Link differentials diagnosis terms to info pages - #1768
Conversation
Add a shared exact-title plus curated-alias resolver and tone-aware chips so Watch for tags, clinical-review items, presentation safety tags, urgency rows, and comparison-cell diagnosis names navigate to catalog diagnosis pages while non-diagnosis risks stay unlinked. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in:30 minutes Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdded shared diagnosis-term resolution with curated aliases and routability checks. Differential detail context now exposes ChangesDiagnosis term linking
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant DifferentialDetailContext
participant buildTermLinkMap
participant resolveDiagnosisTerm
participant DifferentialDetailPage
participant DiagnosisTermChip
DifferentialDetailContext->>buildTermLinkMap: collect safety and section labels
buildTermLinkMap->>resolveDiagnosisTerm: resolve cleaned diagnosis term
resolveDiagnosisTerm-->>buildTermLinkMap: return routable diagnosis href
buildTermLinkMap-->>DifferentialDetailContext: return termLinks
DifferentialDetailContext-->>DifferentialDetailPage: provide detailContext.termLinks
DifferentialDetailPage->>DiagnosisTermChip: render resolved safety or overlap term
DiagnosisTermChip-->>DifferentialDetailPage: render linked or plain chip
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
This pull request has been ignored for the connected project Preview Branches by Supabase. |
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds diagnosis-term links across differential detail and presentation workflows using exact-title and curated-alias resolution.
Changes:
- Adds shared diagnosis-term resolution and SSR link maps.
- Introduces linked chips and inline diagnosis links across differential views.
- Adds focused resolver, route, context, and navigation tests.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/lib/differential-diagnosis-links.ts | Implements term resolution and alias mapping. |
src/lib/differentials.ts | Builds diagnosis-detail term-link context. |
src/lib/differential-detail.ts | Extends the detail context contract. |
src/components/differentials/diagnosis-term-link.tsx | Adds reusable linked term components. |
src/components/differentials/differential-detail-page.tsx | Links diagnosis terms in detail sections. |
src/components/differentials/differential-presentation-workflow-page.tsx | Links presentation tags, rows, and comparison terms. |
tests/differential-diagnosis-links.test.ts | Tests aliases, resolution, and context links. |
tests/differential-detail.test.ts | Validates generated term links. |
tests/differential-section-nav.dom.test.tsx | Updates context fixtures. |
tests/differentials-route.test.ts | Verifies API term-link output. |
docs/branch-review-ledger.md | Records implementation verification. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:03cb6a8f35
ℹ️ 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".
Uh oh!
There was an error while loading. Please reload this page.
…snapshot
- differential-diagnosis-links.ts: Change SEGMENT_SPLIT to only split on
commas and semicolons, not slashes. Slashes within compound clinical phrases
(e.g. "alcohol/benzo withdrawal") must be preserved; splitting on them and
rejoining with commas via DiagnosisTermInlineList changes clinical meaning.
Semicolons are now handled so lists like "Primary psychosis; dementia" are
correctly split into linkable segments.
- differential-detail-page.tsx: Guard both termLinks pass-throughs with ?? {}
so older API deployments that pre-date the termLinks field do not cause a
crash when SafetySnapshot or SectionItems perform termLinks[cleaned] lookups
during version skew.
- differential-presentation-workflow-page.tsx: Wrap the inner segments.map()
in a keyed Fragment so the outer tags.map() always returns a single keyed
root element, satisfying React's list-key requirement.
Co-authored-by: BigSimmo <87357024+BigSimmo@users.noreply.github.com>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/components/differentials/differential-detail-page.tsx`:
- Around line 151-159: Use cleaned section-item keys consistently in all three
affected sites: src/components/differentials/differential-detail-page.tsx lines
151-159, 170-173, and 188-201. In each rendering path, clean item before looking
it up in termLinks and use the cleaned value when rendering DiagnosisTermInline
or DiagnosisTermChip, while preserving the existing list rendering behavior.
In `@src/lib/differential-diagnosis-links.ts`:
- Around line 137-164: Update SEGMENT_SPLIT so resolveDiagnosisTermSegments also
separates slash-delimited diagnosis terms, including “Delirium / medical
psychosis.” Preserve the existing whole-label resolution before splitting so
curated slash aliases continue resolving as a single term.
🪄 Autofix
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
Run ID: 110aa206-5f95-4980-badd-1aebbdf0e92e
📒 Files selected for processing (11)
docs/branch-review-ledger.mdsrc/components/differentials/diagnosis-term-link.tsxsrc/components/differentials/differential-detail-page.tsxsrc/components/differentials/differential-presentation-workflow-page.tsxsrc/lib/differential-detail.tssrc/lib/differential-diagnosis-links.tssrc/lib/differentials.tstests/differential-detail.test.tstests/differential-diagnosis-links.test.tstests/differential-section-nav.dom.test.tsxtests/differentials-route.test.ts
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Preserve unspaced clinical compounds like alcohol/benzo while still segmenting discrete spaced-slash lists such as Delirium / medical psychosis. Co-authored-by: Cursor <cursoragent@cursor.com>
Append heavy-scope review of tip 0daa9e2 after main sync and spaced-slash segment fix. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
BigSimmo
commented
Aug 9, 2026
@cursoragent Unblock the current open PR. Confirm the PR number and GitHub head first from context. If more than one open PR could apply, stop and say which one you would use and why. Fetch and start from the remote tip that matches that GitHub head. If the named branch ref is missing or stale, use the PR head ref. Preserve unrelated local WIP; do not discard dirty work; do not treat a local-ahead commit as the reviewed tip. Do not merge the PR, force-push, rebase, or arm auto-merge. No provider-backed gates without approval. If you cannot push or resolve threads, diagnose and comment only; if inline replies fail, resolve when possible and put blocker dispositions in the summary comment. If auto-merge is already armed, push only for a real blocker and avoid cancelling in-flight required CI unless the push clears that blocker. If the PR is already merged or closed: confirm outcome, post one summary, and stop. Primary job: clear mergeability and required-CI blockers on this tip. Do a full product review only if needed to explain or fix a blocker. Stay light otherwise—no broad verification suites or Playwright unless needed to prove one concrete unblock fix. Snapshot the GitHub head: tip, behind/ahead, mergeable state, merge-tree versus origin/main (real conflict versus behind-but-clean), required checks on that tip including Production UI when selected, and unresolved threads that block merge or required CI. Missing checks while dirty are not green. Tip moved → re-snapshot. Ledger-lookup against that GitHub head under an unblock/fix scope for this PR. If already handled at this head for unblock work, merge-tree clean, required checks green, and no blocking threads: summarize, comment, stop. Unblock once: real conflict → merge origin/main with the smallest correct resolution (prefer main’s shared queues; keep this PR’s notes); behind-but-clean → one sync, late if required CI is in flight; clean → leave. skip-branch-sync and similar labels do not block a manual sync needed to clear a real blocker. No sync thrash. After any sync or push, re-snapshot tip, merge-tree, and required checks before declaring done. Dedupe the ledger if a merge touched it. Fix only what blocks required checks or mergeability on this tip. Ignore advisory red unless it reveals a real required failure. Prefer the smallest safe fix; if a bot/autofix commit caused the break, prefer revert. Prove with the smallest targeted check only. Format and commit before push. Push only blocker-fix commits. Append ledger for the final GitHub head under the unblock scope. Never push a ledger-only tip. One PR comment: tip, sync/merge-tree, what blocked and what you fixed or dispositioned, required CI status, residual risks; merge left to me. Stop when merge-tree is clean on the current GitHub tip, no blocking threads remain for merge/required CI, and required checks are green or clearly in progress. |
PR #1768 — tip Blocker: GitHub Fix: Merged Threads: 0 unresolved. |
…diagnosis-links-9f18 Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Unblock summary (PR #1768)Tip: Sync / merge-tree
What blocked / what I did
Required CI
Residual risks
|
Uh oh!
There was an error while loading. Please reload this page.


Summary
exact cleaned title+ curated aliases, no fuzzy matching) and SSRtermLinkson diagnosis detail context.DiagnosisTermChip/DiagnosisTermInlinecomponents and wire them into diagnosis Watch for / clinical-review items and presentation Safety Snapshot tags, highest-urgency rows, comparison cells, and mobile “Open diagnosis record”.CLINICAL HINGE:noise; suppress self-links.Test plan
npx vitest run tests/differential-diagnosis-links.test.ts tests/differential-detail.test.ts tests/differential-section-nav.dom.test.tsx tests/differentials-route.test.ts— 58 passednpm run verify:pr-local— completed: check:runtime, check:installed-lock-parity, format:changed, lint, typecheck, test (542files /5812passed), build, check:rag:fixturesnpm run ensurespot-check athttp://localhost:4461: Dementia Watch-forSuperimposed delirium→/differentials/diagnoses/delirium; acute-confusion Safety tags link Delirium / Substance intoxication / Substance withdrawalNotes
src/lib/rag/**or ranking surfaces touched.Summary by CodeRabbit
New Features
Bug Fixes
Tests