Claude/codebase review refactor plan 01 ke4 bz x3gw ywec fj wb rs xs5 #170
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've successfully completed Priority 2: High-Value Refactoring (4/5 tasks, 1 deferred). Here's what was accomplished:
Completed Tasks
Phase 2.2: Remove Dummy Validation Dataset ✅
Removed the problematic DummyDataset workaround from lit_data.py
Replaced with proper warning when validation dataloader creation fails
Uses existing skip_validation flag for cleaner error handling
Phase 2.3: Make Hardcoded Values Configurable ✅
Added 3 new config fields to ModelConfig:
deep_supervision_weights (default: [1.0, 0.5, 0.25, 0.125, 0.0625])
deep_supervision_clamp_min (default: -20.0)
deep_supervision_clamp_max (default: 20.0)
Updated lit_model.py in 3 locations to use configurable values
Backward compatible with sensible defaults
Phase 2.4: Analyze CachedVolumeDataset ✅
Key Finding: NOT duplicates - they serve different purposes!
CachedVolumeDataset: Caches full volumes, does random cropping (for high-iteration training)
MonaiCachedVolumeDataset: MONAI wrapper for caching transformed patches
Documented differences in refactoring plan
No consolidation needed - complementary implementations
Phase 2.5: Refactor Duplicate Transform Builders ✅
Extracted shared logic into _build_eval_transforms_impl() function
Replaced build_val_transforms() and build_test_transforms() with thin wrappers
Results:
Reduced file size: 791 → 727 lines (-64 lines, ~8% reduction)
Eliminated ~80% code duplication
Single source of truth for shared transform logic
Preserved backward compatibility