Skip to content

Commit 359a86c

Browse files
authored
Merge pull request #796 from openmobilityfoundation/feature-agency-provider-api-alignment
Provider/Agency API alignment
2 parents 8a83e1f + c1b238d commit 359a86c

6 files changed

Lines changed: 487 additions & 541 deletions

File tree

agency/README.md

Lines changed: 92 additions & 244 deletions
Large diffs are not rendered by default.

data-types.md

Lines changed: 259 additions & 0 deletions
Large diffs are not rendered by default.

general-information.md

Lines changed: 47 additions & 162 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ This document contains specifications that are shared between the various MDS [A
66

77
- [Beta Features](#beta-features)
88
- [Costs and Currencies](#costs-and-currencies)
9+
- [Data Types](#data-types)
910
- [Definitions](#definitions)
1011
- [Devices](#devices)
1112
- [Geographic Data](#geographic-data)
@@ -17,20 +18,8 @@ This document contains specifications that are shared between the various MDS [A
1718
- [Responses](#responses)
1819
- [Error Messages](#error-messages)
1920
- [Strings](#strings)
20-
- [Stops](#stops)
21-
- [Stop Status](#stop-status)
22-
- [GBFS Compatibility](#gbfs-compatibility)
2321
- [Timestamps](#timestamps)
2422
- [UUIDs](#uuids)
25-
- [Trips](#trips)
26-
- [Vehicle Characteristics](#vehicle-characteristics)
27-
- [Accessibility Options](#accessibility-options)
28-
- [Propulsion Types](#propulsion-types)
29-
- [Vehicle Types](#vehicle-types)
30-
- [Vehicle States](#vehicle-states)
31-
- [Event Types](#event-types)
32-
- [Vehicle State Events](#vehicle-state-events)
33-
- [State Machine Diagram](#state-machine-diagram)
3423
- [Versioning](#versioning)
3524

3625
## Beta Features
@@ -53,6 +42,12 @@ If the currency field is null, USD cents is implied.
5342

5443
[Top][toc]
5544

45+
## Data Types
46+
47+
Shared data structures including [vehicles](/data-types.md#vehicles), [vehicle events](/data-types.md#vehicle-state-events), [vehicle telemetry](/data-types.md#telemetry-data), and [trips](/data-types.md#trips) can be found in the [Data Types](/data-types.md) page.
48+
49+
[Top][toc]
50+
5651
## Definitions
5752

5853
Defining terminology and abbreviations used throughout MDS.
@@ -77,62 +72,6 @@ Additionally, `device_id` must remain constant for the device's lifetime of serv
7772

7873
References to geographic datatypes (Point, MultiPolygon, etc.) imply coordinates encoded in the [WGS 84 (EPSG:4326)][wgs84] standard GPS or GNSS projection expressed as [Decimal Degrees][decimal-degrees]. When points are used, you may assume a 20 meter buffer around the point when needed.
7974

80-
### Geographic Telemetry Data
81-
82-
Whenever a vehicle location coordinate measurement is presented, it must be represented as a GeoJSON [`Feature`][geojson-feature] object with a corresponding `properties` object with the following properties:
83-
84-
85-
| Field | Type | Required/Optional | Field Description |
86-
| -------------- | --------------- | --------------------- | ------------------------------------------------------------ |
87-
| `timestamp` | [timestamp][ts] | Required | Date/time that event occurred. Based on GPS or GNSS clock |
88-
| `altitude` | Double | Required if Available | Altitude above mean sea level in meters |
89-
| `heading` | Double | Required if Available | Degrees - clockwise starting at 0 degrees at true North |
90-
| `speed` | Float | Required if Available | Estimated speed in meters / sec as reported by the GPS chipset |
91-
| `accuracy` | Float | Required if Available | Horizontal accuracy, in meters |
92-
| `hdop` | Float | Required if Available | Horizontal GPS or GNSS accuracy value (see [hdop][hdop]) |
93-
| `satellites` | Integer | Required if Available | Number of GPS or GNSS satellites |
94-
95-
Example of a vehicle location GeoJSON [`Feature`][geojson-feature] object:
96-
97-
```json
98-
{
99-
"type": "Feature",
100-
"properties": {
101-
"timestamp": 1529968782421,
102-
"accuracy": 10,
103-
"speed": 1.21
104-
},
105-
"geometry": {
106-
"type": "Point",
107-
"coordinates": [
108-
-118.46710503101347,
109-
33.9909333514159
110-
]
111-
}
112-
}
113-
```
114-
115-
### Stop-based Geographic Data
116-
117-
When an individual location coordinate measurement (Point) corresponds to a [Stop][general-stops], it must be presented with a `stop_id` property:
118-
119-
```json
120-
{
121-
"type": "Feature",
122-
"properties": {
123-
"timestamp": 1529968782421,
124-
"stop_id": "b813cde2-a41c-4ae3-b409-72ff221e003d"
125-
},
126-
"geometry": {
127-
"type": "Point",
128-
"coordinates": [
129-
-118.46710503101347,
130-
33.9909333514159
131-
]
132-
}
133-
}
134-
```
135-
13675
### Intersection Operation
13776

13877
For the purposes of this specification, the intersection of two geographic datatypes is defined according to the [`ST_Intersects` PostGIS operation][st-intersects]
@@ -147,7 +86,7 @@ For the purposes of this specification, the intersection of two geographic datat
14786

14887
**[Beta feature](/general-information.md#beta-features):** *Yes (as of 1.1.0)*. [Leave feedback](https://github.com/openmobilityfoundation/mobility-data-specification/issues/670)
14988

150-
Geography-Driven Events (GDE) is a new MDS feature for Agencies to perform complete Policy compliance monitoring without precise location data. Geography-Driven Events describe individual vehicles in realtime – not just aggregate data. However, rather than receiving the exact location of a vehicle, Agencies receive information about the vehicle's current geographic region. The regions used for Geography-Driven Events correspond to the Geographies in an Agency's current Policy. In this way, the data-shared using Geography-Driven Events is matched to an Agency's particular regulatory needs.
89+
Geography-Driven Events (GDE) is an MDS feature for Agencies to perform complete Policy compliance monitoring without precise location data. Geography-Driven Events describe individual vehicles in realtime – not just aggregate data. However, rather than receiving the exact location of a vehicle, Agencies receive information about the vehicle's current geographic region. The regions used for Geography-Driven Events correspond to the Geographies in an Agency's current Policy. In this way, the data-shared using Geography-Driven Events is matched to an Agency's particular regulatory needs.
15190

15291
See [this example](/policy/examples/requirements.md#geography-driven-events) for how to implement GDE using [Policy Requirements](/policy#requirement).
15392

@@ -173,7 +112,7 @@ During the Beta period for this feature, location and telemetry data remain requ
173112

174113
## Optional Authentication
175114

176-
Authorization of the Policy and Geography APIs is no longer required and will be deprecated in next major release with these endpoints (plus Jursidictions) becoming 'optionally private' instead of 'optionally public'. An agency may optionally decide to make the Policy and Geography endpoints, as well as Jursidictions, unauthenticated and public. This allows transparency for the public to see how the city is regulating, holds the city accountable for their policy decisions, and reduces the technical burden on providers to use these endpoints. A side benefit is that this allows third parties to ingest this information into their applications and services for public benefit.
115+
Authorization of the Policy and Geography APIs is no longer required and will be deprecated in next major release with these endpoints (plus Jurisdictions) becoming 'optionally private' instead of 'optionally public'. An agency may optionally decide to make the Policy and Geography endpoints, as well as Jurisdictions, unauthenticated and public. This allows transparency for the public to see how the city is regulating, holds the city accountable for their policy decisions, and reduces the technical burden on providers to use these endpoints. A side benefit is that this allows third parties to ingest this information into their applications and services for public benefit.
177116

178117
Note if implementing the beta feature [Geography Driven Events](/general-information.md#geography-driven-events), both Policy and Geography must be public.
179118

@@ -182,7 +121,7 @@ Note if implementing the beta feature [Geography Driven Events](/general-informa
182121
## Responses
183122

184123
* **200:** OK: operation successful.
185-
* **201:** Created: `POST` operations, new object created
124+
* **201:** Created: `POST` operations, new object(s) created
186125
* **400:** Bad request.
187126
* **401:** Unauthorized: Invalid, expired, or insufficient scope of token.
188127
* **404:** Not Found: Object does not exist, returned on `GET` or `POST` operations if the object does not exist.
@@ -205,63 +144,46 @@ Note if implementing the beta feature [Geography Driven Events](/general-informa
205144
| `error_description` | String | Human readable error description (can be localized) |
206145
| `error_details` | String[] | Array of error details |
207146

208-
[Top][toc]
209-
210-
## Strings
211-
212-
All String fields, such as `vehicle_id`, are limited to a maximum of 255 characters.
213-
214-
[Top][toc]
147+
### Bulk Responses
215148

216-
## Stops
217-
218-
Stops describe vehicle trip start and end locations in a pre-designated physical place. They can vary from docking stations with or without charging, corrals with lock-to railings, or suggested parking areas marked with spray paint. Stops are used in both [Provider](/provider#stops) (including routes and event locations) and [Agency](/agency#stops) (including telemetry data).
219-
220-
| Field | Type | Required/Optional | Description |
221-
|------------------------|-------------------------------------------------------|-------------------|-------------|
222-
| stop_id | UUID | Required | Unique ID for stop |
223-
| name | String | Required | Name of stop |
224-
| last_reported | Timestamp | Required | Date/Time that the stop was last updated |
225-
| location | GeoJSON [Point Feature](#stop-based-geographic-data) | Required | Simple centerpoint location of the Stop. The use of the optional `geography_id` is recommended to provide more detail. |
226-
| status | [Stop Status](#stop-status) | Required | Object representing the status of the Stop. See [Stop Status](#stop-status). |
227-
| capacity | {vehicle_type: number} | Required | Number of total places per vehicle_type |
228-
| num_vehicles_available | {vehicle_type: number} | Required | How many vehicles are available per vehicle_type at this stop? |
229-
| num_vehicles_disabled | {vehicle_type: number} | Required | How many vehicles are unavailable/reserved per vehicle_type at this stop? |
230-
| provider_id | UUID | Optional | UUID for the provider managing this stop. Null/undefined if managed by an agency. See MDS [provider list](/providers.csv). |
231-
| data_provider_id | UUID | Optional | UUID for the data provider managing the data coming from this stop. Null/undefined if managed by an agency or a provider. See MDS [provider list](/providers.csv). |
232-
| geography_id | UUID | Optional | Pointer to the [Geography](/geography) that represents the Stop geospatially via Polygon or MultiPolygon. |
233-
| region_id | string | Optional | ID of the region where station is located, see [GBFS Station Information][gbfs-station-info] |
234-
| short_name | String | Optional | Abbreviated stop name |
235-
| address | String | Optional | Postal address (useful for directions) |
236-
| post_code | String | Optional | Postal code (e.g. `10036`) |
237-
| rental_methods | [Enum[]][gbfs-station-info] | Optional | List of payment methods accepted at stop, see [GBFS Rental Methods][gbfs-station-info] |
238-
| cross_street | String | Optional | Cross street of where the station is located. |
239-
| num_places_available | {vehicle_type: number} | Optional | How many places are free to be populated with vehicles at this stop? |
240-
| num_places_disabled | {vehicle_type: number} | Optional | How many places are disabled and unable to accept vehicles at this stop? |
241-
| parent_stop | UUID | Optional | Describe a basic hierarchy of stops (e.g.a stop inside of a greater stop) |
242-
| devices | UUID[] | Optional | List of device_ids for vehicles which are currently at this stop |
243-
| image_url | URL | Optional | Link to an image, photo, or diagram of the stop. Could be used by providers to help riders find or use the stop. |
244-
245-
### Stop Status
246-
247-
**Stop Status** returns information about the current status of a **[Stop](#stops)**.
248-
249-
| Field | Type | Required/Optional | Description |
250-
|--------------|---------|-------------------|-----------------------------------------------------|
251-
| is_installed | Boolean | Required | See GBFS [station_status.json][gbfs-station-status] |
252-
| is_renting | Boolean | Required | See GBFS [station_status.json][gbfs-station-status] |
253-
| is_returning | Boolean | Required | See GBFS [station_status.json][gbfs-station-status] |
254-
255-
Example of the **Stop Status** object with properties listed:
149+
For multi-record POST and PUT calls, e.g. sending Events using the Agency API, the bulk-response structure describes a list of failures is as follows:
256150

257151
```json
258152
{
259-
"is_installed": true,
260-
"is_renting": false,
261-
"is_returning": true
153+
"success": "...",
154+
"total": "...",
155+
"failures": [ { // list of failure details
156+
"item": { ... }, // copy of the item with the problem
157+
"error": "...",
158+
"error_description": "...",
159+
"error_details": [ "...", "..." ]
160+
}, {
161+
// additional failure records
162+
} ]
262163
}
263164
```
264165

166+
| Field | Type | Field Description |
167+
| ---------- | ------------------------------ | ------------------------------------------------------------------------------------------------------- |
168+
| `success` | Integer | Number of successfully written trip records points |
169+
| `total` | Integer | Total number of provided points |
170+
| `failures` | [Trip](#trip-data)[] | Array of failed trip records (empty if all successful) |
171+
172+
### Failure Details:
173+
174+
| Field | Type | Field Description |
175+
| ----- | ---- | ----------------- |
176+
| `item` | Vehicle, Event, etc. | Invalid submitted item |
177+
| `error` | Enum | Error code |
178+
| `error_description` | String | Human readable error description (can be localized) |
179+
| `error_details` | String[] | Array of fields with errors, if applicable |
180+
181+
[Top][toc]
182+
183+
## Strings
184+
185+
All String fields, such as `vehicle_id`, are limited to a maximum of 255 characters.
186+
265187
[Top][toc]
266188

267189
### GBFS Compatibility
@@ -325,47 +247,6 @@ See new location within [individual modes](/modes#list-of-supported-modes) in [m
325247

326248
[Top][toc]
327249

328-
## Vehicle Characteristics
329-
330-
Properties and characteristics of vehicles and devices.
331-
332-
[Top][toc]
333-
334-
### Accessibility Options
335-
336-
See new location within [individual modes](/modes#list-of-supported-modes) in [modes](/modes#accessibility-options).
337-
338-
[Top][toc]
339-
340-
### Propulsion Types
341-
342-
| `propulsion` | Description |
343-
| ----------------- | ------------------------------------------------------ |
344-
| `human` | Pedal or foot propulsion |
345-
| `electric_assist` | Provides power only alongside human propulsion |
346-
| `electric` | Contains throttle mode with a battery-powered motor |
347-
| `combustion` | Contains throttle mode with a gas engine-powered motor |
348-
349-
A vehicle may have one or more values from the `propulsion`, depending on the number of modes of operation. For example, a scooter that can be powered by foot or by electric motor would have the `propulsion` represented by the array `['human', 'electric']`. A bicycle with pedal-assist would have the `propulsion` represented by the array `['human', 'electric_assist']` if it can also be operated as a traditional bicycle.
350-
351-
[Top][toc]
352-
353-
### Vehicle Types
354-
355-
The list of allowed `vehicle_type` values in MDS. Aligning with [GBFS vehicle types form factors](https://github.com/NABSA/gbfs/blob/master/gbfs.md#vehicle_typesjson-added-in-v21-rc).
356-
357-
| `vehicle_type` | Description |
358-
|----------------| ----------- |
359-
| bicycle | A two-wheeled mobility device intended for personal transportation that can be operated via pedals, with or without a motorized assist (includes e-bikes, recumbents, and tandems) |
360-
| cargo_bicycle | A two- or three-wheeled bicycle intended for transporting larger, heavier cargo than a standard bicycle (such as goods or passengers), with or without motorized assist (includes bakfiets/front-loaders, cargo trikes, and long-tails) |
361-
| car | A passenger car or similar light-duty vehicle |
362-
| scooter | A standing or seated fully-motorized mobility device intended for one rider, capable of travel at low or moderate speeds, and suited for operation in infrastructure shared with motorized bicycles |
363-
| moped | A seated fully-motorized mobility device capable of travel at moderate or high speeds and suited for operation in general urban traffic |
364-
| delivery_robot | A robot intended for transporting goods |
365-
| other | A device that does not fit in the other categories |
366-
367-
[Top][toc]
368-
369250
## Versioning
370251

371252
MDS APIs must handle requests for specific versions of the specification from clients.
@@ -402,7 +283,11 @@ If an unsupported or invalid version is requested, the API must respond with a s
402283
[modes]: /modes/README.md
403284
[policy]: /policy/README.md
404285
[provider]: /provider/README.md
286+
[point-geo]: #geographic-telemetry-data
287+
[stop-based-geo]: #stop-based-geographic-data
405288
[st-intersects]: https://postgis.net/docs/ST_Intersects.html
406289
[toc]: #table-of-contents
407290
[ts]: /general-information.md#timestamps
291+
[vehicle-states]: /modes#vehicle-states
292+
[vehicle-events]: /modes#event-types
408293
[wgs84]: https://en.wikipedia.org/wiki/World_Geodetic_System

modes/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ The `trip_attributes` array allows additional mode-specific information about th
6060

6161
_See more available trip attributes for any mode in the [trips endpoint](/provider#trips)._
6262

63+
### Fare Attributes
64+
65+
The `fare_attributes` array allows additional mode-specific information about fare information associated with the trip. It can return a list of JSON-formatted key/value pairs which correspond to the allowed attributes and values for the operative mode. See each [mode definition](#list-of-supported-modes) for details.
66+
67+
_See more available fare attributes for any mode in the [trips endpoint](/provider#trips)._
68+
6369
### Vehicle Attributes
6470

6571
The `vehicle_attributes` array returns a list of JSON-formatted key/value pairs which correspond to the allowed attributes and values for the operative mode. For each mode, the allowed attributes and corresponding values are defined in the [mode definition](#list-of-supported-modes).

policy/examples/requirements.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ Version 1.1.0 for one provider with scooters, and 1.0.0 for another provider for
193193

194194
## Trips Only
195195

196-
Version 1.1.0 for 2 providers requiring only historic Provider `/trips` with the optional `parking_verificaiton_url` field, linked to a specific MDS Policy.
196+
Version 1.1.0 for 2 providers requiring only historic Provider `/trips` with the optional `parking_verification_url` field, linked to a specific MDS Policy.
197197

198198
```json
199199
{

0 commit comments

Comments
 (0)