Skip to content

Commit 1fbb430

Browse files
committed
Updated the dataset with the latest available data - now via an API refreshed on a daily basis. R script changed accordingly to now access the data via API.
1 parent f3e1f3c commit 1fbb430

4 files changed

Lines changed: 109 additions & 112 deletions

File tree

general_practice/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</tr>
1818
<tr>
1919
<td>Publisher URL</td>
20-
<td><a href="https://digital.nhs.uk/services/organisation-data-service/data-downloads/gp-and-gp-practice-related-data"></a>https://digital.nhs.uk/services/organisation-data-service/data-downloads/gp-and-gp-practice-related-data</td>
20+
<td><a href="https://digital.nhs.uk/services/organisation-data-service/data-search-and-export/csv-downloads/gp-and-gp-practice-related-data">https://digital.nhs.uk/services/organisation-data-service/data-search-and-export/csv-downloads/gp-and-gp-practice-related-data</a></td>
2121
</tr>
2222
<tr>
2323
<td>Geography</td>
@@ -29,11 +29,11 @@
2929
</tr>
3030
<tr>
3131
<td>Temporal coverage</td>
32-
<td>NA</td>
32+
<td>Latest data correct at 2026-01-23</td>
3333
</tr>
3434
<tr>
3535
<td>Update frequency</td>
36-
<td>Quarterly</td>
36+
<td>Daily</td>
3737
</tr>
3838
<tr>
3939
<td>Licence</td>
@@ -53,11 +53,11 @@
5353
</tr>
5454
<tr>
5555
<td>Last updated</td>
56-
<td>2023-06-14</td>
56+
<td>2026-01-23</td>
5757
</tr>
5858
<tr>
5959
<td>Notes</td>
60-
<td>The postcodes for GP Practices are matched with centroids derived from the May 2023 release of the <a href="https://geoportal.statistics.gov.uk/datasets/ons-postcode-directory-may-2023/about">ONS Postcode Directory</a></td>
60+
<td>The postcodes for GP Practices are matched with centroids derived from the November 2025 release of the <a href="https://geoportal.statistics.gov.uk/datasets/ons::ons-postcode-directory-november-2025-for-the-uk/about">ONS Postcode Directory</a></td>
6161
</tr>
6262
<tr>
6363
<td>Lab visualisation</td>

general_practice/pre-processing.R

Lines changed: 56 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,82 @@
1-
# GP Practices in England and Wales #
1+
# GP Practices in Trafford - from the complete dataset for England and Wales.
22

33
# Source: NHS Digital
4-
# Publisher URL: https://digital.nhs.uk/services/organisation-data-service/data-downloads/gp-and-gp-practice-related-data
4+
# Publisher URL: https://digital.nhs.uk/services/organisation-data-service/data-search-and-export/csv-downloads/gp-and-gp-practice-related-data
5+
# Dateset URL: https://www.odsdatasearchandexport.nhs.uk/api/getReport?report=epraccur
6+
# Metadata URL: https://www.odsdatasearchandexport.nhs.uk/referenceDataCatalogue/565791179.html#GPPractices(PrescribingCostCentres)-epraccur.csv
57
# Licence: Open Government Licence
68

7-
library(tidyverse) ; library(lubridate)
9+
# **Useful information from FAQ section of the API Help and Guidance document available on https://www.odsdatasearchandexport.nhs.uk/:**
10+
#
11+
# How do I find a list of English GP Practices?
12+
#
13+
# English GP Practices codes are created primarily for prescribing, they therefore have a primary role of RO177 Prescribing Cost Centre.
14+
# The non primary role of RO76 GP Practice allows GP Practice records to be distinguished from other prescribing cost centres/settings (such as Walk in Centres).
15+
# Refer to the Prescribing Cost Centre section within the Reference Data Catalogue for further information. (James Austin NOTE: this is the metadata URL above.)
816

9-
# download and unzip data
10-
url <- "https://files.digital.nhs.uk/assets/ods/current/epraccur.zip"
11-
download.file(url, dest = "epraccur.zip")
12-
unzip("epraccur.zip", exdir = ".")
13-
file.remove("epraccur.zip")
17+
# The information is refreshed at 2am each night.
1418

