""" Help content for the Medical Assistant with Spiritual Support interface. This file contains the comprehensive user guide displayed in the Help tab. """ HELP_CONTENT = """ # ๐Ÿ“– Medical Assistant with Spiritual Support - User Guide ## ๐Ÿฅ What This System Does This is an **advanced Medical Assistant** with **intelligent spiritual care monitoring**. The system provides comprehensive medical support while automatically detecting emotional and spiritual distress in the background. **Key Features:** - ๐Ÿ’ฌ Natural medical conversations - ๐Ÿ” Automatic spiritual distress detection - ๐Ÿšฆ Three-tier classification system (GREEN/YELLOW/RED) - ๐Ÿ”ง Advanced prompt optimization with session-level testing - ๐Ÿ“Š Comprehensive verification and export capabilities --- ## ๐Ÿš€ Quick Start Guide ### For Medical Conversations (Primary Use) 1. **Open the Chat tab** ๐Ÿ’ฌ 2. **Ask your medical question** (symptoms, medications, treatment, lifestyle) 3. **Receive personalized medical guidance** 4. **System automatically monitors** for spiritual distress in the background 5. **If distress detected**, system may ask gentle follow-up questions ### For Testing & Quality Assurance 1. **Enhanced Verification** ๐Ÿ” - Test individual messages or upload CSV files 2. **Conversation Verification** ๐Ÿงพ - Review and export chat-derived sessions 3. **Edit Prompts** ๐Ÿ”ง - Test prompt modifications in real-time 4. **Model Settings** โš™๏ธ - Configure AI models for different tasks --- ## ๐Ÿงญ Spiritual Distress Classification System 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** - Medical symptoms and treatments - Routine health questions - Medication inquiries - Lifestyle and wellness topics - Recovery and rehabilitation - **Clear positive statements** like "I am fine" (now correctly classified) ### ๐ŸŸก 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 (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 indicators 2. Asks gentle, targeted questions to understand better 3. Evaluates responses to determine if support is needed 4. Either returns to medical conversation (GREEN) or escalates (RED) ### ๐Ÿ”ด 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 **What happens:** 1. System detects severe distress indicators 2. Provides immediate compassionate response 3. **Asks for your consent** before sharing information 4. If you consent, generates Medical Brain Compatible Summary for spiritual care team 5. Summary appears in right panel with download option 6. 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** - the primary and only format for provider handoffs: **๐Ÿ“‹ Medical Brain Compatible Summary (LLM-Generated)** - **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 - **All patient inputs** throughout the conversation (not just final message) - **Patient quotes** (actual words from entire conversation) - **Professional, clinical tone** suitable for medical providers - **No phone numbers** (team has direct access in application) ### โœจ Automatic Generation (New in v2.3) **Enhanced Provider Summary Workflow:** 1. **RED flag detected** โ†’ System asks for consent 2. **Patient gives consent** โ†’ Summary **automatically appears** in Provider Summary panel 3. **No manual action required** โ†’ Summary is immediately available for review 4. **Instant access** โ†’ Spiritual care team can review and comment immediately **Key Improvements:** - **Automatic display** - No need to click "๐Ÿ”„ Check Status & Summary" button - **Complete conversation context** - Includes all patient inputs, not just final message - **Streamlined workflow** - Summary appears instantly when consent is given - **Enhanced content** - Comprehensive patient quotes from entire interaction ### Enhanced Classification System Based 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 Summaries You can customize how these summaries are generated: **Edit the Prompt (๐Ÿ”ง Edit Prompts tab):** 1. Select **๐Ÿ’ฌ Spiritual Care Message** from dropdown 2. Modify the system prompt to adjust format, content, or focus 3. Test changes in your current session 4. Promote to file if you want permanent changes **Choose the AI Model (โš™๏ธ Model Settings tab):** 1. Select model for **๐Ÿ’ฌ Medical Brain Summary Generator** 2. Default: Claude Sonnet 4.5 (structured, professional language) 3. Alternative: Gemini models for different formatting style 4. Changes apply to your session only ### 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 --- ## ๐Ÿ”ง Advanced Prompt Optimization System ### Session-Level Prompt Testing The **Edit Prompts** tab provides powerful capabilities for testing and optimizing system behavior: **Key Features:** - **Real-time editing** of 5 system prompts - **Session isolation** - changes apply only to your current session - **Live validation** with immediate feedback on syntax and structure - **Visual indicators** showing prompt sources (session vs default) - **Promote to File** workflow for permanent adoption of tested changes ### How to Use Edit Prompts: 1. **Select a prompt** from the dropdown (Spiritual Monitor, Triage Questions, etc.) 2. **Load the current prompt** using the Load button 3. **Make your modifications** in the code editor 4. **Apply changes** to test in your current session 5. **Validate** your changes for syntax and structure 6. **Promote to File** if you want to make changes permanent (creates automatic backup) 7. **Reset to Default** anytime to restore original prompts ### Prompt Types Available: - ๐Ÿ” **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 (single format) --- ## โš™๏ธ AI Model Configuration ### Model Settings Tab Configure which AI models are used for different tasks: **Available Models:** - **Gemini 2.5 Flash** - Fast, efficient processing with excellent performance - **Gemini 2.0 Flash** - Balanced performance and reliability - **Gemini 3.0 Flash Preview** - Latest Gemini model with enhanced capabilities (preview) - **Claude Sonnet 4.5** - Advanced reasoning and empathy for complex tasks (20250929) - **Claude Sonnet 4.0** - Reliable performance with strong reasoning (20250514) - **Claude 3.7 Sonnet** - Enhanced conversational abilities and nuanced understanding (20250219) **Task-Specific Configuration:** - **Spiritual Monitor** - Distress classification (default: Gemini 2.5 Flash) - **Soft Spiritual Triage** - Question generation (default: Claude Sonnet 4.5) - **Triage Response Evaluator** - Response analysis (default: Gemini 2.5 Flash) - **Medical Assistant** - Medical guidance (default: Claude Sonnet 4.5) - **Soft Medical Triage** - Medical assessment (default: Claude Sonnet 4.5) - **Medical Brain Summary Generator** - Medical Brain compatible summary generation (default: Claude Sonnet 4.5) **Session Scope:** Model changes apply only to your current browser session. --- ## ๐Ÿ” Enhanced Verification System ### Manual Input Mode **Perfect for testing individual messages:** 1. Enter a test message in the input field 2. Click **Run Classification** to analyze 3. Review detailed results including: - Classification (GREEN/YELLOW/RED) - Confidence scores - Reasoning and indicators detected - Triage questions (if applicable) 4. **Save verification** to include in session data 5. **Export results** as CSV or JSON ### File Upload Mode **Ideal for batch testing multiple scenarios:** 1. **Download CSV template** from the interface 2. **Fill in test messages** in the template 3. **Upload completed CSV** file 4. **Start batch classification** with one click 5. **Monitor progress** with real-time updates 6. **Review comprehensive results** with statistics 7. **Export detailed reports** in multiple formats --- ## ๐Ÿงพ Conversation Verification ### Chat-Derived Verification Transform your chat conversations into structured verification sessions: 1. **Have a conversation** in the Chat tab 2. **Go to Conversation Verification** tab 3. **Click Generate** to create verification session from chat 4. **Review each exchange** individually: - Mark as โœ… **Correct** or โŒ **Incorrect** - Add comments for incorrect classifications - Specify what the correct classification should be 5. **Navigate** between exchanges using Previous/Next buttons 6. **Download results** as JSON or CSV when complete --- ## ๐Ÿ’พ Data Export & Download Options ### Chat Tab Exports: - **๐Ÿ“ฅ Download JSON** - Complete conversation with all metadata, classifications, and system reasoning - **๐Ÿ“Š Download CSV** - Conversation in spreadsheet format for analysis - **๐Ÿ“ฅ Download Summary** - Provider summary (RED cases only) as text file ### Verification Exports: - **Enhanced Verification** - Test results with detailed analysis and statistics - **Conversation Verification** - Reviewed chat sessions with accuracy assessments - **Session Data** - Complete verification session with all metadata ### Export Features: - **Multiple Formats** - CSV for spreadsheets, JSON for detailed data - **Comprehensive Metadata** - Timestamps, confidence scores, reasoning - **Analysis Ready** - Formatted for statistical analysis and reporting - **Privacy Compliant** - No PHI stored, only classification data --- ## ๐Ÿ‘ฅ Patient Profiles for Testing ### Predefined Scenarios The **Patient Profiles** tab includes comprehensive test scenarios: **Distress Level Profiles:** - ๐ŸŸข **GREEN profiles** - Healthy patients with no spiritual distress - ๐ŸŸก **YELLOW profiles** - Various types of potential distress (grief, existential questions, etc.) - ๐Ÿ”ด **RED profiles** - Severe distress scenarios (crisis, hopelessness, spiritual crisis) **Medical Condition Profiles:** - Cardiac patients with specific exercise limitations - Diabetic patients with dietary considerations - Post-surgery recovery scenarios - Mental health focused interactions - Elderly patient considerations - Athletic patient profiles --- ## ๐Ÿ” Privacy, Security & Safety ### Data Protection: - โŒ **No PHI Storage** - Protected Health Information is never stored - ๐Ÿ”’ **Session Isolation** - Each user session is completely separate - ๐Ÿ” **Secure API Keys** - Stored locally in environment files only - ๐Ÿ“ **Audit Logging** - All interactions logged for quality assurance ### Safety Measures: - ๐Ÿ›ก๏ธ **Conservative Classification** - System errs on the side of caution - ๐Ÿค **Consent-Based Referrals** - Spiritual care referrals only with explicit consent - ๐Ÿšจ **Emergency Protocols** - Clear guidance to contact emergency services - ๐Ÿ‘ฅ **Professional Oversight** - Designed for use with spiritual care team support ### Important Disclaimers: - **Not a replacement** for professional medical or mental health care - **Emergency situations** require immediate contact with local emergency services - **Spiritual care referrals** are recommendations, not mandatory - **System accuracy** is continuously monitored and improved --- ## ๐Ÿ†˜ Emergency Information ### If You're in Crisis: - **Call 911** (US) or your local emergency number immediately - **National Suicide Prevention Lifeline**: 988 (US) - **Crisis Text Line**: Text HOME to 741741 - **Go to your nearest emergency room** ### This System: - **Provides support** but is not emergency intervention - **Can help identify** when professional help is needed - **Facilitates referrals** to appropriate spiritual care - **Complements** but does not replace professional care --- ## ๐ŸŽฏ System Status & Quality ### 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.3 - **Test Coverage**: 65/65 tests passing - **Last Updated**: January 7, 2026 - **Status**: Production Ready with Enhanced Provider Summary - **Recent Updates**: - โœ… **Automatic provider summary generation** (no manual intervention required) - โœ… **Enhanced summary content** (all patient inputs, no phone numbers) - โœ… **Improved user experience** (instant summary display on consent) - โœ… **Fixed HTML badge rendering** (clean text formatting) - โœ… **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) --- ## ๐Ÿ“ž Support & Troubleshooting ### Common Issues: 1. **Prompts not loading** - Try refreshing the page or clearing browser cache 2. **Model not responding** - Check that API keys are configured correctly 3. **Export not working** - Ensure you have data to export (completed conversations/verifications) 4. **Session changes lost** - Remember that prompt/model changes are session-only ### Getting Help: - **Built-in validation** - System provides immediate feedback on issues - **Reset options** - Use "Reset to Defaults" buttons to restore original settings - **Test suite** - Run system tests to verify functionality - **Documentation** - Comprehensive guides available in each tab ### Best Practices: - **Test changes** in Edit Prompts before promoting to permanent files - **Use verification modes** to validate system accuracy - **Export data regularly** for analysis and backup - **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. """