Skip to content

fix(pipeline): key per-series results uniquely — duplicate descriptions no longer drop series#153

Merged
Liohtml merged 1 commit into
mainfrom
claude/dependabot-prs-q6u94z
Jul 10, 2026
Merged

fix(pipeline): key per-series results uniquely — duplicate descriptions no longer drop series#153
Liohtml merged 1 commit into
mainfrom
claude/dependabot-prs-q6u94z

Conversation

@Liohtml

@Liohtml Liohtml commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Summary

context.volumes and context.detected_planes — and everything keyed off context.volumes downstream (anomaly scores, top slices, vision analysis, report sections) — used series.description as the dict key. SeriesDescription (0008,103E) is an optional DICOM tag that is frequently empty or repeated in real MRI studies (repeated localizers, re-run sequences), so colliding series silently overwrote each other: studies lost entire series with no warning and produced incomplete analyses.

Fixes #135

Changes

  • src/medcheck/pipeline/preprocess.py: new _series_keys() generates one unique, human-readable key per series for the whole study:
    • unique descriptions are kept verbatim (labels and behavior unchanged for the common case)
    • empty descriptions fall back to series-<number> (positional index if the number is unset)
    • duplicates get a numeric suffix: pd_sag, pd_sag (2), …
    • volumes and detected_planes are written with the same key list (zip(..., strict=True))
  • tests/unit/test_pipeline/test_preprocess.py: 2 regression tests — two series with identical descriptions both survive; two series with empty descriptions both survive

Testing

  • Existing tests pass (uv run pytest) — 180 passed, all existing key expectations (pd_sag, test, …) unchanged
  • New tests added for new functionality — 2 regression tests
  • Coverage does not decrease (uv run pytest --cov-fail-under=85) — 87.64%
  • Linting passes (uv run ruff check .)
  • Type checking passes (uv run mypy src/medcheck --strict)
  • Pre-commit hooks pass — ruff hooks pass locally; full pre-commit not run

Additional Notes

Key generation lives in exactly one place (preprocess); ml_analysis and vision_analysis already iterate context.volumes.items(), so they pick up the unique keys without changes. detect_plane() still receives the real description, only the dict key is disambiguated.

🤖 Generated with Claude Code

https://claude.ai/code/session_01W4svt5QTs4WUMSy4HwiVt9


Generated by Claude Code

…ns no longer drop series

Volumes, detected planes, and everything keyed off context.volumes
downstream (anomaly scores, top slices, vision analysis, report
sections) used series.description as dict key. SeriesDescription is an
optional DICOM tag that is frequently empty or repeated, so colliding
series silently overwrote each other and studies lost entire series
with no warning. Keys are now generated once per study: unique
descriptions stay verbatim (labels unchanged for the common case), empty
ones fall back to the series number, duplicates get a numeric suffix.

Fixes #135

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W4svt5QTs4WUMSy4HwiVt9
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Warning

Review limit reached

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

Next review available in: 32 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 13b712dd-f8d4-4534-b372-4abe5a71a6da

📥 Commits

Reviewing files that changed from the base of the PR and between 063b913 and d11a527.

📒 Files selected for processing (2)
  • src/medcheck/pipeline/preprocess.py
  • tests/unit/test_pipeline/test_preprocess.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/dependabot-prs-q6u94z

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.

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Liohtml Liohtml merged commit 0336537 into main Jul 10, 2026
14 checks passed
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.

[repo-health] High: Pipeline keys volumes/planes/scores by series.description — duplicate or empty descriptions silently drop series

2 participants