From 1352ba2aa65eda447d92fd437df4e48edca50130 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sun, 21 Jun 2026 21:06:14 +0200 Subject: [PATCH] feat(illness): name the symptom curve in the recovery-gap card When the logged symptom curve drives the recovery gap, the card names it ('you felt better N days before your logged symptoms eased') instead of the vital-driven phrasing. Mirror the new gapDriverType and the return track's adverse flag into the client DTO, and add the driver-aware copy across all six locales. --- messages/de.json | 2 ++ messages/en.json | 2 ++ messages/es.json | 2 ++ messages/fr.json | 2 ++ messages/it.json | 2 ++ messages/pl.json | 2 ++ .../illness/illness-correlation-card.tsx | 20 +++++++++++++++---- src/components/illness/types.ts | 8 ++++++++ 8 files changed, 36 insertions(+), 4 deletions(-) diff --git a/messages/de.json b/messages/de.json index c15520593..91889f5ad 100644 --- a/messages/de.json +++ b/messages/de.json @@ -6866,6 +6866,8 @@ "recoveryGapTitle": "Erholungslücke", "recoveryGapLag": "Deine Werte normalisierten sich {days} Tage, nachdem es dir besser ging.", "recoveryGapLead": "Deine Werte normalisierten sich {days} Tage, bevor du Genesung vermerktest.", + "recoveryGapLagSymptom": "Dir ging es {days} Tage besser, bevor deine erfassten Symptome abklangen.", + "recoveryGapLeadSymptom": "Deine erfassten Symptome klangen {days} Tage ab, bevor du Genesung vermerktest.", "recoveryGapSame": "Deine Werte normalisierten sich am selben Tag, an dem es dir besser ging.", "redFlagTitle": "Genauer ansehen", "redFlagSpo2": "Deine Sauerstoffsättigung blieb mehrere Tage niedrig. Wenn das erneut auftritt, suche ärztliche Hilfe.", diff --git a/messages/en.json b/messages/en.json index 4ad161b92..32cac8164 100644 --- a/messages/en.json +++ b/messages/en.json @@ -6866,6 +6866,8 @@ "recoveryGapTitle": "Recovery gap", "recoveryGapLag": "Your numbers settled {days} days after you felt better.", "recoveryGapLead": "Your numbers settled {days} days before you marked recovery.", + "recoveryGapLagSymptom": "You felt better {days} days before your logged symptoms eased.", + "recoveryGapLeadSymptom": "Your logged symptoms eased {days} days before you marked recovery.", "recoveryGapSame": "Your numbers settled the same day you felt better.", "redFlagTitle": "Worth a closer look", "redFlagSpo2": "Your oxygen saturation stayed low for several days. If this recurs, seek medical care.", diff --git a/messages/es.json b/messages/es.json index 66d9d2421..ba7e9e577 100644 --- a/messages/es.json +++ b/messages/es.json @@ -6866,6 +6866,8 @@ "recoveryGapTitle": "Brecha de recuperación", "recoveryGapLag": "Tus valores se estabilizaron {days} días después de sentirte mejor.", "recoveryGapLead": "Tus valores se estabilizaron {days} días antes de marcar la recuperación.", + "recoveryGapLagSymptom": "Te sentiste mejor {days} días antes de que cedieran tus síntomas registrados.", + "recoveryGapLeadSymptom": "Tus síntomas registrados cedieron {days} días antes de marcar la recuperación.", "recoveryGapSame": "Tus valores se estabilizaron el mismo día en que te sentiste mejor.", "redFlagTitle": "Conviene revisarlo", "redFlagSpo2": "Tu saturación de oxígeno se mantuvo baja varios días. Si se repite, busca atención médica.", diff --git a/messages/fr.json b/messages/fr.json index 608aef1a6..b90b9f7e2 100644 --- a/messages/fr.json +++ b/messages/fr.json @@ -6866,6 +6866,8 @@ "recoveryGapTitle": "Écart de récupération", "recoveryGapLag": "Tes valeurs se sont stabilisées {days} jours après que tu te sois senti mieux.", "recoveryGapLead": "Tes valeurs se sont stabilisées {days} jours avant que tu notes la guérison.", + "recoveryGapLagSymptom": "Tu t'es senti mieux {days} jours avant que tes symptômes consignés s'apaisent.", + "recoveryGapLeadSymptom": "Tes symptômes consignés se sont apaisés {days} jours avant que tu notes la guérison.", "recoveryGapSame": "Tes valeurs se sont stabilisées le jour même où tu t'es senti mieux.", "redFlagTitle": "À examiner de plus près", "redFlagSpo2": "Ta saturation en oxygène est restée basse plusieurs jours. Si cela se reproduit, consulte un médecin.", diff --git a/messages/it.json b/messages/it.json index 226eaebb0..9f3c112f3 100644 --- a/messages/it.json +++ b/messages/it.json @@ -6866,6 +6866,8 @@ "recoveryGapTitle": "Divario di recupero", "recoveryGapLag": "I tuoi valori si sono stabilizzati {days} giorni dopo esserti sentito meglio.", "recoveryGapLead": "I tuoi valori si sono stabilizzati {days} giorni prima di segnare la guarigione.", + "recoveryGapLagSymptom": "Ti sei sentito meglio {days} giorni prima che i sintomi registrati si attenuassero.", + "recoveryGapLeadSymptom": "I tuoi sintomi registrati si sono attenuati {days} giorni prima di segnare la guarigione.", "recoveryGapSame": "I tuoi valori si sono stabilizzati lo stesso giorno in cui ti sei sentito meglio.", "redFlagTitle": "Da guardare più da vicino", "redFlagSpo2": "La tua saturazione di ossigeno è rimasta bassa per diversi giorni. Se si ripete, rivolgiti a un medico.", diff --git a/messages/pl.json b/messages/pl.json index 4853b2972..2704ab145 100644 --- a/messages/pl.json +++ b/messages/pl.json @@ -6866,6 +6866,8 @@ "recoveryGapTitle": "Luka rekonwalescencji", "recoveryGapLag": "Twoje wartości ustabilizowały się {days} dni po tym, jak poczułeś się lepiej.", "recoveryGapLead": "Twoje wartości ustabilizowały się {days} dni przed oznaczeniem wyzdrowienia.", + "recoveryGapLagSymptom": "Poczułeś się lepiej {days} dni przed ustąpieniem zapisanych objawów.", + "recoveryGapLeadSymptom": "Twoje zapisane objawy ustąpiły {days} dni przed oznaczeniem wyzdrowienia.", "recoveryGapSame": "Twoje wartości ustabilizowały się tego samego dnia, gdy poczułeś się lepiej.", "redFlagTitle": "Warto przyjrzeć się bliżej", "redFlagSpo2": "Twoje wysycenie tlenem pozostawało niskie przez kilka dni. Jeśli się powtórzy, zasięgnij pomocy medycznej.", diff --git a/src/components/illness/illness-correlation-card.tsx b/src/components/illness/illness-correlation-card.tsx index 000bac25f..57e937154 100644 --- a/src/components/illness/illness-correlation-card.tsx +++ b/src/components/illness/illness-correlation-card.tsx @@ -44,6 +44,10 @@ function DeviationRow({ d }: { d: IllnessVitalDeviation }) { function CorrelationBody({ value }: { value: IllnessCorrelationValue }) { const { t } = useTranslations(); const gap = value.recoveryGapDays; + // Driver-aware copy: when the user's logged symptom curve drove the gap, name + // the symptoms ("…before your symptoms eased"); otherwise the existing + // vital-driven phrasing. Clinically calm — observation, never prediction. + const symptomDriven = value.gapDriverType === "FUNCTIONAL_IMPACT"; return (
@@ -71,11 +75,19 @@ function CorrelationBody({ value }: { value: IllnessCorrelationValue }) {

{gap > 0 - ? t("illness.correlation.recoveryGapLag", { days: gap }) + ? t( + symptomDriven + ? "illness.correlation.recoveryGapLagSymptom" + : "illness.correlation.recoveryGapLag", + { days: gap }, + ) : gap < 0 - ? t("illness.correlation.recoveryGapLead", { - days: Math.abs(gap), - }) + ? t( + symptomDriven + ? "illness.correlation.recoveryGapLeadSymptom" + : "illness.correlation.recoveryGapLead", + { days: Math.abs(gap) }, + ) : t("illness.correlation.recoveryGapSame")}

diff --git a/src/components/illness/types.ts b/src/components/illness/types.ts index 6bda26316..581dcd3fd 100644 --- a/src/components/illness/types.ts +++ b/src/components/illness/types.ts @@ -97,9 +97,11 @@ export interface IllnessVitalDeviation { } export interface IllnessVitalReturn { + /** A `MeasurementType`, or `"FUNCTIONAL_IMPACT"` for the symptom-burden track. */ type: string; returnedDay: string | null; gapDays: number | null; + adverse: boolean; } export interface IllnessRedFlag { @@ -117,6 +119,12 @@ export interface IllnessCorrelationValue { recoveryGapDays: number | null; adverseCoverageDays: number; feltBetterDay: string | null; + /** + * The metric that drove the headline gap — a `MeasurementType`, + * `"FUNCTIONAL_IMPACT"` (the symptom-burden track), or null. Drives the + * driver-aware recovery-gap copy. + */ + gapDriverType: string | null; redFlags: IllnessRedFlag[]; }