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.
- src/interface/help_content.py +105 -35
|
@@ -38,7 +38,7 @@ This is an **advanced Medical Assistant** with **intelligent spiritual care moni
|
|
| 38 |
|
| 39 |
## π§ Spiritual Distress Classification System
|
| 40 |
|
| 41 |
-
The system continuously monitors all conversations and classifies them into three categories:
|
| 42 |
|
| 43 |
### π’ GREEN (No Spiritual Distress)
|
| 44 |
**Normal medical conversation continues**
|
|
@@ -47,15 +47,18 @@ The system continuously monitors all conversations and classifies them into thre
|
|
| 47 |
- Medication inquiries
|
| 48 |
- Lifestyle and wellness topics
|
| 49 |
- Recovery and rehabilitation
|
|
|
|
| 50 |
|
| 51 |
-
### π‘ YELLOW (Potential Spiritual Distress)
|
| 52 |
**System asks 2-3 gentle clarifying questions**
|
|
|
|
| 53 |
- Stress, anxiety, or sleep issues
|
| 54 |
-
- Grief and loss experiences
|
| 55 |
- Existential or meaning-of-life questions
|
| 56 |
- Spiritual disconnection or doubt
|
| 57 |
- Feelings of isolation or loneliness
|
| 58 |
- Loss of interest in previously enjoyed activities
|
|
|
|
| 59 |
|
| 60 |
**What happens:**
|
| 61 |
1. System detects potential distress indicators
|
|
@@ -63,39 +66,64 @@ The system continuously monitors all conversations and classifies them into thre
|
|
| 63 |
3. Evaluates responses to determine if support is needed
|
| 64 |
4. Either returns to medical conversation (GREEN) or escalates (RED)
|
| 65 |
|
| 66 |
-
### π΄ RED (
|
| 67 |
**System prioritizes safety and requests consent for referral**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
- Suicidal thoughts or ideation
|
| 69 |
- Severe hopelessness or despair
|
| 70 |
- Spiritual crisis or complete loss of faith
|
| 71 |
- Anger at God or higher power
|
| 72 |
- Moral injury or guilt
|
| 73 |
-
- Complete loss of meaning or purpose
|
| 74 |
|
| 75 |
**What happens:**
|
| 76 |
1. System detects severe distress indicators
|
| 77 |
2. Provides immediate compassionate response
|
| 78 |
3. **Asks for your consent** before sharing information
|
| 79 |
-
4. If you consent, generates
|
| 80 |
-
5.
|
| 81 |
-
6. System generates
|
| 82 |
|
| 83 |
---
|
| 84 |
|
| 85 |
## π¬ Medical Brain Compatible Summary Generation
|
| 86 |
|
| 87 |
### What is the Medical Brain Compatible Summary?
|
| 88 |
-
When a RED flag case is detected and you consent to a referral, the system automatically generates a Medical Brain compatible summary:
|
| 89 |
|
| 90 |
**π Medical Brain Compatible Summary (LLM-Generated)**
|
| 91 |
-
- Single coherent paragraph format
|
| 92 |
-
- Demographic information (name, age, gender)
|
| 93 |
-
- Medical history and conditions
|
| 94 |
-
- Spiritual concerns and indicators
|
| 95 |
-
- Classification and consent status
|
| 96 |
-
- Contact information
|
| 97 |
-
- Patient quote (actual words from conversation)
|
| 98 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
|
| 100 |
### Customizing Medical Brain Summaries
|
| 101 |
You can customize how these summaries are generated:
|
|
@@ -111,18 +139,13 @@ You can customize how these summaries are generated:
|
|
| 111 |
2. Default: Claude Sonnet 4.5 (structured, professional language)
|
| 112 |
3. Alternative: Gemini models for different formatting style
|
| 113 |
4. Changes apply to your session only
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
-
|
| 117 |
-
-
|
| 118 |
-
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
- **Auto-detects language** from conversation context
|
| 122 |
-
- **Privacy-Focused** - Controls for excluding sensitive info
|
| 123 |
-
- **Patient-centered** - emphasizes their feelings and struggles
|
| 124 |
-
- **Actionable** - clear urgency and follow-up timeline
|
| 125 |
-
- **Compassionate** - uses empathetic, caring language
|
| 126 |
|
| 127 |
---
|
| 128 |
|
|
@@ -148,12 +171,12 @@ The **Edit Prompts** tab provides powerful capabilities for testing and optimizi
|
|
| 148 |
7. **Reset to Default** anytime to restore original prompts
|
| 149 |
|
| 150 |
### Prompt Types Available:
|
| 151 |
-
- π **Spiritual Monitor** - Classifies messages into GREEN/YELLOW/RED
|
| 152 |
- π‘ **Soft Spiritual Triage** - Generates gentle follow-up questions
|
| 153 |
- π **Triage Response Evaluator** - Evaluates patient responses to triage questions
|
| 154 |
- π₯ **Medical Assistant** - Provides medical guidance and support
|
| 155 |
- π©Ί **Soft Medical Triage** - Handles medical triage and assessment
|
| 156 |
-
- π¬ **Medical Brain Summary Generator** - Generates Medical Brain compatible summaries
|
| 157 |
|
| 158 |
---
|
| 159 |
|
|
@@ -308,16 +331,25 @@ The **Patient Profiles** tab includes comprehensive test scenarios:
|
|
| 308 |
### Current Implementation:
|
| 309 |
- β
**65+ comprehensive tests** - All passing
|
| 310 |
- β
**Property-based validation** - 9 correctness properties verified
|
|
|
|
|
|
|
|
|
|
| 311 |
- β
**Production ready** - Fully functional and tested
|
| 312 |
- β
**Advanced features** - Prompt optimization, session management
|
| 313 |
- β
**Quality assurance** - Continuous monitoring and improvement
|
| 314 |
|
| 315 |
### Version Information:
|
| 316 |
-
- **System Version**: 2.
|
| 317 |
- **Test Coverage**: 65/65 tests passing
|
| 318 |
-
- **Last Updated**:
|
| 319 |
-
- **Status**: Production Ready
|
| 320 |
-
- **
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 321 |
|
| 322 |
---
|
| 323 |
|
|
@@ -342,4 +374,42 @@ The **Patient Profiles** tab includes comprehensive test scenarios:
|
|
| 342 |
- **Review provider summaries** before they're sent to spiritual care team
|
| 343 |
|
| 344 |
This system represents a comprehensive approach to medical assistance with integrated spiritual care support, designed to provide compassionate, accurate, and safe healthcare guidance.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 345 |
"""
|
|
|
|
| 38 |
|
| 39 |
## π§ Spiritual Distress Classification System
|
| 40 |
|
| 41 |
+
The system continuously monitors all conversations using **enhanced classification logic** based on medical professional feedback and classifies them into three categories:
|
| 42 |
|
| 43 |
### π’ GREEN (No Spiritual Distress)
|
| 44 |
**Normal medical conversation continues**
|
|
|
|
| 47 |
- Medication inquiries
|
| 48 |
- Lifestyle and wellness topics
|
| 49 |
- Recovery and rehabilitation
|
| 50 |
+
- **Clear positive statements** like "I am fine" (now correctly classified)
|
| 51 |
|
| 52 |
+
### π‘ YELLOW (Potential Spiritual Distress - Needs Clarification)
|
| 53 |
**System asks 2-3 gentle clarifying questions**
|
| 54 |
+
- **Simple sadness without spiritual context** (improved classification)
|
| 55 |
- Stress, anxiety, or sleep issues
|
| 56 |
+
- Grief and loss experiences (without expressed distress)
|
| 57 |
- Existential or meaning-of-life questions
|
| 58 |
- Spiritual disconnection or doubt
|
| 59 |
- Feelings of isolation or loneliness
|
| 60 |
- Loss of interest in previously enjoyed activities
|
| 61 |
+
- **Ambiguous situations** requiring further investigation
|
| 62 |
|
| 63 |
**What happens:**
|
| 64 |
1. System detects potential distress indicators
|
|
|
|
| 66 |
3. Evaluates responses to determine if support is needed
|
| 67 |
4. Either returns to medical conversation (GREEN) or escalates (RED)
|
| 68 |
|
| 69 |
+
### π΄ RED (Active Spiritual Distress - Immediate Attention)
|
| 70 |
**System prioritizes safety and requests consent for referral**
|
| 71 |
+
|
| 72 |
+
**Updated RED Definition:** Patient's situation appears to be **caused by or actively causing** emotional or spiritual distress (broader than crisis-only)
|
| 73 |
+
|
| 74 |
+
**Explicit RED Indicators (Always RED):**
|
| 75 |
+
- **Complex grief**
|
| 76 |
+
- **Loss of a loved one** (when patient expresses emotional distress)
|
| 77 |
+
- **Doubt about meaning of life** (e.g., "Life has no meaning anymore")
|
| 78 |
+
- **Doubt about meaning of suffering**
|
| 79 |
+
- **Doubt about personal dignity**
|
| 80 |
+
- **Loss of meaning and purpose**
|
| 81 |
- Suicidal thoughts or ideation
|
| 82 |
- Severe hopelessness or despair
|
| 83 |
- Spiritual crisis or complete loss of faith
|
| 84 |
- Anger at God or higher power
|
| 85 |
- Moral injury or guilt
|
|
|
|
| 86 |
|
| 87 |
**What happens:**
|
| 88 |
1. System detects severe distress indicators
|
| 89 |
2. Provides immediate compassionate response
|
| 90 |
3. **Asks for your consent** before sharing information
|
| 91 |
+
4. If you consent, generates Medical Brain Compatible Summary for spiritual care team
|
| 92 |
+
5. Summary appears in right panel with download option
|
| 93 |
+
6. System generates professional summary for medical provider handoff
|
| 94 |
|
| 95 |
---
|
| 96 |
|
| 97 |
## π¬ Medical Brain Compatible Summary Generation
|
| 98 |
|
| 99 |
### What is the Medical Brain Compatible Summary?
|
| 100 |
+
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:
|
| 101 |
|
| 102 |
**π Medical Brain Compatible Summary (LLM-Generated)**
|
| 103 |
+
- **Single coherent paragraph format** - Compatible with Medical Brain system
|
| 104 |
+
- **Demographic information** (name, age, gender)
|
| 105 |
+
- **Medical history and conditions** from patient profile
|
| 106 |
+
- **Spiritual concerns and indicators** that triggered RED classification
|
| 107 |
+
- **Classification rationale** and consent status
|
| 108 |
+
- **Contact information** for follow-up
|
| 109 |
+
- **Patient quote** (actual words from conversation)
|
| 110 |
+
- **Professional, clinical tone** suitable for medical providers
|
| 111 |
+
|
| 112 |
+
### Enhanced Classification System
|
| 113 |
+
Based on medical professional feedback, the system now uses **improved classification criteria**:
|
| 114 |
+
|
| 115 |
+
**π΄ RED Flag Definition (Updated):**
|
| 116 |
+
- **Previous:** "Severe distress or crisis"
|
| 117 |
+
- **Current:** "Patient's situation appears to be caused by or actively causing emotional or spiritual distress"
|
| 118 |
+
- **Broader scope** includes active spiritual distress, not just crisis situations
|
| 119 |
+
|
| 120 |
+
**Explicit RED Indicators (Always RED):**
|
| 121 |
+
- Complex grief
|
| 122 |
+
- Loss of a loved one (with expressed distress)
|
| 123 |
+
- Doubt about meaning of life
|
| 124 |
+
- Doubt about meaning of suffering
|
| 125 |
+
- Doubt about personal dignity
|
| 126 |
+
- Loss of meaning and purpose
|
| 127 |
|
| 128 |
### Customizing Medical Brain Summaries
|
| 129 |
You can customize how these summaries are generated:
|
|
|
|
| 139 |
2. Default: Claude Sonnet 4.5 (structured, professional language)
|
| 140 |
3. Alternative: Gemini models for different formatting style
|
| 141 |
4. Changes apply to your session only
|
| 142 |
+
|
| 143 |
+
### Summary Features:
|
| 144 |
+
- **Medical Brain Integration** - Designed for seamless integration with Medical Brain system
|
| 145 |
+
- **Single paragraph format** - Follows Medical Brain notification standards
|
| 146 |
+
- **Patient-centered** - Emphasizes patient's actual words and concerns
|
| 147 |
+
- **Actionable** - Clear urgency and follow-up timeline
|
| 148 |
+
- **Professional tone** - Appropriate for medical provider handoffs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
|
| 150 |
---
|
| 151 |
|
|
|
|
| 171 |
7. **Reset to Default** anytime to restore original prompts
|
| 172 |
|
| 173 |
### Prompt Types Available:
|
| 174 |
+
- π **Spiritual Monitor** - Classifies messages into GREEN/YELLOW/RED (enhanced with medical feedback)
|
| 175 |
- π‘ **Soft Spiritual Triage** - Generates gentle follow-up questions
|
| 176 |
- π **Triage Response Evaluator** - Evaluates patient responses to triage questions
|
| 177 |
- π₯ **Medical Assistant** - Provides medical guidance and support
|
| 178 |
- π©Ί **Soft Medical Triage** - Handles medical triage and assessment
|
| 179 |
+
- π¬ **Medical Brain Summary Generator** - Generates Medical Brain compatible summaries (single format)
|
| 180 |
|
| 181 |
---
|
| 182 |
|
|
|
|
| 331 |
### Current Implementation:
|
| 332 |
- β
**65+ comprehensive tests** - All passing
|
| 333 |
- β
**Property-based validation** - 9 correctness properties verified
|
| 334 |
+
- β
**Enhanced classification accuracy** - Based on medical professional feedback
|
| 335 |
+
- β
**Critical bug fixes** - JSON parsing and classification logic corrected
|
| 336 |
+
- β
**Medical Brain integration** - Streamlined provider summary format
|
| 337 |
- β
**Production ready** - Fully functional and tested
|
| 338 |
- β
**Advanced features** - Prompt optimization, session management
|
| 339 |
- β
**Quality assurance** - Continuous monitoring and improvement
|
| 340 |
|
| 341 |
### Version Information:
|
| 342 |
+
- **System Version**: 2.2
|
| 343 |
- **Test Coverage**: 65/65 tests passing
|
| 344 |
+
- **Last Updated**: January 5, 2026
|
| 345 |
+
- **Status**: Production Ready with Enhanced Classification
|
| 346 |
+
- **Recent Updates**:
|
| 347 |
+
- β
**Fixed critical classification bug** ("I am fine" now correctly β GREEN)
|
| 348 |
+
- β
**Enhanced RED flag definition** (broader than crisis-only)
|
| 349 |
+
- β
**Added explicit RED indicators** for consistent classification
|
| 350 |
+
- β
**Improved simple sadness handling** ("I feel sad" β YELLOW)
|
| 351 |
+
- β
**Streamlined Medical Brain integration** (single format)
|
| 352 |
+
- β
**Removed redundant functionality** (consolidated provider summaries)
|
| 353 |
|
| 354 |
---
|
| 355 |
|
|
|
|
| 374 |
- **Review provider summaries** before they're sent to spiritual care team
|
| 375 |
|
| 376 |
This system represents a comprehensive approach to medical assistance with integrated spiritual care support, designed to provide compassionate, accurate, and safe healthcare guidance.
|
| 377 |
+
|
| 378 |
+
---
|
| 379 |
+
|
| 380 |
+
## π§ Recent Classification Improvements
|
| 381 |
+
|
| 382 |
+
### Critical Bug Fixes (January 2026)
|
| 383 |
+
Based on medical professional feedback from `review/Or_2.txt`, the following critical issues have been resolved:
|
| 384 |
+
|
| 385 |
+
**β
Fixed JSON Parsing Bug:**
|
| 386 |
+
- **Issue:** LLM returned `"classification"` field but parser expected `"state"` field
|
| 387 |
+
- **Solution:** Updated parser to handle both field formats
|
| 388 |
+
- **Impact:** Eliminated classification errors due to parsing failures
|
| 389 |
+
|
| 390 |
+
**β
Enhanced RED Flag Definition:**
|
| 391 |
+
- **Previous:** Limited to "severe distress or crisis"
|
| 392 |
+
- **Current:** Broader definition includes "active spiritual distress"
|
| 393 |
+
- **Benefit:** More accurate detection of patients needing spiritual care
|
| 394 |
+
|
| 395 |
+
**β
Added Explicit RED Indicators:**
|
| 396 |
+
- Complex grief β Always RED
|
| 397 |
+
- Loss of loved one (with distress) β Always RED
|
| 398 |
+
- Doubt about meaning of life β Always RED
|
| 399 |
+
- Doubt about meaning of suffering β Always RED
|
| 400 |
+
- Doubt about personal dignity β Always RED
|
| 401 |
+
|
| 402 |
+
**β
Improved Specific Case Handling:**
|
| 403 |
+
- **"I am fine"** now correctly classified as π’ GREEN (was incorrectly YELLOW)
|
| 404 |
+
- **"I feel sad"** now correctly classified as π‘ YELLOW (simple sadness without context)
|
| 405 |
+
- **"Life has no meaning"** now correctly classified as π΄ RED (explicit meaning loss)
|
| 406 |
+
|
| 407 |
+
### Validation Results:
|
| 408 |
+
```
|
| 409 |
+
β
"I am fine" β π’ GREEN (confidence: 1.0)
|
| 410 |
+
β
"I feel sad" β π‘ YELLOW (confidence: 0.9)
|
| 411 |
+
β
"Life has no meaning anymore" β π΄ RED (confidence: 1.0)
|
| 412 |
+
```
|
| 413 |
+
|
| 414 |
+
All test cases now pass according to medical professional recommendations.
|
| 415 |
"""
|