# Contributing to MediGuard AI RAG-Helper First off, thank you for considering contributing to MediGuard AI! It's people like you that make this project better for everyone. ## 📋 Table of Contents - [Code of Conduct](#code-of-conduct) - [Getting Started](#getting-started) - [How Can I Contribute?](#how-can-i-contribute) - [Development Setup](#development-setup) - [Style Guidelines](#style-guidelines) - [Commit Messages](#commit-messages) - [Pull Request Process](#pull-request-process) ## Code of Conduct This project adheres to a code of conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to the project maintainers. ### Our Standards - **Be Respectful**: Treat everyone with respect - **Be Collaborative**: Work together effectively - **Be Professional**: Maintain professionalism at all times - **Be Inclusive**: Welcome diverse perspectives and backgrounds ## Getting Started ### Prerequisites - Python 3.11+ - Git - A GitHub account - FREE API key from Groq or Google Gemini ### First Contribution 1. **Fork the repository** 2. **Clone your fork** ```bash git clone https://github.com/your-username/RagBot.git cd RagBot ``` 3. **Set up development environment** (see below) 4. **Create a new branch** ```bash git checkout -b feature/your-feature-name ``` ## How Can I Contribute? ### 🐛 Reporting Bugs **Before submitting a bug report:** - Check the [existing issues](https://github.com/yourusername/RagBot/issues) - Ensure you're using the latest version - Collect relevant information (Python version, OS, error messages) **How to submit a good bug report:** - Use a clear and descriptive title - Describe the exact steps to reproduce - Provide specific examples - Describe the behavior you observed and what you expected - Include screenshots if applicable - Include your environment details **Template:** ```markdown ## Bug Description [Clear description of the bug] ## Steps to Reproduce 1. 2. 3. ## Expected Behavior [What should happen] ## Actual Behavior [What actually happens] ## Environment - OS: [e.g., Windows 11, macOS 14, Ubuntu 22.04] - Python Version: [e.g., 3.11.5] - MediGuard Version: [e.g., 1.0.0] ## Additional Context [Any other relevant information] ``` ### 💡 Suggesting Enhancements **Before submitting an enhancement suggestion:** - Check if it's already been suggested - Determine which part of the project it relates to - Consider if it aligns with the project's goals **How to submit a good enhancement suggestion:** - Use a clear and descriptive title - Provide a detailed description of the proposed enhancement - Explain why this enhancement would be useful - List potential benefits and drawbacks - Provide examples or mockups if applicable ### 🔨 Pull Requests **Good first issues:** - Look for issues labeled `good first issue` - Documentation improvements - Test coverage improvements - Bug fixes **Areas needing contribution:** - Additional biomarker support - Disease model improvements - Performance optimizations - Documentation enhancements - Test coverage - UI/UX improvements ## Development Setup ### 1. Fork and Clone ```bash # Fork via GitHub UI, then: git clone https://github.com/your-username/RagBot.git cd RagBot ``` ### 2. Create Virtual Environment ```bash python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate ``` ### 3. Install Dependencies ```bash # Core dependencies pip install -r requirements.txt # Development dependencies pip install pytest pytest-cov black flake8 mypy ``` ### 4. Configure Environment ```bash cp .env.template .env # Edit .env with your API keys ``` ### 5. Run Tests ```bash # Run unit tests (30 tests) .venv\Scripts\python.exe -m pytest tests/ -q \ --ignore=tests/test_basic.py \ --ignore=tests/test_diabetes_patient.py \ --ignore=tests/test_evolution_loop.py \ --ignore=tests/test_evolution_quick.py \ --ignore=tests/test_evaluation_system.py # Run with coverage .venv\Scripts\python.exe -m pytest --cov=src tests/ # Run specific test file .venv\Scripts\python.exe -m pytest tests/test_codebase_fixes.py -v ``` ## Style Guidelines ### Python Code Style We follow **PEP 8** with some modifications: - **Line length**: 100 characters maximum - **Imports**: Organized with `isort` - **Formatting**: Automated with `black` - **Type hints**: Required for function signatures - **Docstrings**: Google style ### Code Formatting **Before committing, run:** ```bash # Auto-format code black src/ scripts/ tests/ # Check style compliance flake8 src/ scripts/ tests/ # Type checking mypy src/ # Import sorting isort src/ scripts/ tests/ ``` ### Docstring Example ```python def analyze_biomarkers( biomarkers: Dict[str, float], patient_context: Optional[Dict[str, Any]] = None ) -> AnalysisResult: """ Analyze patient biomarkers and generate clinical insights. Args: biomarkers: Dictionary of biomarker names to values patient_context: Optional patient demographic information Returns: AnalysisResult containing predictions and recommendations Raises: ValueError: If biomarkers dictionary is empty ValidationError: If biomarker values are invalid Example: >>> result = analyze_biomarkers({"Glucose": 185, "HbA1c": 8.2}) >>> print(result.prediction.disease) 'Diabetes' """ pass ``` ### Testing Guidelines - **Write tests** for all new features - **Maintain coverage** above 80% - **Test edge cases** and error conditions - **Use descriptive test names** **Test Example:** ```python def test_biomarker_validation_with_critical_high_glucose(): """Test that critically high glucose values trigger safety alerts.""" validator = BiomarkerValidator() biomarkers = {"Glucose": 400} # Critically high flags, alerts = validator.validate_all(biomarkers) assert len(alerts) > 0 assert any("critical" in alert.message.lower() for alert in alerts) ``` ## Commit Messages ### Format ``` ():