Health-AI is a Flask-based personal health tracking platform that combines daily lifestyle logging, lab trend tracking, smartwatch ingestion, and evidence-based risk estimation.
- User auth with local SQLite + bcrypt password hashing
- Guided onboarding for demographics, vitals, and history
- Daily logs for sleep, steps, stress, hydration, food quality, and notes
- Lab entry and historical lab timeline for 17 biomarkers
- Risk scoring with hard gating rules before any risk is shown
- OAuth smartwatch sync (Fitbit and Google Fit implemented)
- CSV import path for Apple Health style exports
- JSON API endpoints for daily history and risk summary
The app runs from app_v5.py and defaults to port 5001.
The current runtime risk pipeline is rule-based and transparent, not a black-box classifier:
- CVD: ACC/AHA Pooled Cohort Equations
- Diabetes: FINDRISC score
- Cancer: lifestyle relative-risk model (not absolute incidence probability)
- Health Age: heuristic estimator based on lifestyle and labs
Implementation is in risk_calculators.py and called through compute_risk_scores() in app_v5.py.
compute_risk_scores() enforces:
- Profile must include age, sex, height, weight
- At least 7 daily logs must exist
- At least one lab panel entry must exist
- CVD additionally requires total cholesterol and HDL, and age 40+
If these conditions are not met, the UI returns explicit gated messages instead of fake numbers.
SQLite DB: users.db
Tables created at startup:
usersdaily_loglab_resultssurveys
Notable tracked fields include BP medication status, smoking status, alcohol/week, race, family history flags, wearable provider/token, and health goals.
OAUTH_CFG supports config keys for:
fitbitgooglefitgarmin(configured in env map, but sync logic currently handles Fitbit and Google Fit)
GET /api/sync_watch
Behavior:
- Pulls current-day steps/active/sleep via provider APIs
- Upserts into
daily_logwithsource='watch'
POST /import_csv
Expected columns include:
datesleepstepsactive_minutes
Imported rows are upserted into daily_log with source='csv_import'.
This repo also contains an advanced experimental ML stack under ml/ (predictor.py, train_model.py, safety.py, etc.).
Important: the primary runtime in app_v5.py currently uses the rule-based calculator path from risk_calculators.py, not the ml/ predictor as the default serving path.
python -m venv venv
# Windows
venv\Scripts\activate
# macOS/Linux
# source venv/bin/activate
pip install -r requirements.txt
python app_v5.pyOpen: http://127.0.0.1:5001
SECRET_KEYFITBIT_CLIENT_IDFITBIT_CLIENT_SECRETGOOGLE_CLIENT_IDGOOGLE_CLIENT_SECRETGARMIN_CLIENT_IDGARMIN_CLIENT_SECRET
/home/register,/login,/logout/onboarding/<step>/dashboard/labs/profile/smartwatch/connect/<provider>and/oauth/callback/<provider>/survey/api/daily_history/api/risk_summary
This project is educational and decision-support only. It is not a medical device and is not a diagnostic substitute for clinician review.