Spiritual_Health_Project / PROJECT_STRUCTURE.md
DocUA's picture
feat: Complete prompt optimization system implementation
24214fc
# 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