Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Agency schema #172

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 30 additions & 5 deletions agency/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Body:
| `timestamp` | Unix Timestamp | Required | Date/time that event occurred. Based on GPS clock. |
| `location` | Point | Required | Location at the time of status change in WGS 84 (EPSG:4326) standard GPS projection |
| `event_type` | Enum | Required | [Event Type](#event_type) for status change. |
| `reason_code` | Enum | Required | [Reason](#reason_code) for status change. |
| `event_type_reason` | Enum | Required | [Reason](#event_type) for status change. |
| `battery_pct` | Float | Require if Applicable | Percent battery charge of device, expressed between 0 and 1 |

Response:
Expand All @@ -106,7 +106,7 @@ Body:
| `provider_id` | String | Required | Issued by city |
| `vehicle_id` | String | Required | Provided by the Vehicle Registration API |
| `timestamp` | Unix Timestamp | Required | Date/time that event occurred. Based on GPS clock. |
| `location` | Point | Required | Location at the time of status change in WGS 84 (EPSG:4326) standard GPS projection |
| `location` | GeoJSON [Point Feature](#geographic-data) | Required | Location at the time of status change in WGS 84 (EPSG:4326) standard GPS projection |
| `accuracy` | Integer | Required | The approximate level of accuracy, in meters, represented by start_point and end_point. |
| `battery_pct_start` | Float | Require if Applicable | Percent battery charge of device, expressed between 0 and 1 |

Expand All @@ -128,7 +128,7 @@ Body:
| ----- | ---- | ----------------- | ----- |
| `trip_id` | UUID | Required | See [start_trip](#start_trip) |
| `timestamp` | Unix Timestamp | Required | Date/time that event occurred. Based on GPS clock. |
| `location` | Point | Required | Location at the time of status change in WGS 84 (EPSG:4326) standard GPS projection |
| `location` | GeoJSON [Point Feature](#geographic-data) | Required | Location at the time of status change in WGS 84 (EPSG:4326) standard GPS projection |
| `accuracy` | Integer | Required | The approximate level of accuracy, in meters, represented by start_point and end_point. |
| `battery_pct_end` | Float | Require if Applicable | Percent battery charge of device, expressed between 0 and 1 |

Expand Down Expand Up @@ -157,7 +157,7 @@ Response:

### Route

To represent a route, MDS provider APIs should create a GeoJSON Feature Collection where ever observed point in the route, plus a time stamp, should be included. The representation needed is below.
To represent a route, MDS provider APIs should create a GeoJSON Feature Collection where every observed point in the route, plus a time stamp, should be included. The representation needed is below.

The route must include at least 2 points, a start point and end point. Additionally, it must include all possible GPS samples collected by a provider. All points must be in WGS 84 (EPSG:4326) standard GPS projection

Expand Down Expand Up @@ -229,6 +229,31 @@ Response:
| preferred_pick_up | Areas where users are encouraged to pick up devices |
| preferred_drop_off | Areas where users are encouraged to drop off devices |



### Geographic Data

References to geographic datatypes (Point, MultiPolygon, etc.) imply coordinates encoded in the [WGS 84 (EPSG:4326)](https://en.wikipedia.org/wiki/World_Geodetic_System) standard GPS projection expressed as [Decimal Degrees](https://en.wikipedia.org/wiki/Decimal_degrees).

Whenever an individual location coordinate measurement is presented, it must be
represented as a GeoJSON [`Feature`](https://tools.ietf.org/html/rfc7946#section-3.2) object with a corresponding [`timestamp`][ts] property and [`Point`](https://tools.ietf.org/html/rfc7946#section-3.1.2) geometry:

```json
{
"type": "Feature",
"properties": {
"timestamp": 1529968782.421409
},
"geometry": {
"type": "Point",
"coordinates": [
-118.46710503101347,
33.9909333514159
]
}
}
```

### Event Types

| event_type | event_type_description | reason | reason_description |
Expand All @@ -254,14 +279,14 @@ For `vehicle_type`, options are:

* `bike`
* `scooter`
* `recumbent`

### propulsion_type

For `propulsion_type`, options are:

* `human`
* `electric`
* `electric_assist`
* `combustion`

### reason_code
Expand Down
56 changes: 56 additions & 0 deletions agency/deregister_vehicle.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"$id": "https://raw.githubusercontent.com/CityofLosAngeles/mobility-data-specification/master/agency/deregister_vehicle.json",
"$schema": "http://json-schema.org/draft-06/schema#",
"title": "The MDS Agency Schema, deregister_vehicle payload",
"type": "object",
"definitions": {
"uuid": {
"$id": "#/definitions/uuid",
"type": "string",
"title": "A UUID 4 used to uniquely identifty an object",
"default": "",
"examples": [
"3c9604d6-b5ee-11e8-96f8-529269fb1459"
],
"pattern": "^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$"
},
"battery_pct": {
"$id": "#/definitions/battery_pct",
"type": "number",
"description": "Percent charge of device battery, expressed between 0 and 1",
"default": 0.0,
"examples": [
0.89
],
"minimum": 0,
"maximum": 1
}
},
"required": [
"unique_id",
"device_id",
"reason_code"
],
"properties": {
"unique_id": {
"$id": "#/properties/unique_id",
"description": "The UUID for the vehicle, unique within MDS",
"$ref": "#/definitions/uuid"
},
"device_id": {
"$id": "#/properties/device_id",
"$ref": "#/definitions/uuid",
"description": "A unique device ID in UUID format"
},
"reason_code": {
"$id": "#/properties/reason_code",
"type": "string",
"description": "The reason for deregistering the vehicle",
"enum": [
"rebalancing",
"maintenance"
]
}
},
"additionalProperties": false
}
148 changes: 148 additions & 0 deletions agency/end_trip.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
{
"$id": "https://raw.githubusercontent.com/CityofLosAngeles/mobility-data-specification/master/agency/end_trip.json",
"$schema": "http://json-schema.org/draft-06/schema#",
"title": "The MDS Agency Schema, end_trip payload",
"type": "object",
"definitions": {
"Point": {
"$id": "#/definitions/Point",
"title": "GeoJSON Point",
"type": "object",
"required": [
"type",
"coordinates"
],
"properties": {
"type": {
"type": "string",
"enum": [
"Point"
]
},
"coordinates": {
"type": "array",
"minItems": 2,
"items": {
"type": "number"
}
},
"bbox": {
"type": "array",
"minItems": 4,
"items": {
"type": "number"
}
}
}
},
"MDS_Feature_Point": {
"$id": "#/definitions/MDS_Feature_Point",
"title": "MDS GeoJSON Feature Point",
"type": "object",
"required": [
"type",
"properties",
"geometry"
],
"properties": {
"type": {
"type": "string",
"enum": [
"Feature"
]
},
"properties": {
"oneOf": [
{
"type": "null"
},
{
"type": "object"
}
],
"required": [
"timestamp"
],
"properties": {
"timestamp": {
"$ref": "#/definitions/timestamp"
}
}
},
"geometry": {
"$ref": "#/definitions/Point"
},
"bbox": {
"type": "array",
"minItems": 4,
"items": {
"type": "number"
}
}
}
},
"uuid": {
"$id": "#/definitions/uuid",
"type": "string",
"title": "A UUID 4 used to uniquely identifty an object",
"default": "",
"examples": [
"3c9604d6-b5ee-11e8-96f8-529269fb1459"
],
"pattern": "^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$"
},
"battery_pct": {
"$id": "#/definitions/battery_pct",
"type": "number",
"description": "Percent charge of device battery, expressed between 0 and 1",
"default": 0.0,
"examples": [
0.89
],
"minimum": 0,
"maximum": 1
},
"timestamp": {
"$id": "#/definitions/timestamp",
"title": "Floating-point seconds since Unix epoch",
"type": "number",
"minimum": 0.0
}
},
"required": [
"trip_id",
"timestamp",
"location",
"accuracy"
],
"properties": {
"trip_id": {
"$id": "#/properties/trip_id",
"description": "The UUID for the trip.",
"$ref": "#/definitions/uuid"
},
"battery_pct_end": {
"$id": "#/properties/battery_pct_end",
"$ref": "#/definitions/battery_pct"
},
"accuracy": {
"$id": "#/properties/accuracy",
"type": "integer",
"title": "The approximate level of accuracy, in meters, of Points within route",
"default": 0,
"examples": [
15
]
},
"location": {
"$id": "#/properties/location",
"description": "The GPS coordinates of where the event occurred",
"$ref": "#/definitions/MDS_Feature_Point"
},
"timestamp": {
"$id": "#/properties/location",
"$ref": "#/definitions/timestamp"
}
},
"additionalProperties": false
}
Loading