Spaces:
Sleeping
docs: Finalize Medical Brain integration and update Help documentation
Browse filesπ§ PROMPT OPTIMIZATION:
- Remove redundant SPIRITUAL_CARE_MESSAGE format from spiritual_care_message.txt
- Streamline to single MEDICAL_BRAIN_COMPATIBLE format only
- Simplify prompt structure for Medical Brain integration
π HELP DOCUMENTATION UPDATE:
- Update classification system description with enhanced logic
- Add explicit RED indicators based on medical professional feedback
- Document critical bug fixes (JSON parsing, classification accuracy)
- Update version to 2.2 with recent improvements timeline
- Add new section on Recent Classification Improvements
- Remove references to deprecated dual-format functionality
- Clarify Medical Brain Compatible Summary as primary format
π REVIEW DOCUMENTATION:
- Add comprehensive README.md in review/ folder (Ukrainian)
- Document medical professional recommendations from Or_2.txt
- Analyze verified conversation examples with outcomes
- Detail implemented improvements and validation results
β
SYSTEM STATUS:
- All classification test cases now pass correctly
- 'I am fine' β GREEN (confidence: 1.0) β
- 'I feel sad' β YELLOW (confidence: 0.9) β
- 'Life has no meaning' β RED (confidence: 1.0) β
- Medical Brain integration streamlined and optimized
- Help documentation fully updated and comprehensive
This completes the Medical Brain integration optimization and ensures all documentation reflects the current enhanced system state.
37 unmodified lines38394041414243442 unmodified lines47484950515152535455545657585960616263641 unmodified line6667686669707172737475767778798081828384857386878889907980819192939495969798998810010110291929394959697981031041051061071081091101111121131141151161171181191201211221231241251261271281299 unmodified lines13914014111411511611711811912012112212312412514214314414514614714814915015119 unmodified lines171172173151174175176177178156179180181182148 unmodified lines33133233333433533633733833934034131634234331831932034434534634734834935035135235335435518 unmodified lines37437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441537 unmodified lines
## π§ Spiritual Distress Classification System
The system continuously monitors all conversations and classifies them into three categories:The system continuously monitors all conversations using **enhanced classification logic** based on medical professional feedback and classifies them into three categories:
### π’ GREEN (No Spiritual Distress)**Normal medical conversation continues**2 unmodified lines- Medication inquiries- Lifestyle and wellness topics- Recovery and rehabilitation- **Clear positive statements** like "I am fine" (now correctly classified)
### π‘ YELLOW (Potential Spiritual Distress)### π‘ YELLOW (Potential Spiritual Distress - Needs Clarification)**System asks 2-3 gentle clarifying questions**- **Simple sadness without spiritual context** (improved classification)- Stress, anxiety, or sleep issues- Grief and loss experiences- Grief and loss experiences (without expressed distress)- Existential or meaning-of-life questions- Spiritual disconnection or doubt- Feelings of isolation or loneliness- Loss of interest in previously enjoyed activities- **Ambiguous situations** requiring further investigation
**What happens:**1. System detects potential distress indicators1 unmodified line3. Evaluates responses to determine if support is needed4. Either returns to medical conversation (GREEN) or escalates (RED)
### π΄ RED (Severe Spiritual Distress - Immediate Attention)### π΄ RED (Active Spiritual Distress - Immediate Attention)**System prioritizes safety and requests consent for referral**
**Updated RED Definition:** Patient's situation appears to be **caused by or actively causing** emotional or spiritual distress (broader than crisis-only)
**Explicit RED Indicators (Always RED):**- **Complex grief**- **Loss of a loved one** (when patient expresses emotional distress)- **Doubt about meaning of life** (e.g., "Life has no meaning anymore")- **Doubt about meaning of suffering**- **Doubt about personal dignity**- **Loss of meaning and purpose**- Suicidal thoughts or ideation- Severe hopelessness or despair- Spiritual crisis or complete loss of faith- Anger at God or higher power- Moral injury or guilt- Complete loss of meaning or purpose
**What happens:**1. System detects severe distress indicators2. Provides immediate compassionate response3. **Asks for your consent** before sharing information4. If you consent, generates Provider Summary for spiritual care team5. Provider Summary appears in right panel with download option6. System generates a compassionate, natural language message for spiritual care team4. If you consent, generates Medical Brain Compatible Summary for spiritual care team5. Summary appears in right panel with download option6. System generates professional summary for medical provider handoff
---
## π¬ Medical Brain Compatible Summary Generation
### What is the Medical Brain Compatible Summary?When a RED flag case is detected and you consent to a referral, the system automatically generates a Medical Brain compatible summary:When a RED flag case is detected and you consent to a referral, the system automatically generates a **Medical Brain compatible summary** - the primary and only format for provider handoffs:
**π Medical Brain Compatible Summary (LLM-Generated)**- Single coherent paragraph format- Demographic information (name, age, gender)- Medical history and conditions- Spiritual concerns and indicators- Classification and consent status- Contact information- Patient quote (actual words from conversation)- Written in professional, clinical tone- **Single coherent paragraph format** - Compatible with Medical Brain system- **Demographic information** (name, age, gender)- **Medical history and conditions** from patient profile- **Spiritual concerns and indicators** that triggered RED classification- **Classification rationale** and consent status- **Contact information** for follow-up- **Patient quote** (actual words from conversation)- **Professional, clinical tone** suitable for medical providers
### Enhanced Classification SystemBased on medical professional feedback, the system now uses **improved classification criteria**:
**π΄ RED Flag Definition (Updated):**- **Previous:** "Severe distress or crisis"- **Current:** "Patient's situation appears to be caused by or actively causing emotional or spiritual distress"- **Broader scope** includes active spiritual distress, not just crisis situations
**Explicit RED Indicators (Always RED):**- Complex grief- Loss of a loved one (with expressed distress)- Doubt about meaning of life- Doubt about meaning of suffering- Doubt about personal dignity- Loss of meaning and purpose
### Customizing Medical Brain SummariesYou can customize how these summaries are generated:9 unmodified lines2. Default: Claude Sonnet 4.5 (structured, professional language)3. Alternative: Gemini models for different formatting style4. Changes apply to your session onlyYou can selectively include or exclude information blocks:- βοΈ **Include Conversation Context (Chat & Triage)** (Default: ON) - Raw chat history and triage exchanges.- βοΈ **Include Distress Indicators** (Default: ON) - Detected signs of spiritual distress.- β¬ **Include Situation Analysis** (Default: OFF) - System-generated summary of the situation (may include medical context).- β¬ **Include Patient Profile** (Default: OFF) - Specific patient identifiers (Name, Phone) and medical history.
### Message Features:- **Auto-detects language** from conversation context- **Privacy-Focused** - Controls for excluding sensitive info- **Patient-centered** - emphasizes their feelings and struggles- **Actionable** - clear urgency and follow-up timeline- **Compassionate** - uses empathetic, caring language
### Summary Features:- **Medical Brain Integration** - Designed for seamless integration with Medical Brain system- **Single paragraph format** - Follows Medical Brain notification standards- **Patient-centered** - Emphasizes patient's actual words and concerns- **Actionable** - Clear urgency and follow-up timeline- **Professional tone** - Appropriate for medical provider handoffs
---
19 unmodified lines7. **Reset to Default** anytime to restore original prompts
### Prompt Types Available:- π **Spiritual Monitor** - Classifies messages into GREEN/YELLOW/RED- π **Spiritual Monitor** - Classifies messages into GREEN/YELLOW/RED (enhanced with medical feedback)- π‘ **Soft Spiritual Triage** - Generates gentle follow-up questions- π **Triage Response Evaluator** - Evaluates patient responses to triage questions- π₯ **Medical Assistant** - Provides medical guidance and support- π©Ί **Soft Medical Triage** - Handles medical triage and assessment- π¬ **Medical Brain Summary Generator** - Generates Medical Brain compatible summaries- π¬ **Medical Brain Summary Generator** - Generates Medical Brain compatible summaries (single format)
---
148 unmodified lines### Current Implementation:- β
**65+ comprehensive tests** - All passing- β
**Property-based validation** - 9 correctness properties verified- β
**Enhanced classification accuracy** - Based on medical professional feedback- β
**Critical bug fixes** - JSON parsing and classification logic corrected- β
**Medical Brain integration** - Streamlined provider summary format- β
**Production ready** - Fully functional and tested- β
**Advanced features** - Prompt optimization, session management- β
**Quality assurance** - Continuous monitoring and improvement
### Version Information:- **System Version**: 2.1- **System Version**: 2.2- **Test Coverage**: 65/65 tests passing- **Last Updated**: December 19, 2025- **Status**: Production Ready- **New Features**: Configurable message content, Prompt editing, Model selection- **Last Updated**: January 5, 2026- **Status**: Production Ready with Enhanced Classification- **Recent Updates**: - β
**Fixed critical classification bug** ("I am fine" now correctly β GREEN) - β
**Enhanced RED flag definition** (broader than crisis-only) - β
**Added explicit RED indicators** for consistent classification - β
**Improved simple sadness handling** ("I feel sad" β YELLOW) - β
**Streamlined Medical Brain integration** (single format) - β
**Removed redundant functionality** (consolidated provider summaries)
---
18 unmodified lines- **Review provider summaries** before they're sent to spiritual care team
This system represents a comprehensive approach to medical assistance with integrated spiritual care support, designed to provide compassionate, accurate, and safe healthcare guidance.
---
## π§ Recent Classification Improvements
### Critical Bug Fixes (January 2026)Based on medical professional feedback from `review/Or_2.txt`, the following critical issues have been resolved:
**β
Fixed JSON Parsing Bug:**- **Issue:** LLM returned `"classification"` field but parser expected `"state"` field- **Solution:** Updated parser to handle both field formats- **Impact:** Eliminated classification errors due to parsing failures
**β
Enhanced RED Flag Definition:**- **Previous:** Limited to "severe distress or crisis"- **Current:** Broader definition includes "active spiritual distress"- **Benefit:** More accurate detection of patients needing spiritual care
**β
Added Explicit RED Indicators:**- Complex grief β Always RED- Loss of loved one (with distress) β Always RED - Doubt about meaning of life β Always RED- Doubt about meaning of suffering β Always RED- Doubt about personal dignity β Always RED
**β
Improved Specific Case Handling:**- **"I am fine"** now correctly classified as π’ GREEN (was incorrectly YELLOW)- **"I feel sad"** now correctly classified as π‘ YELLOW (simple sadness without context)- **"Life has no meaning"** now correctly classified as π΄ RED (explicit meaning loss)
### Validation Results:```β
"I am fine" β π’ GREEN (confidence: 1.0)β
"I feel sad" β π‘ YELLOW (confidence: 0.9) β
"Life has no meaning anymore" β π΄ RED (confidence: 1.0)```
All test cases now pass according to medical professional recommendations."""