Skip to content

feat(clinical): add Form 12A statutory manifest, CV medications, and therapy compass governance copy (#DTSABC, #4AM8Z0, #PM9SP1) - #2448

Merged
BigSimmo merged 20 commits into
mainfrom
clinical_governance_manifest_update
Aug 27, 2026
Merged

feat(clinical): add Form 12A statutory manifest, CV medications, and therapy compass governance copy (#DTSABC, #4AM8Z0, #PM9SP1)#2448
BigSimmo merged 20 commits into
mainfrom
clinical_governance_manifest_update

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Aug 27, 2026

Copy link
Copy Markdown
Owner

Summary

This PR implements three clinical reference data, statutory form manifest, and policy copy tasks with full Clinical Governance Preflight compliance:

  1. #DTSABC — Form 12A Statutory Authority & Criteria (data/forms-catalog.json):

    • Extracted authoritative statutory wording from committed public/forms-pdf/form-12a.pdf (WA Mental Health Act 2014 Form 12A – Nomination of Nominated Person).
    • Authored specific maker (s273/s275), threshold (s273/s276), clock (s277/s278), purpose, authorises (s263/s266), doesNotAuthorise (explicitly stating lack of proxy consent / substitute decision-making power), and priorityFacts cards (clock, authority, criteria).
    • Verified in tests/forms.test.ts.
  2. #4AM8Z0 — Cardiovascular Medications Catalogue Additions (data/medications-snapshot.json):

    • Added complete, evidence-backed entries for Ramipril (ACE inhibitor) and Simvastatin (HMG-CoA reductase inhibitor) benchmarked against AMH, TGA approved PIs (Tritace, Zocor), and BNF.
    • Added entities, brand groups (Tritace, Ramace, Prilace, Zocor, Lipex, Simvar), and tags (ACEi, STATIN, S4) to src/lib/medication-entities.ts.
    • Rebuilt data/medication-interaction-index.json (531 rows) and refreshed docs/medication-interaction-lexicon-review.md.
    • Ratcheted snapshot length from 328 to 330 in tests/medications.test.ts and added badge/interaction assertions in tests/medication-badges.test.ts.
  3. #PM9SP1 — Therapy Compass Policy Copy Relabelling:

    • Replaced "Decision support" with compliant "Source-grounded therapy reference" copy across src/components/therapy-compass/**, src/lib/app-modes.ts, scripts/generate-site-map.ts, and public/therapy-compass-data/pathways.json to strictly adhere to TGA Software as a Medical Device (SaMD) exemption boundaries.

Verification

  • npm run verify:cheap / focused clinical suites passed locally:
    • tests/forms.test.ts (12 tests)
    • tests/medications.test.ts (41 tests)
    • tests/medication-badges.test.ts (17 tests)
    • tests/medication-entities.test.ts (14 tests)
    • tests/medication-interactions.test.ts (53 tests)
    • tests/medication-patient-alerts.test.ts (23 tests)
    • tests/medication-interaction-lexicon-coverage.test.ts (34 tests)
    • tests/therapy-compass-mode-wiring.test.ts (19 tests)
    • tests/therapy-compass-pathways.test.ts (9 tests)
    • Total 222/222 passing unit tests.
  • npm run check:medication-interactions (531 rows up to date)
  • npm run check:medication-lexicon-report (37 terms up to date)
  • npm run check:outstanding-issues (36 pending requests, snapshot synchronized)
  • npm run sitemap:check passed cleanly

Risk and rollout

  • Risk: Low. Additive clinical reference datasets, statutory form priority facts, and copy refinements aligning with TGA SaMD boundaries.
  • Rollback: Revert PR commit f36f94da0.
  • Provider or production effects: None. Purely static and offline-verified references.
  • RAG impact: RAG impact: none

Clinical Governance Preflight

  • Source-backed claims still require linked source verification before clinical use
  • No patient-identifiable document workflow was introduced or expanded without explicit governance approval
  • Supabase target remains Clinical KB Database (sjrfecxgysukkwxsowpy)
  • Service-role keys and private document access remain server-only
  • Demo/synthetic content remains clearly separated from real clinical sources
  • Source metadata, review status, and outdated/unknown-source behavior remain conservative
  • Deployment classification/TGA SaMD impact was checked when clinical decision-support behavior changed

Notes

  • Ledger inbox requests queued for #DTSABC, #4AM8Z0, and #PM9SP1.

Note

Medium Risk
Changes statutory form guidance and medication interaction alerting—clinically consequential reference data, but additive and test-gated rather than runtime auth or prescribing logic.

Overview
Replaces Form 12A placeholder copy in data/forms-catalog.json with WA Mental Health Act 2014–grounded fields (maker, threshold, authority limits, filing/copies) plus new priorityFacts (clock, authority, criteria), tighter traps/pre-use checks, and section-tagged search terms—aligned with tests/forms.test.ts.

Adds full Ramipril and Simvastatin monographs to data/medications-snapshot.json and regenerates data/medication-interaction-index.json: new drug slugs, expanded ACEi/statin class resolution (e.g. ramipril on triple-whammy and hyperkalemia rows, simvastatin on CYP3A4/macrolide edges), and updated index stats. docs/medication-interaction-lexicon-review.md reflects the new catalogue size and term counts.

Closes three outstanding-issue inbox items (#DTSABC, #4AM8Z0, #PM9SP1 recorded in snapshot/inbox JSON). Remaining diff is mostly repo-awareness snapshot refresh and design-system/docs housekeeping (README front door, adoption count 55, contract token wording, scripts-index gate entries).

Reviewed by Cursor Bugbot for commit fd67829. Configure here.

BigSimmo and others added 11 commits August 27, 2026 14:10
Remaining Lucide size={15} and 1px shadow spreads were blocking the
token contract. Map those to named tokens, drop unused v2 line-height
companions, and record leftover Hazard 2/3 items in FIX-GUIDE.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	src/components/therapy-compass/therapy-card.tsx
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Keep quoted contract numbers in lockstep with the baseline JSON, and replace nested brief-duration ternaries plus leftover Lucide size={16} on screens this sweep already touched.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…therapy compass governance copy (#DTSABC, #4AM8Z0, #PM9SP1)
@supabase

supabase Bot commented Aug 27, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 30 seconds.

View limit details

Limit details: You’ve used the included review currently available. Your 102 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7e06730d-c204-40c4-9a1c-7ce6beecaa37

📥 Commits

Reviewing files that changed from the base of the PR and between 5d39caa and 399934b.

⛔ Files ignored due to path filters (14)
  • docs/README.md is excluded by !docs/**, !**/*.md
  • docs/codebase-index.md is excluded by !docs/**, !**/*.md
  • docs/design-system-contract.md is excluded by !docs/**, !**/*.md
  • docs/design-system/ADOPTION.md is excluded by !docs/**, !**/*.md
  • docs/design-system/COMPONENTS.md is excluded by !docs/**, !**/*.md
  • docs/design-system/DECISIONS.md is excluded by !docs/**, !**/*.md
  • docs/design-system/SPEC.md is excluded by !docs/**, !**/*.md
  • docs/medication-interaction-lexicon-review.md is excluded by !docs/**, !**/*.md
  • docs/outstanding-issues-inbox/39bc43fc-7bd7-4088-a7e4-4d29d3d418d5.json is excluded by !docs/**
  • docs/outstanding-issues-inbox/44e5f87c-d30f-4334-9184-75c1544773ef.json is excluded by !docs/**
  • docs/outstanding-issues-inbox/c66f01fb-e52a-40fa-a4b2-f4d1449ddb11.json is excluded by !docs/**
  • docs/process-hardening.md is excluded by !docs/**, !**/*.md
  • docs/scripts-index.md is excluded by !docs/**, !**/*.md
  • docs/testing.md is excluded by !docs/**, !**/*.md
📒 Files selected for processing (23)
  • data/forms-catalog.json
  • data/medication-interaction-index.json
  • data/medications-snapshot.json
  • data/outstanding-issues-snapshot.json
  • data/repo-awareness-snapshot.json
  • public/therapy-compass-data/pathways.json
  • scripts/build-medication-interaction-index.ts
  • scripts/generate-site-map.ts
  • src/components/therapy-compass/screens/brief-screen.tsx
  • src/components/therapy-compass/screens/compare-screen.tsx
  • src/components/therapy-compass/screens/detail-screen.tsx
  • src/components/therapy-compass/screens/pathways-screen.tsx
  • src/components/therapy-compass/screens/sheets-screen.tsx
  • src/components/therapy-compass/workspace.tsx
  • src/lib/app-modes.ts
  • src/lib/medication-entities.ts
  • src/lib/medication-interaction-lexicon.ts
  • src/lib/medication-interactions.ts
  • tests/forms.test.ts
  • tests/medication-badges.test.ts
  • tests/medication-interactions.test.ts
  • tests/medications.test.ts
  • tests/therapy-compass-responsive-contract.test.ts

Comment @coderabbitai help to get the list of available commands.

@cursor

cursor Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_d46446ad-9185-4209-ad55-1e7249dd05c0)

…anifest_update

# Conflicts:
#	data/outstanding-issues-snapshot.json
#	data/repo-awareness-snapshot.json
#	docs/design-system/FIX-GUIDE.md
#	docs/design-system/GATES.md
#	docs/design-system/TOKENS.md
#	scripts/design-system-contract-baseline.json
#	src/app/globals.css
#	src/components/specifiers/specifier-builder-page.tsx
#	src/components/specifiers/specifier-ui.tsx
#	src/components/therapy-compass/screens/compare-screen.tsx
#	src/components/therapy-compass/screens/sheets-screen.tsx
#	src/components/therapy-compass/workspace.tsx
#	tests/ckb-v2-token-contract.test.ts
#	tests/design-system-adoption.test.ts
#	tests/design-system-contract-utils.test.ts
@BigSimmo
BigSimmo enabled auto-merge (squash) August 27, 2026 17:44

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f36f94da02

ℹ️ 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".

Comment thread data/medications-snapshot.json
Comment thread data/medications-snapshot.json
@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

CI triage

CI failed on this PR. Automated classification of the 2 failed job(s):

  • Production UI criticalnot baselined: this job did NOT run on the main comparison below (path-scoped skip), so that run says nothing about it either way. Treat the comparison as absent, not green, and inspect the failing step.
  • PR requiredneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.

Compared with main CI run #14369 (cancelled). That run's conclusion is an aggregate and did not exercise Production UI critical.

Classification is evidence routing, not permission to ignore a failure. Exact quarantined Playwright identities remain governed by the flake ledger.

BigSimmo and others added 4 commits August 28, 2026 02:08
… the gemfibrozil self-class overmatch

Two P1 findings from the PR #2448 review, both in the interaction-index
generator:

- "ACEi + Diuretic + NSAID" rows fired on any single class alone (another
  ACEi, an NSAID by itself, or a diuretic by itself), since the generated
  index unioned each class's matches into one flat counterparty list.
  build-medication-interaction-index.ts now recognises a "+"-joined clause
  as a required combination and records requiredGroups; the evaluator only
  fires such a row once every group has a match in the patient's list. This
  also fixes the same defect on the corpus's seven pre-existing rows using
  the identical pattern, not only ramipril's new row.

- Simvastatin's and atorvastatin's gemfibrozil rows used the generic words
  "statin" and "(Fibrate)" to describe their own mechanism, which the
  generator resolved as sibling-class counterparties (every other statin,
  fenofibrate) — a patient on an unrelated statin alone triggered a HIGH
  "Gemfibrozil ... Contraindicated" alert. Denied at the source via the
  existing sourceDenySlugs mechanism, since gemfibrozil itself is not in
  the catalogue.

Regenerated data/medication-interaction-index.json and
docs/medication-interaction-lexicon-review.md, added regression tests for
both scenarios, and verified no existing interaction alert was weakened
(182 -> 189 medication tests, all passing).

RAG impact: none — this touches only the medication-interaction catalogue
and evaluator, not src/lib/rag/** or retrieval/answer surfaces.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JYtcTz6zLPb1v38ahfeCSH
@cursor

cursor Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_fc7c68f3-3cf9-4ec6-b02e-f5f8b6b9f3d5)

@BigSimmo
BigSimmo merged commit 0e70217 into main Aug 27, 2026
29 checks passed
@BigSimmo
BigSimmo deleted the clinical_governance_manifest_update branch August 27, 2026 20:12
BigSimmo pushed a commit that referenced this pull request Sep 1, 2026
Two pending done-mutations on #PM9SP1 made reconciliation ambiguous, which the
inbox correctly refuses to guess at. 44e5f87c (queued 2026-08-27 by PR #2448)
records only the Therapy Compass relabel; c772a1b8 records the same close plus
the five further sites the 2026-09-01 sweep found, including the prescribing
patient-profile panel and the medication record footer.

Cancelling the narrower one so the archived outcome describes everything that
was wrong rather than a subset. Nothing is lost - the surviving outcome states
Therapy Compass had already been corrected.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015uQ7pGjA4hBxi9TRNsfjAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants