Project Name: Dude Where's My Bus? Authors: Li Jye Tong, Kevin Wu, Alex Chung
What is the problem?
Using Haskell, we will investigate the feasibility of interfacing with Translink's bus APIs. We will handle display the bus times for a single stop first. User will input a bustop ID and relevant busses and bus arrival times will be output.
What is the something extra?
Create a feature to provide nearby-passing busses(when given a geo-location) travelling in each of the four cardinal directions, and provide the appropriate stops on request. e.g. busses X, Y, and Z are going Northbound; busses W and T are travelling Southbound.
What did we learn from doing this?
We learned more about:
-Parsing JSON data in Haskell
-Formatting correct URLs to make HTTP requests
-Haskell Actions (i.e. do blocks)
-User input for Haskell
-Formatting inconsistent data
Haskell was capable of handling Translink's API, but many issues arose from the parsing of the data sent. We queried not only Translink's API, but also Google's Geolocation API also, and both had different specifications to their JSON sent. Even within Translink's API, error message's JSON format was different from their bus stop estimate JSON. Integrating a parser library into our project also required quite a bit of time due to the complexity of some of them. We originally wanted to use Translink's XML data but found that the parsers for those were quite complex and instead tried JSON. We ended up using the Dead Simple JSON Parser library which provided exactly what we needed. There were still limitations to this as the library could not handle all the JSON formats and data manipulation was required. Once we understood how the parser was partitioning the JSON data, extracting the appropriate information was not too difficult. Overall, we can conclude that functional programming is feasible for accessing Translink's API, and as it was through HTTP requests, other APIs accessed through HTTP should also be feasible.