feat: add presentations domain to universal search with bidirectional differential linking#499
Conversation
… differential linking Presentations (umbrella work-up pages) become a seventh universal-search domain with their own result group, and the two differential rankers gain low-weight cross-entity lanes: diagnoses index their parent presentations' titles and presentations index their candidate diagnoses' titles, so a symptom query surfaces the presentation plus its differentials and a diagnosis query surfaces the work-up that contains it. Domain type/order move to a leaf module so the client hook can value-import the list without pulling the server search graph into the browser bundle. Differentials-mode chip counts sum both domains; canonical order keeps exact diagnosis titles ahead of the umbrella for Best match. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
📝 WalkthroughWalkthroughUniversal search now includes presentation workflows, links presentation and differential ranking, derives domains from a client-safe registry, aggregates cross-mode counts, and covers server, API, ranking, and UI behavior with tests. ChangesUniversal presentations search
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant UniversalSearchUI
participant UniversalSearchAPI
participant PresentationRanker
participant DifferentialIndex
User->>UniversalSearchUI: Enter query
UniversalSearchUI->>UniversalSearchAPI: Request universal domains
UniversalSearchAPI->>PresentationRanker: Rank presentation workflows
PresentationRanker->>DifferentialIndex: Resolve candidate diagnosis links
DifferentialIndex-->>PresentationRanker: Indexed presentation and diagnosis text
PresentationRanker-->>UniversalSearchAPI: Presentation results
UniversalSearchAPI-->>UniversalSearchUI: Presentation and differential groups
User->>UniversalSearchUI: Select presentation
UniversalSearchUI-->>User: Navigate to presentation workflow
Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (1 error, 1 warning)
✅ Passed checks (9 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/ui-universal-search.spec.ts (1)
85-89: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCover the aggregated Differentials chip count.
These assertions cover the new Presentations group, but not the changed aggregation in
src/components/clinical-dashboard/universal-search-command-surface.tsxLine [675-683]. Assert that the Differentials cross-mode chip displays the sum of thedifferentialsandpresentationstotals.🤖 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 `@tests/ui-universal-search.spec.ts` around lines 85 - 89, Add an assertion in the universal search test near the existing Presentations group checks to verify the aggregated Differentials chip displays the combined count of the differentials and presentations totals. Use the rendered chip text and preserve the existing assertions for the Presentations group and options.
🤖 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 `@tests/ui-universal-search.spec.ts`:
- Around line 85-89: Add an assertion in the universal search test near the
existing Presentations group checks to verify the aggregated Differentials chip
displays the combined count of the differentials and presentations totals. Use
the rendered chip text and preserve the existing assertions for the
Presentations group and options.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: a5f58a20-ccd9-4a60-9ba0-14a39e817309
📒 Files selected for processing (8)
src/components/clinical-dashboard/universal-search-command-surface.tsxsrc/components/clinical-dashboard/use-universal-search.tssrc/lib/differentials.tssrc/lib/universal-search-domains.tssrc/lib/universal-search.tstests/differentials.test.tstests/ui-universal-search.spec.tstests/universal-search.test.ts
Summary
Adds presentations (the 31 umbrella work-up pages) as a seventh universal-search domain with its own result group, and makes the two differential rankers bidirectionally cross-linked so searching a symptom or diagnosis surfaces both the presentation and its differentials:
src/lib/universal-search-domains.ts) so the client typeahead hook can value-import the list without pulling the server-only search graph into the browser bundle.Verification
differentials,universal-search,differential-detail,differentials-search-request,differentials-route(includes 10 new tests for both link directions, ordering, Best-match tie-breaks, adapter fault isolation, and the route)npm run verify:uiChromium suite — 125/125 (includes 6 extended universal-search e2e tests; two new: presentation-group render + navigate-to-workflow)npm run verify:pr-local— runs in CI ("PR required" aggregate)npm run eval:retrieval:quality— this change is registry-catalogue ranking (snapshot-backed differentials/presentations search viarankCatalogRecords), not the pgvector document-corpus retrieval the 36-case golden eval measures. The document adapter is unchanged; the eval cannot exercise or detect this diff.Clinical Governance Preflight
Search/ranking change — completed:
Clinical KB Database(sjrfecxgysukkwxsowpy) — no Supabase/schema change; presentations use the in-bundle snapshot exactly as the existing differentials domain doesNotes
mainvia merge commit before this PR (main had moved 70 commits, 4 of the changed files overlapped); the merge auto-resolved with no conflicts and all gates were re-run green on the merged tree.