SlowGuess/NeurIPS_2023_OCR huggingface dataset:
The practice-level prescribing data in England has been published monthly by the National Health Services (NHS) Business Services Authority since 1998. This data provides information on the quantity and cost of prescribed medications for each general practitioner  $(GP)$  practice in the country. Although freely accessible, it is provided in individual files for each year, and is difficult to combine in order to analyze spatial or temporal trends. The OpenPrescribing service [10] enables the exploration of trends in items, cost, price per item, and quantity per item for each medical prescription and GP practice from 1998. However, a single GP practice can cater to patients from multiple nearby administrative areas (e.g., LSOAs). Consequently, this service does not directly provide insights into the spatial prevalence of prescriptions across these areas. The PrAna R package [21] allows the calculation of prescribed quantities of active pharmaceutical ingredients (APIs) by postcode. However, a single API or medical drug can be used to treat various conditions (e.g., selective serotonin reuptake inhibitors (SSRIs) are used for treating depression, anxiety disorders, and certain eating disorders), and a specific medical condition is typically treated using multiple drugs or APIs (e.g., depression is treated with both SSRIs and tricyclic antidepressants (TCAs)). This limits the ability of such a tool to understand the prevalence of prescriptions for specific conditions. As a result, previous studies using prescribing data in England have mainly focused on a small number of drugs manually aggregated for bespoke analyses, primarily examining temporal trends (e.g., [20, 30, 8, 45, 12]), with a few studies investigating also spatial trends (e.g., [35, 18]). Despite the valuable insights provided by previous studies using prescribing data, to the best of our knowledge, there is currently no approach that generalizes across various medical conditions to calculate spatial and temporal trends from this data.
Original NHS Practice-Level Prescribing Data The monthly practice-level prescribing data in England, provided by the National Health Services (NHS) since July 2010 [31], constitutes the foundation of our analysis. The dataset consists of four files visualized in Figure 6 containing the following information:
1.  $GP$  monthly prescriptions – Anonymized prescriptions across General Practitioner (GP) practices in England for a given month. Each prescription entry includes details such as the drug name, British National Formulary (BNF) code [31], practice code, total number of items, total cost, and individual item quantities.
2. Drugs - A comprehensive list of drugs with their unique BNF codes [31].
3.  $GPs$  – Information on GP practices, including practice codes, names, and full addresses. Our dataset encompasses 6,924 GPs located across England, excluding closed or prison-hosted practices.
4. Patients - Contains practice codes, census Lower-layer Super Output Area (LSOA) codes, and the number of patients registered with each practice in a particular area. By aggregating this data, we calculated the total number of primary care patients residing in a specific area using the equation:
$$
n _ {\mathrm {p a t}} (a) = \sum_ {\mathrm {g p}} n _ {\mathrm {p a t}} (\mathrm {g p}, a) \tag {1}
$$
Here,  $n_{\mathrm{pat}}(\mathrm{gp}, a)$  represents the number of patients registered with a particular GP residing in area  $a$ . The strong correlation  $(r = .92)$  between the number of patients and residents in an LSOA validates our probabilistic approach of assigning patients to areas. Additionally, we computed the fraction of a GP practice's patients associated with a specific area  $a$  using the equation:
$$
f (\mathrm {g p}, a) = \frac {n _ {\mathrm {p a t}} (\mathrm {g p} , a)}{n _ {\mathrm {p a t}} (\mathrm {g p})} \tag {2}
$$
Figure 6: The four NHS Datasets: (a) GP (general practitioner) monthly prescriptions; (b) Drugs; (c) GPs; and (d) Patients. Each monthly prescription in dataset (a) was translated into a drug name based on the BNF code for which dataset (b) offered the corresponding drug (preparation name). The prescription was also geographically mapped using the GP code for which dataset (c) provided the location. To then map the prescription at the level of census LSOAs, we computed the fraction of the GP's patients who lived in each LSOA from dataset (d).
D.4.3 DrugBank Network
We show here the lists of drug names extracted automatically from DrugBank for two conditions, i.e., diabetes (Table 3) and anxiety (Table 5), and the pre-existing list from the literature [16] for depression (Table 4). For anxiety, we also visualize the corresponding DrugBank network subset (Figure 7). For the other lists of drugs, please refer to our GitHub repository: https://github.com/sanja7s/MedSat/tree/master/code/collate_data/NHS_prescription_parser/drug_names.
The correlation between prevalence scores based on the list of drug names extracted automatically from DrugBank and based on the pre-existing list from the literature are .94 for anxiety and .99 for diabetes, attesting to the high quality of automatically generated output from DrugBank.
Table 3: List of drug names associated with diabetes.
BNF Code	Drug name	BNF Code	Drug name
0601023A0	Acarbose	0601023AM	Canagliflozin
0601023AS	Albiglutide	0601023AP	Canagliflozin/Metformin
0601023AK	Alogliptin	0601021E0	Chlorpropamide
0601023AJ	Alogliptin/Metformin	0212000AD	Colesevelam Hydrochloride
0607010B0	Bromocriptine	0601023AG	Dapagliflozin
0601023AL	Dapagliflozin/Metformin	0605020E0	Desmopressin Acetate
0601023AQ	Dulaglutide	0601023AN	Empagliflozin
0601023AR	Empagliflozin/Metformin	0601023AX	Ertugliflozin
0601023Y0	Exenatide	0601021H0	Glibenclamide
0601021M0	Gliclazide	0601021A0	Glimepiride
0601021P0	Glipizide	0202010L0	Hydrochlorothiazide
0202080M0	Hydrochlorothiazide/Potassium	0601011A0	Insulin Aspart
0601012Z0	Insulin Degludec	0601012X0	Insulin Detemir
0601012V0	Insulin Glargine	0601012AB	Insulin Glargine/Lixisenatide
0601011P0	Insulin Glulisine	0601011R0	Insulin Human
0601011L0	Insulin Lispro	0601012S0	Isophane Insulin
0601023AE	Linagliptin	0601023AF	Linagliptin/Metformin
0601023AB	Liraglutide	0601023AI	Lixisenatide
0601022B0	Metformin Hydrochloride	0601023W0	Metformin Hydrochloride/Pioglitazone
0601023V0	Metformin Hydrochloride/Rosiglitazone	0601023AD	Metformin Hydrochloride/Sitagliptin
0601023Z0	Metformin Hydrochloride/Vildagliptin	0601023M0	Miglitol
0601023U0	Nateglinide	0601023BO	Pioglitazone Hydrochloride
0601023R0	Repaglinide	0601023SO	Rosiglitazone
0601023AC	Saxagliptin	0601023AV	Saxagliptin/Dapagliflozin
0601023AH	Saxagliptin/Metformin	0601023AW	Semaglutide
0601023X0	Sitagliptin	0601021V0	Tolazamide
0601021X0	Tolbutamide	0601023AA	Vildagliptin
Table 4: List of drug names associated with depression (source [16]).
BNF Code	Drug name	BNF Code	Drug name
0403030Q0	Sertraline	0403040T0	Reboxetine
0403030D0	Citalopram	0403040Z0	Agomelatine
0403030E0	Fluoxetine	0402010S0	Flupentixol
0403030P0	Paroxetine	0403010T0	Tryptophan
0403030X0	Escitalopram	0403040N0	Nefazodone
0403030F0	Fluvoxamine	0403010U0	Oxitriptan
0403040M0	Mirtazapine	0403010B0	Amitriptyline
0403040W0	Venlafaxine	0403010V0	Trazodone
0403040Y0	Duloxetine	0403010H0	Dosulepin
0403040AB	Vortioxetine	0403010L0	Lofepamine
0403010R0	Nortriptyline	0403010C0	Clomipramine
0403010J0	Imipramine	0403010W0	Trimipramine
0403010G0	Doxepin	0403010M0	Mianserin
0403010A0	Amoxapine	0403010P0	Moclobemide
0403010X0	Tranylcypromine	0403010S0	Phenelzine
0403010K0	Isocarboxazid
Table 5: List of drug names associated with anxiety.
BNF Code	Drug name	BNF Code	Drug name
0401020A0	Alprazolam	0401020G0	Bromazepam
0403010B0	Amitriptyline Hydrochloride	0401020B0	Buspirone Hydrochloride
0401020D0	Chlordiazepoxide	0401020E0	Chlordiazepoxide Hydrochloride
0403030D0	Citalopram Hydrobromide	0401020V0	Clorazepate Dipotassium
0401020K0	Diazepam	0704020AA	Duloxetine Hydrochloride
0403030X0	Escitalopram	0408010G0	Gabapentin
0304010J0	Hydroxyzine Hydrochloride	0401020P0	Lorazepam
0401020R0	Meprobamate	0403040X0	Mirtazapine
0401020T0	Oxazepam	0403030P0	Paroxetine Hydrochloride
0402010Q0	Perphenazine	0406000T0	Prochlorperazine Maleate
0204000R0	Propranolol Hydrochloride	0402010AB	Quetiapine
0402010X0	Trifluoperazine	0403040W0	Venlafaxine
E Benchmarks Results
E.1 Detailed Health Inequalities
In Figure 8, we present the MEDSAT data, providing insights into healthcare accessibility disparities across regions. Our analysis focuses on comparing the total number of registered patients with the population at the LSOA level, revealing significant spatial deviations, indicative of inequalities.
First, interestingly, we find a prevailing pattern where the number of registered patients exceeds the census population in most areas of the country. This aligns with previous investigations by UK authorities [42]. Second, although the correlation  $(r = .87, p \approx 0)$  is strong, certain LSOAs exhibit disproportionate patient-to-population ratios. For instance, Forest of Dean and Shropshire, located near the Welsh border, show lower patient numbers, likely due to residents being registered with Welsh GPs. Similarly, Richmondshire, housing a military base in Catterick Garrison, and Forest Heath in Suffolk, hosting RAF Mildenhall, exhibit lower patient-to-population ratios. Conversely, Oxford and Cambridge have higher patient-to-population ratios, attributed to students registered with local GPs but not counted as residents (the LSOA with highest residual is Oxford 006F, featuring student housing for Oxford Brookes University, as well as an International Language Campus).
Additionally, our analysis highlights broader factors contributing to healthcare inequalities. The residual values, representing deviations from the linear fit, correlate with deprivation levels ( $r = .16$ ,  $p \approx 0$  for mid-deprived areas;  $r = .22$ ,  $p \approx 0$  for highly-deprived areas), suggesting a greater burden on healthcare access in socioeconomically disadvantaged regions (e.g., one of the areas with the highest patient-to-population ratio is near Bolton, a highly deprived region in Greater Manchester). Moreover, the residual values exhibit a negative correlation ( $r = -.40$ ,  $p \approx 0$ ) with the percentage of White population, indicating disparities associated with ethnic backgrounds. These findings underscore the presence of healthcare access inequalities across the country, as corroborated by prior
Figure 7: Visualization of the Drugbank network: showcasing the comprehensive interconnections between various drugs; the inset provides a zoom-in view to the subset specifically associated with anxiety prescriptions.
Figure 8: Health access disparity analysis using MEDSAT. We present a quick analysis of health access disparities by examining the relationship between the population and the number of registered patients (log-transformed), revealing a strong correlation  $(r = 0.87, p \approx 0)$ . However, the residual values from a linear fit between the two highlight a clear rural-urban pattern, with urban areas showing a higher patient-to-population ratio, which correlates with the percentage of White population  $(r = -0.40, p \approx 0)$ . Furthermore, the residuals show associations with mid-  $(r = 0.16, p \approx 0)$  and highly-deprived areas  $(r = 0.22, p \approx 0)$ , indicating a potentially greater health-access burden in these areas. Details of the analysis are found in Appendix.
research examining various healthcare system aspects, including NHS data on waiting times, staffing, hospital activity, outcomes, and the GP Patient Survey [41], or COVID-19 hospitalisations and deaths [28].
E.2 Predicting Prescriptions
E.2.1 Spatial Lag Model (SLM)
The Spatial Lag Model (SLM) [3, 4], differs from the Ordinary Least Squares (OLS) model by the inclusion of the spatial lag term  $(\rho W y)$ :
$$
y = \rho W y + X \beta + \epsilon ,
$$
where  $y$  is the outcome,  $X$  is the matrix of features, and  $\epsilon$  is the error term.  $W$  is a matrix of the shape  $N\times N$  and it contains spatial weights capturing the spatial interaction among variables, and the coefficient of spatial autocorrelation is captured by  $\rho$ . We fed in input to SLM the LSOA shapefiles to calculate the spatial lag term.
Table 6: The spatial  $R^2$  scores resulting from the Spatial Lag Model (SLM). These scores are computed across various prescription types and combinations of dataset features specifically for the year 2020.
input	metabolic	mental	respiratory	total
diabetes	hypertension	depression	anxiety	asthma	opiods
Image	0.04	0.23	0.23	0.19	0.25	0.28	0.11
Env.	0.13	0.34	0.41	0.37	0.34	0.49	0.25
Soc.	0.33	0.44	0.50	0.48	0.38	0.52	0.31
Env. + Soc. + Image	0.38	0.49	0.54	0.55	0.43	0.63	0.38
The SLM results are presented in Table 6.
E.2.2 Machine Learning Models
Figure 9: Visualization of an example spatial fold created using blockCV spatial blocking: we chose hexagonal blocks and randomly assigned those blocks to 5 folds consisting of an equal number of blocks. The numbers specify the fold assignment of the blocks.
Spatial Cross-Validation In spatial data scenarios, traditional random cross-validation methods can inadvertently undervalue prediction errors which can lead to suboptimal model choices. Recognizing this challenge, specific validation techniques tailored for spatial modeling, such as spatial blocks
and buffers, have been introduced [23, 43]. We utilized the R package blockCV, which facilitates the creation of spatially or environmentally separated folds. We used cv_spatial function to create spatial blocks (hexagons) and relied on the interactive tool rangeExplorer withing blockCV to visualise the blocks and assess the impact of block size on the number and arrangement of blocks in the landscape. For our experiments, we chose the block size of  $28\mathrm{km}\times 28\mathrm{km}$ .
Prescription Prediction To understand whether the prevalence scores for the different prescription types can be reliably predicted based on the environmental, sociodemographic indicators and the simple image features, we performed spatial cross-validation for the LightGBM [22] tree-based model and a Feed-Forward Neural Network (FNN). For this experiment, we dropped the instances having missing values. The hyperparameters used for LightGBM model and the FNN are provided in Tables 7 and 8, respectively. For both years in our dataset, we implemented the following evaluation procedure: We randomly created 5 splits consisting of 5 folds where each fold contains an equal number of the above-described spatial blocks. Figure 9 depicts one example of a spatial split consisting of 5 folds. For each split, we performed the standard cross-validation procedure such that  $80\%$  of the spatial blocks are used in model training and the rest  $20\%$  for model testing. This procedure ensures that the test set does not contain LSOAs from the geographical blocks used for model training. Further, we used half of the instances in the test fold as a validation set for early stopping to prevent overfitting, and the other half was used as a test set to evaluate the model performance. Additionally, in each split, we performed feature standardization such that each feature has zero mean and unit variance. Figure 10 shows the average  $R^2$  scores over the test sets and the corresponding standard deviation per prescription type and machine learning model. These results show that for both years, the LightGBM model consistently outperforms the FNN. Moreover, we can also see that the  $R^2$  scores are similar for the different prescription types for both years except for the total prescriptions which have lower goodness-of-fit in 2019 compared to 2020.
Table 7: LightGBM hyperparameters.
parameter	value
objective	regression
metric	rmse
boosting	gdbt
data_sample_strategy	bagging
num_iterations	100
learning_rate	0.1
tree_learner	serial
early_stopping_rounds	10
Table 8: Feed-Forward Neural Network hyperparameters.
parameter	value
hidden layers	3
embedding dimension	512
epochs	100
criterion	mse
optimizer	Adam
learning_rate	0.0001
weight Decay	0.001
early_stopping_rounds	10
Detailed SHAP results The 10 most important features as estimated by the SHAP approach [25] and the relationship between feature values and their SHAP importance for the prediction of LightGBM models for 2019, and 2020 are given in Figures 11 and 12, respectively. The LightGBM models were trained on the proposed spatial split described in Section E.2. Although these plots indicate that the majority of the relevant factors overlap for 2019 and 2020, we also see that the important factors for a condition can change in the subsequent year. For instance, the aerosols feature
Figure 10: Prescription prediction results on the spatial cross-validation splits of the LightGBM model and the FNN model for the different medical conditions in 2019 (left plot) and 2020 (right plot). The error bars indicate the standard deviation per machine learning model and medical condition and they show that the  $R^2$  scores deviate strongly for the FNN model.
that does not appear among the top-15 features for predicting opioids in 2019 is the most important feature for the same condition in 2020. Also, we observe that the contribution of a feature can vary over the years. For example, while low values of thermal radiation are related with an increase in opioids prescriptions for 2019, such a relationship is not exhibited for 2020. These insights shed light on the challenges introduced with our dataset for predicting future health outcomes based on historical data.
SHAP Dependence Plots The SHAP dependence plots explain the effect of a feature on the model predictions on the entire dataset while also revealing the interaction effects between the features [2]. In Figure 14, we show the SHAP dependence plots for the lightGBM models trained for predicting anxiety and opioid prescriptions. For creating the plots, we used the SHAP python library with the auto option for the interaction index that selects the feature which has the highest estimated interaction with the most important feature (according to the SHAP values). The left plot shows that LSOAs with a high number of White ethnicity population result in higher model predictions for anxiety. Further, the interaction of White ethnicity with work from home feature reveals that among the LSOAs with a large White population, lower prescriptions are predicted for those having a large percentage of people working from home. Next, the right plot shows that the model tends to predict lower prescription rates for LSOAs with high PM2.5 values while at the same time depicting no clear relationship between the PM2.5 and the wind component.
E.3 Temporal Analyses
As Figures 15, and 16 show, both the prescription quantities for our observed outcomes, as well as the environmental point features exhibit different distributions between 2019 and 2020. People in England were prescribed more mental health-related medications, as well as diabetes-associated medications, and less medications associated with asthma and hypertension. Satellite data measured significantly less NO2, ozone, and PM2.5 across England during 2020. The changes in land cover manifested by an increase in built environment, and a decrease in trees cover. Finally, temperatures and the amount of solar radiation, as well as the amounts of wind, as expressed through its both components, east-west and north-south, were higher in England in 2020 compared to 2019.
[1] UK Office for National Statistics. https://www.nomisweb.co.uk/sources/census_2021, 2022. [Online; accessed 26-February-2022].
Figure 11: SHAP values for the LightGBM model used for predicting prescriptions for different conditions in MEDSAT for 2019. The SHAP value for a feature indicates its contribution towards the difference between the prediction for an instance and the average model prediction.
[2] Census income classification with LightGBM. https://shap.readthedocs.io/en/latest/example notebooks/tabular\examples/tree\based\modelsModels/Census%20income%20classification%20with%20LightGBM.html, 2023. [Online; accessed 22-August-2023].
Figure 12: SHAP feature importance for the LightGBM model used for predicting prescriptions for different conditions in MEDSAT for 2020.
[3] Luc Anselin. *Spatial econometrics: Methods and Models*, volume 4. Springer Science & Business Media, 1988.
[4] Luc Anselin. Spatial regression. The SAGE handbook of spatial analysis, 1:255-276, 2009.
[5] Evelise Pereira Barboza, Marta Cirach, Sasha Khomenko, Tamara Iungman, Natalie Mueller, Jose Barrera-Gomez, David Rojas-Rueda, Michelle Kondo, and Mark Nieuwenhuijsen. Green
Figure 13: SHAP values for the LightGBM model trained on prescription prediction based on the mean and standard deviation simple image features.
Figure 14: SHAP dependence plots for anxiety prescriptions (left) and opioids prescriptions (right).
space and mortality in european cities: a health impact assessment study. The Lancet Planetary Health, 5(10):e718-e730, 2021.
[6] Marshall Burke, Anne Driscoll, David B Lobell, and Stefano Ermon. Using satellite imagery to understand and promote sustainable development. Science, 371(6535):eabe8628, 2021.
[7] Kei Long Cheung, Peter M Ten Klooster, Cees Smit, Hein de Vries, and Marcel E Pieterse. The impact of non-response bias due to sampling in public health studies: A comparison of voluntary versus mandatory recruitment in a dutch national survey on adolescent health. BMC public health, 17(1):1-10, 2017.
[8] AJ Connor and SG Fraser. Glaucoma prescribing trends in england 2000 to 2012. Eye, 28(7):863-869, 2014.
[9] Copernicus. CAMS About Us. https://atmosphere.copernicus.eu/about-us, 2023. [Online; accessed 13-June-2023].
[10] Helen J Curtis and Ben Goldacre. Openprescribing: normalised data and software tool to research trends in english nhs primary care prescribing 1998-2016. BMJ Open, 8(2):e019921, 2018.
[11] Centers for Disease Control, Prevention, et al. National health and nutrition examination survey (nhanes), 2007.
[12] Earn H Gan, Stewart Pattman, Simon HS Pearce, and Richard Quinton. A uk epidemic of testosterone prescribing, 2001–2010. Clinical endocrinology, 79(4):564–570, 2013.
Figure 15: Differences in distributions of MEDSAT outcomes between 2019 and 2020. The Kolmogorov-Smirnov (KS) test [27] showed that, except for opioids, all the other prescription types have significantly different distributions between the two years. Notably, prescriptions associated with hypertension and asthma have decreased in 2020; while the prescriptions associated with mental conditions (i.e., depression and anxiety), as well as diabetes have increased.
[13] Christopher J Gidlow, Graham Smith, David Martinez, Richard Wilson, Paul Trinder, Regina Gražulevičiene, and Mark J Nieuwenhuijsen. Research note: Natural environments and prescribing in england. Landscape and Urban Planning, 151:103-108, 2016.
[14] Noel Gorelick, Matt Hancher, Mike Dixon, Simon Ilyushchenko, David Thau, and Rebecca Moore. Google earth engine: Planetary-scale geospatial analysis for everyone. Remote Sensing of Environment, 2017.
[15] Ola Hall, Mattias Ohlsson, and Thorsteinn Rögnvaldsson. A review of explainable ai in the satellite data, deep machine learning, and human poverty domain. *Patterns*, 3(10):100600, 2022.
[16] Adrian H Heald, Mike Stedman, Mark Davies, Mark Livingston, David Taylor, and Roger Gadsby. Antidepressant prescribing in england: patterns and costs. The Primary Care Companion for CNS Disorders, 22(2):26631, 2020.
[17] Marco Helbich, Nadja Klein, Hannah Roberts, Paulien Hagedoorn, and Peter P Groenewegen. More green space is related to less antidepressant prescription rates in the netherlands: A bayesian geoadditive quantile regression approach. *Environmental research*, 166:290–297, 2018.