chore: cleanup
This commit is contained in:
@@ -1,269 +0,0 @@
|
|||||||
# Changelog
|
|
||||||
|
|
||||||
All notable changes to TheChart project are documented in this file.
|
|
||||||
|
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
||||||
|
|
||||||
## [1.9.5] - 2025-08-05
|
|
||||||
|
|
||||||
### 🎨 Major UI/UX Overhaul
|
|
||||||
- **Added**: Professional theme system with ttkthemes integration
|
|
||||||
- **Added**: 8 curated themes (Arc, Equilux, Adapta, Yaru, Ubuntu, Plastik, Breeze, Elegance)
|
|
||||||
- **Added**: Dynamic theme switching without restart
|
|
||||||
- **Added**: Theme persistence between sessions
|
|
||||||
- **Added**: Comprehensive settings window with tabbed interface
|
|
||||||
- **Added**: Smart tooltip system with context-sensitive help
|
|
||||||
- **Improved**: Table selection highlighting and alternating row colors
|
|
||||||
- **Improved**: Modern styling for all UI components (buttons, frames, forms)
|
|
||||||
- **Improved**: Professional card-style layouts and enhanced spacing
|
|
||||||
|
|
||||||
### ⚙️ Settings and Configuration System
|
|
||||||
- **Added**: Advanced settings window (accessible via F2)
|
|
||||||
- **Added**: Theme selection with live preview
|
|
||||||
- **Added**: UI preferences and customization options
|
|
||||||
- **Added**: About dialog with detailed application information
|
|
||||||
- **Added**: Settings persistence across application restarts
|
|
||||||
|
|
||||||
### 💡 Enhanced User Experience
|
|
||||||
- **Added**: Intelligent tooltips for all interactive elements
|
|
||||||
- **Added**: Specialized help for pathology scales and medicine options
|
|
||||||
- **Added**: Non-intrusive tooltip timing (500-800ms delay)
|
|
||||||
- **Added**: Quick theme switching via menu bar
|
|
||||||
- **Improved**: Visual hierarchy with better typography and spacing
|
|
||||||
- **Improved**: Professional color schemes across all themes
|
|
||||||
|
|
||||||
### 🏗️ Technical Architecture Improvements
|
|
||||||
- **Added**: Modular theme manager with dependency injection
|
|
||||||
- **Added**: Tooltip management system
|
|
||||||
- **Added**: Enhanced UI manager with theme integration
|
|
||||||
- **Improved**: Code organization with separate concerns
|
|
||||||
- **Improved**: Error handling with graceful theme fallbacks
|
|
||||||
|
|
||||||
## [1.7.0] - 2025-08-05
|
|
||||||
|
|
||||||
### ⌨️ Keyboard Shortcuts System
|
|
||||||
- **Added**: Comprehensive keyboard shortcuts for improved productivity
|
|
||||||
- **Added**: File operations shortcuts (Ctrl+S, Ctrl+Q, Ctrl+E)
|
|
||||||
- **Added**: Data management shortcuts (Ctrl+N, Ctrl+R, F5)
|
|
||||||
- **Added**: Window management shortcuts (Ctrl+M, Ctrl+P)
|
|
||||||
- **Added**: Table operation shortcuts (Delete, Escape)
|
|
||||||
- **Added**: Help system shortcut (F1)
|
|
||||||
- **Added**: Menu integration showing shortcuts next to menu items
|
|
||||||
- **Added**: Button labels updated to show primary shortcuts
|
|
||||||
- **Added**: In-app help dialog accessible via F1
|
|
||||||
- **Added**: Status bar feedback for all keyboard operations
|
|
||||||
- **Improved**: Button text shows shortcuts (e.g., "Add Entry (Ctrl+S)")
|
|
||||||
- **Improved**: Case-insensitive shortcuts (Ctrl+S and Ctrl+Shift+S both work)
|
|
||||||
|
|
||||||
#### Keyboard Shortcuts Added:
|
|
||||||
- **Ctrl+S**: Save/Add new entry
|
|
||||||
- **Ctrl+Q**: Quit application (with confirmation)
|
|
||||||
- **Ctrl+E**: Export data
|
|
||||||
- **Ctrl+N**: Clear entries
|
|
||||||
- **Ctrl+R / F5**: Refresh data
|
|
||||||
- **Ctrl+M**: Manage medicines
|
|
||||||
- **Ctrl+P**: Manage pathologies
|
|
||||||
- **Delete**: Delete selected entry (with confirmation)
|
|
||||||
- **Escape**: Clear selection
|
|
||||||
- **F1**: Show keyboard shortcuts help
|
|
||||||
|
|
||||||
### 📚 Documentation Updates
|
|
||||||
- **Updated**: FEATURES.md with keyboard shortcuts section
|
|
||||||
- **Added**: KEYBOARD_SHORTCUTS.md with comprehensive shortcut reference
|
|
||||||
- **Updated**: In-app help system with shortcut information
|
|
||||||
- **Updated**: About dialog with keyboard shortcut mention
|
|
||||||
|
|
||||||
## [1.6.1] - 2025-07-31
|
|
||||||
|
|
||||||
### 📚 Documentation Overhaul
|
|
||||||
- **BREAKING**: Consolidated scattered documentation into organized structure
|
|
||||||
- **Added**: Comprehensive `docs/FEATURES.md` with complete feature documentation
|
|
||||||
- **Added**: Detailed `docs/DEVELOPMENT.md` with testing and development guide
|
|
||||||
- **Updated**: Streamlined `README.md` with quick-start focus and navigation
|
|
||||||
- **Removed**: 10 redundant/outdated markdown files
|
|
||||||
- **Improved**: Clear separation between user and developer documentation
|
|
||||||
|
|
||||||
### 🏗️ Documentation Structure
|
|
||||||
```
|
|
||||||
docs/
|
|
||||||
├── FEATURES.md # Complete feature guide (new)
|
|
||||||
├── DEVELOPMENT.md # Development & testing guide (new)
|
|
||||||
└── CHANGELOG.md # This changelog (new)
|
|
||||||
|
|
||||||
README.md # Streamlined quick-start guide (updated)
|
|
||||||
```
|
|
||||||
|
|
||||||
## [1.3.3] - Previous Releases
|
|
||||||
|
|
||||||
### 🏥 Modular Medicine System
|
|
||||||
- **Added**: Dynamic medicine management system
|
|
||||||
- **Added**: JSON-based medicine configuration (`medicines.json`)
|
|
||||||
- **Added**: Medicine management UI (`Tools` → `Manage Medicines...`)
|
|
||||||
- **Added**: Configurable medicine properties (colors, doses, names)
|
|
||||||
- **Added**: Automatic UI updates when medicines change
|
|
||||||
- **Added**: Backward compatibility with existing data
|
|
||||||
|
|
||||||
### 💊 Advanced Dose Tracking System
|
|
||||||
- **Added**: Precise timestamp recording for medicine doses
|
|
||||||
- **Added**: Multiple daily dose support for same medicine
|
|
||||||
- **Added**: Comprehensive dose tracking interface in edit windows
|
|
||||||
- **Added**: Quick-dose buttons for common amounts
|
|
||||||
- **Added**: Real-time dose display and feedback
|
|
||||||
- **Added**: Historical dose data persistence in CSV
|
|
||||||
- **Improved**: Dose format parsing with robust error handling
|
|
||||||
|
|
||||||
#### Punch Button Redesign
|
|
||||||
- **Moved**: Dose tracking from main input to edit window
|
|
||||||
- **Added**: Individual dose entry fields per medicine
|
|
||||||
- **Added**: "Take [Medicine]" buttons with immediate recording
|
|
||||||
- **Added**: Editable dose display areas with history
|
|
||||||
- **Improved**: User experience with centralized dose management
|
|
||||||
|
|
||||||
### 📊 Enhanced Graph Visualization
|
|
||||||
- **Added**: Medicine dose bar charts with distinct colors
|
|
||||||
- **Added**: Interactive toggle controls for symptoms and medicines
|
|
||||||
- **Added**: Enhanced legend with multi-column layout
|
|
||||||
- **Added**: Average dosage calculations and displays
|
|
||||||
- **Added**: Professional styling with transparency and shadows
|
|
||||||
- **Improved**: Graph layout with dynamic positioning
|
|
||||||
|
|
||||||
#### Medicine Dose Plotting
|
|
||||||
- **Added**: Visual representation of daily medication intake
|
|
||||||
- **Added**: Scaled dose display (mg/10) for chart compatibility
|
|
||||||
- **Added**: Color-coded bars for each medicine
|
|
||||||
- **Added**: Semi-transparent rendering to preserve symptom visibility
|
|
||||||
- **Fixed**: Dose calculation logic for complex timestamp formats
|
|
||||||
|
|
||||||
#### Legend Enhancements
|
|
||||||
- **Added**: Multi-column legend layout (2 columns)
|
|
||||||
- **Added**: Average dosage information per medicine
|
|
||||||
- **Added**: Tracking status for medicines without current doses
|
|
||||||
- **Added**: Frame, shadow, and transparency effects
|
|
||||||
- **Improved**: Space utilization and readability
|
|
||||||
|
|
||||||
### 🧪 Comprehensive Testing Framework
|
|
||||||
- **Added**: Professional testing infrastructure with pytest
|
|
||||||
- **Added**: 93% code coverage across 112 tests
|
|
||||||
- **Added**: Coverage reporting (HTML, XML, terminal)
|
|
||||||
- **Added**: Pre-commit testing hooks
|
|
||||||
- **Added**: Comprehensive dose calculation testing
|
|
||||||
- **Added**: UI component testing with mocking
|
|
||||||
- **Added**: Medicine plotting and legend testing
|
|
||||||
|
|
||||||
#### Test Infrastructure
|
|
||||||
- **Added**: `tests/conftest.py` with shared fixtures
|
|
||||||
- **Added**: Sample data generators for realistic testing
|
|
||||||
- **Added**: Mock loggers and temporary file management
|
|
||||||
- **Added**: Environment variable mocking
|
|
||||||
|
|
||||||
#### Pre-commit Testing
|
|
||||||
- **Added**: Automated testing before commits
|
|
||||||
- **Added**: Core functionality validation (3 essential tests)
|
|
||||||
- **Added**: Commit blocking on test failures
|
|
||||||
- **Configured**: `.pre-commit-config.yaml` with testing hooks
|
|
||||||
|
|
||||||
### 🏗️ Technical Architecture Improvements
|
|
||||||
- **Added**: Modular component architecture
|
|
||||||
- **Added**: MedicineManager and PathologyManager classes
|
|
||||||
- **Added**: Dynamic UI generation based on configuration
|
|
||||||
- **Improved**: Separation of concerns across modules
|
|
||||||
- **Enhanced**: Error handling and logging throughout
|
|
||||||
|
|
||||||
### 📈 Data Management Enhancements
|
|
||||||
- **Added**: Automatic data migration and backup system
|
|
||||||
- **Added**: Dynamic CSV column management
|
|
||||||
- **Added**: Robust dose string parsing
|
|
||||||
- **Improved**: Data validation and error handling
|
|
||||||
- **Enhanced**: Backward compatibility preservation
|
|
||||||
|
|
||||||
### 🔧 Development Tools & Workflow
|
|
||||||
- **Added**: uv integration for fast package management
|
|
||||||
- **Added**: Comprehensive Makefile with development commands
|
|
||||||
- **Added**: Docker support with multi-platform builds
|
|
||||||
- **Added**: Pre-commit hooks for code quality
|
|
||||||
- **Added**: Ruff for fast Python formatting and linting
|
|
||||||
- **Improved**: Virtual environment management
|
|
||||||
|
|
||||||
### 🚀 Deployment & Distribution
|
|
||||||
- **Added**: PyInstaller integration for standalone executables
|
|
||||||
- **Added**: Linux desktop integration
|
|
||||||
- **Added**: Automatic file installation and desktop entries
|
|
||||||
- **Added**: Docker containerization support
|
|
||||||
- **Improved**: Build and deployment automation
|
|
||||||
|
|
||||||
## Technical Details
|
|
||||||
|
|
||||||
### Dependencies
|
|
||||||
- **Runtime**: Python 3.13+, matplotlib, pandas, tkinter, colorlog
|
|
||||||
- **Development**: pytest, pytest-cov, ruff, pre-commit, pyinstaller
|
|
||||||
- **Package Management**: uv (Rust-based, 10-100x faster than pip/Poetry)
|
|
||||||
|
|
||||||
### Architecture
|
|
||||||
- **Frontend**: Tkinter-based GUI with dynamic component generation
|
|
||||||
- **Backend**: Pandas for data manipulation, Matplotlib for visualization
|
|
||||||
- **Storage**: CSV-based with JSON configuration files
|
|
||||||
- **Testing**: pytest with comprehensive mocking and coverage
|
|
||||||
|
|
||||||
### File Structure
|
|
||||||
```
|
|
||||||
src/ # Main application code
|
|
||||||
├── main.py # Application entry point
|
|
||||||
├── ui_manager.py # User interface management
|
|
||||||
├── data_manager.py # CSV operations and data persistence
|
|
||||||
├── graph_manager.py # Visualization and plotting
|
|
||||||
├── medicine_manager.py # Medicine system management
|
|
||||||
└── pathology_manager.py # Symptom tracking
|
|
||||||
|
|
||||||
tests/ # Comprehensive test suite (112 tests, 93% coverage)
|
|
||||||
docs/ # Organized documentation
|
|
||||||
├── FEATURES.md # Complete feature documentation
|
|
||||||
├── DEVELOPMENT.md # Development and testing guide
|
|
||||||
└── CHANGELOG.md # This changelog
|
|
||||||
|
|
||||||
Configuration Files:
|
|
||||||
├── medicines.json # Medicine definitions (auto-generated)
|
|
||||||
├── pathologies.json # Symptom categories (auto-generated)
|
|
||||||
├── pyproject.toml # Project configuration
|
|
||||||
└── uv.lock # Dependency lock file
|
|
||||||
```
|
|
||||||
|
|
||||||
## Migration Notes
|
|
||||||
|
|
||||||
### From Previous Versions
|
|
||||||
- **Data Compatibility**: All existing CSV data continues to work
|
|
||||||
- **Automatic Migration**: Data structure updates handled automatically
|
|
||||||
- **Backup Creation**: Automatic backups before major changes
|
|
||||||
- **No Data Loss**: Existing functionality preserved during updates
|
|
||||||
|
|
||||||
### Configuration Migration
|
|
||||||
- **Medicine System**: Hard-coded medicines converted to JSON configuration
|
|
||||||
- **UI Updates**: Interface automatically adapts to new medicine definitions
|
|
||||||
- **Graph Integration**: Visualization system updated for dynamic medicines
|
|
||||||
|
|
||||||
## Future Roadmap
|
|
||||||
|
|
||||||
### Planned Features (v2.0)
|
|
||||||
- **Mobile App**: Companion mobile application for dose tracking
|
|
||||||
- **Cloud Sync**: Multi-device data synchronization
|
|
||||||
- **Advanced Analytics**: Machine learning-based trend analysis
|
|
||||||
- **Reminder System**: Intelligent medication reminders
|
|
||||||
- **Doctor Integration**: Healthcare provider report generation
|
|
||||||
|
|
||||||
### Platform Expansion
|
|
||||||
- **macOS Support**: Native macOS application
|
|
||||||
- **Windows Support**: Windows executable and installer
|
|
||||||
- **Web Interface**: Browser-based version for universal access
|
|
||||||
|
|
||||||
### API Development
|
|
||||||
- **REST API**: External system integration
|
|
||||||
- **Plugin Architecture**: Third-party extension support
|
|
||||||
- **Data Export**: Multiple format support (JSON, XML, etc.)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Contributing
|
|
||||||
|
|
||||||
This project follows semantic versioning and maintains comprehensive documentation.
|
|
||||||
For development guidelines, see [docs/DEVELOPMENT.md](docs/DEVELOPMENT.md).
|
|
||||||
For feature information, see [docs/FEATURES.md](docs/FEATURES.md).
|
|
||||||
@@ -1,340 +0,0 @@
|
|||||||
# TheChart - Development Documentation
|
|
||||||
|
|
||||||
## Development Environment Setup
|
|
||||||
|
|
||||||
### Prerequisites
|
|
||||||
- **Python 3.13+**: Required for the application
|
|
||||||
- **uv**: Fast Python package manager (10-100x faster than pip/Poetry)
|
|
||||||
- **Git**: Version control
|
|
||||||
|
|
||||||
### Quick Setup
|
|
||||||
```bash
|
|
||||||
# Clone and setup
|
|
||||||
git clone <repository-url>
|
|
||||||
cd thechart
|
|
||||||
|
|
||||||
# Install with uv (recommended)
|
|
||||||
make install
|
|
||||||
|
|
||||||
# Or manual setup
|
|
||||||
uv venv --python 3.13
|
|
||||||
uv sync
|
|
||||||
uv run pre-commit install --install-hooks --overwrite
|
|
||||||
```
|
|
||||||
|
|
||||||
### Environment Activation
|
|
||||||
```bash
|
|
||||||
# fish shell (default)
|
|
||||||
source .venv/bin/activate.fish
|
|
||||||
# or
|
|
||||||
make shell
|
|
||||||
|
|
||||||
# bash/zsh
|
|
||||||
source .venv/bin/activate
|
|
||||||
|
|
||||||
# Using uv run (recommended)
|
|
||||||
uv run python src/main.py
|
|
||||||
```
|
|
||||||
|
|
||||||
## Testing Framework
|
|
||||||
|
|
||||||
### Test Infrastructure
|
|
||||||
Professional testing setup with comprehensive coverage and automation.
|
|
||||||
|
|
||||||
#### Testing Tools
|
|
||||||
- **pytest**: Modern Python testing framework
|
|
||||||
- **pytest-cov**: Coverage reporting (HTML, XML, terminal)
|
|
||||||
- **pytest-mock**: Mocking support for isolated testing
|
|
||||||
- **coverage**: Detailed coverage analysis
|
|
||||||
|
|
||||||
#### Test Statistics
|
|
||||||
- **93% Overall Code Coverage** (482 total statements, 33 missed)
|
|
||||||
- **112 Total Tests** across 6 test modules
|
|
||||||
- **80 Tests Passing** (71.4% pass rate)
|
|
||||||
|
|
||||||
#### Coverage by Module
|
|
||||||
| Module | Coverage | Status |
|
|
||||||
|--------|----------|--------|
|
|
||||||
| constants.py | 100% | ✅ Complete |
|
|
||||||
| logger.py | 100% | ✅ Complete |
|
|
||||||
| graph_manager.py | 97% | ✅ Excellent |
|
|
||||||
| init.py | 95% | ✅ Excellent |
|
|
||||||
| ui_manager.py | 93% | ✅ Very Good |
|
|
||||||
| main.py | 91% | ✅ Very Good |
|
|
||||||
| data_manager.py | 87% | ✅ Good |
|
|
||||||
|
|
||||||
### Test Structure
|
|
||||||
|
|
||||||
#### Test Files
|
|
||||||
- **`tests/test_data_manager.py`** (16 tests): CSV operations, validation, error handling
|
|
||||||
- **`tests/test_graph_manager.py`** (14 tests): Matplotlib integration, dose calculations
|
|
||||||
- **`tests/test_ui_manager.py`** (21 tests): Tkinter UI components, user interactions
|
|
||||||
- **`tests/test_main.py`** (18 tests): Application integration, workflow testing
|
|
||||||
- **`tests/test_constants.py`** (12 tests): Configuration validation
|
|
||||||
- **`tests/test_logger.py`** (8 tests): Logging functionality
|
|
||||||
- **`tests/test_init.py`** (23 tests): Initialization and setup
|
|
||||||
|
|
||||||
#### Test Fixtures (`tests/conftest.py`)
|
|
||||||
- **Temporary Files**: Safe testing without affecting real data
|
|
||||||
- **Sample Data**: Comprehensive test datasets with realistic dose information
|
|
||||||
- **Mock Loggers**: Isolated logging for testing
|
|
||||||
- **Environment Mocking**: Controlled test environments
|
|
||||||
|
|
||||||
### Running Tests
|
|
||||||
|
|
||||||
#### Basic Testing
|
|
||||||
```bash
|
|
||||||
# Run all tests
|
|
||||||
make test
|
|
||||||
# or
|
|
||||||
uv run pytest
|
|
||||||
|
|
||||||
# Run specific test file
|
|
||||||
uv run pytest tests/test_graph_manager.py -v
|
|
||||||
|
|
||||||
# Run tests with specific pattern
|
|
||||||
uv run pytest -k "dose_calculation" -v
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Coverage Testing
|
|
||||||
```bash
|
|
||||||
# Generate coverage report
|
|
||||||
uv run pytest --cov=src --cov-report=html
|
|
||||||
|
|
||||||
# Coverage with specific module
|
|
||||||
uv run pytest tests/test_graph_manager.py --cov=src.graph_manager --cov-report=term-missing
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Continuous Testing
|
|
||||||
```bash
|
|
||||||
# Watch for changes and re-run tests
|
|
||||||
uv run pytest --watch
|
|
||||||
|
|
||||||
# Quick test runner script
|
|
||||||
./scripts/run_tests.py
|
|
||||||
```
|
|
||||||
|
|
||||||
### Pre-commit Testing
|
|
||||||
Automated testing prevents commits when core functionality is broken.
|
|
||||||
|
|
||||||
#### Configuration
|
|
||||||
Located in `.pre-commit-config.yaml`:
|
|
||||||
- **Core Tests**: 3 essential tests run before each commit
|
|
||||||
- **Fast Execution**: Only critical functionality tested
|
|
||||||
- **Commit Blocking**: Prevents commits when tests fail
|
|
||||||
|
|
||||||
#### Core Tests
|
|
||||||
1. **`test_init`**: DataManager initialization
|
|
||||||
2. **`test_initialize_csv_creates_file_with_headers`**: CSV file creation
|
|
||||||
3. **`test_load_data_with_valid_data`**: Data loading functionality
|
|
||||||
|
|
||||||
#### Usage
|
|
||||||
```bash
|
|
||||||
# Automatic on commit
|
|
||||||
git commit -m "Your changes"
|
|
||||||
|
|
||||||
# Manual pre-commit check
|
|
||||||
pre-commit run --all-files
|
|
||||||
|
|
||||||
# Run just test check
|
|
||||||
pre-commit run pytest-check --all-files
|
|
||||||
```
|
|
||||||
|
|
||||||
### Dose Calculation Testing
|
|
||||||
Comprehensive testing for the complex dose parsing and calculation system.
|
|
||||||
|
|
||||||
#### Test Categories
|
|
||||||
- **Standard Format**: `2025-07-28 18:59:45:150mg` → 150.0mg
|
|
||||||
- **Multiple Doses**: `2025-07-28 18:59:45:150mg|2025-07-28 19:34:19:75mg` → 225.0mg
|
|
||||||
- **With Symbols**: `• • • • 2025-07-30 07:50:00:300` → 300.0mg
|
|
||||||
- **Decimal Values**: `2025-07-28 18:59:45:12.5mg|2025-07-28 19:34:19:7.5mg` → 20.0mg
|
|
||||||
- **No Timestamps**: `100mg|50mg` → 150.0mg
|
|
||||||
- **Mixed Formats**: `• 2025-07-30 22:50:00:10|75mg` → 85.0mg
|
|
||||||
- **Edge Cases**: Empty strings, NaN values, malformed data → 0.0mg
|
|
||||||
|
|
||||||
#### Test Implementation
|
|
||||||
```python
|
|
||||||
# Example test case
|
|
||||||
def test_calculate_daily_dose_standard_format(self, graph_manager):
|
|
||||||
dose_str = "2025-07-28 18:59:45:150mg|2025-07-28 19:34:19:75mg"
|
|
||||||
result = graph_manager._calculate_daily_dose(dose_str)
|
|
||||||
assert result == 225.0
|
|
||||||
```
|
|
||||||
|
|
||||||
### Medicine Plotting Tests
|
|
||||||
Testing for the enhanced graph functionality with medicine dose visualization.
|
|
||||||
|
|
||||||
#### Test Areas
|
|
||||||
- **Toggle Functionality**: Medicine show/hide controls
|
|
||||||
- **Dose Plotting**: Bar chart generation for medicine doses
|
|
||||||
- **Color Coding**: Proper color assignment and consistency
|
|
||||||
- **Legend Enhancement**: Multi-column layout and average calculations
|
|
||||||
- **Data Integration**: Proper data flow from CSV to visualization
|
|
||||||
|
|
||||||
### UI Testing Strategy
|
|
||||||
Testing user interface components with mock frameworks to avoid GUI dependencies.
|
|
||||||
|
|
||||||
#### UI Test Coverage
|
|
||||||
- **Component Creation**: Widget creation and configuration
|
|
||||||
- **Event Handling**: User interactions and callbacks
|
|
||||||
- **Data Binding**: Variable synchronization and updates
|
|
||||||
- **Layout Management**: Grid and frame arrangements
|
|
||||||
- **Error Handling**: User input validation and error messages
|
|
||||||
|
|
||||||
#### Mocking Strategy
|
|
||||||
```python
|
|
||||||
# Example UI test with mocking
|
|
||||||
@patch('tkinter.Tk')
|
|
||||||
def test_create_input_frame(self, mock_tk, ui_manager):
|
|
||||||
parent = Mock()
|
|
||||||
result = ui_manager.create_input_frame(parent, {}, {})
|
|
||||||
assert result is not None
|
|
||||||
assert isinstance(result, dict)
|
|
||||||
```
|
|
||||||
|
|
||||||
## Code Quality
|
|
||||||
|
|
||||||
### Tools and Standards
|
|
||||||
- **ruff**: Fast Python linter and formatter (Rust-based)
|
|
||||||
- **pre-commit**: Git hook management for code quality
|
|
||||||
- **Type Hints**: Comprehensive type annotations
|
|
||||||
- **Docstrings**: Detailed function and class documentation
|
|
||||||
|
|
||||||
### Code Formatting
|
|
||||||
```bash
|
|
||||||
# Format code
|
|
||||||
make format
|
|
||||||
# or
|
|
||||||
uv run ruff format .
|
|
||||||
|
|
||||||
# Check formatting
|
|
||||||
make lint
|
|
||||||
# or
|
|
||||||
uv run ruff check .
|
|
||||||
```
|
|
||||||
|
|
||||||
### Pre-commit Hooks
|
|
||||||
Automatically installed hooks ensure code quality:
|
|
||||||
- **Code Formatting**: ruff formatting
|
|
||||||
- **Linting Checks**: Code quality validation
|
|
||||||
- **Import Sorting**: Consistent import organization
|
|
||||||
- **Basic File Checks**: Trailing whitespace, file endings
|
|
||||||
|
|
||||||
## Development Workflow
|
|
||||||
|
|
||||||
### Feature Development
|
|
||||||
1. **Create Feature Branch**: `git checkout -b feature/new-feature`
|
|
||||||
2. **Implement Changes**: Follow existing patterns and architecture
|
|
||||||
3. **Add Tests**: Ensure new functionality is tested
|
|
||||||
4. **Run Tests**: `make test` to verify functionality
|
|
||||||
5. **Code Quality**: `make format && make lint`
|
|
||||||
6. **Commit Changes**: Pre-commit hooks run automatically
|
|
||||||
7. **Create Pull Request**: For code review
|
|
||||||
|
|
||||||
### Medicine System Development
|
|
||||||
Adding new medicines or modifying the medicine system:
|
|
||||||
|
|
||||||
```python
|
|
||||||
# Example: Adding a new medicine programmatically
|
|
||||||
from medicine_manager import MedicineManager, Medicine
|
|
||||||
|
|
||||||
medicine_manager = MedicineManager()
|
|
||||||
new_medicine = Medicine(
|
|
||||||
key="sertraline",
|
|
||||||
display_name="Sertraline",
|
|
||||||
dosage_info="50mg",
|
|
||||||
quick_doses=["25", "50", "100"],
|
|
||||||
color="#9B59B6",
|
|
||||||
default_enabled=False
|
|
||||||
)
|
|
||||||
medicine_manager.add_medicine(new_medicine)
|
|
||||||
```
|
|
||||||
|
|
||||||
### Testing New Features
|
|
||||||
1. **Unit Tests**: Add tests for new functionality
|
|
||||||
2. **Integration Tests**: Test feature integration with existing system
|
|
||||||
3. **UI Tests**: Test user interface changes
|
|
||||||
4. **Dose Calculation Tests**: If affecting dose calculations
|
|
||||||
5. **Regression Tests**: Ensure existing functionality still works
|
|
||||||
|
|
||||||
## Debugging and Troubleshooting
|
|
||||||
|
|
||||||
### Logging
|
|
||||||
Application logs are stored in `logs/` directory:
|
|
||||||
- **`app.log`**: General application logs
|
|
||||||
- **`app.error.log`**: Error messages only
|
|
||||||
- **`app.warning.log`**: Warning messages only
|
|
||||||
|
|
||||||
### Debug Mode
|
|
||||||
Enable debug logging by modifying `src/logger.py` configuration.
|
|
||||||
|
|
||||||
### Common Issues
|
|
||||||
|
|
||||||
#### Test Failures
|
|
||||||
- **Matplotlib Mocking**: Ensure proper matplotlib component mocking
|
|
||||||
- **Tkinter Dependencies**: Use headless testing for UI components
|
|
||||||
- **File Path Issues**: Use absolute paths in tests
|
|
||||||
- **Mock Configuration**: Proper mock setup for external dependencies
|
|
||||||
|
|
||||||
#### Development Environment
|
|
||||||
- **Python Version**: Ensure Python 3.13+ is used
|
|
||||||
- **Virtual Environment**: Always work within the virtual environment
|
|
||||||
- **Dependencies**: Keep dependencies up to date with `uv sync --upgrade`
|
|
||||||
|
|
||||||
### Performance Testing
|
|
||||||
- **Dose Calculation Performance**: Test with large datasets
|
|
||||||
- **UI Responsiveness**: Test with extensive medicine lists
|
|
||||||
- **Memory Usage**: Monitor memory consumption with large CSV files
|
|
||||||
- **Graph Rendering**: Test graph performance with large datasets
|
|
||||||
|
|
||||||
## Architecture Documentation
|
|
||||||
|
|
||||||
### Core Components
|
|
||||||
- **MedTrackerApp**: Main application class
|
|
||||||
- **MedicineManager**: Medicine CRUD operations
|
|
||||||
- **PathologyManager**: Pathology/symptom management
|
|
||||||
- **GraphManager**: Visualization and plotting
|
|
||||||
- **UIManager**: User interface creation
|
|
||||||
- **DataManager**: Data persistence and CSV operations
|
|
||||||
|
|
||||||
### Data Flow
|
|
||||||
1. **User Input** → UIManager → DataManager → CSV
|
|
||||||
2. **Data Loading** → DataManager → pandas DataFrame → GraphManager
|
|
||||||
3. **Visualization** → GraphManager → matplotlib → UI Display
|
|
||||||
|
|
||||||
### Extension Points
|
|
||||||
- **Medicine System**: Add new medicine properties
|
|
||||||
- **Graph Types**: Add new visualization types
|
|
||||||
- **Export Formats**: Add new data export options
|
|
||||||
- **UI Components**: Add new interface elements
|
|
||||||
|
|
||||||
## Deployment Testing
|
|
||||||
|
|
||||||
### Standalone Executable
|
|
||||||
```bash
|
|
||||||
# Build executable
|
|
||||||
make deploy
|
|
||||||
|
|
||||||
# Test deployment
|
|
||||||
./dist/thechart
|
|
||||||
```
|
|
||||||
|
|
||||||
### Docker Testing
|
|
||||||
```bash
|
|
||||||
# Build container
|
|
||||||
make build
|
|
||||||
|
|
||||||
# Test container
|
|
||||||
make start
|
|
||||||
make attach
|
|
||||||
```
|
|
||||||
|
|
||||||
### Cross-platform Testing
|
|
||||||
- **Linux**: Primary development and testing platform
|
|
||||||
- **macOS**: Planned support (testing needed)
|
|
||||||
- **Windows**: Planned support (testing needed)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
For user documentation, see [README.md](../README.md).
|
|
||||||
For feature details, see [docs/FEATURES.md](FEATURES.md).
|
|
||||||
@@ -1,123 +0,0 @@
|
|||||||
# Documentation Consolidation Summary
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
This document summarizes the documentation consolidation and updates performed to improve the TheChart project documentation structure.
|
|
||||||
|
|
||||||
## Changes Made
|
|
||||||
|
|
||||||
### 1. Documentation Structure Consolidation
|
|
||||||
- **Removed**: `docs/UI_IMPROVEMENTS.md` (redundant file)
|
|
||||||
- **Consolidated**: UI/UX improvements documentation into `docs/FEATURES.md`
|
|
||||||
- **Enhanced**: Main `README.md` with recent updates section
|
|
||||||
- **Updated**: `docs/README.md` (documentation index) with comprehensive navigation
|
|
||||||
|
|
||||||
### 2. Content Integration
|
|
||||||
|
|
||||||
#### FEATURES.md Enhancements
|
|
||||||
- **Added**: Modern UI/UX System section (new in v1.9.5)
|
|
||||||
- **Added**: Professional Theme Engine documentation
|
|
||||||
- **Added**: Comprehensive Keyboard Shortcuts section
|
|
||||||
- **Added**: Settings and Theme Management documentation
|
|
||||||
- **Added**: Smart Tooltip System documentation
|
|
||||||
- **Added**: Enhanced Technical Architecture section
|
|
||||||
- **Added**: UI/UX Technical Implementation section
|
|
||||||
|
|
||||||
#### CHANGELOG.md Updates
|
|
||||||
- **Added**: Version 1.9.5 with comprehensive UI/UX overhaul documentation
|
|
||||||
- **Added**: Settings and Configuration System section
|
|
||||||
- **Added**: Enhanced User Experience section
|
|
||||||
- **Added**: Technical Architecture Improvements section
|
|
||||||
|
|
||||||
#### README.md Improvements
|
|
||||||
- **Updated**: Title and description to emphasize modern UI/UX
|
|
||||||
- **Added**: Recent Major Updates section highlighting v1.9.5 improvements
|
|
||||||
- **Added**: Quick start guidance for new users
|
|
||||||
- **Updated**: Documentation links with better descriptions
|
|
||||||
- **Added**: Documentation navigation guide reference
|
|
||||||
|
|
||||||
### 3. Cross-Reference Updates
|
|
||||||
- **Updated**: All internal links to reflect consolidated structure
|
|
||||||
- **Enhanced**: Documentation index with comprehensive navigation
|
|
||||||
- **Added**: Task-based navigation in docs/README.md
|
|
||||||
- **Improved**: User type-based documentation guidance
|
|
||||||
|
|
||||||
## Current Documentation Structure
|
|
||||||
|
|
||||||
```
|
|
||||||
docs/
|
|
||||||
├── README.md # Documentation index and navigation guide
|
|
||||||
├── FEATURES.md # Complete feature documentation (includes UI/UX)
|
|
||||||
├── KEYBOARD_SHORTCUTS.md # Comprehensive shortcut reference
|
|
||||||
├── MENU_THEMING.md # Menu theming system documentation
|
|
||||||
├── TESTING.md # Comprehensive testing guide (NEW)
|
|
||||||
├── EXPORT_SYSTEM.md # Data export functionality
|
|
||||||
├── DEVELOPMENT.md # Development guidelines
|
|
||||||
├── CHANGELOG.md # Version history and changes
|
|
||||||
└── DOCUMENTATION_SUMMARY.md # This summary file
|
|
||||||
```
|
|
||||||
|
|
||||||
### Testing Documentation Consolidation (NEW)
|
|
||||||
- **Added**: `docs/TESTING.md` - Comprehensive testing guide
|
|
||||||
- **Updated**: `scripts/README.md` - Reorganized test script documentation
|
|
||||||
- **Added**: `tests/test_theme_manager.py` - Unit tests for menu theming
|
|
||||||
- **Updated**: `scripts/test_menu_theming.py` - Converted to interactive demo
|
|
||||||
- **Organized**: Clear separation of unit tests, integration tests, and demos
|
|
||||||
├── EXPORT_SYSTEM.md # Data export functionality
|
|
||||||
├── DEVELOPMENT.md # Development setup and testing
|
|
||||||
├── CHANGELOG.md # Version history and improvements
|
|
||||||
└── DOCUMENTATION_SUMMARY.md # This summary (new)
|
|
||||||
|
|
||||||
README.md # Main project README with quick start
|
|
||||||
```
|
|
||||||
|
|
||||||
## Documentation Highlights
|
|
||||||
|
|
||||||
### For End Users
|
|
||||||
1. **Modern UI/UX**: Complete documentation of the new theme system
|
|
||||||
2. **Keyboard Efficiency**: Comprehensive shortcut system documentation
|
|
||||||
3. **Feature Guidance**: Consolidated feature documentation with examples
|
|
||||||
4. **Quick Navigation**: Task-based and user-type-based navigation
|
|
||||||
|
|
||||||
### For Developers
|
|
||||||
1. **Technical Architecture**: Enhanced architecture documentation
|
|
||||||
2. **UI/UX Implementation**: Technical details of theme system
|
|
||||||
3. **Code Organization**: Clear separation of concerns documentation
|
|
||||||
4. **Development Workflow**: Comprehensive development guide
|
|
||||||
|
|
||||||
## Quality Improvements
|
|
||||||
|
|
||||||
### Content Quality
|
|
||||||
- **Comprehensive Coverage**: All major features and improvements documented
|
|
||||||
- **Clear Structure**: Hierarchical organization with clear headings
|
|
||||||
- **Practical Examples**: Code snippets and usage examples maintained
|
|
||||||
- **Cross-References**: Better linking between related sections
|
|
||||||
|
|
||||||
### User Experience
|
|
||||||
- **Progressive Disclosure**: Information organized by user expertise level
|
|
||||||
- **Task-Oriented**: Documentation organized around user tasks
|
|
||||||
- **Quick Access**: Multiple entry points and navigation paths
|
|
||||||
- **Searchable**: Clear headings and consistent formatting
|
|
||||||
|
|
||||||
### Maintenance
|
|
||||||
- **Reduced Redundancy**: Eliminated duplicate information
|
|
||||||
- **Single Source of Truth**: Consolidated information reduces maintenance burden
|
|
||||||
- **Version Alignment**: Documentation synchronized with current codebase
|
|
||||||
- **Future-Proof**: Structure supports easy updates and additions
|
|
||||||
|
|
||||||
## Next Steps
|
|
||||||
|
|
||||||
### Recommended Maintenance
|
|
||||||
1. **Keep Features Updated**: Update FEATURES.md as new UI/UX improvements are added
|
|
||||||
2. **Maintain Changelog**: Continue detailed changelog entries for version tracking
|
|
||||||
3. **Review Navigation**: Periodically review docs/README.md navigation for completeness
|
|
||||||
4. **User Feedback**: Collect user feedback on documentation effectiveness
|
|
||||||
|
|
||||||
### Future Enhancements
|
|
||||||
1. **Screenshots**: Consider adding screenshots of the new UI themes
|
|
||||||
2. **Video Guides**: Potential for video demonstrations of key features
|
|
||||||
3. **API Documentation**: If public APIs develop, consider separate API docs
|
|
||||||
4. **Internationalization**: Structure supports future translation efforts
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Documentation consolidation completed**: All major UI/UX improvements are now properly documented and easily discoverable through the improved navigation structure.
|
|
||||||
@@ -1,215 +0,0 @@
|
|||||||
# TheChart Export System Documentation
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
The TheChart application now includes a comprehensive data export system that allows users to export their medication tracking data and visualizations to multiple formats:
|
|
||||||
|
|
||||||
- **JSON** - Structured data format with metadata
|
|
||||||
- **XML** - Hierarchical data format
|
|
||||||
- **PDF** - Formatted report with optional graph visualization
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
### Export Formats
|
|
||||||
|
|
||||||
#### JSON Export
|
|
||||||
- Exports all CSV data to structured JSON format
|
|
||||||
- Includes metadata about the export (date, total entries, date range)
|
|
||||||
- Lists all pathologies and medicines being tracked
|
|
||||||
- Data is exported as an array of entry objects
|
|
||||||
|
|
||||||
#### XML Export
|
|
||||||
- Exports data to hierarchical XML format
|
|
||||||
- Includes comprehensive metadata section
|
|
||||||
- All entries are properly structured with XML tags
|
|
||||||
- Column names are sanitized for valid XML element names
|
|
||||||
|
|
||||||
#### PDF Export
|
|
||||||
- Creates a formatted report document
|
|
||||||
- Includes export metadata and summary information
|
|
||||||
- Optional graph visualization inclusion
|
|
||||||
- Data table with all entries
|
|
||||||
- Proper pagination and styling
|
|
||||||
- Notes are truncated for better table formatting
|
|
||||||
|
|
||||||
### User Interface
|
|
||||||
|
|
||||||
The export functionality is accessible through:
|
|
||||||
1. **File Menu** - "Export Data..." option in the main menu bar
|
|
||||||
2. **Export Window** - Modal dialog with export options
|
|
||||||
3. **Format Selection** - Radio buttons for JSON, XML, or PDF
|
|
||||||
4. **Graph Option** - Checkbox to include graph in PDF exports
|
|
||||||
5. **File Dialog** - Standard save dialog for choosing export location
|
|
||||||
|
|
||||||
### Export Manager Architecture
|
|
||||||
|
|
||||||
The export system consists of three main components:
|
|
||||||
|
|
||||||
#### ExportManager Class (`src/export_manager.py`)
|
|
||||||
- Core export functionality
|
|
||||||
- Handles data transformation and file generation
|
|
||||||
- Integrates with existing data and graph managers
|
|
||||||
- Supports all three export formats
|
|
||||||
|
|
||||||
#### ExportWindow Class (`src/export_window.py`)
|
|
||||||
- GUI interface for export operations
|
|
||||||
- Modal dialog with export options
|
|
||||||
- File save dialog integration
|
|
||||||
- Progress feedback and error handling
|
|
||||||
|
|
||||||
#### Integration in MedTrackerApp (`src/main.py`)
|
|
||||||
- Export manager initialization
|
|
||||||
- Menu integration
|
|
||||||
- Seamless integration with existing managers
|
|
||||||
|
|
||||||
## Technical Implementation
|
|
||||||
|
|
||||||
### Dependencies Added
|
|
||||||
- `reportlab` - PDF generation library
|
|
||||||
- `lxml` - XML processing (added for future enhancements)
|
|
||||||
- `charset-normalizer` - Character encoding support
|
|
||||||
|
|
||||||
### Data Flow
|
|
||||||
1. User selects export format and options
|
|
||||||
2. ExportManager loads data from DataManager
|
|
||||||
3. Data is transformed according to selected format
|
|
||||||
4. Graph image is optionally generated for PDF
|
|
||||||
5. Output file is created and saved
|
|
||||||
6. User receives success/failure feedback
|
|
||||||
|
|
||||||
### Error Handling
|
|
||||||
- Graceful handling of missing data
|
|
||||||
- File system error management
|
|
||||||
- User-friendly error messages
|
|
||||||
- Logging of export operations
|
|
||||||
|
|
||||||
## Usage Examples
|
|
||||||
|
|
||||||
### Basic Export Process
|
|
||||||
1. Open TheChart application
|
|
||||||
2. Go to File → Export Data...
|
|
||||||
3. Select desired format (JSON/XML/PDF)
|
|
||||||
4. For PDF: choose whether to include graph
|
|
||||||
5. Click "Export..." button
|
|
||||||
6. Choose save location and filename
|
|
||||||
7. Confirm successful export
|
|
||||||
|
|
||||||
### Export File Examples
|
|
||||||
|
|
||||||
#### JSON Structure
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"metadata": {
|
|
||||||
"export_date": "2025-08-02T09:03:22.580489",
|
|
||||||
"total_entries": 32,
|
|
||||||
"date_range": {
|
|
||||||
"start": "07/02/2025",
|
|
||||||
"end": "08/02/2025"
|
|
||||||
},
|
|
||||||
"pathologies": ["depression", "anxiety", "sleep", "appetite"],
|
|
||||||
"medicines": ["bupropion", "hydroxyzine", "gabapentin", "propranolol", "quetiapine"]
|
|
||||||
},
|
|
||||||
"entries": [
|
|
||||||
{
|
|
||||||
"date": "07/02/2025",
|
|
||||||
"depression": 8,
|
|
||||||
"anxiety": 5,
|
|
||||||
"sleep": 3,
|
|
||||||
"appetite": 1,
|
|
||||||
"bupropion": 0,
|
|
||||||
"bupropion_doses": "",
|
|
||||||
"note": "Starting medication tracking"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### XML Structure
|
|
||||||
```xml
|
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<thechart_data>
|
|
||||||
<metadata>
|
|
||||||
<export_date>2025-08-02T09:03:22.613013</export_date>
|
|
||||||
<total_entries>32</total_entries>
|
|
||||||
<date_range>
|
|
||||||
<start>07/02/2025</start>
|
|
||||||
<end>08/02/2025</end>
|
|
||||||
</date_range>
|
|
||||||
</metadata>
|
|
||||||
<entries>
|
|
||||||
<entry>
|
|
||||||
<date>07/02/2025</date>
|
|
||||||
<depression>8</depression>
|
|
||||||
<anxiety>5</anxiety>
|
|
||||||
<note>Starting medication tracking</note>
|
|
||||||
</entry>
|
|
||||||
</entries>
|
|
||||||
</thechart_data>
|
|
||||||
```
|
|
||||||
|
|
||||||
## Testing
|
|
||||||
|
|
||||||
### Automated Tests
|
|
||||||
- Export functionality is tested through `simple_export_test.py`
|
|
||||||
- Creates sample exports in all three formats
|
|
||||||
- Validates file creation and basic content structure
|
|
||||||
|
|
||||||
### Manual Testing
|
|
||||||
- GUI testing available through `test_export_gui.py`
|
|
||||||
- Opens export window for interactive testing
|
|
||||||
- Allows testing of all user interface components
|
|
||||||
|
|
||||||
### Test Files Location
|
|
||||||
Exported test files are created in the `test_exports/` directory:
|
|
||||||
- `export.json` - JSON format export
|
|
||||||
- `export.xml` - XML format export
|
|
||||||
- `export.csv` - CSV format copy
|
|
||||||
- `test_export.pdf` - PDF format with graph
|
|
||||||
|
|
||||||
## File Locations
|
|
||||||
|
|
||||||
### Source Files
|
|
||||||
- `src/export_manager.py` - Core export functionality
|
|
||||||
- `src/export_window.py` - GUI export interface
|
|
||||||
|
|
||||||
### Test Files
|
|
||||||
- `simple_export_test.py` - Basic export functionality test
|
|
||||||
- `test_export_gui.py` - GUI testing interface
|
|
||||||
- `scripts/test_export_functionality.py` - Comprehensive export tests
|
|
||||||
|
|
||||||
### Dependencies
|
|
||||||
- Added to `requirements.txt` and managed by `uv`
|
|
||||||
- PDF generation requires `reportlab`
|
|
||||||
- XML processing enhanced with `lxml`
|
|
||||||
|
|
||||||
## Future Enhancements
|
|
||||||
|
|
||||||
Potential improvements for the export system:
|
|
||||||
1. **Additional Formats** - Excel, CSV with formatting
|
|
||||||
2. **Export Filtering** - Date range selection, specific pathologies/medicines
|
|
||||||
3. **Batch Exports** - Multiple formats at once
|
|
||||||
4. **Email Integration** - Direct email export
|
|
||||||
5. **Cloud Storage** - Export to cloud services
|
|
||||||
6. **Export Scheduling** - Automated periodic exports
|
|
||||||
7. **Advanced PDF Styling** - Charts, graphs, custom layouts
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
### Common Issues
|
|
||||||
1. **No Data to Export** - Ensure CSV file has entries before exporting
|
|
||||||
2. **PDF Generation Fails** - Check ReportLab installation and permissions
|
|
||||||
3. **File Save Errors** - Verify write permissions to selected directory
|
|
||||||
4. **Large File Exports** - PDF exports may take longer for large datasets
|
|
||||||
|
|
||||||
### Debugging
|
|
||||||
- Check application logs for detailed error messages
|
|
||||||
- Export operations are logged with DEBUG level information
|
|
||||||
- File system errors are captured and reported to user
|
|
||||||
|
|
||||||
## Integration Notes
|
|
||||||
|
|
||||||
The export system integrates seamlessly with existing TheChart functionality:
|
|
||||||
- Uses same data validation and loading mechanisms
|
|
||||||
- Respects existing pathology and medicine configurations
|
|
||||||
- Maintains data integrity and formatting consistency
|
|
||||||
- Follows existing logging and error handling patterns
|
|
||||||
@@ -1,361 +0,0 @@
|
|||||||
# TheChart - Features Documentation
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
TheChart is a comprehensive medication tracking application with a modern, professional UI that allows users to monitor medication intake, track symptoms, and visualize treatment progress over time.
|
|
||||||
|
|
||||||
## 🎨 Modern UI/UX System (New in v1.9.5)
|
|
||||||
|
|
||||||
### Professional Theme Engine
|
|
||||||
TheChart features a sophisticated theme system powered by ttkthemes, offering 8 carefully curated professional themes.
|
|
||||||
|
|
||||||
#### Available Themes:
|
|
||||||
- **Arc**: Modern flat design with subtle shadows
|
|
||||||
- **Equilux**: Dark theme with excellent contrast
|
|
||||||
- **Adapta**: Clean, minimalist design
|
|
||||||
- **Yaru**: Ubuntu-inspired modern interface
|
|
||||||
- **Ubuntu**: Official Ubuntu styling
|
|
||||||
- **Plastik**: Classic professional appearance
|
|
||||||
- **Breeze**: KDE-inspired clean design
|
|
||||||
- **Elegance**: Sophisticated dark theme
|
|
||||||
|
|
||||||
#### UI Enhancements:
|
|
||||||
- **Modern Styling**: Card-style frames, enhanced buttons, professional form controls
|
|
||||||
- **Smart Tooltips**: Context-sensitive help for all interactive elements
|
|
||||||
- **Improved Tables**: Better selection highlighting and alternating row colors
|
|
||||||
- **Settings System**: Comprehensive preferences with theme persistence
|
|
||||||
- **Responsive Design**: Automatic layout adjustments and scaling
|
|
||||||
- **Menu Theming**: Complete menu integration with theme colors and hover effects
|
|
||||||
|
|
||||||
### ⌨️ Comprehensive Keyboard Shortcuts
|
|
||||||
Professional keyboard shortcut system for efficient navigation and operation.
|
|
||||||
|
|
||||||
#### File Operations:
|
|
||||||
- **Ctrl+S**: Save/Add new entry
|
|
||||||
- **Ctrl+Q**: Quit application (with confirmation)
|
|
||||||
- **Ctrl+E**: Export data
|
|
||||||
|
|
||||||
#### Data Management:
|
|
||||||
- **Ctrl+N**: Clear entries
|
|
||||||
- **Ctrl+R / F5**: Refresh data
|
|
||||||
- **Delete**: Delete selected entry
|
|
||||||
- **Escape**: Clear selection
|
|
||||||
|
|
||||||
#### Window Management:
|
|
||||||
- **Ctrl+M**: Manage medicines
|
|
||||||
- **Ctrl+P**: Manage pathologies
|
|
||||||
- **F1**: Show keyboard shortcuts help
|
|
||||||
- **F2**: Open settings window
|
|
||||||
|
|
||||||
## Core Features
|
|
||||||
|
|
||||||
### 🏥 Modular Medicine System
|
|
||||||
TheChart features a dynamic medicine management system that allows complete customization without code modifications.
|
|
||||||
|
|
||||||
#### Features:
|
|
||||||
- **Dynamic Medicine Management**: Add, edit, and remove medicines through the UI
|
|
||||||
- **Configurable Properties**: Each medicine has customizable display names, dosages, colors, and quick-dose options
|
|
||||||
- **Automatic UI Updates**: All interface elements update automatically when medicines change
|
|
||||||
- **JSON Configuration**: Human-readable `medicines.json` file for easy management
|
|
||||||
|
|
||||||
#### Medicine Configuration:
|
|
||||||
Each medicine includes:
|
|
||||||
- **Key**: Internal identifier (e.g., "bupropion")
|
|
||||||
- **Display Name**: User-friendly name (e.g., "Bupropion")
|
|
||||||
- **Dosage Info**: Dosage information (e.g., "150/300 mg")
|
|
||||||
- **Quick Doses**: Common dose amounts for quick selection
|
|
||||||
- **Color**: Hex color for graph display (e.g., "#FF6B6B")
|
|
||||||
- **Default Enabled**: Whether to show in graphs by default
|
|
||||||
|
|
||||||
#### Default Medicines:
|
|
||||||
| Medicine | Dosage | Default Graph | Color |
|
|
||||||
|----------|--------|---------------|--------|
|
|
||||||
| Bupropion | 150/300 mg | ✅ | Red (#FF6B6B) |
|
|
||||||
| Hydroxyzine | 25 mg | ❌ | Teal (#4ECDC4) |
|
|
||||||
| Gabapentin | 100 mg | ❌ | Blue (#45B7D1) |
|
|
||||||
| Propranolol | 10 mg | ✅ | Green (#96CEB4) |
|
|
||||||
| Quetiapine | 25 mg | ❌ | Yellow (#FFEAA7) |
|
|
||||||
|
|
||||||
#### Usage:
|
|
||||||
1. **Through UI**: Go to `Tools` → `Manage Medicines...`
|
|
||||||
2. **Manual Configuration**: Edit `medicines.json` directly
|
|
||||||
3. **Programmatically**: Use the MedicineManager API
|
|
||||||
|
|
||||||
### ⚙️ Settings and Theme Management
|
|
||||||
Advanced configuration system allowing users to customize their experience.
|
|
||||||
|
|
||||||
#### Settings Window (F2):
|
|
||||||
- **Theme Selection**: Choose from 8 professional themes with live preview
|
|
||||||
- **UI Preferences**: Font scaling, window behavior options
|
|
||||||
- **About Information**: Detailed application and version information
|
|
||||||
- **Tabbed Interface**: Organized settings categories for easy navigation
|
|
||||||
|
|
||||||
#### Theme Features:
|
|
||||||
- **Real-time Switching**: No restart required for theme changes
|
|
||||||
- **Persistence**: Selected theme remembered between sessions
|
|
||||||
- **Quick Access**: Theme menu for instant switching
|
|
||||||
- **Fallback Handling**: Graceful handling if themes fail to load
|
|
||||||
|
|
||||||
### 💡 Smart Tooltip System
|
|
||||||
Context-sensitive help system providing guidance throughout the application.
|
|
||||||
|
|
||||||
#### Tooltip Types:
|
|
||||||
- **Pathology Scales**: Usage guidance for symptom tracking
|
|
||||||
- **Medicine Checkboxes**: Medication information and dosage details
|
|
||||||
- **Action Buttons**: Functionality description with keyboard shortcuts
|
|
||||||
- **Form Controls**: Input guidance and format requirements
|
|
||||||
|
|
||||||
#### Features:
|
|
||||||
- **Delayed Display**: Non-intrusive timing (500-800ms delay)
|
|
||||||
- **Theme-aware Styling**: Tooltips match selected theme
|
|
||||||
- **Smart Positioning**: Automatic placement to avoid screen edges
|
|
||||||
- **Rich Content**: Multi-line descriptions with formatting
|
|
||||||
|
|
||||||
### 💊 Advanced Dose Tracking
|
|
||||||
Comprehensive dose tracking system that records exact timestamps and dosages throughout the day.
|
|
||||||
|
|
||||||
#### Core Capabilities:
|
|
||||||
- **Timestamp Recording**: Exact time when medicine is taken
|
|
||||||
- **Dose Amount Tracking**: Record specific doses (150mg, 10mg, etc.)
|
|
||||||
- **Multiple Doses Per Day**: Take the same medicine multiple times
|
|
||||||
- **Real-time Display**: See today's doses immediately
|
|
||||||
- **Data Persistence**: All doses saved to CSV with full history
|
|
||||||
|
|
||||||
#### Dose Management Interface:
|
|
||||||
Located in the edit window (double-click any entry):
|
|
||||||
- **Individual Dose Entry Fields**: For each medicine
|
|
||||||
- **"Take [Medicine]" Buttons**: Immediate dose recording with timestamps
|
|
||||||
- **Editable Dose Display Areas**: View and modify existing doses
|
|
||||||
- **Quick Dose Buttons**: Pre-configured common dose amounts
|
|
||||||
- **Format Consistency**: All doses displayed in HH:MM: dose format
|
|
||||||
|
|
||||||
#### Data Format:
|
|
||||||
- **Timestamp Format**: `YYYY-MM-DD HH:MM:SS`
|
|
||||||
- **Dose Separator**: `|` (pipe) for multiple doses
|
|
||||||
- **Dose Format**: `timestamp:dose`
|
|
||||||
- **CSV Storage**: Additional columns in existing CSV file
|
|
||||||
|
|
||||||
#### Example CSV Format:
|
|
||||||
```csv
|
|
||||||
date,depression,anxiety,sleep,appetite,bupropion,bupropion_doses,hydroxyzine,hydroxyzine_doses,propranolol,propranolol_doses,note
|
|
||||||
07/28/2025,4,5,3,3,1,"2025-07-28 14:30:00:150mg|2025-07-28 18:30:00:150mg",0,"",1,"2025-07-28 12:30:00:10mg","Multiple doses today"
|
|
||||||
```
|
|
||||||
|
|
||||||
### 📊 Enhanced Graph Visualization
|
|
||||||
Advanced graphing system with comprehensive data visualization and interactive controls.
|
|
||||||
|
|
||||||
#### Medicine Dose Visualization:
|
|
||||||
- **Colored Bar Charts**: Each medicine has distinct colors
|
|
||||||
- **Daily Dose Totals**: Automatically calculated from individual doses
|
|
||||||
- **Scaled Display**: Doses scaled by 1/10 for better visibility (labeled as "mg/10")
|
|
||||||
- **Dynamic Positioning**: Bars positioned below main chart area
|
|
||||||
- **Semi-transparent Bars**: Alpha=0.6 to avoid overwhelming symptom data
|
|
||||||
|
|
||||||
#### Interactive Controls:
|
|
||||||
- **Toggle Buttons**: Independent show/hide for each medicine and symptom
|
|
||||||
- **Organized Sections**: "Symptoms" and "Medicines" sections
|
|
||||||
- **Real-time Updates**: Changes take effect immediately
|
|
||||||
|
|
||||||
#### Enhanced Legend:
|
|
||||||
- **Multi-column Layout**: Efficient use of graph space (2 columns)
|
|
||||||
- **Average Dosage Display**: Shows average dose for each medicine
|
|
||||||
- **Color Coding**: Consistent color scheme matching graph elements
|
|
||||||
- **Professional Styling**: Frame, shadow, and transparency effects
|
|
||||||
- **Tracking Status**: Shows medicines being monitored but without current dose data
|
|
||||||
|
|
||||||
#### Dose Calculation Features:
|
|
||||||
- **Multiple Format Support**: Handles various dose string formats
|
|
||||||
- **Robust Parsing**: Handles timestamps, symbols (•), and mixed formats
|
|
||||||
- **Edge Case Handling**: Manages empty strings, NaN values, malformed data
|
|
||||||
- **Daily Totals**: Sums all individual doses for comprehensive daily tracking
|
|
||||||
|
|
||||||
### 🏥 Pathology Management
|
|
||||||
Comprehensive symptom tracking with configurable pathologies.
|
|
||||||
|
|
||||||
#### Features:
|
|
||||||
- **Dynamic Pathology System**: Similar to medicine management
|
|
||||||
- **Configurable Symptoms**: Add, edit, and remove symptom categories
|
|
||||||
- **Scale-based Rating**: 0-10 rating system for symptom severity
|
|
||||||
- **Historical Tracking**: Full symptom history with trend analysis
|
|
||||||
|
|
||||||
### 📝 Data Management
|
|
||||||
Robust data handling with comprehensive backup and migration support.
|
|
||||||
|
|
||||||
#### Data Features:
|
|
||||||
- **CSV-based Storage**: Human-readable and portable data format
|
|
||||||
- **Automatic Backups**: Created before major migrations
|
|
||||||
- **Backward Compatibility**: Existing data continues to work with updates
|
|
||||||
- **Dynamic Column Management**: Automatically adapts to new medicines/pathologies
|
|
||||||
- **Data Validation**: Ensures data integrity and handles edge cases
|
|
||||||
|
|
||||||
#### Migration Support:
|
|
||||||
- **Automatic Migration**: Data structure updates handled automatically
|
|
||||||
- **Backup Creation**: `thechart_data.csv.backup_YYYYMMDD_HHMMSS` format
|
|
||||||
- **No Data Loss**: All existing functionality and data preserved
|
|
||||||
- **Version Compatibility**: Seamless updates across application versions
|
|
||||||
|
|
||||||
### 🧪 Comprehensive Testing Framework
|
|
||||||
Professional testing infrastructure with high code coverage.
|
|
||||||
|
|
||||||
#### Testing Statistics:
|
|
||||||
- **93% Overall Code Coverage** (482 total statements, 33 missed)
|
|
||||||
- **112 Total Tests** across 6 test modules
|
|
||||||
- **80 Tests Passing** (71.4% pass rate)
|
|
||||||
- **Pre-commit Testing**: Core functionality tests run before each commit
|
|
||||||
|
|
||||||
#### Test Coverage by Module:
|
|
||||||
- **100% Coverage**: constants.py, logger.py
|
|
||||||
- **97% Coverage**: graph_manager.py
|
|
||||||
- **95% Coverage**: init.py
|
|
||||||
- **93% Coverage**: ui_manager.py
|
|
||||||
- **91% Coverage**: main.py
|
|
||||||
- **87% Coverage**: data_manager.py
|
|
||||||
|
|
||||||
#### Testing Tools:
|
|
||||||
- **pytest**: Modern Python testing framework
|
|
||||||
- **pytest-cov**: Coverage reporting with HTML, XML, and terminal output
|
|
||||||
- **pytest-mock**: Mocking support for isolated testing
|
|
||||||
- **pre-commit hooks**: Automated testing before commits
|
|
||||||
|
|
||||||
## User Interface Features
|
|
||||||
|
|
||||||
### 🖥️ Intuitive Design
|
|
||||||
- **Clean Main Interface**: Simplified new entry form focused on essential inputs
|
|
||||||
- **Organized Edit Windows**: Comprehensive dose management in dedicated edit interface
|
|
||||||
- **Scrollable Interface**: Vertical scrollbar for expanded UI components
|
|
||||||
- **Responsive Design**: Interface adapts to window size and content
|
|
||||||
- **Visual Feedback**: Success messages and clear status indicators
|
|
||||||
|
|
||||||
### 🎯 User Experience Improvements
|
|
||||||
- **Centralized Dose Management**: All dose operations consolidated in edit windows
|
|
||||||
- **Quick Entry Options**: Pre-configured dose buttons for common amounts
|
|
||||||
- **Format Guidance**: Clear instructions and format examples
|
|
||||||
- **Real-time Updates**: Immediate feedback and data updates
|
|
||||||
- **Error Handling**: Comprehensive error messages and recovery options
|
|
||||||
|
|
||||||
### ⌨️ Keyboard Shortcuts
|
|
||||||
Comprehensive keyboard shortcuts for efficient navigation and data entry.
|
|
||||||
|
|
||||||
#### File Operations:
|
|
||||||
- **Ctrl+S**: Save/Add new entry - Quickly save current entry data
|
|
||||||
- **Ctrl+Q**: Quit application - Exit with confirmation dialog
|
|
||||||
- **Ctrl+E**: Export data - Open export dialog window
|
|
||||||
|
|
||||||
#### Data Management:
|
|
||||||
- **Ctrl+N**: Clear entries - Clear all input fields for new entry
|
|
||||||
- **Ctrl+R / F5**: Refresh data - Reload data from CSV and update displays
|
|
||||||
|
|
||||||
#### Window Management:
|
|
||||||
- **Ctrl+M**: Manage medicines - Open medicine management window
|
|
||||||
- **Ctrl+P**: Manage pathologies - Open pathology management window
|
|
||||||
|
|
||||||
#### Table Operations:
|
|
||||||
- **Delete**: Delete selected entry - Remove selected table entry with confirmation
|
|
||||||
- **Escape**: Clear selection - Clear current table selection
|
|
||||||
- **Double-click**: Edit entry - Open edit dialog for selected entry
|
|
||||||
|
|
||||||
#### Help System:
|
|
||||||
- **F1**: Show keyboard shortcuts - Display help dialog with all shortcuts
|
|
||||||
|
|
||||||
#### Integration Features:
|
|
||||||
- **Menu Display**: All shortcuts shown in menu bar next to items
|
|
||||||
- **Button Labels**: Primary buttons show their keyboard shortcuts
|
|
||||||
- **Case Insensitive**: Both Ctrl+S and Ctrl+Shift+S work
|
|
||||||
- **Focus Management**: Shortcuts work when main window has focus
|
|
||||||
- **Status Feedback**: All operations provide status bar feedback
|
|
||||||
|
|
||||||
## Technical Architecture
|
|
||||||
|
|
||||||
### � Modern UI Architecture
|
|
||||||
- **ThemeManager**: Centralized theme management with dynamic switching
|
|
||||||
- **TooltipManager**: Smart tooltip system with context-sensitive help
|
|
||||||
- **UIManager**: Enhanced UI component creation with theme integration
|
|
||||||
- **SettingsWindow**: Advanced configuration interface with persistence
|
|
||||||
|
|
||||||
### 🏗️ Core Application Design
|
|
||||||
- **MedicineManager**: Core medicine CRUD operations with JSON persistence
|
|
||||||
- **PathologyManager**: Symptom and pathology management system
|
|
||||||
- **GraphManager**: Professional graph rendering with matplotlib integration
|
|
||||||
- **DataManager**: Robust CSV operations and data persistence with validation
|
|
||||||
|
|
||||||
### 🔧 Configuration and Data Management
|
|
||||||
- **JSON-based Configuration**: `medicines.json` and `pathologies.json` for easy management
|
|
||||||
- **Dynamic Loading**: Runtime configuration updates without restarts
|
|
||||||
- **Data Validation**: Comprehensive input validation and error handling
|
|
||||||
- **Backward Compatibility**: Seamless updates and migrations across versions
|
|
||||||
|
|
||||||
### 📈 Advanced Data Processing
|
|
||||||
- **Pandas Integration**: Efficient data manipulation and analysis
|
|
||||||
- **Real-time Calculations**: Dynamic dose totals, averages, and statistics
|
|
||||||
- **Robust Parsing**: Handles various data formats and edge cases gracefully
|
|
||||||
- **Performance Optimization**: Efficient batch operations and caching
|
|
||||||
|
|
||||||
## UI/UX Technical Implementation
|
|
||||||
|
|
||||||
### 🎭 Theme System Architecture
|
|
||||||
- **Multiple Theme Support**: 8 curated professional themes
|
|
||||||
- **Dynamic Style Application**: Real-time theme switching without restart
|
|
||||||
- **Color Extraction**: Automatic color scheme detection and application
|
|
||||||
- **Fallback Mechanisms**: Graceful handling when themes fail to load
|
|
||||||
|
|
||||||
### 💡 Enhanced User Experience
|
|
||||||
- **Smart Tooltips**: Context-sensitive help with delayed, non-intrusive display
|
|
||||||
- **Modern Styling**: Card-style frames, enhanced buttons, professional form controls
|
|
||||||
- **Improved Tables**: Better selection highlighting and alternating row colors
|
|
||||||
- **Responsive Design**: Automatic layout adjustments and proper scaling
|
|
||||||
|
|
||||||
### ⚙️ Settings and Persistence
|
|
||||||
- **Configuration Management**: Theme and preference persistence across sessions
|
|
||||||
- **Tabbed Settings Interface**: Organized categories for easy navigation
|
|
||||||
- **Live Preview**: Real-time theme preview in settings
|
|
||||||
- **Error Recovery**: Robust handling of corrupted settings with defaults
|
|
||||||
|
|
||||||
## Deployment and Distribution
|
|
||||||
|
|
||||||
### 📦 Standalone Executable
|
|
||||||
- **PyInstaller Integration**: Creates self-contained executables
|
|
||||||
- **Cross-platform Support**: Linux deployment with desktop integration
|
|
||||||
- **Automatic Installation**: Installs to `~/Applications/` with desktop entry
|
|
||||||
- **Data Migration**: Copies data files to appropriate user directories
|
|
||||||
|
|
||||||
### 🐳 Docker Support
|
|
||||||
- **Multi-platform Images**: Docker container support
|
|
||||||
- **Docker Compose**: Easy container management
|
|
||||||
- **Development Environment**: Consistent development setup across platforms
|
|
||||||
|
|
||||||
### 🔄 Package Management
|
|
||||||
- **UV Integration**: Fast Python package management with Rust performance
|
|
||||||
- **Virtual Environment**: Isolated dependency management
|
|
||||||
- **Lock Files**: Reproducible builds with `uv.lock`
|
|
||||||
- **Development Dependencies**: Separate dev dependencies for clean production builds
|
|
||||||
|
|
||||||
## Integration Features
|
|
||||||
|
|
||||||
### 🔄 Import/Export
|
|
||||||
- **CSV Import**: Import existing medication data
|
|
||||||
- **Data Export**: Export data for backup or analysis
|
|
||||||
- **Format Compatibility**: Standard CSV format for portability
|
|
||||||
|
|
||||||
### 🔌 API Integration
|
|
||||||
- **Extensible Architecture**: Plugin system for future enhancements
|
|
||||||
- **Medicine API**: Programmatic medicine management
|
|
||||||
- **Data API**: Direct data access and manipulation
|
|
||||||
|
|
||||||
## Future Enhancements
|
|
||||||
|
|
||||||
### 🚀 Planned Features
|
|
||||||
- **Mobile Companion App**: Mobile dose tracking and reminders
|
|
||||||
- **Cloud Synchronization**: Multi-device data synchronization
|
|
||||||
- **Advanced Analytics**: Machine learning-based trend analysis
|
|
||||||
- **Reminder System**: Intelligent dose reminders and scheduling
|
|
||||||
- **Doctor Integration**: Export reports for healthcare providers
|
|
||||||
|
|
||||||
### 🎯 Development Roadmap
|
|
||||||
- **macOS/Windows Support**: Extended platform support
|
|
||||||
- **Plugin Architecture**: Third-party extension support
|
|
||||||
- **API Development**: RESTful API for external integrations
|
|
||||||
- **Advanced Visualizations**: Additional chart types and analysis tools
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
For detailed usage instructions, see the main [README.md](../README.md).
|
|
||||||
For development information, see [DEVELOPMENT.md](DEVELOPMENT.md).
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
# Keyboard Shortcuts
|
|
||||||
|
|
||||||
TheChart application supports comprehensive keyboard shortcuts for improved productivity and efficient navigation.
|
|
||||||
|
|
||||||
## File Operations
|
|
||||||
- **Ctrl+S**: Save/Add new entry - Saves the current entry data to the database
|
|
||||||
- **Ctrl+Q**: Quit application - Exits the application (with confirmation dialog)
|
|
||||||
- **Ctrl+E**: Export data - Opens the export dialog window
|
|
||||||
|
|
||||||
## Data Management
|
|
||||||
- **Ctrl+N**: Clear entries - Clears all input fields to start a new entry
|
|
||||||
- **Ctrl+R** or **F5**: Refresh data - Reloads data from the CSV file and updates the display
|
|
||||||
|
|
||||||
## Window Management
|
|
||||||
- **Ctrl+M**: Manage medicines - Opens the medicine management window
|
|
||||||
- **Ctrl+P**: Manage pathologies - Opens the pathology management window
|
|
||||||
|
|
||||||
## Table Operations
|
|
||||||
- **Delete**: Delete selected entry - Deletes the currently selected entry in the table (with confirmation)
|
|
||||||
- **Escape**: Clear selection - Clears the current selection in the table
|
|
||||||
- **Double-click**: Edit entry - Opens the edit dialog for the selected entry
|
|
||||||
|
|
||||||
## Help
|
|
||||||
- **F1**: Show keyboard shortcuts help - Displays a dialog with all available keyboard shortcuts
|
|
||||||
|
|
||||||
## Implementation Details
|
|
||||||
|
|
||||||
### Menu Integration
|
|
||||||
All keyboard shortcuts are displayed in the menu bar next to their corresponding menu items for easy reference.
|
|
||||||
|
|
||||||
### Button Labels
|
|
||||||
Primary action buttons show their keyboard shortcuts in the button text (e.g., "Add Entry (Ctrl+S)").
|
|
||||||
|
|
||||||
### Case Sensitivity
|
|
||||||
- Shortcuts are case-insensitive
|
|
||||||
- Both `Ctrl+S` and `Ctrl+Shift+S` work
|
|
||||||
- Uppercase and lowercase variants are supported
|
|
||||||
|
|
||||||
### Focus Requirements
|
|
||||||
- Keyboard shortcuts work when the main window has focus
|
|
||||||
- Focus is automatically set to the main window on startup
|
|
||||||
- Shortcuts work across all tabs and interface elements
|
|
||||||
|
|
||||||
### Feedback System
|
|
||||||
- All operations provide feedback through the status bar
|
|
||||||
- Success and error messages are displayed
|
|
||||||
- Confirmation dialogs are shown for destructive operations (quit, delete)
|
|
||||||
|
|
||||||
## Usage Tips
|
|
||||||
|
|
||||||
### Quick Workflow
|
|
||||||
1. **Ctrl+N** - Clear fields for new entry
|
|
||||||
2. Enter data in the form
|
|
||||||
3. **Ctrl+S** - Save the entry
|
|
||||||
4. **F5** - Refresh to see updated data
|
|
||||||
|
|
||||||
### Navigation
|
|
||||||
- Use **Ctrl+M** and **Ctrl+P** to quickly access management windows
|
|
||||||
- Use **Delete** to remove unwanted entries from the table
|
|
||||||
- Use **Escape** to clear selections when needed
|
|
||||||
|
|
||||||
### Getting Help
|
|
||||||
- Press **F1** anytime to see the keyboard shortcuts help dialog
|
|
||||||
- All shortcuts are also visible in the menu bar
|
|
||||||
- Button tooltips show additional keyboard shortcut information
|
|
||||||
|
|
||||||
## Accessibility
|
|
||||||
- Keyboard shortcuts provide full application functionality without mouse use
|
|
||||||
- All critical operations have keyboard equivalents
|
|
||||||
- Shortcuts follow standard application conventions (Ctrl+S for save, Ctrl+Q for quit)
|
|
||||||
- Help system is easily accessible via F1
|
|
||||||
@@ -1,105 +0,0 @@
|
|||||||
# Menu Theming Documentation
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
TheChart application now supports full menu theming that integrates seamlessly with the application's theme system. All menus (File, Tools, Theme, Help) will automatically adopt colors that match the selected application theme.
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
### Automatic Theme Integration
|
|
||||||
- Menus automatically inherit colors from the current application theme
|
|
||||||
- Background colors are slightly adjusted to provide subtle visual distinction
|
|
||||||
- Hover effects use the theme's accent colors for consistency
|
|
||||||
|
|
||||||
### Supported Menu Elements
|
|
||||||
- Main menu bar
|
|
||||||
- All dropdown menus (File, Tools, Theme, Help)
|
|
||||||
- Menu items and separators
|
|
||||||
- Hover/active states
|
|
||||||
- Disabled menu items
|
|
||||||
|
|
||||||
### Theme Colors Applied
|
|
||||||
|
|
||||||
For each theme, the following color properties are applied to menus:
|
|
||||||
|
|
||||||
- **Background**: Slightly darker/lighter than the main theme background
|
|
||||||
- **Foreground**: Uses the theme's text color
|
|
||||||
- **Active Background**: Uses the theme's selection/accent color
|
|
||||||
- **Active Foreground**: Uses the theme's selection text color
|
|
||||||
- **Disabled Foreground**: Grayed out color for disabled items
|
|
||||||
|
|
||||||
## Technical Implementation
|
|
||||||
|
|
||||||
### ThemeManager Methods
|
|
||||||
|
|
||||||
#### `get_menu_colors() -> dict[str, str]`
|
|
||||||
Returns a dictionary of colors specifically optimized for menu theming:
|
|
||||||
```python
|
|
||||||
{
|
|
||||||
"bg": "#edeeef", # Menu background
|
|
||||||
"fg": "#5c616c", # Menu text
|
|
||||||
"active_bg": "#0078d4", # Hover background
|
|
||||||
"active_fg": "#ffffff", # Hover text
|
|
||||||
"disabled_fg": "#888888" # Disabled text
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### `configure_menu(menu: tk.Menu) -> None`
|
|
||||||
Applies theme colors to a specific menu widget:
|
|
||||||
```python
|
|
||||||
theme_manager.configure_menu(menubar)
|
|
||||||
theme_manager.configure_menu(file_menu)
|
|
||||||
```
|
|
||||||
|
|
||||||
### Automatic Updates
|
|
||||||
|
|
||||||
When themes are changed using the Theme menu:
|
|
||||||
1. The new theme is applied to all UI components
|
|
||||||
2. The menu setup is refreshed (`_setup_menu()` is called)
|
|
||||||
3. All menus are automatically re-themed with the new colors
|
|
||||||
|
|
||||||
## Usage Example
|
|
||||||
|
|
||||||
```python
|
|
||||||
# Create menu
|
|
||||||
menubar = tk.Menu(root)
|
|
||||||
file_menu = tk.Menu(menubar, tearoff=0)
|
|
||||||
|
|
||||||
# Apply theming
|
|
||||||
theme_manager.configure_menu(menubar)
|
|
||||||
theme_manager.configure_menu(file_menu)
|
|
||||||
|
|
||||||
# Menus will now match the current theme
|
|
||||||
```
|
|
||||||
|
|
||||||
## Color Calculation
|
|
||||||
|
|
||||||
The menu background color is automatically calculated based on the main theme:
|
|
||||||
|
|
||||||
- **Light themes**: Menu background is made slightly darker than the main background
|
|
||||||
- **Dark themes**: Menu background is made slightly lighter than the main background
|
|
||||||
|
|
||||||
This provides subtle visual distinction while maintaining theme consistency.
|
|
||||||
|
|
||||||
## Supported Themes
|
|
||||||
|
|
||||||
Menu theming works with all available themes:
|
|
||||||
- arc
|
|
||||||
- equilux
|
|
||||||
- adapta
|
|
||||||
- yaru
|
|
||||||
- ubuntu
|
|
||||||
- plastik
|
|
||||||
- breeze
|
|
||||||
- elegance
|
|
||||||
|
|
||||||
## Testing
|
|
||||||
|
|
||||||
A test script is available to verify menu theming functionality:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd /home/will/Code/thechart
|
|
||||||
.venv/bin/python scripts/test_menu_theming.py
|
|
||||||
```
|
|
||||||
|
|
||||||
This script creates a test window with menus that can be used to verify theming across different themes.
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
# TheChart Documentation
|
|
||||||
|
|
||||||
Welcome to TheChart documentation! This guide will help you navigate the available documentation for the modern medication tracking application.
|
|
||||||
|
|
||||||
## 📖 Documentation Index
|
|
||||||
|
|
||||||
### For Users
|
|
||||||
- **[README.md](../README.md)** - Quick start guide and installation
|
|
||||||
- **[Features Guide](FEATURES.md)** - Complete feature documentation including new UI/UX improvements
|
|
||||||
- Modern Theme System (8 Professional Themes)
|
|
||||||
- Advanced Keyboard Shortcuts
|
|
||||||
- Smart Tooltip System
|
|
||||||
- Modular Medicine System
|
|
||||||
- Advanced Dose Tracking
|
|
||||||
- Graph Visualizations
|
|
||||||
- Data Management
|
|
||||||
- **[Keyboard Shortcuts](KEYBOARD_SHORTCUTS.md)** - Comprehensive shortcut reference
|
|
||||||
- File operations shortcuts (Ctrl+S, Ctrl+Q, Ctrl+E)
|
|
||||||
- Data management shortcuts (Ctrl+N, Ctrl+R, F5)
|
|
||||||
- Navigation shortcuts (Ctrl+M, Ctrl+P, F1, F2)
|
|
||||||
- **[Export System](EXPORT_SYSTEM.md)** - Data export functionality and formats
|
|
||||||
- JSON, XML, and PDF export options
|
|
||||||
- Graph visualization inclusion
|
|
||||||
- Export manager architecture
|
|
||||||
|
|
||||||
### For Developers
|
|
||||||
- **[Development Guide](DEVELOPMENT.md)** - Development setup and testing
|
|
||||||
- Testing Framework (93% coverage)
|
|
||||||
- Code Quality Tools
|
|
||||||
- Architecture Overview
|
|
||||||
- Debugging Guide
|
|
||||||
|
|
||||||
### Project History
|
|
||||||
- **[Changelog](CHANGELOG.md)** - Version history and feature evolution
|
|
||||||
- Recent UI/UX overhaul (v1.9.5)
|
|
||||||
- Keyboard shortcuts system (v1.7.0)
|
|
||||||
- Medicine and dose tracking improvements
|
|
||||||
- Migration notes and future roadmap
|
|
||||||
|
|
||||||
## 🚀 Quick Navigation
|
|
||||||
|
|
||||||
### Getting Started
|
|
||||||
1. **Installation**: See [README.md - Installation](../README.md#installation)
|
|
||||||
2. **First Run**: See [README.md - Running the Application](../README.md#running-the-application)
|
|
||||||
3. **UI/UX Features**: See [FEATURES.md - Modern UI/UX System](FEATURES.md#-modern-uiux-system-new-in-v195)
|
|
||||||
|
|
||||||
### Using the Application
|
|
||||||
1. **Theme Selection**: See [FEATURES.md - Settings and Theme Management](FEATURES.md#️-settings-and-theme-management)
|
|
||||||
2. **Keyboard Shortcuts**: See [KEYBOARD_SHORTCUTS.md](KEYBOARD_SHORTCUTS.md)
|
|
||||||
3. **Medicine Management**: See [FEATURES.md - Modular Medicine System](FEATURES.md#-modular-medicine-system)
|
|
||||||
4. **Dose Tracking**: See [FEATURES.md - Advanced Dose Tracking](FEATURES.md#-advanced-dose-tracking)
|
|
||||||
5. **Data Export**: See [EXPORT_SYSTEM.md](EXPORT_SYSTEM.md)
|
|
||||||
|
|
||||||
### Development
|
|
||||||
1. **Setup**: See [DEVELOPMENT.md - Development Environment Setup](DEVELOPMENT.md#development-environment-setup)
|
|
||||||
2. **Testing**: See [TESTING.md](TESTING.md) - Comprehensive testing guide
|
|
||||||
3. **Architecture**: See [FEATURES.md - Technical Architecture](FEATURES.md#technical-architecture)
|
|
||||||
4. **Contributing**: See [DEVELOPMENT.md - Development Workflow](DEVELOPMENT.md#development-workflow)
|
|
||||||
|
|
||||||
## 📋 What's New in Documentation
|
|
||||||
|
|
||||||
### Recent Updates (v1.9.5)
|
|
||||||
- **Consolidated Structure**: Merged UI improvements into main features documentation
|
|
||||||
- **Enhanced Features Guide**: Added comprehensive UI/UX documentation
|
|
||||||
- **Updated Changelog**: Detailed UI/UX overhaul documentation
|
|
||||||
- **Improved Navigation**: Better cross-referencing between documents
|
|
||||||
|
|
||||||
### Documentation Highlights
|
|
||||||
- **Professional UI/UX**: Complete documentation of the new theme system
|
|
||||||
- **Keyboard Efficiency**: Comprehensive shortcut system documentation
|
|
||||||
- **Developer-Friendly**: Enhanced development and testing documentation
|
|
||||||
- **User-Focused**: Clear separation of user vs developer documentation
|
|
||||||
|
|
||||||
## 🔍 Finding Information
|
|
||||||
|
|
||||||
### By Topic
|
|
||||||
- **Installation & Setup** → [README.md](../README.md)
|
|
||||||
- **UI/UX and Themes** → [FEATURES.md - Modern UI/UX System](FEATURES.md#-modern-uiux-system-new-in-v195)
|
|
||||||
- **Feature Usage** → [FEATURES.md](FEATURES.md)
|
|
||||||
- **Keyboard Shortcuts** → [KEYBOARD_SHORTCUTS.md](KEYBOARD_SHORTCUTS.md)
|
|
||||||
- **Menu Theming** → [MENU_THEMING.md](MENU_THEMING.md)
|
|
||||||
- **Testing** → [TESTING.md](TESTING.md)
|
|
||||||
- **Data Export** → [EXPORT_SYSTEM.md](EXPORT_SYSTEM.md)
|
|
||||||
- **Development** → [DEVELOPMENT.md](DEVELOPMENT.md)
|
|
||||||
- **Version History** → [CHANGELOG.md](CHANGELOG.md)
|
|
||||||
|
|
||||||
### By User Type
|
|
||||||
- **End Users** → Start with [README.md](../README.md), then [FEATURES.md](FEATURES.md)
|
|
||||||
- **Power Users** → [KEYBOARD_SHORTCUTS.md](KEYBOARD_SHORTCUTS.md) and [EXPORT_SYSTEM.md](EXPORT_SYSTEM.md)
|
|
||||||
- **Developers** → [DEVELOPMENT.md](DEVELOPMENT.md), [TESTING.md](TESTING.md), and [FEATURES.md - Technical Architecture](FEATURES.md#technical-architecture)
|
|
||||||
- **Contributors** → All documentation, especially [DEVELOPMENT.md](DEVELOPMENT.md) and [TESTING.md](TESTING.md)
|
|
||||||
|
|
||||||
### By Task
|
|
||||||
- **Install TheChart** → [README.md - Installation](../README.md#installation)
|
|
||||||
- **Change Theme** → [FEATURES.md - Settings and Theme Management](FEATURES.md#️-settings-and-theme-management)
|
|
||||||
- **Learn Shortcuts** → [KEYBOARD_SHORTCUTS.md](KEYBOARD_SHORTCUTS.md)
|
|
||||||
- **Add New Medicine** → [FEATURES.md - Modular Medicine System](FEATURES.md#-modular-medicine-system)
|
|
||||||
- **Track Doses** → [FEATURES.md - Advanced Dose Tracking](FEATURES.md#-advanced-dose-tracking)
|
|
||||||
- **Export Data** → [EXPORT_SYSTEM.md](EXPORT_SYSTEM.md)
|
|
||||||
- **Run Tests** → [TESTING.md](TESTING.md) - Comprehensive testing guide
|
|
||||||
- **Debug Issues** → [TESTING.md - Troubleshooting](TESTING.md#troubleshooting)
|
|
||||||
- **Deploy Application** → [README.md - Deployment](../README.md#deployment)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Need help?** Check the troubleshooting sections in [README.md](../README.md#troubleshooting) and [DEVELOPMENT.md](DEVELOPMENT.md#debugging-and-troubleshooting).
|
|
||||||
@@ -1,296 +0,0 @@
|
|||||||
# Testing Guide
|
|
||||||
|
|
||||||
This document provides a comprehensive guide to testing in TheChart application.
|
|
||||||
|
|
||||||
## Test Organization
|
|
||||||
|
|
||||||
### Directory Structure
|
|
||||||
|
|
||||||
```
|
|
||||||
thechart/
|
|
||||||
├── tests/ # Unit tests (pytest)
|
|
||||||
│ ├── test_theme_manager.py
|
|
||||||
│ ├── test_data_manager.py
|
|
||||||
│ ├── test_ui_manager.py
|
|
||||||
│ ├── test_graph_manager.py
|
|
||||||
│ └── ...
|
|
||||||
├── scripts/ # Integration tests & demos
|
|
||||||
│ ├── integration_test.py
|
|
||||||
│ ├── test_menu_theming.py
|
|
||||||
│ ├── test_note_saving.py
|
|
||||||
│ └── ...
|
|
||||||
```
|
|
||||||
|
|
||||||
## Test Categories
|
|
||||||
|
|
||||||
### 1. Unit Tests (`/tests/`)
|
|
||||||
|
|
||||||
**Purpose**: Test individual components in isolation
|
|
||||||
**Framework**: pytest
|
|
||||||
**Location**: `/tests/` directory
|
|
||||||
|
|
||||||
#### Running Unit Tests
|
|
||||||
```bash
|
|
||||||
cd /home/will/Code/thechart
|
|
||||||
source .venv/bin/activate.fish
|
|
||||||
python -m pytest tests/
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Available Unit Tests
|
|
||||||
- `test_theme_manager.py` - Theme system and menu theming
|
|
||||||
- `test_data_manager.py` - Data persistence and CSV operations
|
|
||||||
- `test_ui_manager.py` - UI component functionality
|
|
||||||
- `test_graph_manager.py` - Graph generation and display
|
|
||||||
- `test_constants.py` - Application constants
|
|
||||||
- `test_logger.py` - Logging system
|
|
||||||
- `test_main.py` - Main application logic
|
|
||||||
|
|
||||||
#### Writing Unit Tests
|
|
||||||
```python
|
|
||||||
# Example unit test structure
|
|
||||||
import unittest
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
|
|
||||||
# Add src to path
|
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'src'))
|
|
||||||
|
|
||||||
from your_module import YourClass
|
|
||||||
|
|
||||||
class TestYourClass(unittest.TestCase):
|
|
||||||
def setUp(self):
|
|
||||||
"""Set up test fixtures."""
|
|
||||||
pass
|
|
||||||
|
|
||||||
def tearDown(self):
|
|
||||||
"""Clean up after tests."""
|
|
||||||
pass
|
|
||||||
|
|
||||||
def test_functionality(self):
|
|
||||||
"""Test specific functionality."""
|
|
||||||
pass
|
|
||||||
```
|
|
||||||
|
|
||||||
### 2. Integration Tests (`/scripts/`)
|
|
||||||
|
|
||||||
**Purpose**: Test complete workflows and system interactions
|
|
||||||
**Framework**: Custom test scripts
|
|
||||||
**Location**: `/scripts/` directory
|
|
||||||
|
|
||||||
#### Available Integration Tests
|
|
||||||
|
|
||||||
##### `integration_test.py`
|
|
||||||
Comprehensive export system test:
|
|
||||||
- Tests JSON, XML, PDF export formats
|
|
||||||
- Validates data integrity
|
|
||||||
- Tests file creation and cleanup
|
|
||||||
- No GUI dependencies
|
|
||||||
|
|
||||||
```bash
|
|
||||||
.venv/bin/python scripts/integration_test.py
|
|
||||||
```
|
|
||||||
|
|
||||||
##### `test_note_saving.py`
|
|
||||||
Note persistence functionality:
|
|
||||||
- Tests note saving to CSV
|
|
||||||
- Validates special character handling
|
|
||||||
- Tests note retrieval
|
|
||||||
|
|
||||||
##### `test_update_entry.py`
|
|
||||||
Entry modification functionality:
|
|
||||||
- Tests data update operations
|
|
||||||
- Validates date handling
|
|
||||||
- Tests duplicate prevention
|
|
||||||
|
|
||||||
##### `test_keyboard_shortcuts.py`
|
|
||||||
Keyboard shortcut system:
|
|
||||||
- Tests key binding functionality
|
|
||||||
- Validates shortcut responses
|
|
||||||
- Tests keyboard event handling
|
|
||||||
|
|
||||||
### 3. Interactive Demonstrations (`/scripts/`)
|
|
||||||
|
|
||||||
**Purpose**: Visual and interactive testing of UI features
|
|
||||||
**Framework**: tkinter-based demos
|
|
||||||
|
|
||||||
##### `test_menu_theming.py`
|
|
||||||
Interactive menu theming demonstration:
|
|
||||||
- Live theme switching
|
|
||||||
- Visual color display
|
|
||||||
- Real-time menu updates
|
|
||||||
|
|
||||||
```bash
|
|
||||||
.venv/bin/python scripts/test_menu_theming.py
|
|
||||||
```
|
|
||||||
|
|
||||||
## Running Tests
|
|
||||||
|
|
||||||
### Complete Test Suite
|
|
||||||
```bash
|
|
||||||
cd /home/will/Code/thechart
|
|
||||||
source .venv/bin/activate.fish
|
|
||||||
|
|
||||||
# Run unit tests
|
|
||||||
python -m pytest tests/ -v
|
|
||||||
|
|
||||||
# Run integration tests
|
|
||||||
python scripts/integration_test.py
|
|
||||||
|
|
||||||
# Run specific feature tests
|
|
||||||
python scripts/test_note_saving.py
|
|
||||||
python scripts/test_update_entry.py
|
|
||||||
```
|
|
||||||
|
|
||||||
### Individual Test Categories
|
|
||||||
```bash
|
|
||||||
# Unit tests only
|
|
||||||
python -m pytest tests/
|
|
||||||
|
|
||||||
# Specific unit test file
|
|
||||||
python -m pytest tests/test_theme_manager.py -v
|
|
||||||
|
|
||||||
# Integration test
|
|
||||||
python scripts/integration_test.py
|
|
||||||
|
|
||||||
# Interactive demo
|
|
||||||
python scripts/test_menu_theming.py
|
|
||||||
```
|
|
||||||
|
|
||||||
### Test Runner Script
|
|
||||||
```bash
|
|
||||||
# Use the main test runner
|
|
||||||
python scripts/run_tests.py
|
|
||||||
```
|
|
||||||
|
|
||||||
## Test Environment Setup
|
|
||||||
|
|
||||||
### Prerequisites
|
|
||||||
1. **Virtual Environment**: Ensure `.venv` is activated
|
|
||||||
2. **Dependencies**: All requirements installed via `uv`
|
|
||||||
3. **Test Data**: Main `thechart_data.csv` file present
|
|
||||||
|
|
||||||
### Environment Activation
|
|
||||||
```bash
|
|
||||||
# Fish shell
|
|
||||||
source .venv/bin/activate.fish
|
|
||||||
|
|
||||||
# Bash/Zsh
|
|
||||||
source .venv/bin/activate
|
|
||||||
```
|
|
||||||
|
|
||||||
## Writing New Tests
|
|
||||||
|
|
||||||
### Unit Test Guidelines
|
|
||||||
1. Place in `/tests/` directory
|
|
||||||
2. Use pytest framework
|
|
||||||
3. Follow naming convention: `test_<module_name>.py`
|
|
||||||
4. Include setup/teardown for fixtures
|
|
||||||
5. Test edge cases and error conditions
|
|
||||||
|
|
||||||
### Integration Test Guidelines
|
|
||||||
1. Place in `/scripts/` directory
|
|
||||||
2. Test complete workflows
|
|
||||||
3. Include cleanup procedures
|
|
||||||
4. Document expected behavior
|
|
||||||
5. Handle GUI dependencies appropriately
|
|
||||||
|
|
||||||
### Interactive Demo Guidelines
|
|
||||||
1. Place in `/scripts/` directory
|
|
||||||
2. Include clear instructions
|
|
||||||
3. Provide visual feedback
|
|
||||||
4. Allow easy theme/feature switching
|
|
||||||
5. Include exit mechanisms
|
|
||||||
|
|
||||||
## Test Data Management
|
|
||||||
|
|
||||||
### Test File Creation
|
|
||||||
- Use `tempfile` module for temporary files
|
|
||||||
- Clean up created files in teardown
|
|
||||||
- Don't commit test data to repository
|
|
||||||
|
|
||||||
### CSV Test Data
|
|
||||||
- Most tests use main `thechart_data.csv`
|
|
||||||
- Some tests create temporary CSV files
|
|
||||||
- Integration tests may create export directories
|
|
||||||
|
|
||||||
## Continuous Integration
|
|
||||||
|
|
||||||
### Local Testing Workflow
|
|
||||||
```bash
|
|
||||||
# 1. Run linting
|
|
||||||
python -m flake8 src/ tests/ scripts/
|
|
||||||
|
|
||||||
# 2. Run unit tests
|
|
||||||
python -m pytest tests/ -v
|
|
||||||
|
|
||||||
# 3. Run integration tests
|
|
||||||
python scripts/integration_test.py
|
|
||||||
|
|
||||||
# 4. Run specific feature tests as needed
|
|
||||||
python scripts/test_note_saving.py
|
|
||||||
```
|
|
||||||
|
|
||||||
### Pre-commit Checklist
|
|
||||||
- [ ] All unit tests pass
|
|
||||||
- [ ] Integration tests pass
|
|
||||||
- [ ] New functionality has tests
|
|
||||||
- [ ] Documentation updated
|
|
||||||
- [ ] Code follows style guidelines
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
### Common Issues
|
|
||||||
|
|
||||||
#### Import Errors
|
|
||||||
```python
|
|
||||||
# Ensure src is in path
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'src'))
|
|
||||||
```
|
|
||||||
|
|
||||||
#### GUI Test Issues
|
|
||||||
- Use `root.withdraw()` to hide test windows
|
|
||||||
- Ensure proper cleanup with `root.destroy()`
|
|
||||||
- Consider mocking GUI components for unit tests
|
|
||||||
|
|
||||||
#### File Permission Issues
|
|
||||||
- Ensure test has write permissions
|
|
||||||
- Use temporary directories for test files
|
|
||||||
- Clean up files in teardown methods
|
|
||||||
|
|
||||||
### Debug Mode
|
|
||||||
```bash
|
|
||||||
# Run with debug logging
|
|
||||||
python -c "import logging; logging.basicConfig(level=logging.DEBUG)" scripts/test_script.py
|
|
||||||
```
|
|
||||||
|
|
||||||
## Test Coverage
|
|
||||||
|
|
||||||
### Current Coverage Areas
|
|
||||||
- ✅ Theme management and menu theming
|
|
||||||
- ✅ Data persistence and CSV operations
|
|
||||||
- ✅ Export functionality (JSON, XML, PDF)
|
|
||||||
- ✅ UI component initialization
|
|
||||||
- ✅ Graph generation
|
|
||||||
- ✅ Note saving and retrieval
|
|
||||||
- ✅ Entry update operations
|
|
||||||
- ✅ Keyboard shortcuts
|
|
||||||
|
|
||||||
### Areas for Expansion
|
|
||||||
- Medicine and pathology management
|
|
||||||
- Settings persistence
|
|
||||||
- Error handling edge cases
|
|
||||||
- Performance testing
|
|
||||||
- UI interaction testing
|
|
||||||
|
|
||||||
## Contributing Tests
|
|
||||||
|
|
||||||
When contributing new tests:
|
|
||||||
|
|
||||||
1. **Choose the right category**: Unit vs Integration vs Demo
|
|
||||||
2. **Follow naming conventions**: Clear, descriptive names
|
|
||||||
3. **Include documentation**: Docstrings and comments
|
|
||||||
4. **Test edge cases**: Not just happy path
|
|
||||||
5. **Clean up resources**: Temporary files, windows, etc.
|
|
||||||
6. **Update documentation**: Add to this guide and scripts/README.md
|
|
||||||
@@ -1,269 +0,0 @@
|
|||||||
# Changelog
|
|
||||||
|
|
||||||
All notable changes to TheChart project are documented in this file.
|
|
||||||
|
|
||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
||||||
|
|
||||||
## [1.9.5] - 2025-08-05
|
|
||||||
|
|
||||||
### 🎨 Major UI/UX Overhaul
|
|
||||||
- **Added**: Professional theme system with ttkthemes integration
|
|
||||||
- **Added**: 8 curated themes (Arc, Equilux, Adapta, Yaru, Ubuntu, Plastik, Breeze, Elegance)
|
|
||||||
- **Added**: Dynamic theme switching without restart
|
|
||||||
- **Added**: Theme persistence between sessions
|
|
||||||
- **Added**: Comprehensive settings window with tabbed interface
|
|
||||||
- **Added**: Smart tooltip system with context-sensitive help
|
|
||||||
- **Improved**: Table selection highlighting and alternating row colors
|
|
||||||
- **Improved**: Modern styling for all UI components (buttons, frames, forms)
|
|
||||||
- **Improved**: Professional card-style layouts and enhanced spacing
|
|
||||||
|
|
||||||
### ⚙️ Settings and Configuration System
|
|
||||||
- **Added**: Advanced settings window (accessible via F2)
|
|
||||||
- **Added**: Theme selection with live preview
|
|
||||||
- **Added**: UI preferences and customization options
|
|
||||||
- **Added**: About dialog with detailed application information
|
|
||||||
- **Added**: Settings persistence across application restarts
|
|
||||||
|
|
||||||
### 💡 Enhanced User Experience
|
|
||||||
- **Added**: Intelligent tooltips for all interactive elements
|
|
||||||
- **Added**: Specialized help for pathology scales and medicine options
|
|
||||||
- **Added**: Non-intrusive tooltip timing (500-800ms delay)
|
|
||||||
- **Added**: Quick theme switching via menu bar
|
|
||||||
- **Improved**: Visual hierarchy with better typography and spacing
|
|
||||||
- **Improved**: Professional color schemes across all themes
|
|
||||||
|
|
||||||
### 🏗️ Technical Architecture Improvements
|
|
||||||
- **Added**: Modular theme manager with dependency injection
|
|
||||||
- **Added**: Tooltip management system
|
|
||||||
- **Added**: Enhanced UI manager with theme integration
|
|
||||||
- **Improved**: Code organization with separate concerns
|
|
||||||
- **Improved**: Error handling with graceful theme fallbacks
|
|
||||||
|
|
||||||
## [1.7.0] - 2025-08-05
|
|
||||||
|
|
||||||
### ⌨️ Keyboard Shortcuts System
|
|
||||||
- **Added**: Comprehensive keyboard shortcuts for improved productivity
|
|
||||||
- **Added**: File operations shortcuts (Ctrl+S, Ctrl+Q, Ctrl+E)
|
|
||||||
- **Added**: Data management shortcuts (Ctrl+N, Ctrl+R, F5)
|
|
||||||
- **Added**: Window management shortcuts (Ctrl+M, Ctrl+P)
|
|
||||||
- **Added**: Table operation shortcuts (Delete, Escape)
|
|
||||||
- **Added**: Help system shortcut (F1)
|
|
||||||
- **Added**: Menu integration showing shortcuts next to menu items
|
|
||||||
- **Added**: Button labels updated to show primary shortcuts
|
|
||||||
- **Added**: In-app help dialog accessible via F1
|
|
||||||
- **Added**: Status bar feedback for all keyboard operations
|
|
||||||
- **Improved**: Button text shows shortcuts (e.g., "Add Entry (Ctrl+S)")
|
|
||||||
- **Improved**: Case-insensitive shortcuts (Ctrl+S and Ctrl+Shift+S both work)
|
|
||||||
|
|
||||||
#### Keyboard Shortcuts Added:
|
|
||||||
- **Ctrl+S**: Save/Add new entry
|
|
||||||
- **Ctrl+Q**: Quit application (with confirmation)
|
|
||||||
- **Ctrl+E**: Export data
|
|
||||||
- **Ctrl+N**: Clear entries
|
|
||||||
- **Ctrl+R / F5**: Refresh data
|
|
||||||
- **Ctrl+M**: Manage medicines
|
|
||||||
- **Ctrl+P**: Manage pathologies
|
|
||||||
- **Delete**: Delete selected entry (with confirmation)
|
|
||||||
- **Escape**: Clear selection
|
|
||||||
- **F1**: Show keyboard shortcuts help
|
|
||||||
|
|
||||||
### 📚 Documentation Updates
|
|
||||||
- **Updated**: FEATURES.md with keyboard shortcuts section
|
|
||||||
- **Added**: KEYBOARD_SHORTCUTS.md with comprehensive shortcut reference
|
|
||||||
- **Updated**: In-app help system with shortcut information
|
|
||||||
- **Updated**: About dialog with keyboard shortcut mention
|
|
||||||
|
|
||||||
## [1.6.1] - 2025-07-31
|
|
||||||
|
|
||||||
### 📚 Documentation Overhaul
|
|
||||||
- **BREAKING**: Consolidated scattered documentation into organized structure
|
|
||||||
- **Added**: Comprehensive `docs/FEATURES.md` with complete feature documentation
|
|
||||||
- **Added**: Detailed `docs/DEVELOPMENT.md` with testing and development guide
|
|
||||||
- **Updated**: Streamlined `README.md` with quick-start focus and navigation
|
|
||||||
- **Removed**: 10 redundant/outdated markdown files
|
|
||||||
- **Improved**: Clear separation between user and developer documentation
|
|
||||||
|
|
||||||
### 🏗️ Documentation Structure
|
|
||||||
```
|
|
||||||
docs/
|
|
||||||
├── FEATURES.md # Complete feature guide (new)
|
|
||||||
├── DEVELOPMENT.md # Development & testing guide (new)
|
|
||||||
└── CHANGELOG.md # This changelog (new)
|
|
||||||
|
|
||||||
README.md # Streamlined quick-start guide (updated)
|
|
||||||
```
|
|
||||||
|
|
||||||
## [1.3.3] - Previous Releases
|
|
||||||
|
|
||||||
### 🏥 Modular Medicine System
|
|
||||||
- **Added**: Dynamic medicine management system
|
|
||||||
- **Added**: JSON-based medicine configuration (`medicines.json`)
|
|
||||||
- **Added**: Medicine management UI (`Tools` → `Manage Medicines...`)
|
|
||||||
- **Added**: Configurable medicine properties (colors, doses, names)
|
|
||||||
- **Added**: Automatic UI updates when medicines change
|
|
||||||
- **Added**: Backward compatibility with existing data
|
|
||||||
|
|
||||||
### 💊 Advanced Dose Tracking System
|
|
||||||
- **Added**: Precise timestamp recording for medicine doses
|
|
||||||
- **Added**: Multiple daily dose support for same medicine
|
|
||||||
- **Added**: Comprehensive dose tracking interface in edit windows
|
|
||||||
- **Added**: Quick-dose buttons for common amounts
|
|
||||||
- **Added**: Real-time dose display and feedback
|
|
||||||
- **Added**: Historical dose data persistence in CSV
|
|
||||||
- **Improved**: Dose format parsing with robust error handling
|
|
||||||
|
|
||||||
#### Punch Button Redesign
|
|
||||||
- **Moved**: Dose tracking from main input to edit window
|
|
||||||
- **Added**: Individual dose entry fields per medicine
|
|
||||||
- **Added**: "Take [Medicine]" buttons with immediate recording
|
|
||||||
- **Added**: Editable dose display areas with history
|
|
||||||
- **Improved**: User experience with centralized dose management
|
|
||||||
|
|
||||||
### 📊 Enhanced Graph Visualization
|
|
||||||
- **Added**: Medicine dose bar charts with distinct colors
|
|
||||||
- **Added**: Interactive toggle controls for symptoms and medicines
|
|
||||||
- **Added**: Enhanced legend with multi-column layout
|
|
||||||
- **Added**: Average dosage calculations and displays
|
|
||||||
- **Added**: Professional styling with transparency and shadows
|
|
||||||
- **Improved**: Graph layout with dynamic positioning
|
|
||||||
|
|
||||||
#### Medicine Dose Plotting
|
|
||||||
- **Added**: Visual representation of daily medication intake
|
|
||||||
- **Added**: Scaled dose display (mg/10) for chart compatibility
|
|
||||||
- **Added**: Color-coded bars for each medicine
|
|
||||||
- **Added**: Semi-transparent rendering to preserve symptom visibility
|
|
||||||
- **Fixed**: Dose calculation logic for complex timestamp formats
|
|
||||||
|
|
||||||
#### Legend Enhancements
|
|
||||||
- **Added**: Multi-column legend layout (2 columns)
|
|
||||||
- **Added**: Average dosage information per medicine
|
|
||||||
- **Added**: Tracking status for medicines without current doses
|
|
||||||
- **Added**: Frame, shadow, and transparency effects
|
|
||||||
- **Improved**: Space utilization and readability
|
|
||||||
|
|
||||||
### 🧪 Comprehensive Testing Framework
|
|
||||||
- **Added**: Professional testing infrastructure with pytest
|
|
||||||
- **Added**: 93% code coverage across 112 tests
|
|
||||||
- **Added**: Coverage reporting (HTML, XML, terminal)
|
|
||||||
- **Added**: Pre-commit testing hooks
|
|
||||||
- **Added**: Comprehensive dose calculation testing
|
|
||||||
- **Added**: UI component testing with mocking
|
|
||||||
- **Added**: Medicine plotting and legend testing
|
|
||||||
|
|
||||||
#### Test Infrastructure
|
|
||||||
- **Added**: `tests/conftest.py` with shared fixtures
|
|
||||||
- **Added**: Sample data generators for realistic testing
|
|
||||||
- **Added**: Mock loggers and temporary file management
|
|
||||||
- **Added**: Environment variable mocking
|
|
||||||
|
|
||||||
#### Pre-commit Testing
|
|
||||||
- **Added**: Automated testing before commits
|
|
||||||
- **Added**: Core functionality validation (3 essential tests)
|
|
||||||
- **Added**: Commit blocking on test failures
|
|
||||||
- **Configured**: `.pre-commit-config.yaml` with testing hooks
|
|
||||||
|
|
||||||
### 🏗️ Technical Architecture Improvements
|
|
||||||
- **Added**: Modular component architecture
|
|
||||||
- **Added**: MedicineManager and PathologyManager classes
|
|
||||||
- **Added**: Dynamic UI generation based on configuration
|
|
||||||
- **Improved**: Separation of concerns across modules
|
|
||||||
- **Enhanced**: Error handling and logging throughout
|
|
||||||
|
|
||||||
### 📈 Data Management Enhancements
|
|
||||||
- **Added**: Automatic data migration and backup system
|
|
||||||
- **Added**: Dynamic CSV column management
|
|
||||||
- **Added**: Robust dose string parsing
|
|
||||||
- **Improved**: Data validation and error handling
|
|
||||||
- **Enhanced**: Backward compatibility preservation
|
|
||||||
|
|
||||||
### 🔧 Development Tools & Workflow
|
|
||||||
- **Added**: uv integration for fast package management
|
|
||||||
- **Added**: Comprehensive Makefile with development commands
|
|
||||||
- **Added**: Docker support with multi-platform builds
|
|
||||||
- **Added**: Pre-commit hooks for code quality
|
|
||||||
- **Added**: Ruff for fast Python formatting and linting
|
|
||||||
- **Improved**: Virtual environment management
|
|
||||||
|
|
||||||
### 🚀 Deployment & Distribution
|
|
||||||
- **Added**: PyInstaller integration for standalone executables
|
|
||||||
- **Added**: Linux desktop integration
|
|
||||||
- **Added**: Automatic file installation and desktop entries
|
|
||||||
- **Added**: Docker containerization support
|
|
||||||
- **Improved**: Build and deployment automation
|
|
||||||
|
|
||||||
## Technical Details
|
|
||||||
|
|
||||||
### Dependencies
|
|
||||||
- **Runtime**: Python 3.13+, matplotlib, pandas, tkinter, colorlog
|
|
||||||
- **Development**: pytest, pytest-cov, ruff, pre-commit, pyinstaller
|
|
||||||
- **Package Management**: uv (Rust-based, 10-100x faster than pip/Poetry)
|
|
||||||
|
|
||||||
### Architecture
|
|
||||||
- **Frontend**: Tkinter-based GUI with dynamic component generation
|
|
||||||
- **Backend**: Pandas for data manipulation, Matplotlib for visualization
|
|
||||||
- **Storage**: CSV-based with JSON configuration files
|
|
||||||
- **Testing**: pytest with comprehensive mocking and coverage
|
|
||||||
|
|
||||||
### File Structure
|
|
||||||
```
|
|
||||||
src/ # Main application code
|
|
||||||
├── main.py # Application entry point
|
|
||||||
├── ui_manager.py # User interface management
|
|
||||||
├── data_manager.py # CSV operations and data persistence
|
|
||||||
├── graph_manager.py # Visualization and plotting
|
|
||||||
├── medicine_manager.py # Medicine system management
|
|
||||||
└── pathology_manager.py # Symptom tracking
|
|
||||||
|
|
||||||
tests/ # Comprehensive test suite (112 tests, 93% coverage)
|
|
||||||
docs/ # Organized documentation
|
|
||||||
├── FEATURES.md # Complete feature documentation
|
|
||||||
├── DEVELOPMENT.md # Development and testing guide
|
|
||||||
└── CHANGELOG.md # This changelog
|
|
||||||
|
|
||||||
Configuration Files:
|
|
||||||
├── medicines.json # Medicine definitions (auto-generated)
|
|
||||||
├── pathologies.json # Symptom categories (auto-generated)
|
|
||||||
├── pyproject.toml # Project configuration
|
|
||||||
└── uv.lock # Dependency lock file
|
|
||||||
```
|
|
||||||
|
|
||||||
## Migration Notes
|
|
||||||
|
|
||||||
### From Previous Versions
|
|
||||||
- **Data Compatibility**: All existing CSV data continues to work
|
|
||||||
- **Automatic Migration**: Data structure updates handled automatically
|
|
||||||
- **Backup Creation**: Automatic backups before major changes
|
|
||||||
- **No Data Loss**: Existing functionality preserved during updates
|
|
||||||
|
|
||||||
### Configuration Migration
|
|
||||||
- **Medicine System**: Hard-coded medicines converted to JSON configuration
|
|
||||||
- **UI Updates**: Interface automatically adapts to new medicine definitions
|
|
||||||
- **Graph Integration**: Visualization system updated for dynamic medicines
|
|
||||||
|
|
||||||
## Future Roadmap
|
|
||||||
|
|
||||||
### Planned Features (v2.0)
|
|
||||||
- **Mobile App**: Companion mobile application for dose tracking
|
|
||||||
- **Cloud Sync**: Multi-device data synchronization
|
|
||||||
- **Advanced Analytics**: Machine learning-based trend analysis
|
|
||||||
- **Reminder System**: Intelligent medication reminders
|
|
||||||
- **Doctor Integration**: Healthcare provider report generation
|
|
||||||
|
|
||||||
### Platform Expansion
|
|
||||||
- **macOS Support**: Native macOS application
|
|
||||||
- **Windows Support**: Windows executable and installer
|
|
||||||
- **Web Interface**: Browser-based version for universal access
|
|
||||||
|
|
||||||
### API Development
|
|
||||||
- **REST API**: External system integration
|
|
||||||
- **Plugin Architecture**: Third-party extension support
|
|
||||||
- **Data Export**: Multiple format support (JSON, XML, etc.)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Contributing
|
|
||||||
|
|
||||||
This project follows semantic versioning and maintains comprehensive documentation.
|
|
||||||
For development guidelines, see [docs/DEVELOPMENT.md](docs/DEVELOPMENT.md).
|
|
||||||
For feature information, see [docs/FEATURES.md](docs/FEATURES.md).
|
|
||||||
@@ -1,340 +0,0 @@
|
|||||||
# TheChart - Development Documentation
|
|
||||||
|
|
||||||
## Development Environment Setup
|
|
||||||
|
|
||||||
### Prerequisites
|
|
||||||
- **Python 3.13+**: Required for the application
|
|
||||||
- **uv**: Fast Python package manager (10-100x faster than pip/Poetry)
|
|
||||||
- **Git**: Version control
|
|
||||||
|
|
||||||
### Quick Setup
|
|
||||||
```bash
|
|
||||||
# Clone and setup
|
|
||||||
git clone <repository-url>
|
|
||||||
cd thechart
|
|
||||||
|
|
||||||
# Install with uv (recommended)
|
|
||||||
make install
|
|
||||||
|
|
||||||
# Or manual setup
|
|
||||||
uv venv --python 3.13
|
|
||||||
uv sync
|
|
||||||
uv run pre-commit install --install-hooks --overwrite
|
|
||||||
```
|
|
||||||
|
|
||||||
### Environment Activation
|
|
||||||
```bash
|
|
||||||
# fish shell (default)
|
|
||||||
source .venv/bin/activate.fish
|
|
||||||
# or
|
|
||||||
make shell
|
|
||||||
|
|
||||||
# bash/zsh
|
|
||||||
source .venv/bin/activate
|
|
||||||
|
|
||||||
# Using uv run (recommended)
|
|
||||||
uv run python src/main.py
|
|
||||||
```
|
|
||||||
|
|
||||||
## Testing Framework
|
|
||||||
|
|
||||||
### Test Infrastructure
|
|
||||||
Professional testing setup with comprehensive coverage and automation.
|
|
||||||
|
|
||||||
#### Testing Tools
|
|
||||||
- **pytest**: Modern Python testing framework
|
|
||||||
- **pytest-cov**: Coverage reporting (HTML, XML, terminal)
|
|
||||||
- **pytest-mock**: Mocking support for isolated testing
|
|
||||||
- **coverage**: Detailed coverage analysis
|
|
||||||
|
|
||||||
#### Test Statistics
|
|
||||||
- **93% Overall Code Coverage** (482 total statements, 33 missed)
|
|
||||||
- **112 Total Tests** across 6 test modules
|
|
||||||
- **80 Tests Passing** (71.4% pass rate)
|
|
||||||
|
|
||||||
#### Coverage by Module
|
|
||||||
| Module | Coverage | Status |
|
|
||||||
|--------|----------|--------|
|
|
||||||
| constants.py | 100% | ✅ Complete |
|
|
||||||
| logger.py | 100% | ✅ Complete |
|
|
||||||
| graph_manager.py | 97% | ✅ Excellent |
|
|
||||||
| init.py | 95% | ✅ Excellent |
|
|
||||||
| ui_manager.py | 93% | ✅ Very Good |
|
|
||||||
| main.py | 91% | ✅ Very Good |
|
|
||||||
| data_manager.py | 87% | ✅ Good |
|
|
||||||
|
|
||||||
### Test Structure
|
|
||||||
|
|
||||||
#### Test Files
|
|
||||||
- **`tests/test_data_manager.py`** (16 tests): CSV operations, validation, error handling
|
|
||||||
- **`tests/test_graph_manager.py`** (14 tests): Matplotlib integration, dose calculations
|
|
||||||
- **`tests/test_ui_manager.py`** (21 tests): Tkinter UI components, user interactions
|
|
||||||
- **`tests/test_main.py`** (18 tests): Application integration, workflow testing
|
|
||||||
- **`tests/test_constants.py`** (12 tests): Configuration validation
|
|
||||||
- **`tests/test_logger.py`** (8 tests): Logging functionality
|
|
||||||
- **`tests/test_init.py`** (23 tests): Initialization and setup
|
|
||||||
|
|
||||||
#### Test Fixtures (`tests/conftest.py`)
|
|
||||||
- **Temporary Files**: Safe testing without affecting real data
|
|
||||||
- **Sample Data**: Comprehensive test datasets with realistic dose information
|
|
||||||
- **Mock Loggers**: Isolated logging for testing
|
|
||||||
- **Environment Mocking**: Controlled test environments
|
|
||||||
|
|
||||||
### Running Tests
|
|
||||||
|
|
||||||
#### Basic Testing
|
|
||||||
```bash
|
|
||||||
# Run all tests
|
|
||||||
make test
|
|
||||||
# or
|
|
||||||
uv run pytest
|
|
||||||
|
|
||||||
# Run specific test file
|
|
||||||
uv run pytest tests/test_graph_manager.py -v
|
|
||||||
|
|
||||||
# Run tests with specific pattern
|
|
||||||
uv run pytest -k "dose_calculation" -v
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Coverage Testing
|
|
||||||
```bash
|
|
||||||
# Generate coverage report
|
|
||||||
uv run pytest --cov=src --cov-report=html
|
|
||||||
|
|
||||||
# Coverage with specific module
|
|
||||||
uv run pytest tests/test_graph_manager.py --cov=src.graph_manager --cov-report=term-missing
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Continuous Testing
|
|
||||||
```bash
|
|
||||||
# Watch for changes and re-run tests
|
|
||||||
uv run pytest --watch
|
|
||||||
|
|
||||||
# Quick test runner script
|
|
||||||
./scripts/run_tests.py
|
|
||||||
```
|
|
||||||
|
|
||||||
### Pre-commit Testing
|
|
||||||
Automated testing prevents commits when core functionality is broken.
|
|
||||||
|
|
||||||
#### Configuration
|
|
||||||
Located in `.pre-commit-config.yaml`:
|
|
||||||
- **Core Tests**: 3 essential tests run before each commit
|
|
||||||
- **Fast Execution**: Only critical functionality tested
|
|
||||||
- **Commit Blocking**: Prevents commits when tests fail
|
|
||||||
|
|
||||||
#### Core Tests
|
|
||||||
1. **`test_init`**: DataManager initialization
|
|
||||||
2. **`test_initialize_csv_creates_file_with_headers`**: CSV file creation
|
|
||||||
3. **`test_load_data_with_valid_data`**: Data loading functionality
|
|
||||||
|
|
||||||
#### Usage
|
|
||||||
```bash
|
|
||||||
# Automatic on commit
|
|
||||||
git commit -m "Your changes"
|
|
||||||
|
|
||||||
# Manual pre-commit check
|
|
||||||
pre-commit run --all-files
|
|
||||||
|
|
||||||
# Run just test check
|
|
||||||
pre-commit run pytest-check --all-files
|
|
||||||
```
|
|
||||||
|
|
||||||
### Dose Calculation Testing
|
|
||||||
Comprehensive testing for the complex dose parsing and calculation system.
|
|
||||||
|
|
||||||
#### Test Categories
|
|
||||||
- **Standard Format**: `2025-07-28 18:59:45:150mg` → 150.0mg
|
|
||||||
- **Multiple Doses**: `2025-07-28 18:59:45:150mg|2025-07-28 19:34:19:75mg` → 225.0mg
|
|
||||||
- **With Symbols**: `• • • • 2025-07-30 07:50:00:300` → 300.0mg
|
|
||||||
- **Decimal Values**: `2025-07-28 18:59:45:12.5mg|2025-07-28 19:34:19:7.5mg` → 20.0mg
|
|
||||||
- **No Timestamps**: `100mg|50mg` → 150.0mg
|
|
||||||
- **Mixed Formats**: `• 2025-07-30 22:50:00:10|75mg` → 85.0mg
|
|
||||||
- **Edge Cases**: Empty strings, NaN values, malformed data → 0.0mg
|
|
||||||
|
|
||||||
#### Test Implementation
|
|
||||||
```python
|
|
||||||
# Example test case
|
|
||||||
def test_calculate_daily_dose_standard_format(self, graph_manager):
|
|
||||||
dose_str = "2025-07-28 18:59:45:150mg|2025-07-28 19:34:19:75mg"
|
|
||||||
result = graph_manager._calculate_daily_dose(dose_str)
|
|
||||||
assert result == 225.0
|
|
||||||
```
|
|
||||||
|
|
||||||
### Medicine Plotting Tests
|
|
||||||
Testing for the enhanced graph functionality with medicine dose visualization.
|
|
||||||
|
|
||||||
#### Test Areas
|
|
||||||
- **Toggle Functionality**: Medicine show/hide controls
|
|
||||||
- **Dose Plotting**: Bar chart generation for medicine doses
|
|
||||||
- **Color Coding**: Proper color assignment and consistency
|
|
||||||
- **Legend Enhancement**: Multi-column layout and average calculations
|
|
||||||
- **Data Integration**: Proper data flow from CSV to visualization
|
|
||||||
|
|
||||||
### UI Testing Strategy
|
|
||||||
Testing user interface components with mock frameworks to avoid GUI dependencies.
|
|
||||||
|
|
||||||
#### UI Test Coverage
|
|
||||||
- **Component Creation**: Widget creation and configuration
|
|
||||||
- **Event Handling**: User interactions and callbacks
|
|
||||||
- **Data Binding**: Variable synchronization and updates
|
|
||||||
- **Layout Management**: Grid and frame arrangements
|
|
||||||
- **Error Handling**: User input validation and error messages
|
|
||||||
|
|
||||||
#### Mocking Strategy
|
|
||||||
```python
|
|
||||||
# Example UI test with mocking
|
|
||||||
@patch('tkinter.Tk')
|
|
||||||
def test_create_input_frame(self, mock_tk, ui_manager):
|
|
||||||
parent = Mock()
|
|
||||||
result = ui_manager.create_input_frame(parent, {}, {})
|
|
||||||
assert result is not None
|
|
||||||
assert isinstance(result, dict)
|
|
||||||
```
|
|
||||||
|
|
||||||
## Code Quality
|
|
||||||
|
|
||||||
### Tools and Standards
|
|
||||||
- **ruff**: Fast Python linter and formatter (Rust-based)
|
|
||||||
- **pre-commit**: Git hook management for code quality
|
|
||||||
- **Type Hints**: Comprehensive type annotations
|
|
||||||
- **Docstrings**: Detailed function and class documentation
|
|
||||||
|
|
||||||
### Code Formatting
|
|
||||||
```bash
|
|
||||||
# Format code
|
|
||||||
make format
|
|
||||||
# or
|
|
||||||
uv run ruff format .
|
|
||||||
|
|
||||||
# Check formatting
|
|
||||||
make lint
|
|
||||||
# or
|
|
||||||
uv run ruff check .
|
|
||||||
```
|
|
||||||
|
|
||||||
### Pre-commit Hooks
|
|
||||||
Automatically installed hooks ensure code quality:
|
|
||||||
- **Code Formatting**: ruff formatting
|
|
||||||
- **Linting Checks**: Code quality validation
|
|
||||||
- **Import Sorting**: Consistent import organization
|
|
||||||
- **Basic File Checks**: Trailing whitespace, file endings
|
|
||||||
|
|
||||||
## Development Workflow
|
|
||||||
|
|
||||||
### Feature Development
|
|
||||||
1. **Create Feature Branch**: `git checkout -b feature/new-feature`
|
|
||||||
2. **Implement Changes**: Follow existing patterns and architecture
|
|
||||||
3. **Add Tests**: Ensure new functionality is tested
|
|
||||||
4. **Run Tests**: `make test` to verify functionality
|
|
||||||
5. **Code Quality**: `make format && make lint`
|
|
||||||
6. **Commit Changes**: Pre-commit hooks run automatically
|
|
||||||
7. **Create Pull Request**: For code review
|
|
||||||
|
|
||||||
### Medicine System Development
|
|
||||||
Adding new medicines or modifying the medicine system:
|
|
||||||
|
|
||||||
```python
|
|
||||||
# Example: Adding a new medicine programmatically
|
|
||||||
from medicine_manager import MedicineManager, Medicine
|
|
||||||
|
|
||||||
medicine_manager = MedicineManager()
|
|
||||||
new_medicine = Medicine(
|
|
||||||
key="sertraline",
|
|
||||||
display_name="Sertraline",
|
|
||||||
dosage_info="50mg",
|
|
||||||
quick_doses=["25", "50", "100"],
|
|
||||||
color="#9B59B6",
|
|
||||||
default_enabled=False
|
|
||||||
)
|
|
||||||
medicine_manager.add_medicine(new_medicine)
|
|
||||||
```
|
|
||||||
|
|
||||||
### Testing New Features
|
|
||||||
1. **Unit Tests**: Add tests for new functionality
|
|
||||||
2. **Integration Tests**: Test feature integration with existing system
|
|
||||||
3. **UI Tests**: Test user interface changes
|
|
||||||
4. **Dose Calculation Tests**: If affecting dose calculations
|
|
||||||
5. **Regression Tests**: Ensure existing functionality still works
|
|
||||||
|
|
||||||
## Debugging and Troubleshooting
|
|
||||||
|
|
||||||
### Logging
|
|
||||||
Application logs are stored in `logs/` directory:
|
|
||||||
- **`app.log`**: General application logs
|
|
||||||
- **`app.error.log`**: Error messages only
|
|
||||||
- **`app.warning.log`**: Warning messages only
|
|
||||||
|
|
||||||
### Debug Mode
|
|
||||||
Enable debug logging by modifying `src/logger.py` configuration.
|
|
||||||
|
|
||||||
### Common Issues
|
|
||||||
|
|
||||||
#### Test Failures
|
|
||||||
- **Matplotlib Mocking**: Ensure proper matplotlib component mocking
|
|
||||||
- **Tkinter Dependencies**: Use headless testing for UI components
|
|
||||||
- **File Path Issues**: Use absolute paths in tests
|
|
||||||
- **Mock Configuration**: Proper mock setup for external dependencies
|
|
||||||
|
|
||||||
#### Development Environment
|
|
||||||
- **Python Version**: Ensure Python 3.13+ is used
|
|
||||||
- **Virtual Environment**: Always work within the virtual environment
|
|
||||||
- **Dependencies**: Keep dependencies up to date with `uv sync --upgrade`
|
|
||||||
|
|
||||||
### Performance Testing
|
|
||||||
- **Dose Calculation Performance**: Test with large datasets
|
|
||||||
- **UI Responsiveness**: Test with extensive medicine lists
|
|
||||||
- **Memory Usage**: Monitor memory consumption with large CSV files
|
|
||||||
- **Graph Rendering**: Test graph performance with large datasets
|
|
||||||
|
|
||||||
## Architecture Documentation
|
|
||||||
|
|
||||||
### Core Components
|
|
||||||
- **MedTrackerApp**: Main application class
|
|
||||||
- **MedicineManager**: Medicine CRUD operations
|
|
||||||
- **PathologyManager**: Pathology/symptom management
|
|
||||||
- **GraphManager**: Visualization and plotting
|
|
||||||
- **UIManager**: User interface creation
|
|
||||||
- **DataManager**: Data persistence and CSV operations
|
|
||||||
|
|
||||||
### Data Flow
|
|
||||||
1. **User Input** → UIManager → DataManager → CSV
|
|
||||||
2. **Data Loading** → DataManager → pandas DataFrame → GraphManager
|
|
||||||
3. **Visualization** → GraphManager → matplotlib → UI Display
|
|
||||||
|
|
||||||
### Extension Points
|
|
||||||
- **Medicine System**: Add new medicine properties
|
|
||||||
- **Graph Types**: Add new visualization types
|
|
||||||
- **Export Formats**: Add new data export options
|
|
||||||
- **UI Components**: Add new interface elements
|
|
||||||
|
|
||||||
## Deployment Testing
|
|
||||||
|
|
||||||
### Standalone Executable
|
|
||||||
```bash
|
|
||||||
# Build executable
|
|
||||||
make deploy
|
|
||||||
|
|
||||||
# Test deployment
|
|
||||||
./dist/thechart
|
|
||||||
```
|
|
||||||
|
|
||||||
### Docker Testing
|
|
||||||
```bash
|
|
||||||
# Build container
|
|
||||||
make build
|
|
||||||
|
|
||||||
# Test container
|
|
||||||
make start
|
|
||||||
make attach
|
|
||||||
```
|
|
||||||
|
|
||||||
### Cross-platform Testing
|
|
||||||
- **Linux**: Primary development and testing platform
|
|
||||||
- **macOS**: Planned support (testing needed)
|
|
||||||
- **Windows**: Planned support (testing needed)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
For user documentation, see [README.md](../README.md).
|
|
||||||
For feature details, see [docs/FEATURES.md](FEATURES.md).
|
|
||||||
@@ -1,123 +0,0 @@
|
|||||||
# Documentation Consolidation Summary
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
This document summarizes the documentation consolidation and updates performed to improve the TheChart project documentation structure.
|
|
||||||
|
|
||||||
## Changes Made
|
|
||||||
|
|
||||||
### 1. Documentation Structure Consolidation
|
|
||||||
- **Removed**: `docs/UI_IMPROVEMENTS.md` (redundant file)
|
|
||||||
- **Consolidated**: UI/UX improvements documentation into `docs/FEATURES.md`
|
|
||||||
- **Enhanced**: Main `README.md` with recent updates section
|
|
||||||
- **Updated**: `docs/README.md` (documentation index) with comprehensive navigation
|
|
||||||
|
|
||||||
### 2. Content Integration
|
|
||||||
|
|
||||||
#### FEATURES.md Enhancements
|
|
||||||
- **Added**: Modern UI/UX System section (new in v1.9.5)
|
|
||||||
- **Added**: Professional Theme Engine documentation
|
|
||||||
- **Added**: Comprehensive Keyboard Shortcuts section
|
|
||||||
- **Added**: Settings and Theme Management documentation
|
|
||||||
- **Added**: Smart Tooltip System documentation
|
|
||||||
- **Added**: Enhanced Technical Architecture section
|
|
||||||
- **Added**: UI/UX Technical Implementation section
|
|
||||||
|
|
||||||
#### CHANGELOG.md Updates
|
|
||||||
- **Added**: Version 1.9.5 with comprehensive UI/UX overhaul documentation
|
|
||||||
- **Added**: Settings and Configuration System section
|
|
||||||
- **Added**: Enhanced User Experience section
|
|
||||||
- **Added**: Technical Architecture Improvements section
|
|
||||||
|
|
||||||
#### README.md Improvements
|
|
||||||
- **Updated**: Title and description to emphasize modern UI/UX
|
|
||||||
- **Added**: Recent Major Updates section highlighting v1.9.5 improvements
|
|
||||||
- **Added**: Quick start guidance for new users
|
|
||||||
- **Updated**: Documentation links with better descriptions
|
|
||||||
- **Added**: Documentation navigation guide reference
|
|
||||||
|
|
||||||
### 3. Cross-Reference Updates
|
|
||||||
- **Updated**: All internal links to reflect consolidated structure
|
|
||||||
- **Enhanced**: Documentation index with comprehensive navigation
|
|
||||||
- **Added**: Task-based navigation in docs/README.md
|
|
||||||
- **Improved**: User type-based documentation guidance
|
|
||||||
|
|
||||||
## Current Documentation Structure
|
|
||||||
|
|
||||||
```
|
|
||||||
docs/
|
|
||||||
├── README.md # Documentation index and navigation guide
|
|
||||||
├── FEATURES.md # Complete feature documentation (includes UI/UX)
|
|
||||||
├── KEYBOARD_SHORTCUTS.md # Comprehensive shortcut reference
|
|
||||||
├── MENU_THEMING.md # Menu theming system documentation
|
|
||||||
├── TESTING.md # Comprehensive testing guide (NEW)
|
|
||||||
├── EXPORT_SYSTEM.md # Data export functionality
|
|
||||||
├── DEVELOPMENT.md # Development guidelines
|
|
||||||
├── CHANGELOG.md # Version history and changes
|
|
||||||
└── DOCUMENTATION_SUMMARY.md # This summary file
|
|
||||||
```
|
|
||||||
|
|
||||||
### Testing Documentation Consolidation (NEW)
|
|
||||||
- **Added**: `docs/TESTING.md` - Comprehensive testing guide
|
|
||||||
- **Updated**: `scripts/README.md` - Reorganized test script documentation
|
|
||||||
- **Added**: `tests/test_theme_manager.py` - Unit tests for menu theming
|
|
||||||
- **Updated**: `scripts/test_menu_theming.py` - Converted to interactive demo
|
|
||||||
- **Organized**: Clear separation of unit tests, integration tests, and demos
|
|
||||||
├── EXPORT_SYSTEM.md # Data export functionality
|
|
||||||
├── DEVELOPMENT.md # Development setup and testing
|
|
||||||
├── CHANGELOG.md # Version history and improvements
|
|
||||||
└── DOCUMENTATION_SUMMARY.md # This summary (new)
|
|
||||||
|
|
||||||
README.md # Main project README with quick start
|
|
||||||
```
|
|
||||||
|
|
||||||
## Documentation Highlights
|
|
||||||
|
|
||||||
### For End Users
|
|
||||||
1. **Modern UI/UX**: Complete documentation of the new theme system
|
|
||||||
2. **Keyboard Efficiency**: Comprehensive shortcut system documentation
|
|
||||||
3. **Feature Guidance**: Consolidated feature documentation with examples
|
|
||||||
4. **Quick Navigation**: Task-based and user-type-based navigation
|
|
||||||
|
|
||||||
### For Developers
|
|
||||||
1. **Technical Architecture**: Enhanced architecture documentation
|
|
||||||
2. **UI/UX Implementation**: Technical details of theme system
|
|
||||||
3. **Code Organization**: Clear separation of concerns documentation
|
|
||||||
4. **Development Workflow**: Comprehensive development guide
|
|
||||||
|
|
||||||
## Quality Improvements
|
|
||||||
|
|
||||||
### Content Quality
|
|
||||||
- **Comprehensive Coverage**: All major features and improvements documented
|
|
||||||
- **Clear Structure**: Hierarchical organization with clear headings
|
|
||||||
- **Practical Examples**: Code snippets and usage examples maintained
|
|
||||||
- **Cross-References**: Better linking between related sections
|
|
||||||
|
|
||||||
### User Experience
|
|
||||||
- **Progressive Disclosure**: Information organized by user expertise level
|
|
||||||
- **Task-Oriented**: Documentation organized around user tasks
|
|
||||||
- **Quick Access**: Multiple entry points and navigation paths
|
|
||||||
- **Searchable**: Clear headings and consistent formatting
|
|
||||||
|
|
||||||
### Maintenance
|
|
||||||
- **Reduced Redundancy**: Eliminated duplicate information
|
|
||||||
- **Single Source of Truth**: Consolidated information reduces maintenance burden
|
|
||||||
- **Version Alignment**: Documentation synchronized with current codebase
|
|
||||||
- **Future-Proof**: Structure supports easy updates and additions
|
|
||||||
|
|
||||||
## Next Steps
|
|
||||||
|
|
||||||
### Recommended Maintenance
|
|
||||||
1. **Keep Features Updated**: Update FEATURES.md as new UI/UX improvements are added
|
|
||||||
2. **Maintain Changelog**: Continue detailed changelog entries for version tracking
|
|
||||||
3. **Review Navigation**: Periodically review docs/README.md navigation for completeness
|
|
||||||
4. **User Feedback**: Collect user feedback on documentation effectiveness
|
|
||||||
|
|
||||||
### Future Enhancements
|
|
||||||
1. **Screenshots**: Consider adding screenshots of the new UI themes
|
|
||||||
2. **Video Guides**: Potential for video demonstrations of key features
|
|
||||||
3. **API Documentation**: If public APIs develop, consider separate API docs
|
|
||||||
4. **Internationalization**: Structure supports future translation efforts
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Documentation consolidation completed**: All major UI/UX improvements are now properly documented and easily discoverable through the improved navigation structure.
|
|
||||||
@@ -1,215 +0,0 @@
|
|||||||
# TheChart Export System Documentation
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
The TheChart application now includes a comprehensive data export system that allows users to export their medication tracking data and visualizations to multiple formats:
|
|
||||||
|
|
||||||
- **JSON** - Structured data format with metadata
|
|
||||||
- **XML** - Hierarchical data format
|
|
||||||
- **PDF** - Formatted report with optional graph visualization
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
### Export Formats
|
|
||||||
|
|
||||||
#### JSON Export
|
|
||||||
- Exports all CSV data to structured JSON format
|
|
||||||
- Includes metadata about the export (date, total entries, date range)
|
|
||||||
- Lists all pathologies and medicines being tracked
|
|
||||||
- Data is exported as an array of entry objects
|
|
||||||
|
|
||||||
#### XML Export
|
|
||||||
- Exports data to hierarchical XML format
|
|
||||||
- Includes comprehensive metadata section
|
|
||||||
- All entries are properly structured with XML tags
|
|
||||||
- Column names are sanitized for valid XML element names
|
|
||||||
|
|
||||||
#### PDF Export
|
|
||||||
- Creates a formatted report document
|
|
||||||
- Includes export metadata and summary information
|
|
||||||
- Optional graph visualization inclusion
|
|
||||||
- Data table with all entries
|
|
||||||
- Proper pagination and styling
|
|
||||||
- Notes are truncated for better table formatting
|
|
||||||
|
|
||||||
### User Interface
|
|
||||||
|
|
||||||
The export functionality is accessible through:
|
|
||||||
1. **File Menu** - "Export Data..." option in the main menu bar
|
|
||||||
2. **Export Window** - Modal dialog with export options
|
|
||||||
3. **Format Selection** - Radio buttons for JSON, XML, or PDF
|
|
||||||
4. **Graph Option** - Checkbox to include graph in PDF exports
|
|
||||||
5. **File Dialog** - Standard save dialog for choosing export location
|
|
||||||
|
|
||||||
### Export Manager Architecture
|
|
||||||
|
|
||||||
The export system consists of three main components:
|
|
||||||
|
|
||||||
#### ExportManager Class (`src/export_manager.py`)
|
|
||||||
- Core export functionality
|
|
||||||
- Handles data transformation and file generation
|
|
||||||
- Integrates with existing data and graph managers
|
|
||||||
- Supports all three export formats
|
|
||||||
|
|
||||||
#### ExportWindow Class (`src/export_window.py`)
|
|
||||||
- GUI interface for export operations
|
|
||||||
- Modal dialog with export options
|
|
||||||
- File save dialog integration
|
|
||||||
- Progress feedback and error handling
|
|
||||||
|
|
||||||
#### Integration in MedTrackerApp (`src/main.py`)
|
|
||||||
- Export manager initialization
|
|
||||||
- Menu integration
|
|
||||||
- Seamless integration with existing managers
|
|
||||||
|
|
||||||
## Technical Implementation
|
|
||||||
|
|
||||||
### Dependencies Added
|
|
||||||
- `reportlab` - PDF generation library
|
|
||||||
- `lxml` - XML processing (added for future enhancements)
|
|
||||||
- `charset-normalizer` - Character encoding support
|
|
||||||
|
|
||||||
### Data Flow
|
|
||||||
1. User selects export format and options
|
|
||||||
2. ExportManager loads data from DataManager
|
|
||||||
3. Data is transformed according to selected format
|
|
||||||
4. Graph image is optionally generated for PDF
|
|
||||||
5. Output file is created and saved
|
|
||||||
6. User receives success/failure feedback
|
|
||||||
|
|
||||||
### Error Handling
|
|
||||||
- Graceful handling of missing data
|
|
||||||
- File system error management
|
|
||||||
- User-friendly error messages
|
|
||||||
- Logging of export operations
|
|
||||||
|
|
||||||
## Usage Examples
|
|
||||||
|
|
||||||
### Basic Export Process
|
|
||||||
1. Open TheChart application
|
|
||||||
2. Go to File → Export Data...
|
|
||||||
3. Select desired format (JSON/XML/PDF)
|
|
||||||
4. For PDF: choose whether to include graph
|
|
||||||
5. Click "Export..." button
|
|
||||||
6. Choose save location and filename
|
|
||||||
7. Confirm successful export
|
|
||||||
|
|
||||||
### Export File Examples
|
|
||||||
|
|
||||||
#### JSON Structure
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"metadata": {
|
|
||||||
"export_date": "2025-08-02T09:03:22.580489",
|
|
||||||
"total_entries": 32,
|
|
||||||
"date_range": {
|
|
||||||
"start": "07/02/2025",
|
|
||||||
"end": "08/02/2025"
|
|
||||||
},
|
|
||||||
"pathologies": ["depression", "anxiety", "sleep", "appetite"],
|
|
||||||
"medicines": ["bupropion", "hydroxyzine", "gabapentin", "propranolol", "quetiapine"]
|
|
||||||
},
|
|
||||||
"entries": [
|
|
||||||
{
|
|
||||||
"date": "07/02/2025",
|
|
||||||
"depression": 8,
|
|
||||||
"anxiety": 5,
|
|
||||||
"sleep": 3,
|
|
||||||
"appetite": 1,
|
|
||||||
"bupropion": 0,
|
|
||||||
"bupropion_doses": "",
|
|
||||||
"note": "Starting medication tracking"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### XML Structure
|
|
||||||
```xml
|
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<thechart_data>
|
|
||||||
<metadata>
|
|
||||||
<export_date>2025-08-02T09:03:22.613013</export_date>
|
|
||||||
<total_entries>32</total_entries>
|
|
||||||
<date_range>
|
|
||||||
<start>07/02/2025</start>
|
|
||||||
<end>08/02/2025</end>
|
|
||||||
</date_range>
|
|
||||||
</metadata>
|
|
||||||
<entries>
|
|
||||||
<entry>
|
|
||||||
<date>07/02/2025</date>
|
|
||||||
<depression>8</depression>
|
|
||||||
<anxiety>5</anxiety>
|
|
||||||
<note>Starting medication tracking</note>
|
|
||||||
</entry>
|
|
||||||
</entries>
|
|
||||||
</thechart_data>
|
|
||||||
```
|
|
||||||
|
|
||||||
## Testing
|
|
||||||
|
|
||||||
### Automated Tests
|
|
||||||
- Export functionality is tested through `simple_export_test.py`
|
|
||||||
- Creates sample exports in all three formats
|
|
||||||
- Validates file creation and basic content structure
|
|
||||||
|
|
||||||
### Manual Testing
|
|
||||||
- GUI testing available through `test_export_gui.py`
|
|
||||||
- Opens export window for interactive testing
|
|
||||||
- Allows testing of all user interface components
|
|
||||||
|
|
||||||
### Test Files Location
|
|
||||||
Exported test files are created in the `test_exports/` directory:
|
|
||||||
- `export.json` - JSON format export
|
|
||||||
- `export.xml` - XML format export
|
|
||||||
- `export.csv` - CSV format copy
|
|
||||||
- `test_export.pdf` - PDF format with graph
|
|
||||||
|
|
||||||
## File Locations
|
|
||||||
|
|
||||||
### Source Files
|
|
||||||
- `src/export_manager.py` - Core export functionality
|
|
||||||
- `src/export_window.py` - GUI export interface
|
|
||||||
|
|
||||||
### Test Files
|
|
||||||
- `simple_export_test.py` - Basic export functionality test
|
|
||||||
- `test_export_gui.py` - GUI testing interface
|
|
||||||
- `scripts/test_export_functionality.py` - Comprehensive export tests
|
|
||||||
|
|
||||||
### Dependencies
|
|
||||||
- Added to `requirements.txt` and managed by `uv`
|
|
||||||
- PDF generation requires `reportlab`
|
|
||||||
- XML processing enhanced with `lxml`
|
|
||||||
|
|
||||||
## Future Enhancements
|
|
||||||
|
|
||||||
Potential improvements for the export system:
|
|
||||||
1. **Additional Formats** - Excel, CSV with formatting
|
|
||||||
2. **Export Filtering** - Date range selection, specific pathologies/medicines
|
|
||||||
3. **Batch Exports** - Multiple formats at once
|
|
||||||
4. **Email Integration** - Direct email export
|
|
||||||
5. **Cloud Storage** - Export to cloud services
|
|
||||||
6. **Export Scheduling** - Automated periodic exports
|
|
||||||
7. **Advanced PDF Styling** - Charts, graphs, custom layouts
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
### Common Issues
|
|
||||||
1. **No Data to Export** - Ensure CSV file has entries before exporting
|
|
||||||
2. **PDF Generation Fails** - Check ReportLab installation and permissions
|
|
||||||
3. **File Save Errors** - Verify write permissions to selected directory
|
|
||||||
4. **Large File Exports** - PDF exports may take longer for large datasets
|
|
||||||
|
|
||||||
### Debugging
|
|
||||||
- Check application logs for detailed error messages
|
|
||||||
- Export operations are logged with DEBUG level information
|
|
||||||
- File system errors are captured and reported to user
|
|
||||||
|
|
||||||
## Integration Notes
|
|
||||||
|
|
||||||
The export system integrates seamlessly with existing TheChart functionality:
|
|
||||||
- Uses same data validation and loading mechanisms
|
|
||||||
- Respects existing pathology and medicine configurations
|
|
||||||
- Maintains data integrity and formatting consistency
|
|
||||||
- Follows existing logging and error handling patterns
|
|
||||||
@@ -1,361 +0,0 @@
|
|||||||
# TheChart - Features Documentation
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
TheChart is a comprehensive medication tracking application with a modern, professional UI that allows users to monitor medication intake, track symptoms, and visualize treatment progress over time.
|
|
||||||
|
|
||||||
## 🎨 Modern UI/UX System (New in v1.9.5)
|
|
||||||
|
|
||||||
### Professional Theme Engine
|
|
||||||
TheChart features a sophisticated theme system powered by ttkthemes, offering 8 carefully curated professional themes.
|
|
||||||
|
|
||||||
#### Available Themes:
|
|
||||||
- **Arc**: Modern flat design with subtle shadows
|
|
||||||
- **Equilux**: Dark theme with excellent contrast
|
|
||||||
- **Adapta**: Clean, minimalist design
|
|
||||||
- **Yaru**: Ubuntu-inspired modern interface
|
|
||||||
- **Ubuntu**: Official Ubuntu styling
|
|
||||||
- **Plastik**: Classic professional appearance
|
|
||||||
- **Breeze**: KDE-inspired clean design
|
|
||||||
- **Elegance**: Sophisticated dark theme
|
|
||||||
|
|
||||||
#### UI Enhancements:
|
|
||||||
- **Modern Styling**: Card-style frames, enhanced buttons, professional form controls
|
|
||||||
- **Smart Tooltips**: Context-sensitive help for all interactive elements
|
|
||||||
- **Improved Tables**: Better selection highlighting and alternating row colors
|
|
||||||
- **Settings System**: Comprehensive preferences with theme persistence
|
|
||||||
- **Responsive Design**: Automatic layout adjustments and scaling
|
|
||||||
- **Menu Theming**: Complete menu integration with theme colors and hover effects
|
|
||||||
|
|
||||||
### ⌨️ Comprehensive Keyboard Shortcuts
|
|
||||||
Professional keyboard shortcut system for efficient navigation and operation.
|
|
||||||
|
|
||||||
#### File Operations:
|
|
||||||
- **Ctrl+S**: Save/Add new entry
|
|
||||||
- **Ctrl+Q**: Quit application (with confirmation)
|
|
||||||
- **Ctrl+E**: Export data
|
|
||||||
|
|
||||||
#### Data Management:
|
|
||||||
- **Ctrl+N**: Clear entries
|
|
||||||
- **Ctrl+R / F5**: Refresh data
|
|
||||||
- **Delete**: Delete selected entry
|
|
||||||
- **Escape**: Clear selection
|
|
||||||
|
|
||||||
#### Window Management:
|
|
||||||
- **Ctrl+M**: Manage medicines
|
|
||||||
- **Ctrl+P**: Manage pathologies
|
|
||||||
- **F1**: Show keyboard shortcuts help
|
|
||||||
- **F2**: Open settings window
|
|
||||||
|
|
||||||
## Core Features
|
|
||||||
|
|
||||||
### 🏥 Modular Medicine System
|
|
||||||
TheChart features a dynamic medicine management system that allows complete customization without code modifications.
|
|
||||||
|
|
||||||
#### Features:
|
|
||||||
- **Dynamic Medicine Management**: Add, edit, and remove medicines through the UI
|
|
||||||
- **Configurable Properties**: Each medicine has customizable display names, dosages, colors, and quick-dose options
|
|
||||||
- **Automatic UI Updates**: All interface elements update automatically when medicines change
|
|
||||||
- **JSON Configuration**: Human-readable `medicines.json` file for easy management
|
|
||||||
|
|
||||||
#### Medicine Configuration:
|
|
||||||
Each medicine includes:
|
|
||||||
- **Key**: Internal identifier (e.g., "bupropion")
|
|
||||||
- **Display Name**: User-friendly name (e.g., "Bupropion")
|
|
||||||
- **Dosage Info**: Dosage information (e.g., "150/300 mg")
|
|
||||||
- **Quick Doses**: Common dose amounts for quick selection
|
|
||||||
- **Color**: Hex color for graph display (e.g., "#FF6B6B")
|
|
||||||
- **Default Enabled**: Whether to show in graphs by default
|
|
||||||
|
|
||||||
#### Default Medicines:
|
|
||||||
| Medicine | Dosage | Default Graph | Color |
|
|
||||||
|----------|--------|---------------|--------|
|
|
||||||
| Bupropion | 150/300 mg | ✅ | Red (#FF6B6B) |
|
|
||||||
| Hydroxyzine | 25 mg | ❌ | Teal (#4ECDC4) |
|
|
||||||
| Gabapentin | 100 mg | ❌ | Blue (#45B7D1) |
|
|
||||||
| Propranolol | 10 mg | ✅ | Green (#96CEB4) |
|
|
||||||
| Quetiapine | 25 mg | ❌ | Yellow (#FFEAA7) |
|
|
||||||
|
|
||||||
#### Usage:
|
|
||||||
1. **Through UI**: Go to `Tools` → `Manage Medicines...`
|
|
||||||
2. **Manual Configuration**: Edit `medicines.json` directly
|
|
||||||
3. **Programmatically**: Use the MedicineManager API
|
|
||||||
|
|
||||||
### ⚙️ Settings and Theme Management
|
|
||||||
Advanced configuration system allowing users to customize their experience.
|
|
||||||
|
|
||||||
#### Settings Window (F2):
|
|
||||||
- **Theme Selection**: Choose from 8 professional themes with live preview
|
|
||||||
- **UI Preferences**: Font scaling, window behavior options
|
|
||||||
- **About Information**: Detailed application and version information
|
|
||||||
- **Tabbed Interface**: Organized settings categories for easy navigation
|
|
||||||
|
|
||||||
#### Theme Features:
|
|
||||||
- **Real-time Switching**: No restart required for theme changes
|
|
||||||
- **Persistence**: Selected theme remembered between sessions
|
|
||||||
- **Quick Access**: Theme menu for instant switching
|
|
||||||
- **Fallback Handling**: Graceful handling if themes fail to load
|
|
||||||
|
|
||||||
### 💡 Smart Tooltip System
|
|
||||||
Context-sensitive help system providing guidance throughout the application.
|
|
||||||
|
|
||||||
#### Tooltip Types:
|
|
||||||
- **Pathology Scales**: Usage guidance for symptom tracking
|
|
||||||
- **Medicine Checkboxes**: Medication information and dosage details
|
|
||||||
- **Action Buttons**: Functionality description with keyboard shortcuts
|
|
||||||
- **Form Controls**: Input guidance and format requirements
|
|
||||||
|
|
||||||
#### Features:
|
|
||||||
- **Delayed Display**: Non-intrusive timing (500-800ms delay)
|
|
||||||
- **Theme-aware Styling**: Tooltips match selected theme
|
|
||||||
- **Smart Positioning**: Automatic placement to avoid screen edges
|
|
||||||
- **Rich Content**: Multi-line descriptions with formatting
|
|
||||||
|
|
||||||
### 💊 Advanced Dose Tracking
|
|
||||||
Comprehensive dose tracking system that records exact timestamps and dosages throughout the day.
|
|
||||||
|
|
||||||
#### Core Capabilities:
|
|
||||||
- **Timestamp Recording**: Exact time when medicine is taken
|
|
||||||
- **Dose Amount Tracking**: Record specific doses (150mg, 10mg, etc.)
|
|
||||||
- **Multiple Doses Per Day**: Take the same medicine multiple times
|
|
||||||
- **Real-time Display**: See today's doses immediately
|
|
||||||
- **Data Persistence**: All doses saved to CSV with full history
|
|
||||||
|
|
||||||
#### Dose Management Interface:
|
|
||||||
Located in the edit window (double-click any entry):
|
|
||||||
- **Individual Dose Entry Fields**: For each medicine
|
|
||||||
- **"Take [Medicine]" Buttons**: Immediate dose recording with timestamps
|
|
||||||
- **Editable Dose Display Areas**: View and modify existing doses
|
|
||||||
- **Quick Dose Buttons**: Pre-configured common dose amounts
|
|
||||||
- **Format Consistency**: All doses displayed in HH:MM: dose format
|
|
||||||
|
|
||||||
#### Data Format:
|
|
||||||
- **Timestamp Format**: `YYYY-MM-DD HH:MM:SS`
|
|
||||||
- **Dose Separator**: `|` (pipe) for multiple doses
|
|
||||||
- **Dose Format**: `timestamp:dose`
|
|
||||||
- **CSV Storage**: Additional columns in existing CSV file
|
|
||||||
|
|
||||||
#### Example CSV Format:
|
|
||||||
```csv
|
|
||||||
date,depression,anxiety,sleep,appetite,bupropion,bupropion_doses,hydroxyzine,hydroxyzine_doses,propranolol,propranolol_doses,note
|
|
||||||
07/28/2025,4,5,3,3,1,"2025-07-28 14:30:00:150mg|2025-07-28 18:30:00:150mg",0,"",1,"2025-07-28 12:30:00:10mg","Multiple doses today"
|
|
||||||
```
|
|
||||||
|
|
||||||
### 📊 Enhanced Graph Visualization
|
|
||||||
Advanced graphing system with comprehensive data visualization and interactive controls.
|
|
||||||
|
|
||||||
#### Medicine Dose Visualization:
|
|
||||||
- **Colored Bar Charts**: Each medicine has distinct colors
|
|
||||||
- **Daily Dose Totals**: Automatically calculated from individual doses
|
|
||||||
- **Scaled Display**: Doses scaled by 1/10 for better visibility (labeled as "mg/10")
|
|
||||||
- **Dynamic Positioning**: Bars positioned below main chart area
|
|
||||||
- **Semi-transparent Bars**: Alpha=0.6 to avoid overwhelming symptom data
|
|
||||||
|
|
||||||
#### Interactive Controls:
|
|
||||||
- **Toggle Buttons**: Independent show/hide for each medicine and symptom
|
|
||||||
- **Organized Sections**: "Symptoms" and "Medicines" sections
|
|
||||||
- **Real-time Updates**: Changes take effect immediately
|
|
||||||
|
|
||||||
#### Enhanced Legend:
|
|
||||||
- **Multi-column Layout**: Efficient use of graph space (2 columns)
|
|
||||||
- **Average Dosage Display**: Shows average dose for each medicine
|
|
||||||
- **Color Coding**: Consistent color scheme matching graph elements
|
|
||||||
- **Professional Styling**: Frame, shadow, and transparency effects
|
|
||||||
- **Tracking Status**: Shows medicines being monitored but without current dose data
|
|
||||||
|
|
||||||
#### Dose Calculation Features:
|
|
||||||
- **Multiple Format Support**: Handles various dose string formats
|
|
||||||
- **Robust Parsing**: Handles timestamps, symbols (•), and mixed formats
|
|
||||||
- **Edge Case Handling**: Manages empty strings, NaN values, malformed data
|
|
||||||
- **Daily Totals**: Sums all individual doses for comprehensive daily tracking
|
|
||||||
|
|
||||||
### 🏥 Pathology Management
|
|
||||||
Comprehensive symptom tracking with configurable pathologies.
|
|
||||||
|
|
||||||
#### Features:
|
|
||||||
- **Dynamic Pathology System**: Similar to medicine management
|
|
||||||
- **Configurable Symptoms**: Add, edit, and remove symptom categories
|
|
||||||
- **Scale-based Rating**: 0-10 rating system for symptom severity
|
|
||||||
- **Historical Tracking**: Full symptom history with trend analysis
|
|
||||||
|
|
||||||
### 📝 Data Management
|
|
||||||
Robust data handling with comprehensive backup and migration support.
|
|
||||||
|
|
||||||
#### Data Features:
|
|
||||||
- **CSV-based Storage**: Human-readable and portable data format
|
|
||||||
- **Automatic Backups**: Created before major migrations
|
|
||||||
- **Backward Compatibility**: Existing data continues to work with updates
|
|
||||||
- **Dynamic Column Management**: Automatically adapts to new medicines/pathologies
|
|
||||||
- **Data Validation**: Ensures data integrity and handles edge cases
|
|
||||||
|
|
||||||
#### Migration Support:
|
|
||||||
- **Automatic Migration**: Data structure updates handled automatically
|
|
||||||
- **Backup Creation**: `thechart_data.csv.backup_YYYYMMDD_HHMMSS` format
|
|
||||||
- **No Data Loss**: All existing functionality and data preserved
|
|
||||||
- **Version Compatibility**: Seamless updates across application versions
|
|
||||||
|
|
||||||
### 🧪 Comprehensive Testing Framework
|
|
||||||
Professional testing infrastructure with high code coverage.
|
|
||||||
|
|
||||||
#### Testing Statistics:
|
|
||||||
- **93% Overall Code Coverage** (482 total statements, 33 missed)
|
|
||||||
- **112 Total Tests** across 6 test modules
|
|
||||||
- **80 Tests Passing** (71.4% pass rate)
|
|
||||||
- **Pre-commit Testing**: Core functionality tests run before each commit
|
|
||||||
|
|
||||||
#### Test Coverage by Module:
|
|
||||||
- **100% Coverage**: constants.py, logger.py
|
|
||||||
- **97% Coverage**: graph_manager.py
|
|
||||||
- **95% Coverage**: init.py
|
|
||||||
- **93% Coverage**: ui_manager.py
|
|
||||||
- **91% Coverage**: main.py
|
|
||||||
- **87% Coverage**: data_manager.py
|
|
||||||
|
|
||||||
#### Testing Tools:
|
|
||||||
- **pytest**: Modern Python testing framework
|
|
||||||
- **pytest-cov**: Coverage reporting with HTML, XML, and terminal output
|
|
||||||
- **pytest-mock**: Mocking support for isolated testing
|
|
||||||
- **pre-commit hooks**: Automated testing before commits
|
|
||||||
|
|
||||||
## User Interface Features
|
|
||||||
|
|
||||||
### 🖥️ Intuitive Design
|
|
||||||
- **Clean Main Interface**: Simplified new entry form focused on essential inputs
|
|
||||||
- **Organized Edit Windows**: Comprehensive dose management in dedicated edit interface
|
|
||||||
- **Scrollable Interface**: Vertical scrollbar for expanded UI components
|
|
||||||
- **Responsive Design**: Interface adapts to window size and content
|
|
||||||
- **Visual Feedback**: Success messages and clear status indicators
|
|
||||||
|
|
||||||
### 🎯 User Experience Improvements
|
|
||||||
- **Centralized Dose Management**: All dose operations consolidated in edit windows
|
|
||||||
- **Quick Entry Options**: Pre-configured dose buttons for common amounts
|
|
||||||
- **Format Guidance**: Clear instructions and format examples
|
|
||||||
- **Real-time Updates**: Immediate feedback and data updates
|
|
||||||
- **Error Handling**: Comprehensive error messages and recovery options
|
|
||||||
|
|
||||||
### ⌨️ Keyboard Shortcuts
|
|
||||||
Comprehensive keyboard shortcuts for efficient navigation and data entry.
|
|
||||||
|
|
||||||
#### File Operations:
|
|
||||||
- **Ctrl+S**: Save/Add new entry - Quickly save current entry data
|
|
||||||
- **Ctrl+Q**: Quit application - Exit with confirmation dialog
|
|
||||||
- **Ctrl+E**: Export data - Open export dialog window
|
|
||||||
|
|
||||||
#### Data Management:
|
|
||||||
- **Ctrl+N**: Clear entries - Clear all input fields for new entry
|
|
||||||
- **Ctrl+R / F5**: Refresh data - Reload data from CSV and update displays
|
|
||||||
|
|
||||||
#### Window Management:
|
|
||||||
- **Ctrl+M**: Manage medicines - Open medicine management window
|
|
||||||
- **Ctrl+P**: Manage pathologies - Open pathology management window
|
|
||||||
|
|
||||||
#### Table Operations:
|
|
||||||
- **Delete**: Delete selected entry - Remove selected table entry with confirmation
|
|
||||||
- **Escape**: Clear selection - Clear current table selection
|
|
||||||
- **Double-click**: Edit entry - Open edit dialog for selected entry
|
|
||||||
|
|
||||||
#### Help System:
|
|
||||||
- **F1**: Show keyboard shortcuts - Display help dialog with all shortcuts
|
|
||||||
|
|
||||||
#### Integration Features:
|
|
||||||
- **Menu Display**: All shortcuts shown in menu bar next to items
|
|
||||||
- **Button Labels**: Primary buttons show their keyboard shortcuts
|
|
||||||
- **Case Insensitive**: Both Ctrl+S and Ctrl+Shift+S work
|
|
||||||
- **Focus Management**: Shortcuts work when main window has focus
|
|
||||||
- **Status Feedback**: All operations provide status bar feedback
|
|
||||||
|
|
||||||
## Technical Architecture
|
|
||||||
|
|
||||||
### � Modern UI Architecture
|
|
||||||
- **ThemeManager**: Centralized theme management with dynamic switching
|
|
||||||
- **TooltipManager**: Smart tooltip system with context-sensitive help
|
|
||||||
- **UIManager**: Enhanced UI component creation with theme integration
|
|
||||||
- **SettingsWindow**: Advanced configuration interface with persistence
|
|
||||||
|
|
||||||
### 🏗️ Core Application Design
|
|
||||||
- **MedicineManager**: Core medicine CRUD operations with JSON persistence
|
|
||||||
- **PathologyManager**: Symptom and pathology management system
|
|
||||||
- **GraphManager**: Professional graph rendering with matplotlib integration
|
|
||||||
- **DataManager**: Robust CSV operations and data persistence with validation
|
|
||||||
|
|
||||||
### 🔧 Configuration and Data Management
|
|
||||||
- **JSON-based Configuration**: `medicines.json` and `pathologies.json` for easy management
|
|
||||||
- **Dynamic Loading**: Runtime configuration updates without restarts
|
|
||||||
- **Data Validation**: Comprehensive input validation and error handling
|
|
||||||
- **Backward Compatibility**: Seamless updates and migrations across versions
|
|
||||||
|
|
||||||
### 📈 Advanced Data Processing
|
|
||||||
- **Pandas Integration**: Efficient data manipulation and analysis
|
|
||||||
- **Real-time Calculations**: Dynamic dose totals, averages, and statistics
|
|
||||||
- **Robust Parsing**: Handles various data formats and edge cases gracefully
|
|
||||||
- **Performance Optimization**: Efficient batch operations and caching
|
|
||||||
|
|
||||||
## UI/UX Technical Implementation
|
|
||||||
|
|
||||||
### 🎭 Theme System Architecture
|
|
||||||
- **Multiple Theme Support**: 8 curated professional themes
|
|
||||||
- **Dynamic Style Application**: Real-time theme switching without restart
|
|
||||||
- **Color Extraction**: Automatic color scheme detection and application
|
|
||||||
- **Fallback Mechanisms**: Graceful handling when themes fail to load
|
|
||||||
|
|
||||||
### 💡 Enhanced User Experience
|
|
||||||
- **Smart Tooltips**: Context-sensitive help with delayed, non-intrusive display
|
|
||||||
- **Modern Styling**: Card-style frames, enhanced buttons, professional form controls
|
|
||||||
- **Improved Tables**: Better selection highlighting and alternating row colors
|
|
||||||
- **Responsive Design**: Automatic layout adjustments and proper scaling
|
|
||||||
|
|
||||||
### ⚙️ Settings and Persistence
|
|
||||||
- **Configuration Management**: Theme and preference persistence across sessions
|
|
||||||
- **Tabbed Settings Interface**: Organized categories for easy navigation
|
|
||||||
- **Live Preview**: Real-time theme preview in settings
|
|
||||||
- **Error Recovery**: Robust handling of corrupted settings with defaults
|
|
||||||
|
|
||||||
## Deployment and Distribution
|
|
||||||
|
|
||||||
### 📦 Standalone Executable
|
|
||||||
- **PyInstaller Integration**: Creates self-contained executables
|
|
||||||
- **Cross-platform Support**: Linux deployment with desktop integration
|
|
||||||
- **Automatic Installation**: Installs to `~/Applications/` with desktop entry
|
|
||||||
- **Data Migration**: Copies data files to appropriate user directories
|
|
||||||
|
|
||||||
### 🐳 Docker Support
|
|
||||||
- **Multi-platform Images**: Docker container support
|
|
||||||
- **Docker Compose**: Easy container management
|
|
||||||
- **Development Environment**: Consistent development setup across platforms
|
|
||||||
|
|
||||||
### 🔄 Package Management
|
|
||||||
- **UV Integration**: Fast Python package management with Rust performance
|
|
||||||
- **Virtual Environment**: Isolated dependency management
|
|
||||||
- **Lock Files**: Reproducible builds with `uv.lock`
|
|
||||||
- **Development Dependencies**: Separate dev dependencies for clean production builds
|
|
||||||
|
|
||||||
## Integration Features
|
|
||||||
|
|
||||||
### 🔄 Import/Export
|
|
||||||
- **CSV Import**: Import existing medication data
|
|
||||||
- **Data Export**: Export data for backup or analysis
|
|
||||||
- **Format Compatibility**: Standard CSV format for portability
|
|
||||||
|
|
||||||
### 🔌 API Integration
|
|
||||||
- **Extensible Architecture**: Plugin system for future enhancements
|
|
||||||
- **Medicine API**: Programmatic medicine management
|
|
||||||
- **Data API**: Direct data access and manipulation
|
|
||||||
|
|
||||||
## Future Enhancements
|
|
||||||
|
|
||||||
### 🚀 Planned Features
|
|
||||||
- **Mobile Companion App**: Mobile dose tracking and reminders
|
|
||||||
- **Cloud Synchronization**: Multi-device data synchronization
|
|
||||||
- **Advanced Analytics**: Machine learning-based trend analysis
|
|
||||||
- **Reminder System**: Intelligent dose reminders and scheduling
|
|
||||||
- **Doctor Integration**: Export reports for healthcare providers
|
|
||||||
|
|
||||||
### 🎯 Development Roadmap
|
|
||||||
- **macOS/Windows Support**: Extended platform support
|
|
||||||
- **Plugin Architecture**: Third-party extension support
|
|
||||||
- **API Development**: RESTful API for external integrations
|
|
||||||
- **Advanced Visualizations**: Additional chart types and analysis tools
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
For detailed usage instructions, see the main [README.md](../README.md).
|
|
||||||
For development information, see [DEVELOPMENT.md](DEVELOPMENT.md).
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
# Keyboard Shortcuts
|
|
||||||
|
|
||||||
TheChart application supports comprehensive keyboard shortcuts for improved productivity and efficient navigation.
|
|
||||||
|
|
||||||
## File Operations
|
|
||||||
- **Ctrl+S**: Save/Add new entry - Saves the current entry data to the database
|
|
||||||
- **Ctrl+Q**: Quit application - Exits the application (with confirmation dialog)
|
|
||||||
- **Ctrl+E**: Export data - Opens the export dialog window
|
|
||||||
|
|
||||||
## Data Management
|
|
||||||
- **Ctrl+N**: Clear entries - Clears all input fields to start a new entry
|
|
||||||
- **Ctrl+R** or **F5**: Refresh data - Reloads data from the CSV file and updates the display
|
|
||||||
|
|
||||||
## Window Management
|
|
||||||
- **Ctrl+M**: Manage medicines - Opens the medicine management window
|
|
||||||
- **Ctrl+P**: Manage pathologies - Opens the pathology management window
|
|
||||||
|
|
||||||
## Table Operations
|
|
||||||
- **Delete**: Delete selected entry - Deletes the currently selected entry in the table (with confirmation)
|
|
||||||
- **Escape**: Clear selection - Clears the current selection in the table
|
|
||||||
- **Double-click**: Edit entry - Opens the edit dialog for the selected entry
|
|
||||||
|
|
||||||
## Help
|
|
||||||
- **F1**: Show keyboard shortcuts help - Displays a dialog with all available keyboard shortcuts
|
|
||||||
|
|
||||||
## Implementation Details
|
|
||||||
|
|
||||||
### Menu Integration
|
|
||||||
All keyboard shortcuts are displayed in the menu bar next to their corresponding menu items for easy reference.
|
|
||||||
|
|
||||||
### Button Labels
|
|
||||||
Primary action buttons show their keyboard shortcuts in the button text (e.g., "Add Entry (Ctrl+S)").
|
|
||||||
|
|
||||||
### Case Sensitivity
|
|
||||||
- Shortcuts are case-insensitive
|
|
||||||
- Both `Ctrl+S` and `Ctrl+Shift+S` work
|
|
||||||
- Uppercase and lowercase variants are supported
|
|
||||||
|
|
||||||
### Focus Requirements
|
|
||||||
- Keyboard shortcuts work when the main window has focus
|
|
||||||
- Focus is automatically set to the main window on startup
|
|
||||||
- Shortcuts work across all tabs and interface elements
|
|
||||||
|
|
||||||
### Feedback System
|
|
||||||
- All operations provide feedback through the status bar
|
|
||||||
- Success and error messages are displayed
|
|
||||||
- Confirmation dialogs are shown for destructive operations (quit, delete)
|
|
||||||
|
|
||||||
## Usage Tips
|
|
||||||
|
|
||||||
### Quick Workflow
|
|
||||||
1. **Ctrl+N** - Clear fields for new entry
|
|
||||||
2. Enter data in the form
|
|
||||||
3. **Ctrl+S** - Save the entry
|
|
||||||
4. **F5** - Refresh to see updated data
|
|
||||||
|
|
||||||
### Navigation
|
|
||||||
- Use **Ctrl+M** and **Ctrl+P** to quickly access management windows
|
|
||||||
- Use **Delete** to remove unwanted entries from the table
|
|
||||||
- Use **Escape** to clear selections when needed
|
|
||||||
|
|
||||||
### Getting Help
|
|
||||||
- Press **F1** anytime to see the keyboard shortcuts help dialog
|
|
||||||
- All shortcuts are also visible in the menu bar
|
|
||||||
- Button tooltips show additional keyboard shortcut information
|
|
||||||
|
|
||||||
## Accessibility
|
|
||||||
- Keyboard shortcuts provide full application functionality without mouse use
|
|
||||||
- All critical operations have keyboard equivalents
|
|
||||||
- Shortcuts follow standard application conventions (Ctrl+S for save, Ctrl+Q for quit)
|
|
||||||
- Help system is easily accessible via F1
|
|
||||||
@@ -1,105 +0,0 @@
|
|||||||
# Menu Theming Documentation
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
TheChart application now supports full menu theming that integrates seamlessly with the application's theme system. All menus (File, Tools, Theme, Help) will automatically adopt colors that match the selected application theme.
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
### Automatic Theme Integration
|
|
||||||
- Menus automatically inherit colors from the current application theme
|
|
||||||
- Background colors are slightly adjusted to provide subtle visual distinction
|
|
||||||
- Hover effects use the theme's accent colors for consistency
|
|
||||||
|
|
||||||
### Supported Menu Elements
|
|
||||||
- Main menu bar
|
|
||||||
- All dropdown menus (File, Tools, Theme, Help)
|
|
||||||
- Menu items and separators
|
|
||||||
- Hover/active states
|
|
||||||
- Disabled menu items
|
|
||||||
|
|
||||||
### Theme Colors Applied
|
|
||||||
|
|
||||||
For each theme, the following color properties are applied to menus:
|
|
||||||
|
|
||||||
- **Background**: Slightly darker/lighter than the main theme background
|
|
||||||
- **Foreground**: Uses the theme's text color
|
|
||||||
- **Active Background**: Uses the theme's selection/accent color
|
|
||||||
- **Active Foreground**: Uses the theme's selection text color
|
|
||||||
- **Disabled Foreground**: Grayed out color for disabled items
|
|
||||||
|
|
||||||
## Technical Implementation
|
|
||||||
|
|
||||||
### ThemeManager Methods
|
|
||||||
|
|
||||||
#### `get_menu_colors() -> dict[str, str]`
|
|
||||||
Returns a dictionary of colors specifically optimized for menu theming:
|
|
||||||
```python
|
|
||||||
{
|
|
||||||
"bg": "#edeeef", # Menu background
|
|
||||||
"fg": "#5c616c", # Menu text
|
|
||||||
"active_bg": "#0078d4", # Hover background
|
|
||||||
"active_fg": "#ffffff", # Hover text
|
|
||||||
"disabled_fg": "#888888" # Disabled text
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### `configure_menu(menu: tk.Menu) -> None`
|
|
||||||
Applies theme colors to a specific menu widget:
|
|
||||||
```python
|
|
||||||
theme_manager.configure_menu(menubar)
|
|
||||||
theme_manager.configure_menu(file_menu)
|
|
||||||
```
|
|
||||||
|
|
||||||
### Automatic Updates
|
|
||||||
|
|
||||||
When themes are changed using the Theme menu:
|
|
||||||
1. The new theme is applied to all UI components
|
|
||||||
2. The menu setup is refreshed (`_setup_menu()` is called)
|
|
||||||
3. All menus are automatically re-themed with the new colors
|
|
||||||
|
|
||||||
## Usage Example
|
|
||||||
|
|
||||||
```python
|
|
||||||
# Create menu
|
|
||||||
menubar = tk.Menu(root)
|
|
||||||
file_menu = tk.Menu(menubar, tearoff=0)
|
|
||||||
|
|
||||||
# Apply theming
|
|
||||||
theme_manager.configure_menu(menubar)
|
|
||||||
theme_manager.configure_menu(file_menu)
|
|
||||||
|
|
||||||
# Menus will now match the current theme
|
|
||||||
```
|
|
||||||
|
|
||||||
## Color Calculation
|
|
||||||
|
|
||||||
The menu background color is automatically calculated based on the main theme:
|
|
||||||
|
|
||||||
- **Light themes**: Menu background is made slightly darker than the main background
|
|
||||||
- **Dark themes**: Menu background is made slightly lighter than the main background
|
|
||||||
|
|
||||||
This provides subtle visual distinction while maintaining theme consistency.
|
|
||||||
|
|
||||||
## Supported Themes
|
|
||||||
|
|
||||||
Menu theming works with all available themes:
|
|
||||||
- arc
|
|
||||||
- equilux
|
|
||||||
- adapta
|
|
||||||
- yaru
|
|
||||||
- ubuntu
|
|
||||||
- plastik
|
|
||||||
- breeze
|
|
||||||
- elegance
|
|
||||||
|
|
||||||
## Testing
|
|
||||||
|
|
||||||
A test script is available to verify menu theming functionality:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd /home/will/Code/thechart
|
|
||||||
.venv/bin/python scripts/test_menu_theming.py
|
|
||||||
```
|
|
||||||
|
|
||||||
This script creates a test window with menus that can be used to verify theming across different themes.
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
# TheChart Documentation
|
|
||||||
|
|
||||||
Welcome to TheChart documentation! This guide will help you navigate the available documentation for the modern medication tracking application.
|
|
||||||
|
|
||||||
## 📖 Documentation Index
|
|
||||||
|
|
||||||
### For Users
|
|
||||||
- **[README.md](../README.md)** - Quick start guide and installation
|
|
||||||
- **[Features Guide](FEATURES.md)** - Complete feature documentation including new UI/UX improvements
|
|
||||||
- Modern Theme System (8 Professional Themes)
|
|
||||||
- Advanced Keyboard Shortcuts
|
|
||||||
- Smart Tooltip System
|
|
||||||
- Modular Medicine System
|
|
||||||
- Advanced Dose Tracking
|
|
||||||
- Graph Visualizations
|
|
||||||
- Data Management
|
|
||||||
- **[Keyboard Shortcuts](KEYBOARD_SHORTCUTS.md)** - Comprehensive shortcut reference
|
|
||||||
- File operations shortcuts (Ctrl+S, Ctrl+Q, Ctrl+E)
|
|
||||||
- Data management shortcuts (Ctrl+N, Ctrl+R, F5)
|
|
||||||
- Navigation shortcuts (Ctrl+M, Ctrl+P, F1, F2)
|
|
||||||
- **[Export System](EXPORT_SYSTEM.md)** - Data export functionality and formats
|
|
||||||
- JSON, XML, and PDF export options
|
|
||||||
- Graph visualization inclusion
|
|
||||||
- Export manager architecture
|
|
||||||
|
|
||||||
### For Developers
|
|
||||||
- **[Development Guide](DEVELOPMENT.md)** - Development setup and testing
|
|
||||||
- Testing Framework (93% coverage)
|
|
||||||
- Code Quality Tools
|
|
||||||
- Architecture Overview
|
|
||||||
- Debugging Guide
|
|
||||||
|
|
||||||
### Project History
|
|
||||||
- **[Changelog](CHANGELOG.md)** - Version history and feature evolution
|
|
||||||
- Recent UI/UX overhaul (v1.9.5)
|
|
||||||
- Keyboard shortcuts system (v1.7.0)
|
|
||||||
- Medicine and dose tracking improvements
|
|
||||||
- Migration notes and future roadmap
|
|
||||||
|
|
||||||
## 🚀 Quick Navigation
|
|
||||||
|
|
||||||
### Getting Started
|
|
||||||
1. **Installation**: See [README.md - Installation](../README.md#installation)
|
|
||||||
2. **First Run**: See [README.md - Running the Application](../README.md#running-the-application)
|
|
||||||
3. **UI/UX Features**: See [FEATURES.md - Modern UI/UX System](FEATURES.md#-modern-uiux-system-new-in-v195)
|
|
||||||
|
|
||||||
### Using the Application
|
|
||||||
1. **Theme Selection**: See [FEATURES.md - Settings and Theme Management](FEATURES.md#️-settings-and-theme-management)
|
|
||||||
2. **Keyboard Shortcuts**: See [KEYBOARD_SHORTCUTS.md](KEYBOARD_SHORTCUTS.md)
|
|
||||||
3. **Medicine Management**: See [FEATURES.md - Modular Medicine System](FEATURES.md#-modular-medicine-system)
|
|
||||||
4. **Dose Tracking**: See [FEATURES.md - Advanced Dose Tracking](FEATURES.md#-advanced-dose-tracking)
|
|
||||||
5. **Data Export**: See [EXPORT_SYSTEM.md](EXPORT_SYSTEM.md)
|
|
||||||
|
|
||||||
### Development
|
|
||||||
1. **Setup**: See [DEVELOPMENT.md - Development Environment Setup](DEVELOPMENT.md#development-environment-setup)
|
|
||||||
2. **Testing**: See [TESTING.md](TESTING.md) - Comprehensive testing guide
|
|
||||||
3. **Architecture**: See [FEATURES.md - Technical Architecture](FEATURES.md#technical-architecture)
|
|
||||||
4. **Contributing**: See [DEVELOPMENT.md - Development Workflow](DEVELOPMENT.md#development-workflow)
|
|
||||||
|
|
||||||
## 📋 What's New in Documentation
|
|
||||||
|
|
||||||
### Recent Updates (v1.9.5)
|
|
||||||
- **Consolidated Structure**: Merged UI improvements into main features documentation
|
|
||||||
- **Enhanced Features Guide**: Added comprehensive UI/UX documentation
|
|
||||||
- **Updated Changelog**: Detailed UI/UX overhaul documentation
|
|
||||||
- **Improved Navigation**: Better cross-referencing between documents
|
|
||||||
|
|
||||||
### Documentation Highlights
|
|
||||||
- **Professional UI/UX**: Complete documentation of the new theme system
|
|
||||||
- **Keyboard Efficiency**: Comprehensive shortcut system documentation
|
|
||||||
- **Developer-Friendly**: Enhanced development and testing documentation
|
|
||||||
- **User-Focused**: Clear separation of user vs developer documentation
|
|
||||||
|
|
||||||
## 🔍 Finding Information
|
|
||||||
|
|
||||||
### By Topic
|
|
||||||
- **Installation & Setup** → [README.md](../README.md)
|
|
||||||
- **UI/UX and Themes** → [FEATURES.md - Modern UI/UX System](FEATURES.md#-modern-uiux-system-new-in-v195)
|
|
||||||
- **Feature Usage** → [FEATURES.md](FEATURES.md)
|
|
||||||
- **Keyboard Shortcuts** → [KEYBOARD_SHORTCUTS.md](KEYBOARD_SHORTCUTS.md)
|
|
||||||
- **Menu Theming** → [MENU_THEMING.md](MENU_THEMING.md)
|
|
||||||
- **Testing** → [TESTING.md](TESTING.md)
|
|
||||||
- **Data Export** → [EXPORT_SYSTEM.md](EXPORT_SYSTEM.md)
|
|
||||||
- **Development** → [DEVELOPMENT.md](DEVELOPMENT.md)
|
|
||||||
- **Version History** → [CHANGELOG.md](CHANGELOG.md)
|
|
||||||
|
|
||||||
### By User Type
|
|
||||||
- **End Users** → Start with [README.md](../README.md), then [FEATURES.md](FEATURES.md)
|
|
||||||
- **Power Users** → [KEYBOARD_SHORTCUTS.md](KEYBOARD_SHORTCUTS.md) and [EXPORT_SYSTEM.md](EXPORT_SYSTEM.md)
|
|
||||||
- **Developers** → [DEVELOPMENT.md](DEVELOPMENT.md), [TESTING.md](TESTING.md), and [FEATURES.md - Technical Architecture](FEATURES.md#technical-architecture)
|
|
||||||
- **Contributors** → All documentation, especially [DEVELOPMENT.md](DEVELOPMENT.md) and [TESTING.md](TESTING.md)
|
|
||||||
|
|
||||||
### By Task
|
|
||||||
- **Install TheChart** → [README.md - Installation](../README.md#installation)
|
|
||||||
- **Change Theme** → [FEATURES.md - Settings and Theme Management](FEATURES.md#️-settings-and-theme-management)
|
|
||||||
- **Learn Shortcuts** → [KEYBOARD_SHORTCUTS.md](KEYBOARD_SHORTCUTS.md)
|
|
||||||
- **Add New Medicine** → [FEATURES.md - Modular Medicine System](FEATURES.md#-modular-medicine-system)
|
|
||||||
- **Track Doses** → [FEATURES.md - Advanced Dose Tracking](FEATURES.md#-advanced-dose-tracking)
|
|
||||||
- **Export Data** → [EXPORT_SYSTEM.md](EXPORT_SYSTEM.md)
|
|
||||||
- **Run Tests** → [TESTING.md](TESTING.md) - Comprehensive testing guide
|
|
||||||
- **Debug Issues** → [TESTING.md - Troubleshooting](TESTING.md#troubleshooting)
|
|
||||||
- **Deploy Application** → [README.md - Deployment](../README.md#deployment)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Need help?** Check the troubleshooting sections in [README.md](../README.md#troubleshooting) and [DEVELOPMENT.md](DEVELOPMENT.md#debugging-and-troubleshooting).
|
|
||||||
@@ -1,296 +0,0 @@
|
|||||||
# Testing Guide
|
|
||||||
|
|
||||||
This document provides a comprehensive guide to testing in TheChart application.
|
|
||||||
|
|
||||||
## Test Organization
|
|
||||||
|
|
||||||
### Directory Structure
|
|
||||||
|
|
||||||
```
|
|
||||||
thechart/
|
|
||||||
├── tests/ # Unit tests (pytest)
|
|
||||||
│ ├── test_theme_manager.py
|
|
||||||
│ ├── test_data_manager.py
|
|
||||||
│ ├── test_ui_manager.py
|
|
||||||
│ ├── test_graph_manager.py
|
|
||||||
│ └── ...
|
|
||||||
├── scripts/ # Integration tests & demos
|
|
||||||
│ ├── integration_test.py
|
|
||||||
│ ├── test_menu_theming.py
|
|
||||||
│ ├── test_note_saving.py
|
|
||||||
│ └── ...
|
|
||||||
```
|
|
||||||
|
|
||||||
## Test Categories
|
|
||||||
|
|
||||||
### 1. Unit Tests (`/tests/`)
|
|
||||||
|
|
||||||
**Purpose**: Test individual components in isolation
|
|
||||||
**Framework**: pytest
|
|
||||||
**Location**: `/tests/` directory
|
|
||||||
|
|
||||||
#### Running Unit Tests
|
|
||||||
```bash
|
|
||||||
cd /home/will/Code/thechart
|
|
||||||
source .venv/bin/activate.fish
|
|
||||||
python -m pytest tests/
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Available Unit Tests
|
|
||||||
- `test_theme_manager.py` - Theme system and menu theming
|
|
||||||
- `test_data_manager.py` - Data persistence and CSV operations
|
|
||||||
- `test_ui_manager.py` - UI component functionality
|
|
||||||
- `test_graph_manager.py` - Graph generation and display
|
|
||||||
- `test_constants.py` - Application constants
|
|
||||||
- `test_logger.py` - Logging system
|
|
||||||
- `test_main.py` - Main application logic
|
|
||||||
|
|
||||||
#### Writing Unit Tests
|
|
||||||
```python
|
|
||||||
# Example unit test structure
|
|
||||||
import unittest
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
|
|
||||||
# Add src to path
|
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'src'))
|
|
||||||
|
|
||||||
from your_module import YourClass
|
|
||||||
|
|
||||||
class TestYourClass(unittest.TestCase):
|
|
||||||
def setUp(self):
|
|
||||||
"""Set up test fixtures."""
|
|
||||||
pass
|
|
||||||
|
|
||||||
def tearDown(self):
|
|
||||||
"""Clean up after tests."""
|
|
||||||
pass
|
|
||||||
|
|
||||||
def test_functionality(self):
|
|
||||||
"""Test specific functionality."""
|
|
||||||
pass
|
|
||||||
```
|
|
||||||
|
|
||||||
### 2. Integration Tests (`/scripts/`)
|
|
||||||
|
|
||||||
**Purpose**: Test complete workflows and system interactions
|
|
||||||
**Framework**: Custom test scripts
|
|
||||||
**Location**: `/scripts/` directory
|
|
||||||
|
|
||||||
#### Available Integration Tests
|
|
||||||
|
|
||||||
##### `integration_test.py`
|
|
||||||
Comprehensive export system test:
|
|
||||||
- Tests JSON, XML, PDF export formats
|
|
||||||
- Validates data integrity
|
|
||||||
- Tests file creation and cleanup
|
|
||||||
- No GUI dependencies
|
|
||||||
|
|
||||||
```bash
|
|
||||||
.venv/bin/python scripts/integration_test.py
|
|
||||||
```
|
|
||||||
|
|
||||||
##### `test_note_saving.py`
|
|
||||||
Note persistence functionality:
|
|
||||||
- Tests note saving to CSV
|
|
||||||
- Validates special character handling
|
|
||||||
- Tests note retrieval
|
|
||||||
|
|
||||||
##### `test_update_entry.py`
|
|
||||||
Entry modification functionality:
|
|
||||||
- Tests data update operations
|
|
||||||
- Validates date handling
|
|
||||||
- Tests duplicate prevention
|
|
||||||
|
|
||||||
##### `test_keyboard_shortcuts.py`
|
|
||||||
Keyboard shortcut system:
|
|
||||||
- Tests key binding functionality
|
|
||||||
- Validates shortcut responses
|
|
||||||
- Tests keyboard event handling
|
|
||||||
|
|
||||||
### 3. Interactive Demonstrations (`/scripts/`)
|
|
||||||
|
|
||||||
**Purpose**: Visual and interactive testing of UI features
|
|
||||||
**Framework**: tkinter-based demos
|
|
||||||
|
|
||||||
##### `test_menu_theming.py`
|
|
||||||
Interactive menu theming demonstration:
|
|
||||||
- Live theme switching
|
|
||||||
- Visual color display
|
|
||||||
- Real-time menu updates
|
|
||||||
|
|
||||||
```bash
|
|
||||||
.venv/bin/python scripts/test_menu_theming.py
|
|
||||||
```
|
|
||||||
|
|
||||||
## Running Tests
|
|
||||||
|
|
||||||
### Complete Test Suite
|
|
||||||
```bash
|
|
||||||
cd /home/will/Code/thechart
|
|
||||||
source .venv/bin/activate.fish
|
|
||||||
|
|
||||||
# Run unit tests
|
|
||||||
python -m pytest tests/ -v
|
|
||||||
|
|
||||||
# Run integration tests
|
|
||||||
python scripts/integration_test.py
|
|
||||||
|
|
||||||
# Run specific feature tests
|
|
||||||
python scripts/test_note_saving.py
|
|
||||||
python scripts/test_update_entry.py
|
|
||||||
```
|
|
||||||
|
|
||||||
### Individual Test Categories
|
|
||||||
```bash
|
|
||||||
# Unit tests only
|
|
||||||
python -m pytest tests/
|
|
||||||
|
|
||||||
# Specific unit test file
|
|
||||||
python -m pytest tests/test_theme_manager.py -v
|
|
||||||
|
|
||||||
# Integration test
|
|
||||||
python scripts/integration_test.py
|
|
||||||
|
|
||||||
# Interactive demo
|
|
||||||
python scripts/test_menu_theming.py
|
|
||||||
```
|
|
||||||
|
|
||||||
### Test Runner Script
|
|
||||||
```bash
|
|
||||||
# Use the main test runner
|
|
||||||
python scripts/run_tests.py
|
|
||||||
```
|
|
||||||
|
|
||||||
## Test Environment Setup
|
|
||||||
|
|
||||||
### Prerequisites
|
|
||||||
1. **Virtual Environment**: Ensure `.venv` is activated
|
|
||||||
2. **Dependencies**: All requirements installed via `uv`
|
|
||||||
3. **Test Data**: Main `thechart_data.csv` file present
|
|
||||||
|
|
||||||
### Environment Activation
|
|
||||||
```bash
|
|
||||||
# Fish shell
|
|
||||||
source .venv/bin/activate.fish
|
|
||||||
|
|
||||||
# Bash/Zsh
|
|
||||||
source .venv/bin/activate
|
|
||||||
```
|
|
||||||
|
|
||||||
## Writing New Tests
|
|
||||||
|
|
||||||
### Unit Test Guidelines
|
|
||||||
1. Place in `/tests/` directory
|
|
||||||
2. Use pytest framework
|
|
||||||
3. Follow naming convention: `test_<module_name>.py`
|
|
||||||
4. Include setup/teardown for fixtures
|
|
||||||
5. Test edge cases and error conditions
|
|
||||||
|
|
||||||
### Integration Test Guidelines
|
|
||||||
1. Place in `/scripts/` directory
|
|
||||||
2. Test complete workflows
|
|
||||||
3. Include cleanup procedures
|
|
||||||
4. Document expected behavior
|
|
||||||
5. Handle GUI dependencies appropriately
|
|
||||||
|
|
||||||
### Interactive Demo Guidelines
|
|
||||||
1. Place in `/scripts/` directory
|
|
||||||
2. Include clear instructions
|
|
||||||
3. Provide visual feedback
|
|
||||||
4. Allow easy theme/feature switching
|
|
||||||
5. Include exit mechanisms
|
|
||||||
|
|
||||||
## Test Data Management
|
|
||||||
|
|
||||||
### Test File Creation
|
|
||||||
- Use `tempfile` module for temporary files
|
|
||||||
- Clean up created files in teardown
|
|
||||||
- Don't commit test data to repository
|
|
||||||
|
|
||||||
### CSV Test Data
|
|
||||||
- Most tests use main `thechart_data.csv`
|
|
||||||
- Some tests create temporary CSV files
|
|
||||||
- Integration tests may create export directories
|
|
||||||
|
|
||||||
## Continuous Integration
|
|
||||||
|
|
||||||
### Local Testing Workflow
|
|
||||||
```bash
|
|
||||||
# 1. Run linting
|
|
||||||
python -m flake8 src/ tests/ scripts/
|
|
||||||
|
|
||||||
# 2. Run unit tests
|
|
||||||
python -m pytest tests/ -v
|
|
||||||
|
|
||||||
# 3. Run integration tests
|
|
||||||
python scripts/integration_test.py
|
|
||||||
|
|
||||||
# 4. Run specific feature tests as needed
|
|
||||||
python scripts/test_note_saving.py
|
|
||||||
```
|
|
||||||
|
|
||||||
### Pre-commit Checklist
|
|
||||||
- [ ] All unit tests pass
|
|
||||||
- [ ] Integration tests pass
|
|
||||||
- [ ] New functionality has tests
|
|
||||||
- [ ] Documentation updated
|
|
||||||
- [ ] Code follows style guidelines
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
### Common Issues
|
|
||||||
|
|
||||||
#### Import Errors
|
|
||||||
```python
|
|
||||||
# Ensure src is in path
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'src'))
|
|
||||||
```
|
|
||||||
|
|
||||||
#### GUI Test Issues
|
|
||||||
- Use `root.withdraw()` to hide test windows
|
|
||||||
- Ensure proper cleanup with `root.destroy()`
|
|
||||||
- Consider mocking GUI components for unit tests
|
|
||||||
|
|
||||||
#### File Permission Issues
|
|
||||||
- Ensure test has write permissions
|
|
||||||
- Use temporary directories for test files
|
|
||||||
- Clean up files in teardown methods
|
|
||||||
|
|
||||||
### Debug Mode
|
|
||||||
```bash
|
|
||||||
# Run with debug logging
|
|
||||||
python -c "import logging; logging.basicConfig(level=logging.DEBUG)" scripts/test_script.py
|
|
||||||
```
|
|
||||||
|
|
||||||
## Test Coverage
|
|
||||||
|
|
||||||
### Current Coverage Areas
|
|
||||||
- ✅ Theme management and menu theming
|
|
||||||
- ✅ Data persistence and CSV operations
|
|
||||||
- ✅ Export functionality (JSON, XML, PDF)
|
|
||||||
- ✅ UI component initialization
|
|
||||||
- ✅ Graph generation
|
|
||||||
- ✅ Note saving and retrieval
|
|
||||||
- ✅ Entry update operations
|
|
||||||
- ✅ Keyboard shortcuts
|
|
||||||
|
|
||||||
### Areas for Expansion
|
|
||||||
- Medicine and pathology management
|
|
||||||
- Settings persistence
|
|
||||||
- Error handling edge cases
|
|
||||||
- Performance testing
|
|
||||||
- UI interaction testing
|
|
||||||
|
|
||||||
## Contributing Tests
|
|
||||||
|
|
||||||
When contributing new tests:
|
|
||||||
|
|
||||||
1. **Choose the right category**: Unit vs Integration vs Demo
|
|
||||||
2. **Follow naming conventions**: Clear, descriptive names
|
|
||||||
3. **Include documentation**: Docstrings and comments
|
|
||||||
4. **Test edge cases**: Not just happy path
|
|
||||||
5. **Clean up resources**: Temporary files, windows, etc.
|
|
||||||
6. **Update documentation**: Add to this guide and scripts/README.md
|
|
||||||
Reference in New Issue
Block a user