mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-19 08:12:52 +00:00
Show the HRV tile for an account whose HRV is RMSSD
HRV lives under two measurement types and they are not the same measure: Apple Health / Fitbit / Google Health write SDNN as `HEART_RATE_VARIABILITY`, while Oura / Polar / WHOOP — and a bridge pushing a watch that reports it that way — write nightly RMSSD as `HRV_RMSSD`. Every HRV surface unions the two: `/insights/hrv` through `fallbackMeasurementType`, the Coach through `COACH_SOURCE_MEASUREMENT_TYPES.hrv`, the MCP reads through `withHrvFallback`. `sub-page-metric.ts` even says listing both is what keeps "the tab, pill, and dashboard tile lit whichever source the user has". The dashboard tile did not. It read SDNN alone, so an RMSSD-only account got a Settings → Dashboard toggle that turned on and rendered nothing, with no explanation, while the insights page charted the same readings — which is why it reads as a broken layout rather than a missing series. `pickHrvSummary` picks the series with the same rule `withHrvFallback` uses: the primary wins whenever it has any rows, the fallback only when it has none. Never a merge — the two share `ms` but measure different things, so blending them would invent a number no device reported. The caller gets the winning type back, because the freshness caption has to read the series on show and the label has to name the measure when it is not SDNN (`· RMSSD`, as the insights chart title already does). Second, less visible half: `HRV_RMSSD` is recovery-owned in `METRIC_STATUS_MODULE_OWNERS`, but the dashboard snapshot gates off `SUMMARY_TYPE_MODULE`, a different map, and that one did not list it. The omission was inert while the tile read SDNN alone; adding the fallback without it would hand a recovery-off account a tile built from recovery-owned rows — the exact hazard the owner map documents. The entry goes in beside the four sibling recovery types, so the gate stays server side and the client keeps no competing copy.
This commit is contained in:
5 files changed
+277
-3
No files matched your search
@@ -68,6 +68,16 @@ export const SUMMARY_TYPE_MODULE: Partial<Record<string, ModuleKey>> = {
|
||||
SIX_MINUTE_WALK_DISTANCE: "recovery",
|
||||
STAIR_ASCENT_SPEED: "recovery",
|
||||
STAIR_DESCENT_SPEED: "recovery",
|
||||
// The HRV fallback series. `METRIC_STATUS_MODULE_OWNERS` already owns this
|
||||
// type for the metric-status / MCP reads, for the reason stated there: a
|
||||
// fallback path must not serve the recovery data the primary type refuses.
|
||||
// The dashboard snapshot gates off THIS map instead, and the entry was
|
||||
// missing — harmless only while the dashboard HRV tile read SDNN alone.
|
||||
// Now that the tile falls back to RMSSD (`pickHrvSummary`), the omission
|
||||
// would hand a recovery-off account a tile built from recovery-owned rows.
|
||||
// `HEART_RATE_VARIABILITY` stays deliberately ungated: SDNN is a plain
|
||||
// vital, and it is what the tile shows whenever the account has it.
|
||||
HRV_RMSSD: "recovery",
|
||||
// Per-night breathing-disturbance index is a sleep-page signal.
|
||||
BREATHING_DISTURBANCES: "sleep",
|
||||
// v1.29 — fluid-intake dashboard tile summary, derived server-side from
|
||||
|
||||
Reference in new issue
Block a user