Billed vs ordered quantities
Compare medication quantities to surface shortages, overages, and records that need operational review.
An end-to-end Applied ML system for leakage-safe prescription-renewal prediction, operational follow-up workflows, and containerized deployment using entirely synthetic pharmacy data.
The project began as a pharmacy billing-vs-ordering reconciliation workflow and evolved into an end-to-end Applied ML system for prescription-renewal prediction and operational follow-up.
Compare medication quantities to surface shortages, overages, and records that need operational review.
Identify prescriptions that may need renewal review as expected medication supply approaches exhaustion.
Deterministic longitudinal synthetic data
Point-in-time prediction design
Leakage prevention
Chronological Train / Validation / Test split
16-feature final model input
Train-only preprocessing
Time-series cross-validation
Logistic Regression / Random Forest / XGBoost / LightGBM comparison
Locked final Logistic Regression before Test
Threshold = 0.50
Test consumed once
Interpretation: high recall means the model caught most synthetic renewal cases, with the trade-off of additional false-positive review workload. This is not clinical or real-world performance.
MLflow experiment tracking and locked model artifact
FastAPI single and batch inference
PostgreSQL prediction history
Follow-up case workflow
Activities and explicit case resolution
Alembic migrations
Docker and Docker Compose
Persistent PostgreSQL volume
Health and readiness endpoints
Request IDs and privacy-safe logs
139 automated tests
GitHub Actions CI
AWS components shown in the diagram are planning only and are not represented as deployed technology.
Used chronological splitting instead of a random split to preserve the temporal prediction setting.
Selected the model and 0.50 threshold before consuming Test, with no Test-based retuning.
All longitudinal pharmacy records and reported model results are deterministic and synthetic.
Selected simpler Logistic Regression after comparison with more complex tree-based models.
Cases require explicit operational resolution rather than automatic closure from model output.
The system has not been evaluated on real pharmacy data.
Predictions support a simulated operational review workflow, not clinical decisions.
The validated system runs locally with Docker Compose.
The AWS path is future architecture and has not been deployed.
The reported metrics do not represent real pharmacy performance.
The repository contains the synthetic-data pipeline, trained model workflow, API, migrations, tests, operational case handling, and Docker Compose setup.
View repository ↗