DocUA Claude Opus 5.5 (1M context) commited on
Commit
474586e
·
1 Parent(s): 948058d

fix: only explicit refusals decline the Spiritual Health referral

Browse files

Any consent answer that was not a clear yes or a question used to count as
a refusal, so a patient answering with more distress ("praying doesn't help
anymore") got "I understand and respect your decision" and lost the referral.
Keyword matching was also substring-based ("I know" hit "no", "мене" hit "не").

- Classify consent answers as accept / decline / unclear with word-boundary
patterns; negated accept words ("not ok") are not consent
- Short explicit refusals (<= 3 words) decline without an LLM call; longer
answers with refusal words are checked for distress first
- Unclear answer with new distress keeps the consent request open; otherwise
re-ask once, then close softly without a referral

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

2 files changed +189 -57
Files changed (2)
src/core/simplified_medical_app.py+107-57
tests/unit/test_or7_feedback.py+82