fix(medications): polish the interaction note text - #1898
Conversation
The warning read as an unformatted dump. Three causes, all addressed without touching the clinical wording: Every note opened with a shouty `CRITICAL — `. That token is the same value already shown as the severity badge beside it, so it was redundant and it made each paragraph start with an all-caps word and a dangling dash. `interactionNoteBody()` strips only that prefix; a row that does not carry one is returned untouched, and a test asserts the original string still ends with the returned body, so nothing else can ever be removed. It is not a summariser: no sentence is dropped, reordered or reworded, because the wording is the clinical claim. The text was `line-clamp-2`'d, cutting mid-word with an ellipsis. The block sits behind a tap now, so there was no space to reclaim by truncating a safety note. The notes ran together as muted small type on the tinted wash. Each interaction is now its own card on the panel's own surface — body text on a same-hue fill is the readability trap recorded on the hero tiles (#659) — carrying the drug-name link plus a per-row severity chip. The trigger only reports the worst severity, so a HIGH sitting under a CRITICAL was previously unlabelled. Rebased onto main after PR #1874 merged; this is a fresh change, not a continuation of that branch's history. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X12okkARLhFQ2zgcPoFp54
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
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 (16)
Comment |
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X12okkARLhFQ2zgcPoFp54
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 807d13f4ab
ℹ️ 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. The only repository destination is BigSimmo/Database, and the only branch destination is the pull request head branch claude/patient-interactions-drug-alerts-3tztvw at starting commit 91a164f; never publish fixes to a detached or synthetic work branch and never create a stacked pull request. Use the authenticated GitHub connector to commit each approved fix to BigSimmo/Database:claude/patient-interactions-drug-alerts-3tztvw, then verify that the pull request head contains the published commit before reporting success. 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. For a fixed thread, reply with as the first line and as the second line. For a no-code disposition, use followed by . These result markers authorize the workflow to close that exact thread only after it verifies a fixed commit is the pull request head; a local-only commit is not a fix. If publication or verification fails, do not use either result marker, do not claim success, and leave the thread open with the blocker. If human input or new authorization is required, do the same. 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. |
|
@claude Please fix both unresolved review findings on exact head
|
|
Hi @BigSimmo — thanks for the @claude mention. Open this in Claude Code on the web to continue here: https://claude.ai/code Context: Automated backlink from the Claude backlink workflow. Claude Code can pick up the mention and push a scoped fix to the branch. |
|
Claude encountered an error after 2s —— View job I'll analyze this and get back to you. |
|
@copilot Fix the two still-unresolved exact-head defects on current head The current head already added the correct failing regressions but did not change production code:
|
Summary
Publication blockerThe fixes could not be published or marked resolved:
Testing
|
|
@copilot On current head Run |
…everse matches their wording
Two safety gaps in the interaction feature, both about a clinician being able
to act on what the tool shows them.
1. The lexicon had never been reviewed and was not readable enough to review.
`scripts/build-medication-lexicon-report.ts` generates
`docs/medication-interaction-lexicon-review.md`: every term expanded to the
drugs it actually resolves to, with how many CRITICAL/HIGH rows depend on
it, sorted by severe usage, carrying a sign-off block. Marked UNREVIEWED
until a clinician fills that block in. `check:medication-lexicon-report`
fails when the sheet and the lexicon disagree, so a sign-off cannot end up
covering a different lexicon.
The sheet immediately found two defects:
- `subclassIncludes: ["ARB"]` matched "C-ARB-apenem", putting ertapenem and
meropenem in the angiotensin-receptor-blocker class across 16
CRITICAL/HIGH rows. Fixed with a new exact-match `subclassEquals`
selector, pinned by name and by a systemic whole-word check that would
catch the next one.
- Two catalogue records are both named "Warfarin" and share no interaction
rows at all, so which one a clinician opens decides which warnings they
see. That is a catalogue data defect, not a lexicon fault, so it is
reported rather than silently patched — merging the records is a clinical
content decision that needs an owner.
2. A reverse-direction match rendered a drug name and a severity chip with no
text underneath. The counterparty's row lives on the patient's medication,
whose record the caller does not hold, so its wording was passed as "".
Row text is carried in the index again and used as the fallback; the live
record still wins when present, and the two are kept identical by
`check:medication-interactions`. Index cost 249KB -> 333KB raw
(15KB -> 39KB gzip).
Both freshness checks are wired into `verify:pr-local` so neither artefact can
go stale unnoticed, and the generator formats its own output so a tree-wide
`npm run format` cannot make a current report look stale.
…-alerts-3tztvw' into claude/patient-interactions-drug-alerts-3tztvw
|
Fixed the exact current-head static CI failure by formatting |
Preserve the corrected severity parser, restored phone tap target, focused regressions, and immutable review record on top of the current Services-filter main.
…-alerts-3tztvw' into claude/patient-interactions-drug-alerts-3tztvw
Commit 92bcdf4 reflowed `tests/medication-interactions.test.ts` to 80 columns. The repo's `.prettierrc` sets `printWidth: 120`, so that pass ran with a default config rather than this project's, and `format:changed` and the exact-commit pre-push guard would both have gone red on the pushed blob. `npm run format` reverts it.
…-alerts-3tztvw' into claude/patient-interactions-drug-alerts-3tztvw
|
@copilot Fix the exact-head CI format failure on |
CI triageCI failed on this PR. Automated classification of the 2 failed job(s):
Compared with main CI run #10410 (cancelled). Classification is evidence routing, not permission to ignore a failure. Exact quarantined Playwright identities remain governed by the flake ledger. |
Summary
Follow-up to #1874 (merged). The interaction warning read as an unformatted dump rather than something designed. Three causes, all fixed without touching the clinical wording.
CRITICAL —. That token is the same value already shown as the severity badge beside it, so it was redundant and it made each paragraph start with an all-caps word and a dangling dash. NewinteractionNoteBody()strips only that prefix. It is deliberately not a summariser: no sentence is dropped, reordered or reworded, because the wording is the clinical claim and this surface promises it verbatim. A row that carries no prefix is returned untouched.line-clamp-2cut mid-word with an ellipsis. The block sits behind a tap since feat(medications): patient details dock pill and drug-interaction alerting #1874, so there was no space to reclaim by truncating a safety note. Now unclamped.#659) — carrying the drug-name link plus a per-row severity chip. The disclosure trigger only reports the worst severity, so a HIGH sitting under a CRITICAL was previously unlabelled.The in-sheet block gets the same treatment so the two surfaces agree.
What I deliberately did not do: split each note into "which drugs" and "what happens" halves. The catalogue is not consistent enough for it — some rows lead with the counterparties (
CRITICAL — NSAIDs and Aspirin. SSRIs deplete platelet serotonin…), others lead with the mechanism (HIGH — Blocks the cardioprotective effect of low-dose Aspirin…). A heuristic that mangles a clinical sentence is worse than leaving it whole.Note on branching: #1874 merged and its branch was deleted while this was in progress, so this is a fresh change off current
main, not a continuation of that history.Verification
npm run verify:pr-local—completed: check:runtime, check:installed-lock-parity, format:changed, lint, typecheck, test, build, check:rag:fixtures, check:medication-interactions/failed: (none), exit 0. Dependencies were reinstalled first (npm ci) because main's lockfile had moved on.tests/medication-interactions.test.tspin the parser: prefix removal across em-dash, en-dash and hyphen; a no-prefix row left alone; an all-caps word mid-sentence not eaten; and — the one that matters — an assertion that the original string still ends with the returned body, so nothing but the prefix can ever be removed./medications/sertralinewithtramadol-ir+ibuprofenin the session profile: two white cards inside the tinted callout, each with the drug name, aCritical/Highchip, and clean unclipped prose.docs:check-inventory,docs:check-index,check:design-system-adoption) — all current, tree clean.UI verification not run:
npm run verify:phone-chromecannot complete its browser stages in this environment (Chromium 1194 vs Playwright 1.62.1's 1234 — the drift tracked as/issues #255), anddocs/testing.mdsays not to force a mismatched browser. No chrome token, reserve or dock ownership moved here, so the phone-chrome journeys are unaffected by this diff; Chromium coverage is delegated to CI.RAG impact: no retrieval behaviour change — nothing under
src/lib/rag/**, clinical-search, retrieval-selection, ranking-config, answer-ranking, the eval harness or the golden fixture is touched.check:rag:fixturespassed unchanged (36 golden cases, 23 suites).Risk and rollout
interactionNoteBody()can alter a clinical claim is by removing more than the severity prefix, which the "original ends with body" assertion makes impossible. Presentation-only otherwise.interactionNoteBodyandseverityLabelhave no other consumers.Clinical Governance Preflight
Clinical KB Database(sjrfecxgysukkwxsowpy) — no Supabase file, migration, env value or client call is touched.data/medications-snapshot.jsoncatalogue export, addressed byrowIndex.docs/samd-classification-medication-considerations.mdis unaffected. That note remains OPEN and still needs its named clinical + regulatory reviewer.Notes
Generated by Claude Code