in Blog, Featured

Which constituency is that in?

I’m learning that old skool stakeholder engagement involves a lot of spreadsheets.

We needed to work out which UK Parliamentary constituencies some organisations were in, to identify who needed to be contacted about an issue.  400 organisations, in fact.

Could have been a boring day’s work for someone, but became instead quite an enjoyable lunchtime project exploring TheyWorkForYou‘s API to information about MPs.

And so to save others future pain, here’s a little thing that takes a list of postcodes, and returns details of the constituencies for each one: Which constituency is that in?

You could probably do the rest of the matching up work in Excel with some clever VLOOKUPs. If that’s your kinda thing.

This hosted version limits you to batches of 25; if you want to grab the code and host it yourself with your own API key, it’s free for anyone to use.

  1. Blimey Steph, there’s no stopping you these days is there? I think I’m going to start calling you The Machine! Yet another great idea executed brilliantly and – seemingly – effortlessly.

  2. I tried to do this last year with some data and had to sign up to some heavy post office academic licencing thing to get a look up table – which was only to some code I had to manually turn into local government areas!

    This looks fabulous but I’m amazed the post office lawyers aren’t trying to get it shut down..

  3. @Caroline: I think we’re OK here – the postcode mapping is done by MySociety (who run TheyWorkForYou) who I presume have some licensing arrangement in place with Royal Mail.

Comments are closed.

Webmentions

  • Whose Constituency is that Post Code in ? - Scotweb2 February 8, 2009

    […] The ever inventive Steph Gray has produced this wonderful piece of code […]