Mapping Scotland's GPs

Updated on

>>> See the Map of Scottish GPs

Why build a map?

I wanted to see the distribution of GPs in relation to population.

I wanted to explore some MapLibre and PMTiles technologies.

I like making it easy to access complex datasets.

The GP Data

GPs are key infrastructure for public health. In Scotland, as in the rest of the UK, your General Practitioner is both your local doctor and the route in to most other healthcare.

The key challenge in this work was that the term “GP” is overloaded, making data manipulation complex.

Is it the Place, as in “The GPs Surgery”?

The Person - “my GP”?

Or the Organisation - “Dr Smith’s Medical Practice”?

Any early hopes of an easy project vanished when the available datasets were of different concepts.

While this data is open data or public, I wasn’t able to find an open mapping across the datasets / concepts. I built one using fuzzy location and text matching. This worked, but hasn’t been fully checked. Please let me know if you spot something that doesn’t look quite right.

The Population Data

Heikki Vesanto produced an award winning Every Person in Scotland on the Map from the 2011 census data. Heikki very helpfully shared his one-point-per-person positions.

I reimplemented this in pink, using pmtiles, a cloud-first geospatial technology that simplified the hosting requirements.

Pink was a colour that hadn’t yet been used. The overlap to microscopy staining was a happy accident.

I hope to return to this to update using 2022 census data.

Mapping Methodology

  • Maplibre GL JS.
  • OpenFreeMap Positron (© OpenMapTiles) as a great muted basemap using OpenStreetMap data.
  • NHS Scotland style guide, to make the map feel health related.
  • OGL Boundaries for regional Health Boards, but using a separate layer of centroids for label positioning. A done-beats-perfect compromise. One source of data would have been preferable.
  • Every Person in Scotland on the Map 2011, in pink in QGIS, to mbtiles, then to pmtiles for efficient hosting and access.
  • Add GP layers with clustering.
  • Add a layer control to turn off the population pink.

Key Learnings

Things I didn’t know at the start of this project.

  • Your GP Practice is (probably) its own business. Your GP (the person) may or may not be a partner in that business.
  • Health Boards: There are 14 regional Health Boards in Scotland. There are non-regional Health Boards that fulfil specialist national functions, including NHS24 and Public Health Scotland.
  • GP Practices are often under a Scotland-wide contract to provide services to the NHS. Some GP Practices are run by Health Boards directly, and some GP Practices operate under special locally negotiated contracts.
  • Sometimes multiple GP Practices operate out of the same building, making joining on Addresses impractical.
  • There is, and has been, plenty of innovation and make-it-work in the NHS. Therfore NHS datasets will contain exceptions to exceptions.
  • Key datasets are held in very old data formats (here, DOS fixed width). While it’s canny not to reimplement something that isn’t broken, even with just this shallow dive into non-patient data, I have some sympathy for anyone tasked with creating a working nationwide app.
  • While data about GPs does model main and branch practices, it doesn’t fully model the business relationship across practices. (e.g. Alba Medical Group)

Giving Back

While working on this map, it became clear that some NHS data wasn’t quite right. Where possible teams were identified and given a heads-up.