Category: voteuk

OpenTech 2010

A quick report on OpenTech 2010 - the London event for geeks interested in Government data, openness and generally doing good things with tech and data.

Get Excited And Make Things
Copyright Matt Jones used under a Creative Commons non-commercial, attribution, share-alike licence.

I attended last year's event which inspired me to create my "VoteUK" service for the 2010 general election. I had considered doing a talk about the trials and tribulations of using open - and not so open - data. Instead, I gave a more general talk about how to harness the power of the mobile web to empower people - and why iPhone apps are the wrong way to get data to the masses.

More details in a moment. First off, my thoughts on the rest of the presentations.
Continue reading

I Love Open Source

As I mentioned in my last post about VoteUK, I found the TheyWorkForYou API to be a little lacking when it came to image sizing.

I posted a request asking if there was a pattern to the image sizes and, if not, was it possible to have the sizes returned in the API.

The "standard" open source reply - "fix it yerself" - was predictably swift.

So I did.

The source code is remarkably accessible - although a few more comments wouldn't go amiss.  This was my first experience with GIT and Github.  It was easy to get the code and, luckily, I didn't have to dive too far in to its syntax.

I had initially thought about using the EXIF data within the images to get the width and height.  Unfortunately, not every image can be guaranteed to have (accurate) EXIF data.  PHP to the rescue once again with the getimagesize() function.

So, where we previously had

if ($image) $row['image'] = $image;

This becomes

if ($image) {
	list($width, $height) = getimagesize($image);
	$row['image'] = $image;
	$row['image_height'] = $height;
	$row['image_width'] = $width;
}

Many thanks to Matthew Somerville for testing and releasing the patch in double quick time. You can examine the changes made to the code.

So now the API returns,

<image>/images/mps/10409.jpg</image>
<image_height>59</image_height>
<image_width>49</image_width>

Brilliant!

So, I have a problem, I can see how much effort it will be to fix, I suggest a solution, it works and goes into production.  That's the awesome power of open source.

VoteUK - Updates

After the tragic death of Ernest Marples, I'm sorry to say that the site fell in to a bit of disrepair. With no postcode data and no new boundary data, it looked like VoteUK was going to be permanantly out of business.

Thanks - once again - to the clever-clogs at TheyWorkForYou, at least half of the problem has been solved.

The API call getConstituency now has a future parameter.  Adding future=1 to the call will return the constituency the Postcode will be in for the 2010 General Election.

I've also made use of TWFY's getMP API call.  It returns enough detail about the current MP to be useful - including a photo.

So, a valid postcode will get you something like this:

MP Photo
MP Photo

One thing to note about the photos. Each one is a different size. This gives us two small problems.

Firstly there is no guarantee of how small the photo is. Should one MP's photo be massive, that could cause a problem for the phone trying to download it. All the ones I've tried so far have been thumbnail size.

Secondly, because we don't know the height and width of the image, we can't put the height and width attributes in the <img> tag.  Not only is this poor HTML, but it will mean that rendering the page will take longer and - depending on the phone - page reflow may occur.

To mitigate this issue, I'm using http://tinysrc.mobi/ - it will automatically shrink the picture to fit the phone.  This doesn't help with the page reflow issue though.

As for geo-locating Postcodes - I suggest you respond to Ordnance Survey's consultation and / or lobby your MP.

Until there's an official source for postcode data, I've gone back to using Yahoo!'s geo-location API.  I then pass these co-ordinates on to the Google Maps API.

So, VoteUK lives on.  Next steps are to make sure that all the data I got from the Electoral Commission is valid and build a framework for volunteers to enter their local candidate details.

Free Our Postcodes

VoteUK is no more.  In order to precisely show you where your electoral registration office was, I needed to take its postcode and covert it to latitude and longitude.  That's the service Ernest Marples provided.

A few days ago, the Post Office - in their infinite wisdom - set their legal dogs on those running Ernest Marples.

The Post Office charges for the file that they generated which converts post codes to location.  It can cost anywhere from £1,000 to £4,000 per year to get accurate data.  That's a price that I can't afford - neither can many non-profits, startups or innovators.

"I take the position that the postcode file and the data set of physical coordinates that go with it are a national asset that should be freely available to any UK citizen"  - Tom Watson MP

The Guardian has shown that there is more economic benefit to the UK by setting this data free.

