Coder Social home page Coder Social logo

openmobilityfoundation / mds-openapi Goto Github PK

View Code? Open in Web Editor NEW
8.0 2.0 2.0 294 KB

OpenAPI description for MDS data feeds, managed by the Open Mobility Foundation.

Home Page: https://openmobilityfnd.stoplight.io/docs/mds-openapi

License: Other

Jupyter Notebook 42.70% Python 57.30%
openapi3 openapi bike-share cities mds mobility mobility-as-a-service policy delivery-robot micromobility

mds-openapi's Introduction

Mobility Data Specification OpenAPI

The Mobility Data Specification (MDS), a project of the Open Mobility Foundation (OMF), is a data standard to enable right-of-way regulation and two-way communication between mobility companies and local governments.

This is the OpenAPI description for MDS data feeds, managed by the Open Mobility Foundation.

Online documentation is available on Stoplight.

MDS versions are organized by branches starting with a branch for v2.0.

Python project

A small Python project defined in pyproject.toml supports the schema development process.

# install the project and its dependencies
pip install -e .

Schema validation

Tests written in pytest check various components of the schemas. These tests can be run locally, and also run in GitHub Actions on commits to this repository.

# run the tests with pytest from the root of the repo
pytest

Notebooks

Jupyter Notebooks to help with one-time data cleanups and issue checking.

# install the 'notebooks' extras
pip install -e .[notebooks]

License

The MDS OpenAPI, like MDS itself, is licensed under Creative Commons Attribution 4.0 International Public License

mds-openapi's People

Contributors

dependabot[bot] avatar schnuerle avatar thekaveman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

mds-openapi's Issues

Provider API

Spec description: https://github.com/openmobilityfoundation/mobility-data-specification/tree/release-2.0.0/provider

Endpoints

  • /vehicles
  • /vehicles/{device_id}
  • /vehicles/status
  • /vehicles/status/{device_id}
  • /events/historical
  • /events/recent
  • /trips
  • /telemetry
  • /stops
  • /stops/{stop_id}
  • /reports

Data requirements

  • Standard MDS payload wrapper
  • Optional paging
  • Optional data latency
  • journey_attributes
    • car-share: journey_id
    • car-share.trip: reservation_id
    • passenger-services: journey_id
    • passenger-services.trip: shift_id
    • delivery-robots: journey_id
  • Conditional trip_ids
    • micromobility.event.event_types: trip_start, trip_end, trip_cancel, trip_enter_jurisdiction, or trip_leave_jurisdiction.
    • passenger-services.event.event_types: reservation_start, reservation_stop, trip_start, trip_pause, trip_resume, trip_end,trip_cancel, customer_cancellation, provider_cancellation, driver_cancellation, trip_enter_jurisdiction, trip_leave_jurisdiction
    • delivery-robots.event.event_types: reservation_start, reservation_stop, trip_start, trip_pause, trip_resume, trip_end,trip_cancel, customer_cancellation, provider_cancellation, driver_cancellation, trip_enter_jurisdiction or trip_leave_jurisdiction
  • Conditional event_geographies on Event
  • State machine transitions

Agency GET endpoints return MDS version in responses

Agency GET endpoints return their data payload, and optionally the JSON API pagination fields, e.g. for Vehicles:

{
    "vehicles": [ ... ],
    "links": {
        "first": "https://...",
        "last": "https://...",
        "prev": "https://...",
        "next": "https://..."
    }
}

Should the MDS version be included in this response? Like it is for Provider, Policy, Jurisdiction responses?

{
    "version": "2.0.0",
    "vehicles": [ ... ],
    "links": {
        "first": "https://...",
        "last": "https://...",
        "prev": "https://...",
        "next": "https://..."
    }
}

Use endpoint for summary field

E.g. in the Provider API doc we have:

/vehicles:
    get:
      operationId: get-vehicles
      description: Get a list of known vehicles, with properties that do not change often.
      summary: Get near-realtime vehicle information.

In the Stoplight menu, this looks like (notice some items are cut off):

image

Instead reuse the endpoint name in the summary field:

/vehicles:
    get:
      operationId: get-vehicles
      description: Get a list of known vehicles, with properties that do not change often.
      summary: /vehicles

This will reduce duplication within these OpenAPI docs and with the MDS docs, and it makes it much clearer in the Stoplight menu:

image

Media type in OpenAPI

UPDATE

See comment below #34 (comment)

Original

MDS defines the media type application/vnd.mds+json for use in the (response) Content-type header, and for the purposes of version negotiation whereby a client could request a particular version:

Accept application/vnd.mds+json;version=2.0

The OpenAPI endpoints thus far have used application/vnd.mds+json as the Content-type and not required it as an Accept header.

Metrics API

Spec description: https://github.com/openmobilityfoundation/mobility-data-specification/tree/release-2.0.0/metrics

Endpoints

  • /metrics: GET
  • /metrics: POST

Data requirements

  • ISO 8601 formatted strings with minute granularity supported and time zone (default UTC - YYYY-MM-DDTHH:mm or included offset (YYYY-MM-DDTHH:mm). Dates and times may also be specified using a numeric Unix epoch/timestamp
  • ISO 8601 duration format strings (e.g. PT15M, PT1H, P1D)
  • metrics GET response
  • metrics POST parameters
  • metrics POST response

Policy rule conditional requirements

  1. If rule_type != user, then rule_units required
  2. Valid combinations of rule_type and rule_units
  3. If rate_recurrence = *_time_unit, then rule_type = time

vehicle_type allowed values

Currently, vehicle_type is described here and shared between all the modes.
My question is should it be one list of allowed values ​​for all modes? I assume allowed values should be separated per each mode.

Seems like it should be separated to each mode, like:

  • bicycle is related to micromobility
  • bus - passenger-services (?)
  • cargo_bicycle - micromobility
  • car - car-share
  • delivery_robot - delivery-robots
  • moped - micromobility
  • motorcycle - micromobility (?)
  • scooter_standing - micromobility
  • scooter_seated - micromobility
  • truck - car-share
  • other - ...

Could you please review this moment?

Agency API

Spec description: https://github.com/openmobilityfoundation/mobility-data-specification/tree/release-2.0.0/agency

Endpoints

  • /events: POST
    • Request body
    • Success body
    • Error body
  • /reports: POST
    • Request body
    • Success body
    • Error body
  • /stops: GET
  • /stops/{stop_id}: GET
  • /stops: POST, PUT
    • Request body
    • Success body
    • Error body
  • /telemetry: POST
    • Request body
    • Success body
    • Error body
  • /trips: POST
    • Request body
    • Success body
    • Error body
  • /vehicles: POST, PUT
    • Request body
    • Success body
    • Error body
  • /vehicles: GET
  • /vehicles/{device_id}: GET
  • /vehicles/status: GET
  • /vehicles/status/{device_id}: GET

Data requirements

  • Single error response
  • Bulk responses
  • Event errors
  • Reports register errors
  • Stop register errors
  • Stop update errors
  • Telemetry errors
  • Trip errors

Create v2.0 branch

Requires the following issues to be complete:

Tasks

  • Create a new branch from main, called v2.0
  • Make the new branch the default branch in this repository
  • In the Stoplight project, track the new branch and make it the default

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.