Machine Learning / Case study
Healthcare Risk Prioritisation
An end-to-end PostgreSQL and machine-learning workflow for prioritising future kidney-disease diagnoses in synthetic health records.
- PostgreSQL
- SQL
- scikit-learn
- MLflow
Key result
On pooled synthetic 2024–2025 test snapshots, the reported top 10% (1,376 of 13,769 patient snapshots) captures 37 of 75 positive snapshots. Precision is 37 / 1,376 ≈ 2.7%; case capture is 37 / 75 ≈ 49.3%. These are snapshot-level counts, not necessarily distinct patients.
Limitations at a glance
Synthetic records are cleaner and rule-generated; real-world transfer is unverified. Patients can recur across annual snapshots and time-split groups; this is not an unseen-patient evaluation. The script selects the best model using average precision on the reported test set, so it is not an untouched final holdout. Few positive outcomes add uncertainty. No clinical validation is claimed.
Read all limitations
Problem
When review capacity is limited, can historical records help prioritise patients who later receive a first chronic kidney disease diagnosis? This is a synthetic-data ranking study, not a diagnostic system.
Data or modelled system
Synthea-generated health records are loaded into PostgreSQL. SQL constructs annual snapshots for adults without prior CKD who visited in the preceding two years.
Each snapshot uses only the preceding two years for features; the outcome is a first CKD diagnosis in the following 12 months. No real patient records are used.
Implementation
SQL builds cohorts and features; Python and scikit-learn fit logistic regression and gradient boosting; MLflow records experiments. A local Streamlit dashboard communicates ranking performance and review-capacity trade-offs.
Approach / workflow
Construct snapshots from 2019–2025. Restrict predictors to information available before each snapshot, train on 2019–2023, and test on 2024–2025. The repository includes a no-leakage test.
Compare a transparent linear baseline with gradient boosting, then evaluate how many future cases fall within a feasible top-ranked review fraction.
Evaluation
Rare outcomes make accuracy misleading. The author evaluates precision–recall AUC, ROC AUC and case capture at fixed review capacity. The reported test data contains 13,769 snapshots and only 75 future diagnoses.
Reported average precision (called “PR-AUC” in the repository) is 0.030 for logistic regression and 0.028 for gradient boosting, against a 0.005 random baseline. This summarizes precision across recall levels; it is not necessarily trapezoidal PR-curve area. These are author-reported synthetic test results, not independently reproduced findings.
Results
On pooled synthetic 2024–2025 test snapshots, the reported top 10% (1,376 of 13,769 patient snapshots) captures 37 of 75 positive snapshots. Precision is 37 / 1,376 ≈ 2.7%; case capture is 37 / 75 ≈ 49.3%. These are snapshot-level counts, not necessarily distinct patients.
This illustrates a review-capacity versus case-capture trade-off. It does not establish clinical benefit, diagnose disease or provide calibrated clinical probabilities.
Limitations
Synthetic records are cleaner and rule-generated; real-world transfer is unverified. Patients can recur across annual snapshots and time-split groups; this is not an unseen-patient evaluation. The script selects the best model using average precision on the reported test set, so it is not an untouched final holdout. Few positive outcomes add uncertainty. No clinical validation is claimed.
Rankings should not be interpreted as individual clinical risk probabilities. Validation on real records and careful clinical assessment are future work, not implemented results.
Repository and reproducibility
The public repository documents Synthea generation settings and seeds, PostgreSQL setup, a one-command pipeline, model tracking, dashboard launch and tests. Reproduction requires generated input data and the documented environment.