Spaces:
Sleeping
Sleeping
A newer version of the Gradio SDK is available:
6.3.0
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
# Recommended method
./run.sh
# Alternative
python app.py
Running Tests
# 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
# 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
- Edit Prompts: Use the "π§ Edit Prompts" tab for real-time testing
- Session Testing: Make changes that apply only to your session
- Validation: Use built-in validation before applying changes
- Promotion: Promote tested changes to permanent files
- 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