autoicd-js 0.6.0 → 0.8.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 +118 -2
- package/dist/index.d.mts +537 -3
- package/dist/index.d.ts +537 -3
- package/dist/index.js +170 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +170 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -3
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,376 @@ 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
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Healthcare coding systems supported by `/v1/translate`.
|
|
575
|
+
* Current reachable mappings (forward):
|
|
576
|
+
* - `icd10` → `icd11` / `snomed` / `umls` / `icf`
|
|
577
|
+
* - `icd11` → `icd10`
|
|
578
|
+
* - `icf` → `icd10`
|
|
579
|
+
*/
|
|
580
|
+
type InteropSystem = "icd10" | "icd11" | "snomed" | "umls" | "icf";
|
|
581
|
+
interface TranslateRequest {
|
|
582
|
+
from: {
|
|
583
|
+
code: string;
|
|
584
|
+
system: InteropSystem;
|
|
585
|
+
};
|
|
586
|
+
to?: InteropSystem[];
|
|
587
|
+
}
|
|
588
|
+
interface TranslateMapping {
|
|
589
|
+
code: string;
|
|
590
|
+
description?: string;
|
|
591
|
+
mapping_type?: string;
|
|
592
|
+
component?: string;
|
|
593
|
+
}
|
|
594
|
+
interface TranslateSource {
|
|
595
|
+
code: string;
|
|
596
|
+
system: InteropSystem;
|
|
597
|
+
description?: string;
|
|
598
|
+
}
|
|
599
|
+
interface TranslateResponse {
|
|
600
|
+
from: TranslateSource;
|
|
601
|
+
mappings: Partial<Record<InteropSystem, TranslateMapping[]>>;
|
|
602
|
+
unsupported_targets: InteropSystem[];
|
|
603
|
+
provider: string;
|
|
604
|
+
}
|
|
203
605
|
|
|
204
606
|
declare class AutoICD {
|
|
205
607
|
private readonly apiKey;
|
|
@@ -212,6 +614,10 @@ declare class AutoICD {
|
|
|
212
614
|
readonly icd10: ICD10Codes;
|
|
213
615
|
/** Sub-resource for ICD-11 code lookup. */
|
|
214
616
|
readonly icd11: ICD11Codes;
|
|
617
|
+
/** Sub-resource for ICF code lookup and coding. */
|
|
618
|
+
readonly icf: ICFCodes;
|
|
619
|
+
/** Sub-resource for LOINC code lookup and coding. */
|
|
620
|
+
readonly loinc: LOINCCodes;
|
|
215
621
|
constructor(options: AutoICDOptions);
|
|
216
622
|
/**
|
|
217
623
|
* Code clinical text to ICD-10-CM diagnoses.
|
|
@@ -236,6 +642,40 @@ declare class AutoICD {
|
|
|
236
642
|
* ```
|
|
237
643
|
*/
|
|
238
644
|
anonymize(text: string): Promise<AnonymizeResponse>;
|
|
645
|
+
/**
|
|
646
|
+
* Audit a chart for coding gaps, RADV risk, specificity, denial flags, and
|
|
647
|
+
* a reconciled problem list. Every finding carries extractive evidence spans.
|
|
648
|
+
*
|
|
649
|
+
* @example
|
|
650
|
+
* ```ts
|
|
651
|
+
* const audit = await autoicd.audit({
|
|
652
|
+
* text: "68yo M, type 2 diabetes, chronic systolic heart failure on furosemide.",
|
|
653
|
+
* codes: [{ code: "E11.9", kind: "icd10" }],
|
|
654
|
+
* capabilities: ["hcc", "radv", "specificity", "denial", "problem_list"],
|
|
655
|
+
* context: { patient: { coverage: "medicare_advantage" } },
|
|
656
|
+
* });
|
|
657
|
+
* console.log(audit.totals.estimated_revenue_recovery);
|
|
658
|
+
* for (const m of audit.missed) {
|
|
659
|
+
* console.log(`${m.code} ${m.hcc_category} $${m.estimated_revenue}`);
|
|
660
|
+
* }
|
|
661
|
+
* ```
|
|
662
|
+
*/
|
|
663
|
+
audit(request: AuditRequest): Promise<AuditResponse>;
|
|
664
|
+
/**
|
|
665
|
+
* Translate a code between healthcare coding systems. Maps a source code
|
|
666
|
+
* (ICD-10, ICD-11, SNOMED, UMLS, ICF) to equivalents in requested target
|
|
667
|
+
* systems. Omit `to` to get every system reachable from the source.
|
|
668
|
+
*
|
|
669
|
+
* @example
|
|
670
|
+
* ```ts
|
|
671
|
+
* const result = await autoicd.translate({
|
|
672
|
+
* from: { code: "E11.9", system: "icd10" },
|
|
673
|
+
* });
|
|
674
|
+
* console.log(result.mappings.icd11);
|
|
675
|
+
* console.log(result.mappings.snomed);
|
|
676
|
+
* ```
|
|
677
|
+
*/
|
|
678
|
+
translate(request: TranslateRequest): Promise<TranslateResponse>;
|
|
239
679
|
/** @internal */
|
|
240
680
|
get<T>(path: string): Promise<T>;
|
|
241
681
|
/** @internal */
|
|
@@ -295,6 +735,100 @@ declare class ICD11Codes {
|
|
|
295
735
|
*/
|
|
296
736
|
get(code: string): Promise<ICD11CodeDetailFull>;
|
|
297
737
|
}
|
|
738
|
+
declare class ICFCodes {
|
|
739
|
+
private readonly client;
|
|
740
|
+
constructor(client: AutoICD);
|
|
741
|
+
/**
|
|
742
|
+
* Code clinical text to ICF codes.
|
|
743
|
+
*
|
|
744
|
+
* @example
|
|
745
|
+
* ```ts
|
|
746
|
+
* const result = await autoicd.icf.code("Patient has difficulty walking");
|
|
747
|
+
* for (const entity of result.results) {
|
|
748
|
+
* console.log(entity.entity_text, entity.codes[0]?.code);
|
|
749
|
+
* }
|
|
750
|
+
* ```
|
|
751
|
+
*/
|
|
752
|
+
code(text: string, options?: {
|
|
753
|
+
topK?: number;
|
|
754
|
+
}): Promise<ICFCodingResponse>;
|
|
755
|
+
/**
|
|
756
|
+
* Get full details for a single ICF code, including definition,
|
|
757
|
+
* hierarchy (parent/children), inclusions, exclusions, and index terms.
|
|
758
|
+
*
|
|
759
|
+
* @example
|
|
760
|
+
* ```ts
|
|
761
|
+
* const detail = await autoicd.icf.lookup("b280");
|
|
762
|
+
* console.log(detail.title);
|
|
763
|
+
* console.log(detail.definition);
|
|
764
|
+
* console.log(detail.children.length);
|
|
765
|
+
* ```
|
|
766
|
+
*/
|
|
767
|
+
lookup(code: string): Promise<ICFCodeDetail>;
|
|
768
|
+
/**
|
|
769
|
+
* Search ICF codes by description.
|
|
770
|
+
*
|
|
771
|
+
* @example
|
|
772
|
+
* ```ts
|
|
773
|
+
* const results = await autoicd.icf.search("pain");
|
|
774
|
+
* ```
|
|
775
|
+
*/
|
|
776
|
+
search(query: string, options?: SearchOptions): Promise<ICFSearchResponse>;
|
|
777
|
+
/**
|
|
778
|
+
* Get the ICF Core Set for an ICD-10 diagnosis code.
|
|
779
|
+
*
|
|
780
|
+
* @example
|
|
781
|
+
* ```ts
|
|
782
|
+
* const coreSet = await autoicd.icf.coreSet("M54.5");
|
|
783
|
+
* console.log(coreSet.condition_name);
|
|
784
|
+
* console.log(coreSet.brief.length, "brief codes");
|
|
785
|
+
* console.log(coreSet.comprehensive.length, "comprehensive codes");
|
|
786
|
+
* ```
|
|
787
|
+
*/
|
|
788
|
+
coreSet(icd10Code: string): Promise<ICFCoreSetResult>;
|
|
789
|
+
}
|
|
790
|
+
declare class LOINCCodes {
|
|
791
|
+
private readonly client;
|
|
792
|
+
constructor(client: AutoICD);
|
|
793
|
+
/**
|
|
794
|
+
* Code clinical text to LOINC codes.
|
|
795
|
+
*
|
|
796
|
+
* Extracts lab tests, imaging orders, and clinical observations from
|
|
797
|
+
* free text and matches to LOINC codes using NER + SapBERT embeddings.
|
|
798
|
+
*
|
|
799
|
+
* @example
|
|
800
|
+
* ```ts
|
|
801
|
+
* const result = await autoicd.loinc.code("Order CBC, glucose, and TSH");
|
|
802
|
+
* for (const entity of result.results) {
|
|
803
|
+
* console.log(entity.entity_text, entity.codes[0]?.code);
|
|
804
|
+
* }
|
|
805
|
+
* ```
|
|
806
|
+
*/
|
|
807
|
+
code(text: string, options?: {
|
|
808
|
+
topK?: number;
|
|
809
|
+
}): Promise<LOINCCodingResponse>;
|
|
810
|
+
/**
|
|
811
|
+
* Get full details for a single LOINC code, including 6-axis classification,
|
|
812
|
+
* definition, related names, and cross-references.
|
|
813
|
+
*
|
|
814
|
+
* @example
|
|
815
|
+
* ```ts
|
|
816
|
+
* const detail = await autoicd.loinc.lookup("2345-7");
|
|
817
|
+
* console.log(detail.long_common_name);
|
|
818
|
+
* console.log(detail.component, detail.system);
|
|
819
|
+
* ```
|
|
820
|
+
*/
|
|
821
|
+
lookup(code: string): Promise<LOINCCodeDetail>;
|
|
822
|
+
/**
|
|
823
|
+
* Search LOINC codes by description.
|
|
824
|
+
*
|
|
825
|
+
* @example
|
|
826
|
+
* ```ts
|
|
827
|
+
* const results = await autoicd.loinc.search("glucose");
|
|
828
|
+
* ```
|
|
829
|
+
*/
|
|
830
|
+
search(query: string, options?: SearchOptions): Promise<LOINCSearchResponse>;
|
|
831
|
+
}
|
|
298
832
|
|
|
299
833
|
declare class AutoICDError extends Error {
|
|
300
834
|
readonly status: number;
|
|
@@ -311,4 +845,4 @@ declare class NotFoundError extends AutoICDError {
|
|
|
311
845
|
constructor(message?: string);
|
|
312
846
|
}
|
|
313
847
|
|
|
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 };
|
|
848
|
+
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 InteropSystem, 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 TranslateMapping, type TranslateRequest, type TranslateResponse, type TranslateSource, type UnsupportedCode, type UpgradeHint };
|