15-
# read data
16-
df <- read_csv("epraccur.csv",
17-
# provide variable names
19+
20+
library(tidyverse) ; library(httr) ; library(jsonlite) ; library(sf) ; library(lubridate)
21+
22+
# Read in data via the API and replace codes with meanings via the metadata information
23+
df <- read_csv("https://www.odsdatasearchandexport.nhs.uk/api/getReport?report=epraccur",
24+
# Provide variable names as the file only contains data starting on the first row.
25+
# These names come from the "Report Alias (legacy csv) column on the metadata page (see URL above)
26+
# Only changes are the fields containing LegalStartDate/LegalEndDate. There are duplicates of these
27+
# specified on the page, so I've had to differentiate using the legacy names.
1828
col_names = c(
19-
"Organisation Code", "Name", "National Grouping",
20-
"High Level Health Geography", "Address Line 1",
21-
"Address Line 2", "Address Line 3", "Address Line 4",
22-
"Address Line 5", "Postcode", "Open Date", "Close Date",
23-
"Status Code", "Organisation Sub-Type Code", "Commissioner",
29+
"OrganisationCode", "OrgName", "NHSER_code", "ICB_code",
30+
"Address1", "Address2", "Address3", "Town", "County", "Postcode",
31+
"Open Date", "Close Date", "StatusName", "Primary Role / OrgTypeID", "TargetOrgCode",
2432
"Join Provider/Purchaser Date", "Left Provider/Purchaser Date",
25-
"Contact Telephone Number", "Null", "Null", "Null",
26-
"Amended Record Indicator", "Null", "Provider/Purchaser",
27-
"Null", "Prescribing Setting", "Null")) %>%
33+
"TelephoneNumber", "NULL", "NULL", "NULL",
34+
"Amended Record Indicator", "NULL", "TargetOrgCode",
35+
"NULL", "RoleID", "NULL")) %>%
2836
# recode values
29-
mutate(`Status Code` =
30-
fct_recode(`Status Code`,
31-
"Active" = "A", "Closed" = "C", "Dormant" = "D",
32-
"Proposed" = "P"),
33-
`Organisation Sub-Type Code` =
34-
fct_recode(`Organisation Sub-Type Code`,
37+
mutate(`Primary Role / OrgTypeID` =
38+
fct_recode(`Primary Role / OrgTypeID`,
3539
"Allocated to a Provider/Purchaser Organisation" = "B",
3640
"Not allocated to a Provider/Purchaser Organisation" = "Z"),
37-
`Prescribing Setting` =
38-
fct_recode(as.character(`Prescribing Setting`),
39-
"Other" = "0", "WIC Practice" = "1", "OOH Practice" = "2",
40-
"WIC + OOH Practice" = "3", "GP Practice" = "4",
41-
"Public Health Service" = "8", "Community Health Service" = "9",
42-
"Hospital Service" = "10", "Optometry Service" = "11",
43-
"Urgent & Emergency Care" = "12", "Hospice" = "13",
44-
"Care Home / Nursing Home" = "14", "Border Force" = "15",
45-
"Young Offender Institution" = "16", "Secure Training Centre" = "17",
46-
"Secure Children's Home" = "18", "Immigration Removal Centre" = "19",
47-
"Court" = "20", "Police Custody" = "21",
48-
"Sexual Assault Referral Centre (SARC)" = "22",
49-
"Other – Justice Estate" = "24", "Prison" = "25")) %>%
41+
RoleID =
42+
fct_recode(as.character(RoleID),
43+
"Other" = "RO72", "WIC Practice" = "RO87", "OOH Practice" = "RO80",
44+
"WIC + OOH Practice" = "RO80|RO87", "GP Practice" = "RO76",
45+
"Public Health Service" = "RO255", "Community Health Service" = "RO247",
46+
"Hospital Service" = "RO250", "Optometry Service" = "RO252",
47+
"Urgent & Emergency Care" = "RO259", "Hospice" = "RO249",
48+
"Care Home / Nursing Home" = "RO246", "Border Force" = "RO245",
49+
"Young Offender Institution" = "RO260", "Secure Training Centre" = "RO257",
50+
"Secure Children's Home" = "RO256", "Immigration Removal Centre" = "RO251",
51+
"Court" = "RO248", "Police Custody" = "RO254",
52+
"Sexual Assault Referral Centre (SARC)" = "RO258",
53+
"Other – Justice Estate" = "RO253", "Prison" = "RO82",
54+
"Primary Care Network" = "RO321", "Independent Pharmacy Prescriber Pathfinder" = "RO323")) %>%
5055
# convert to date format
5156
mutate(`Open Date` = as_date(as.character(`Open Date`)),
52-
`Close Date` = as_date(as.character(`Close Date`))) %>%
57+
`Close Date` = as_date(as.character(`Close Date`)),
58+
`Join Provider/Purchaser Date` = as_date(as.character(`Join Provider/Purchaser Date`)),
59+
`Left Provider/Purchaser Date` = as_date(as.character(`Left Provider/Purchaser Date`))) %>%
5360
# convert to proper case
54-
mutate_at(c("Name", "Address Line 1", "Address Line 2", "Address Line 3", "Address Line 4"), str_to_title) %>%
61+
mutate_at(c("OrgName", "Address1", "Address2", "Address3", "Town"), str_to_title) %>%
5562
# concatenate addresses to a single variable
56-
unite(Address, `Address Line 1`, `Address Line 2`, `Address Line 3`,
57-
`Address Line 4`, `Address Line 5`, sep = ", ", na.rm = TRUE, remove = TRUE) %>%
63+
unite(Address, Address1, Address2, Address3, Town, sep = ", ", na.rm = TRUE, remove = TRUE) %>%
5864
# drop variables starting NULL
5965
select(-starts_with("NULL"))
6066

