feat: Remove outdated testing documentation and add comprehensive development and feature guides
- Deleted `TESTING_SETUP.md` and `TEST_UPDATES_SUMMARY.md` as they were outdated. - Introduced `CHANGELOG.md` to document notable changes and version history. - Added `DEVELOPMENT.md` for detailed development setup, testing framework, and debugging guidance. - Created `FEATURES.md` to outline core features and functionalities of TheChart. - Established `README.md` as a centralized documentation index for users and developers.
This commit is contained in:
200
docs/CHANGELOG.md
Normal file
200
docs/CHANGELOG.md
Normal file
@@ -0,0 +1,200 @@
|
||||
# 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.3.4] - 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).
|
||||
340
docs/DEVELOPMENT.md
Normal file
340
docs/DEVELOPMENT.md
Normal file
@@ -0,0 +1,340 @@
|
||||
# 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).
|
||||
232
docs/FEATURES.md
Normal file
232
docs/FEATURES.md
Normal file
@@ -0,0 +1,232 @@
|
||||
# TheChart - Features Documentation
|
||||
|
||||
## Overview
|
||||
TheChart is a comprehensive medication tracking application that allows users to monitor medication intake, symptom tracking, and visualize treatment progress over time.
|
||||
|
||||
## 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
|
||||
|
||||
### 💊 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
|
||||
|
||||
## Technical Architecture
|
||||
|
||||
### 🏗️ Modular Design
|
||||
- **MedicineManager**: Core medicine CRUD operations
|
||||
- **PathologyManager**: Symptom and pathology management
|
||||
- **GraphManager**: All graph-related operations and visualizations
|
||||
- **UIManager**: User interface creation and management
|
||||
- **DataManager**: CSV operations and data persistence
|
||||
|
||||
### 🔧 Configuration Management
|
||||
- **JSON-based Configuration**: `medicines.json` and `pathologies.json`
|
||||
- **Dynamic Loading**: Runtime configuration updates
|
||||
- **Validation**: Input validation and error handling
|
||||
- **Backward Compatibility**: Seamless updates and migrations
|
||||
|
||||
### 📈 Data Processing
|
||||
- **Pandas Integration**: Efficient data manipulation and analysis
|
||||
- **Matplotlib Visualization**: Professional graph rendering
|
||||
- **Robust Parsing**: Handles various data formats and edge cases
|
||||
- **Real-time Calculations**: Dynamic dose totals and averages
|
||||
|
||||
## 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).
|
||||
76
docs/README.md
Normal file
76
docs/README.md
Normal file
@@ -0,0 +1,76 @@
|
||||
# TheChart Documentation
|
||||
|
||||
Welcome to TheChart documentation! This guide will help you navigate the available documentation.
|
||||
|
||||
## 📖 Documentation Index
|
||||
|
||||
### For Users
|
||||
- **[README.md](../README.md)** - Quick start guide and installation
|
||||
- **[Features Guide](FEATURES.md)** - Complete feature documentation
|
||||
- Modular Medicine System
|
||||
- Advanced Dose Tracking
|
||||
- Graph Visualizations
|
||||
- Data Management
|
||||
|
||||
### 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 updates and improvements
|
||||
- Migration notes
|
||||
- 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. **Key Features**: See [FEATURES.md](FEATURES.md)
|
||||
|
||||
### Development
|
||||
1. **Setup**: See [DEVELOPMENT.md - Development Environment Setup](DEVELOPMENT.md#development-environment-setup)
|
||||
2. **Testing**: See [DEVELOPMENT.md - Testing Framework](DEVELOPMENT.md#testing-framework)
|
||||
3. **Contributing**: See [DEVELOPMENT.md - Development Workflow](DEVELOPMENT.md#development-workflow)
|
||||
|
||||
### Advanced Usage
|
||||
1. **Medicine Management**: See [FEATURES.md - Modular Medicine System](FEATURES.md#-modular-medicine-system)
|
||||
2. **Dose Tracking**: See [FEATURES.md - Advanced Dose Tracking](FEATURES.md#-advanced-dose-tracking)
|
||||
3. **Visualizations**: See [FEATURES.md - Enhanced Graph Visualization](FEATURES.md#-enhanced-graph-visualization)
|
||||
|
||||
## 📋 Documentation Standards
|
||||
|
||||
All documentation follows these principles:
|
||||
- **Clear Structure**: Hierarchical organization with clear headings
|
||||
- **Practical Examples**: Code snippets and usage examples
|
||||
- **Up-to-date**: Synchronized with current codebase
|
||||
- **Comprehensive**: Covers all major features and workflows
|
||||
- **Cross-referenced**: Links between related sections
|
||||
|
||||
## 🔍 Finding Information
|
||||
|
||||
### By Topic
|
||||
- **Installation & Setup** → [README.md](../README.md)
|
||||
- **Feature Usage** → [FEATURES.md](FEATURES.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)
|
||||
- **Developers** → [DEVELOPMENT.md](DEVELOPMENT.md) and [CHANGELOG.md](CHANGELOG.md)
|
||||
- **Contributors** → All documentation, especially [DEVELOPMENT.md](DEVELOPMENT.md)
|
||||
|
||||
### By Task
|
||||
- **Install TheChart** → [README.md - Installation](../README.md#installation)
|
||||
- **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)
|
||||
- **Run Tests** → [DEVELOPMENT.md - Testing Framework](DEVELOPMENT.md#testing-framework)
|
||||
- **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).
|
||||
Reference in New Issue
Block a user