@fhirfly-io/terminology 0.10.0 → 0.11.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/dist/index.cjs CHANGED
@@ -1364,6 +1364,167 @@ var SmaEndpoint = class {
1364
1364
  }
1365
1365
  };
1366
1366
 
1367
+ // src/endpoints/hcc.ts
1368
+ var HccEndpoint = class {
1369
+ constructor(http) {
1370
+ this.http = http;
1371
+ }
1372
+ /**
1373
+ * Look up HCC mappings for a single ICD-10 code.
1374
+ *
1375
+ * Returns all HCC category mappings for the given diagnosis code.
1376
+ *
1377
+ * @param icd10Code - ICD-10-CM diagnosis code (e.g., "E11.9")
1378
+ * @param options - Response shape and include options
1379
+ * @returns HCC mapping data (may contain multiple mappings)
1380
+ *
1381
+ * @example
1382
+ * ```ts
1383
+ * const result = await client.hcc.lookup("E11.9");
1384
+ * console.log(result.data); // HCC mapping(s) for Type 2 diabetes
1385
+ * ```
1386
+ */
1387
+ async lookup(icd10Code, options) {
1388
+ return this.http.get(`/v1/hcc/${encodeURIComponent(icd10Code)}`, options);
1389
+ }
1390
+ /**
1391
+ * Look up HCC mappings for multiple ICD-10 codes in a single request.
1392
+ *
1393
+ * @param codes - Array of ICD-10-CM codes (max 100)
1394
+ * @param options - Response shape, include, and batch options
1395
+ * @returns Batch response with HCC mappings for each code
1396
+ */
1397
+ async lookupMany(codes, options) {
1398
+ if (codes.length === 0) throw new ValidationError("codes array must not be empty");
1399
+ if (codes.length > 100) throw new ValidationError(`HCC batch lookup supports max 100 codes, got ${codes.length}`);
1400
+ return this.http.post(
1401
+ "/v1/hcc/_batch",
1402
+ { codes },
1403
+ options
1404
+ );
1405
+ }
1406
+ /**
1407
+ * Reverse lookup: find ICD-10 codes that map to a given HCC category.
1408
+ *
1409
+ * @param ccNumber - HCC condition category number
1410
+ * @param options - Response shape, include, and model filter options
1411
+ * @returns Reverse lookup result with array of ICD-10 codes
1412
+ *
1413
+ * @example
1414
+ * ```ts
1415
+ * // Find all ICD-10 codes that map to HCC 19 (Diabetes)
1416
+ * const result = await client.hcc.reverse(19);
1417
+ * console.log(result.data.icd10_codes);
1418
+ *
1419
+ * // Filter by model
1420
+ * const result = await client.hcc.reverse(19, { model: "CMS-HCC" });
1421
+ * ```
1422
+ */
1423
+ async reverse(ccNumber, options) {
1424
+ const { model, ...lookupOptions } = options ?? {};
1425
+ const endpoint = `/v1/hcc/reverse/${encodeURIComponent(String(ccNumber))}`;
1426
+ if (model) {
1427
+ return this.http.search(endpoint, {
1428
+ model,
1429
+ shape: lookupOptions.shape,
1430
+ include: lookupOptions.include?.join(",")
1431
+ });
1432
+ }
1433
+ return this.http.get(endpoint, lookupOptions);
1434
+ }
1435
+ /**
1436
+ * Search for HCC crosswalk mappings.
1437
+ *
1438
+ * @param params - Search parameters (q, model_version, model_type, cc_number, payment_year)
1439
+ * @param options - Pagination and response shape options
1440
+ * @returns Search results with facets
1441
+ *
1442
+ * @example
1443
+ * ```ts
1444
+ * // Search by ICD-10 code text
1445
+ * const results = await client.hcc.search({ q: "diabetes" });
1446
+ *
1447
+ * // Filter by model version
1448
+ * const results = await client.hcc.search({
1449
+ * model_version: "V28",
1450
+ * cc_number: 19
1451
+ * });
1452
+ * ```
1453
+ */
1454
+ async search(params, options) {
1455
+ return this.http.search("/v1/hcc/search", {
1456
+ ...params,
1457
+ ...options,
1458
+ include: options?.include?.join(",")
1459
+ });
1460
+ }
1461
+ };
1462
+
1463
+ // src/endpoints/opcs4.ts
1464
+ var Opcs4Endpoint = class {
1465
+ constructor(http) {
1466
+ this.http = http;
1467
+ }
1468
+ /**
1469
+ * Look up a single OPCS-4 procedure code.
1470
+ *
1471
+ * @param code - OPCS-4 procedure code (e.g., "W37.1")
1472
+ * @param options - Response shape and include options
1473
+ * @returns OPCS-4 data
1474
+ *
1475
+ * @example
1476
+ * ```ts
1477
+ * const result = await client.opcs4.lookup("W37.1");
1478
+ * console.log(result.data.display); // Procedure description
1479
+ * ```
1480
+ */
1481
+ async lookup(code, options) {
1482
+ return this.http.get(`/v1/opcs4/${encodeURIComponent(code)}`, options);
1483
+ }
1484
+ /**
1485
+ * Look up multiple OPCS-4 codes in a single request.
1486
+ *
1487
+ * @param codes - Array of OPCS-4 codes (max 100)
1488
+ * @param options - Response shape, include, and batch options
1489
+ * @returns Batch response with results for each code
1490
+ */
1491
+ async lookupMany(codes, options) {
1492
+ if (codes.length === 0) throw new ValidationError("codes array must not be empty");
1493
+ if (codes.length > 100) throw new ValidationError(`OPCS-4 batch lookup supports max 100 codes, got ${codes.length}`);
1494
+ return this.http.post(
1495
+ "/v1/opcs4/_batch",
1496
+ { codes },
1497
+ options
1498
+ );
1499
+ }
1500
+ /**
1501
+ * Search for OPCS-4 procedure codes.
1502
+ *
1503
+ * @param params - Search parameters (q, chapter, category)
1504
+ * @param options - Pagination and response shape options
1505
+ * @returns Search results with facets
1506
+ *
1507
+ * @example
1508
+ * ```ts
1509
+ * // Search for knee procedures
1510
+ * const results = await client.opcs4.search({ q: "knee replacement" });
1511
+ *
1512
+ * // Filter by chapter
1513
+ * const results = await client.opcs4.search({
1514
+ * chapter: "W",
1515
+ * q: "joint"
1516
+ * });
1517
+ * ```
1518
+ */
1519
+ async search(params, options) {
1520
+ return this.http.search("/v1/opcs4/search", {
1521
+ ...params,
1522
+ ...options,
1523
+ include: options?.include?.join(",")
1524
+ });
1525
+ }
1526
+ };
1527
+
1367
1528
  // src/client.ts
