Tools for working with MDS provider
data.
Developed and tested with Python 3.7+.
See mds-provider-services
for real-world usage of many of these tools.
Install with pip
:
pip install -e git+https://github.com/CityofSantaMonica/mds-provider@master#egg=mds-provider
Or with python
directly:
git clone https://github.com/CityofSantaMonica/mds-provider.git
cd mds-provider
python setup.py install
from datetime import datetime, timedelta
import mds
end = datetime.utcnow()
start = end - timedelta(hours=1)
client = mds.Client("provider_name", token="secret-token")
trips = client.get_trips(start_time=start, end_time=end)
validator = mds.DataValidator.trips()
for error in validator.validate(trips):
print(error)
db = mds.Database(user="user", password="password", host="host", db="database")
db.load_trips(trips)
module | description |
---|---|
mds |
Tools for working with Mobility Data Specification provider data |
mds.api |
Request data from compatible API endpoints |
mds.db |
Work with databases |
mds.encoding |
Custom data encoding and decoding. |
mds.fake |
Generate fake provider data for testing and development |
mds.files |
Work with provider configuration and data payload files |
mds.geometry |
Helpers for GeoJSON-based geometry objects |
mds.github |
Data and helpers for MDS on GitHub. |
mds.providers |
Parse Provider registry files |
mds.schemas |
Validate data using the JSON schemas |
mds.versions |
Work with MDS versions |