Skip to content

Expose HRV, sleep stages, calories, and contributor scores - #1

Open
lextoumbourou wants to merge 1 commit into
ruhrpotter:mainfrom
lextoumbourou:main
Open

Expose HRV, sleep stages, calories, and contributor scores#1
lextoumbourou wants to merge 1 commit into
ruhrpotter:mainfrom
lextoumbourou:main

Conversation

@lextoumbourou

Copy link
Copy Markdown

Summary

Add the additional information already available via Oura v2 API:

  • Sleep struct (get sleep-details, sleep endpoint): add average HRV, total/deep/REM/light sleep duration, awake time, latency, restless periods, average & lowest heart rate, and average breath.
  • DailyActivity struct (get activity, daily_activity endpoint): add active and total calories.
  • DailySleep struct (get sleep, daily_sleep endpoint): add the contributors breakdown (deep sleep, efficiency, latency, REM, restfulness, timing, total sleep).
  • DailyReadiness struct (get readiness, daily_readiness endpoint): add the contributors breakdown (activity balance, body temperature, HRV balance, previous day activity/night, recovery index, resting heart rate, sleep balance/regularity) plus temperature_deviation and temperature_trend_deviation.

Test plan

  • go build ./..., go vet ./..., gofmt -l . all clean
  • Verified live against the Oura API — new fields decode with real, non-zero values:
oura get sleep
{
  "data": [
    {
      "id": "<uuid>",
      "day": "2026-07-11",
      "score": 75,
      "timestamp": "2026-07-11T00:00:00.000+00:00",
      "contributors": {
        "deep_sleep": 75,
        "efficiency": 67,
        "latency": 37,
        "rem_sleep": 72,
        "restfulness": 70,
        "timing": 94,
        "total_sleep": 85
      }
    }
  ],
  "next_token": ""
}

oura get sleep-details --start <D-1> --end <D> (long_sleep record)
{
  "id": "<uuid>",
  "day": "2026-07-11",
  "score": 0,
  "efficiency": 78,
  "type": "long_sleep",
  "bedtime_start": "2026-07-10T20:36:59.000+10:00",
  "bedtime_end": "2026-07-11T06:18:54.000+10:00",
  "hypnogram_5min": "",
  "total_sleep_duration": 27120,
  "time_in_bed": 34915,
  "deep_sleep_duration": 3750,
  "rem_sleep_duration": 4860,
  "light_sleep_duration": 18510,
  "awake_time": 7795,
  "latency": 2280,
  "restless_periods": 246,
  "average_hrv": 56,
  "average_heart_rate": 50.75,
  "lowest_heart_rate": 43,
  "average_breath": 13.5
}

oura get activity --start <D-1> --end <D>
{
  "data": [
    {
      "id": "<uuid>",
      "day": "2026-07-11",
      "score": 94,
      "steps": 1629,
      "active_calories": 72,
      "total_calories": 2093
    }
  ],
  "next_token": ""
}

oura get readiness --start <D-1> --end <D>
{
  "id": "<uuid>",
  "day": "2026-07-11",
  "score": 83,
  "timestamp": "2026-07-11T00:00:00.000+00:00",
  "contributors": {
    "activity_balance": 73,
    "body_temperature": 97,
    "hrv_balance": 88,
    "previous_day_activity": 80,
    "previous_night": 72,
    "recovery_index": 65,
    "resting_heart_rate": 100,
    "sleep_balance": 93,
    "sleep_regularity": 85
  },
  "temperature_deviation": -0.22,
  "temperature_trend_deviation": -0.05
}

Add average HRV, deep/REM/light sleep duration, and lowest heart rate
to the sleep-details response, and active/total calories to activity.
Flesh out the previously-stubbed daily sleep and readiness structs
with their contributor scores.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant