My first foray into coding with open data

My first foray into coding with someone else’s data would probably have been when I created some php and a cron job to automatically block-and-report-for-spam any Twitter account that tweeted one of three specific texts that spammers were flooding on the #eqnz channel. I really don’t want to work with Twitter’s API, or more specifically with their OAuth stuff, ever again.

So my first foray that I enjoyed was with the Christchurch Metroinfo (bus) data – specifically the real-time bus arrival data (link requires filling out a short terms and conditions thing but then the data’s free under CC-BY license). For a long time I’ve used this real-time information to keep an eye out on when I need to leave the house to reach my stop in time for my bus. But if I’m working in another window and get distracted, or traffic suddenly speeds up, I can still miss it. I wanted a web app that’d give me an audio alert when the bus came in range.

Working with the data turned out to be wonderfully easy. A bit of googling yielded me information about SimpleXML and I knew enough PHP to use it. There was an odd glitch when I tried to upload my code, which worked perfectly fine on my computer, to my webserver with a slightly older version of PHP which for some reason required an extra step in parsing the attributes ECan use in their XML. But once I worked out what was going on, that was an easy fix too.

Then I did a whole bunch of fiddling with the CSS and HTML5, and the SQL is a whole nother story; and then I uploaded the source code to GitHub; and eventually even remembered to cite the data, whoops.

So now I have:

online, and I’m already starting to think about what other open data projects might be out there waiting for me.

(And now that the development phase is over and I’m using the thing live, I think my cat is starting to recognise that when this particular bird song plays, I’m about to leave the house.)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.