NHS PCNs as a hex cartogram

Recently I spotted that Richard Wilson had made a hex cartogram of the NHS's new Integrated Care Boards (ICBs) which came into existence on 1st July. As we are massive fans of hex layouts, and making them reusable, I converted that ICB layout to HexJSON. Then Alex Porter suggested that there should be a hex layout for Primary Care Networks (PCNs). That set me off constructing the biggest hex layout I've made to date.

Getting the data

The first task was to get a list of PCNs. NHS Digital have a page for getting PCN Organisational Data Service codes. Unfortunately it is a little out-of-date so neither method provided on that page will actually return all PCNs; the ODS portal limits to 1000 results (there are over 1000 PCNs) and so does the ODS API. Thankfully, the Exeter Helpdesk were able to point me to a page which provides a download of PCNs - it has 1322 PCNs although some of them have closed. I extracted the open PCNs from this list and created a CSV file. I then found some data on the new ICBs from NHS Digital and added the ICBs as attributes to each PCN.

Building a map

To build a map we need to know where the PCNs are. I got this by doing a coordinate lookup for their postcodes. However some PCNs have the same address (presumably GP practices that host multiple) so I added a little bit of noise to the coordinates to avoid any PCNs having exactly the same coordinates - important for the next step which was to generate rough polygons. To do that I loaded the PCNs (with coordinates) into QGIS where I used the Voronoi Polygons tool. These polygons wouldn't be very reliable for a geographic tool but they do help find likely neighbours.

Voronoi map
An example of the voronoi polygons for PCNs in the North of England.
Credit: Open Innovations / Carto

After exporting the voronoi polygons as GeoJSON I was able to use our Hexify tool to spot which polygons had edges in common and then collapse them down to a hex grid. This gives a very rough draft layout which tries to preserve some of the geography whilst forcing everything to a hexagonal grid.

Dots that make up a hexagonal grid - roughly the shape of England
PCNs gridded using the Hexify tool
Credit: Open Innovations

The next step was to use our Hex Builder tool to move the hexes around into a "better" layout. A useful feature of the Hex Builder is that you can select all hexes of the same colour by pressing the "c" key on the keyboard. That meant that I could quickly move groups of PCNs around (I'd coloured each PCN by CCG) and saved a lot of time.

Trying to add 1261 PCNs to a contiguous hex layout would be tricky because there would be too much distortion and then changing things later involves a lot of work. So I took a similar approach to the House of Commons Library when they created a hex layout of MSOAs. I grouped PCNs by the 42 ICBs and left gaps between them. Here is the end result coloured by the old-style CCG groupings (now called sub ICB units).

Hex layout of PCNs
A first draft of a hex layout for NHS PCNs arranged by ICB and coloured by CCG
Credit: Open Innovations

I'm sure the layout isn't perfect - I had to try to work out where lots of PCNs were just based on their names - but I tried to keep CCGs together and recreate some geographic shapes where I could. The layout is open so can be tweaked/improved. If you do improve a part of the map, please contribute your updates to the version on Github so that we all have a better map.