You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: policy/README.md
+30-20Lines changed: 30 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,7 @@ Versioning must be implemented as specified in the [Versioning section][versioni
39
39
40
40
## Background
41
41
42
-
The goal of this specification is to enable Agencies to create, revise, and publish machine-readable policies, as sets of rules for individual and collective device behavior exhibited by both _mobility as a service_ Providers and riders / users. [Examples](examples.md) of policies include:
42
+
The goal of this specification is to enable Agencies to create, revise, and publish machine-readable policies, as sets of rules for individual and collective device behavior exhibited by both _mobility as a service_ Providers and riders / users. [Examples](./examples/README.md) of policies include:
43
43
44
44
- City-wide and localized caps (e.g. "Minimum 500 and maximum 3000 scooters within city boundaries")
45
45
- Exclusion zones (e.g. "No scooters are permitted in this district on weekends")
@@ -50,7 +50,7 @@ The goal of this specification is to enable Agencies to create, revise, and publ
50
50
51
51
The machine-readable format allows Providers to obtain policies and compute compliance where it can be determined entirely by data obtained internally.
52
52
53
-
**See the [Policy Examples](examples.md) for ways these can be implemented.**
53
+
**See the [Policy Examples](./examples/README.md) for ways these can be implemented.**
54
54
55
55
[Top][toc]
56
56
@@ -139,7 +139,7 @@ The `updated` field in the payload wrapper should be set to the time of publishi
139
139
140
140
#### Example `policies.json`
141
141
142
-
```json
142
+
```jsonc
143
143
{
144
144
"version":"0.4.0",
145
145
"updated":1570035222868,
@@ -161,7 +161,7 @@ The optional `end_date` field applies to all policies represented in the file.
161
161
162
162
#### Example `geographies.json`
163
163
164
-
```json
164
+
```jsonc
165
165
{
166
166
"version":"0.4.0",
167
167
"updated":1570035222868,
@@ -186,7 +186,7 @@ All response fields must use `lower_case_with_underscores`.
186
186
187
187
Response bodies must be a `UTF-8` encoded JSON object and must minimally include the MDS `version`, a timestamp indicating the last time the data was `updated`, and a `data` payload:
188
188
189
-
```json
189
+
```jsonc
190
190
{
191
191
"version":"x.y.z",
192
192
"updated":1570035222868,
@@ -196,6 +196,12 @@ Response bodies must be a `UTF-8` encoded JSON object and must minimally include
196
196
}
197
197
```
198
198
199
+
### JSON Schema
200
+
201
+
The JSON Schema file is available in this repository: [`policy.json`](./policy.json).
202
+
203
+
Before publishing a new Policy document, the document should be validated against the schema to ensure it has the correct format and fields.
204
+
199
205
[Top][toc]
200
206
201
207
### Policy
@@ -208,7 +214,7 @@ An individual `Policy` object is defined by the following fields:
208
214
|`policy_id`| UUID | Required | Unique ID of policy |
209
215
|`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). |
210
216
|`description`| String | Required | Description of policy |
211
-
|`currency`| String | Optional | An ISO 4217 Alphabetic Currency Code representing the [currency](../provider#costs--currencies) of all Rules of [type](#rule-types)`rate`.|
217
+
|`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`.|
212
218
|`start_date`|[timestamp][ts]| Required | Beginning date/time of policy enforcement |
213
219
|`end_date`|[timestamp][ts]| Optional | End date/time of policy enforcement |
214
220
|`published_date`|[timestamp][ts]| Required | Timestamp that the policy was published |
@@ -227,8 +233,8 @@ An individual `Rule` object is defined by the following fields:
227
233
|`rule_id`| UUID | Required | Unique ID of the rule |
228
234
|`rule_type`| enum | Required | Type of policy (see [Rule Types](#rule-types)) |
229
235
|`geographies`| UUID[]| Required | List of Geography UUIDs (non-overlapping) specifying the covered geography |
230
-
|`states`|`{ state: event[] }`| Required |[Vehicle state][vehicle-states] to which this rule applies. Optionally provide a list of specific [vehicle events][#vehicle-events] as a subset of a given status for the rule to apply to. An empty list or `null`/absent defaults to "all". |
231
-
|`rule_units`| enum | Required | Measured units of policy (see [Rule Units](#rule-units)) |
236
+
|`states`|`{ state: event[] }`| Required |[Vehicle state][vehicle-states] to which this rule applies. Optionally provide a list of specific [vehicle events][#vehicle-events] as a subset of a given status for the rule to apply to. An empty list or `null`/absent defaults to "all". |
237
+
|`rule_units`| enum |Conditionally Required | Measured units of policy (see [Rule Units](#rule-units)) |
|`amount`|`rate`| Cost (in [local currency](/general-information.md#costs-and-currencies)) |
273
+
|`mph`|`speed`| Miles per hour |
274
+
|`kph`|`speed`| Kilometers per hour |
275
+
|`devices`|`count`| Devices |
276
+
277
+
[Rule type](#rule-types)`user` has no associated Rule units; `rule_units` is not required when the Rule type is `user`.
270
278
271
279
[Top][toc]
272
280
@@ -290,9 +298,9 @@ Rate recurrences specify when a rate is applied – either once, or periodicall
290
298
291
299
| Name | Description |
292
300
| --------- | ------------------- |
293
-
|`once`| Rate is applied once to vehicles entering a matching status from a non-matching status. |
301
+
|`once`| Rate is applied once to vehicles entering a matching status from a non-matching status. |
294
302
|`each_time_unit`| During each `time_unit`, rate is applied once to vehicles entering or remaining in a matching status. Requires a `time_unit` to be specified using `rule_units`. |
295
-
|`per_complete_time_unit`| Rate is applied once per complete `time_unit` that vehicles remain in a matching status. Requires a `time_unit` to be specified using `rule_units`. |
303
+
|`per_complete_time_unit`| Rate is applied once per complete `time_unit` that vehicles remain in a matching status. Requires a `time_unit` to be specified using `rule_units`. |
296
304
297
305
[Top][toc]
298
306
@@ -344,9 +352,11 @@ The internal mechanics of ordering are up to the Policy editing and hosting soft
0 commit comments