Skip to main content
Open Innovations is winding down and will no longer be commencing new work from May 2026.

A dashboard for every constituency

We are very proud of our UK constituency data hex maps site. It maps data about UK constituencies across six different themes: Economy, Energy, Environment, Health, Society, and Transport. We are continually adding new datasets when we find them or when they are suggested to us, and we try to update visualisations when a new version is made available.

The datasets come from a variety of sources from UK Government departments to OpenStreetMap to third sector organisations. We always make sure to include the source and reshare the data as a (normally cleaner) CSV file. A few months ago, building on a few conversations we'd had, we decided that we'd like to make all the effort we put into the hex map site more reusable.

Reusable data

Just providing a hex map on a webpage is of limited use. Providing CSV files of the data is a bit more useful for those that want to explore or build upon what we did. But there was a bunch of meta data that we were using to build the hex maps that we thought we should share too. That's things like our choice of colour scale range, some units for the columns in the CSV, the legends, and the columns we used to map the data.

We've created a simple machine-readable "API" in JSON format that provides an index split by theme with an entry for each of the visualisations that links to a fuller JSON file for each one. This way others (and us!) could easily get all the data and meta data in an automated and consistent way. This is our #RadicallyOpen approach.

One for all and all for one

As well as being #RadicallyOpen we also like to "eat our own dog food". That means using your own tools/products/services so that we know they work and quickly find out what improvements are needed. In that vein we had an idea to create a view that showed a constituency with every dataset. Effectively, could we "pivot" the data and make visualisations with it?

The answer was: yes! We have built an entire site to show just that: a dashboard for every constituency.

We have used Lume static site generator and some JavaScript to programmatically get all the data from every hex map visualisation and then to build a constituency-specific dashboard.

Chart types

We use the values field returned by our API to infer the "type" of visualisation. For example, whether the data represents a time-series (if there are a lot of values that look like dates), a categorical variable, or just a single value. Based on this, we either build a line chart, a bar chart, or display a number.

How many what?

Just displaying a number on a dashboard panel isn't always enough. Just saying "Electricity generation: 1025" is all very well but 1025 what? Watts? MW? GW? We sometimes need units.

We found a file of units made by GhostWrench that was a great starting point. We cleaned up some of descriptions, converted the language to British English, and added currencies to make our own version of a units definition. This exercise helped us think more deeply about the variety of things we encounter in the constituencies data.

Sometimes a data column may be a scaled version of a unit e.g. when "percent" values are actually given as a fraction (i.e. 0 to 1) rather than from 0 to 100. Sometimes even adding units to a figure isn't informative enoughe.g. the EU referendum results can be displayed as "EU referendum: 48%" but 48% what?

To deal with all these different situations we created a unitsobject that defines the units for numerical columns in the data. We allow units to have the following properties:

  • value e.g. "percent", "GBP", "MW", "Mb/s" etc. These should be combinations of units defined in the file mentioned.
  • category (optional) we've mostly used this to highlight that say "GBP" is a "currency".
  • scaleBy(optional) which lets you indicate that a number would need to be multiplied by this to be in the unit
  • precision (optional) the raw data files sometimes have too many decimal places to be sensible so this is a way for us to say how we think a number should be rounded. If this had the value "0.1" it would mean we think you should round the number to the nearest 0.1. If it was "5000" the displayed number should probably be rounded to the nearest 5000.
  • notes (optional) a short description that could help clarify e.g. for the EU referendum this might say "Percentage that voted Leave".

Adding units to the API meant our dashboard site could add appropriate prefix/postfixes to a number - "£10/year" is much more informative than just "10" - and add clarifying notes after the number where we feel it necessary.

Ratings

Showing a number in a panel can often lead to questions like "Is this a lot?", "Is the constituency doing badly compared to others?" etc. To help answer this, for some panels we came up with the idea of showing a relative rating. This is based on calculating a percentile rank for the constituency and then we convert this into a 5 star rating.

There are some cases where more is not better. In those cases we've flipped the ranking so that a lower relative value would receive more stars e.g. a lower child poverty rate is better so those with the lowest values get ★★★★★. After some user testing we added a note to each rating that says if a higher or lower number leads to more stars.

Adding a rating requires a value judgement. Not everything has a clear direction of "better" e.g. more food banks is good if you need food banks but bad in terms of what it says about the need for them. A trend over time is also hard to sum up this way. So, not every panel/statistic gets a relative rating.

Feedback and improvements

Over the past few weeks we've been showing our constituency dashboards to a few people (including on Mastodon) and getting useful feedback. This helped inform how we display units, add links to source data, improve the search page, add some limited chart axis labels, and a few other tweaks that have made it better for everyone.

Making these dashboard has mostly been a way to test our API. They aren't there to answer all questions - and we can't realistically expect them too - but they may provide interesting/useful overviews of constituencies to benefit MPs and constituents. Hopefully they trigger people to have questions that they can go and explore by following the links.

Once you've had chance to look at the dashboard, we'd love to hear if you found them clear. Also, if you know of an open dataset (provided by constituency or as points) that you think we should include, please get in touch.