Merge symptom-severity recovery track into release/v1.19.2

Fold the illness journal's per-day functional-impact curve (falling back
to linked symptom severity) into the recovery-gap as a return track
against the known-constant healthy baseline. It is adverse by
construction, feeds the qualifying-days floor and the gap median, and
withholds on sparse logging. The card names the driver when symptoms
lead ('…before your logged symptoms eased').
This commit is contained in:
Marc-André Bombeck committed 2026-06-21 21:07:02 +02:00
commit 5a2d759e50
12 files changed
+471 -8

No files matched your search

@@ -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 (
<div className="space-y-5">
@@ -71,11 +75,19 @@ function CorrelationBody({ value }: { value: IllnessCorrelationValue }) {
</p>
<p className="text-muted-foreground mt-1 text-sm">
{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")}
</p>
</div>
+8
View File
@@ -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[];
}