This project is an API service built with PHP that aggregates, caches and serves the data for Dash v2 in a JSON format.
The development of this supporting project for Dash v2 was necessary because Commuter Dashboard (Dash v1) contained, hard coded variables, all the data grooming logic and private API keys as part of the front-end web experience. This effectively exposed both the API keys and the logic to anyone who is familiar with the Inspect Source functionality of most modern web browsers. It also prevented the application from being useful to other people who wanted to use it.
The API service grooms the data provided by Environment Canada's Advanced Weather XML Feed and JSON provided by the OneBusAway API into a single JSON object, simplifying it to only include the data necessary to drive the Dash v2 application, thus saving bandwidth.
Reducing the strain on data sources was also important to the project to ensure that the use of the services does not impact their ability to operate. In the case of Government Data Sources this ensures continued free access, by reducing the number of times the API service actually requests data. When data is requested from the API, the API fetches the data via the caching mechanism. The caching mechanism, which is configured on a per data source basis, returns the data after determining if it should be re-downloaded from a data source or served from the cache.
DashServer also stores the configurations and customization for each API key. When it receives a post request containing an API Key, it retrieves, packages and responds with all the data for that respective key.
This project is going to be replaced with a version rewritten in Node.js in order to provide better integration with my plan to replace the OneBusAway API service with my own implementation, DashGTFS.