# Project Structure This document describes the organized structure of the Medical Assistant with Spiritual Support project after the prompt optimization implementation. ## 📁 Directory Structure ``` ├── src/ # Source code │ ├── config/ # Configuration and prompt management │ │ ├── prompt_management/ # NEW: Centralized prompt system │ │ │ ├── data/ # Shared component data (JSON) │ │ │ ├── prompt_controller.py # Central prompt orchestrator │ │ │ ├── shared_components.py # Indicator/Rules/Template catalogs │ │ │ └── data_models.py # Data structures │ │ └── prompts/ # Prompt text files │ ├── core/ # Core business logic │ └── interface/ # User interfaces │ ├── simplified_gradio_app.py # Main application │ └── enhanced_prompt_editor.py # NEW: Enhanced prompt editing UI │ ├── tests/ # Organized test structure │ ├── prompt_optimization/ # NEW: Prompt system tests │ │ ├── test_enhanced_prompt_editor.py │ │ ├── test_prompt_controller.py │ │ ├── test_session_prompt_*.py │ │ └── test_*_catalog.py │ ├── integration/ # End-to-end integration tests │ │ ├── test_task_*_complete.py │ │ └── test_integration.py │ ├── unit/ # Component unit tests │ │ ├── test_*_manager.py │ │ ├── test_*_classifier.py │ │ └── test_*_system.py │ ├── verification_mode/ # Verification system tests │ └── chaplain_feedback/ # Chaplain feedback tests │ ├── scripts/ # NEW: Utility scripts │ ├── cleanup_test_data.py # Data cleanup utilities │ ├── update_*.py # System update scripts │ └── simple_test.py # Quick testing │ ├── .kiro/ # Kiro IDE configuration │ └── specs/ # Project specifications │ └── prompt-optimization/ # Prompt optimization spec │ └── [Root Files] ├── app.py # Main application entry point ├── run.sh # Launch script ├── run_tests.py # NEW: Organized test runner └── requirements.txt # Dependencies ``` ## 🎯 Key Features Implemented ### 1. **Centralized Prompt Management** - **PromptController**: Central orchestrator for all prompt operations - **Shared Components**: Indicators, rules, templates stored centrally - **Session Overrides**: Temporary prompt modifications for testing - **Priority System**: Session → Centralized → Default fallbacks ### 2. **Enhanced Edit Prompts Interface** - **Real-time editing** with session isolation - **Validation system** with CSS-optimized display - **Promote to File** workflow with automatic backups - **Visual indicators** for prompt sources (session vs centralized) ### 3. **Organized Test Structure** - **Prompt Optimization Tests**: 9 test files covering all prompt system functionality - **Integration Tests**: 8 test files for end-to-end workflows - **Unit Tests**: 16 test files for individual components - **Proper imports** and path handling for moved files ### 4. **Data Management** - **Clean shared components** (no test data pollution) - **JSON-based storage** for indicators, rules, templates - **Automatic cleanup** scripts and procedures ## 🚀 Usage ### Running the Application ```bash # Recommended method ./run.sh # Alternative python app.py ``` ### Running Tests ```bash # All tests with organized output python run_tests.py # Specific test suites python -m pytest tests/prompt_optimization/ -v python -m pytest tests/integration/ -v python -m pytest tests/unit/ -v ``` ### Utility Scripts ```bash # Clean test data from shared components python scripts/cleanup_test_data.py # Quick functionality test python scripts/simple_test.py ``` ## 📊 Test Coverage - **Prompt Optimization**: 60+ tests covering all new functionality - **Integration**: 38+ tests for complete workflows - **Unit Tests**: 50+ tests for individual components - **Property-based**: Hypothesis testing for correctness guarantees ## 🔧 Development Workflow 1. **Edit Prompts**: Use the "🔧 Edit Prompts" tab for real-time testing 2. **Session Testing**: Make changes that apply only to your session 3. **Validation**: Use built-in validation before applying changes 4. **Promotion**: Promote tested changes to permanent files 5. **Testing**: Run organized test suites to verify functionality ## 📝 Recent Improvements - ✅ **Organized file structure** with logical groupings - ✅ **Fixed import paths** for all moved test files - ✅ **CSS-optimized validation** display (no more UI overflow) - ✅ **Clean shared components** (removed test data pollution) - ✅ **Comprehensive documentation** and README files - ✅ **Utility scripts** for maintenance and cleanup ## 🎉 Ready for Production The system is now fully organized, tested, and ready for production use with: - Clean, maintainable code structure - Comprehensive test coverage - User-friendly prompt editing interface - Robust data management - Clear documentation and workflows