chore(core): stage 1 contracts — dialog, API schemas + fixtures, integrations, monitoring, modules
CI / ruff · pytest (pull_request) Successful in 22s
CI / ruff · pytest (pull_request) Successful in 22s
Freeze interfaces between lanes A (bot), B (backend), C (dashboard) so three developers work in parallel without touching each other's files: dialog Event/Reply + engine registry with echo stub, integration protocols with in-memory defaults, MonitoringService with noop stub, /api/v1 schemas with fixture-backed routes, frozen main.py wiring, config/modules.yaml + due_scales(), DAR-5, tzdata, Andrey trajectory, lanes in WORKFLOW, ADR-010. Refs #34 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
from datetime import date, timedelta
|
||||
|
||||
from app.core.modules import due_scales, load_modules
|
||||
from app.core.scales import load_all
|
||||
|
||||
TODAY = date(2026, 10, 3)
|
||||
|
||||
|
||||
def test_modules_reference_existing_scales() -> None:
|
||||
cfg, scales = load_modules(), load_all()
|
||||
for mod in cfg.modules.values():
|
||||
for s in mod.start_scales + [e.scale for e in mod.schedule]:
|
||||
assert s in scales, s
|
||||
|
||||
|
||||
def test_veteran_schedule() -> None:
|
||||
last = {s: TODAY - timedelta(days=1) for s in ["pcl5", "phq9", "dar5", "auditc"]}
|
||||
assert due_scales({"veteran"}, 10, last, TODAY) == []
|
||||
last["pcl5"] = TODAY - timedelta(days=14)
|
||||
assert due_scales({"veteran"}, 20, last, TODAY) == ["pcl5"]
|
||||
|
||||
|
||||
def test_depression_weekly_then_biweekly() -> None:
|
||||
last = {"phq9": TODAY - timedelta(days=7), "cssrs_screen": TODAY}
|
||||
assert due_scales({"depression"}, 20, last, TODAY) == ["phq9"]
|
||||
assert due_scales({"depression"}, 50, last, TODAY) == []
|
||||
|
||||
|
||||
def test_dar5_scoring() -> None:
|
||||
from app.core.scales import score
|
||||
|
||||
r = score("dar5", {f"dar5_{i}": 3 for i in range(1, 6)})
|
||||
assert r.total == 15 and "dar5_significant" in r.flags
|
||||
Reference in New Issue
Block a user