chore(core): stage 1 contracts — dialog, API schemas + fixtures, integrations, monitoring, modules
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:
2026-10-03 15:22:25 +03:00
co-authored by Claude Opus 5.5
parent a86008f248
commit b4731fb1d6
30 changed files with 1126 additions and 89 deletions
+42
View File
@@ -0,0 +1,42 @@
# Clinical modules (ADR-001, docs/info/CLINICAL_MODULES.md). Starting values; final ones are approved by the
# team psychiatrist (#8). Read by the dialog engine (start screening, daily question) and the scheduler (#13).
#
# schedule: a scale is due when `every_days` have passed since it was last completed; `from_day`/`until_day`
# bound the therapy-day window (day 0 = visit where therapy was prescribed).
core:
daily: [mood, med_taken] # every module: mood 0–10 + dose confirmation
silence_alert_days: 3 # no answer for N days → reach out (silence is a risk signal)
item9_followup: cssrs_screen # PHQ-9 item 9 >= 1 → C-SSRS → escalation
modules:
veteran:
title: "Ветераны боевых действий"
start_scales: [pcptsd5, pcl5, phq9, auditc]
start_questions: [trauma_exposure, weapon_access]
daily_question: sleep_nightmares
schedule:
- {scale: pcl5, every_days: 14}
- {scale: phq9, every_days: 14}
- {scale: dar5, every_days: 14}
- {scale: auditc, every_days: 30}
enables_depression_if: {scale: phq9, op: ">=", value: 10}
depression:
title: "Депрессия и суицидальный риск"
start_scales: [phq9, gad7, cssrs_screen]
start_questions: []
daily_question: null
schedule:
- {scale: phq9, every_days: 7, until_day: 42} # weekly during the first 4–6 weeks
- {scale: phq9, every_days: 14, from_day: 43}
- {scale: cssrs_screen, every_days: 7}
enhanced_monitoring_under_age: 25 # FDA warning: young adults early in antidepressant therapy
family: # optional future direction (epic #40)
title: "Близкие ветеранов"
start_scales: [phq4]
start_questions: [hits]
daily_question: null
schedule:
- {scale: phq4, every_days: 30}
+26
View File
@@ -0,0 +1,26 @@
# Стартовые пороги из литературы, финальные утверждает психиатр (issue #8).
# DAR-5 (Dimensions of Anger Reactions, Forbes et al., 2014): 5 пунктов × 1–5, сумма 5–25; ≥ 12 — клинически значимый гнев.
id: dar5
title: "Шкала реакций гнева (DAR-5)"
recall_period: "последние 4 недели"
instruction: "Насколько следующие утверждения описывают Вас за последние 4 недели?"
license_note: "DAR-5 — лицензия на проверке (CLINICAL_MODULES.md), в прототипе демо-текст."
translation_note: "Рабочий перевод; финальную русскую версию выбирает психиатр (#8)."
options:
- {value: 1, label: "Ни разу"}
- {value: 2, label: "Немного времени"}
- {value: 3, label: "Часть времени"}
- {value: 4, label: "Большую часть времени"}
- {value: 5, label: "Всё время"}
items:
- {id: dar5_1, text: "Я злился(лась) на людей или ситуации"}
- {id: dar5_2, text: "Когда я злился(лась), я по-настоящему выходил(а) из себя"}
- {id: dar5_3, text: "Когда я злился(лась), злость не проходила долго"}
- {id: dar5_4, text: "Когда я злился(лась), это мешало мне в повседневной жизни"}
- {id: dar5_5, text: "Мой гнев мешал отношениям с близкими"}
range: {min: 5, max: 25}
severity:
- {min: 5, max: 11, code: below_threshold, label: "Ниже порога"}
- {min: 12, max: 25, code: significant, label: "Клинически значимый гнев"}
flags:
- {code: dar5_significant, when: {total: true, op: ">=", value: 12}}