mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-14 22:50:51 +00:00
Anchor the physiological-return search after the first notable deviation so an early in-band run-up can no longer be reported as a return before the vital ever deviated (the spurious-negative-gap bug). Decouple the red-flag escalation from the baseline-band loop: it now scans the raw episode days for SpO2 and temperature against absolute clinical floors, so a rock-steady (MAD=0) vital still escalates a low SpO2 or sustained fever. Union the day-log feverC series into the fever flag and prefer per-day max so an evening spike is not masked by the daily mean. Key every per-day series in the user's timezone (rollup buckets and the raw fallback) so the vital series lines up with the tz-keyed onset and felt-better markers instead of an off-by-one for non-UTC accounts.