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
+26Lines changed: 26 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,12 +25,16 @@ This specification describes the digital relationship between _mobility as a ser
25
25
26
26
The following information applies to all `policy` API endpoints.
27
27
28
+
[Top][toc]
29
+
28
30
### Versioning
29
31
30
32
`policy` APIs must handle requests for specific versions of the specification from clients.
31
33
32
34
Versioning must be implemented as specified in the [Versioning section][versioning].
33
35
36
+
[Top][toc]
37
+
34
38
## Background
35
39
36
40
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 of policies include:
@@ -63,6 +67,8 @@ Policies should be re-fetched whenever:
63
67
64
68
Flat files have an optional `end_date` field that will apply to the file as a whole.
65
69
70
+
[Top][toc]
71
+
66
72
### REST Endpoints
67
73
68
74
Among other use-cases, configuring a REST API allows an Agency to:
|`id`| UUID | Optional | If provided, returns one geography object with the matching UUID; default is to return all geography objects. |
114
120
121
+
[Top][toc]
122
+
115
123
### Flat Files
116
124
117
125
To use flat files, policies shall be represented in two (2) files:
@@ -184,6 +192,8 @@ Response bodies must be a `UTF-8` encoded JSON object and must minimally include
184
192
}
185
193
```
186
194
195
+
[Top][toc]
196
+
187
197
### Policy
188
198
189
199
An individual `Policy` object is defined by the following fields:
@@ -201,6 +211,8 @@ An individual `Policy` object is defined by the following fields:
201
211
|`prev_policies`| UUID[]| Optional | Unique IDs of prior policies replaced by this one |
202
212
|`rules`| Rule[]| Required | List of applicable [Rule](#rules) objects |
203
213
214
+
[Top][toc]
215
+
204
216
### Rules
205
217
206
218
An individual `Rule` object is defined by the following fields:
@@ -225,6 +237,8 @@ An individual `Rule` object is defined by the following fields:
225
237
|`messages`|`{ String:String }`| Optional | Message to rider user, if desired, in various languages, keyed by language tag (see [Messages](#messages)) |
226
238
|`value_url`| URL | Optional | URL to an API endpoint that can provide dynamic information for the measured value (see [Value URL](#value-url)) |
227
239
240
+
[Top][toc]
241
+
228
242
### Rule Types
229
243
230
244
| Name | Description |
@@ -235,6 +249,8 @@ An individual `Rule` object is defined by the following fields:
235
249
|`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 Recurrence](#rate_recurrence). Agencies and Providers must agree on terms of use prior to utilizing the `rate` rule type. |
236
250
|`user`| Information for users, e.g. about helmet laws. Generally can't be enforced via events and telemetry. |
237
251
252
+
[Top][toc]
253
+
238
254
### Rule Units
239
255
240
256
| Name | Description |
@@ -246,6 +262,8 @@ An individual `Rule` object is defined by the following fields:
246
262
|`mph`| Miles per hour |
247
263
|`kph`| Kilometers per hour |
248
264
265
+
[Top][toc]
266
+
249
267
### Geography
250
268
251
269
| Name | Type | Required / Optional | Description |
@@ -258,6 +276,8 @@ An individual `Rule` object is defined by the following fields:
258
276
|`publish_date`|[timestamp][ts]| Required | Timestamp that the policy was published, i.e. made immutable |
259
277
|`prev_geographies`| UUID[]| Optional | Unique IDs of prior geographies replaced by this one |
260
278
279
+
[Top][toc]
280
+
261
281
### Rate Recurrences
262
282
263
283
Rate recurrences specify when a rate is applied – either once, or periodically according to a `time_unit` specified using [Rule Units](#rule-units). A `time_unit` refers to a unit of time as measured in local time for the juristiction – a day begins at midnight local time, an hour begins at the top of the hour, etc.
@@ -268,6 +288,8 @@ Rate recurrences specify when a rate is applied – either once, or periodicall
268
288
|`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`. |
269
289
|`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`. |
270
290
291
+
[Top][toc]
292
+
271
293
### Messages
272
294
273
295
Some Policies as established by the Agency may benefit from rider communication. This optional field contains a map of languages to messages, to be shown to the user.
@@ -283,6 +305,8 @@ Example for a decreased speed-limit rule for Venice Beach on weekends:
283
305
},
284
306
```
285
307
308
+
[Top][toc]
309
+
286
310
### Value URL
287
311
288
312
An Agency may wish to provide dynamic or global rules, e.g.
@@ -299,6 +323,8 @@ The payload returned from a `GET` request to the `value_url` will have the follo
299
323
|`timestamp`|[timestamp][ts]| Required | Timestamp the value was recorded |
300
324
|`policy_id`| UUID | Required | Relevant `policy_id` for reference |
301
325
326
+
[Top][toc]
327
+
302
328
### Order of Operations
303
329
304
330
Rules, being in a list, are ordered **most specific** to **most general**. E.g. an "earlier" rule (lower list index) would take precedence over a "later" rule (higher list index).
0 commit comments