You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[health-connect] Import per-sample HR, not just a daily average — unblocks Effort/zones/HR chart for strapless users #843
Split out of #835, where @bartmuskala asked to see Effort on an imported ride rather than calories:
workouts are about strain. I prefer to see my strain score for the ride instead of improved calories. It is already calculated anyway.
Reasonable, and it is the better number for a workout — but it is not a display toggle today.
Why it cannot be shown
HealthConnectImporter reads HeartRateRecord and collapses it to a per-day average:
readAll(client, HeartRateRecord::class, filter, selfPackage) { r ->for (s in r.samples) { b.hrSum += s.beatsPerMinute; b.hrCount +=1 }
}
No hrSample rows are written. So a Health-Connect-only install (no strap) has no HR series at all, and everything downstream of one is unavailable:
Effort / strain — StrainScorer needs the series
Zone minutes — HrZones.timeInZone needs the series
The workout HR chart — hrBuckets reads hrSample
HRV / stress — needs R-R, which Health Connect does not expose at all
"It is already calculated anyway" holds for strap workouts, not imported ones.
There is one narrow exception already in place: a per-session HeartRateRecord read fills each imported workout's avgHr/maxHr when ≥60 samples land in the window. Those samples are read and then discarded rather than stored.
What to do
Persist HR samples from Health Connect into hrSample under the HC device id, the way the strap path does. That single change delivers Effort, zone minutes and the workout HR chart together, and it makes strapless installs a real use case rather than a degraded one.
Worth deciding up front:
Volume. 1 Hz over a long history is large. The strap path already handles this scale, but HC can span years of data from multiple sources.
Granularity. HC HR is often sparser than 1 Hz; the 60-sample gates in fillWorkoutHrFromStrap and the stager assume denser data and may need revisiting for imported sessions.
Scope. Whether to import HR for the whole range or only inside exercise sessions. Session-only is far cheaper and covers the actual request.
Related: #835 (calories, fixed in #842), #836 (PPG-derived HR missing from the workout average, fixed in #841).
Activity
fix(health-connect): workout calories under-report, and double-count …
fix(health-connect): workout calories under-report, and double-count …