Machine learning framework for predicting medication non-adherence among chronic disease patients in Ghana using EMR data
# Medication Adherence Prediction Using Machine Learning
A machine learning framework for predicting medication non-adherence among chronic disease patients in Ghana using structured electronic medical record (EMR) data.
## Overview
This project develops an interpretable, context-specific ML model to identify patients at risk of medication non-adherence. The work addresses a critical gap in healthcare AI: most adherence prediction models are developed in high-income settings and fail to generalize to low- and middle-income countries (LMICs) where healthcare financing, access patterns, and socioeconomic factors differ substantially.
### Key Results
| Metric | Score |
|--------|-------|
| Accuracy | 89.5% |
| AUC-ROC | 0.934 |
| F1-Score | 0.93 |
| Recall (Non-adherent) | 77% |
| Recall (Adherent) | 94% |
### Top Predictive Features (SHAP Analysis)
1. **Insurance Status (NHIS)** — Strongest predictor of adherence
2. **Age × Medication Complexity** — Interaction effect capturing polypharmacy burden in older patients
3. **Chronic Comorbidity Status** — Presence of conditions like diabetes, heart failure
4. **Age** — Independent effect on adherence behavior
5. **Total Medication Count** — Regimen complexity
6. **Estimated Medication Cost** — Financial burden proxy
7. **Cost Burden × Insurance** — Interaction capturing uninsured cost sensitivity
## Methodology
### Data Source
- Structured EMR data from Presbyterian Hospital, Agogo, Ghana
- 1,367 adult patients with chronic conditions (hypertension, diabetes, cardiovascular disease)
- 6-month observation window for adherence measurement
### Adherence Measurement
- **Proportion of Days Covered (PDC)** calculated from prescription refill patterns
- Adherent: PDC ≥ 80% | Non-adherent: PDC =1.5.0
numpy>=1.23.0
scikit-learn>=1.2.0
xgboost>=1.7.0
shap>=0.41.0
matplotlib>=3.6.0
seaborn>=0.12.0
streamlit>=1.20.0
```
## Usage
### Running the Analysis
```python
# Load and preprocess data
import pandas as pd
from src.pr …