autoicd-js 0.5.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
5
5
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.5+-blue.svg)](https://www.typescriptlang.org/)
6
6
 
7
- Official TypeScript SDK for the [AutoICD API](https://autoicdapi.com) — clinical text to ICD-10-CM diagnosis codes, powered by AI and medical NLP.
7
+ Official TypeScript SDK for the [AutoICD API](https://autoicdapi.com) — AI medical coding that converts clinical text to ICD-10-CM, ICD-11, and ICF codes using medical NLP. Automate ICD-10 coding, ICF functioning classification, and disability assessment in your application.
8
8
 
9
9
  Zero dependencies. Works in **Node.js 18+**, **Deno**, **Bun**, and **edge runtimes**.
10
10
 
@@ -16,8 +16,11 @@ Zero dependencies. Works in **Node.js 18+**, **Deno**, **Bun**, and **edge runti
16
16
 
17
17
  | | |
18
18
  |---|---|
19
- | **AI-Powered ICD-10 Coding** | Clinical NLP extracts diagnoses from free-text notes and maps them to ICD-10-CM codes — no manual lookup required |
19
+ | **AI-Powered ICD-10, ICD-11 & ICF Coding** | Clinical NLP extracts diagnoses from free-text notes and maps them to ICD-10-CM, ICD-11, or ICF codes — no manual lookup required |
20
+ | **Chart Audit with HCC Gap Capture** | Find missed HCCs, unsupported codes, and specificity upgrades with RAF-weighted revenue estimates (CMS v22 + v28 PY2026). Every finding carries evidence spans |
20
21
  | **74,000+ ICD-10-CM Codes** | Full 2025 code set enriched with SNOMED CT synonyms for comprehensive matching |
22
+ | **ICD-11 Support** | Search and look up ICD-11 codes, with full ICD-10 ↔ ICD-11 crosswalk mappings |
23
+ | **ICF Functioning Codes** | Code clinical text to WHO ICF categories, search 1,400+ codes, and access Core Sets for 12+ conditions |
21
24
  | **Negation & Context Detection** | Knows the difference between "patient has diabetes" and "patient denies diabetes" — flags negated, historical, uncertain, and family-history mentions |
22
25
  | **PHI De-identification** | HIPAA-compliant anonymization of names, dates, SSNs, phone numbers, emails, addresses, MRNs, and ages |
23
26
  | **Confidence Scoring** | Every code match includes a similarity score and confidence level so you can set your own acceptance thresholds |
@@ -68,6 +71,51 @@ for (const entity of result.entities) {
68
71
 
69
72
  ## Features
70
73
 
74
+ ### Chart Audit (HCC gap capture, RADV defense, specificity, denial risk)
75
+
76
+ Audit a chart to surface coding gaps, unsupported codes, specificity upgrades, and denial-risk flags in a single call. Every finding carries extractive evidence spans pointing back to the source text, and HCC gaps include RAF-weighted revenue estimates using the CMS PY2026 V22 and V28 community models.
77
+
78
+ ```ts
79
+ const audit = await autoicd.audit({
80
+ text:
81
+ "68yo M, type 2 diabetes stable on metformin, chronic systolic heart failure " +
82
+ "on furosemide, edema controlled. A1c 7.4 today.",
83
+ codes: [{ code: "E11.9", kind: "icd10" }],
84
+ capabilities: ["hcc", "radv", "specificity", "denial", "problem_list"],
85
+ context: {
86
+ patient: { coverage: "medicare_advantage" },
87
+ hcc_model: "both",
88
+ },
89
+ });
90
+
91
+ console.log(`Missed revenue: $${audit.totals.estimated_revenue_recovery.toFixed(0)}`);
92
+ console.log(`RADV exposure: $${audit.totals.radv_exposure.toFixed(0)}`);
93
+
94
+ for (const m of audit.missed) {
95
+ console.log(
96
+ `MISSED ${m.code} (${m.hcc_category ?? "non-HCC"} ${m.hcc_model ?? ""}) ` +
97
+ `→ $${m.estimated_revenue?.toFixed(0) ?? 0}: ${m.description}`
98
+ );
99
+ for (const span of m.evidence) {
100
+ console.log(` evidence: "${span.quote}" [${span.start}-${span.end}]`);
101
+ }
102
+ }
103
+ ```
104
+
105
+ | Capability | What it surfaces |
106
+ |---|---|
107
+ | `hcc` | Missed HCC codes with `hcc_category`, `raf_weight`, `estimated_revenue` per v22/v28 model |
108
+ | `radv` | Submitted codes with no supporting documentation, with `what_would_support_it` guidance and exposure dollars |
109
+ | `specificity` | Upgrade opportunities from unspecified to more specific child codes |
110
+ | `denial` | Documentation-quality risk flags (missing laterality, missing duration, age/sex mismatches) |
111
+ | `problem_list` | Deduplicated active-conditions list with status (active/historical) and evidence |
112
+
113
+ Default behavior runs all five capabilities. Pass `capabilities: ["hcc"]` to run a targeted audit.
114
+
115
+ > **`hcc_model`:** use `"v22"`, `"v28"`, or `"both"` (default). CMS PY2026 MA payment uses V22 and V28 as the two main community models. V24 is the ESRD-specific model and is not accepted here.
116
+
117
+ Read more about the Audit endpoint at [autoicdapi.com/audit](https://autoicdapi.com/audit).
118
+
71
119
  ### Automated ICD-10 Medical Coding
72
120
 
73
121
  Extract diagnosis entities from clinical notes and map them to ICD-10-CM codes. Each entity includes ranked candidates with confidence scores, negation status, and context flags.
@@ -106,10 +154,10 @@ const result = await autoicd.code(
106
154
  Search the full ICD-10-CM 2025 code set by description. Perfect for building code lookup UIs, autocomplete fields, and validation workflows.
107
155
 
108
156
  ```ts
109
- const results = await autoicd.codes.search("diabetes mellitus");
157
+ const results = await autoicd.icd10.search("diabetes mellitus");
110
158
  // results.codes → [{ code: "E11.9", short_description: "...", long_description: "...", is_billable: true }, ...]
111
159
 
112
- const results = await autoicd.codes.search("heart failure", { limit: 5 });
160
+ const results = await autoicd.icd10.search("heart failure", { limit: 5 });
113
161
  ```
114
162
 
115
163
  ### ICD-10 Code Details
@@ -117,7 +165,7 @@ const results = await autoicd.codes.search("heart failure", { limit: 5 });
117
165
  Get full details for any ICD-10-CM code — descriptions, billable status, synonyms, hierarchy, and chapter classification.
118
166
 
119
167
  ```ts
120
- const detail = await autoicd.codes.get("E11.9");
168
+ const detail = await autoicd.icd10.get("E11.9");
121
169
  console.log(detail.code); // "E11.9"
122
170
  console.log(detail.long_description); // "Type 2 diabetes mellitus without complications"
123
171
  console.log(detail.is_billable); // true
@@ -125,6 +173,71 @@ console.log(detail.synonyms.snomed); // ["Diabetes mellitus type 2", ...]
125
173
  console.log(detail.chapter?.title); // "Endocrine, Nutritional and Metabolic Diseases"
126
174
  ```
127
175
 
176
+ ### ICD-11 Code Search
177
+
178
+ Search the ICD-11 code set by description. The AutoICD API includes the full WHO ICD-11 MMS hierarchy.
179
+
180
+ ```ts
181
+ const results = await autoicd.icd11.search("diabetes mellitus");
182
+ // results.codes → [{ code: "5A11", short_description: "...", foundation_uri: "..." }, ...]
183
+
184
+ const results = await autoicd.icd11.search("heart failure", { limit: 5 });
185
+ ```
186
+
187
+ ### ICD-11 Code Details & Crosswalk
188
+
189
+ Get full details for any ICD-11 code — descriptions, Foundation URI, hierarchy, synonyms, and ICD-10 crosswalk mappings.
190
+
191
+ ```ts
192
+ const detail = await autoicd.icd11.get("5A11");
193
+ console.log(detail.code); // "5A11"
194
+ console.log(detail.short_description); // "Type 2 diabetes mellitus"
195
+ console.log(detail.foundation_uri); // "http://id.who.int/icd/entity/1691003785"
196
+ console.log(detail.chapter?.title); // "Endocrine, nutritional or metabolic diseases"
197
+
198
+ // ICD-10 crosswalk
199
+ for (const mapping of detail.icd10_mappings) {
200
+ console.log(`${mapping.code} — ${mapping.description} (${mapping.mapping_type})`);
201
+ // "E11.9 — Type 2 diabetes mellitus without complications (equivalent)"
202
+ }
203
+ ```
204
+
205
+ ### ICD-10 → ICD-11 Crosswalk
206
+
207
+ ICD-10 code details now include ICD-11 crosswalk mappings when available:
208
+
209
+ ```ts
210
+ const detail = await autoicd.icd10.get("E11.9");
211
+ for (const mapping of detail.icd11_mappings ?? []) {
212
+ console.log(`${mapping.code} — ${mapping.description}`);
213
+ // "5A11 — Type 2 diabetes mellitus"
214
+ }
215
+ ```
216
+
217
+ ### ICF Functioning Codes
218
+
219
+ Code clinical text to WHO ICF categories, look up codes, search, and access ICF Core Sets for 12+ conditions.
220
+
221
+ ```typescript
222
+ // Code clinical text to ICF categories
223
+ const icf = await client.icf.code("Patient with stroke and hemiplegia");
224
+ console.log(icf.results[0].codes);
225
+ // [{ code: "b730", description: "Muscle power functions", component: "b", ... }]
226
+
227
+ // Look up an ICF code
228
+ const code = await client.icf.lookup("d450");
229
+ console.log(code.title); // "Walking"
230
+ console.log(code.definition); // "Moving along a surface on foot..."
231
+
232
+ // Search ICF codes
233
+ const results = await client.icf.search("mobility");
234
+
235
+ // Get ICF Core Set for a diagnosis
236
+ const coreSet = await client.icf.coreSet("E11.9");
237
+ console.log(coreSet.conditionName); // "Diabetes Mellitus"
238
+ console.log(coreSet.brief); // [{ code: "b530", title: "Weight maintenance functions", ... }]
239
+ ```
240
+
128
241
  ### PHI De-identification
129
242
 
130
243
  Strip protected health information from clinical notes before storage or analysis. HIPAA-compliant de-identification for names, dates, SSNs, phone numbers, emails, addresses, MRNs, and ages.
@@ -235,8 +348,14 @@ Full REST API documentation at [autoicdapi.com/docs](https://autoicdapi.com/docs
235
348
  |--------|-------------|
236
349
  | `autoicd.code(text, options?)` | Code clinical text to ICD-10-CM diagnoses |
237
350
  | `autoicd.anonymize(text)` | De-identify PHI/PII in clinical text |
238
- | `autoicd.codes.search(query, options?)` | Search ICD-10-CM codes by description |
239
- | `autoicd.codes.get(code)` | Get details for an ICD-10-CM code |
351
+ | `autoicd.icd10.search(query, options?)` | Search ICD-10-CM codes by description |
352
+ | `autoicd.icd10.get(code)` | Get details for an ICD-10-CM code (incl. ICD-11 crosswalk) |
353
+ | `autoicd.icd11.search(query, options?)` | Search ICD-11 codes by description |
354
+ | `autoicd.icd11.get(code)` | Get details for an ICD-11 code (incl. ICD-10 crosswalk) |
355
+ | `autoicd.icf.code(text, options?)` | Code clinical text to ICF functioning categories |
356
+ | `autoicd.icf.lookup(code)` | Get details for an ICF code |
357
+ | `autoicd.icf.search(query, options?)` | Search ICF codes by keyword |
358
+ | `autoicd.icf.coreSet(icd10Code)` | Get ICF Core Set for an ICD-10 diagnosis |
240
359
 
241
360
  ---
242
361
 
@@ -255,6 +374,14 @@ import type {
255
374
  AnonymizeResponse,
256
375
  PIIEntity,
257
376
  RateLimit,
377
+ ICD11CodeDetail,
378
+ ICD11CodeDetailFull,
379
+ ICD11CodeSearchResponse,
380
+ CrosswalkMapping,
381
+ ICFCodingResponse,
382
+ ICFCodeDetail,
383
+ ICFCodeSearchResponse,
384
+ ICFCoreSetResponse,
258
385
  } from "autoicd";
259
386
  ```
260
387
 
@@ -272,6 +399,8 @@ import type {
272
399
  - [AutoICD API](https://autoicdapi.com) — Homepage and API key management
273
400
  - [API Documentation](https://autoicdapi.com/docs) — Full REST API reference
274
401
  - [ICD-10-CM Code Directory](https://autoicdapi.com/icd10) — Browse all 74,000+ diagnosis codes
402
+ - [ICD-11 Code Directory](https://autoicdapi.com/icd11) — Browse the WHO ICD-11 MMS hierarchy
403
+ - [ICD-10 ↔ ICD-11 Crosswalk](https://autoicdapi.com/icd10-to-icd11) — Map codes between revisions
275
404
  - [ICD-10 Codes by Condition](https://autoicdapi.com/icd10/condition) — Find codes for common conditions
276
405
  - [Python SDK](https://pypi.org/project/autoicd/) — `pip install autoicd`
277
406
  - [MCP Server](https://www.npmjs.com/package/autoicd-mcp) — For Claude Desktop, Cursor, VS Code