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>
20 lines
884 B
Python
20 lines
884 B
Python
"""Schema bootstrap: `create_all` on both databases at startup (ADR-003: no Alembic in the MVP).
|
|
|
|
The only module (besides registration code) that touches both schemas — and only their metadata.
|
|
"""
|
|
|
|
from app.db import audit as _audit # noqa: F401 (registers audit_log in clinical metadata)
|
|
from app.db import intake as _intake # noqa: F401
|
|
from app.db import scheduler as _scheduler # noqa: F401
|
|
from app.db.clinical import ClinicalBase
|
|
from app.db.identity import IdentityBase
|
|
from app.db.session import clinical_engine, identity_engine
|
|
|
|
|
|
async def init_db() -> None:
|
|
"""Create missing tables in the identity and clinical databases. Idempotent."""
|
|
async with identity_engine().begin() as conn:
|
|
await conn.run_sync(IdentityBase.metadata.create_all)
|
|
async with clinical_engine().begin() as conn:
|
|
await conn.run_sync(ClinicalBase.metadata.create_all)
|