feat(specifiers): add diagnostic decision-support workspace#633
Conversation
Integrate Specifiers with the shared Clinical Guide shell, add local natural-language search and structured comparison/builder/map workflows, and cover desktop/mobile accessibility without source provenance fields.
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
📝 WalkthroughWalkthroughAdds a new Specifiers app mode with a psychiatric specifier catalogue, ranked search, detail pages, builder, comparison, map, global navigation, generated sitemap entries, and unit/UI test coverage. ChangesSpecifiers mode
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant GlobalSearch
participant SpecifiersRoute
participant SpecifiersHome
participant SpecifierCatalogue
User->>GlobalSearch: select specifiers mode
GlobalSearch->>SpecifiersRoute: navigate with query and run parameters
SpecifiersRoute->>SpecifiersHome: pass normalized search state
SpecifiersHome->>SpecifierCatalogue: searchSpecifiers(query, filters)
SpecifierCatalogue-->>SpecifiersHome: ranked records
SpecifiersHome-->>User: render filtered specifier results
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c9d8edf85f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex resolve actionable Codex review findings for this pull request and current head using the repository instructions. This is the pull request's single automatic repair pass: do not perform a fresh review, create new standalone findings, or request another review. Work only the existing unresolved Codex threads on the current head. Always fix P0 and P1 findings. For P2 and lower findings, fix only clear, scoped, low-risk issues; otherwise disposition them with a concise reason. After fixing or dispositioning a thread, reply in that thread with as the first line, followed by a concise summary; that marker authorizes the workflow to close that exact thread. If human input or new authorization is required, do not use the marker and leave the thread open with the blocker. Finish only after every actionable thread is fixed or dispositioned and closed, or explicitly left open for a human decision. Do not update the branch from main, address unrelated reviews, broaden scope, or create more than one scoped fix commit. Do not use external APIs, paid services, credentials, dependency changes, or broad refactors unless explicitly authorized. Add targeted tests where behavior changes and run the narrowest relevant validation. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c9d8edf85f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/app/specifiers/builder/page.tsx`:
- Around line 9-13: Deduplicate the query values when constructing
initialSpecifiers from params.specifier, preserving the existing handling of
scalar values and empty input. Ensure repeated specifiers cannot enter the
builder’s selected state or create duplicate downstream keys.
In `@src/components/specifiers/specifier-builder-page.tsx`:
- Around line 30-33: Normalize validInitial before passing it to the selected
state in SpecifierBuilderPage, applying the same choose-up-to-one behavior used
by toggle() for the severity-remission category. Preserve other valid specifiers
and ensure at most one severity-remission slug is initially selected.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 55032f95-9e5e-4338-bdeb-3fcebd8ff203
📒 Files selected for processing (27)
docs/branch-review-ledger.mddocs/codebase-index.mddocs/site-map.mdplaywright.config.tsscripts/generate-site-map.tssrc/app/specifiers/[slug]/page.tsxsrc/app/specifiers/builder/page.tsxsrc/app/specifiers/compare/page.tsxsrc/app/specifiers/layout.tsxsrc/app/specifiers/map/page.tsxsrc/app/specifiers/page.tsxsrc/components/clinical-dashboard/ClinicalSidebar.tsxsrc/components/clinical-dashboard/global-search-shell.tsxsrc/components/clinical-dashboard/master-search-header.tsxsrc/components/clinical-dashboard/mode-action-popup.tsxsrc/components/specifiers/specifier-builder-page.tsxsrc/components/specifiers/specifier-compare-page.tsxsrc/components/specifiers/specifier-map-page.tsxsrc/components/specifiers/specifier-record-page.tsxsrc/components/specifiers/specifier-ui.tsxsrc/components/specifiers/specifiers-home-page.tsxsrc/lib/app-mode-icons.tssrc/lib/app-modes.tssrc/lib/specifiers.tstests/app-modes.test.tstests/specifiers.test.tstests/ui-specifiers.spec.ts
CI triageCI failed on this PR. Automated classification of the 2 failed job(s):
Heuristic only — a main-side or flake label is a starting point, not a verdict. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bb660bd5b4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b9491a4420
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7f1d211f92
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 03daca3bfd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/lib/specifiers.ts (1)
635-661: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsolidate the parallel diagnosis mapping tables to avoid drift.
diagnosisFiltersByApplicability,builderDiagnosesByApplicability, andknownDiagnosisFiltersare three independently-maintained structures keyed by/derived from the sameappliesTostrings and the same four diagnosis tokens (depressive,bipolar,psychotic,mood). Adding a newappliesTocategory or diagnosis token later requires updating all three in lockstep; missing one silently degrades diagnosis filtering (falls through to the substring fallback inmatchesDiagnosisFilter) or breaks builder applicability, with no compiler/test signal beyond the specific cases covered today.Consider merging into a single table (e.g.
applicabilityByCategory: Record<string, { searchDiagnoses: readonly string[]; builderDiagnoses: readonly SpecifierBuilderDiagnosis[] }>) and derivingknownDiagnosisFiltersfrom the union ofsearchDiagnosesvalues, so there is one source of truth for this clinical mapping.Also applies to: 667-667
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/lib/specifiers.ts` around lines 635 - 661, Consolidate diagnosisFiltersByApplicability and builderDiagnosesByApplicability into one applicabilityByCategory mapping keyed by the shared appliesTo categories, with searchDiagnoses and builderDiagnoses fields. Update the lookup logic to use this combined table, and derive knownDiagnosisFilters from the union of all searchDiagnoses values instead of maintaining a separate list. Preserve existing mappings and fallback behavior for unmatched categories.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/lib/specifiers.ts`:
- Around line 635-661: Consolidate diagnosisFiltersByApplicability and
builderDiagnosesByApplicability into one applicabilityByCategory mapping keyed
by the shared appliesTo categories, with searchDiagnoses and builderDiagnoses
fields. Update the lookup logic to use this combined table, and derive
knownDiagnosisFilters from the union of all searchDiagnoses values instead of
maintaining a separate list. Preserve existing mappings and fallback behavior
for unmatched categories.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 9ce3811e-e8dd-4740-80cc-18328753756b
📒 Files selected for processing (8)
docs/branch-review-ledger.mdsrc/app/page.tsxsrc/app/specifiers/builder/page.tsxsrc/components/specifiers/specifier-builder-page.tsxsrc/lib/specifiers.tstests/specifiers.test.tstests/ui-smoke.spec.tstests/ui-specifiers.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/app/specifiers/builder/page.tsx
Summary
SourceandSource statusfrom the Specifiers search contract and enforce their absence in testsmainand preserve both review-ledger historiesWhy
The supplied Formulation references needed to be reinterpreted for psychiatric specifiers while retaining the Database application's native shell, density, responsive behavior, and clinical decision-support conventions.
Areas touched
src/app/specifiers/**andsrc/components/specifiers/**Verification
65d8f533f: build, static checks, lint, typecheck, unit coverage, safety/config, critical UI, full UI regression, advisory UI, Semgrep, Gitleaks, GitGuardian, andPR requirednpm run verify:pr-local— passed on the feature head: format, lint, TypeScript, 2,213 passed / 1 skipped, production build, and client-bundle secret scannpm run verify:cheap— passed during review follow-up: runtime/action/sitemap/brand/scale checks, lint, typecheck, 2,214 passed / 1 skippedgit diff --checknpm run check:production-readiness— failed closed because this isolated worktree has no Supabase/OpenAI secrets; the CI-safe production-readiness check passedClinical Governance Preflight
Clinical KB Database(sjrfecxgysukkwxsowpy)Risk and follow-up
The catalogue contains original static decision-support summaries and does not change APIs, Supabase, ingestion, RAG retrieval, or answer generation. The builder now blocks diagnosis-incompatible combinations and preserves required severity wording, but a clinician should still verify wording against the current diagnostic manual and local documentation policy before clinical use. All nine actionable review threads are fixed and resolved.