{"id":301,"date":"2013-11-04T21:07:29","date_gmt":"2013-11-04T08:07:29","guid":{"rendered":"http:\/\/deborahfitchett.com\/blog\/?p=301"},"modified":"2013-11-04T21:07:29","modified_gmt":"2013-11-04T08:07:29","slug":"my-first-foray-into-coding-with-open-data","status":"publish","type":"post","link":"https:\/\/deborahfitchett.com\/blog\/2013\/11\/my-first-foray-into-coding-with-open-data\/","title":{"rendered":"My first foray into coding with open data"},"content":{"rendered":"<p>My first foray into coding with someone else&#8217;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&#8217;t want to work with Twitter&#8217;s API, or more specifically with their OAuth stuff, ever again.<\/p>\n<p>So my first foray that I <em>enjoyed<\/em> was with the <a href=\"http:\/\/data.ecan.govt.nz\/Catalogue\/Search?Query=bus\">Christchurch Metroinfo (bus) data<\/a> &#8211; specifically the <a href=\"http:\/\/data.ecan.govt.nz\/Catalogue\/Method?MethodId=74\">real-time bus arrival data<\/a> (link requires filling out a short terms and conditions thing but then the data&#8217;s free under CC-BY license). For a long time I&#8217;ve used <a href=\"http:\/\/wap.metroinfo.org.nz\/rtt\/public\/RoutePositionET.aspx?PlatformNo=50490\">this real-time information<\/a> 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&#8217;m working in another window and get distracted, or traffic suddenly speeds up, I can still miss it. I wanted a web app that&#8217;d give me an audio alert when the bus came in range.<\/p>\n<p>Working with the data turned out to be wonderfully easy. A bit of googling yielded me information about <a href=\"http:\/\/php.net\/manual\/en\/book.simplexml.php\">SimpleXML<\/a> 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.<\/p>\n<p>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.<\/p>\n<p>So now I have:<\/p>\n<ul>\n<li><a href=\"http:\/\/www.deborahfitchett.com\/toys\/bustler\/?stop=40882&#038;route=5&#038;wheelchair=0&#038;max=6&#038;min=4\">a demo web application<\/a>, and <\/li>\n<li><a href=\"https:\/\/github.com\/deborahfitchett\/bustler\">all the source code<\/a><\/li>\n<\/ul>\n<p>online, and I&#8217;m already starting to think about what other open data projects might be out there waiting for me.<\/p>\n<p>(And now that the development phase is over and I&#8217;m using the thing live, I think my cat is starting to recognise that when this particular bird song plays, I&#8217;m about to leave the house.)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My first foray into coding with someone else&#8217;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&#8217;t want to work with Twitter&#8217;s API, or more specifically [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[15,6],"_links":{"self":[{"href":"https:\/\/deborahfitchett.com\/blog\/wp-json\/wp\/v2\/posts\/301"}],"collection":[{"href":"https:\/\/deborahfitchett.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/deborahfitchett.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/deborahfitchett.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/deborahfitchett.com\/blog\/wp-json\/wp\/v2\/comments?post=301"}],"version-history":[{"count":3,"href":"https:\/\/deborahfitchett.com\/blog\/wp-json\/wp\/v2\/posts\/301\/revisions"}],"predecessor-version":[{"id":304,"href":"https:\/\/deborahfitchett.com\/blog\/wp-json\/wp\/v2\/posts\/301\/revisions\/304"}],"wp:attachment":[{"href":"https:\/\/deborahfitchett.com\/blog\/wp-json\/wp\/v2\/media?parent=301"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/deborahfitchett.com\/blog\/wp-json\/wp\/v2\/categories?post=301"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/deborahfitchett.com\/blog\/wp-json\/wp\/v2\/tags?post=301"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}