Skip to content

feat(specifiers): add full DSM-5-TR catalogue with verification gate#656

Merged
BigSimmo merged 7 commits into
mainfrom
claude/specifiers-v2-design-r55baf
Jul 14, 2026
Merged

feat(specifiers): add full DSM-5-TR catalogue with verification gate#656
BigSimmo merged 7 commits into
mainfrom
claude/specifiers-v2-design-r55baf

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Summary

Populates the existing /specifiers feature with the complete DSM-5-TR specifier taxonomy — 20 categories → 131 disorders → 218 groups → 585 specifier items (+18 universal specifiers) — imported from the clinical content export and layered additively on top of main's curated records. Routes, navigation, the curated 14-record lib, and the builder/compare/map tools are unchanged. Rebased cleanly onto current main as a single commit.

Governance-safe verification gate

The source export's auto-generated definitions were systematically mis-templated across domains (e.g. FND "psychological stressor" text landing on unrelated diagnoses). Rather than patch row by row, display is gated on source trust:

  • Only the 71 source-verified definitions are rendered.
  • The 494 unverified definitions are withheld behind a neutral "pending clinician verification" notice, and their text is blanked in the client search index so it is neither displayed nor ranked-on.
  • The full catalogue structure/labels stay searchable; no clinical text is invented.

Changes (9 files)

  • Data: data/specifiers-content.json (full nested export, server-only) + data/specifiers-search-index.json (compact client index, definition text present only for verified rows).
  • Loaders: src/lib/specifiers-content.ts (typed loader, stable slugs, curated enrichment confined to mood bip/dep categories, bounded static-param subset) and src/lib/specifiers-search-index.ts (client-safe ranked search reusing rankCatalogRecords).
  • Detail: SpecifierReferencePage renders any catalogue item with the gate applied; /specifiers/[slug] resolves curated records first, then the catalogue (dynamicParams for the long tail).
  • Home: additive "full DSM-5-TR catalogue" matches beneath the curated results, deduped by label.
  • UI: DSM-5-TR badge, category tags, review-status badges, quick tiles — small stylistic upgrades within the existing page anatomy.
  • Tests: tests/specifiers-content.test.ts — catalog↔stats consistency, unique slugs, gate invariants, enrichment confinement, and search.

