autoicd-js 0.6.0 → 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 +81 -2
- package/dist/index.d.mts +490 -3
- package/dist/index.d.ts +490 -3
- package/dist/index.js +150 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +150 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -3
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
[](https://www.typescriptlang.org/)
|
|
6
6
|
|
|
7
|
-
Official TypeScript SDK for the [AutoICD API](https://autoicdapi.com) — clinical text to ICD-10-CM
|
|
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,9 +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
|
|
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 |
|
|
21
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 |
|
|
22
24
|
| **Negation & Context Detection** | Knows the difference between "patient has diabetes" and "patient denies diabetes" — flags negated, historical, uncertain, and family-history mentions |
|
|
23
25
|
| **PHI De-identification** | HIPAA-compliant anonymization of names, dates, SSNs, phone numbers, emails, addresses, MRNs, and ages |
|
|
24
26
|
| **Confidence Scoring** | Every code match includes a similarity score and confidence level so you can set your own acceptance thresholds |
|
|
@@ -69,6 +71,51 @@ for (const entity of result.entities) {
|
|
|
69
71
|
|
|
70
72
|
## Features
|
|
71
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
|
+
|
|
72
119
|
### Automated ICD-10 Medical Coding
|
|
73
120
|
|
|
74
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.
|
|
@@ -167,6 +214,30 @@ for (const mapping of detail.icd11_mappings ?? []) {
|
|
|
167
214
|
}
|
|
168
215
|
```
|
|
169
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
|
+
|
|
170
241
|
### PHI De-identification
|
|
171
242
|
|
|
172
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.
|
|
@@ -281,6 +352,10 @@ Full REST API documentation at [autoicdapi.com/docs](https://autoicdapi.com/docs
|
|
|
281
352
|
| `autoicd.icd10.get(code)` | Get details for an ICD-10-CM code (incl. ICD-11 crosswalk) |
|
|
282
353
|
| `autoicd.icd11.search(query, options?)` | Search ICD-11 codes by description |
|
|
283
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 |
|
|
284
359
|
|
|
285
360
|
---
|
|
286
361
|
|
|
@@ -303,6 +378,10 @@ import type {
|
|
|
303
378
|
ICD11CodeDetailFull,
|
|
304
379
|
ICD11CodeSearchResponse,
|
|
305
380
|
CrosswalkMapping,
|
|
381
|
+
ICFCodingResponse,
|
|
382
|
+
ICFCodeDetail,
|
|
383
|
+
ICFCodeSearchResponse,
|
|
384
|
+
ICFCoreSetResponse,
|
|
306
385
|
} from "autoicd";
|
|
307
386
|
```
|
|
308
387
|
|
package/dist/index.d.mts
CHANGED
|
@@ -15,6 +15,14 @@ interface CodeOptions {
|
|
|
15
15
|
includeNegated?: boolean;
|
|
16
16
|
/** Output coding system: `"icd10"` (default) or `"icd11"`. */
|
|
17
17
|
outputSystem?: "icd10" | "icd11";
|
|
18
|
+
/** Include ICF functioning code results in the response. Defaults to false. */
|
|
19
|
+
includeIcf?: boolean;
|
|
20
|
+
/** Include ICD-11 crosswalk codes per ICD-10 match. Defaults to false. */
|
|
21
|
+
includeIcd11?: boolean;
|
|
22
|
+
/** Include SNOMED CT concept IDs per ICD-10 match. Defaults to false. */
|
|
23
|
+
includeSnomed?: boolean;
|
|
24
|
+
/** Include UMLS CUIs per ICD-10 match. Defaults to false. */
|
|
25
|
+
includeUmls?: boolean;
|
|
18
26
|
}
|
|
19
27
|
interface CodeMatch {
|
|
20
28
|
/** ICD-10-CM code (e.g., `"E11.21"`). */
|
|
@@ -27,6 +35,14 @@ interface CodeMatch {
|
|
|
27
35
|
confidence: "high" | "moderate";
|
|
28
36
|
/** The index term that produced this match. */
|
|
29
37
|
matched_term: string;
|
|
38
|
+
/** Mapped ICD-11 codes. */
|
|
39
|
+
icd11_codes: string[];
|
|
40
|
+
/** SNOMED CT concept IDs. */
|
|
41
|
+
snomed_ids: string[];
|
|
42
|
+
/** UMLS CUIs. */
|
|
43
|
+
umls_cuis: string[];
|
|
44
|
+
/** Related ICF category codes. */
|
|
45
|
+
icf_categories: string[];
|
|
30
46
|
}
|
|
31
47
|
interface CodingEntity {
|
|
32
48
|
/** Entity text as extracted from the input. */
|
|
@@ -61,6 +77,9 @@ interface CodingResponse {
|
|
|
61
77
|
entity_count: number;
|
|
62
78
|
/** Coding results per entity, sorted by position in text. */
|
|
63
79
|
entities: CodingEntity[];
|
|
80
|
+
/** LOINC lab code results. Only present when `includeLoinc` is true. */
|
|
81
|
+
/** ICF functioning code results. Only present when `includeIcf` is true. */
|
|
82
|
+
icf_entities?: ICFCodingEntity[];
|
|
64
83
|
}
|
|
65
84
|
interface SearchOptions {
|
|
66
85
|
/** Maximum number of results (1-100). Defaults to 20. */
|
|
@@ -99,8 +118,10 @@ interface CodeDetailFull extends CodeDetail {
|
|
|
99
118
|
chapter: ChapterInfo | null;
|
|
100
119
|
/** Code block range (e.g., `"E08-E13"`). */
|
|
101
120
|
block: string | null;
|
|
102
|
-
/** ICD-11 crosswalk mappings
|
|
103
|
-
icd11_mappings
|
|
121
|
+
/** ICD-11 crosswalk mappings for this ICD-10 code. */
|
|
122
|
+
icd11_mappings: CrosswalkMapping[];
|
|
123
|
+
/** Related ICF categories from WHO Core Sets. */
|
|
124
|
+
icf_categories: ICFCrossReference[];
|
|
104
125
|
}
|
|
105
126
|
interface CodeSearchResponse {
|
|
106
127
|
/** The search query that was used. */
|
|
@@ -166,6 +187,15 @@ interface CrosswalkMapping {
|
|
|
166
187
|
/** Target coding system: `"icd10"` or `"icd11"`. */
|
|
167
188
|
system: string;
|
|
168
189
|
}
|
|
190
|
+
/** A related ICF category from WHO Core Sets. */
|
|
191
|
+
interface ICFCrossReference {
|
|
192
|
+
/** ICF code (e.g., "b5401"). */
|
|
193
|
+
code: string;
|
|
194
|
+
/** ICF code title. */
|
|
195
|
+
title: string;
|
|
196
|
+
/** Component letter: "b", "s", "d", or "e". */
|
|
197
|
+
component: string;
|
|
198
|
+
}
|
|
169
199
|
interface ICD11CodeDetailFull extends ICD11CodeDetail {
|
|
170
200
|
/** Synonyms grouped by source. */
|
|
171
201
|
synonyms: Record<string, string[]>;
|
|
@@ -181,6 +211,8 @@ interface ICD11CodeDetailFull extends ICD11CodeDetail {
|
|
|
181
211
|
block: string | null;
|
|
182
212
|
/** ICD-10 crosswalk mappings for this ICD-11 code. */
|
|
183
213
|
icd10_mappings: CrosswalkMapping[];
|
|
214
|
+
/** Related ICF categories (via ICD-10 bridge). */
|
|
215
|
+
icf_categories: ICFCrossReference[];
|
|
184
216
|
}
|
|
185
217
|
interface ICD11CodeSearchResult {
|
|
186
218
|
/** ICD-11 code. */
|
|
@@ -200,6 +232,344 @@ interface ICD11CodeSearchResponse {
|
|
|
200
232
|
/** Matching ICD-11 codes. */
|
|
201
233
|
codes: ICD11CodeSearchResult[];
|
|
202
234
|
}
|
|
235
|
+
type ICFComponent = "b" | "s" | "d" | "e";
|
|
236
|
+
interface ICFCodeSummary {
|
|
237
|
+
/** ICF code (e.g., `"b280"`). */
|
|
238
|
+
code: string;
|
|
239
|
+
/** Code title. */
|
|
240
|
+
title: string;
|
|
241
|
+
/** ICF component: `"b"` (body functions), `"s"` (body structures), `"d"` (activities/participation), `"e"` (environmental factors). */
|
|
242
|
+
component: ICFComponent;
|
|
243
|
+
/** Number of direct child codes. */
|
|
244
|
+
child_count: number;
|
|
245
|
+
}
|
|
246
|
+
interface ICFCodeDetail {
|
|
247
|
+
/** ICF code. */
|
|
248
|
+
code: string;
|
|
249
|
+
/** Code title. */
|
|
250
|
+
title: string;
|
|
251
|
+
/** Full definition text, or `null` if not available. */
|
|
252
|
+
definition: string | null;
|
|
253
|
+
/** ICF component. */
|
|
254
|
+
component: ICFComponent;
|
|
255
|
+
/** Chapter this code belongs to. */
|
|
256
|
+
chapter: string;
|
|
257
|
+
/** Parent code in the ICF hierarchy, or `null` for top-level. */
|
|
258
|
+
parent: ICFCodeSummary | null;
|
|
259
|
+
/** Direct child codes. */
|
|
260
|
+
children: ICFCodeSummary[];
|
|
261
|
+
/** Inclusion notes. */
|
|
262
|
+
inclusions: string[];
|
|
263
|
+
/** Exclusion notes. */
|
|
264
|
+
exclusions: string[];
|
|
265
|
+
/** Index terms for this code. */
|
|
266
|
+
index_terms: string[];
|
|
267
|
+
/** Related ICD-10 codes from WHO Core Sets. */
|
|
268
|
+
icd10_mappings: CrosswalkMapping[];
|
|
269
|
+
/** Related ICD-11 codes (via ICD-10 bridge). */
|
|
270
|
+
icd11_mappings: CrosswalkMapping[];
|
|
271
|
+
/** Cross-reference IDs: "snomed" (concept IDs), "umls" (CUIs). */
|
|
272
|
+
cross_references: Record<string, string[]>;
|
|
273
|
+
}
|
|
274
|
+
interface ICFCodeResult {
|
|
275
|
+
/** Matched ICF code. */
|
|
276
|
+
code: string;
|
|
277
|
+
/** Code description. */
|
|
278
|
+
description: string;
|
|
279
|
+
/** ICF component. */
|
|
280
|
+
component: ICFComponent;
|
|
281
|
+
/** Cosine similarity score (0-1). */
|
|
282
|
+
similarity: number;
|
|
283
|
+
/** `"high"` if above high-confidence threshold, else `"moderate"`. */
|
|
284
|
+
confidence: "high" | "moderate";
|
|
285
|
+
/** The index term that produced this match. */
|
|
286
|
+
matched_term: string;
|
|
287
|
+
/** Related ICD-10 codes. */
|
|
288
|
+
icd10_codes: string[];
|
|
289
|
+
/** Related ICD-11 codes. */
|
|
290
|
+
icd11_codes: string[];
|
|
291
|
+
/** SNOMED CT concept IDs. */
|
|
292
|
+
snomed_ids: string[];
|
|
293
|
+
/** UMLS CUIs. */
|
|
294
|
+
umls_cuis: string[];
|
|
295
|
+
}
|
|
296
|
+
interface ICFCodingEntity {
|
|
297
|
+
/** Entity text as extracted from the input. */
|
|
298
|
+
entity_text: string;
|
|
299
|
+
/** Ranked ICF code candidates. */
|
|
300
|
+
codes: ICFCodeResult[];
|
|
301
|
+
}
|
|
302
|
+
interface ICFCodingResponse {
|
|
303
|
+
/** The input text that was processed. */
|
|
304
|
+
text: string;
|
|
305
|
+
/** Coding provider used. */
|
|
306
|
+
provider: string;
|
|
307
|
+
/** Total number of entities in results. */
|
|
308
|
+
entity_count: number;
|
|
309
|
+
/** Coding results per entity. */
|
|
310
|
+
results: ICFCodingEntity[];
|
|
311
|
+
}
|
|
312
|
+
interface ICFSearchResponse {
|
|
313
|
+
/** The search query that was used. */
|
|
314
|
+
query: string;
|
|
315
|
+
/** Number of results returned. */
|
|
316
|
+
count: number;
|
|
317
|
+
/** Matching ICF codes. */
|
|
318
|
+
codes: ICFCodeSummary[];
|
|
319
|
+
}
|
|
320
|
+
interface ICFCoreSetResult {
|
|
321
|
+
/** ICD-10 code used to look up the core set. */
|
|
322
|
+
icd10_code: string;
|
|
323
|
+
/** Condition name for this ICD-10 code. */
|
|
324
|
+
condition_name: string;
|
|
325
|
+
/** Brief ICF Core Set codes. */
|
|
326
|
+
brief: ICFCodeSummary[];
|
|
327
|
+
/** Comprehensive ICF Core Set codes. */
|
|
328
|
+
comprehensive: ICFCodeSummary[];
|
|
329
|
+
}
|
|
330
|
+
interface LOINCCodeSummary {
|
|
331
|
+
/** LOINC code (e.g., `"2345-7"`). */
|
|
332
|
+
code: string;
|
|
333
|
+
/** Primary description. */
|
|
334
|
+
long_common_name: string;
|
|
335
|
+
/** Abbreviated name. */
|
|
336
|
+
short_name: string;
|
|
337
|
+
/** LOINC class (e.g., `"CHEM"`). */
|
|
338
|
+
class_name: string;
|
|
339
|
+
/** 1=Lab, 2=Clinical, 3=Claims, 4=Surveys. */
|
|
340
|
+
class_type: number;
|
|
341
|
+
/** Order, Observation, or Both. */
|
|
342
|
+
order_obs: string;
|
|
343
|
+
}
|
|
344
|
+
interface LOINCCodeDetail {
|
|
345
|
+
/** LOINC code. */
|
|
346
|
+
code: string;
|
|
347
|
+
/** Primary description. */
|
|
348
|
+
long_common_name: string;
|
|
349
|
+
/** Abbreviated name. */
|
|
350
|
+
short_name: string;
|
|
351
|
+
/** Display name. */
|
|
352
|
+
display_name: string;
|
|
353
|
+
/** Consumer-friendly name. */
|
|
354
|
+
consumer_name: string;
|
|
355
|
+
/** What is measured (e.g., `"Glucose"`). */
|
|
356
|
+
component: string;
|
|
357
|
+
/** Measurement property (e.g., `"MCnc"`). */
|
|
358
|
+
property: string;
|
|
359
|
+
/** Timing (e.g., `"Pt"` = point in time). */
|
|
360
|
+
time_aspect: string;
|
|
361
|
+
/** Specimen type (e.g., `"Ser/Plas"`). */
|
|
362
|
+
system: string;
|
|
363
|
+
/** Scale (e.g., `"Qn"` = quantitative). */
|
|
364
|
+
scale_type: string;
|
|
365
|
+
/** Method used. */
|
|
366
|
+
method_type: string;
|
|
367
|
+
/** LOINC class. */
|
|
368
|
+
class_name: string;
|
|
369
|
+
/** 1=Lab, 2=Clinical, 3=Claims, 4=Surveys. */
|
|
370
|
+
class_type: number;
|
|
371
|
+
/** Definition text, or `null`. */
|
|
372
|
+
definition: string | null;
|
|
373
|
+
/** Order, Observation, or Both. */
|
|
374
|
+
order_obs: string;
|
|
375
|
+
/** Synonym terms. */
|
|
376
|
+
related_names: string[];
|
|
377
|
+
/** Popularity rank. */
|
|
378
|
+
common_test_rank: number;
|
|
379
|
+
/** Order popularity rank. */
|
|
380
|
+
common_order_rank: number;
|
|
381
|
+
/** Cross-reference IDs: `"snomed"` (concept IDs), `"umls"` (CUIs). */
|
|
382
|
+
cross_references: Record<string, string[]>;
|
|
383
|
+
}
|
|
384
|
+
interface LOINCSearchResponse {
|
|
385
|
+
/** The search query that was used. */
|
|
386
|
+
query: string;
|
|
387
|
+
/** Number of results returned. */
|
|
388
|
+
count: number;
|
|
389
|
+
/** Matching LOINC codes. */
|
|
390
|
+
codes: LOINCCodeSummary[];
|
|
391
|
+
}
|
|
392
|
+
/** A single LOINC code match from the coding endpoint. */
|
|
393
|
+
interface LOINCCodeResult {
|
|
394
|
+
code: string;
|
|
395
|
+
long_common_name: string;
|
|
396
|
+
component: string;
|
|
397
|
+
system: string;
|
|
398
|
+
similarity: number;
|
|
399
|
+
confidence: "high" | "moderate";
|
|
400
|
+
matched_term: string;
|
|
401
|
+
snomed_ids: string[];
|
|
402
|
+
umls_cuis: string[];
|
|
403
|
+
}
|
|
404
|
+
/** LOINC coding results for a single extracted entity. */
|
|
405
|
+
interface LOINCCodingEntity {
|
|
406
|
+
entity_text: string;
|
|
407
|
+
codes: LOINCCodeResult[];
|
|
408
|
+
}
|
|
409
|
+
/** Full LOINC coding response. */
|
|
410
|
+
interface LOINCCodingResponse {
|
|
411
|
+
text: string;
|
|
412
|
+
provider: string;
|
|
413
|
+
entity_count: number;
|
|
414
|
+
results: LOINCCodingEntity[];
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Audit capability selector. Defaults to all five when omitted.
|
|
418
|
+
*
|
|
419
|
+
* - `hcc`: missed HCC codes with RAF-weighted revenue estimates (v22/v28)
|
|
420
|
+
* - `radv`: submitted codes that cannot be defended against RADV clawback
|
|
421
|
+
* - `specificity`: suggestions to upgrade unspecified codes to more precise children
|
|
422
|
+
* - `denial`: documentation-quality flags that correlate with claim denials
|
|
423
|
+
* - `problem_list`: reconciled active-conditions list across the documentation
|
|
424
|
+
*/
|
|
425
|
+
type AuditCapability = "hcc" | "radv" | "specificity" | "denial" | "problem_list";
|
|
426
|
+
interface AuditDocument {
|
|
427
|
+
id: string;
|
|
428
|
+
text: string;
|
|
429
|
+
type?: "progress_note" | "discharge_summary" | "h_and_p" | "operative_note" | "consult" | "other";
|
|
430
|
+
date?: string;
|
|
431
|
+
}
|
|
432
|
+
interface AuditCode {
|
|
433
|
+
code: string;
|
|
434
|
+
kind: "icd10" | "icd11" | "cpt" | "hcpcs";
|
|
435
|
+
}
|
|
436
|
+
interface AuditContext {
|
|
437
|
+
patient?: {
|
|
438
|
+
age?: number;
|
|
439
|
+
sex?: "male" | "female";
|
|
440
|
+
coverage?: "medicare_advantage" | "fee_for_service" | "medicaid" | "commercial" | "aco";
|
|
441
|
+
};
|
|
442
|
+
claim?: {
|
|
443
|
+
date_of_service?: string;
|
|
444
|
+
place_of_service?: string;
|
|
445
|
+
provider_type?: string;
|
|
446
|
+
};
|
|
447
|
+
payer?: {
|
|
448
|
+
id?: string;
|
|
449
|
+
type?: string;
|
|
450
|
+
};
|
|
451
|
+
rates?: {
|
|
452
|
+
cms_base_rate?: number;
|
|
453
|
+
hospital_base_rate?: number;
|
|
454
|
+
denial_rework_cost?: number;
|
|
455
|
+
};
|
|
456
|
+
/** Defaults to `"both"`. `"v24"` is ESRD-specific and NOT accepted; PY2026 MA payment uses v22 + v28. */
|
|
457
|
+
hcc_model?: "v22" | "v28" | "both";
|
|
458
|
+
}
|
|
459
|
+
interface AuditRequest {
|
|
460
|
+
text?: string;
|
|
461
|
+
documents?: AuditDocument[];
|
|
462
|
+
codes?: AuditCode[];
|
|
463
|
+
capabilities?: AuditCapability[];
|
|
464
|
+
context?: AuditContext;
|
|
465
|
+
}
|
|
466
|
+
interface EvidenceSpan {
|
|
467
|
+
document_id: string;
|
|
468
|
+
start: number;
|
|
469
|
+
end: number;
|
|
470
|
+
quote: string;
|
|
471
|
+
}
|
|
472
|
+
interface ConfirmedCode {
|
|
473
|
+
code: string;
|
|
474
|
+
kind: string;
|
|
475
|
+
description: string;
|
|
476
|
+
evidence: EvidenceSpan[];
|
|
477
|
+
confidence: number;
|
|
478
|
+
hcc_category?: string;
|
|
479
|
+
raf_weight?: number;
|
|
480
|
+
}
|
|
481
|
+
interface MissedCode {
|
|
482
|
+
code: string;
|
|
483
|
+
kind: string;
|
|
484
|
+
description: string;
|
|
485
|
+
evidence: EvidenceSpan[];
|
|
486
|
+
confidence: number;
|
|
487
|
+
hcc_category?: string;
|
|
488
|
+
raf_weight?: number;
|
|
489
|
+
estimated_revenue?: number;
|
|
490
|
+
hcc_model?: "v22" | "v28";
|
|
491
|
+
}
|
|
492
|
+
interface UnsupportedCode {
|
|
493
|
+
code: string;
|
|
494
|
+
kind: string;
|
|
495
|
+
description: string;
|
|
496
|
+
reason: string;
|
|
497
|
+
what_would_support_it: string;
|
|
498
|
+
radv_risk: "high" | "moderate" | "low";
|
|
499
|
+
estimated_exposure?: number;
|
|
500
|
+
}
|
|
501
|
+
interface SpecificityUpgrade {
|
|
502
|
+
from_code: string;
|
|
503
|
+
to_code: string;
|
|
504
|
+
from_description: string;
|
|
505
|
+
to_description: string;
|
|
506
|
+
evidence: EvidenceSpan[];
|
|
507
|
+
mcc_cc_change?: {
|
|
508
|
+
from: "none" | "cc" | "mcc";
|
|
509
|
+
to: "none" | "cc" | "mcc";
|
|
510
|
+
};
|
|
511
|
+
drg_impact?: number;
|
|
512
|
+
}
|
|
513
|
+
interface DenialRisk {
|
|
514
|
+
code: string;
|
|
515
|
+
kind: string;
|
|
516
|
+
description: string;
|
|
517
|
+
risk: "high" | "moderate" | "low";
|
|
518
|
+
probability: number;
|
|
519
|
+
reasons: string[];
|
|
520
|
+
}
|
|
521
|
+
interface ProblemListEntry {
|
|
522
|
+
condition: string;
|
|
523
|
+
icd10_code: string;
|
|
524
|
+
status: "active" | "resolved" | "historical";
|
|
525
|
+
first_seen: {
|
|
526
|
+
document_id: string;
|
|
527
|
+
date?: string;
|
|
528
|
+
};
|
|
529
|
+
last_seen: {
|
|
530
|
+
document_id: string;
|
|
531
|
+
date?: string;
|
|
532
|
+
};
|
|
533
|
+
evidence: EvidenceSpan[];
|
|
534
|
+
}
|
|
535
|
+
interface AuditTotals {
|
|
536
|
+
missed_raf: number;
|
|
537
|
+
estimated_revenue_recovery: number;
|
|
538
|
+
radv_exposure: number;
|
|
539
|
+
drg_upside: number;
|
|
540
|
+
codes_confirmed: number;
|
|
541
|
+
codes_missed: number;
|
|
542
|
+
codes_unsupported: number;
|
|
543
|
+
upgrades_available: number;
|
|
544
|
+
}
|
|
545
|
+
interface RatesUsed {
|
|
546
|
+
cms_base_rate: number;
|
|
547
|
+
hospital_base_rate: number;
|
|
548
|
+
source: "cms_national_2026" | "customer_provided";
|
|
549
|
+
hcc_model: "v22" | "v28" | "both";
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* Present on the response when the server dropped one or more requested
|
|
553
|
+
* capabilities because the caller's plan did not include them.
|
|
554
|
+
*/
|
|
555
|
+
interface UpgradeHint {
|
|
556
|
+
denied_capabilities: AuditCapability[];
|
|
557
|
+
required_plan: string;
|
|
558
|
+
message: string;
|
|
559
|
+
}
|
|
560
|
+
interface AuditResponse {
|
|
561
|
+
capabilities_run: AuditCapability[];
|
|
562
|
+
confirmed: ConfirmedCode[];
|
|
563
|
+
missed: MissedCode[];
|
|
564
|
+
unsupported: UnsupportedCode[];
|
|
565
|
+
specificity_upgrades: SpecificityUpgrade[];
|
|
566
|
+
denial_risk: DenialRisk[];
|
|
567
|
+
problem_list?: ProblemListEntry[];
|
|
568
|
+
totals: AuditTotals;
|
|
569
|
+
provider: string;
|
|
570
|
+
rates_used: RatesUsed;
|
|
571
|
+
upgrade_hint?: UpgradeHint;
|
|
572
|
+
}
|
|
203
573
|
|
|
204
574
|
declare class AutoICD {
|
|
205
575
|
private readonly apiKey;
|
|
@@ -212,6 +582,10 @@ declare class AutoICD {
|
|
|
212
582
|
readonly icd10: ICD10Codes;
|
|
213
583
|
/** Sub-resource for ICD-11 code lookup. */
|
|
214
584
|
readonly icd11: ICD11Codes;
|
|
585
|
+
/** Sub-resource for ICF code lookup and coding. */
|
|
586
|
+
readonly icf: ICFCodes;
|
|
587
|
+
/** Sub-resource for LOINC code lookup and coding. */
|
|
588
|
+
readonly loinc: LOINCCodes;
|
|
215
589
|
constructor(options: AutoICDOptions);
|
|
216
590
|
/**
|
|
217
591
|
* Code clinical text to ICD-10-CM diagnoses.
|
|
@@ -236,6 +610,25 @@ declare class AutoICD {
|
|
|
236
610
|
* ```
|
|
237
611
|
*/
|
|
238
612
|
anonymize(text: string): Promise<AnonymizeResponse>;
|
|
613
|
+
/**
|
|
614
|
+
* Audit a chart for coding gaps, RADV risk, specificity, denial flags, and
|
|
615
|
+
* a reconciled problem list. Every finding carries extractive evidence spans.
|
|
616
|
+
*
|
|
617
|
+
* @example
|
|
618
|
+
* ```ts
|
|
619
|
+
* const audit = await autoicd.audit({
|
|
620
|
+
* text: "68yo M, type 2 diabetes, chronic systolic heart failure on furosemide.",
|
|
621
|
+
* codes: [{ code: "E11.9", kind: "icd10" }],
|
|
622
|
+
* capabilities: ["hcc", "radv", "specificity", "denial", "problem_list"],
|
|
623
|
+
* context: { patient: { coverage: "medicare_advantage" } },
|
|
624
|
+
* });
|
|
625
|
+
* console.log(audit.totals.estimated_revenue_recovery);
|
|
626
|
+
* for (const m of audit.missed) {
|
|
627
|
+
* console.log(`${m.code} ${m.hcc_category} $${m.estimated_revenue}`);
|
|
628
|
+
* }
|
|
629
|
+
* ```
|
|
630
|
+
*/
|
|
631
|
+
audit(request: AuditRequest): Promise<AuditResponse>;
|
|
239
632
|
/** @internal */
|
|
240
633
|
get<T>(path: string): Promise<T>;
|
|
241
634
|
/** @internal */
|
|
@@ -295,6 +688,100 @@ declare class ICD11Codes {
|
|
|
295
688
|
*/
|
|
296
689
|
get(code: string): Promise<ICD11CodeDetailFull>;
|
|
297
690
|
}
|
|
691
|
+
declare class ICFCodes {
|
|
692
|
+
private readonly client;
|
|
693
|
+
constructor(client: AutoICD);
|
|
694
|
+
/**
|
|
695
|
+
* Code clinical text to ICF codes.
|
|
696
|
+
*
|
|
697
|
+
* @example
|
|
698
|
+
* ```ts
|
|
699
|
+
* const result = await autoicd.icf.code("Patient has difficulty walking");
|
|
700
|
+
* for (const entity of result.results) {
|
|
701
|
+
* console.log(entity.entity_text, entity.codes[0]?.code);
|
|
702
|
+
* }
|
|
703
|
+
* ```
|
|
704
|
+
*/
|
|
705
|
+
code(text: string, options?: {
|
|
706
|
+
topK?: number;
|
|
707
|
+
}): Promise<ICFCodingResponse>;
|
|
708
|
+
/**
|
|
709
|
+
* Get full details for a single ICF code, including definition,
|
|
710
|
+
* hierarchy (parent/children), inclusions, exclusions, and index terms.
|
|
711
|
+
*
|
|
712
|
+
* @example
|
|
713
|
+
* ```ts
|
|
714
|
+
* const detail = await autoicd.icf.lookup("b280");
|
|
715
|
+
* console.log(detail.title);
|
|
716
|
+
* console.log(detail.definition);
|
|
717
|
+
* console.log(detail.children.length);
|
|
718
|
+
* ```
|
|
719
|
+
*/
|
|
720
|
+
lookup(code: string): Promise<ICFCodeDetail>;
|
|
721
|
+
/**
|
|
722
|
+
* Search ICF codes by description.
|
|
723
|
+
*
|
|
724
|
+
* @example
|
|
725
|
+
* ```ts
|
|
726
|
+
* const results = await autoicd.icf.search("pain");
|
|
727
|
+
* ```
|
|
728
|
+
*/
|
|
729
|
+
search(query: string, options?: SearchOptions): Promise<ICFSearchResponse>;
|
|
730
|
+
/**
|
|
731
|
+
* Get the ICF Core Set for an ICD-10 diagnosis code.
|
|
732
|
+
*
|
|
733
|
+
* @example
|
|
734
|
+
* ```ts
|
|
735
|
+
* const coreSet = await autoicd.icf.coreSet("M54.5");
|
|
736
|
+
* console.log(coreSet.condition_name);
|
|
737
|
+
* console.log(coreSet.brief.length, "brief codes");
|
|
738
|
+
* console.log(coreSet.comprehensive.length, "comprehensive codes");
|
|
739
|
+
* ```
|
|
740
|
+
*/
|
|
741
|
+
coreSet(icd10Code: string): Promise<ICFCoreSetResult>;
|
|
742
|
+
}
|
|
743
|
+
declare class LOINCCodes {
|
|
744
|
+
private readonly client;
|
|
745
|
+
constructor(client: AutoICD);
|
|
746
|
+
/**
|
|
747
|
+
* Code clinical text to LOINC codes.
|
|
748
|
+
*
|
|
749
|
+
* Extracts lab tests, imaging orders, and clinical observations from
|
|
750
|
+
* free text and matches to LOINC codes using NER + SapBERT embeddings.
|
|
751
|
+
*
|
|
752
|
+
* @example
|
|
753
|
+
* ```ts
|
|
754
|
+
* const result = await autoicd.loinc.code("Order CBC, glucose, and TSH");
|
|
755
|
+
* for (const entity of result.results) {
|
|
756
|
+
* console.log(entity.entity_text, entity.codes[0]?.code);
|
|
757
|
+
* }
|
|
758
|
+
* ```
|
|
759
|
+
*/
|
|
760
|
+
code(text: string, options?: {
|
|
761
|
+
topK?: number;
|
|
762
|
+
}): Promise<LOINCCodingResponse>;
|
|
763
|
+
/**
|
|
764
|
+
* Get full details for a single LOINC code, including 6-axis classification,
|
|
765
|
+
* definition, related names, and cross-references.
|
|
766
|
+
*
|
|
767
|
+
* @example
|
|
768
|
+
* ```ts
|
|
769
|
+
* const detail = await autoicd.loinc.lookup("2345-7");
|
|
770
|
+
* console.log(detail.long_common_name);
|
|
771
|
+
* console.log(detail.component, detail.system);
|
|
772
|
+
* ```
|
|
773
|
+
*/
|
|
774
|
+
lookup(code: string): Promise<LOINCCodeDetail>;
|
|
775
|
+
/**
|
|
776
|
+
* Search LOINC codes by description.
|
|
777
|
+
*
|
|
778
|
+
* @example
|
|
779
|
+
* ```ts
|
|
780
|
+
* const results = await autoicd.loinc.search("glucose");
|
|
781
|
+
* ```
|
|
782
|
+
*/
|
|
783
|
+
search(query: string, options?: SearchOptions): Promise<LOINCSearchResponse>;
|
|
784
|
+
}
|
|
298
785
|
|
|
299
786
|
declare class AutoICDError extends Error {
|
|
300
787
|
readonly status: number;
|
|
@@ -311,4 +798,4 @@ declare class NotFoundError extends AutoICDError {
|
|
|
311
798
|
constructor(message?: string);
|
|
312
799
|
}
|
|
313
800
|
|
|
314
|
-
export { type AnonymizeResponse, AuthenticationError, AutoICD, AutoICDError, type AutoICDOptions, type ChapterInfo, type CodeDetail, type CodeDetailFull, type CodeMatch, type CodeOptions, type CodeSearchResponse, type CodingEntity, type CodingResponse, type CrosswalkMapping, type ICD11ChapterInfo, type ICD11CodeDetail, type ICD11CodeDetailFull, type ICD11CodeSearchResponse, type ICD11CodeSearchResult, NotFoundError, type PIIEntity, type RateLimit, RateLimitError, type SearchOptions };
|
|
801
|
+
export { type AnonymizeResponse, type AuditCapability, type AuditCode, type AuditContext, type AuditDocument, type AuditRequest, type AuditResponse, type AuditTotals, AuthenticationError, AutoICD, AutoICDError, type AutoICDOptions, type ChapterInfo, type CodeDetail, type CodeDetailFull, type CodeMatch, type CodeOptions, type CodeSearchResponse, type CodingEntity, type CodingResponse, type ConfirmedCode, type CrosswalkMapping, type DenialRisk, type EvidenceSpan, type ICD11ChapterInfo, type ICD11CodeDetail, type ICD11CodeDetailFull, type ICD11CodeSearchResponse, type ICD11CodeSearchResult, type ICFCodeDetail, type ICFCodeResult, type ICFCodeSummary, type ICFCodingEntity, type ICFCodingResponse, type ICFComponent, type ICFCoreSetResult, type ICFCrossReference, type ICFSearchResponse, type LOINCCodeDetail, type LOINCCodeResult, type LOINCCodeSummary, type LOINCCodingEntity, type LOINCCodingResponse, type LOINCSearchResponse, type MissedCode, NotFoundError, type PIIEntity, type ProblemListEntry, type RateLimit, RateLimitError, type RatesUsed, type SearchOptions, type SpecificityUpgrade, type UnsupportedCode, type UpgradeHint };
|