Archive for the ‘Hacks’ Category
Posty – our new gem for geolocation in Ruby 13th Apr 10
Just last week Ordnance Survey released a tonne of data. This is of course a wonderful thing for everybody, and software making use of this data has only started appearing in the past week. This morning, in fact, we noticed a gem, pat by Stef Lewandowski which uses Pezholio/Stuart Harrison’s very useful UK Postcodes.
We took a look at it, and decided to make a gem that uses a local database (usually a bit faster than using a Web-based API), but which is similarly easy to use.
Three hours later, we present to you posty!
The data it provides from CodePoint Open is:
- postcode
- quality
- latitude
- longitude
- country
- nhs_region
- nhs_health_authority
- county
- district
- ward
In all these cases, rather than proving the name of the county/district/ward/etc, it only provides the identifier used in the data set. This is a case where UK Postcodes would be a better option.
To install it,
sudo gem install posty
To set up the database (which can be downloaded automatically from mySociety, or you can download the latest version yourself and use the -c option),
sudo posty-init -g
This should take about 8 minutes to load all the CSV into the database.
To use it,
require 'posty' Posty.postcode('SE1 1EN')
If you’re going to be using it frequently from the same process, you should probably use the following instead,
require 'posty' posty = Posty.new postcode = posty.postcode('SE1 1EN') postcode = posty.postcode('SE1 7PB')
The magick going on here is that the database is stored in the gem (in lib/posty/codepointopen.sqlite3), and then it’s available without having to connect manually.
Have a fiddle with posty and tell us what you think.
Data: Weekly Fuel Prices 11th Aug 09
James Darling and I met up for a chat about some data-related stuffs this afternoon, and came across this data on average fuel prices via the Office of National Statistics. This struck us both as being very useful (any hauliers out there who want to make some a nice visualisations?) so we threw together a script to convert it into (much) more useful formats.
Check out Weekly Fuel Prices, in more formats than you can shake a stick at, here.
ScenicOrNot: want to play with the data? 26th Jun 09
mySociety have added a data dump to ScenicOrNot, the site we built for them a couple of months ago. It’s got the photos and all the votes for each of the 181,300 places that have received 3 or more votes since the site launched.
If you’re one of the many people who had something to say about the voting system that ScenicOrNot uses, we hope you might have some fun playing with the raw data! If you do make something, let us know how you get on…
DFID Procurement Opportunities 30th Dec 08
One of the things that I mentioned in our last post was the lack of RSS feeds for various parts of the DFID’s new website. Today, someone else picked up the same point in a Twitter update.
This is just the kind of thing we like to do, so we knocked up a script to generate an Atom feed from DFID’s procurement page. If you’re interested in DFID’s procurement opportunities, do add it to your feed reader, and let us know how you get on.