Verification (run in-sandbox)

  • Next.js production build compiled successfully; no type errors in any changed src/ file (the only tsc failures are pre-existing missing dev-deps @testing-library/* / @axe-core/playwright, declared in package.json but uninstalled in this sandbox — CI installs them).
  • ESLint clean; Prettier clean on all changed files.
  • Vitest: tests/specifiers-content.test.ts + tests/specifiers.test.ts21/21 pass.
  • Data gate asserted programmatically: 585 items, 71 definitions shown, 494 neutralized, 0 cross-domain leaks, client index in sync.

Clinical Governance Preflight

  • Source-backed claims require verification — per-item sourceVerificationStatus and the dataset scope warning stay visible; unverified generated text is withheld, not shown.
  • No patient-identifiable document workflow introduced or expanded.
  • Supabase target unchanged (Clinical KB Database / sjrfecxgysukkwxsowpy).
  • Service-role/private access remain server-only — the full dataset is imported only by server components; the client gets the compact non-sensitive index.
  • Demo/synthetic content remains separate — reference specifier content, flagged pending review.
  • Conservative source behavior — no definitions invented; the 494 unverified definitions are gated behind a pending-verification notice.
  • Deployment classification / TGA SaMD impact — a reviewer should confirm classification for this broadened (non-automated, pending-review) reference content.

Notes

  • The two data files are kept in sync (a unit test asserts the compact index matches the full catalog by slug).
  • The clinical content should receive qualified clinician/governance review before production use, per the export's own scope warning.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added an end-to-end DSM-5-TR specifier catalogue experience with search, category filters, review-status indicators, and source status.
    • Introduced specifier reference pages for catalogue entries, including definitions, clinical note guidance, curated reasoning, ICD-11 context, and related items.
    • Enhanced specifier detail routing and metadata to support both curated records and catalogue entries.
    • Improved search results with catalogue matches plus clearer category, DSM, and quick-tile UI elements.
  • Data Updates
    • Refreshed catalogue datasets and metadata, including updated review coverage and statistics.
  • Tests
    • Added consistency checks between catalogue content, search index, enrichment logic, and slug behavior.

@supabase

supabase Bot commented Jul 14, 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 Jul 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a complete DSM-5-TR specifier catalog, server and client search helpers, catalog reference pages, enhanced search results, validation tests, and dynamic detail-page routing with curated-content fallback.

Changes

Specifier catalog experience

Layer / File(s) Summary
Specifier datasets
data/specifiers-content.json, data/specifiers-search-index.json, src/lib/specifiers-search-index.ts
Refreshes catalog exports and defines typed metadata, item schemas, review statuses, filters, and search-index accessors.
Server catalog access
src/lib/specifiers-content.ts
Loads and validates content, flattens and caches entries, resolves slugs, finds related items, applies curated enrichment, and selects verified entries for pre-rendering.
Client catalog search and validation
src/lib/specifiers-search-index.ts, tests/specifiers-content.test.ts
Filters and ranks catalog records, supports category and reviewed-only filtering, and verifies dataset consistency, definition gating, enrichment, and search behavior.
Reference page and UI primitives
src/components/specifiers/specifier-ui.tsx, src/components/specifiers/specifier-reference-page.tsx
Adds category, review-status, DSM, and quick-tile components, then renders definitions, review state, clinical notes, enrichment, ICD-11 context, and related entries.
Search home and route integration
src/components/specifiers/specifiers-home-page.tsx, src/app/specifiers/[slug]/page.tsx
Adds deduplicated catalogue matches to search results and routes curated or catalog slugs to the appropriate detail page with catalog-derived metadata.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 21.74% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding the full DSM-5-TR specifier catalogue with a verification gate.
Description check ✅ Passed The description covers Summary, Verification, Clinical Governance Preflight, and Notes, with the main requirements mostly addressed.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/specifiers-v2-design-r55baf

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

@BigSimmo
BigSimmo marked this pull request as ready for review July 14, 2026 11:37
@BigSimmo
BigSimmo enabled auto-merge July 14, 2026 11:40

@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: 3470e94f59

ℹ️ 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/specifiers-content.json Outdated
Comment thread src/components/specifiers/specifiers-home-page.tsx Outdated
Comment thread src/components/specifiers/specifier-reference-page.tsx
@BigSimmo

Copy link
Copy Markdown
Owner Author

@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.

@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: 3470e94f59

ℹ️ 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 src/lib/specifiers-content.ts Outdated
Comment thread data/specifiers-content.json Outdated
Comment thread src/components/specifiers/specifiers-home-page.tsx Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (2)
data/specifiers-content.json (2)

11721-12168: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Category "20. ICD-11 Specifics" fully duplicates content already present in other categories.

Several disorders in this category are near-identical/byte-identical repeats of entries already defined elsewhere in the file, rather than differentiated ICD-11-specific views:

  • Gaming Disorder (Lines 11726-11791) duplicates the entry under "16. Substance & Addictive" (Lines 9948-10013) — identical "meaning" text for both type and severity items.
  • Compulsive Sexual Behaviour Disorder (Lines 11793-11819) duplicates the entry under "13. Sexual Dysfunctions" (Lines 8988-9014).
  • Bodily Distress Disorder (Lines 11911-11971) duplicates the entry under "9. Somatic Symptom" (Lines 6162-6223).
  • Partial Dissociative Identity Disorder (Lines 11973-11999) duplicates "8. Dissociative Disorders" (Lines 5570-5596).
  • Trance Disorder (Lines 12001-12027) duplicates "8. Dissociative Disorders" (Lines 5598-5646).
  • Olfactory Reference Disorder (Lines 12029-12111) duplicates "6. Obsessive-Compulsive" (Lines 4799-4881).
  • Body-Focused Repetitive Behaviour Disorder (Lines 12113-12139) duplicates "6. Obsessive-Compulsive" (Lines 4883-4909).
  • Complex PTSD (Lines 11821-11847) closely duplicates "7. Trauma & Stressor" (Lines 5092-5140), with only minor label wording differences.

Unlike "Catatonia" in this same category (whose ICD-11 sub-items genuinely differ from the DSM-5-TR "Catatonia" entry elsewhere), these are exact-content duplicates. This inflates the disorders/specifierItems stats, produces redundant catalog entries a user could stumble on twice with no distinguishing information, and creates a content-drift risk: because each copy has its own rowKey/contentHash, future edits to one copy will not automatically propagate to the other.

Consider either deduplicating (drop the exact-duplicate entries from "20. ICD-11 Specifics" and rely on category tags/cross-links instead), or giving the ICD-11 Specifics versions genuinely differentiated content (as done for Catatonia).

🤖 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 `@data/specifiers-content.json` around lines 11721 - 12168, The ICD-11
Specifics category contains duplicate disorder entries already defined in other
categories, inflating catalog counts and creating content drift. In the category
identified by id "icd", remove the duplicate entries for Gaming Disorder,
Compulsive Sexual Behaviour Disorder, Complex PTSD, Bodily Distress Disorder,
Partial Dissociative Identity Disorder, Trance Disorder, Olfactory Reference
Disorder, and Body-Focused Repetitive Behaviour Disorder, while retaining
Catatonia and Gender Incongruence; do not alter the canonical entries in their
original categories.

295-300: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Drop the nested definition.status. Only definitionStatus is read by the schema and consumers, so the nested copy is redundant and can drift out of sync. data/specifiers-content.json:295-308

🤖 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 `@data/specifiers-content.json` around lines 295 - 300, Remove the nested
status property from the definition object in the Intellectual Developmental
Disorder entry, while preserving definition.meaning, definition.clinicalNote,
definition.sourceFamily, and the existing top-level definitionStatus value
consumed by the schema.
🤖 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 `@data/specifiers-content.json`:
- Around line 1101-1127: Remove the Selective Mutism entry identified by name
and its associated icd11Context and groups data from the Neurodevelopmental
section, while preserving the existing Anxiety Disorders entry and valid
surrounding JSON structure.

In `@data/specifiers-search-index.json`:
- Around line 618-626: Update the upstream catalog generator responsible for
specifier definitions so entries such as “Current severity” for Brief Psychotic
Disorder no longer reuse tic-severity or other cross-domain templates. Use
validated disorder-specific definitions where available; otherwise mark the
entry undefined/manual-review instead of defined. Regenerate both
specifiers-content.json and specifiers-search-index.json from the corrected
generator.

In `@src/components/specifiers/specifier-reference-page.tsx`:
- Around line 153-159: Update the “Deep guide” Link in SpecifierReferencePage to
navigate to the curated detail-page route instead of the `/specifiers/compare`
comparison workflow, preserving its existing label and styling.

In `@src/components/specifiers/specifiers-home-page.tsx`:
- Around line 213-218: Update catalogMatches to apply the active family and
diagnosis filters consistently with curated results, then use the combined
curated and catalog collections when deriving result counts and
EmptySearchResults visibility. Ensure catalog-only queries render valid cards
instead of the zero-match state. Add focused tests covering catalog-only results
and diagnosis-filtered catalog results, and run the narrowest relevant
validation.

---

Nitpick comments:
In `@data/specifiers-content.json`:
- Around line 11721-12168: The ICD-11 Specifics category contains duplicate
disorder entries already defined in other categories, inflating catalog counts
and creating content drift. In the category identified by id "icd", remove the
duplicate entries for Gaming Disorder, Compulsive Sexual Behaviour Disorder,
Complex PTSD, Bodily Distress Disorder, Partial Dissociative Identity Disorder,
Trance Disorder, Olfactory Reference Disorder, and Body-Focused Repetitive
Behaviour Disorder, while retaining Catatonia and Gender Incongruence; do not
alter the canonical entries in their original categories.
- Around line 295-300: Remove the nested status property from the definition
object in the Intellectual Developmental Disorder entry, while preserving
definition.meaning, definition.clinicalNote, definition.sourceFamily, and the
existing top-level definitionStatus value consumed by the schema.
🪄 Autofix (Beta)

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: fcb1a9a6-d791-4e5b-93a3-8ccd20fcf042

📥 Commits

Reviewing files that changed from the base of the PR and between 281d3e0 and 3470e94.

📒 Files selected for processing (10)
  • data/specifiers-content.json
  • data/specifiers-search-index.json
  • src/app/specifiers/[slug]/page.tsx
  • src/components/specifiers/specifier-record-page.tsx
  • src/components/specifiers/specifier-reference-page.tsx
  • src/components/specifiers/specifier-ui.tsx
  • src/components/specifiers/specifiers-home-page.tsx
  • src/lib/specifiers-content.ts
  • src/lib/specifiers-search-index.ts
  • tests/specifiers-content.test.ts

Comment thread data/specifiers-content.json Outdated
Comment thread data/specifiers-search-index.json Outdated
Comment thread src/components/specifiers/specifier-reference-page.tsx
Comment thread src/components/specifiers/specifiers-home-page.tsx Outdated

@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: 1c8bfd4ca3

ℹ️ 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/specifiers-content.json Outdated
Comment thread data/specifiers-content.json Outdated
Comment thread data/specifiers-content.json Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
data/specifiers-content.json (2)

2776-2792: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

clinicalNote references a parenthetical severity list that doesn't exist on these labels.

Cyclothymic Disorder's and Persistent Depressive Disorder's "With anxious distress" items carry the note "The parenthetical severity levels grade the anxious distress specifier, not the whole disorder." but their labels have no parenthetical severity list (unlike the Bipolar I/II/MDD variants, whose label reads "With anxious distress (mild, moderate, moderate-severe, severe)"). Since this PR's stated goal is correcting anxious-distress content, these two look like leftover copy-paste from the parenthetical variant.

🩹 Proposed fix
-                  "clinicalNote": "The parenthetical severity levels grade the anxious distress specifier, not the whole disorder.",
+                  "clinicalNote": null,

(apply at both Cyclothymic Disorder line ~2779 and Persistent Depressive Disorder line ~3415)

Also applies to: 3412-3427

🤖 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 `@data/specifiers-content.json` around lines 2776 - 2792, Remove the inaccurate
parenthetical-severity reference from the clinicalNote of the “With anxious
distress” entries for Cyclothymic Disorder and Persistent Depressive Disorder.
Keep the labels and other definition metadata unchanged, and replace the note
with wording that accurately describes these non-parenthetical variants.

1360-1380: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Wrong severity template reused across multiple rows
data/specifiers-content.json assigns the tic-disorder “current severity” wording (“tic frequency, complexity, suppressibility…”) to Brief Psychotic Disorder, Substance/Medication-Induced Psychotic Disorder, PTSD, and several paraphilic entries. These severities need disorder-specific domains, so this looks like a template-mapping bug and should be regenerated at the source rather than patched row by row.

🤖 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 `@data/specifiers-content.json` around lines 1360 - 1380, Regenerate the
severity entries in the source that produce the affected rows, including Brief
Psychotic Disorder and the other disorders identified in the comment, so each
“Current severity” definition uses disorder-specific domains instead of the
tic-disorder wording. Rebuild data/specifiers-content.json from the corrected
source and verify the reused template no longer appears in those rows.
🤖 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.

Outside diff comments:
In `@data/specifiers-content.json`:
- Around line 2776-2792: Remove the inaccurate parenthetical-severity reference
from the clinicalNote of the “With anxious distress” entries for Cyclothymic
Disorder and Persistent Depressive Disorder. Keep the labels and other
definition metadata unchanged, and replace the note with wording that accurately
describes these non-parenthetical variants.
- Around line 1360-1380: Regenerate the severity entries in the source that
produce the affected rows, including Brief Psychotic Disorder and the other
disorders identified in the comment, so each “Current severity” definition uses
disorder-specific domains instead of the tic-disorder wording. Rebuild
data/specifiers-content.json from the corrected source and verify the reused
template no longer appears in those rows.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 3825d38b-62d7-4a27-a7f2-d40dd9ffa25b

📥 Commits

Reviewing files that changed from the base of the PR and between 3470e94 and 1c8bfd4.

📒 Files selected for processing (6)
  • data/specifiers-content.json
  • data/specifiers-search-index.json
  • src/components/specifiers/specifier-reference-page.tsx
  • src/components/specifiers/specifiers-home-page.tsx
  • src/lib/specifiers-content.ts
  • tests/specifiers-content.test.ts
🚧 Files skipped from review as they are similar to previous changes (5)
  • src/components/specifiers/specifier-reference-page.tsx
  • tests/specifiers-content.test.ts
  • data/specifiers-search-index.json
  • src/components/specifiers/specifiers-home-page.tsx
  • src/lib/specifiers-content.ts

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 2 file(s) based on 2 unresolved review comments.

Files modified:

  • data/specifiers-content.json
  • data/specifiers-search-index.json

Commit: fbf299b5457fca34ecbaf60fbf816874ebf83c37

The changes have been pushed to the claude/specifiers-v2-design-r55baf branch.

Time taken: 7m 21s

@github-actions

Copy link
Copy Markdown

CI triage

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

  • Static PR checksneeds investigation.
  • Unit coverageneeds investigation.
  • PR requiredpossible known flake: UI/Playwright job; check tests/flake-ledger.json (tests/ui-smoke.spec.ts, tests/ui-smoke.spec.ts, tests/ui-tools.spec.ts, tests/ui-tools.spec.ts) and re-run before bisecting.

Heuristic only — a main-side or flake label is a starting point, not a verdict.

@BigSimmo

Copy link
Copy Markdown
Owner Author

@codex fix all open comments please without regression

@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: 60c7603fcf

ℹ️ 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/specifiers-content.json Outdated
Comment thread data/specifiers-content.json Outdated
@chatgpt-codex-connector

Copy link
Copy Markdown

Summary

Testing

  • python3 - <<'PY' ... PY — custom JSON/index consistency and content-regression assertions passed for 585 specifier items.
  • ⚠️ npm test -- --run tests/specifiers-content.test.ts — could not run in this checkout because node_modules/vitest/vitest.mjs is missing; npm also resolved Node v20.20.2 in this environment instead of the repo-required Node 24.

View task →

@BigSimmo

Copy link
Copy Markdown
Owner Author

@copilot resolve the merge conflicts on this branch.

auto-merge was automatically disabled July 14, 2026 13:41

Head branch was pushed to by a user without write access

Copilot AI commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts on this branch.

Resolved on commit 343f4ee by merging origin/main into this branch and fixing the resulting conflicts in the formulation/specifiers transition files.

@BigSimmo
BigSimmo enabled auto-merge (squash) July 14, 2026 13:50
@BigSimmo
BigSimmo disabled auto-merge July 14, 2026 13:52
@BigSimmo
BigSimmo force-pushed the claude/specifiers-v2-design-r55baf branch from 343f4ee to 4f889f0 Compare July 14, 2026 19:01
Populate the existing Specifiers feature with the complete DSM-5-TR
specifier taxonomy (585 items across 20 categories, 131 disorders, 218
groups) imported from the clinical content export, layered additively on
top of main's curated records — routes, wiring, and curated cards are
unchanged.

Governance-safe verification gate: only the 71 source-verified
definitions are displayed; the 494 unverified auto-generated definitions
(which were systematically mis-templated across domains in the source
export) are withheld behind a neutral "pending clinician verification"
notice and are neither rendered nor ranked-on in client search. The full
catalogue structure/labels stay searchable.

- data/specifiers-content.json: full nested dataset (server-only)
- data/specifiers-search-index.json: compact client search index
  (definition text blanked for non-verified items)
- src/lib/specifiers-content.ts: server catalog loader, slug map,
  curated enrichment confined to mood (bip/dep) categories
- src/lib/specifiers-search-index.ts: client-safe ranked catalog search
- specifier-reference-page.tsx: gated catalogue detail page
- specifier-ui.tsx: category/review/DSM badges + quick tiles
- specifiers-home-page.tsx: additive catalogue results beneath curated
- [slug]/page.tsx: resolve curated first, then catalogue (dynamicParams)
- tests: catalog integrity, gate, enrichment-confinement, search

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WmtoUEnX7Pe4yipAmPFSiG
@BigSimmo
BigSimmo force-pushed the claude/specifiers-v2-design-r55baf branch from 4f889f0 to 8ffbc0e Compare July 14, 2026 19:03
@BigSimmo BigSimmo changed the title feat(specifiers): populate search + detail with full DSM-5-TR catalog feat(specifiers): add full DSM-5-TR catalogue with verification gate Jul 14, 2026
@BigSimmo
BigSimmo enabled auto-merge (squash) July 14, 2026 19:05

@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: 8ffbc0e87b

ℹ️ 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/specifiers-content.json Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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 `@data/specifiers-content.json`:
- Around line 1332-1350: Update the sourceFamily value for the Brief Psychotic
Disorder “Current severity” item in the Severity section to “Best-effort
DSM-derived clinical anchor pending manual verification,” matching the standard
value used by other Current severity entries while leaving its review and
verification statuses unchanged.
🪄 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: c95a453a-60f2-4ee0-a400-452b74cd6d3a

📥 Commits

Reviewing files that changed from the base of the PR and between 60c7603 and 8ffbc0e.

📒 Files selected for processing (9)
  • data/specifiers-content.json
  • data/specifiers-search-index.json
  • src/app/specifiers/[slug]/page.tsx
  • src/components/specifiers/specifier-reference-page.tsx
  • src/components/specifiers/specifier-ui.tsx
  • src/components/specifiers/specifiers-home-page.tsx
  • src/lib/specifiers-content.ts
  • src/lib/specifiers-search-index.ts
  • tests/specifiers-content.test.ts
🚧 Files skipped from review as they are similar to previous changes (6)
  • src/components/specifiers/specifier-reference-page.tsx
  • src/app/specifiers/[slug]/page.tsx
  • data/specifiers-search-index.json
  • src/lib/specifiers-search-index.ts
  • src/lib/specifiers-content.ts
  • src/components/specifiers/specifier-ui.tsx

Comment thread data/specifiers-content.json
Address Codex/CodeRabbit review findings on the catalogue:

- Gaming Disorder "Predominantly online"/"Predominantly offline" subtypes
  (both source-verified, so displayed) shared one merged "online or
  offline" definition. Give each a direction-specific definition in both
  the content dataset and the compact search index, and add a regression
  test asserting the two subtypes stay distinct.
- Brief Psychotic Disorder "Current severity": replace the leftover
  internal note "Needs manual review - incorrect template removed" in
  sourceFamily (which surfaces on the detail page) with the standard
  "Best-effort DSM-derived clinical anchor pending manual verification".

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WmtoUEnX7Pe4yipAmPFSiG

Copy link
Copy Markdown
Owner Author

Review-findings disposition (clean rebuild, head 6834b64a)

This PR was rebuilt as a single clean commit on current main, then two follow-up fixes. Mapping every prior Codex/CodeRabbit finding to its resolution:

Systemic mis-templated definitions — anxious-distress showing severity text, FND "sexual-dysfunction context", bodily-distress "trauma-related symptom burden", illness-anxiety "personality change presentation", tic-severity anchors on non-tic rows, severity-range describing only "severe":
→ Resolved structurally by the verification gate. All of these are on source-needs-formal-review rows, whose auto-generated definitions are withheld behind a "pending clinician verification" notice and blanked in the client search index. Verified programmatically: of 585 items only the 71 source-verified rows display definition text, with 0 cross-domain-template leaks. A test (only source-verified rows carry displayed definition text…) locks this in.

Gaming Disorder "Predominantly online/offline" (P1, Codex r3581898748) — these are source-verified, so they display; both subtypes shared one merged "online or offline" string.
→ Fixed in 6834b64a: each subtype now has a direction-specific definition in both data files, plus a regression test.

Brief Psychotic Disorder "Current severity" sourceFamily (Minor, CodeRabbit) — leftover internal note.
→ Fixed in 6834b64a: standardised to "Best-effort DSM-derived clinical anchor pending manual verification".

Enrichment cross-matching generic labels (P1) — e.g. an IDD "Mild" row picking up mood mild-severity guidance.
→ Resolved: curatedEnrichmentFor is confined to mood (bip/dep) categories and drops short-name matching. Tests assert non-mood generic labels are not enriched.

"Deep guide" CTA (P2) → points to /specifiers/${enrichment.slug}.

Catalogue matches vs. filters (P2) → the full-catalogue results are a clearly-labelled, separate "Full DSM-5-TR catalogue" section beneath the curated results (the reviewers' second accepted option), deduped by label.

Resolving the prior threads accordingly; all are outdated against the superseded broken commits. The dataset remains flagged pending qualified clinician review per its own scope warning.


Generated by Claude Code

@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: 6834b64a09

ℹ️ 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 src/components/specifiers/specifier-reference-page.tsx Outdated
Comment thread src/components/specifiers/specifiers-home-page.tsx Outdated
Comment thread data/specifiers-content.json Outdated
@BigSimmo
BigSimmo disabled auto-merge July 14, 2026 19:20
Address a further round of Codex review findings on displayed content:

- Source badge: ICD-11 catalogue items (e.g. Gaming Disorder (ICD-11),
  Gender Incongruence) were unconditionally labelled DSM-5-TR. Derive the
  badge from the item's provenance (ICD-11 Specifics category, ICD-11/WHO
  source family, or "(ICD-11)" disorder name).
- Search results: a catalog-only query showed the "No strong match"
  empty state and a "0 matches" count while the full-catalogue section
  listed real matches below. Drive the shared count and empty-state from
  both curated and catalogue results.
- Clinical notes: PTSD "with delayed expression" (a timing threshold) and
  Conduct Disorder "adolescent-onset type" (an age-of-onset threshold)
  carried a generic "symptom-count threshold" note. Replace it with a
  dimension-neutral caveat on those two source-verified rows; the genuine
  symptom-count severity rows keep their note. Add a regression test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WmtoUEnX7Pe4yipAmPFSiG
@BigSimmo
BigSimmo enabled auto-merge (squash) July 14, 2026 19:27

Copy link
Copy Markdown
Owner Author

Addressed the latest Codex findings in acddc95b:

  • Provenance badge (P1) — ICD-11 catalogue items (Gaming Disorder (ICD-11), Gender Incongruence, etc.) no longer show a DSM-5-TR badge; the badge is now derived from the item's provenance (ICD-11 Specifics category, ICD-11/WHO source family, or "(ICD-11)" disorder name).
  • Empty state vs. catalogue matches (P2) — the shared count and empty-state now include the full-catalogue matches, so a catalog-only query no longer shows "0 matches" / "No strong match" above real results.
  • Timing/onset clinical notes (P2) — PTSD "with delayed expression" (timing) and Conduct Disorder "adolescent-onset type" (age-of-onset) no longer carry the generic "symptom-count threshold" note; genuine symptom-count severity rows keep theirs. Regression test added.

Build compiles; 23/23 specifier tests pass.


Generated by Claude Code

@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: acddc95bd0

ℹ️ 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 src/lib/specifiers-search-index.ts Outdated
rankCatalogRecords compares its field/full-text/exact/prefix haystacks
against a normalized (lowercased) query, but searchSpecifierCatalog passed
the raw-cased specifier values, so a lowercase query like "mild" missed the
exact/prefix/phrase/field bonuses on a capitalized "Mild" label and could
rank below rows that merely contain "mild" in a parenthetical range.
Normalize the haystacks the same way the other catalog callers do, and add
a regression test that an exact label match ranks first.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WmtoUEnX7Pe4yipAmPFSiG

@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: 03200832f6

ℹ️ 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 src/components/specifiers/specifiers-home-page.tsx Outdated
Comment thread src/lib/specifiers-content.ts
Comment thread data/specifiers-content.json Outdated
Address two more Codex review findings on head 0320083:

- Catalogue de-dupe: the label-only exclusion removed every catalogue row
  whose normalized label matched a curated card, even across different
  diagnoses — so a query like "schizophrenia catatonia" had its
  diagnosis-specific catalogue rows hidden by the generic curated "With
  catatonia" card. The curated set is mood-only and generic, so drop the
  de-dupe entirely; the disorder-specific catalogue rows now stay reachable.
- AMPD provenance: three source-verified DSM-5-TR Section III (AMPD) trait
  rows (Negative affectivity, Detachment, Disinhibition) carried an ICD-11
  sourceFamily, which the reference page turned into an ICD-11 badge/source
  panel for DSM content. Correct them to the DSM value used by the sibling
  AMPD rows; add a regression test that AMPD provenance stays DSM-specific.

Universal specifiers (18) are intentionally not flattened: they are export
metadata and are not surfaced or advertised anywhere in the UI.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WmtoUEnX7Pe4yipAmPFSiG

@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: b42a50f205

ℹ️ 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/specifiers-content.json Outdated
Comment thread data/specifiers-content.json Outdated
Two more source-verified rows displayed clinically wrong text:

- Binge-Eating Disorder (and the identically-templated Hypersomnolence
  Disorder) severity notes told users to document "compensatory
  behaviours", which are not part of those disorders — they belong to
  Bulimia. Drop that item from the note for the non-purging disorders;
  Bulimia's note is left intact.
- "With/without possession" rows (Dissociative Identity Disorder, Trance
  Disorder) had a one-sided meaning asserting possession is present, so
  the non-possession reading was wrong. Use neutral wording covering both
  states, in both the content dataset and the compact search index.

Add regression tests for both.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WmtoUEnX7Pe4yipAmPFSiG

@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: 796c443a8e

ℹ️ 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 src/components/specifiers/specifiers-home-page.tsx Outdated
The full-catalogue results section can include ICD-11/WHO rows (Gaming
Disorder, Gender Incongruence), so its "Full DSM-5-TR catalogue" eyebrow
misstated provenance before a user opened a row. Use a neutral "Full
specifier catalogue" label; per-item source is already shown on the cards
and the detail page.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WmtoUEnX7Pe4yipAmPFSiG
@BigSimmo
BigSimmo disabled auto-merge July 14, 2026 20:11
@BigSimmo
BigSimmo merged commit 2c208fd into main Jul 14, 2026
16 checks passed
BigSimmo pushed a commit that referenced this pull request Jul 17, 2026
… review

Follow-up to the DSM-5-TR specifier catalogue (#656). Automated review
repeatedly surfaced clinically wrong auto-generated text among the rows
whose SOURCE was verified (gaming subtypes, PTSD/Conduct threshold notes,
AMPD provenance, BED severity notes, possession meanings, ...). "Source
verified" only attests the specifier's existence/attribution, not that the
generated definition text is clinically correct, so displaying any of it as
trusted is unsafe for a decision-support tool.

Withhold the generated meaning/clinical-note for ALL catalogue rows — not
just the previously-ungated ~514 — until a clinician authors real
definitions:

- specifier-reference-page.tsx: every catalogue detail page now shows the
  "definition pending qualified clinician verification" notice instead of
  generated meaning/clinical-note. Structural facts (label, disorder,
  group, ICD-11 context), the source/review badges, and the hand-authored
  curated fit/exclusion guidance are still shown.
- specifiers-search-index.json: blank all 71 remaining meaning fields so no
  generated definition text is displayed or ranked on client-side.
- tests: assert the client index carries no generated definition text.

The full 585-item catalogue, search, routing, provenance badges, and
structure are unchanged. The nested content dataset is left intact so a
future clinician-reviewed regeneration can restore verified definitions.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WmtoUEnX7Pe4yipAmPFSiG
BigSimmo added a commit that referenced this pull request Jul 17, 2026
… review (#691)

* fix(specifiers): withhold all generated definitions pending clinician review

Follow-up to the DSM-5-TR specifier catalogue (#656). Automated review
repeatedly surfaced clinically wrong auto-generated text among the rows
whose SOURCE was verified (gaming subtypes, PTSD/Conduct threshold notes,
AMPD provenance, BED severity notes, possession meanings, ...). "Source
verified" only attests the specifier's existence/attribution, not that the
generated definition text is clinically correct, so displaying any of it as
trusted is unsafe for a decision-support tool.

Withhold the generated meaning/clinical-note for ALL catalogue rows — not
just the previously-ungated ~514 — until a clinician authors real
definitions:

- specifier-reference-page.tsx: every catalogue detail page now shows the
  "definition pending qualified clinician verification" notice instead of
  generated meaning/clinical-note. Structural facts (label, disorder,
  group, ICD-11 context), the source/review badges, and the hand-authored
  curated fit/exclusion guidance are still shown.
- specifiers-search-index.json: blank all 71 remaining meaning fields so no
  generated definition text is displayed or ranked on client-side.
- tests: assert the client index carries no generated definition text.

The full 585-item catalogue, search, routing, provenance badges, and
structure are unchanged. The nested content dataset is left intact so a
future clinician-reviewed regeneration can restore verified definitions.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WmtoUEnX7Pe4yipAmPFSiG

* fix(specifiers): correct ARFID third driver label (ICD-11 6B83)

Source verification against ICD-11 6B83 found the ARFID feature labelled
"With inadequate food intake associated with limited availability" names an
ICD-11 EXCLUSION ("unavailability of food") rather than a driver. The genuine
third ARFID driver — alongside sensory-based avoidance and fear of aversive
consequences — is an apparent lack of interest in eating / low appetite.

Relabel it accordingly in the content dataset and the client index (rowKey/slug
kept stable to avoid breaking URLs), and add a regression test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WmtoUEnX7Pe4yipAmPFSiG

* fix(specifiers): source-neutral wording for undefined ICD-11 rows

CodeRabbit: the "no separate definition" branch of the reference-page
description hardcoded "DSM-5-TR", so an ICD-11 item without a definition
told users to read it against the wrong manual. Use the per-item
sourceManual label (DSM-5-TR or ICD-11) already derived for the badge.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WmtoUEnX7Pe4yipAmPFSiG

---------

Co-authored-by: Claude <noreply@anthropic.com>
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.

3 participants