November 24, 2026
This project explored whether over-the-counter (OTC) analgesic purchasing patterns from loyalty-card transaction data could help identify repeated high-volume analgesic purchasing, used as a proxy for possible persistent or chronic pain-related demand outside prescribed care pathways.
The analysis focused on paracetamol, NSAIDs, and codeine-containing products. The aim was to identify accounts with chronic purchasing patterns, describe demographic and geographic variation, compare OTC purchasing with prescription data, and generate client-friendly outputs for reporting and manuscript development.
Solution
A reproducible Python analysis pipeline was developed to process monthly OTC analgesic transaction files, classify products, calculate tablet totals, identify chronic purchasing accounts, and generate structured outputs.
Chronic purchasing was defined as an account purchasing more than 96 tablets within a rolling six-month period. This was calculated separately for paracetamol, NSAIDs, and codeine-containing products, with outputs created at both account and transaction level where appropriate.
Tech Stack
- Python, pandas, and NumPy for data cleaning and aggregation
- Matplotlib and seaborn for visualisation
- Geopandas for geographic mapping
- Statsmodels, scikit-learn, and SHAP for regression, manchine learning, and model interpretation
- YAML config files and Jupyter notebooks for reproducible, client-friendly running
- Python-docx and python-pptx for manuscript and presentation outputs
Key Features
- Config-driven pipeline
- Chronic purchasing logic
- Separated drug groups
- Demographic summaries
- Geographic outputs
- OTC vs. prescribed analysis
- Model output
Funding
This work was supported by the University of Nottingham's SEED pump-prime funding scheme.
Comments
No comments yet — be the first to comment.
