feat: abstract routing configuration and URI parameter access (#48) - #392
feat: abstract routing configuration and URI parameter access (#48)#392igoroctaviano wants to merge 4 commits into
Conversation
Introduce src/utils/routes.ts as a single source of truth for route templates, path builders, and URI parameter parsing. Previously the /studies/:studyInstanceUID/series/:seriesInstanceUID template (and its GCP DICOM store variant) was hardcoded and re-parsed by hand across App, CaseViewer, Worklist, Header, and OidcManager, making routing changes error-prone. Components now consume RoutePaths for <Route> definitions and the buildStudyPath/buildSeriesPath/buildLogoutPath builders plus parse/predicate helpers instead of ad-hoc string interpolation, split(), includes(), and regex replacement. Add unit tests for the new routing helpers. Closes #48
|
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| JavaScript | Aug 7, 2026 3:14p.m. | Review ↗ |
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
|
Visit the preview URL for this PR (updated for commit 00728be): https://idc-external-006--pr392-feat-48-abstract-rou-0r7miscb.web.app (expires Fri, 14 Aug 2026 15:16:14 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 88aacecd98ba54d2f9c8d201a9444e43d1ad8307 |
|



Summary
Resolves #48. The URI template
/studies/:studyInstanceUID/series/:seriesInstanceUID(and its GCP DICOM store variant) was assumed/hardcoded in several places and re-parsed by hand, making routing changes error-prone.This introduces
src/utils/routes.tsas a single source of truth for:RoutePaths) consumed by react-router<Route path>definitions, with parameter names centralized inRouteParams.buildStudyPath,buildSeriesPath,buildLogoutPath.parseSeriesInstanceUID,hasSeriesInPath,isProjectsPath,getProjectStorePath,withSeriesInProjectPath,isViewerPath,isGcpDicomStorePath.Refactored to use the abstraction
App.tsx—<Route>paths (ROOT,STUDY,GCP_STUDY,LOGOUT) and GCP client base-URL derivation.components/CaseViewer.tsx— series-selection URL building, series parsing, and nestedSERIESroute (removed ad-hoc interpolation + regex).components/Worklist.tsx— study navigation.components/Header.tsx— DICOM Tag Browser visibility, series parsing, and GCP server-URL validation (removed the localDICOM_TAG_BROWSER_PATHSconstant).auth/OidcManager.tsx—post_logout_redirect_uri.No behavior change — paths produced/parsed are identical to before; the logic is just centralized.
Test plan
pnpm run typecheckpassespnpm run lint(biome) passespnpm test— all 53 tests pass, including newsrc/utils/__tests__/routes.test.ts(22 assertions covering builders, parsers, and predicates)projects/.../dicomStores/...deep links still route correctly