How svaishnavim/hospital-readmission-mlops works
This repository is a guided MLOps pipeline for predicting 30-day hospital readmission, with a FastAPI inference service. Its main workflow prepares encounter data, trains and evaluates models, serves predictions, monitors feature and prediction drift, and conditionally retrains. The README documents notebook-led preparation, model tracking, and operations stages; source excerpts show key runtime calls and artifact handling. Training implementation is incomplete, so model-selection and MLflow links reflect the documented training contract rather than a completed implementation.
Main entry points: train.py Model training · monitoring.py Feature and prediction drift · data_prep.py Feature engineering · retrain.py Retraining decision
Components 21
Data preparation
- Hospital encounters
data/diabetic_data.csv - Pipeline configuration
config.py - Cleaning and labels
src/data_prep.py - Feature engineering
src/data_prep.py - Stratified splits
src/data_prep.py - Preparation walkthrough
Data_Preparation.ipynb
Model lifecycle
- Model training
src/train.py - Classification metrics
src/evaluate.py - Experiment tracking
src/train.py - Model and reference artifacts
artifacts/best_model.pkl - Model development walkthrough
Model_Development_and_Tracking.ipynb
Monitoring and retraining
- Drifted batch generation
src/generate_current_batch.py - Current encounter batch
artifacts/current_batch.csv - Feature and prediction drift
src/monitoring.py - Drift report and summary
artifacts/drift_summary.json - Retraining decision
src/retrain.py - Retraining decision record
artifacts/retraining_decision.json - Operations evidence walkthrough
Operations_Monitoring_and_Evidence.ipynb
Prediction service
- FastAPI inference
app.py - Prediction governance log
artifacts
Other components
- Prediction client
Connections 25
- Pipeline configuration → Cleaning and labels: configures
src/data_prep.py - Hospital encounters → Cleaning and labels: reads
- Cleaning and labels → Feature engineering: cleans and labels
src/data_prep.py - Feature engineering → Stratified splits: engineers features
src/data_prep.py - Preparation walkthrough → Feature engineering: demonstrates
README.md - Stratified splits → Model training: supplies splits
src/train.py - Pipeline configuration → Model training: configures
src/train.py - Model training → Classification metrics: evaluates models
src/train.py - Model training → Experiment tracking: logs experiments
src/train.py - Model training → Model and reference artifacts: saves model
src/train.py - Model development walkthrough → Model training: demonstrates
README.md - Feature engineering → Drifted batch generation: provides batch features
src/generate_current_batch.py - Drifted batch generation → Current encounter batch: writes
src/generate_current_batch.py - Feature and prediction drift → Drifted batch generation: invokes if absent
src/monitoring.py - Feature and prediction drift → Current encounter batch: reads
src/monitoring.py - Model and reference artifacts → Feature and prediction drift: scores batches
src/monitoring.py - Feature and prediction drift → Drift report and summary: writes summary
src/monitoring.py - Drift report and summary → Retraining decision: informs decision
src/retrain.py - Retraining decision → Model training: trains if triggered
src/retrain.py - Retraining decision → Retraining decision record: writes
src/retrain.py - Operations evidence walkthrough → Feature and prediction drift: demonstrates
README.md - Operations evidence walkthrough → Retraining decision: demonstrates
README.md - Prediction client → FastAPI inference: requests prediction
app.py - FastAPI inference → Model and reference artifacts: loads model and columns
app.py - FastAPI inference → Prediction governance log: appends predictions
app.py