open formats

Open formats are cool. They’re cool for reasons I should not have to explain.

The new US Administration, in their stimulus implementation guidelines, has indicated that government agencies use feeds (Atom or RSS) to disclose how funds are being allocated.

It’s neat not only because the data is available, but also because people can do things with this data. People can chart and graph things, or create watch dog websites, or approval rating websites (on each allocation) etc. Open data allows people to do things. This is a good thing.

When throwing together demand a stance, I couldn’t find any open formats for contact information on members of parliament. The government does have this website, which returns MP information based on a postal code. Which is great, because it was exactly what I was looking for, except that the information is not in an open format (or an easily machine readable format).

So I wrote a scraper that extracted the information that was required. We threw the site up in PHP, I hacked together some pages, Fathima made it look pretty. We also threw in a whole bunch of javascripty goodness, for smooth flowing and what not.

But that doesn’t solve the open format issue. I decided to rebuild the site in Ruby on Rails. So as a starting step I’m extracting the information from the government website and presenting it in nicer HTML and also in JSON. So people can easily do what they want.

The test site is: http://das.nashahai.com/. Yeah, the page needs work. But it describes how to use the thing.

HTML: http://das.nashahai.com/mp/find/by_postal_code.html?postal_code=m1s5b2

You can view source on that and see the HTML layout. I think all the elements should be accessible via css, and can be manipulated using javascript.

JSON: http://das.nashahai.com/mp/find/by_postal_code.js?postal_code=m1s5b2

This returns a JSON object containing all the data.

You can find the code here: http://github.com/adnanali/das2/tree/master

I’m assuming that if I needed something like this then someone else will too. If you find any issues, let me know.

2 thoughts on “open formats”

Leave a Reply

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