mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 04:50:59 +00:00
feat(report): name the analysed window of each medication effect
The effect is fitted on up to 90 days before a start and 180 after it, which can lie outside the report period. The PDF notes and the clinician view now state the fitted window for every effect shown.
This commit is contained in:
1 parent
cfe5e2d3c6
commit
bb6982aea2
12 files changed
+84
-12
No files matched your search
+3
-1
@@ -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": {
|
||||
|
||||
+3
-1
@@ -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": {
|
||||
|
||||
+3
-1
@@ -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": {
|
||||
|
||||
+3
-1
@@ -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": {
|
||||
|
||||
+3
-1
@@ -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": {
|
||||
|
||||
+3
-1
@@ -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": {
|
||||
|
||||
+3
-1
@@ -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": {
|
||||
|
||||
+3
-1
@@ -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": {
|
||||
|
||||
@@ -200,6 +200,43 @@ describe("<ClinicianView>", () => {
|
||||
],
|
||||
});
|
||||
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"]),
|
||||
|
||||
@@ -163,6 +163,14 @@ export function MedicationEffectSection({
|
||||
unit,
|
||||
})}
|
||||
</p>
|
||||
{e.window ? (
|
||||
<p className="text-muted-foreground text-xs">
|
||||
{t("doctorReport.medicationEffect.windowLine", {
|
||||
from: fmtDay(e.window.from),
|
||||
to: fmtDay(e.window.to),
|
||||
})}
|
||||
</p>
|
||||
) : null}
|
||||
<p className="text-muted-foreground text-xs">
|
||||
{t("doctorReport.medicationEffect.days", {
|
||||
before: e.days.before,
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user