Preserve CancerVerse case ids so CV cards load correctly#81
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Root cause
itemToIddidraw.match(/\d+/)on the case id, which stripped theCV_prefix from"CV_00000001"and returned1as a number. The card then rebuilt it asPanTS_${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.ts—itemToIdreturns the full string for CV (startsWith("CV")), number otherwise; exportedCaseIdtype.components/Preview.tsx—id: CaseId;caseIdStrbranches on CV vs PanTS, so the thumbnail, viewer route, and (downstream) nifti/seg/report URLs all use the right prefix.helpers/prefetchVolume.ts— acceptsCaseId(the hover prefetch now warms the correct CV url).routes/Homepage.tsx— grid state,ingestItems, and the save/compare features acceptCaseId; the compare tray also accepts a typedCV_…id.helpers/savedCases.ts—SavedCase.idaccepts string;loadSavedCasesno longer filters out string ids.Fully backward-compatible for PanTS (still numeric).
Testing
tsc -bcleanitemToIdCV coverage)Known follow-ups (out of scope — not the reported bug)
/case/CV_…loads the CT (backend dispatch works) and seg returns{"masks_available": false}; the viewer shows CT-only. Doesn't crash (getPanTSIdtolerates the string), but full CT-only viewer polish (hiding mask UI) is a separate task.ComparePagestill parses ids as PanTS — comparing two CV cases won't render correctly yet. Worth a follow-up if CV comparison is wanted.