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
The Policy API endpoints are intended to be implemented by regulatory agencies and consumed by mobility providers. Providers query the Policy API to get information about local rules that may affect the operation of their mobility service or which may be used to determine compliance.
5
+
The Policy API endpoints are intended to be implemented by regulatory agencies and consumed by mobility providers across all supported MDS [modes](../modes#list-of-supported-modes) and services (scooters, bikeshare, car share, delivery robots, taxis, TNCs, autonomous vehicles, agency fleets, commuter shuttles, etc). Providers query the Policy API to get information about local rules that may affect the operation of their mobility service or which may be used to determine compliance.
6
6
7
7
This specification describes the digital relationship between _mobility as a service_ providers and the agencies that regulate them. The Policy API communicates municipal policies (such as as vehicle deployment caps and speed limits) in a clear, consistent manner.
8
8
@@ -37,12 +37,12 @@ This specification describes the digital relationship between _mobility as a ser
@@ -57,35 +57,39 @@ The following information applies to all `policy` API endpoints.
57
57
58
58
### Background
59
59
60
-
The goal of the Policy API 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:
60
+
The goal of the Policy API specification is to enable public agencies to create, revise, and publish machine-readable policies (in near real-time if needed), 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:
61
61
62
62
- City-wide and localized caps (e.g. "Minimum 500 and maximum 3000 scooters within city boundaries")
63
63
- Exclusion zones (e.g. "No scooters are permitted in this district on weekends")
64
64
- Cap allowances (e.g. "Up to 500 additional scooters are permitted near train stations")
- Idle-time and disabled-time limitations (e.g. "5 days idle while rentable, 12 hours idle while unrentable, per device")
67
67
- Trip fees and subsidies (e.g. "A 25 cent fee applied when a trip ends downtown")
68
+
- Real-time emergency notifications (e.g. "A no travel geofence around a fire reported by a 911 call")
69
+
- Large event policy rules (e.g. "No AVs or carshare near a planned stadium event, but 25 cent bikeshare subsidy when trips end near event")
68
70
69
71
The machine-readable format allows Providers to obtain policies and compute compliance where it can be determined entirely by data obtained internally, and know what data is required from them and provided to them.
70
72
71
73
[Top][toc]
72
74
73
75
### Policy Examples
74
76
75
-
See the [Policy Examples](./examples/README.md)for ways Policy can be implemented.
77
+
See the [MDS Policy Examples](https://github.com/openmobilityfoundation/mobility-data-specification/wiki/MDS-Policy-Examples) wiki page for code examples of specific MDS Policy use cases, ideas on how Policy can be implemented.
76
78
77
79
[Top][toc]
78
80
79
81
### Authorization
80
82
81
-
The Policy endpoints should be made public. Authorization is not required.
83
+
The Policy endpoints should be made public. Authorization is not required. Agencies may make reasonable accommodations to manage their endpoints, for example, using an API key that has a clear, public way to obtain - this can be useful for rate limiting requests, ensure proper use, tracking access per requestor, and/or customization of the Policy tailored to the requestor.
82
84
83
85
[Top][toc]
84
86
85
87
### Update Frequency
86
88
87
89
The publishing agency should establish beforehand and communicate to providers how frequently the Policy endpoints are expected to change, how often they should be polled to get the latest information, and expectations around emergency updates.
88
90
91
+
For real-time uses of MDS Policy, public agencies should set a recommended minimum threshold (eg, every 1 minute at most).
92
+
89
93
[Top][toc]
90
94
91
95
### Updating or Ending Policies
@@ -110,12 +114,15 @@ Policies shall be published by regulatory bodies or their authorized delegates a
110
114
111
115
Policies typically refer to one or more associated geographies. Geographic information is obtained from the MDS [Geography](/geography) API. Each policy and geography shall have a unique ID (UUID).
112
116
117
+
Policies must be unique. A Policy may not have the exact same [Policy](#policy) object field values with a different `policy_id`. For example if the required or optional fields have the same values (either exactly identical or functionally identical), it is considered the same Policy and must not be duplicated as two different policies in the Policy payload.
118
+
113
119
Geographical data shall be represented as GeoJSON `Feature` objects. No part of the geographical data should be outside the [municipality boundary][muni-boundary].
114
120
115
121
Policies should be re-fetched whenever:
116
122
117
123
1. a policy expires (via its `end_date`), or
118
124
2. at an interval specified by the regulatory body, e.g. "daily at midnight".
125
+
3. when the `last_updated` timestamp is newer than the previously fetched timestamp
119
126
120
127
Flat files have an optional `end_date` field that will apply to the file as a whole.
121
128
@@ -127,7 +134,7 @@ Among other use-cases, configuring a REST API allows an Agency to:
127
134
128
135
1. Dynamically adjust caps
129
136
2. Set Provider specific policies
130
-
3. Adjust other attributes in closer to realtime
137
+
3. Adjust other attributes in close to real-time
131
138
4. Enumerate when policies are set to change
132
139
133
140
Responses must set the `Content-Type` header, as specified in the [versioning][versioning] section.
@@ -159,6 +166,8 @@ _Query Parameters:_
159
166
|`policy_id`| UUID | Optional | If provided, returns one policy object with the matching UUID; default is to return all policy objects. |
160
167
|`start_date`|[timestamp][ts]| Optional | Beginning date of the queried time range; the default value is the request time |
161
168
|`end_date`|[timestamp][ts]| Optional | Ending date of the queried time range; the default value is null, which captures all policies that are effective in the future|
169
+
|`last_updated`| Boolean | Optional | If true, the endpoint only returns two fields: `version`, `last_updated`. Useful to quickly check when any data in the file has last been changed, without downloading the entire Policy payload. See the [Schema](#schema) section for an example. If not provided, value is false. |
170
+
|`active_only`| Boolean | Optional | If true, return only the current active and future policies, not the retired/previous policies. Any policy that is a prev_policies would not be returned. However, the array of prev_policies still will be returned for reference as part of any relevant active policy. Useful to reduce the Policy payload size for use cases where you do not need to know the previous policy details. If not provided, value is false. |
162
171
163
172
`start_date` and `end_date` are only considered when no `id` parameter is provided. They should return any policy whose effectiveness overlaps with or is contained with this range. Suppose there's a policy with a `start_date` of 1/1/21 and `end_date` of 1/31/21. Assuming an `end_date` that is null, 12/1/20 and 1/5/21 `start_dates` will return the policy, but 2/10/21 wouldn't. Assuming a `start_date` parameter of say, 11/1/20, then an `end_date` of 12/1/20 wouldn't return the policy, but 1/5/21 and 2/10/21 would. Lastly, a `start_date` of 1/5/21 and `end_date` of 1/6/21 would also return the policy. Please note also that while dates in the format MM:DD:YY are being used here, `start_date` and `end_date` must be numbers representing milliseconds since the Unix epoch time.
164
173
@@ -286,6 +295,8 @@ Response bodies must be a `UTF-8` encoded JSON object and must minimally include
286
295
}
287
296
```
288
297
298
+
Note that `data` payload will not be returned if the `last_updated` query string parameter is set to true.
299
+
289
300
### Data Schema
290
301
291
302
See the [Endpoints](#endpoints) below for information on their specific schema, and the [`mds-openapi`](https://github.com/openmobilityfoundation/mds-openapi) repository for full details and interactive documentation.
@@ -458,6 +469,59 @@ The internal mechanics of ordering are up to the Policy editing and hosting soft
A public agency's Policy program Requirements endpoint enumerates all of the parts of MDS, [CDS](https://github.com/openmobilityfoundation/curb-data-specification), GBFS, and other specifications that an agency requires from providers for certain programs, including APIs, endpoints, and optional fields, as well as information for providers about the APIs the agency is hosting. The program requirements are specific to the needs and use cases of each agency, and ensure there is clarity on what data is being asked for in operating policy documents from providers, reducing the burden on both. This also allows additional public transparency and accountability around data requirements from agencies, and encourages privacy by allowing agencies to ask for only the data they need.
@@ -468,7 +532,7 @@ Requirements can also be used to define a scaled-down MDS implementation in situ
468
532
469
533
#### Examples
470
534
471
-
See [Policy Requirements Examples](/policy/examples/requirements.md)for ideas on how this can be implemented.
535
+
See the [MDS Policy Examples](https://github.com/openmobilityfoundation/mobility-data-specification/wiki/MDS-Policy-Requirements-Examples) wiki page for code examples of specific MDS Policy Requirements use cases, ideas on how Requirements can be implemented.
0 commit comments