Recently, the Chicago Transit Authority released its CTA Bus Tracker API. For those of you who don't live in Chicago, CTA Bus Tracker is just about the greatest thing ever. It allows you to look up online, in real time, when the next bus is coming to a stop. It was rolled out over the last few years, and within the last year or so, has been available for every bus. My only major complaint about it was that it was only available via the Bus Tracker website, so if you did not have a smartphone with a web browser, you were out of luck. But, there was very little I could do, since there wasn't an open API for accessing their Bus Tracker data.
Yesterday, I saw a few tweets about various Canadian public transit systems that had opened their APIs to varying degrees. Curious, I looked up whether CTA had done anything in the last few months to open up the Bus Tracker API. They had! Back in September, they posted it online. They require you to make an account on Bus Tracker and apply for a developer key, so I decided to go for it and see if they'd allow me to start using it.
...and, I got my developer key this afternoon!
This led to me spending the vast majority of the afternoon and early evening playing around. The Bus Tracker API itself is pretty straightforward, but I hadn't yet learned the python commands for creating DOM objects and parsing XML. (In fact, I didn't even know what a DOM object was until this afternoon--I just assumed that there had to be an easier way to parse XML than parsing it with regular expressions or pattern matching within the strings.) At this point, I have gotten the hang of pulling the Bus Tracker XML data and parsing it, which means that I can start to do something useful.
My thought is to do a Twitter interface. I enjoy working with the Twitter API, and back when I didn't have a smartphone (but could use Twitter by SMS), I wished there was a way I could text for bus times. A good Twitter interface for Bus Tracker would solve that problem.
Of course, the challenge is going to be crafting a "good" interface. The code is not going to be the difficult part. Finding a way to make a Twitter interface that is intuitive to use is going to be the difficult part, since there is so much information that Bus Tracker needs to give the user the times: bus route, direction, and stop. The difficulty will come because people will format their queries in different ways (for example, referring to the same stop as either Belmont and Sacramento or Sacramento and Belmont or Belmont/Sacramento or Belmont & Sacramento, et cetera), and it would be extremely obnoxious for the user to have to be all that picky about their formatting or street name order if they are rushing to find out when their bus is going to come.

Add new comment