Skip to content

Make mass transfer discovery resilient to non-conformant StudyDate/StudyTime - #400

Open
samuelvkwong wants to merge 1 commit into
mainfrom
fix/mass-transfer-skip-invalid-study-metadata
Open

Make mass transfer discovery resilient to non-conformant StudyDate/StudyTime#400
samuelvkwong wants to merge 1 commit into
mainfrom
fix/mass-transfer-skip-invalid-study-metadata

Conversation

@samuelvkwong

Copy link
Copy Markdown
Member

Summary

  • Some PACS return studies with non-conformant date/time values (seen in production: StudyDate with an invalid month, StudyTime 1113.672). _discover_series raised a bare ValueError from pydicom's DA/TM parsing, which nothing caught, so the whole daily partition task failed (mass transfer job 2, tasks 8543/9805) and stayed failed on every retry.
  • StudyTime: fall back to midnight when it cannot be parsed (it is only used for folder naming).
  • StudyDate (or anything else still unparseable): skip that single study instead of failing the task. Skipped studies are listed in the task log and the task finishes as WARNING, so the omission stays visible.
  • Refactor: per-study discovery extracted into _discover_study_series() so the skip is a single try/except around it.

Test plan

  • New tests in adit/mass_transfer/tests/test_processor.py: malformed StudyTime is salvaged, malformed StudyDate skips only that study with WARNING, all-malformed partition warns instead of failing
  • adit/mass_transfer/tests/test_processor.py green (102 passed), ruff + pyright clean

🤖 Generated with Claude Code

Some PACS return studies with non-conformant date/time values (e.g.
StudyDate "20143822" or StudyTime "1113.672"). These raised ValueError
during series discovery and failed the whole partition task, even though
only a single study was affected.

- Fall back to midnight when StudyTime cannot be parsed (the time is
  only cosmetic for folder naming).
- Skip studies whose metadata still cannot be parsed (e.g. invalid
  StudyDate), instead of failing the task. Skipped studies are listed
  in the task log and the task finishes as WARNING so the data loss
  stays visible.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@samuelvkwong, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 59 minutes

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

Wait for the limit to reset, then comment @coderabbitai review or push new commits to the PR.

An organization admin can change what happens after included review limits in Billing.

How do review limits work?

CodeRabbit enforces per-developer PR review limits within each organization.

For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e9bebf2e-4cf9-4539-be84-5a063700bb84

📥 Commits

Reviewing files that changed from the base of the PR and between e3bd000 and cbe581d.

📒 Files selected for processing (2)
  • adit/mass_transfer/processors.py
  • adit/mass_transfer/tests/test_processor.py

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant