mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-11 22:02:16 +00:00
fix(medications): the schedule flip cannot rewrite history and the doctor report stops inventing a rate
Switching an as-needed medication onto a fixed schedule archived no revision (there were no prior rows), so the era segmentation attributed the entire schedule-less stretch to the new schedules — every as-needed day would have read as missed across the era-aware consumers. The flip now archives an empty-payload era covering the stretch, which expects nothing. The doctor report's compliance table excludes as-needed medications: with no schedule every logged intake is taken by definition, and a fabricated 100% has no place on a clinical document; the medication list itself still carries them.
This commit is contained in:
1 parent
6fef2081d0
commit
4ced89553d
3 files changed
+97
-1
No files matched your search
@@ -441,6 +441,7 @@ export async function collectDoctorReportData(
|
||||
atcCode: true,
|
||||
rxNormCode: true,
|
||||
deliveryForm: true,
|
||||
asNeeded: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -502,9 +503,13 @@ export async function collectDoctorReportData(
|
||||
};
|
||||
}
|
||||
|
||||
// Medication compliance.
|
||||
// Medication compliance. As-needed medications are excluded: they
|
||||
// carry no schedule, so every logged intake is "taken" by definition
|
||||
// and a 100% rate would be a fabricated number on a clinical report.
|
||||
// The medication itself stays on the report's medication list.
|
||||
const compliance: Record<string, DoctorReportCompliance> = {};
|
||||
for (const event of intakeEvents) {
|
||||
if (event.medication.asNeeded) continue;
|
||||
const name = event.medication.name;
|
||||
if (!compliance[name]) {
|
||||
compliance[name] = { total: 0, taken: 0, skipped: 0, missed: 0 };
|
||||
|
||||
Reference in new issue
Block a user