From a45ef50a456f354b596dec7bd0df80dd1ea2c0ed Mon Sep 17 00:00:00 2001 From: Doug Horner Date: Thu, 23 Jul 2026 23:16:01 -0400 Subject: [PATCH 1/3] =?UTF-8?q?feat(CodeLookup):=20coding-system=20filter?= =?UTF-8?q?=20=E2=80=94=20ICD-10/SNOMED=20mode,=20ICD-11-ready=20(#335)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - engine SearchOptions.codetypes filters label + code matches at query time - searchCodetypes prop: programmer-fixed system; applies to drill-down too - codetypeOptions prop: user-facing segmented control (radiogroup) - ConditionsOnly story: All | ICD-10 | SNOMED toggle; new ICD-10-only story --- .../CodeLookup/CodeLookup.stories.tsx | 45 ++++++++++- src/components/CodeLookup/CodeLookup.tsx | 74 ++++++++++++++++++- src/components/CodeLookup/codify.worker.ts | 1 + src/components/CodeLookup/engine.test.ts | 27 +++++++ src/components/CodeLookup/engine.ts | 28 ++++++- src/components/CodeLookup/index.ts | 1 + 6 files changed, 169 insertions(+), 7 deletions(-) diff --git a/src/components/CodeLookup/CodeLookup.stories.tsx b/src/components/CodeLookup/CodeLookup.stories.tsx index 4fb510b8c..c5e76995e 100644 --- a/src/components/CodeLookup/CodeLookup.stories.tsx +++ b/src/components/CodeLookup/CodeLookup.stories.tsx @@ -1,6 +1,10 @@ import type { Meta, StoryObj } from '@storybook/react-vite'; import { useState } from 'react'; -import { CodeLookup, type CodifyDomain } from './CodeLookup'; +import { + CodeLookup, + type CodifyDomain, + type CodetypeOption, +} from './CodeLookup'; import type { CodifyResult } from './engine'; const meta: Meta = { @@ -50,10 +54,14 @@ type Story = StoryObj; function Template({ domains, searchDomains, + searchCodetypes, + codetypeOptions, locale, }: { domains?: CodifyDomain[]; searchDomains?: CodifyDomain[]; + searchCodetypes?: string[]; + codetypeOptions?: CodetypeOption[]; locale?: string; }) { const [selected, setSelected] = useState(null); @@ -64,6 +72,8 @@ function Template({ locale={locale} domains={domains} searchDomains={searchDomains} + searchCodetypes={searchCodetypes} + codetypeOptions={codetypeOptions} onSelect={setSelected} /> {selected && ( @@ -82,11 +92,38 @@ export const AllDomains: Story = { /** Conditions only (ICD-10 + SNOMED, ~14 MB). Try "con hea fa", "chf", "lvhf". * Results collapse to one row per condition family (ICD-10 code root); → lists - * the specific billable codes. Planned: the drill-down will also surface - * suggested orders (labs/procedures) for the condition. */ + * the specific billable codes. The segmented control lets the user restrict + * the coding system (`codetypeOptions`); a fixed programmer-set filter is the + * `searchCodetypes` prop instead (see "Conditions ICD-10 Only"). An ICD-11 + * option is one `{ label: 'ICD-11', codetypes: ['ICD11'] }` away once the + * shards carry ICD-11 rows (the source dataset has none yet). Planned: the + * drill-down will also surface suggested orders (labs/procedures) for the + * condition. */ export const ConditionsOnly: Story = { render: (_args, { globals }) => ( -