Spaces:
Sleeping
Sleeping
File size: 4,778 Bytes
9e00302 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | # Contributing to SecureLens
Thank you for your interest in contributing to SecureLens! This document provides guidelines and instructions for contributing.
---
## Code of Conduct
- Be respectful and professional
- Focus on medical ethics and patient privacy
- Follow Python best practices
- Maintain code quality and test coverage
---
## Getting Started
### 1. Setup Development Environment
```bash
# Clone repository
git clone https://github.com/yourusername/securelens.git
cd securelens
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements-dev.txt
# Install pre-commit hooks
pre-commit install
```
### 2. Create a Feature Branch
```bash
git checkout -b feature/your-feature-name
```
---
## Development Guidelines
### Code Style
- Use **Black** for formatting: `black .`
- Use **Flake8** for linting: `flake8 .`
- Use **Pylint** for analysis: `pylint cloud_server/`
- Use **isort** for imports: `isort .`
### Type Hints
All functions should have type hints:
```python
def predict(image: np.ndarray, context: ts.Context) -> dict:
"""
Run encrypted inference on X-ray image.
Args:
image: Preprocessed X-ray image
context: CKKS encryption context
Returns:
dict: {"prediction": "NORMAL/PNEUMONIA", "confidence": 0.95}
"""
```
### Testing
- Write tests for new features
- Run full test suite: `pytest tests/ -v --cov`
- Maintain >80% code coverage
- Include edge cases and error conditions
```bash
# Run tests
pytest tests/
# Run with coverage
pytest tests/ --cov=cloud_server --cov=crypto_layer
# Run specific test
pytest tests/test_api.py::test_predict
```
### Documentation
- Add docstrings to all functions
- Update README if behavior changes
- Document CKKS parameter changes
- Include examples for new features
---
## Commit Guidelines
Use conventional commits:
```
feat: Add differential privacy option
fix: Handle corrupted image uploads
docs: Update encryption parameter docs
test: Add security test cases
refactor: Optimize inference latency
```
---
## Pull Request Process
1. **Update your branch** with latest main:
```bash
git fetch origin
git rebase origin/main
```
2. **Run all checks locally**:
```bash
pytest tests/ -v
black --check .
flake8 .
```
3. **Create pull request** with:
- Clear description of changes
- Motivation/problem solved
- Testing performed
- Backwards compatibility notes
4. **Link issues**: Reference any related issues (#123)
5. **Code review**: Address reviewer feedback
---
## Areas for Contribution
### Priority Areas (High Impact)
- [ ] **ReLU Approximation** β Polynomial approximations for deeper HE
- [ ] **GPU Acceleration** β CUDA-based SEAL integration
- [ ] **Multi-disease** β Extend to ChestX-ray14 dataset
- [ ] **HIPAA Audit** β Formal security audit
- [ ] **Federated Learning** β Hospital network training
### Medium Priority
- [ ] Performance optimization
- [ ] Better error messages
- [ ] Enhanced logging
- [ ] API authentication
- [ ] Web UI improvements
### Low Priority
- [ ] Documentation improvements
- [ ] Code style cleanup
- [ ] Test coverage increase
- [ ] Dependency updates
---
## Testing Requirements
All submissions must:
1. Pass unit tests: `pytest tests/`
2. Pass type checking: `mypy cloud_server/`
3. Pass linting: `flake8 .`
4. Have >80% code coverage
5. Include docstrings
6. Have at least one test case per function
---
## Medical/Regulatory Considerations
When contributing medical-related features:
1. **Privacy-First**: Always assume patient data could be leaked
2. **Accuracy**: Medical accuracy is non-negotiable
3. **Compliance**: Consider HIPAA/GDPR/DPDP implications
4. **Testing**: Include both accuracy and edge case tests
5. **Documentation**: Clearly mark limitations and disclaimers
---
## Reporting Issues
When reporting bugs:
1. Use clear title describing the issue
2. Include steps to reproduce
3. Provide expected vs actual behavior
4. Include relevant logs/error messages
5. Specify Python version and OS
---
## Security
If you discover a security vulnerability:
1. **Do NOT** create a public GitHub issue
2. Email: securelens-security@example.com
3. Include description and proof of concept
4. Allow 90 days for fix before disclosure
---
## License
By contributing, you agree that your contributions will be licensed under the MIT License.
---
## Questions?
- Open a GitHub issue with `[question]` prefix
- Check existing documentation and FAQs
- Review discussion threads
---
**Thank you for contributing to SecureLens! π**
Your work helps advance privacy-preserving medical AI for everyone.
|