diff --git a/messages/de.json b/messages/de.json index 332273ff2..f2480fafb 100644 --- a/messages/de.json +++ b/messages/de.json @@ -432,7 +432,9 @@ "endDoseChange": "Zeitraum endet am {date}, vor der ersten Dosisänderung", "days": "{before} Tage vor, {after} Tage nach dem Start, {excluded} Tage ausgelassen", "method": "Segmentierte Regression über die Tageswerte von 90 Tagen vor bis höchstens 180 Tagen nach dem Start, Intervalle nach Newey-West. Tage nach dem Start, an denen in den 14 Tagen davor weniger als 80 % der Dosen eingenommen wurden, sind ausgelassen. Beschreibt einen zeitlichen Zusammenhang, keine nachgewiesene Wirkung des Medikaments.", - "autocorrelation": "starke Abhängigkeit vom Vortag, die Bereiche können daher noch zu eng sein" + "autocorrelation": "starke Abhängigkeit vom Vortag, die Bereiche können daher noch zu eng sein", + "window": "ausgewertet {from} bis {to}, das kann über den Berichtszeitraum hinausreichen", + "windowLine": "Ausgewertet {from} bis {to}. Dieser Zeitraum kann über den Berichtszeitraum hinausreichen." } }, "errorBoundary": { diff --git a/messages/en.json b/messages/en.json index df76fca81..4cdf487f5 100644 --- a/messages/en.json +++ b/messages/en.json @@ -432,7 +432,9 @@ "endDoseChange": "window ends {date}, before the first dose change", "days": "{before} days before, {after} days after the start, {excluded} days left out", "method": "Segmented regression on daily values from 90 days before to at most 180 days after the start, with Newey-West intervals. Days after the start on which fewer than 80 % of the doses of the preceding 14 days were taken are left out. Describes an association over time, not a proven effect of the medication.", - "autocorrelation": "strong day-to-day carry-over, so the ranges may still be too narrow" + "autocorrelation": "strong day-to-day carry-over, so the ranges may still be too narrow", + "window": "analysed {from} to {to}, which can reach beyond the report period", + "windowLine": "Analysed {from} to {to}. This window can reach beyond the report period." } }, "errorBoundary": { diff --git a/messages/es.json b/messages/es.json index a41820b06..8d7873a7c 100644 --- a/messages/es.json +++ b/messages/es.json @@ -432,7 +432,9 @@ "endDoseChange": "el periodo termina el {date}, antes del primer cambio de dosis", "days": "{before} días antes, {after} días después del inicio, {excluded} días omitidos", "method": "Regresión segmentada sobre los valores diarios desde 90 días antes hasta como máximo 180 días después del inicio, con intervalos de Newey-West. Se omiten los días posteriores al inicio en los que se tomó menos del 80 % de las dosis de los 14 días anteriores. Describe una asociación en el tiempo, no un efecto demostrado del medicamento.", - "autocorrelation": "fuerte dependencia del día anterior, así que los rangos pueden seguir siendo demasiado estrechos" + "autocorrelation": "fuerte dependencia del día anterior, así que los rangos pueden seguir siendo demasiado estrechos", + "window": "analizado del {from} al {to}, puede ir más allá del periodo del informe", + "windowLine": "Analizado del {from} al {to}. Este intervalo puede ir más allá del periodo del informe." } }, "errorBoundary": { diff --git a/messages/fr.json b/messages/fr.json index 2c7feebcd..a689b23bc 100644 --- a/messages/fr.json +++ b/messages/fr.json @@ -432,7 +432,9 @@ "endDoseChange": "la période s'arrête le {date}, avant le premier changement de dose", "days": "{before} jours avant, {after} jours après le démarrage, {excluded} jours écartés", "method": "Régression segmentée sur les valeurs quotidiennes, de 90 jours avant à 180 jours au plus après le démarrage, intervalles de Newey-West. Les jours après le démarrage où moins de 80 % des doses des 14 jours précédents ont été prises sont écartés. Décrit une association dans le temps, pas un effet démontré du médicament.", - "autocorrelation": "forte dépendance à la veille, les plages peuvent donc rester trop étroites" + "autocorrelation": "forte dépendance à la veille, les plages peuvent donc rester trop étroites", + "window": "analysé du {from} au {to}, ce qui peut dépasser la période du rapport", + "windowLine": "Analysé du {from} au {to}. Cette fenêtre peut dépasser la période du rapport." } }, "errorBoundary": { diff --git a/messages/it.json b/messages/it.json index 7d623bd08..276cfd2c3 100644 --- a/messages/it.json +++ b/messages/it.json @@ -432,7 +432,9 @@ "endDoseChange": "il periodo termina il {date}, prima della prima variazione di dose", "days": "{before} giorni prima, {after} giorni dopo l'inizio, {excluded} giorni esclusi", "method": "Regressione segmentata sui valori giornalieri da 90 giorni prima a non oltre 180 giorni dopo l'inizio, con intervalli di Newey-West. Sono esclusi i giorni dopo l'inizio in cui è stato assunto meno dell'80 % delle dosi dei 14 giorni precedenti. Descrive un'associazione nel tempo, non un effetto dimostrato del farmaco.", - "autocorrelation": "forte dipendenza dal giorno precedente, quindi gli intervalli possono restare troppo stretti" + "autocorrelation": "forte dipendenza dal giorno precedente, quindi gli intervalli possono restare troppo stretti", + "window": "analizzato dal {from} al {to}, può andare oltre il periodo del report", + "windowLine": "Analizzato dal {from} al {to}. Questo intervallo può andare oltre il periodo del report." } }, "errorBoundary": { diff --git a/messages/ko.json b/messages/ko.json index bbfc55376..de47beccd 100644 --- a/messages/ko.json +++ b/messages/ko.json @@ -432,7 +432,9 @@ "endDoseChange": "기간은 첫 용량 변경 전인 {date}에 끝남", "days": "시작 전 {before}일, 시작 후 {after}일, 제외 {excluded}일", "method": "시작 90일 전부터 최대 180일 후까지의 일별 값에 대한 분절 회귀, Newey-West 구간. 직전 14일 복용률이 80% 미만인 시작 후 날짜는 제외했습니다. 시간에 따른 연관성을 보여 줄 뿐, 약의 효과를 입증하지 않습니다.", - "autocorrelation": "전날 값에 크게 좌우되므로 범위가 여전히 너무 좁을 수 있음" + "autocorrelation": "전날 값에 크게 좌우되므로 범위가 여전히 너무 좁을 수 있음", + "window": "{from}부터 {to}까지 분석, 보고 기간을 넘어설 수 있음", + "windowLine": "{from}부터 {to}까지 분석했습니다. 이 기간은 보고 기간을 넘어설 수 있습니다." } }, "errorBoundary": { diff --git a/messages/nl.json b/messages/nl.json index 3b16274f8..7b94c1ea4 100644 --- a/messages/nl.json +++ b/messages/nl.json @@ -432,7 +432,9 @@ "endDoseChange": "periode eindigt op {date}, vóór de eerste dosiswijziging", "days": "{before} dagen voor, {after} dagen na de start, {excluded} dagen weggelaten", "method": "Gesegmenteerde regressie op de dagwaarden van 90 dagen vóór tot hoogstens 180 dagen na de start, met Newey-West-intervallen. Dagen na de start waarop minder dan 80% van de doses van de 14 dagen ervoor is ingenomen, zijn weggelaten. Beschrijft een samenhang in de tijd, geen bewezen effect van het medicijn.", - "autocorrelation": "sterke afhankelijkheid van de vorige dag, dus de bereiken kunnen nog te smal zijn" + "autocorrelation": "sterke afhankelijkheid van de vorige dag, dus de bereiken kunnen nog te smal zijn", + "window": "geanalyseerd van {from} tot {to}, dit kan buiten de rapportperiode vallen", + "windowLine": "Geanalyseerd van {from} tot {to}. Deze periode kan buiten de rapportperiode vallen." } }, "errorBoundary": { diff --git a/messages/pl.json b/messages/pl.json index c1e0aee67..7fc928cd2 100644 --- a/messages/pl.json +++ b/messages/pl.json @@ -432,7 +432,9 @@ "endDoseChange": "okres kończy się {date}, przed pierwszą zmianą dawki", "days": "{before} dni przed, {after} dni po rozpoczęciu, pominięto {excluded} dni", "method": "Regresja segmentowa na wartościach dziennych od 90 dni przed do najwyżej 180 dni po rozpoczęciu, przedziały Neweya-Westa. Pominięto dni po rozpoczęciu, w których w ciągu poprzednich 14 dni przyjęto mniej niż 80% dawek. Opisuje związek w czasie, a nie udowodnione działanie leku.", - "autocorrelation": "silna zależność od poprzedniego dnia, więc zakresy mogą nadal być zbyt wąskie" + "autocorrelation": "silna zależność od poprzedniego dnia, więc zakresy mogą nadal być zbyt wąskie", + "window": "analizowano od {from} do {to}, może to wykraczać poza okres raportu", + "windowLine": "Analizowano od {from} do {to}. Ten okres może wykraczać poza okres raportu." } }, "errorBoundary": { diff --git a/src/components/clinician/__tests__/clinician-view.test.tsx b/src/components/clinician/__tests__/clinician-view.test.tsx index 7a765a28e..49eb46428 100644 --- a/src/components/clinician/__tests__/clinician-view.test.tsx +++ b/src/components/clinician/__tests__/clinician-view.test.tsx @@ -200,6 +200,43 @@ describe("", () => { ], }); const leaves = ["MEDICATION_EFFECT", "BLOOD_PRESSURE_SYS"] as const; + const est = { + estimate: -5, + ciLow: -7, + ciHigh: -3, + standardError: 1, + includesZero: false, + }; + const fitted = makeReport({ + medicationEffects: [ + { + ...report.medicationEffects![0], + targets: [ + { + type: "BLOOD_PRESSURE_SYS", + effect: { + ...report.medicationEffects![0].targets[0].effect, + present: true, + reason: undefined, + levelChange: est, + slopeChangePerWeek: est, + preSlopePerWeek: est, + window: { + from: "2025-10-07", + to: "2026-01-20", + endReason: "today", + }, + }, + }, + ], + }, + ], + }); + expect( + render(fitted, { + selection: selectionFromLeaves([...leaves, "MEDICATION_LIST"]), + }), + ).toContain("This window can reach beyond the report period."); expect( render(report, { selection: selectionFromLeaves([...leaves, "MEDICATION_LIST"]), diff --git a/src/components/clinician/activity-effect-sections.tsx b/src/components/clinician/activity-effect-sections.tsx index 33f07921a..d6a2629f1 100644 --- a/src/components/clinician/activity-effect-sections.tsx +++ b/src/components/clinician/activity-effect-sections.tsx @@ -163,6 +163,14 @@ export function MedicationEffectSection({ unit, })}

+ {e.window ? ( +

+ {t("doctorReport.medicationEffect.windowLine", { + from: fmtDay(e.window.from), + to: fmtDay(e.window.to), + })} +

+ ) : null}

{t("doctorReport.medicationEffect.days", { before: e.days.before, diff --git a/src/lib/doctor-report-pdf/__tests__/activity-effect-sections.test.ts b/src/lib/doctor-report-pdf/__tests__/activity-effect-sections.test.ts index 94daa7421..46aa08183 100644 --- a/src/lib/doctor-report-pdf/__tests__/activity-effect-sections.test.ts +++ b/src/lib/doctor-report-pdf/__tests__/activity-effect-sections.test.ts @@ -217,6 +217,11 @@ describe("doctor report v1.44 sections", () => { expect(text).toContain("-0.3 mmHg/week"); expect(text).toContain("84 / 61"); expect(text).toContain("5 days after the start left out"); + // The fitted window (Dec to Apr) reaches outside the Feb to May report + // period; the report says which days the figures rest on. + expect(text).toMatch( + /analysed \S+ to \S+, which can reach beyond the report period/, + ); expect(text).toContain("Other drug started on"); expect(text).toContain("not a proven effect"); expect(text).not.toContain("carry-over"); diff --git a/src/lib/doctor-report-pdf/activity-effect-sections.ts b/src/lib/doctor-report-pdf/activity-effect-sections.ts index 819918bbc..e122c7e8f 100644 --- a/src/lib/doctor-report-pdf/activity-effect-sections.ts +++ b/src/lib/doctor-report-pdf/activity-effect-sections.ts @@ -213,7 +213,15 @@ export function buildMedicationEffectSection( `${slope.value} ${unit}/${t("doctorReport.medicationEffect.week")}\n(${slope.low} ${t("doctorReport.medicationEffect.to")} ${slope.high})`, `${e.days.before} / ${e.days.after}`, ]); - const extras: string[] = []; + // The fitted window reaches up to 90 days before the start and 180 + // after it, so it can lie partly outside the report period: always + // say which days the figures rest on. + const extras: string[] = [ + t("doctorReport.medicationEffect.window", { + from: dayLabel(fmtDate, e.window.from), + to: dayLabel(fmtDate, e.window.to), + }), + ]; if (e.days.excludedLowAdherence > 0) { extras.push( t("doctorReport.medicationEffect.excludedAdherence", { @@ -250,9 +258,7 @@ export function buildMedicationEffectSection( }), ); } - if (extras.length > 0) { - notes.push(`${med.medicationName}, ${label}: ${extras.join("; ")}.`); - } + notes.push(`${med.medicationName}, ${label}: ${extras.join("; ")}.`); } } if (rows.length === 0) return state;