Skip to Content
WearablesOverview

Wearables

Loop Health integrates with multiple wearable devices and continuous glucose monitors to provide a complete picture of a patient’s daily health metrics. Wearable data contributes 40% of the composite health score.

Supported Devices

DeviceTypeMetricsOAuth
Oura RingSmart ringSleep, readiness, activity, HRVOAuth 2.0
WhoopFitness bandRecovery, strain, sleep, HRV, workoutsOAuth 2.0
Dexcom CGMGlucose monitorContinuous glucose readingsOAuth 2.0
Libre CGMGlucose monitorContinuous glucose readingsOAuth 2.0

Future support is planned for Garmin, Fitbit, and Apple Health.

Architecture

┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ Oura API │ │ Whoop API │ │ Dexcom API │ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ │ │ │ ▼ ▼ ▼ ┌──────────────────────────────────────────────────────────┐ │ OAuth Token Storage │ │ patient_graph.wearable_data │ └──────────────────────────┬───────────────────────────────┘ ┌──────────────────────────────────────────────────────────┐ │ Trigger.dev Sync Jobs │ │ syncWearablesDaily · syncWhoopData · syncCgmReadings │ └──────────────────────────┬───────────────────────────────┘ ┌──────────────────────────────────────────────────────────┐ │ patient_graph.wearable_data │ │ patient_wearable_readings · patient_wearable_daily_stats │ └──────────────────────────┬───────────────────────────────┘ ┌────────────┼────────────┐ ▼ ▼ ▼ Health Score Luna AI Dashboard (40% weight) Insights Visualizations

Data Flow

  1. Connect — User initiates OAuth flow from the consumer app
  2. Authorize — User authorizes Loop Health on the device provider’s site
  3. Callback — OAuth tokens received and stored in the Patient Graph
  4. Sync — Trigger.dev jobs run daily (3 AM UTC) to fetch latest data
  5. Store — Metrics stored in wearable_data table with device source and type
  6. Aggregate — Daily stats computed and stored in patient_wearable_daily_stats
  7. Score@loop/health-score incorporates wearable data (40% weight)
  8. Insights — Luna AI accesses data via getWearableInsights tool

Metrics Collected

Metric TypeDevicesDescription
sleepOura, WhoopDuration, efficiency, stages, latency
recoveryOura, WhoopRecovery score, readiness
hrvOura, WhoopHeart rate variability (ms)
activityOura, WhoopActive calories, steps, activity score
strainWhoopDaily strain (0–21 scale)
glucoseDexcom, LibreContinuous glucose (mg/dL)
readinessOuraReadiness score (0–100)

Database Schema

wearable_data

Stores raw wearable metrics with source attribution:

ColumnTypeDescription
iduuidRecord ID
customerIduuidPatient ID
sourceenumDevice source (oura, whoop, dexcom, etc.)
metricTypeenumMetric type (sleep, recovery, hrv, etc.)
metricsjsonbDevice-specific metric values
recordedAttimestampWhen the data was recorded

patient_wearable_daily_stats

Aggregated daily statistics for dashboard display and trend analysis.

patient_wearable_readings

Individual readings (primarily used for CGM data points).