Skip to content

Preserve CancerVerse case ids so CV cards load correctly#81

Merged
aperson30 merged 1 commit into
mainfrom
fix/cv-id-passthrough
Jul 18, 2026
Merged

Preserve CancerVerse case ids so CV cards load correctly#81
aperson30 merged 1 commit into
mainfrom
fix/cv-id-passthrough

Conversation

@aperson30

Copy link
Copy Markdown
Collaborator

Root cause

itemToId did raw.match(/\d+/) on the case id, which stripped the CV_ prefix from "CV_00000001" and returned 1 as a number. The card then rebuilt it as PanTS_${1.padStart(8)}PanTS_00000001, hitting PanTS endpoints. So CancerVerse cases silently rendered as PanTS thumbnails or failed to load.

Fix

Introduce CaseId = number | string: PanTS stays a bare number, CancerVerse keeps its full prefixed string so it routes to the CV endpoints. Threaded through every place the id flows:

  • helpers/search.tsitemToId returns the full string for CV (startsWith("CV")), number otherwise; exported CaseId type.
  • components/Preview.tsxid: CaseId; caseIdStr branches on CV vs PanTS, so the thumbnail, viewer route, and (downstream) nifti/seg/report URLs all use the right prefix.
  • helpers/prefetchVolume.ts — accepts CaseId (the hover prefetch now warms the correct CV url).
  • routes/Homepage.tsx — grid state, ingestItems, and the save/compare features accept CaseId; the compare tray also accepts a typed CV_… id.
  • helpers/savedCases.tsSavedCase.id accepts string; loadSavedCases no longer filters out string ids.

Fully backward-compatible for PanTS (still numeric).

Testing

  • tsc -b clean
  • 103/103 frontend tests pass (added itemToId CV coverage)

Known follow-ups (out of scope — not the reported bug)

  • Viewer for CV: /case/CV_… loads the CT (backend dispatch works) and seg returns {"masks_available": false}; the viewer shows CT-only. Doesn't crash (getPanTSId tolerates the string), but full CT-only viewer polish (hiding mask UI) is a separate task.
  • Compare page for CV: CV cards can now be selected to compare, but ComparePage still parses ids as PanTS — comparing two CV cases won't render correctly yet. Worth a follow-up if CV comparison is wanted.

itemToId stripped the CV_ prefix ("CV_00000001" -> 1), then the card rebuilt it
as PanTS_00000001 and hit PanTS endpoints — so CancerVerse cases silently
rendered as PanTS thumbnails or failed to load.

Introduce a CaseId = number | string type: PanTS stays a bare number, CancerVerse
keeps its full prefixed string. Thread it through the grid state, Preview (thumb /
viewer route / caseIdStr now branch on CV), the hover prefetch, and the saved /
compare features (localStorage + compare tray now accept string ids).

Fully backward-compatible for PanTS (still numeric). Added itemToId CV coverage.
@aperson30
aperson30 merged commit c117a11 into main Jul 18, 2026
7 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.

1 participant