section-11 icon indicating copy to clipboard operation
section-11 copied to clipboard

Wellness fields (HRV, sleep, SpO2) not mapping from Intervals.icu API to latest.json

Open mmmgame1888 opened this issue 5 months ago • 2 comments

HI, I recently started using your Section 11 AI coach. It's amazing, thank you! I also recently got a fitbit air to track my wellness data. However, data like resting hr, hrv, sleep hours, and spO2) isn't making it into the latest.json. I asked Claude for help, and it drafted the below issue summary. Can you update the sync?

If you have a donation page, i'd be happy to contribute.

Cheers, mmmgame1888

Summary

Wellness data from Intervals.icu is not being mapped correctly into latest.json. The data exists in Intervals.icu (confirmed via CSV export) but fields appear as null in the JSON output.

Affected fields

  • hrv_rmssd (always null — CSV shows ~37–40 RMSSD)
  • sleep_hours (always null — CSV shows ~7h/night as sleepSecs)
  • spO2 (always null — CSV shows 97%)
  • resting_hr (sporadic — only appearing on some days, not consistently)

Evidence

On 2026-06-23, the Intervals.icu CSV export shows hrv=37.389473 for that date, but the latest.json generated at 2026-06-23T22:07:26 UTC shows hrv_rmssd: null for the same date. This rules out a timing issue — the data was in Intervals.icu when the sync ran.

Setup

  • Wellness source: Fitbit Air via Health Sync → Intervals.icu
  • sync.py version: 3.112
  • Sync method: GitHub Actions (json-auto-sync)

Expected behaviour

HRV, sleep, and SpO2 should populate in the wellness_data and current_status.current_metrics sections of latest.json when present in Intervals.icu.

mmmgame1888 avatar Jun 25 '26 22:06 mmmgame1888

Sorry for the late reply!

I can’t reproduce this with sync.py 3.112 on my Intervals data, and I haven’t seen other reports of these canonical wellness fields being dropped.

In my local latest.json:

  • wellness_data[].hrv_rmssd is populated for all 7 recent days
  • wellness_data[].sleep_hours is populated for all 7 days
  • wellness_data[].resting_hr is populated for all 7 days
  • wellness_data[].spO2 exists for all 7 days, but is null for all 7 days

So the normal Intervals /wellness JSON -> Section 11 mapping appears to work when Intervals returns the canonical fields.

Since the source here is Fitbit Air via Health Sync, the useful test is to compare one affected date in raw Intervals API output vs generated latest.json:

curl -u API_KEY:*** 'https://intervals.icu/api/v1/athlete/ATHLETE_ID/wellness/YYYY-MM-DD'
curl -u API_KEY:*** 'https://intervals.icu/api/v1/athlete/ATHLETE_ID/wellness?oldest=YYYY-MM-DD&newest=YYYY-MM-DD'
curl -u API_KEY:*** 'https://intervals.icu/api/v1/athlete/ATHLETE_ID/wellness.csv?oldest=YYYY-MM-DD&newest=YYYY-MM-DD&cols=hrv,sleepSecs,restingHR,spO2'

Expected mappings:

• hrv -> wellness_data[].hrv_rmssd • sleepSecs -> wellness_data[].sleep_hours • restingHR -> wellness_data[].resting_hr • spO2 -> wellness_data[].spO2

If those keys are present in raw /wellness JSON but missing/null in latest.json, that is a Section 11 sync bug. If UI/CSV has them but raw /wellness JSON does not, this is more likely an Intervals / Health Sync source/API-shape issue than Section 11 dropping fields.

CrankAddict avatar Jun 28 '26 20:06 CrankAddict

It has started pulling in now! it must have been an issue on the Health Sync / Intervals end. Thank you for your very detailed response. Cheers

mmmgame1888 avatar Jun 30 '26 22:06 mmmgame1888