fix(clinical): red flags, one crisis rule, callback after a crisis, one table of numbers
Clinical review of the questionnaires (ADR-013):
- Red-flag block first in stage 1 (config/instruments/red_flags.yaml); any «Да» stops the
questionnaire with an acute alert and the help screen of its category.
- One crisis rule: the crisis screen opens at a HIGH C-SSRS risk only; moderate stops and goes
to a psychiatrist (24 h as a guide), low is a flag with the safety plan. PHQ-9 item 9 with a
negative screener is a discrepancy flag; without a completed screener it asks the C-SSRS at once.
config/questionnaire.yaml: cssrs_positive_policy graded (C01).
- Every crisis leaves a callback task for the doctor on duty (post_crisis_call, one per patient)
and the app asks how the person is the next day, the safety plan one tap away.
- Routing: risk and flags first, scales second; PCL-5 >= 50 no longer means a priority
appointment (pcl5_severe is moderate on the dashboard too).
- Crisis numbers live only in config/texts/crisis.yaml; texts and the agent prompt refer to them
via {phone:<key>}. Fixes the children's helpline offered to adults by the chat agent.
Refs #92
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -172,12 +172,16 @@ def test_unapproved_policy_never_continues_even_a_negative_screen():
|
||||
def test_immediate_safety_preempts_unfinished_or_invalid_unrelated_scales():
|
||||
for overrides in [
|
||||
dict(help_now=True, cssrs={"broken": "data"}),
|
||||
dict(phq9={"phq9_9": 1}),
|
||||
dict(phq9={"phq9_9": 1}, cssrs={}), # item 9 before the screener is complete
|
||||
dict(cssrs={"q4": 1}, alcohol={"bad": 50}),
|
||||
]:
|
||||
assert intake(policy=load_policy(), **overrides).status == "crisis"
|
||||
|
||||
|
||||
def test_item9_with_a_negative_screener_is_a_discrepancy_flag_not_a_crisis():
|
||||
# One crisis rule (ADR-013): the crisis screen opens at a high C-SSRS risk only.
|
||||
r = intake(phq9={"phq9_9": 1})
|
||||
assert "phq9_cssrs_discrepancy" in r.flags
|
||||
assert r.status != "crisis" and {"phq9_item9_positive", "phq9_cssrs_discrepancy"} <= set(r.flags)
|
||||
|
||||
|
||||
def test_physician_must_choose_between_stop_and_graded():
|
||||
@@ -208,7 +212,8 @@ def test_phq2_and_trauma_expansion_do_not_turn_missing_into_negative():
|
||||
(30, "self_help"),
|
||||
(31, "psychiatrist_or_psychotherapist"),
|
||||
(49, "psychiatrist_or_psychotherapist"),
|
||||
(50, "priority_psychiatrist"),
|
||||
(50, "psychiatrist_or_psychotherapist"),
|
||||
(80, "psychiatrist_or_psychotherapist"),
|
||||
],
|
||||
)
|
||||
def test_pdf_pcl_boundaries_are_distinct_from_legacy_33(total, route):
|
||||
|
||||
Reference in New Issue
Block a user