Spaces:
Sleeping
Sleeping
File size: 5,754 Bytes
24214fc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# 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 |