Google Health / Fitbit Setup
Read-Only OAuth Configuration
Enable Google Health API in Google Cloud, configure an External / Testing OAuth app with your account as a test user, and add these read-only scopes:
https://www.googleapis.com/auth/googlehealth.activity_and_fitness.readonlyhttps://www.googleapis.com/auth/googlehealth.health_metrics_and_measurements.readonlyhttps://www.googleapis.com/auth/googlehealth.sleep.readonlyhttps://www.googleapis.com/auth/googlehealth.location.readonly(optional, for GPS TCX workout tracks)
Create a Desktop app OAuth client and place the downloaded JSON at .private/ghealth/client_secret.json (or embed it during build via -GoogleOAuthClientPath). Authorization opens an ephemeral local loopback port only during login.
Data Semantics & Pace Rules
- 90-Day Atomic Fetch: Fetches the trailing 90 days (UTC+8 by default) in 14-day heart-rate and 7-day workout batches, committing atomically to SQLite only after full success.
- No Fabricated Zeros: Missing observations remain blank rather than distorting averages with fake zeros.
- Units & Active Duration: Weight converts grams to
kg, distance converts millimeters tokm, and workouts useactiveDurationexcluding pauses. - GPS Pace: Uses official
averagePaceSecondsPerMeterwhen available; per-point track pace uses a ~20-second sliding window, resets across >90s gaps, labels pauses as stationary, and never alters raw WGS84 points.