6167

62-
# Tidy up filesystem
63-
file.remove("epraccur.csv")
64-
file.remove("epraccur.pdf")
65-
66-
6768
# Get just GPs in Trafford ---------------------------------------------------------------
6869

6970
# NOTE Clinical Commissioning Groups (CCG) were abolished in favour of Integrated Care Boards (ICB) in 2022.
7071
# ICB22NM: NHS Greater Manchester Integrated Care Board
7172
# ICB22CD: E54000057
7273
# ICB22CDH: QOP
7374

74-
library(httr) ; library(jsonlite) ; library(sf)
75-
76-
# Retrieve postcode centroids for Trafford - https://geoportal.statistics.gov.uk/datasets/ons-postcode-directory-may-2023/about
77-
pcode_file_reference <- "ONSPD_MAY_2023_UK" # makes it easier to change this once here than throughout the code below
75+
# Retrieve postcode centroids for Trafford - https://geoportal.statistics.gov.uk/datasets/ons::ons-postcode-directory-november-2025-for-the-uk/about
76+
pcode_file_reference <- "ONSPD_NOV_2025_UK" # makes it easier to change this once here than throughout the code below
7877

7978
tmp <- tempfile(fileext = ".zip")
80-
GET(url = "https://www.arcgis.com/sharing/rest/content/items/bd25c421196b4546a7830e95ecdd70bc/data",
79+
GET(url = "https://www.arcgis.com/sharing/rest/content/items/3635ca7f69df4733af27caf86473ffa1/data",
8180
write_disk(tmp))
8281

8382
unzip(tmp, exdir = pcode_file_reference) # extract the contents of the zip
@@ -86,7 +85,7 @@ unzip(tmp, exdir = pcode_file_reference) # extract the contents of the zip
8685
unlink(tmp)
8786

8887
postcodes <- read_csv(paste0(pcode_file_reference, "/Data/", pcode_file_reference, ".csv")) %>%
89-
filter(oslaua == "E08000009") %>%
88+
filter(lad25cd == "E08000009") %>%
9089
select(Postcode = pcds,
9190
lon = long,
9291
lat = lat)
@@ -96,10 +95,10 @@ unlink(pcode_file_reference, recursive = TRUE)
9695

9796
# Get just GPs in Trafford by matching to Trafford postcodes and filtering to select only active GP Practices
9897
gp <- inner_join(df, postcodes, by = "Postcode") %>%
99-
filter(`Prescribing Setting` == "GP Practice",
100-
`Status Code` == "Active") %>%
101-
select(Name, Address, Postcode,
102-
telephone = `Contact Telephone Number`, lon, lat) %>%
98+
filter(RoleID == "GP Practice",
99+
StatusName == "ACTIVE") %>%
100+
select(name = OrgName, Address, Postcode,
101+
telephone = TelephoneNumber, lon, lat) %>%
103102
rename_all(tolower)
104103

105104
# write results as CSV and GeoJSON
Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
11
name,address,postcode,telephone,lon,lat
2-
Park Medical Practice,"Park Medical Practice, 405 Stockport Road, Altrincham",WA15 7XR,0161 9733485,-2.315695,53.398559
3-
Altrincham Medical Practice,"Altrincham Medical Pract, Lloyd House, 7 Lloyd St., Altrincham, Cheshire",WA14 2DD,0161 9282424,-2.351614,53.38451
2+
Park Medical Practice,"405 Stockport Road, Timperley, Altrincham",WA15 7XR,0161 9733485,-2.315695,53.398559
3+
Altrincham Medical Practice,"Lloyd House, 7 Lloyd Street, Altrincham",WA14 2DD,0161 9282424,-2.351613,53.384527
44
Urmston Group Practice,"6 Woodsend Crescent Road, Urmston, Manchester",M41 8AA,0161 7559870,-2.394066,53.452491
5-
Timperley Health Centre (Westwood),"Timperley Health Centre, 169 Grove Lane, Timperley, Altrincham, Cheshire",WA15 6PH,0161 9803751,-2.323566,53.397228
6-
Shay Lane Medical Centre (Kelman),"Shay Lane Medical Centre, Shay Lane, Hale Barns, Altrincham, Cheshire",WA15 8NZ,0161 9803835,-2.31556,53.372189
7-
Davyhulme Medical Centre,"130 Broadway, Davyhulme,Urmston, Manchester",M41 7WJ,0161 7485559,-2.366782,53.459483
8-
Shay Lane Medical Centre (Patel),"Shay Lane Medical Centre, Shay Lane, Hale Barns, Altrincham, Cheshire",WA15 8NZ,0161 9802656,-2.31556,53.372189
9-
Primrose Surgery,"59 Old Crofts Bank, Urmston, Manchester",M41 7AB,0161 7472424,-2.357311,53.456159
10-
Boundary House Medical Centre,"Boundary House, 462 Northenden Road, Sale, Cheshire",M33 2RH,0161 9729999,-2.288936,53.415635
11-
Washway Road Medical Centre,"Washway Road Medical Ctr., 67 Washway Road, Sale, Cheshire",M33 7SS,0161 9624354,-2.328288,53.422516
12-
West Timperley Medical Centre,"West Timperley Med. Ctr., 21 Dawson Road, West Timperley, Altrincham, Cheshire",WA14 5PF,0161 9291515,-2.353117,53.402699
13-
Bodmin Road Health Centre,"Bodmin Road Health Centre, Bodmin Road, Sale, Cheshire",M33 5JH,0161 9624625,-2.351718,53.428123
14-
Delamere Medical Practice,"The Delamere Med Pract, Delamere Avenue, Stretford, Manchester",M32 0DF,0161 8640200,-2.307365,53.450887
15-
Partington Central Surgery,"Partington Central Surg, Partington Health Centre, Central Road, Partington, Manchester",M31 4FY,0161 7757032,-2.425016,53.416781
16-
Limelight Health And Wellbeing Hub,"Limelight, 1 St Brides Way, Old Trafford, Manchester",M16 9NW,0161 2267777,-2.261969,53.461412
17-
Firsway Health Centre,"121 Firsway, Sale, Cheshire",M33 4BR,0161 9050310,-2.355468,53.421289
5+
Timperley Health Centre (Westwood),"169 Grove Lane, Timperley, Altrincham",WA15 6PH,0161 9803751,-2.323566,53.397244
6+
Shay Lane Medical Centre (Kelman),"Shay Lane Medical Centre, Shay Lane, Hale Barns, Altrincham",WA15 8NZ,0161 9803835,-2.315559,53.372205
7+
Davyhulme Medical Centre,"130 Broadway, Davyhulme,Urmston, Urmston, Manchester",M41 7WJ,0161 7485559,-2.366781,53.459499
8+
Shay Lane Medical Centre (Patel),"13 Shay Lane, Hale Barns, Altrincham",WA15 8NZ,0161 9802656,-2.315559,53.372205
9+
Primrose Surgery,"59 Old Crofts Bank, Urmston, Manchester",M41 7AB,0161 7472424,-2.35731,53.456175
10+
Boundary House Medical Centre,"462 Northenden Road, Sale",M33 2RH,0161 9729999,-2.2889370000000002,53.415652
11+
Washway Road Medical Centre,"67 Washway Road, Sale",M33 7SS,0161 9624354,-2.328392,53.422417
12+
West Timperley Medical Centre,"21 Dawson Road, Broadheath, West Timperley, Altrincham",WA14 5PF,0161 9291515,-2.353117,53.402715
13+
Bodmin Road Health Centre,"Bodmin Road, Sale",M33 5JH,0161 9624625,-2.351718,53.428139
14+
Delamere Medical Practice,"Delamere Avenue, Stretford, Manchester",M32 0DF,0161 8640200,-2.30738,53.450859
15+
Partington Central Surgery,"Partington Health Centre, Central Road, Partington, Manchester",M31 4FL,0161 7757032,-2.42617,53.417784
16+
Limelight Health And Wellbeing Hub,"Limelight, 1 St Brides Way, Manchester",M16 9NW,0161 2267777,-2.26197,53.461412
17+
Firsway Health Centre,"121 Firs Way, Sale",M33 4BR,0161 9050310,-2.355468,53.421305
1818
Partington Family Practice,"Partington Health Centre, Central Road, Partington, Manchester",M31 4FL,0161 7757033,-2.42617,53.417784
19-
Flixton Road Medical Centre,"Flixton Road Medical Ctr, 132 Flixton Road, Urmston, Manchester",M41 5BG,0161 7482021,-2.362664,53.448267
20-
Conway Road Medical Practice,"Conway Road Med Practice, 80a Conway Road, Sale, Cheshire",M33 2TB,0161 9731151,-2.303561,53.417873
21-
Barrington Medical Centre,"33 Market Street, Altrincham, Cheshire",WA14 1PF,0161 9289621,-2.35263,53.387437
22-
St Johns Medical Centre,"Altrincham Health, 31-33 Market Street, Altrincham, Cheshire",WA14 1PF,0161 9285522,-2.35263,53.387437
23-
Family Surgery,"The Surgery, 94 Navigation Road, Altrinchan, Cheshire",WA14 1LL,0161 9299300,-2.346055,53.396194
24-
Village Surgery,"The Village Surgery, Timperley Health Centre, 169 Grove Lane,Timperley, Cheshire",WA15 6PH,0161 9039010,-2.323566,53.397228
25-
Lostock Medical Centre,"431 Barton Road, Stretford, Manchester",M32 9PA,0161 8651100,-2.328128,53.45458
26-
North Trafford Group Practice,"North Trafford Group Prac, 864/866 Chester Road, Stretford, Manchester",M32 0PA,0161 8655556,-2.299421,53.453953
27-
Riddings Family Health Centre,"Riddings Family Hlth Ctr, 34 Riddings Road, Timperley, Altrincham, Cheshire",WA15 6BP,0161 9629662,-2.331291,53.404424
28-
Grove Medical Practice,"Grove Medical Practice, 169 Grove Lane,Timperley, Altrincham, Cheshire",WA15 6PH,0161 9039302,-2.323566,53.397228
19+
Flixton Road Medical Centre,"132 Flixton Road, Urmston, Manchester",M41 5BG,0161 7482021,-2.362664,53.448267
20+
Conway Road Medical Practice,"80a Conway Road, Sale",M33 2TB,0161 9731151,-2.303562,53.417889
21+
Barrington Medical Centre,"33 Market Street, Altrincham",WA14 1PF,0161 9289621,-2.352958,53.387183
22+
St Johns Medical Centre,"Altrincham Health & Wellbeing Ctr, 31-33 Market Street, Altrincham",WA14 1PF,0161 9285522,-2.352958,53.387183
23+
Family Surgery,"94 Navigation Road, Altrincham",WA14 1LL,0161 9299300,-2.346055,53.39621
24+
Village Surgery,"169 Grove Lane, Timperley, Altrincham",WA15 6PH,0161 9039010,-2.323566,53.397244
25+
Lostock Medical Centre,"431 Barton Road, Stretford, Manchester",M32 9PA,0161 8651100,-2.32852,53.45464
26+
North Trafford Group Practice,"864-866 Chester Road, Stretford, Manchester",M32 0PA,0161 8655556,-2.299421,53.453953
27+
Riddings Family Health Centre,"34 Riddings Road, Timperley, Altrincham",WA15 6BP,0161 9629662,-2.331292,53.40444

0 commit comments

Comments
 (0)