Personal health tracking & analysis: wearable data (Zepp/Amazfit via Android Health Connect) combined with self-logged lifestyle events (coffee, drinks, feeling sick), visualized in a dashboard — and queried in natural language via an LLM. Full context and roadmap: PROJECT.md.
All data stays local (SQLite in data/, gitignored). Events are logged with
the companion Android app: TrackerApp,
which syncs to this backend over Wi-Fi.
Create a .env file in the repo root (gitignored, chmod 600):
ANTHROPIC_API_KEY=sk-ant-... # for the LLM chat (optional)
HEALTH_API_TOKEN=<random token> # API auth — required beyond localhost
Generate the token with
python -c "import secrets; print(secrets.token_urlsafe(32))".
Every API endpoint except /health requires
Authorization: Bearer <HEALTH_API_TOKEN>; the dashboard and scripts pick the
env var up automatically, the TrackerApp
gets the same token via its local.properties (HEALTH_API_TOKEN=...).
For automatic watch-data ingestion from Google Drive, set up rclone once — see docs/health-connect-export.md.
# load secrets + make rclone findable, then start:
set -a; source .env; set +a
export PATH="$HOME/.local/bin:$PATH"
# 1. backend API → http://<LAN-IP>:8000 (docs at /docs)
# fetches + ingests the newest Health Connect export at startup
uv run uvicorn backend.main:app --host 0.0.0.0 --reload
# 2. dashboard → http://localhost:8501 (separate terminal, source .env too)
# binds to localhost ONLY (.streamlit/config.toml) — it has no login
uv run streamlit run dashboard/app.py
# optional: seed synthetic demo data (idempotent; remove with --clear)
uv run python scripts/seed_demo_data.py| Path | What |
|---|---|
| backend/ | FastAPI + SQLite: normalized events/metrics store, REST API, Drive sync, LLM chat (README) |
| dashboard/ | Streamlit dashboard, pure API consumer (README) |
| scripts/ | demo seeder, Health Connect export inspector + manual ingester |
| docs/ | guides: data ingestion · event semantics · app sync contract · LLM chat |
data/ |
SQLite DB + export drop zone (gitignored — health data stays off git) |
| TrackerApp | companion Android app: one-tap event logging + sync (separate repo) |
- Watch metrics: Zepp → Health Connect → daily export → Google Drive → fetched + ingested automatically at backend startup and every 12 h (details).
- Lifestyle events: logged in TrackerApp,
synced to
POST /events/bulkwith idempotency keys (contract, semantics). - Analysis: the dashboard's Chat page answers questions via Claude with scope-limited tools and a full per-answer transparency trace; an offline data-bundle export works without an API key (privacy model & costs).
- Replace the rclone user-OAuth with a Google service account shared
only on the
Health_TrackerDrive folder — least-privilege Drive access (current token can read the whole Drive) and independence from rclone's shared client ID, which Google retires during 2026. - Let TrackerApp upload the export zip directly to the backend — would remove Google Drive (and all Drive credentials) from the pipeline entirely.