feat(illness): Rest Mode — annotate score/recovery/streaks during an active episode + FHIR/doctor-report

An active illness/condition episode annotates, it never penalises: the
measured number is untouched, only the narrative changes.

- rest-mode.ts: one server-authoritative resolver (module-gated, fail-soft)
  for "is the account in Rest Mode + which episodes back it". iOS mirrors the
  resolved context, never recomputes the suppression.
- health-score: /api/analytics attaches a value-free Rest Mode annotation;
  computeHealthScore stays pure (score never adjusted).
- recovery-score: computeRecoveryScore carries the Rest Mode context as of the
  scored day; the persisted blend is unchanged.
- coach-nudge: pause cadence-nudges during an active episode (new
  skippedDuringIllness counter, gate sits before the trigger search).
- achievements: bridgeFrozenStreakGaps freezes (does not break) every
  day-streak across illness days; never invents a streak, a non-illness gap
  still breaks.
- coincident-deviation: reframe a fired flag as illness-explained; vital
  numbers untouched. Surfaced as a neutral line on the insights card.
- coach snapshot: illness history + active illness as load-bearing context so
  the coach knows about Rest Mode (no decrypted note reaches the prompt).
- FHIR: illness episodes map to Condition (generic disease root, label on
  code.text, patient-reported/unconfirmed) + a bounding Encounter.
- doctor-report: module-gated illness section in the aggregator + PDF table
  (retrospective, neutral palette); FHIR Condition section in the bundle.

i18n x6 for the report + reframe copy. Tests: score-annotation-not-
penalisation, streak-freeze, coach-nudge pause, FHIR Condition/Encounter
mapping, doctor-report inclusion, Rest Mode resolver. typecheck/lint/test
green, openapi in sync, knip clean.
This commit is contained in:
Marc-André Bombeck committed 2026-06-16 22:25:50 +02:00
1 parent 8447ad90cc
commit c59cf0b652
37 files changed
+1352 -24

No files matched your search

