From raw claims to a usable model

The source is a public, de-identified dataset of pharmacy claims (Kanyongo, Moyo, Ezugwu & Fonou Dombeu, Mendeley Data, DOI 10.17632/zkp7sbbx64.2, CC0 license) — a hypertension table of roughly 218,816 records and a diabetes table of roughly 52,616 records, each with 41 columns. Raw claims data is not analysis-ready: it was merged with coverage and complication reference tables (neurology, ophthalmology, physician visits, dialysis) down to a final analytical set of 24,084 patients and 11 predictor features, organized into a star schema — a fact table of patient claims joined to dimension tables for patients, coverage, and complications — the same kind of structure a BI tool can query efficiently and a model can consume directly.

That schema underpins a four-page Power BI dashboard that moves through the problem in order: risk identification, segmentation, intervention prioritization, then predictive analytics — rather than putting every chart on one page and letting the viewer figure out the story themselves.

What the data actually shows

59.85% of patients (14,415 of 24,084) were non-adherent to their prescribed medication. Hypertension patients made up 80.05% of the population, and the 50–59 age band was the largest single cohort at 26.65%. The number worth sitting with: non-adherent patients carried roughly 2.5× the average annual claims cost of adherent ones — non-adherence isn't just a clinical problem, it shows up directly in cost.

Five models, one honest failure

Five classifiers were benchmarked on an 80/20 split — a 4,817-patient held-out test set. Four of them landed in a reasonable 78.66%–81.98% accuracy range. The fifth didn't work at all.

Logistic Regression collapsed. It predicted the majority class for every single patient — 0% precision, 0% recall, 0% F1 for the adherent class — while still reporting 59.85% "accuracy," because 59.85% of patients actually were non-adherent. A model that never predicts the minority class can still look reasonable on accuracy alone, which is exactly why accuracy by itself is a misleading headline number, and exactly why this gets reported here instead of quietly dropped from the comparison.
ModelAccuracyPrecisionRecallF1
Logistic Regression59.85%*0.0000.0000.000
Decision Tree78.66%
Extra Trees≈80%
Random Forest≈81%
Gradient Boosting81.98%0.7380.8550.792

*Logistic Regression's accuracy is the majority-class baseline, not a meaningful score — see above. Precision/recall/F1 weren't separately reported for every mid-table model in the original analysis; the comparison focuses on accuracy for those and full metrics for the champion.

What actually drives non-adherence

Feature importance from the Random Forest model was dominated by two variables: total claim units (42.97%) and annual claim amount (33.71%) — together over 76% of the model's predictive power. Age was a distant third at 14.76%, and every demographic or coverage variable individually contributed under 2%. In plain terms: claims volume and cost history predict future adherence far better than who the patient is.

What this doesn't claim: the analysis is a single medical scheme in a single geography, a one-year snapshot rather than longitudinal data, and feature importance describes association, not causation. Currency units in the source data aren't specified. No hyperparameter tuning or class-rebalancing was applied to any of the five models — this is a first-pass benchmark, reported as one, not dressed up as a finished production system.

No trained model or app code survives from this project's original working session — only the Power BI files and the feature-importance outputs. A rebuilt version, if it happens, would mean retraining the Gradient Boosting model from the same public dataset rather than reviving anything that already exists.