sharedstreets / mobility-metrics

Tools for collecting, processing, and interpreting mobility data using SharedStreets
MIT License
50 stars 17 forks source link

Add ability to specify MDS version #91

Closed billdirks closed 4 years ago

billdirks commented 5 years ago

It would be great to be able to associated an provider in the configuration file with a MDS version number. Examples where this would matter:

  1. Currently, if one uses mds.js to download data, there is an implicit assumption that the provider serves MDS 0.2.x. That is mds.js does not provide a version header, which by default requests version 0.2.X (see https://github.com/CityOfLosAngeles/mobility-data-specification/tree/dev/provider#versioning). Also there is an assumption that the start/end times provided to the API are in seconds. In MDS 0.2.X these times are in float seconds but in 0.3.X this changed to int milliseconds.

  2. Currently if one uses local.js to import locally downloaded data, there is an implicit assumption that the time in the local files is in milliseconds (for example: change.event_time = change.event_time / 1000;)

So the benefits to specifying the MDS versions are:

1) Sending the correct request headers 2) Having the right units when filtering change/trips data.

This would be really helpful when there is more than 1 provider in a city each supporting different MDS versions.

morganherlocker commented 5 years ago

Next Steps

morganherlocker commented 4 years ago

v4.4.0 implements an optional "version" setting that can be set per provider. Setting to "0.3" will use the MDS 0.3 request headers and parameters when performing queries. Leaving version blank will fall back to 0.2 request structure. See docs and changelog for more details.