Production-oriented pipeline for early-warning anomaly detection and triage risk scoring from streamed vitals (HR, SpO2, ABP).
docker pull ghcr.io/keanesc/time-series-analysis:latest
docker run -p 8000:8000 ghcr.io/keanesc/time-series-analysis:latestVerify the service:
curl http://localhost:8000/healthThis project uses pixi for environment management. Use the commands below when developing locally or running from source.
# clone the repo (SSH or HTTPS)
cd time-series-analysis
pixi install
pixi run serve # open http://localhost:8000
pixi run all # run full pipelinepixi run all— run entire pipeline end-to-endpixi run collect— fetch & simulate motionpixi run clean— artifact detection + cleaningpixi run train— train anomaly modelpixi run score— compute risk scorespixi run evaluate— metrics & latencypixi run failures— failure-case analysispixi run serve— start API server
GET /health— livenessPOST /predict— input:hr,spo2,sbp,dbp,motionreturns:anomaly_flag,risk_score,confidence,alert_status
Example:
curl -X POST http://localhost:8000/predict -H "Content-Type: application/json" -d '{"hr":120,"spo2":88,"sbp":85,"dbp":55,"motion":0.1}'Response:
{
"anomaly_flag": true,
"risk_score": 78.3,
"confidence": 0.87,
"alert_status": "ALERT"
}Build locally:
docker build -t time-series-analysis .
docker run -p 8000:8000 time-series-analysisPublished image (GHCR):
docker pull ghcr.io/keanesc/time-series-analysis:latest
docker run -p 8000:8000 ghcr.io/keanesc/time-series-analysis:latestThe repository includes a GitHub Actions workflow (.github/workflows/publish-ghcr.yml) that builds and publishes the image to GHCR on pushes to main. (Image is public.)
MIMIC-III Waveform Database (PhysioNet, v1.0) [1]
- 67,830 record sets from ~30,000 ICU patients
- Numerics records at 1 Hz: HR, SpO₂, ABP (systolic/diastolic)
- Open access under ODbL v1.0
- Motion/vibration signal is simulated (ambulance context adaptation)
- Clinical features (per 60 s window): distance-to-threshold, slope, mean, std, end value for each vital, plus motion and data quality indicators (24 features total)
- HistGradientBoostingClassifier trained on stable windows to predict pre-critical deterioration within 2 minutes
- Risk score (0–100): weighted vital severities + trend bonus, gated by data-quality confidence
- Alert logic: ALERT if risk ≥ 70 and confidence ≥ 0.6; SUPPRESSED if confidence too low
See report.md for detailed methodology, metrics, and safety-critical analysis.
[1] PhysioNet, “MIMIC‑III Waveform Database (v1.0).” [Online]. Available: physionet.org/content/mimic3wdb/1.0
[2] P. Zwerschke, “Shipping conda environments to production using pixi,” QuantCo Tech Blog, Jul. 11, 2024. [Online]. Available: tech.quanto.com/blog/pixi-production