An end-to-end AI system for detecting abnormal patterns in wearable health data.
This project simulates wearable device data (steps, resting heart rate, HRV, sleep hours, activity minutes) and applies an Isolation Forest model to detect unusual physiological patterns.
The system includes:
• Synthetic health data generation
• Isolation Forest anomaly detection model
• FastAPI prediction API
• Streamlit monitoring dashboard
• Git-based reproducible ML pipeline
Synthetic Data Generator
↓
Isolation Forest Training
↓
Model Serialization (.joblib)
↓
FastAPI Prediction API
↓
Streamlit Dashboard
• Detect abnormal physiological patterns
• Analyze wearable device metrics
• Visualize anomalies in an interactive dashboard
• Deployable API for real-time predictions
This project goes beyond traditional anomaly detection by integrating a local Large Language Model (LLM) to generate natural language health insights.
- Wearable data is processed through an Isolation Forest model
- Anomalies and key observations are identified
- Observations are passed to a local LLM via Ollama
- The LLM generates a short, human-readable, supportive health insight
Observations
- Resting heart rate appears elevated
- HRV is lower than expected
- Sleep duration is lower than expected
- Daily step count is low
- Daily activity level is low
AI Insight
Your body is currently experiencing reduced recovery and increased physiological strain. Lower sleep duration, reduced HRV, and low daily activity may suggest that your system needs better rest and balance. Paying attention to sleep consistency and light movement may help support recovery.
Python
Scikit-Learn
FastAPI
Streamlit
Plotly
Pandas
NumPy
The dataset is synthetically generated and includes:
steps
resting_hr
hrv
sleep_hours
active_minutes
Synthetic anomalies are injected to simulate abnormal physiological conditions.
Install dependencies:
pip install -r requirements.txt
Generate dataset:
python training/make_synth_data.py
Train anomaly model:
python training/train_iforest.py
Run API:
uvicorn app.main:app --reload
Run dashboard:
streamlit run dashboard/app.py
The Streamlit dashboard visualizes:
• anomaly score distribution
• abnormal activity patterns
• physiological outliers


