Democracy Club Menu

Data feeds of newly elected MPs from YourNextMP.com

by

We will be providing a data feeds of newly elected MPs from YourNextMP.com.

Here’s a technical post about our plans. Contact us if you would like to build something from our data, or see below.

mySociety just blogged about our joint plans to update YourNextMP.com as the election results come in over night on the 7th and 8th of May.

As well as updating TheyWorkForYou in real time, YourNextMP will get updated and the data that powers it will too.

We will expose this for reuse in a few ways:

Home page

Results will also be shown on the homepage of YourNextMP, and candidate and constituency pages will show the winners.

Twitter

We will be tweeting on @democlub every time the Atom feed is updated.

CSV

The CSV export will have a new column elected with the same logic as above. This file is updated every 15 minutes

PopIt API

The PopIt API people objects will be updated to have a new key in the standing_in.2015 object. If the key is true the person has been elected, if it’s false the person is known not to have been elected (because someone else in that constituency got elected).

If the key doesn’t exist then we don’t have the results for that constituency yet.

The winner will also have a new membership created like:

 {
    'start_date': '2015-05-08',
    'end_date': '9999-12-31',
    'organization_id': 'commons',
    'post_id': ...,
    'person_id': ...
 }

… where post_id and person_id as as for their 2015 candidate membership. (n.b. this is actually broken at the moment, but I’ll have it fixed soon).

Atom feed

We will publish an Atom feed with the results, updated as we press the button. This will be published at /results/all.atom and will have the following custom fields:

post_id

The MapIt area ID, which we use as constituency ID

winner_popit_person_id

The PopIt person ID of the winner in that constituency

winner_person_name

The name of the winning candidate

winner_party_id

The party ID of the winner’s party, as used on YourNextMP (these are derived from the Electoral Commission’s IDs except in a few cases: joint parties, independents and the speaker seeking re-election.

winner_party_name

The human readable party name

user_id

The user ID of the YourNextMP volunteer who recorded the result

constituency_name

The human readable name of the constituency

information_source

Our source for the result (presumably BBC TV coverage in most cases)

image_url_template

If present, this is a URL template for getting a thumbnail image of the candidate. You should replace {width} and {height} with the required width and height (you can just fix one of them by setting the other to 0) and {extension} with ‘jpg’ or ‘png’.

parlparse_id

If present, that means that this person had that ID in TheyWorkForYou / PublicWhip / parlparse before this election.