feat(insights): read the persisted wellness scores through the derived contract

Register RECOVERY_SCORE / STRESS_SCORE / STRAIN_SCORE as derived metrics that
read the nightly-persisted COMPUTED Measurement rows — a passthrough, never a
recompute. The dispatcher routes the three ids to a thin reader that returns
the latest score, a trailing-window trend, and a direction-aware band (stress
and strain invert, so a high stress reads red). This lets every surface — the
dashboard, the Coach snapshot, the doctor report — consume the scores through
the one Derived<T> route + hook rather than each growing its own read path.
Regenerate the OpenAPI enum, which picks up the three ids from the registry.
This commit is contained in:
Marc-André Bombeck committed 2026-06-02 23:13:26 +02:00
1 parent 02c50acd46
commit a8daef7376
7 files changed
+308 -2

No files matched your search

+6
View File
@@ -2445,6 +2445,9 @@ paths:
- COINCIDENT_DEVIATION
- HRV_BALANCE
- BMI
- RECOVERY_SCORE
- STRESS_SCORE
- STRAIN_SCORE
description: "Derived-metric id to compute (e.g. VITALS_BASELINE, FITNESS_AGE, VASCULAR_AGE_DELTA, HRV_BALANCE, BMI,
READINESS). Closed enum: an unknown id 422s. Metrics whose compute has not yet landed return an
`insufficient` value with reason `not_implemented`."
@@ -7592,6 +7595,9 @@ components:
- COINCIDENT_DEVIATION
- HRV_BALANCE
- BMI
- RECOVERY_SCORE
- STRESS_SCORE
- STRAIN_SCORE
description: Echoes the requested derived-metric id (tags the union).
status:
type: string