Architecture Proposal · v3.0
mWellness Score Pipeline
§ 11 — End-to-end pipeline
From wearable signal to a single, explainable score.
10
Stages
7
Sources
UTC
Canonical time
Stage 01Click to explore
Source Sync
Pull from devices & cloud APIs
- Four wake triggers: app foreground, OS background (
BGTaskScheduler/WorkManager), BLEGATTnotification, partner webhooks. - Adapters persist a cursor (
last_synced_at+ vendor pagination token) and issue delta queries only — never full re-pulls. - Per-vendor auth: HealthKit entitlement, Health Connect permissions,
OAuthrefresh tokens for Fitbit / Garmin / Oura. - Exponential backoff with jitter, rate-limit headers honored, every request tagged with a
sync_run_idfor traceability.
Artifacts
HealthKitHealth ConnectOEM SDKGarmin / Fitbit / Oura
Incremental · cursor-based · idempotent · OAuth + entitlement
Open data-sync deep-dive →§ 11 — Worked example
Ana opens the app · April 3, 2026
It's 7:42 a.m. Ana finishes her morning run, taps the app, and two adapters wake up at once. Her Garmin watch streams its daily summary, last night's sleep, and the 35-minute run straight from Garmin's cloud. A heartbeat later, iOS HealthKit hands over its own copies of the same workout, sleep block, and step count — quietly mirrored from the Garmin Connect app on her phone. Two channels, one underlying truth, both pulled in deltas only — nothing she synced yesterday is fetched again.