Training a model is the easy part. This project is about everything around it: making sure bad data never reaches the model, serving predictions reliably, retraining when enough new data arrives, and noticing when the world drifts away from the training data.
- 8
- data-quality expectations on every file
- 7
- types of data errors injected to test them
- 3
- scheduled Airflow pipelines
- 1
- command to start the whole stack
The system
- 01Ingestnew 10-row files arrive every minute and are validated with Great Expectations for completeness, validity, consistency, schema, and type
- 02Triageclean rows go to the database; bad rows are quarantined, scored by severity, and serious problems trigger a Teams alert
- 03Predictevery two minutes, new clean files are sent in one batch to the FastAPI model service, and each prediction is stored with its model version
- 04Retrainevery hour, if enough new data has arrived, a candidate Random Forest is trained and logged to MLflow
- 05Promote safelythe candidate replaces the champion only if its R² is within 0.01 of the champion and inference stays under two seconds
- 06MonitorGrafana dashboards track data quality, feature drift against the training baseline, and predictions per model version
Testing the guard rails
To prove the validation works, a corruption script deliberately injects seven kinds of errors, such as missing columns, out-of-range values, invalid categories, wrong data types, duplicates, and inconsistent fields, and the pipeline has to catch them.
Alerts are tiered on purpose: low-severity issues are logged but not sent, to avoid alert fatigue.
Engineering practices
- Model registry: the serving model is always the MLflow model tagged as champion, with a local fallback
- Traceability: every stored prediction records which model version produced it
- CI/CD: linting and tests on every pull request, and automatic versioned releases
- Reproducible: the full stack, from database to dashboards, starts with Docker Compose
The data is an hourly bike-sharing dataset of 17,379 records, streamed into the system in small files to simulate a live feed.