ENH: Fix directory structure for CHOP-Valve data#92
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughCHOP-Valve4D archives now extract into the parent dataset directory. Population and verification checks infer layouts from target directory names, and test archives include subdirectory-qualified members. ChangesCHOP-Valve4D dataset layout
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/physiotwin4d/data_download_tools.py (1)
247-251: 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick winFlattened directory paths break data verification and mesh extraction.
Passing
data_dirdirectly to_CHOPValve4DSubdirIsPopulatedcauses it to look for marker files (likeRVOT28-Dias.nii.gzor*.vtk) in the root dataset directory rather than the appropriate subdirectories.
- If the zip archives extract flat into
data_dir,AlterraandTPV25meshes will overwrite each other, and downloading one will cause the other to be skipped (sinceany(target_dir.glob("*.vtk"))matches both).- If the zip archives natively contain subdirectories (e.g.,
CT/), extracting todata_diravoids double-folders, but the population check will fail because it looks fordata_dir / "RVOT28-Dias.nii.gz"instead ofdata_dir / "CT" / "RVOT28-Dias.nii.gz". This causesVerifyCHOPValve4DDatato always fail and triggers re-downloads on every run.Restore the subdirectory paths for the checks to correctly isolate the assets:
src/physiotwin4d/data_download_tools.py#L247-L251: Passdata_dir / subdir_nameto_CHOPValve4DSubdirIsPopulatedinstead oftarget_dir. If you are extracting todata_dirto avoid double-folders, you can keeptarget_dir = data_dirfor the_DownloadAndExtractZipcall.src/physiotwin4d/data_download_tools.py#L307-L311: Append the respective subdirectory names by passingdata_dir / "CT",data_dir / "Alterra", anddata_dir / "TPV25"to_CHOPValve4DSubdirIsPopulated.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/physiotwin4d/data_download_tools.py` around lines 247 - 251, The population check in the download loop must use each asset’s subdirectory rather than the root data directory. In src/physiotwin4d/data_download_tools.py lines 247-251, pass data_dir / subdir_name to _CHOPValve4DSubdirIsPopulated while preserving target_dir for extraction; in lines 307-311, pass data_dir / "CT", data_dir / "Alterra", and data_dir / "TPV25" to the corresponding _CHOPValve4DSubdirIsPopulated calls.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/physiotwin4d/data_download_tools.py`:
- Around line 247-251: The population check in the download loop must use each
asset’s subdirectory rather than the root data directory. In
src/physiotwin4d/data_download_tools.py lines 247-251, pass data_dir /
subdir_name to _CHOPValve4DSubdirIsPopulated while preserving target_dir for
extraction; in lines 307-311, pass data_dir / "CT", data_dir / "Alterra", and
data_dir / "TPV25" to the corresponding _CHOPValve4DSubdirIsPopulated calls.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d02e7b02-a6d8-4bcb-acd7-9dd0caecd711
📒 Files selected for processing (1)
src/physiotwin4d/data_download_tools.py
Summary by CodeRabbit