Skip to content

Commit 8a83e1f

Browse files
authored
Merge pull request #817 from openmobilityfoundation/feature-remove-rate-policy-type
Remove 'rate' rule-type, since we can put rate_amount on any rule
2 parents 3e47dbd + 198af64 commit 8a83e1f

3 files changed

Lines changed: 53 additions & 37 deletions

File tree

policy/README.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ An individual `Policy` object is defined by the following fields:
267267
| `policy_id` | UUID | Required | Unique ID of policy |
268268
| `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). |
269269
| `description` | String | Required | Description of policy |
270-
| `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`.|
270+
| `currency` | String | Optional | An ISO 4217 Alphabetic Currency Code representing the [currency](../general-information.md#costs-and-currencies) of all Rules with a `rate_amount`.|
271271
| `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`. |
272272
| `end_date` | [timestamp][ts] | Optional | End date/time of policy enforcement |
273273
| `published_date` | [timestamp][ts] | Required | Timestamp that the policy was published |
@@ -313,23 +313,21 @@ An individual `Rule` object is defined by the following fields:
313313
| `count` | Fleet counts based on regions. Rule `minimum`/`maximum` refers to number of devices in [Rule Units](#rule-units). |
314314
| `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). |
315315
| `speed` | Global or local speed limits. Rule `minimum`/`maximum` refers to speed in [Rule Units](#rule-units). |
316-
| `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.* |
317316
| `user` | Information for users, e.g. about helmet laws. Generally can't be enforced via events and telemetry. |
318317

319318
[Top][toc]
320319

321320
### Rule Units
322321

323-
| Name | Rule Types | Description |
324-
| --------- | ---------------------- | ------------------- |
325-
| `seconds` | `rate`, `time` | Seconds |
326-
| `minutes` | `rate`, `time` | Minutes |
327-
| `hours` | `rate`, `time` | Hours |
328-
| `days` | `rate`, `time` | Days |
329-
| `amount` | `rate` | Cost (in [local currency](/general-information.md#costs-and-currencies)) |
330-
| `mph` | `speed` | Miles per hour |
331-
| `kph` | `speed` | Kilometers per hour |
332-
| `devices` | `count` | Devices |
322+
| Name | Rule Types | Description |
323+
| --------- | -------------- | ------------------- |
324+
| `seconds` | `time` | Seconds |
325+
| `minutes` | `time` | Minutes |
326+
| `hours` | `time` | Hours |
327+
| `days` | `time` | Days |
328+
| `mph` | `speed` | Miles per hour |
329+
| `kph` | `speed` | Kilometers per hour |
330+
| `devices` | `count` | Devices |
333331

334332
[Rule type](#rule-types) `user` has no associated Rule units; `rule_units` is not required when the Rule type is `user`.
335333

@@ -352,9 +350,9 @@ An individual `Rule` object is defined by the following fields:
352350
[Top][toc]
353351

354352
### Rates
355-
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.
353+
Rate-related properties can currently be specified on all rule types except `user`, i.e. any rule that can be measured.
356354

357-
**[Beta feature](/general-information.md#beta-features)**: *Yes (as of 1.0.0)*. [Leave feedback](https://github.com/openmobilityfoundation/mobility-data-specification/issues/674)
355+
**[Beta feature](/general-information.md#beta-features)**: *No (as of 2.0.0)*. [Leave feedback](https://github.com/openmobilityfoundation/mobility-data-specification/issues/674)
358356

359357
#### Rate Amounts
360358
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).

policy/policy.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@
107107
"count",
108108
"time",
109109
"speed",
110-
"rate",
111110
"user"
112111
]
113112
},
@@ -328,9 +327,6 @@
328327
"rate_recurrence"
329328
],
330329
"properties": {
331-
"rule_type": {
332-
"const": "rate"
333-
},
334330
"rule_units": {
335331
"enum": [
336332
"amount",
@@ -646,4 +642,4 @@
646642
}
647643
},
648644
"additionalProperties": false
649-
}
645+
}

schema/templates/policy/policy.json

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"$ref": "#/definitions/uuid",
2929
"description": "Unique ID of policy"
3030
},
31-
"provider_ids":{
31+
"provider_ids": {
3232
"$id": "#/definitions/policy/properties/provider_ids",
3333
"$ref": "#/definitions/null_uuid_array",
3434
"description": "Providers for whom this policy is applicable; empty arrays and null/absent implies all Providers.",
@@ -43,7 +43,7 @@
4343
"$id": "#/definitions/policy/properties/currency",
4444
"$ref": "#/definitions/currency"
4545
},
46-
"start_date":{
46+
"start_date": {
4747
"$id": "#/definitions/policy/properties/start_date",
4848
"$ref": "#/definitions/timestamp",
4949
"description": "Beginning date/time of policy enforcement"
@@ -107,7 +107,6 @@
107107
"count",
108108
"time",
109109
"speed",
110-
"rate",
111110
"user"
112111
]
113112
},
@@ -126,8 +125,7 @@
126125
"$id": "#/definitions/rule/properties/states/propertyNames",
127126
"$ref": "#/definitions/vehicle_state"
128127
},
129-
"properties": {
130-
},
128+
"properties": {},
131129
"additionalProperties": {
132130
"type": "array",
133131
"uniqueItems": true,
@@ -163,32 +161,50 @@
163161
},
164162
"minimum": {
165163
"$id": "#/definitions/rule/properties/minimum",
166-
"type": ["null", "integer"],
164+
"type": [
165+
"null",
166+
"integer"
167+
],
167168
"description": "Minimum value, if applicable (default 0)"
168169
},
169170
"maximum": {
170171
"$id": "#/definitions/rule/properties/maximum",
171-
"type": ["null", "integer"],
172+
"type": [
173+
"null",
174+
"integer"
175+
],
172176
"description": "Maximum value, if applicable (default unlimited)"
173177
},
174178
"inclusive_minimum": {
175179
"$id": "#/definitions/rule/properties/inclusive_minimum",
176-
"type": ["null", "boolean"],
180+
"type": [
181+
"null",
182+
"boolean"
183+
],
177184
"description": "Whether the rule minimum is considered in-bounds (default true)"
178185
},
179186
"inclusive_maximum": {
180187
"$id": "#/definitions/rule/properties/inclusive_maximum",
181-
"type": ["null", "boolean"],
188+
"type": [
189+
"null",
190+
"boolean"
191+
],
182192
"description": "Whether the rule maximum is considered in-bounds (default true)"
183193
},
184194
"rate_amount": {
185195
"$id": "#/definitions/rule/properties/rate_amount",
186-
"type": ["null", "integer"],
196+
"type": [
197+
"null",
198+
"integer"
199+
],
187200
"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."
188201
},
189202
"rate_recurrence": {
190203
"$id": "#/definitions/rule/properties/rate_recurrence",
191-
"type": ["string", "null"],
204+
"type": [
205+
"string",
206+
"null"
207+
],
192208
"description": "Specify how a rate is applied – either once, or periodically according to a time unit specified using rule_units",
193209
"enum": [
194210
"once_on_match",
@@ -199,7 +215,10 @@
199215
},
200216
"rate_applies_when": {
201217
"$id": "#/definitions/rule/properties/rate_applies_when",
202-
"type": ["string", "null"],
218+
"type": [
219+
"string",
220+
"null"
221+
],
203222
"description": "Specify when a rate is applicable to an event or count: when it's within rule bounds or when it is not",
204223
"enum": [
205224
"in_bounds",
@@ -223,15 +242,21 @@
223242
},
224243
"messages": {
225244
"$id": "#/definitions/rule/properties/messages",
226-
"type": ["null", "object"],
245+
"type": [
246+
"null",
247+
"object"
248+
],
227249
"description": "Message to rider user, if desired, in various languages, keyed by BCP 47 language tag",
228250
"propertyNames": {
229251
"pattern": "([A-Za-z]{2,3})([-][A-Za-z]{3}){0,3}([-]([A-Za-z]{4}))?([-]([A-Za-z]{2}|[0-9]{3}))?"
230252
}
231253
},
232254
"value_url": {
233255
"$id": "#/definitions/rule/properties/value_url",
234-
"type": ["null", "string"],
256+
"type": [
257+
"null",
258+
"string"
259+
],
235260
"description": "URL to an API endpoint that can provide dynamic information for the measured value",
236261
"format": "uri"
237262
}
@@ -302,9 +327,6 @@
302327
"rate_recurrence"
303328
],
304329
"properties": {
305-
"rule_type": {
306-
"const": "rate"
307-
},
308330
"rule_units": {
309331
"enum": [
310332
"amount",
@@ -368,4 +390,4 @@
368390
}
369391
},
370392
"additionalProperties": false
371-
}
393+
}

0 commit comments

Comments
 (0)