Skip to content

sandseb123/Leo-Health-Core

Repository files navigation

Leo Health πŸ«€

Your Apple Health and Whoop data β€” unified in a local SQLite database. In 60 seconds.

Apple Health locks your biometrics in a 4GB XML file. Whoop buries yours in CSVs with inconsistent column names. Leo Core parses both in under 60 seconds and writes everything to a single, normalized SQLite database β€” Heart Rate, Sleep, Workouts, HRV, Recovery Score, Blood Oxygen β€” all queryable with standard SQL.

Zero network requests. Runs locally. MIT licensed.

Python 3.9+ License MIT Zero Dependencies Status CI


🧠 Leo Max β€” AI Health Coach (Coming Soon)

Local LLM that analyses your data privately. Bloodwork history, wearable trends, medical literature β€” all on your Mac, nothing leaves your machine.

Join the waitlist β†’


What it looks like

Leo Health Dashboard

Leo Health Sleep Breakdown


Install

git clone https://github.com/sandseb123/Leo-Health-Core.git
cd Leo-Health-Core
pip3 install -e .

Three commands are now available anywhere on your Mac:

leo          # view your health dashboard
leo-watch    # start watching Downloads for new exports
leo-dash     # open full web dashboard in browser

Note: If pip3 is not found, try pip install -e . or install Python 3.9+ from python.org


Docker

Run Leo Health in a container β€” works on macOS, Linux, and Windows.

# Clone the repo
git clone https://github.com/sandseb123/Leo-Health-Core.git
cd Leo-Health-Core

# Start the dashboard
docker compose up -d


# Open in browser
open http://localhost:5380

Drop your health exports into the imports/ folder β€” Leo will detect and ingest them automatically.

# Import Apple Health export
cp ~/Downloads/export.zip imports/

# Import Whoop CSVs
cp ~/Downloads/whoop_recovery.csv imports/

Or run directly without compose:

docker run \
  -p 127.0.0.1:5380:5380 \
  -v ~/.leo-health:/data \
  -e LEO_HOST=0.0.0.0 \
  -e LEO_DB_PATH=/data/leo.db \
  leo-health

Data is stored in a Docker volume (leo-data) and persists across container restarts.

# Stop
docker compose down

# View logs
docker compose logs -f

Get your data in

Apple Health (iPhone):

  1. Open the Health app
  2. Tap your profile picture β†’ Export All Health Data
  3. AirDrop it to your Mac β€” Leo detects and parses it automatically

Whoop: Open Whoop app β†’ Profile β†’ Export Data β†’ check email for CSVs β†’ AirDrop to Mac

leo-watch    # start the watcher β€” detects exports within 10 seconds

Auto-Ingest via AirDrop ✨

Leo watches your Downloads folder and automatically parses any health export the moment it arrives β€” no commands needed after setup.

  • Checks for new files every 10 seconds
  • Uses ~8MB RAM, near-zero CPU while idle
  • Never processes the same file twice
  • Sends a macOS notification when ingestion completes

Auto-start on login: Coming soon.


Query your data

sqlite3 ~/.leo-health/leo.db
-- Last 7 days of Whoop recovery
SELECT recorded_at, recovery_score, hrv_ms, resting_heart_rate
FROM whoop_recovery
ORDER BY recorded_at DESC LIMIT 7;

-- HRV by source (Apple Watch vs Whoop)
SELECT source, ROUND(AVG(value), 1) as avg_hrv, COUNT(*) as readings
FROM hrv GROUP BY source;

-- Sleep stage breakdown
SELECT stage, COUNT(*) as sessions
FROM sleep GROUP BY stage ORDER BY sessions DESC;

-- Top workouts by volume
SELECT activity, COUNT(*) as sessions, ROUND(AVG(calories), 0) as avg_cal
FROM workouts GROUP BY activity ORDER BY sessions DESC;

What gets parsed

Apple Health (export.zip)

