Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Health Tracker

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.

Setup (one-time)

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.

Quickstart

# 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

Layout

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)

How data flows

  • 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/bulk with 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).

TODO / roadmap

  • Replace the rclone user-OAuth with a Google service account shared only on the Health_Tracker Drive 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.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages