From 787baf59c304d3470095fa3cfd4c1903657fb9aa Mon Sep 17 00:00:00 2001 From: Marie Maxham Date: Tue, 6 Dec 2022 08:12:28 -0600 Subject: [PATCH 1/6] remove 'rate' rule-type, since we can put $$ on any rule --- policy/README.md | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/policy/README.md b/policy/README.md index ee74c585..fefed8d2 100644 --- a/policy/README.md +++ b/policy/README.md @@ -267,7 +267,7 @@ An individual `Policy` object is defined by the following fields: | `policy_id` | UUID | Required | Unique ID of policy | | `provider_ids` | UUID[] | Optional | Providers for whom this policy is applicable; empty arrays and `null`/absent implies all Providers. See MDS [provider list](/providers.csv). | | `description` | String | Required | Description of policy | -| `currency` | String | Optional | An ISO 4217 Alphabetic Currency Code representing the [currency](../general-information.md#costs-and-currencies) of all Rules of [type](#rule-types) `rate`.| +| `currency` | String | Optional | An ISO 4217 Alphabetic Currency Code representing the [currency](../general-information.md#costs-and-currencies) of all Rules with `rate_amount`.| | `start_date` | [timestamp][ts] | Required | Beginning date/time of policy enforcement. In order to give providers sufficient time to poll, `start_date` must be at least 20 minutes after `published_date`. | | `end_date` | [timestamp][ts] | Optional | End date/time of policy enforcement | | `published_date` | [timestamp][ts] | Required | Timestamp that the policy was published | @@ -313,7 +313,6 @@ An individual `Rule` object is defined by the following fields: | `count` | Fleet counts based on regions. Rule `minimum`/`maximum` refers to number of devices in [Rule Units](#rule-units). | | `time` | Individual limitations or fees based upon time spent in one or more vehicle states. Rule `minimum`/`maximum` refers to increments of time in [Rule Units](#rule-units). | | `speed` | Global or local speed limits. Rule `minimum`/`maximum` refers to speed in [Rule Units](#rule-units). | -| `rate` | **[Beta feature](/general-information.md#beta-features):** *Yes (as of 1.0.0)*. Fees or subsidies based on regions and time spent in one or more vehicle states. Rule `rate_amount` refers to the rate charged according to the [Rate Recurrences](#rate_recurrences) and the [currency requirements](/general-information.md#costs-and-currencies) in [Rule Units](#rule-units). *Prior to implementation agencies should consult with providers to discuss how the `rate` rule will be used. Most agencies do this as a matter of course, but it is particularly important to communicate in advance how frequently and in what ways rates might change over time.* | | `user` | Information for users, e.g. about helmet laws. Generally can't be enforced via events and telemetry. | [Top][toc] @@ -322,11 +321,11 @@ An individual `Rule` object is defined by the following fields: | Name | Rule Types | Description | | --------- | ---------------------- | ------------------- | -| `seconds` | `rate`, `time` | Seconds | -| `minutes` | `rate`, `time` | Minutes | -| `hours` | `rate`, `time` | Hours | -| `days` | `rate`, `time` | Days | -| `amount` | `rate` | Cost (in [local currency](/general-information.md#costs-and-currencies)) | +| `seconds` | `time` . | Seconds | +| `minutes` | `time` . | Minutes | +| `hours` | `time` . | Hours | +| `days` | `time` . | Days | +| `amount` | all | Cost (in [local currency](/general-information.md#costs-and-currencies)) | | `mph` | `speed` | Miles per hour | | `kph` | `speed` | Kilometers per hour | | `devices` | `count` | Devices | @@ -352,9 +351,9 @@ An individual `Rule` object is defined by the following fields: [Top][toc] ### Rates -Rate-related properties can currently be specified on `rate` and `time` Rules. Note: A future MDS version will likely support rates for `count` and `speed` rules, but their behavior is currently undefined. +Rate-related properties can currently be specified on any policy with a `rate_amount`. -**[Beta feature](/general-information.md#beta-features)**: *Yes (as of 1.0.0)*. [Leave feedback](https://github.com/openmobilityfoundation/mobility-data-specification/issues/674) +(?) TODO define how rate_amount is applied to `count` and `speed` rules #### Rate Amounts The amount of a rate applied when this rule applies, if applicable (default zero). A positive integer rate amount represents a fee, while a negative integer represents a subsidy. Rate amounts are given in the `currency` defined in the [Policy](#policy). @@ -376,7 +375,7 @@ Rate recurrences specify how a rate is applied – either once, or periodically The `rate_applies_when` field specifies when a rate should be applied to an event or count, e.g. is it when the event is within the Rule bounds or when it is outside? -It defaults to `out_of_bounds`. +Default is `out_of_bounds`. The `rate_applies_when` field may take the following values: From 4eec0b5cfec454c06f222d3e2005f4dd5179d182 Mon Sep 17 00:00:00 2001 From: Marie Maxham Date: Tue, 6 Dec 2022 08:16:42 -0600 Subject: [PATCH 2/6] typo --- policy/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/policy/README.md b/policy/README.md index fefed8d2..c30ec82a 100644 --- a/policy/README.md +++ b/policy/README.md @@ -321,10 +321,10 @@ An individual `Rule` object is defined by the following fields: | Name | Rule Types | Description | | --------- | ---------------------- | ------------------- | -| `seconds` | `time` . | Seconds | -| `minutes` | `time` . | Minutes | -| `hours` | `time` . | Hours | -| `days` | `time` . | Days | +| `seconds` | `time` | Seconds | +| `minutes` | `time` | Minutes | +| `hours` | `time` | Hours | +| `days` | `time` | Days | | `amount` | all | Cost (in [local currency](/general-information.md#costs-and-currencies)) | | `mph` | `speed` | Miles per hour | | `kph` | `speed` | Kilometers per hour | From 7f43a8c1d20f84e150a08e8a91e10185e8f43c6c Mon Sep 17 00:00:00 2001 From: Marie Maxham Date: Tue, 6 Dec 2022 14:13:48 -0600 Subject: [PATCH 3/6] no-mo-beta remove "amount" as a measurement --- policy/README.md | 2 + policy/policy.json | 4 +- schema/templates/policy/policy.json | 58 ++++++++++++++++++++--------- 3 files changed, 44 insertions(+), 20 deletions(-) diff --git a/policy/README.md b/policy/README.md index c30ec82a..1ade3593 100644 --- a/policy/README.md +++ b/policy/README.md @@ -353,6 +353,8 @@ An individual `Rule` object is defined by the following fields: ### Rates Rate-related properties can currently be specified on any policy with a `rate_amount`. +**[Beta feature](/general-information.md#beta-features)**: *No (as of 2.0.0)*. + (?) TODO define how rate_amount is applied to `count` and `speed` rules #### Rate Amounts diff --git a/policy/policy.json b/policy/policy.json index b937f00e..989325bf 100644 --- a/policy/policy.json +++ b/policy/policy.json @@ -107,7 +107,6 @@ "count", "time", "speed", - "rate", "user" ] }, @@ -146,8 +145,7 @@ "days", "mph", "kph", - "devices", - "amount" + "devices" ] }, "vehicle_types": { diff --git a/schema/templates/policy/policy.json b/schema/templates/policy/policy.json index 408b8818..5156d3e1 100644 --- a/schema/templates/policy/policy.json +++ b/schema/templates/policy/policy.json @@ -28,7 +28,7 @@ "$ref": "#/definitions/uuid", "description": "Unique ID of policy" }, - "provider_ids":{ + "provider_ids": { "$id": "#/definitions/policy/properties/provider_ids", "$ref": "#/definitions/null_uuid_array", "description": "Providers for whom this policy is applicable; empty arrays and null/absent implies all Providers.", @@ -43,7 +43,7 @@ "$id": "#/definitions/policy/properties/currency", "$ref": "#/definitions/currency" }, - "start_date":{ + "start_date": { "$id": "#/definitions/policy/properties/start_date", "$ref": "#/definitions/timestamp", "description": "Beginning date/time of policy enforcement" @@ -126,8 +126,7 @@ "$id": "#/definitions/rule/properties/states/propertyNames", "$ref": "#/definitions/vehicle_state" }, - "properties": { - }, + "properties": {}, "additionalProperties": { "type": "array", "uniqueItems": true, @@ -147,8 +146,7 @@ "days", "mph", "kph", - "devices", - "amount" + "devices" ] }, "vehicle_types": { @@ -163,32 +161,50 @@ }, "minimum": { "$id": "#/definitions/rule/properties/minimum", - "type": ["null", "integer"], + "type": [ + "null", + "integer" + ], "description": "Minimum value, if applicable (default 0)" }, "maximum": { "$id": "#/definitions/rule/properties/maximum", - "type": ["null", "integer"], + "type": [ + "null", + "integer" + ], "description": "Maximum value, if applicable (default unlimited)" }, "inclusive_minimum": { "$id": "#/definitions/rule/properties/inclusive_minimum", - "type": ["null", "boolean"], + "type": [ + "null", + "boolean" + ], "description": "Whether the rule minimum is considered in-bounds (default true)" }, "inclusive_maximum": { "$id": "#/definitions/rule/properties/inclusive_maximum", - "type": ["null", "boolean"], + "type": [ + "null", + "boolean" + ], "description": "Whether the rule maximum is considered in-bounds (default true)" }, "rate_amount": { "$id": "#/definitions/rule/properties/rate_amount", - "type": ["null", "integer"], + "type": [ + "null", + "integer" + ], "description": "The amount of a rate applied when this rule applies, if applicable (default zero). A positive integer rate amount represents a fee, while a negative integer represents a subsidy. Rate amounts are given in the currency defined in the Policy." }, "rate_recurrence": { "$id": "#/definitions/rule/properties/rate_recurrence", - "type": ["string", "null"], + "type": [ + "string", + "null" + ], "description": "Specify how a rate is applied – either once, or periodically according to a time unit specified using rule_units", "enum": [ "once_on_match", @@ -199,7 +215,10 @@ }, "rate_applies_when": { "$id": "#/definitions/rule/properties/rate_applies_when", - "type": ["string", "null"], + "type": [ + "string", + "null" + ], "description": "Specify when a rate is applicable to an event or count: when it's within rule bounds or when it is not", "enum": [ "in_bounds", @@ -223,7 +242,10 @@ }, "messages": { "$id": "#/definitions/rule/properties/messages", - "type": ["null", "object"], + "type": [ + "null", + "object" + ], "description": "Message to rider user, if desired, in various languages, keyed by BCP 47 language tag", "propertyNames": { "pattern": "([A-Za-z]{2,3})([-][A-Za-z]{3}){0,3}([-]([A-Za-z]{4}))?([-]([A-Za-z]{2}|[0-9]{3}))?" @@ -231,7 +253,10 @@ }, "value_url": { "$id": "#/definitions/rule/properties/value_url", - "type": ["null", "string"], + "type": [ + "null", + "string" + ], "description": "URL to an API endpoint that can provide dynamic information for the measured value", "format": "uri" } @@ -307,7 +332,6 @@ }, "rule_units": { "enum": [ - "amount", "seconds", "minutes", "hours", @@ -368,4 +392,4 @@ } }, "additionalProperties": false -} +} \ No newline at end of file From 9ede1857462dd7f27c669448b1ad44415357861a Mon Sep 17 00:00:00 2001 From: Marie Maxham Date: Tue, 6 Dec 2022 15:17:50 -0600 Subject: [PATCH 4/6] update examples --- policy/examples/README.md | 14 +++++++++----- policy/examples/metered-parking-fees.json | 4 +++- policy/examples/per-trip-fees.json | 3 +-- policy/examples/vehicle-row-fees.json | 6 ++++-- policy/policy.json | 3 +-- schema/templates/policy/policy.json | 3 +-- 6 files changed, 19 insertions(+), 14 deletions(-) diff --git a/policy/examples/README.md b/policy/examples/README.md index 72f178f0..217a814d 100644 --- a/policy/examples/README.md +++ b/policy/examples/README.md @@ -271,8 +271,7 @@ File: [`per-trip-fees.json`](per-trip-fees.json) { "name": "City Wide Trip Fee", "rule_id": "4137a47c-836a-11ea-bc55-0242ac130003", - "rule_type": "rate", - "rule_units": "amount", + "rule_type": "count", "rate_amount": 25, "rate_recurrence": "once_on_match", "geographies": [ @@ -309,7 +308,9 @@ File: [`vehicle-row-fees.json`](vehicle-row-fees.json) { "rule_id": "96033eb2-eff7-4ed3-bb93-0101aff3bb6a", "name": "Downtown Right of Way Fee", - "rule_type": "rate", + "rule_type": "time", + "rule_unit": "day", + "maximum": 0, "rate_amount": 25, "rate_recurrence": "each_time_unit", "rule_units": "days", @@ -325,7 +326,9 @@ File: [`vehicle-row-fees.json`](vehicle-row-fees.json) { "rule_id": "62778174-97f6-4a2b-a949-070709b4190a", "name": "Decreased Right of Way Fee", - "rule_type": "rate", + "rule_type": "time", + "rule_unit": "day", + "maximum": 0, "rate_amount": 5, "rate_recurrence": "each_time_unit", "rule_units": "days", @@ -363,7 +366,8 @@ File: [`metered-parking-fees.json`](metered-parking-fees.json) { "rule_id": "0da40491-73eb-418f-9b3c-cf5f150775e8", "name": "Downtown Peak-Hour Parking Fee", - "rule_type": "rate", + "rule_type": "time", + "minimum": 0, "rate_amount": 10, "rate_recurrence": "per_complete_time_unit", "rule_units": "hours", diff --git a/policy/examples/metered-parking-fees.json b/policy/examples/metered-parking-fees.json index a12a07a0..87b0a042 100644 --- a/policy/examples/metered-parking-fees.json +++ b/policy/examples/metered-parking-fees.json @@ -15,7 +15,9 @@ { "rule_id": "0da40491-73eb-418f-9b3c-cf5f150775e8", "name": "Downtown Peak-Hour Parking Fee", - "rule_type": "rate", + "rule_type": "time", + "maximum": "1", + "rule_unit": "hour", "rate_amount": 10, "rate_recurrence": "per_complete_time_unit", "rule_units": "hours", diff --git a/policy/examples/per-trip-fees.json b/policy/examples/per-trip-fees.json index d48de4cc..fa978594 100644 --- a/policy/examples/per-trip-fees.json +++ b/policy/examples/per-trip-fees.json @@ -15,8 +15,7 @@ { "name": "City Wide Trip Fee", "rule_id": "4137a47c-836a-11ea-bc55-0242ac130003", - "rule_type": "rate", - "rule_units": "amount", + "rule_type": "count", "rate_amount": 25, "rate_recurrence": "once", "geographies": [ diff --git a/policy/examples/vehicle-row-fees.json b/policy/examples/vehicle-row-fees.json index ec6ea351..be3f808c 100644 --- a/policy/examples/vehicle-row-fees.json +++ b/policy/examples/vehicle-row-fees.json @@ -15,10 +15,11 @@ { "rule_id": "96033eb2-eff7-4ed3-bb93-0101aff3bb6a", "name": "Downtown Right of Way Fee", - "rule_type": "rate", + "rule_type": "time", "rate_amount": 25, "rate_recurrence": "each_time_unit", "rule_units": "days", + "minimum": 0, "geographies": [ "1f943d59-ccc9-4d91-b6e2-0c5e771cbc49" ], @@ -31,10 +32,11 @@ { "rule_id": "62778174-97f6-4a2b-a949-070709b4190a", "name": "Decreased Right of Way Fee", - "rule_type": "rate", + "rule_type": "time", "rate_amount": 5, "rate_recurrence": "each_time_unit", "rule_units": "days", + "minimum": 0, "geographies": [ "e3ed0a0e-61d3-4887-8b6a-4af4f3769c14" ], diff --git a/policy/policy.json b/policy/policy.json index 989325bf..4aaa371a 100644 --- a/policy/policy.json +++ b/policy/policy.json @@ -327,11 +327,10 @@ ], "properties": { "rule_type": { - "const": "rate" + "const": "time" }, "rule_units": { "enum": [ - "amount", "seconds", "minutes", "hours", diff --git a/schema/templates/policy/policy.json b/schema/templates/policy/policy.json index 5156d3e1..f7f40c5a 100644 --- a/schema/templates/policy/policy.json +++ b/schema/templates/policy/policy.json @@ -107,7 +107,6 @@ "count", "time", "speed", - "rate", "user" ] }, @@ -328,7 +327,7 @@ ], "properties": { "rule_type": { - "const": "rate" + "const": "time" }, "rule_units": { "enum": [ From 8f9297b534b95593d6c752923f046540438e301e Mon Sep 17 00:00:00 2001 From: Marie Maxham Date: Wed, 7 Dec 2022 13:47:35 -0600 Subject: [PATCH 5/6] clarified some of the rate language; removed 'amount' as a unit --- policy/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/policy/README.md b/policy/README.md index 1ade3593..8d038aa7 100644 --- a/policy/README.md +++ b/policy/README.md @@ -325,7 +325,6 @@ An individual `Rule` object is defined by the following fields: | `minutes` | `time` | Minutes | | `hours` | `time` | Hours | | `days` | `time` | Days | -| `amount` | all | Cost (in [local currency](/general-information.md#costs-and-currencies)) | | `mph` | `speed` | Miles per hour | | `kph` | `speed` | Kilometers per hour | | `devices` | `count` | Devices | @@ -351,11 +350,12 @@ An individual `Rule` object is defined by the following fields: [Top][toc] ### Rates -Rate-related properties can currently be specified on any policy with a `rate_amount`. **[Beta feature](/general-information.md#beta-features)**: *No (as of 2.0.0)*. -(?) TODO define how rate_amount is applied to `count` and `speed` rules +Rate-related properties can be specified on any policy rule with a `rate_amount`, with the exception of `user` - `count`, `time` and `speed` can be measured from events and telemetry, but `user` cannot. + +The application of a fee or a fine is triggered zero or more times according to [rate recurrance](#rate-recurrences). #### Rate Amounts The amount of a rate applied when this rule applies, if applicable (default zero). A positive integer rate amount represents a fee, while a negative integer represents a subsidy. Rate amounts are given in the `currency` defined in the [Policy](#policy). From 3a18f10657e5bc62e0401ac978361b63b6eb933d Mon Sep 17 00:00:00 2001 From: Michael Schnuerle <1285077+schnuerle@users.noreply.github.com> Date: Mon, 9 Jan 2023 20:44:48 -0500 Subject: [PATCH 6/6] Upgrading version --- policy/examples/metered-parking-fees.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/policy/examples/metered-parking-fees.json b/policy/examples/metered-parking-fees.json index 87b0a042..b0dac797 100644 --- a/policy/examples/metered-parking-fees.json +++ b/policy/examples/metered-parking-fees.json @@ -1,6 +1,6 @@ { "updated": 0, - "version": "1.2.0", + "version": "2.0.0", "data": { "policies": [ {