feat(backend): demo scheduler on the virtual clock — doses, missed, check-ins, scales, silence
CI / ruff · pytest (pull_request) Successful in 1m3s
CI / ruff · pytest (pull_request) Successful in 1m3s
- app/scheduler/demo.py: run_until(now) replays due and fresh events in time order: dose rows + med_reminder, missed after 2 h without an answer → monitoring, daily_checkin, scale_due by the config/modules.yaml schedules, daily monitoring pass (silence, missed doses) → reach_out/scale_due - idempotent via scheduler_events (unique token+key); stale events are not sent; no contact without consent or during an open crisis - config/scheduler.yaml: times and windows; runs while the questionnaire release is off - POST /demo/clock/advance replays the scheduler up to the new time Refs #13 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
# Demo scheduler on the virtual clock (#13, SPEC §8, ADR-005). Local times are in settings.tz.
|
||||
# Read by app/scheduler/demo.py; used only while the questionnaire release (intake_runtime.yaml) is off.
|
||||
#
|
||||
# Every event is delivered once (idempotency key in `scheduler_events`) and only while it is fresh: an event
|
||||
# older than its late window is not sent at all — after a long jump of the demo clock the patient does not
|
||||
# receive a pile of yesterday's reminders, and an undelivered reminder never turns into a "missed" dose.
|
||||
|
||||
enabled: true
|
||||
tick_seconds: 30
|
||||
|
||||
doses:
|
||||
late_hours: 2 # reminder not delivered if the dose time is older than this
|
||||
missed_after_hours: 2 # reminded dose without an answer → status "missed" (SPEC §8)
|
||||
|
||||
daily_checkin:
|
||||
time: "20:00"
|
||||
late_hours: 4
|
||||
|
||||
scales:
|
||||
time: "10:00" # scales due today (config/modules.yaml schedules) are offered from this hour
|
||||
late_hours: 10
|
||||
|
||||
evaluation:
|
||||
time: "09:00" # daily monitoring pass: silence > N days, missed doses → caring contact
|
||||
late_hours: 15
|
||||
Reference in New Issue
Block a user