House of Commons: How Members of Parliament vote

Follow me at @puntofisso _ Data by data.parliament _

What is this?

The UK General Election 2017 resulted in a hung parliament. The Conservatives led by Theresa May, who had been Prime Minister since July 2016, had to strike a deal with the Democratic Unionist Party to reach a majority. The Government relies on the combined 327 votes of the Conservative and Democratic Unionists, which is slightly above the required majority of 323.

This project is an interactive, visual exploration of each vote—called "division" in the UK Parliament—and the resulting majority.

Disclaimer: this visualization should be considered a proof-of-concept beta. There are some discrepancies in the data; for example, the divisions available through the API seem to be a subset of the full dataset.

For more data driven news, subscribe to my weekly newsletter.

Data

The list of MPs and their photos is tricky. I had to cross-reference two datasets, including data from TheyWorkForYou, as I couldn't find a full, exhaustive list of current MPs together with their so-called MNID, on the Parliament website.

As far as divisions are concerned, there are two endpoints I've used: the list of divisions at

http://lda.data.parliament.uk/commonsdivisions.json?_pageSize=25000&minEx-date=2017-06-08

and the detail of each division, for example

http://api.data.parliament.uk/resources/files/102.xml

There are some discrepancies in the data, or simply oddness in the way the endpoints return data (e.g. there is no JSON-equivalent to the XML endpoint above). This is because the PDS API is still work in progress.

All the issues, whether they are incorrect data, missing API calls, or simple desiderata, have been reported to the (excellent) teams working at Parliament on data and business systems, and we're working together to improve the quality of the data.

Code

The code I've used is available on Github.