Data Table Metrics
Heart Rate heart_rate BPM, resting HR, walking avg
HRV hrv SDNN in milliseconds
Sleep sleep REM, Deep, Core, Awake stages
Workouts workouts Activity, duration, distance, calories
Blood Oxygen blood_oxygen SpOβ‚‚ %

Whoop (CSV exports)

Data Table Metrics
Recovery whoop_recovery Score, HRV, resting HR, SpO2
Strain whoop_strain Day strain, calories, max/avg HR
Sleep sleep Performance %, time in bed, stages

Privacy

Leo Core contains zero outbound network code. Verify the entire repository yourself:

grep -r "import urllib\|import http\|import requests\|import socket\|http.client\|urllib.request" .

You'll see three results, all in leo_health/dashboard.py β€” these are Python stdlib imports used to run a local web server on your own machine (localhost only). No data is sent anywhere. No outbound connections. No tracking.

Your data lives in ~/.leo-health/leo.db and never leaves your machine.

Threat model: Dashboard binds to localhost only. Anyone with local machine access can read the DB. No authentication β€” designed for single-user desktop use only.


Who this is for

Leo Core is an open-source developer tool. If you're comfortable with Terminal, git clone and bash install.sh gets you running in 2 minutes. Free forever, MIT licensed.

Leo Max is the upcoming AI health coach layer β€” a local LLM that runs against your unified health database, cross-references medical literature, and lets you upload bloodwork PDFs to track lab panels over time. Nothing leaves your Mac. Join the waitlist β†’


Project structure

leo_health/
β”œβ”€β”€ parsers/
β”‚   β”œβ”€β”€ apple_health.py   # SAX streaming parser for export.zip
β”‚   └── whoop.py          # Auto-detecting CSV parser
β”œβ”€β”€ db/
β”‚   β”œβ”€β”€ schema.py         # SQLite schema
β”‚   └── ingest.py         # Unified ingest for all sources
└── dashboard.py          # Local web dashboard (localhost only)
status.py                 # leo command β€” terminal dashboard
watcher.py                # leo-watch β€” auto-ingest on AirDrop
install.sh                # One-command installer for macOS
pyproject.toml

Architecture Overview

flowchart TD

    subgraph External Inputs
        A[Apple Health Export XML]
        B[Whoop CSV Export]
        C[AirDrop Watch Folder]
    end

    subgraph Leo Health Core
        D[Streaming SAX Parser]
        E[CSV Parser]
        F[Normalization & Validation]
        G[(SQLite<br/>User-Owned DB)]
        H[Query & Trend Engine]
        I[Local Dashboard<br/>localhost only]
    end

    A --> D
    B --> E
    C --> D

    D --> F
    E --> F
    F --> G
    G --> H
    H --> I
Loading

Roadmap

  • Apple Health XML parser
  • Whoop CSV parser
  • Normalized SQLite schema
  • leo terminal dashboard
  • leo-watch auto-ingest watcher
  • AirDrop β†’ auto-parse workflow
  • Docker support (cross-platform)
  • Linux & Windows support (via Docker)
  • Oura Ring CSV support
  • Fitbit CSV support
  • Garmin .fit support
  • Leo Max β€” AI Health Coach (local LLM, fully private)
  • Leo Max β€” bloodwork PDF/photo ingestion
  • Leo Max β€” native macOS app (no Terminal required)

Contributing

Good first issues:

  • Add Oura Ring CSV parser
  • Add Fitbit CSV parser
  • Add Garmin .fit file support
  • Add missing Whoop metrics to schema
  • Improve test coverage

See good first issue labels to get started.


Built With AI Assistance

Leo Health was built with AI assistance and reviewed, tested, and maintained by @sandseb123. All security fixes, architectural decisions, and code reviews were done by a human. If you find issues or have questions, open a GitHub issue or reach out directly.


License

Leo Core β€” MIT. Free to use, modify, and distribute.

Leo Max (AI Coach) is a separate commercial product β€” join the waitlist.


Built by sandseb123

About

Parse Apple Health & Whoop exports into a local SQLite database. Zero dependencies. Zero network requests. MIT licensed.

Resources

License

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages