Spaces:
Sleeping
Sleeping
Commit History
23 days ago
-
fix: only explicit refusals decline the Spiritual Health referral
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>474586e -
fix: Or_7 feedback — Spiritual Health team wording, coping follow-up, summary trigger
- Consent question now asks "Would you be open to having someone from the team reach out to you?" instead of asking to share the patient's information; confirmation and all consent templates renamed to the Spiritual Health team - Service explanation rewritten from Alex's program description: ambulatory, not hospital/bedside, phone or video, free, and visits are NOT private; the description is also added to the classifier and medical assistant prompts - Triage evaluator: a practical/treatment-related cause alone no longer resolves to GREEN; ongoing burden prompts a question about coping - Drop the canned "I'm glad you have support" on GREEN resolution - Provider summary context keeps only patient lines, most recent 2000 chars, so the triggering distress statement is not truncated; prompt requires naming the reported feeling in the patient's words - CSV export now includes provider_summary on the PROVIDER_SUMMARY row - Medical assistant must not invent appointment times or …948058d
-
Implement Or_4.txt feedback: Provider Summary as final exchange, simplified interface improvements
- Provider Summary now appears as final exchange in Conversation Verification - Added 'To patient:' and 'To spiritual care team:' addressee labels - Provider Summary uses narrative format from LLM (format_coherent_paragraph) - Created simplified_chat_handlers.py for simplified interface logic - Added simplified_help_content.py with detailed instructions - Removed Download JSON button, kept only CSV export - Added Model Settings, Edit Prompts, and Patient Profiles tabs back - Updated verification_handlers.py to use coherent narrative format - Created response documents (Or_4_Response.txt, Or_4_Response_EN.md, Or_4_Response_UA.md) - All changes based on customer feedback from review/Or_4.txte8c7fad
-
feat: Fix classification logic and remove redundant spiritual care message functionality
## Major Changes ### 🔧 Classification Logic Fixes (review/Or_2.txt recommendations) - Fix JSON parsing bug: LLM returns 'classification' but parser expected 'state' - Update RED flag definition: broader than crisis-only, includes active spiritual distress - Add explicit RED indicators: complex grief, loss of loved one, doubt about meaning of life/suffering/dignity - Fix 'I am fine' classification: now correctly GREEN (was incorrectly YELLOW) - Fix 'feeling sad' classification: now correctly YELLOW without spiritual context (was incorrectly RED) - Loss of meaning/purpose now correctly RED with high confidence ### 🗑️ Remove Redundant Spiritual Care Message UI - Remove redundant '💬 Care Team Message' tab from Provider Summary panel - Remove related UI controls and event handlers - Fix undefined 'spiritual_care_msg' variable in return statements - Preserve prompt editing and model settings (now used for Medical Brain Summary) - Medical Brain Summary now first tab by default in '�� Che…be1b5d2
-
feat: Complete prompt optimization system implementation
🎉 MAJOR FEATURE: Comprehensive prompt optimization system ## Core Architecture - ✅ Centralized PromptController with shared component architecture - ✅ Session-level prompt override system with isolation and cleanup - ✅ Enhanced Edit Prompts UI with validation and promotion workflows - ✅ Complete integration with existing Gradio interface ## Key Features Implemented - 🔧 Real-time prompt editing with session isolation - �� Visual indicators for prompt sources (session vs centralized) - ✅ Live validation with syntax and structure checking - 🔄 Promote to File workflow for permanent adoption - 🛡️ Automatic backup and rollback capabilities ## Shared Component System - 📋 Centralized indicators catalog (68 indicators) - 📏 Unified rules catalog (7 classification rules) - 📝 Template catalog (5 reusable patterns) - �� Consistent terminology across all AI agents ## Testing & Quality Assurance - ✅ 65+ comprehensive tests - all passing - 🧪 Property-based tests validating 9 correctness pr…24214fc
-
Add per-session prompt override functionality across interfaces and AI client
2e0e95f -
Add tests for model overrides in manual input and file upload controllers
4367366 -
Implement model overrides for AI clients and enhance interfaces for manual input and file upload
37184d4 -
Add comments and CSV export to conversation verification
08ac559 -
Fix conversation verification export record id
34caac9 -
Embed conversation verification in main UI and add download button
- Add Conversation Verification tab (no second Gradio server) - Add Download Verification JSON button in Chat tab - Add UI import smoke test - Restore VerificationDataStore import compatibilityded6460
-
✅ Enhanced Verification Modes - Production Ready
🎯 Complete implementation of enhanced verification system: - Enhanced Dataset Mode: Full dataset editing with CRUD operations - Manual Input Mode: Real-time classification and verification - File Upload Mode: Batch CSV/XLSX processing with progress tracking 🚀 Key Features: - Cross-mode session management and switching - Comprehensive export system (CSV, XLSX, JSON) - Robust error handling and data validation - Standardized UI components and integrated help system - Full backward compatibility with existing verification data �� Testing: - 100% integration test pass rate (10/10 tests) - 100% end-to-end workflow test pass rate (5/5 tests) - All 19 development tasks completed successfully 📚 Documentation: - Complete user guides and troubleshooting documentation - File format examples and help system integration - Comprehensive API documentation 🧹 Repository cleanup: - Removed intermediate development documents - Removed temporary integration tests - Clean production-ready codebase …7bbd836 -
Fix CSV download button for Hugging Face Spaces - use DownloadButton for direct file download
ab93d81
-
Add property-based tests for verification mode functionality
- Implement tests for verification data persistence, ensuring records and sessions save and load correctly. - Create tests for progress display accuracy, validating the display reflects the current position in the queue and total messages. - Add tests for message queue advancement, confirming the queue advances correctly after verification. - Develop tests for verification UI components, ensuring classifier decisions, confidence formatting, and indicators display correctly. - Include tests for test dataset management functionality, verifying dataset retrieval and message integrity. - Enhance unit tests for verification UI components, focusing on rendering accuracy for message review components.a3934b1
-
chore: Remove legacy modules and old tests
- Removed .kiro/specs and .vscode directories - Removed old spiritual analyzer and assistant modules - Removed combined assistant and multi-faith modules - Removed old Gradio interface and spiritual interface - Removed prompts, storage, and utils modules - Removed all old tests (kept only simplified app tests) - Repository now contains only essential files for Simplified Medical Assistant - Clean, minimal codebase ready for production6c0e398 -
feat: Implement simplified spiritual triage system (Phases 2-9)
New components: - src/core/spiritual_state.py: State machine (GREEN/YELLOW/RED) - src/core/spiritual_monitor.py: Background distress classifier - src/core/soft_triage_manager.py: Soft triage (2-3 questions max) - src/core/simplified_medical_app.py: Main app with integrated monitoring - src/interface/simplified_gradio_app.py: Simplified UI - run_simplified_app.py: Launch script Property tests (130 passing): - tests/test_spiritual_state_properties.py (22 tests) - tests/test_spiritual_monitor_properties.py (42 tests) - tests/test_soft_triage_properties.py (22 tests) - tests/test_simplified_app_properties.py (27 tests) - tests/test_referral_language_properties.py (17 tests) Correctness properties validated: - Property 1: Spiritual Monitor Always Invoked - Property 2: Green State Preservation - Property 3: Yellow Triggers Triage - Property 4: Red Triggers Immediate Referral - Property 5: Triage Question Limit (max 3) - Property 6: Triage Binary Outcome - Property 7: Triage Timeout Escalat…f2a77d5
-
feat: Implement CombinedAssistant for coordinating both modes
- Created CombinedAssistant that coordinates Lifestyle and Spiritual assistants - Implements intelligent prioritization (spiritual red flag > lifestyle close > balanced) - Handles parallel invocation of both assistants - Includes comprehensive error handling with fallback to working assistant - Formats combined responses based on priority - Added 14 unit tests covering all scenarios including error cases - All tests passing ✅ Implements Task 2.1-2.4 from integration spec Requirements: 2.1, 2.2, 2.3, 2.4, 2.5, 6.1, 6.2, 6.3, 6.4, 6.5d4a4a89 -
feat: Implement SpiritualAssistant for dialog mode
- Created SpiritualAssistant class that wraps spiritual health components - Handles red flags (generates referral), yellow flags (asks questions), and no flags (supportive response) - Formats responses for conversational interface - Includes comprehensive error handling with safe fallbacks - Added 13 unit tests covering all scenarios - All tests passing ✅ Implements Task 1.1-1.3 from integration spec Requirements: 5.1, 5.2, 5.3, 5.4, 5.5428869e -
🔧 Виправлення імпортів після реорганізації
- Оновлено імпорти в src/core/ai_client.py - Оновлено імпорти в src/core/core_classes.py - Оновлено імпорти в src/interface/gradio_app.py - Оновлено імпорти в lifestyle_app.py - Оновлено імпорти в tests/test_ai_providers.py Всі імпорти тепер вказують на нові шляхи після переміщення файлів у src/config/, src/utils/, scripts/, tests/f08800b -
🧹 Організація проекту: структурування коду, тестів та документації
✨ Основні зміни: - Переміщено всі тести в tests/spiritual/ (145 тестів) - Переміщено документацію в docs/spiritual/ та docs/general/ - Переміщено демо в demos/, скрипти в scripts/ - Переміщено конфігурацію в src/config/ - Видалено проміжні звіти (TASK_*_SUMMARY.md) - Створено чітку структуру проекту 📁 Нова структура: - src/ - вихідний код - tests/ - всі тести - docs/ - вся документація - demos/ - демонстраційні скрипти - scripts/ - утилітні скрипти - deployment/ - файли для розгортання 📚 Документація: - README.md - головний README - QUICK_START.md - швидкий старт - STRUCTURE.md - структура проекту - FILE_INDEX.md - індекс файлів - FINAL_STATUS.md - статус проекту ✅ Результат: чистий, організований репозиторій готовий до productiona2eebc7
-
refactor: adopt src/ modular structure, update imports, add compatibility shims; dynamic prompt safety components; tests passing (52)
aa18fb4