Skip to content

Fix CV viewer hang + dataset counts in filter panel#82

Merged
aperson30 merged 1 commit into
mainfrom
fix/cv-viewer-and-dataset-counts
Jul 18, 2026
Merged

Fix CV viewer hang + dataset counts in filter panel#82
aperson30 merged 1 commit into
mainfrom
fix/cv-viewer-and-dataset-counts

Conversation

@aperson30

Copy link
Copy Markdown
Collaborator

Summary

  • CV viewer hang fix: VisualizationPage.tsx now detects CV cases (id starts with "CV") and sets segUrl to null instead of calling /api/get-segmentations/CV_…. That endpoint returns {"masks_available": false} (JSON, HTTP 200) which the NIfTI loader treats as a binary volume and hangs indefinitely. Setting null gives the same CT-only path as isLocal/isDicom cases.
  • HF fallback guard: getPanTSId produces a garbage value for CV ids; p is now set to "" for CV cases so no malformed HuggingFace URL is constructed if the JHU server goes down.
  • Dataset counts in filter panel: /api/facets now includes dataset_counts: {PanTS, CancerVerse} (total row counts from DF/DF_CV). The Dataset filter buttons in the advanced search panel now show count badges matching the style of Tumor, Sex, etc.

Test plan

  • Open a CV case (/case/CV_00000001) — viewer loads CT, no hang, organ panel shows CT-only (no mask list)
  • Open a PanTS case — viewer loads CT + segmentation as before (regression check)
  • Open advanced filters on the dashboard — Dataset section shows "PanTS 9,901" and "CancerVerse N" count badges
  • npm test — 103 tests pass, no regressions
  • tsc -b — clean

VisualizationPage: detect CV cases (id starts with "CV") and set segUrl to
null — skips the /api/get-segmentations call that returns JSON {"masks_available":false}
instead of a binary NIfTI, which previously hung the loader indefinitely. Also
guards the HuggingFace fallback URL so getPanTSId's garbage output for CV ids
never produces a bad URL.

Homepage/api_blueprint: /api/facets now returns dataset_counts {PanTS, CancerVerse}
(total row counts from DF / DF_CV). Dataset filter buttons display the count badge
matching the style of every other filter option.
@aperson30
aperson30 merged commit f9acb3c into main Jul 18, 2026
7 checks passed
aperson30 added a commit that referenced this pull request Jul 18, 2026
The load-effect guard required !segUrl to be false before proceeding, so
CV cases (where PR #82 sets segUrl=null) never got past it — CT never
loaded and the spinner ran forever.

Three edits:
1. Component-level isCvCase flag (pantsCase starts with "CV") so the guard
   can distinguish "CV, intentionally no seg" from "sources not resolved yet"
2. Guard: (!segUrl && !isCvCase) — CV is CT-only; seg is only required for
   non-CV cases
3. renderVisualization call: segUrl ?? undefined — converts null to undefined
   to match the string|undefined signature and avoid tripping downstream seg logic
harleensachdev pushed a commit to harleensachdev/BodyMaps-website that referenced this pull request Jul 19, 2026
PR BodyMaps#82 set segUrl=null for CV cases to skip the JSON-returning seg endpoint,
but the load-effect guard blocked on !segUrl, so the CT never loaded and the
spinner ran forever.

Three edits:
1. Component-level isCvCase flag so the guard can distinguish "CV, intentionally
   no seg" from "sources not resolved yet" (both start as null)
2. Guard: (!segUrl && !isCvCase) — seg only required for non-CV cases
3. renderVisualization: segUrl ?? undefined — null → undefined matches the
   string|undefined signature and avoids tripping downstream seg logic
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