feat(oura): capture daily resilience as an ordinal RESILIENCE metric

Oura's daily_resilience collection reports a categorical level — limited,
adequate, solid, strong, exceptional. Encode it ordinally (limited=1 …
exceptional=5) into the numeric measurement value so it fits the existing
model with no new categorical column: add the RESILIENCE measurement type
(migration 0186), fetch and map daily_resilience in the Oura sync, and skip
an unknown or missing level rather than coercing it to zero.

RESILIENCE_LEVELS in the Oura client is the single source of truth for the
encoding. The day-keyed externalId keeps a re-sync idempotent so a re-scored
day overwrites in place. Extend the measurement-type label, unit, range,
category, chart-token, and PR-direction maps; add the metric label across all
six locales.
This commit is contained in:
Marc-André Bombeck committed 2026-06-21 10:44:15 +02:00
1 parent 3faafef0df
commit aff4e9abeb
21 files changed
+338 -24

No files matched your search

@@ -120,6 +120,8 @@ export const MEASUREMENT_TYPE_LABEL_KEYS: Record<string, string> = {
// ── v1.17.1 — Oura coverage completion ──
SLEEP_SCORE: "measurements.typeSleepScore",
BODY_TEMPERATURE_DEVIATION: "measurements.typeBodyTemperatureDeviation",
// ── v1.19.0 — Oura resilience ──
RESILIENCE: "measurements.typeResilience",
};
export const MEASUREMENT_TYPE_ICONS: Record<string, LucideIcon> = {
@@ -239,6 +241,10 @@ export const MEASUREMENT_TYPE_ICONS: Record<string, LucideIcon> = {
// ── v1.17.1 — Oura coverage completion ──
SLEEP_SCORE: Moon,
BODY_TEMPERATURE_DEVIATION: Thermometer,
// ── v1.19.0 — Oura resilience ──
// Gauge reads as the composite "index / level" dial, matching the other
// recovery / score composites (RECOVERY_SCORE, DAY_STRAIN).
RESILIENCE: Gauge,
};
export const MEASUREMENT_TYPE_COLORS: Record<string, string> = {
@@ -349,4 +355,8 @@ export const MEASUREMENT_TYPE_COLORS: Record<string, string> = {
// for the body-temperature deviation.
SLEEP_SCORE: "bg-chart-2/20 text-chart-2",
BODY_TEMPERATURE_DEVIATION: "bg-chart-5/20 text-chart-5",
// ── v1.19.0 — Oura resilience ──
// chart-1 (Dracula purple) marks the derived recovery / score composites as
// their own visual group, matching RECOVERY_SCORE / DAY_STRAIN.
RESILIENCE: "bg-chart-1/20 text-chart-1",
};