+10 -2
View File
@@ -204,7 +204,14 @@
"eA1c": "Geschätzter HbA1c",
"cv": "Variabilität (VK%)",
"spotCaveat": "Dies sind Schätzwerte aus Einzelmessungen, kein Profil eines kontinuierlichen Messgeräts — als Tendenz und nicht als klinisches Urteil zu lesen."
}
},
"illnessTitle": "Erkrankungen",
"illnessOngoing": "Andauernd",
"illnessColCondition": "Erkrankung",
"illnessColType": "Art",
"illnessColLifecycle": "Verlauf",
"illnessColOnset": "Beginn",
"illnessColResolved": "Abgeklungen"
},
"errorBoundary": {
"title": "Da ist etwas schiefgelaufen",
@@ -3462,7 +3469,8 @@
"watchVital": "Außerhalb des Bereichs: {vital}. Oft nur einmalig — behalte es in den nächsten Tagen im Blick.",
"firedHeadline": "{count} deiner Vitalwerte liegen heute außerhalb ihres persönlichen Bereichs.",
"factors": "Mögliche Faktoren — nie eine Ursache: ein hartes Training, schlechter Schlaf, Alkohol, Höhe, Stress oder Krankheit. Das ist ein Hinweis aus deinen eigenen Baselines, keine Diagnose.",
"building": "Deine persönlichen Baselines entstehen — erfasse ein paar Tage mehr, dann erscheint dies."
"building": "Deine persönlichen Baselines entstehen — erfasse ein paar Tage mehr, dann erscheint dies.",
"illnessExplained": "Diese Abweichungen hängen wahrscheinlich mit der erfassten Erkrankung zusammen."
},
"trajectory": {
"cardTitle": "Kurzfrist-Projektion",
+10 -2
View File
@@ -204,7 +204,14 @@
"eA1c": "Estimated A1C",
"cv": "Variability (CV%)",
"spotCaveat": "These are spot-reading estimates from individual measurements, not a continuous-monitor profile — read them as a direction of travel rather than a clinical verdict."
}
},
"illnessTitle": "Conditions & illnesses",
"illnessOngoing": "Ongoing",
"illnessColCondition": "Condition",
"illnessColType": "Type",
"illnessColLifecycle": "Course",
"illnessColOnset": "Onset",
"illnessColResolved": "Resolved"
},
"errorBoundary": {
"title": "Something went wrong",
@@ -3462,7 +3469,8 @@
"watchVital": "Outside range: {vital}. Often just a one-off — worth a glance over the next few days.",
"firedHeadline": "{count} of your vitals are outside their personal range today.",
"factors": "Possible factors — never a cause: a hard workout, poor sleep, alcohol, altitude, stress, or illness. This is awareness from your own baselines, not a diagnosis.",
"building": "Building your personal baselines — track a few more days and this will appear."
"building": "Building your personal baselines — track a few more days and this will appear.",
"illnessExplained": "These shifts likely reflect the condition you logged."
},
"trajectory": {
"cardTitle": "Short-horizon projection",
+10 -2
View File
@@ -204,7 +204,14 @@
"eA1c": "A1C estimada",
"cv": "Variabilidad (CV%)",
"spotCaveat": "Son estimaciones a partir de mediciones puntuales, no un perfil de monitor continuo — léelas como una tendencia, no como un veredicto clínico."
}
},
"illnessTitle": "Afecciones y enfermedades",
"illnessOngoing": "En curso",
"illnessColCondition": "Afección",
"illnessColType": "Tipo",
"illnessColLifecycle": "Curso",
"illnessColOnset": "Inicio",
"illnessColResolved": "Resuelta"
},
"errorBoundary": {
"title": "Algo ha salido mal",
@@ -3462,7 +3469,8 @@
"watchVital": "Fuera de rango: {vital}. A menudo es algo puntual; conviene vigilarlo los próximos días.",
"firedHeadline": "Hoy, {count} de tus constantes están fuera de su rango personal.",
"factors": "Posibles factores, nunca una causa: un entrenamiento intenso, dormir mal, alcohol, altitud, estrés o una enfermedad. Es un aviso a partir de tus propias bases, no un diagnóstico.",
"building": "Construyendo tus bases personales: registra unos días más y esto aparecerá."
"building": "Construyendo tus bases personales: registra unos días más y esto aparecerá.",
"illnessExplained": "Es probable que estas variaciones reflejen la afección que registraste."
},
"trajectory": {
"cardTitle": "Proyección a corto plazo",
+10 -2
View File
@@ -204,7 +204,14 @@
"eA1c": "HbA1c estimée",
"cv": "Variabilité (CV%)",
"spotCaveat": "Ce sont des estimations issues de mesures ponctuelles, et non un profil de capteur continu — à lire comme une tendance, pas comme un verdict clinique."
}
},
"illnessTitle": "Affections et maladies",
"illnessOngoing": "En cours",
"illnessColCondition": "Affection",
"illnessColType": "Type",
"illnessColLifecycle": "Évolution",
"illnessColOnset": "Début",
"illnessColResolved": "Résolue"
},
"errorBoundary": {
"title": "Une erreur est survenue",
@@ -3462,7 +3469,8 @@
"watchVital": "Hors plage : {vital}. Souvent ponctuel — à surveiller ces prochains jours.",
"firedHeadline": "Aujourd’hui, {count} de vos constantes sont hors de leur plage personnelle.",
"factors": "Facteurs possibles — jamais une cause : un entraînement intense, un mauvais sommeil, l’alcool, l’altitude, le stress ou une maladie. C’est un repère issu de vos propres références, pas un diagnostic.",
"building": "Construction de vos références personnelles — enregistrez quelques jours de plus et cela apparaîtra."
"building": "Construction de vos références personnelles — enregistrez quelques jours de plus et cela apparaîtra.",
"illnessExplained": "Ces écarts reflètent probablement l’affection que vous avez consignée."
},
"trajectory": {
"cardTitle": "Projection à court terme",
+10 -2
View File
@@ -204,7 +204,14 @@
"eA1c": "A1C stimata",
"cv": "Variabilità (CV%)",
"spotCaveat": "Sono stime da misurazioni occasionali, non un profilo da monitor continuo — vanno lette come una tendenza, non come un verdetto clinico."
}
},
"illnessTitle": "Condizioni e malattie",
"illnessOngoing": "In corso",
"illnessColCondition": "Condizione",
"illnessColType": "Tipo",
"illnessColLifecycle": "Decorso",
"illnessColOnset": "Inizio",
"illnessColResolved": "Risolta"
},
"errorBoundary": {
"title": "Qualcosa è andato storto",
@@ -3462,7 +3469,8 @@
"watchVital": "Fuori intervallo: {vital}. Spesso è un episodio isolato — tienilo d’occhio nei prossimi giorni.",
"firedHeadline": "Oggi {count} dei tuoi parametri vitali sono fuori dal loro intervallo personale.",
"factors": "Possibili fattori — mai una causa: un allenamento intenso, poco sonno, alcol, altitudine, stress o una malattia. È un avviso basato sui tuoi parametri, non una diagnosi.",
"building": "Stiamo costruendo i tuoi riferimenti personali — registra ancora qualche giorno e comparirà."
"building": "Stiamo costruendo i tuoi riferimenti personali — registra ancora qualche giorno e comparirà.",
"illnessExplained": "Questi scostamenti riflettono probabilmente la condizione che hai registrato."
},
"trajectory": {
"cardTitle": "Proiezione a breve termine",
+10 -2
View File
@@ -204,7 +204,14 @@
"eA1c": "Szacowane HbA1c",
"cv": "Zmienność (CV%)",
"spotCaveat": "To szacunki z pojedynczych pomiarów, nie profil z monitora ciągłego — czytaj je jako kierunek zmian, a nie kliniczny werdykt."
}
},
"illnessTitle": "Schorzenia i choroby",
"illnessOngoing": "Trwająca",
"illnessColCondition": "Schorzenie",
"illnessColType": "Typ",
"illnessColLifecycle": "Przebieg",
"illnessColOnset": "Początek",
"illnessColResolved": "Ustąpiła"
},
"errorBoundary": {
"title": "Coś poszło nie tak",
@@ -3462,7 +3469,8 @@
"watchVital": "Poza zakresem: {vital}. Często to jednorazowy odczyt — warto obserwować przez kilka dni.",
"firedHeadline": "Dziś {count} Twoich parametrów życiowych jest poza osobistym zakresem.",
"factors": "Możliwe czynniki — nigdy przyczyna: intensywny trening, słaby sen, alkohol, wysokość, stres lub choroba. To wskazówka z Twoich własnych baz, nie diagnoza.",
"building": "Budujemy Twoje osobiste bazy — zarejestruj jeszcze kilka dni, a to się pojawi."
"building": "Budujemy Twoje osobiste bazy — zarejestruj jeszcze kilka dni, a to się pojawi.",
"illnessExplained": "Te odchylenia prawdopodobnie wynikają z zapisanego schorzenia."
},
"trajectory": {
"cardTitle": "Krótkoterminowy rzut",