@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.d.ts CHANGED
@@ -27,6 +27,28 @@ interface LegalInfo {
27
27
  attribution?: string;
28
28
  source_url?: string;
29
29
  }
30
+ /**
31
+ * Provenance information included in full-shape responses.
32
+ * Describes the upstream data source, version, and when FHIRfly last ingested it.
33
+ */
34
+ interface SourceInfo {
35
+ /** Name of the data source (e.g., "FDA NDC Directory", "CMS NPPES") */
36
+ name: string;
37
+ /** URL of the authoritative source */
38
+ url?: string;
39
+ /** Version or release identifier of the source data */
40
+ version?: string;
41
+ /** ISO 8601 timestamp of when FHIRfly last ingested this data */
42
+ fhirfly_updated_at?: string;
43
+ /** Version of the FHIRfly ETL pipeline that processed this data */
44
+ fhirfly_etl_version?: string;
45
+ /** Component data sources (used when a dataset combines multiple sources, e.g., NPI = NPPES + NUCC) */
46
+ components?: Array<{
47
+ name: string;
48
+ version: string;
49
+ url?: string;
50
+ }>;
51
+ }
30
52
  /**
31
53
  * Metadata included in all API responses.
32
54
  */
@@ -66,6 +88,8 @@ interface BatchResponse<T> {
66
88
  /** Response metadata */
67
89
  meta: {
68
90
  legal: LegalInfo;
91
+ /** Provenance information. Included when shape=full. */
92
+ source?: SourceInfo;
69
93
  };
70
94
  }
71
95
  /**
@@ -1090,11 +1114,17 @@ interface Icd10Standard extends Icd10Compact {
1090
1114
  root_operation?: string;
1091
1115
  /** SNOMED CT mappings (ICD-10-CM only, added by enrichment) */
1092
1116
  snomed?: SnomedEnrichmentStandard[];
1117
+ /** HCC crosswalk mappings (ICD-10-CM only, added by enrichment) */
1118
+ hcc?: Array<{
1119
+ cc_number: number;
1120
+ model_version: string;
1121
+ model_type: string;
1122
+ }>;
1093
1123
  }
1094
1124
  /**
1095
1125
  * ICD-10 lookup result - full shape.
1096
1126
  */
