Mapping Scotland's GPs
Why build a map?
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.
I wanted to see the distribution of GPs in relation to population. I also wanted to explore some MapLibre and PMTiles technologies.
The GP Data
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 I realised that the available datasets were of different concepts, and none of the dataset sizes match.
- PHS GP Practice Contact Details and List Sizes
- PHS Scottish Morbidity Records SMR Reference Data
- GP Practices
- GP Branch Practices
- GPs (the people - practice pairs)
- NHS24
While this data is open data or public, I wasn’t able to find an open mapping across the datasets / concepts.
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 just 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 to 2022 census data.
Mapping Methodology
- Use Maplibre GL JS.
- Use OpenFreeMap Positron (© OpenMapTiles) as a great muted basemap using data OpenStreetMap.
- Identify NHS Scotland style guide, to make the map feel health related.
- Use OGL Boundaries for regional Health Boards, but create centroids for label positioning. A done-beats-perfect compromise. One source of data would have been preferable.
- Rework 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 was wrong. The right teams were identified and given a heads-up.