BusTicker / BusTicker-Server

MIT License
0 stars 0 forks source link

Implement app's with mock and MCTS providers #6

Closed brennanMKE closed 10 years ago

brennanMKE commented 10 years ago

In app.'s the following dependencies will be loaded using require.

The following API calls of the MCTS API will need to be done.

These calls to the MCTS API will not be returned directly from the Bus Ticker API. The first 3 calls will be used to assemble the data structure which will populate the backend data for the following 2 calls on the for the Bus Ticker API.

The data returned will be very simple and work with the following basic construct.

    {
        'success' : true,
        'message' : 'OK',
        'data' : {}
    }

If the incoming parameters include help=true the API route will always return a text-only response with a content-type of text/plain with basic docs much like a MAN page on the command-line. If there is an error with processing a request, such as a missing required parameter the success value will be false and the message will explain the problem. When success is true the message will always be OK.

The call for stops will return an array of bus stop vectors which include the following values.

The call to eta will return an array of ISO standard date strings for each of the arrival times. Additional details are not needed since the location and name of the stop is already known.

brennanMKE commented 10 years ago

@Aaron-Hartwig @tdhsmith

I created a Node.js project which fetches all of the data from the MCTS API. It fetches all routes, then directions and finally all of the stops which are gathered into an object graph of all of the routes. This object graph could be held by the backend for looking up stops when given a center location and radius. There's also a function for fetching predictions for a stop.

It uses the when and rest modules from npm which are very useful at cutting down on the code we need to write while giving us great async/promises support. It's quite fast and will work well as a foundation for the Bus Ticker backend.

https://github.com/brennanMKE/Node-RideMCTS

brennanMKE commented 10 years ago

Done with tests.