1097
- interface Icd10Full extends Omit<Icd10Standard, "snomed"> {
1127
+ interface Icd10Full extends Omit<Icd10Standard, "snomed" | "hcc"> {
1098
1128
  /** ICD-10-CM specific */
1099
1129
  includes?: string[];
1100
1130
  excludes1?: string[];
@@ -1110,6 +1140,14 @@ interface Icd10Full extends Omit<Icd10Standard, "snomed"> {
1110
1140
  end_date?: string;
1111
1141
  /** SNOMED CT mappings with FHIR coding (ICD-10-CM only, added by enrichment) */
1112
1142
  snomed?: SnomedEnrichmentFull[];
1143
+ /** HCC crosswalk mappings with payment details (ICD-10-CM only, added by enrichment) */
1144
+ hcc?: Array<{
1145
+ cc_number: number;
1146
+ model_version: string;
1147
+ model_type: string;
1148
+ payment_year: string;
1149
+ release_type: string;
1150
+ }>;
1113
1151
  }
1114
1152
  /**
1115
1153
  * ICD-10 response type based on shape.
@@ -2530,6 +2568,302 @@ declare class SmaEndpoint {
2530
2568
  stats(): Promise<SmaStatsResponse>;
2531
2569
  }
2532
2570
 
2571
+ /**
2572
+ * FHIR coding representation for HCC.
2573
+ */
2574
+ interface HccFhirCoding {
2575
+ system: string;
2576
+ code: string;
2577
+ display?: string;
2578
+ }
2579
+ /**
2580
+ * ETL ingest tracking metadata for HCC.
2581
+ */
2582
+ interface HccIngest {
2583
+ source: string;
2584
+ file_tag: string;
2585
+ etl_version: string;
2586
+ run_id: string;
2587
+ first_seen: string;
2588
+ last_seen: string;
2589
+ is_current: boolean;
2590
+ }
2591
+ /**
2592
+ * HCC crosswalk lookup result - compact shape.
2593
+ * Minimal data for lists, autocomplete.
2594
+ */
2595
+ interface HccCompact {
2596
+ icd10_code: string;
2597
+ cc_number: number;
2598
+ model_version: string;
2599
+ model_type: string;
2600
+ }
2601
+ /**
2602
+ * HCC crosswalk lookup result - standard shape.
2603
+ * Core structured data for most API integrations.
2604
+ */
2605
+ interface HccStandard extends HccCompact {
2606
+ payment_year: string;
2607
+ release_type: string;
2608
+ mapping_source: string;
2609
+ fhir_coding: HccFhirCoding;
2610
+ }
2611
+ /**
2612
+ * HCC crosswalk lookup result - full shape.
2613
+ * Complete data with provenance for AI agents.
2614
+ */
2615
+ interface HccFull extends HccStandard {
2616
+ ingest: HccIngest;
2617
+ }
2618
+ /**
2619
+ * HCC response type based on shape.
2620
+ */
2621
+ type HccData = HccCompact | HccStandard | HccFull;
2622
+ /**
2623
+ * HCC reverse lookup result.
2624
+ * Returns ICD-10 codes that map to a given HCC category.
2625
+ */
2626
+ interface HccReverseResult {
2627
+ cc_number: number;
2628
+ model_version: string;
2629
+ model_type: string;
2630
+ icd10_codes: string[];
2631
+ }
2632
+ /**
2633
+ * HCC search parameters.
2634
+ */
2635
+ interface HccSearchParams {
2636
+ /** General text search */
2637
+ q?: string;
2638
+ /** Filter by model version (e.g., "V28", "V24") */
2639
+ model_version?: string;
2640
+ /** Filter by model type (e.g., "CMS-HCC", "RxHCC") */
2641
+ model_type?: string;
2642
+ /** Filter by condition category number */
2643
+ cc_number?: number;
2644
+ /** Filter by payment year */
2645
+ payment_year?: string;
2646
+ /** Sort order: "relevance", "cc_number", "icd10_code" */
2647
+ sort?: "relevance" | "cc_number" | "icd10_code";
2648
+ }
2649
+
2650
+ /**
2651
+ * Options for HCC reverse lookups.
2652
+ */
2653
+ interface HccReverseLookupOptions extends LookupOptions {
2654
+ /** Filter by HCC model (e.g., "CMS-HCC", "RxHCC") */
2655
+ model?: string;
2656
+ }
2657
+ /**
2658
+ * HCC (Hierarchical Condition Categories) API endpoint.
2659
+ *
2660
+ * Provides access to HCC crosswalk data mapping ICD-10 diagnosis codes
2661
+ * to CMS risk adjustment condition categories.
2662
+ */
2663
+ declare class HccEndpoint {
2664
+ private readonly http;
2665
+ constructor(http: HttpClient);
2666
+ /**
2667
+ * Look up HCC mappings for a single ICD-10 code.
2668
+ *
2669
+ * Returns all HCC category mappings for the given diagnosis code.
2670
+ *
2671
+ * @param icd10Code - ICD-10-CM diagnosis code (e.g., "E11.9")
2672
+ * @param options - Response shape and include options
2673
+ * @returns HCC mapping data (may contain multiple mappings)
2674
+ *
2675
+ * @example
2676
+ * ```ts
2677
+ * const result = await client.hcc.lookup("E11.9");
2678
+ * console.log(result.data); // HCC mapping(s) for Type 2 diabetes
2679
+ * ```
2680
+ */
2681
+ lookup(icd10Code: string, options?: LookupOptions): Promise<ApiResponse<HccData[]>>;
2682
+ /**
2683
+ * Look up HCC mappings for multiple ICD-10 codes in a single request.
2684
+ *
2685
+ * @param codes - Array of ICD-10-CM codes (max 100)
2686
+ * @param options - Response shape, include, and batch options
2687
+ * @returns Batch response with HCC mappings for each code
2688
+ */
2689
+ lookupMany(codes: string[], options?: BatchLookupOptions): Promise<BatchResponse<HccData[]>>;
2690
+ /**
2691
+ * Reverse lookup: find ICD-10 codes that map to a given HCC category.
2692
+ *
2693
+ * @param ccNumber - HCC condition category number
2694
+ * @param options - Response shape, include, and model filter options
2695
+ * @returns Reverse lookup result with array of ICD-10 codes
2696
+ *
2697
+ * @example
2698
+ * ```ts
2699
+ * // Find all ICD-10 codes that map to HCC 19 (Diabetes)
2700
+ * const result = await client.hcc.reverse(19);
2701
+ * console.log(result.data.icd10_codes);
2702
+ *
2703
+ * // Filter by model
2704
+ * const result = await client.hcc.reverse(19, { model: "CMS-HCC" });
2705
+ * ```
2706
+ */
2707
+ reverse(ccNumber: number, options?: HccReverseLookupOptions): Promise<ApiResponse<HccReverseResult>>;
2708
+ /**
2709
+ * Search for HCC crosswalk mappings.
2710
+ *
2711
+ * @param params - Search parameters (q, model_version, model_type, cc_number, payment_year)
2712
+ * @param options - Pagination and response shape options
2713
+ * @returns Search results with facets
2714
+ *
2715
+ * @example
2716
+ * ```ts
2717
+ * // Search by ICD-10 code text
2718
+ * const results = await client.hcc.search({ q: "diabetes" });
2719
+ *
2720
+ * // Filter by model version
2721
+ * const results = await client.hcc.search({
2722
+ * model_version: "V28",
2723
+ * cc_number: 19
2724
+ * });
2725
+ * ```
2726
+ */
2727
+ search(params: HccSearchParams, options?: SearchOptions): Promise<SearchResponse<HccData>>;
2728
+ }
2729
+
2730
+ /**
2731
+ * FHIR coding representation for OPCS-4.
2732
+ */
2733
+ interface Opcs4FhirCoding {
2734
+ system: string;
2735
+ code: string;
2736
+ display?: string;
2737
+ }
2738
+ /**
2739
+ * OPCS-4 structural hierarchy information.
2740
+ */
2741
+ interface Opcs4Structure {
2742
+ chapter: {
2743
+ code: string;
2744
+ title: string;
2745
+ };
2746
+ category: string;
2747
+ }
2748
+ /**
2749
+ * Legal/licensing information for OPCS-4.
2750
+ */
2751
+ interface Opcs4Legal {
2752
+ license: string;
2753
+ copyright: string;
2754
+ attribution: string;
2755
+ }
2756
+ /**
2757
+ * ETL ingest tracking metadata for OPCS-4.
2758
+ */
2759
+ interface Opcs4Ingest {
2760
+ source: string;
2761
+ file_tag: string;
2762
+ etl_version: string;
2763
+ run_id: string;
2764
+ first_seen: string;
2765
+ last_seen: string;
2766
+ is_current: boolean;
2767
+ }
2768
+ /**
2769
+ * OPCS-4 procedure code lookup result - compact shape.
2770
+ * Minimal data for lists, autocomplete.
2771
+ */
2772
+ interface Opcs4Compact extends DisplayField {
2773
+ code: string;
2774
+ code_system: "OPCS-4";
2775
+ display: string;
2776
+ }
2777
+ /**
2778
+ * OPCS-4 procedure code lookup result - standard shape.
2779
+ * Core structured data for most API integrations.
2780
+ */
2781
+ interface Opcs4Standard extends Opcs4Compact {
2782
+ system: string;
2783
+ version: string;
2784
+ structure: Opcs4Structure;
2785
+ fhir_coding: Opcs4FhirCoding;
2786
+ effective_date: string;
2787
+ }
2788
+ /**
2789
+ * OPCS-4 procedure code lookup result - full shape.
2790
+ * Complete data with provenance for AI agents.
2791
+ */
2792
+ interface Opcs4Full extends Opcs4Standard {
2793
+ legal: Opcs4Legal;
2794
+ ingest: Opcs4Ingest;
2795
+ }
2796
+ /**
2797
+ * OPCS-4 response type based on shape.
2798
+ */
2799
+ type Opcs4Data = Opcs4Compact | Opcs4Standard | Opcs4Full;
2800
+ /**
2801
+ * OPCS-4 search parameters.
2802
+ */
2803
+ interface Opcs4SearchParams {
2804
+ /** General text search */
2805
+ q?: string;
2806
+ /** Filter by chapter code */
2807
+ chapter?: string;
2808
+ /** Filter by category */
2809
+ category?: string;
2810
+ /** Sort order: "relevance", "code", "display" */
2811
+ sort?: "relevance" | "code" | "display";
2812
+ }
2813
+
2814
+ /**
2815
+ * OPCS-4 (Office of Population Censuses and Surveys Classification of
2816
+ * Interventions and Procedures) API endpoint.
2817
+ *
2818
+ * Provides access to the UK's procedural coding system used by the NHS.
2819
+ */
2820
+ declare class Opcs4Endpoint {
2821
+ private readonly http;
2822
+ constructor(http: HttpClient);
2823
+ /**
2824
+ * Look up a single OPCS-4 procedure code.
2825
+ *
2826
+ * @param code - OPCS-4 procedure code (e.g., "W37.1")
2827
+ * @param options - Response shape and include options
2828
+ * @returns OPCS-4 data
2829
+ *
2830
+ * @example
2831
+ * ```ts
2832
+ * const result = await client.opcs4.lookup("W37.1");
2833
+ * console.log(result.data.display); // Procedure description
2834
+ * ```
2835
+ */
2836
+ lookup(code: string, options?: LookupOptions): Promise<ApiResponse<Opcs4Data>>;
2837
+ /**
2838
+ * Look up multiple OPCS-4 codes in a single request.
2839
+ *
2840
+ * @param codes - Array of OPCS-4 codes (max 100)
2841
+ * @param options - Response shape, include, and batch options
2842
+ * @returns Batch response with results for each code
2843
+ */
2844
+ lookupMany(codes: string[], options?: BatchLookupOptions): Promise<BatchResponse<Opcs4Data>>;
2845
+ /**
2846
+ * Search for OPCS-4 procedure codes.
2847
+ *
2848
+ * @param params - Search parameters (q, chapter, category)
2849
+ * @param options - Pagination and response shape options
2850
+ * @returns Search results with facets
2851
+ *
2852
+ * @example
2853
+ * ```ts
2854
+ * // Search for knee procedures
2855
+ * const results = await client.opcs4.search({ q: "knee replacement" });
2856
+ *
2857
+ * // Filter by chapter
2858
+ * const results = await client.opcs4.search({
2859
+ * chapter: "W",
2860
+ * q: "joint"
2861
+ * });
2862
+ * ```
2863
+ */
2864
+ search(params: Opcs4SearchParams, options?: SearchOptions): Promise<SearchResponse<Opcs4Data>>;
2865
+ }
2866
+
2533
2867
  /**
2534
2868
  * Base configuration options shared by all auth modes.
2535
2869
  */
@@ -2677,6 +3011,16 @@ declare class Fhirfly {
2677
3011
  * State FHIR endpoint implementation status, patient access, and provider directories.
2678
3012
  */
2679
3013
  readonly sma: SmaEndpoint;
3014
+ /**
3015
+ * HCC (Hierarchical Condition Categories) crosswalk lookups.
3016
+ * Map ICD-10 diagnosis codes to CMS risk adjustment categories.
3017
+ */
3018
+ readonly hcc: HccEndpoint;
3019
+ /**
3020
+ * OPCS-4 (Office of Population Censuses and Surveys) procedure code lookups.
3021
+ * UK NHS procedural coding system.
3022
+ */
3023
+ readonly opcs4: Opcs4Endpoint;
2680
3024
  /**
2681
3025
  * Create a new FHIRfly client.
2682
3026
  *
@@ -2762,4 +3106,4 @@ declare class TimeoutError extends FhirflyError {
2762
3106
  constructor(timeoutMs: number);
2763
3107
  }
2764
3108
 
2765
- export { type ActiveIngredient, ApiError, type ApiResponse, AuthenticationError, type AuthorizedOfficial, type BatchLookupOptions, type BatchResponse, type BatchResultItem, type ClaimsLegalInfo, type ClaimsMeta, type ConnectivityEndpointData, type ConnectivityMeta, type ConnectivityTargetData, type CoverageCheckData, type CoverageCheckItem, type CoverageCheckResponse, type CoveragePolicyType, type CvxCompact, type CvxData, type CvxFull, type CvxSearchParams, type CvxStandard, type Deactivation, type DisplayField, type EndpointAuthRequirements, type EndpointAvailability, type EnrichedTaxonomy, type EvidenceSummary, type FdaLabelBundleName, type FdaLabelData, type FdaLabelLookupOptions, type FdaLabelMetadata, type FdaLabelSearchCompact, type FdaLabelSearchData, type FdaLabelSearchFull, type FdaLabelSearchParams, type FdaLabelSearchStandard, type FhirMetadata, Fhirfly, type FhirflyApiKeyConfig, type FhirflyConfig, FhirflyError, type FhirflyOAuthConfig, type Icd10Compact, type Icd10Data, type Icd10Full, type Icd10SearchParams, type Icd10Standard, type Icd10Type, type IncludeOption, type IpsCategory, type LegalInfo, type LoincCompact, type LoincData, type LoincFhirCoding, type LoincFull, type LoincParts, type LoincRanks, type LoincSearchParams, type LoincSourceOrg, type LoincStandard, type LoincUnits, type LookupOptions, type MueBatchResponse, type MueBatchResultItem, type MueLimitItem, type MueLookupData, type MueLookupResponse, type MueServiceType, type MvxCompact, type MvxData, type MvxFhirCoding, type MvxFull, type MvxIngest, type MvxSearchParams, type MvxStandard, type NcciClaimType, type NcciEditItem, type NcciValidateData, type NcciValidateResponse, type NdcCompact, type NdcData, type NdcFull, type NdcSearchParams, type NdcStandard, type NdcType, NetworkError, NotFoundError, type NpiAddress, type NpiCompact, type NpiConnectivityData, type NpiData, type NpiFull, type NpiSearchParams, type NpiStandard, type OtherIdentifier, type PersonName, type PfsBatchResponse, type PfsBatchResultItem, type PfsIndicators, type PfsLookupData, type PfsLookupResponse, type PfsPayment, type PfsRvu, type ProviderSummary, QuotaExceededError, RateLimitError, type ResponseMeta, type ResponseShape, type RxNormCompact, type RxNormData, type RxNormFull, type RxNormSearchParams, type RxNormStandard, type RxTermType, type SearchFacets, type SearchLegalInfo, type SearchOptions, type SearchResponse, type SecondaryLocation, ServerError, type SmaListOptions, type SmaMetaResponse, type SmaStateDetailResponse, type SmaStateSummary, type SmaStatesListResponse, type SmaStatsResponse, type SnomedBatchResultItem, type SnomedCategoriesResponse, type SnomedConcept, type SnomedEnrichmentFull, type SnomedEnrichmentStandard, type SnomedMappingSource, type SnomedMappingSourceSystem, type SnomedMappingType, type SnomedReverseMapping, type SnomedReverseMappingData, type SnomedSearchParams, TimeoutError, TokenManager, ValidationError };
3109
+ export { type ActiveIngredient, ApiError, type ApiResponse, AuthenticationError, type AuthorizedOfficial, type BatchLookupOptions, type BatchResponse, type BatchResultItem, type ClaimsLegalInfo, type ClaimsMeta, type ConnectivityEndpointData, type ConnectivityMeta, type ConnectivityTargetData, type CoverageCheckData, type CoverageCheckItem, type CoverageCheckResponse, type CoveragePolicyType, type CvxCompact, type CvxData, type CvxFull, type CvxSearchParams, type CvxStandard, type Deactivation, type DisplayField, type EndpointAuthRequirements, type EndpointAvailability, type EnrichedTaxonomy, type EvidenceSummary, type FdaLabelBundleName, type FdaLabelData, type FdaLabelLookupOptions, type FdaLabelMetadata, type FdaLabelSearchCompact, type FdaLabelSearchData, type FdaLabelSearchFull, type FdaLabelSearchParams, type FdaLabelSearchStandard, type FhirMetadata, Fhirfly, type FhirflyApiKeyConfig, type FhirflyConfig, FhirflyError, type FhirflyOAuthConfig, type HccCompact, type HccData, HccEndpoint, type HccFhirCoding, type HccFull, type HccIngest, type HccReverseLookupOptions, type HccReverseResult, type HccSearchParams, type HccStandard, type Icd10Compact, type Icd10Data, type Icd10Full, type Icd10SearchParams, type Icd10Standard, type Icd10Type, type IncludeOption, type IpsCategory, type LegalInfo, type LoincCompact, type LoincData, type LoincFhirCoding, type LoincFull, type LoincParts, type LoincRanks, type LoincSearchParams, type LoincSourceOrg, type LoincStandard, type LoincUnits, type LookupOptions, type MueBatchResponse, type MueBatchResultItem, type MueLimitItem, type MueLookupData, type MueLookupResponse, type MueServiceType, type MvxCompact, type MvxData, type MvxFhirCoding, type MvxFull, type MvxIngest, type MvxSearchParams, type MvxStandard, type NcciClaimType, type NcciEditItem, type NcciValidateData, type NcciValidateResponse, type NdcCompact, type NdcData, type NdcFull, type NdcSearchParams, type NdcStandard, type NdcType, NetworkError, NotFoundError, type NpiAddress, type NpiCompact, type NpiConnectivityData, type NpiData, type NpiFull, type NpiSearchParams, type NpiStandard, type Opcs4Compact, type Opcs4Data, Opcs4Endpoint, type Opcs4FhirCoding, type Opcs4Full, type Opcs4Ingest, type Opcs4Legal, type Opcs4SearchParams, type Opcs4Standard, type Opcs4Structure, type OtherIdentifier, type PersonName, type PfsBatchResponse, type PfsBatchResultItem, type PfsIndicators, type PfsLookupData, type PfsLookupResponse, type PfsPayment, type PfsRvu, type ProviderSummary, QuotaExceededError, RateLimitError, type ResponseMeta, type ResponseShape, type RxNormCompact, type RxNormData, type RxNormFull, type RxNormSearchParams, type RxNormStandard, type RxTermType, type SearchFacets, type SearchLegalInfo, type SearchOptions, type SearchResponse, type SecondaryLocation, ServerError, type SmaListOptions, type SmaMetaResponse, type SmaStateDetailResponse, type SmaStateSummary, type SmaStatesListResponse, type SmaStatsResponse, type SnomedBatchResultItem, type SnomedCategoriesResponse, type SnomedConcept, type SnomedEnrichmentFull, type SnomedEnrichmentStandard, type SnomedMappingSource, type SnomedMappingSourceSystem, type SnomedMappingType, type SnomedReverseMapping, type SnomedReverseMappingData, type SnomedSearchParams, TimeoutError, TokenManager, ValidationError };
package/dist/index.js CHANGED
@@ -1362,6 +1362,167 @@ var SmaEndpoint = class {
1362
1362
  }
1363
1363
  };
1364
1364
 
1365
+ // src/endpoints/hcc.ts
1366
+ var HccEndpoint = class {
1367
+ constructor(http) {
1368
+ this.http = http;
1369
+ }
1370
+ /**
1371
+ * Look up HCC mappings for a single ICD-10 code.
1372
+ *
1373
+ * Returns all HCC category mappings for the given diagnosis code.
1374
+ *
1375
+ * @param icd10Code - ICD-10-CM diagnosis code (e.g., "E11.9")
1376
+ * @param options - Response shape and include options
1377
+ * @returns HCC mapping data (may contain multiple mappings)
1378
+ *
1379
+ * @example
1380
+ * ```ts
1381
+ * const result = await client.hcc.lookup("E11.9");
1382
+ * console.log(result.data); // HCC mapping(s) for Type 2 diabetes
1383
+ * ```
1384
+ */
1385
+ async lookup(icd10Code, options) {
1386
+ return this.http.get(`/v1/hcc/${encodeURIComponent(icd10Code)}`, options);
1387
+ }
1388
+ /**
1389
+ * Look up HCC mappings for multiple ICD-10 codes in a single request.
1390
+ *
1391
+ * @param codes - Array of ICD-10-CM codes (max 100)
1392
+ * @param options - Response shape, include, and batch options
1393
+ * @returns Batch response with HCC mappings for each code
1394
+ */
1395
+ async lookupMany(codes, options) {
1396
+ if (codes.length === 0) throw new ValidationError("codes array must not be empty");
1397
+ if (codes.length > 100) throw new ValidationError(`HCC batch lookup supports max 100 codes, got ${codes.length}`);
1398
+ return this.http.post(
1399
+ "/v1/hcc/_batch",
1400
+ { codes },
1401
+ options
1402
+ );
1403
+ }
1404
+ /**
1405
+ * Reverse lookup: find ICD-10 codes that map to a given HCC category.
1406
+ *
1407
+ * @param ccNumber - HCC condition category number
1408
+ * @param options - Response shape, include, and model filter options
1409
+ * @returns Reverse lookup result with array of ICD-10 codes
1410
+ *
1411
+ * @example
1412
+ * ```ts
1413
+ * // Find all ICD-10 codes that map to HCC 19 (Diabetes)
1414
+ * const result = await client.hcc.reverse(19);
1415
+ * console.log(result.data.icd10_codes);
1416
+ *
1417
+ * // Filter by model
1418
+ * const result = await client.hcc.reverse(19, { model: "CMS-HCC" });
1419
+ * ```
1420
+ */
1421
+ async reverse(ccNumber, options) {
1422
+ const { model, ...lookupOptions } = options ?? {};
1423
+ const endpoint = `/v1/hcc/reverse/${encodeURIComponent(String(ccNumber))}`;
1424
+ if (model) {
1425
+ return this.http.search(endpoint, {
1426
+ model,
1427
+ shape: lookupOptions.shape,
1428
+ include: lookupOptions.include?.join(",")
1429
+ });
1430
+ }
1431
+ return this.http.get(endpoint, lookupOptions);
1432
+ }
1433
+ /**
1434
+ * Search for HCC crosswalk mappings.
1435
+ *
1436
+ * @param params - Search parameters (q, model_version, model_type, cc_number, payment_year)
1437
+ * @param options - Pagination and response shape options
1438
+ * @returns Search results with facets
1439
+ *
1440
+ * @example
1441
+ * ```ts
1442
+ * // Search by ICD-10 code text
1443
+ * const results = await client.hcc.search({ q: "diabetes" });
1444
+ *
1445
+ * // Filter by model version
1446
+ * const results = await client.hcc.search({
1447
+ * model_version: "V28",
1448
+ * cc_number: 19
1449
+ * });
1450
+ * ```
1451
+ */
1452
+ async search(params, options) {
1453
+ return this.http.search("/v1/hcc/search", {
1454
+ ...params,
1455
+ ...options,
1456
+ include: options?.include?.join(",")
1457
+ });
1458
+ }
1459
+ };
1460
+
1461
+ // src/endpoints/opcs4.ts
1462
+ var Opcs4Endpoint = class {
1463
+ constructor(http) {
1464
+ this.http = http;
1465
+ }
1466
+ /**
1467
+ * Look up a single OPCS-4 procedure code.
1468
+ *
1469
+ * @param code - OPCS-4 procedure code (e.g., "W37.1")
1470
+ * @param options - Response shape and include options
1471
+ * @returns OPCS-4 data
1472
+ *
1473
+ * @example
1474
+ * ```ts
1475
+ * const result = await client.opcs4.lookup("W37.1");
1476
+ * console.log(result.data.display); // Procedure description
1477
+ * ```
1478
+ */
1479
+ async lookup(code, options) {
1480
+ return this.http.get(`/v1/opcs4/${encodeURIComponent(code)}`, options);
1481
+ }
1482
+ /**
1483
+ * Look up multiple OPCS-4 codes in a single request.
1484
+ *
1485
+ * @param codes - Array of OPCS-4 codes (max 100)
1486
+ * @param options - Response shape, include, and batch options
1487
+ * @returns Batch response with results for each code
1488
+ */
1489
+ async lookupMany(codes, options) {
1490
+ if (codes.length === 0) throw new ValidationError("codes array must not be empty");
1491
+ if (codes.length > 100) throw new ValidationError(`OPCS-4 batch lookup supports max 100 codes, got ${codes.length}`);
1492
+ return this.http.post(
1493
+ "/v1/opcs4/_batch",
1494
+ { codes },
1495
+ options
1496
+ );
1497
+ }
1498
+ /**
1499
+ * Search for OPCS-4 procedure codes.
1500
+ *
1501
+ * @param params - Search parameters (q, chapter, category)
1502
+ * @param options - Pagination and response shape options
1503
+ * @returns Search results with facets
1504
+ *
1505
+ * @example
1506
+ * ```ts
1507
+ * // Search for knee procedures
1508
+ * const results = await client.opcs4.search({ q: "knee replacement" });
1509
+ *
1510
+ * // Filter by chapter
1511
+ * const results = await client.opcs4.search({
1512
+ * chapter: "W",
1513
+ * q: "joint"
1514
+ * });
1515
+ * ```
1516
+ */
1517
+ async search(params, options) {
1518
+ return this.http.search("/v1/opcs4/search", {
1519
+ ...params,
1520
+ ...options,
1521
+ include: options?.include?.join(",")
1522
+ });
1523
+ }
1524
+ };
1525
+
1365
1526
  // src/client.ts
1366
1527
  var Fhirfly = class {
1367
1528
  http;
@@ -1417,6 +1578,16 @@ var Fhirfly = class {
1417
1578
  * State FHIR endpoint implementation status, patient access, and provider directories.
1418
1579
  */
1419
1580
  sma;
1581
+ /**
1582
+ * HCC (Hierarchical Condition Categories) crosswalk lookups.
1583
+ * Map ICD-10 diagnosis codes to CMS risk adjustment categories.
1584
+ */
1585
+ hcc;
1586
+ /**
1587
+ * OPCS-4 (Office of Population Censuses and Surveys) procedure code lookups.
1588
+ * UK NHS procedural coding system.
1589
+ */
1590
+ opcs4;
1420
1591
  /**
1421
1592
  * Create a new FHIRfly client.
1422
1593
  *
@@ -1466,9 +1637,11 @@ var Fhirfly = class {
1466
1637
  this.snomed = new SnomedEndpoint(this.http);
1467
1638
  this.claims = new ClaimsEndpoint(this.http);
1468
1639
  this.sma = new SmaEndpoint(this.http);
1640
+ this.hcc = new HccEndpoint(this.http);
1641
+ this.opcs4 = new Opcs4Endpoint(this.http);
1469
1642
  }
1470
1643
  };
1471
1644
 
1472
- export { ApiError, AuthenticationError, Fhirfly, FhirflyError, NetworkError, NotFoundError, QuotaExceededError, RateLimitError, ServerError, TimeoutError, TokenManager, ValidationError };
1645
+ export { ApiError, AuthenticationError, Fhirfly, FhirflyError, HccEndpoint, NetworkError, NotFoundError, Opcs4Endpoint, QuotaExceededError, RateLimitError, ServerError, TimeoutError, TokenManager, ValidationError };
1473
1646
  //# sourceMappingURL=index.js.map
1474
1647
  //# sourceMappingURL=index.js.map