feat: abstract routing configuration and URI parameter access (#48)#392
Open
igoroctaviano wants to merge 1 commit into
Open
feat: abstract routing configuration and URI parameter access (#48)#392igoroctaviano wants to merge 1 commit into
igoroctaviano wants to merge 1 commit 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 | Jun 22, 2026 10:40p.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.
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.



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