sharedstreets / mobility-metrics

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

deprecate server in favor of static site #64

Closed morganherlocker closed 5 years ago

morganherlocker commented 5 years ago

The frontend and API are currently served by a custom hapi server. In the interest of making the data and frontend as easy as possible to serve, we are moving to a static structure that can be served with any generic file server or even github pages. We have been careful to keep the API simple, essentially zero custom filters or data processing performed at runtime, which will make this transition straightforward.

In addition, this will let us host demo mobility metrics instances over github pages by simply copying the site into a subdirectory on the gh-pages branch. I will be generating synthetic data for a few cities to kick off this effort.

morganherlocker commented 5 years ago

In preparation to release this change, I decided to modify the distribution model a bit to aid usability with deployment. My plan is to publish mobility-metrics as a CLI capable of generating aggregates and reports as static bundles that can be thrown up behind any generic webserver. I have a working branch I will be posting today, but here is an example of the interface as it stands:

mobility-metrics --config ./example/example.json --public ./public --cache ./cache --day 2019-07-20

This command stores all output in the ./public directory, but this could be anywhere. Inside public is a ./data directory containing all metrics data, which could be used to power an API with a simple file server. Another directory contains all UI for reporting, which is dynamically generated from templates based on the config. Note that the config is now passed as a parameter. This allows for more flexible deployment options, such as a batch job system capable of generating metric data for dozens of cities.

morganherlocker commented 5 years ago

^ This has now been fully implemented and will ship in v1.4