So, what can be done about it?

The Royal Mail is in its death-throes. It is vital that data created and supported by public money is returned to the public before it is sold off to the highest bidder... only to be sold back to us.

VoteUK - Some Minor Setbacks

One of the problems with creating a service which deals with elections, is that boundaries change.  One year you might be in the Electoral Constituency of Woking, the next year it might be Guildford.  Boundaries have to shift in order to keep each MP with roughly the same number of constituents.

The work to determine how these boundaries should be formed is done by The Boundary Commission.  They have produced a report to show how the boundaries will be set out at the next General Election.  There report - while detailed, thorough and no doubt accurate - is utterly useless.  Well, from a "linked data" perspective.  It's a 57 MB PDF if you want to see for your self.

I was expecting, along with the rationales, maps and population densities to see something like

Constituency: Woking

Ward: Mount Herman East

Postcodes: GU22 0XX, GU22 0XY, GU22 0XZ ...

Or, indeed, anything which would allow one to easily link the data to other sources.  This is what the report contains.

A Detailed Map of Surrey
A Detailed Map of Surrey

While the map is pretty detailed, it doesn't contain any geo-spatial co-ordinates.  It looks like it has just been drawn by hand in ink.  There is no way to extract any information out of this map.

The also produce a list of constituencies and wards.

This is not text - it's a screen shot!
This is not text - it's a screen shot!

There are three problems with this.

  1. It's a screen shot.  I don't mean that I've taken a screen shot, I mean that they have taken a screenshot of the text and pasted it into the report.  There is no way to copy the text out of there.
  2. Even if it were possible, they don't list the Government standard codes for the wards
  3. There are no postcodes or other forms of information which tie the ward to a specific place.

Gah!

So, how can I find this information?  I know! I'll write to those nice folk at Parliament

Dear Sir or Madam,

I notice that you provide a website which allows Constituency lookup from a postcode (http://findyourmp.parliament.uk/)

Do you have the data for the *new* Constituencies proposed by the Boundary Commission?

The Boundary Commission has maps of the new areas (http://www.statistics.gov.uk/pbc/default.asp) but these don't have postcodes on them.

I'm happy to make an FoI request if that is your preferred way of releasing the information.

If you do not have the information - would you be able to tell me who does?

Many thanks

A few days later I got back this.

Dear Sir,

Thank you for your enquiry asking if we have the post codes for the new Constituencies proposed by the Boundary Commission.

I am afraid, the House of Commons Information Office is unable to give you a list of the post codes for the proposed "new" constituencies Boundaries  .The House purchases a list of postcodes for each Parliamentary constituencies from the Office of National Statistics and the new list will not be purchased until nearer the time of the General Election when the changes in Parliamentary constituencies take effect.

You may like to contact the Office of National Statistic to see if you can purchase a list from them of the new constituencies.

Customer Contact Centre
Office for National Statistics
Room 1.015
Government Buildings
Cardiff Road
Newport
South Wales
NP10 8XG
Telephone - +44 (0) 845 601 3034

I hope this is helpful

So, off to the ONS! I took a look through their website, couldn't find what I wanted, so I emailed them.

I'm looking for some definitive data on the electoral constituencies and their comprising wards for the next general election.  That is, those incorporating the boundary changes in the Boundary Commission's Fifth periodical report.

Under "Names and codes for Electoral Geography" your document "Westminster Parliamentary Constituencies" only lists the 647 constituencies from the 2005 election.  Do you have the data for the upcoming election?

Similarly, in "Names and codes for Administrative Geography" I'm not sure if the document "Wards (Eng) Dec 2008 Names and Codes" contains the latest wards.  There also seems to be no schema to link Wards to Constituencies that I can see.

Do you hold such information?

Which sadly got back

Dear Terence,
Thank you for your recent enquiry
Please be advised that this information is currently not available. This is because current wards are split across the new boundaries and a review of these is about to be carried out which makes them subject to change.

If you have any further questions, please let me know.

So, no luck there.

Is this really so hard? All I want is to know that Postcode X is in Ward Y of Constituency Z.  It would appear that this information just isn't held anywhere. The review has been completed by the Boundary Commission but they either don't consider linked data or they don't share it. I just wish they would Set Our Data Free.

Or am I barking up the wrong tree entirely?