mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-12 22:26:13 +00:00
fix(medications): count forgotten doses as missed, not skipped
A never-acted dose past its 24h cutoff was flipped to skipped=true by the hourly cron. The compliance engine excludes skipped doses from the denominator (a deliberate user pause), so a forgotten dose then counted neither as taken nor missed — silently inflating adherence. Add a dedicated auto_missed terminal state. The cron now sets auto_missed (not skipped) on a never-acted pending row, so the engine counts it as a real miss against the rate, while a user-initiated skip stays excluded. The two are mutually exclusive on a live row by construction.
This commit is contained in:
1 parent
384fc9caa1
commit
29fa982e11
4 files changed
+97
-42
No files matched your search
@@ -1443,6 +1443,14 @@ model MedicationIntakeEvent {
|
||||
scheduledFor DateTime @map("scheduled_for")
|
||||
takenAt DateTime? @map("taken_at")
|
||||
skipped Boolean @default(false)
|
||||
/// v1.15.9 — distinguishes a never-acted forgotten dose from a
|
||||
/// deliberate user skip. The hourly auto-miss cron sets this (NOT
|
||||
/// `skipped`) on a pending row past its miss cutoff so the compliance
|
||||
/// engine counts it as a MISS in the denominator, while a user-initiated
|
||||
/// `skipped = true` stays excluded (a deliberate drug holiday). Every
|
||||
/// legacy row defaults to false (a user skip or a live pending row,
|
||||
/// neither of which is an auto-miss).
|
||||
autoMissed Boolean @default(false) @map("auto_missed")
|
||||
source IntakeSource @default(WEB)
|
||||
idempotencyKey String? @unique @map("idempotency_key")
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
|
||||
Reference in new issue
Block a user