Results of the UK General Election on 8 June 2017: some open data resources

Post: 30 June 2017

This post is a quick guide to some open data resources that I’ve found useful for analysis of the results of the recent UK General Election.

(I’ve going to refer to this election throughout as the “recent General Election” rather than the “2017 General Election”. Future-proofing …)

Electoral Commission

The Electoral Commission is a reliable central source of open data on UK elections. They don’t yet have a release for the recent General Election, but they have results for other UK elections back to 2005.

Commons Library

The current most authoritative source for compiled results of the recent General Election is the analysis released by the House of Commons Library. This includes the outcome in each constituency, vote counts for each party, size of the electorate (i.e. number of people eligible to vote), and the majority (margin of victory). There’s also a spreadsheet with names and vote counts for every candidate.

There were earlier versions of election results available from other sources, but be careful of them because they may contain input errors or may not have been updated with the corrections issued by electoral officers in several constituencies.

The Commons Library has also published comparable datasets with results of last year’s EU Referendum and the General Elections in 2015, 2010 and 2005 (though the latter two are in PDF only). The UK Election Statistics: 1918-2017 paper may also be of interest.

Other constituency-level indicators

General Election results are normally published only at constituency level, so breakdowns by ward or counting station are not readily available. (This lack of granularity lost Britain marks in the most recent Global Open Data Index.)

The Commons Library datasets include ONS statistical codes for each constituency, which is very helpful if you want to combine the results data with other constituency-level indicators.

Commons Library has an excellent guide to constituency statistics and data, as well as its own visualisation tool.

Some constituency data I found particularly useful when looking at the election results:

Further useful datasets

The FT released the full dataset used in its election analyses. This adds 50 demographic variables to an early version of the constituency-level results.

Comparison with the EU Referendum results has been area of much discussion. Official Referendum results were reported by council area but Chris Hanretty’s has also produced Leave and Remain vote shares for constituencies. (Some are modelled estimates and some are derived from council responses to BBC FOI requests.)

Prior to the election Nesta produced an interesting research-based dataset with information on the educational background of most of the candidates, with a focus on STEM subjects.

Maps

Boundary datasets for constituencies are available from ONS Geography for Great Britain and from OSNI for Northern Ireland. You can combine those yourself to create a UK-wide dataset or download the shapefile helpfully produced by Alasdair Rae.

Or if you want to make hex maps I recommend the hexagon cartogram shapefile released as open data by Ben Flanagan of Esri UK.

image

Additional resources for developers

I’ve mostly been doing analysis and static mapping, but if you like your election data flavoured more towards development use there are a couple of particular resources you should look at: