-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor SCORE2 modules and extract shared components #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This refactoring addresses code duplication between SCORE2 and SCORE2-Diabetes modules by: 1. Created new vitals/schemas/ module with organized structure: - units.py: All Units classes (PhenoageUnits, Score2Units, Score2DiabetesUnits) - markers.py: All Markers classes (PhenoageMarkers, Score2Markers, Score2DiabetesMarkers) - coefficients.py: Sex-split coefficient classes for better type safety - core.py: Shared components (BaselineSurvival, CalibrationScales, utility functions) 2. Replaced duplicate ModelCoefficients with sex-specific classes: - Score2MaleCoefficients and Score2FemaleCoefficients - Score2DiabetesMaleCoefficients and Score2DiabetesFemaleCoefficients (extending base) 3. Extracted shared utility functions: - determine_risk_category(): Common risk categorization logic - apply_calibration(): Common calibration formula 4. Updated all imports across the codebase to use new schema structure 5. Removed original biomarkers/schemas.py file This refactoring follows DRY principles while maintaining simplicity and type safety. All tests pass and code formatting is clean. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Claude finished @fbraza's task —— View job PR Review Complete ✅Todo List
Code Review Feedback✅ Excellent Refactoring - Well-structured and maintainableThis PR demonstrates a clean, thoughtful refactoring that significantly improves code organization and maintainability. Here's my detailed analysis: Code Quality & Best Practices ⭐⭐⭐⭐⭐Strengths:
Minor suggestions:
Architecture & Maintainability ⭐⭐⭐⭐⭐Major improvements:
Potential Issues
|
|
Claude finished @fbraza's task —— View job PR Review Complete ✅Todo List
Code Review Feedback✅ Excellent Refactoring - Well-structured and maintainableThis PR demonstrates a clean, thoughtful refactoring that significantly improves code organization and maintainability. Here's my detailed analysis: Code Quality & Best Practices ⭐⭐⭐⭐⭐Strengths:
Minor suggestions:
Architecture & Maintainability ⭐⭐⭐⭐⭐Major improvements:
Potential Issues
|
- Move common functions (risk categorization, calibration, gompertz model) to helpers.py - Consolidate schema modules into algorithm-specific files (phenoage.py, score2.py) - Rename coefficient classes for clarity and consistency - Update imports across all compute modules to use new schema structure - Remove redundant schema files (core.py, markers.py, units.py)
9fad0bf to
f44b399
Compare
|
Claude finished @fbraza's task —— View job PR Review Complete ✅Todo List
Code Review Feedback✅ Excellent Refactoring - Well-structured and maintainableThis PR demonstrates a clean, thoughtful refactoring that significantly improves code organization and maintainability. Here's my detailed analysis: Code Quality & Best Practices ⭐⭐⭐⭐⭐Strengths:
Minor suggestions:
Architecture & Maintainability ⭐⭐⭐⭐⭐Major improvements:
Potential Issues
|
Summary
• Refactored SCORE2 and SCORE2 Diabetes compute functions for better maintainability
• Extracted common schemas into a dedicated
vitals/schemas/module• Reorganized biomarker validation and coefficient handling
• Reduced code duplication between SCORE2 variants
Changes
vitals/schemas/module with organized components:core.py: Core biomarker and patient data modelsmarkers.py: Biomarker extraction and validation utilitiescoefficients.py: SCORE2 coefficient definitionsunits.py: Unit conversion utilities (moved from biomarkers/schemas.py)🤖 Generated with Claude Code