1368
1529
  var Fhirfly = class {
1369
1530
  http;
@@ -1419,6 +1580,16 @@ var Fhirfly = class {
1419
1580
  * State FHIR endpoint implementation status, patient access, and provider directories.
1420
1581
  */
1421
1582
  sma;
1583
+ /**
1584
+ * HCC (Hierarchical Condition Categories) crosswalk lookups.
1585
+ * Map ICD-10 diagnosis codes to CMS risk adjustment categories.
1586
+ */
1587
+ hcc;
1588
+ /**
1589
+ * OPCS-4 (Office of Population Censuses and Surveys) procedure code lookups.
1590
+ * UK NHS procedural coding system.
1591
+ */
1592
+ opcs4;
1422
1593
  /**
1423
1594
  * Create a new FHIRfly client.
1424
1595
  *
@@ -1468,6 +1639,8 @@ var Fhirfly = class {
1468
1639
  this.snomed = new SnomedEndpoint(this.http);
1469
1640
  this.claims = new ClaimsEndpoint(this.http);
1470
1641
  this.sma = new SmaEndpoint(this.http);
1642
+ this.hcc = new HccEndpoint(this.http);
1643
+ this.opcs4 = new Opcs4Endpoint(this.http);
1471
1644
  }
1472
1645
  };
1473
1646
 
@@ -1475,8 +1648,10 @@ exports.ApiError = ApiError;
1475
1648
  exports.AuthenticationError = AuthenticationError;
1476
1649
  exports.Fhirfly = Fhirfly;
1477
1650
  exports.FhirflyError = FhirflyError;
1651
+ exports.HccEndpoint = HccEndpoint;
1478
1652
  exports.NetworkError = NetworkError;
1479
1653
  exports.NotFoundError = NotFoundError;
1654
+ exports.Opcs4Endpoint = Opcs4Endpoint;
1480
1655
  exports.QuotaExceededError = QuotaExceededError;
1481
1656
  exports.RateLimitError = RateLimitError;
1482
1657
  exports.ServerError = ServerError;