@fhirfly-io/terminology 0.1.3 → 0.2.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 +359 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +545 -22
- package/dist/index.d.ts +545 -22
- package/dist/index.js +359 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -71,13 +71,101 @@ interface BatchResponse<T> {
|
|
|
71
71
|
interface DisplayField {
|
|
72
72
|
display?: string;
|
|
73
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Common options for all search methods.
|
|
76
|
+
*/
|
|
77
|
+
interface SearchOptions {
|
|
78
|
+
/** Response detail level. Default: "compact" */
|
|
79
|
+
shape?: ResponseShape;
|
|
80
|
+
/** Include additional fields like pre-formatted display strings */
|
|
81
|
+
include?: IncludeOption[];
|
|
82
|
+
/** Results per page (1-100). Default: 20 */
|
|
83
|
+
limit?: number;
|
|
84
|
+
/** Page number (1-100). Default: 1 */
|
|
85
|
+
page?: number;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Facet counts in search results.
|
|
89
|
+
*/
|
|
90
|
+
type SearchFacets = Record<string, Record<string, number>>;
|
|
91
|
+
/**
|
|
92
|
+
* Legal metadata for search results.
|
|
93
|
+
*/
|
|
94
|
+
interface SearchLegalInfo {
|
|
95
|
+
license: string;
|
|
96
|
+
source_name: string;
|
|
97
|
+
citation: string;
|
|
98
|
+
attribution_required: boolean;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Search response wrapper.
|
|
102
|
+
*/
|
|
103
|
+
interface SearchResponse<T> {
|
|
104
|
+
/** Search result items */
|
|
105
|
+
items: T[];
|
|
106
|
+
/** Total number of matching results */
|
|
107
|
+
total: number;
|
|
108
|
+
/** Whether total was capped (e.g., at 10,000) */
|
|
109
|
+
total_capped: boolean;
|
|
110
|
+
/** Whether there are more results */
|
|
111
|
+
has_more: boolean;
|
|
112
|
+
/** Current page number */
|
|
113
|
+
page: number;
|
|
114
|
+
/** Results per page */
|
|
115
|
+
limit: number;
|
|
116
|
+
/** Facet counts for filtering */
|
|
117
|
+
facets: SearchFacets;
|
|
118
|
+
/** Legal and attribution metadata */
|
|
119
|
+
meta: {
|
|
120
|
+
legal: SearchLegalInfo;
|
|
121
|
+
};
|
|
122
|
+
}
|
|
74
123
|
|
|
124
|
+
/**
|
|
125
|
+
* OAuth2 client credentials configuration.
|
|
126
|
+
*/
|
|
127
|
+
interface OAuthCredentials {
|
|
128
|
+
clientId: string;
|
|
129
|
+
clientSecret: string;
|
|
130
|
+
tokenUrl: string;
|
|
131
|
+
scopes?: string[];
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Manages OAuth2 access tokens with automatic refresh.
|
|
135
|
+
*/
|
|
136
|
+
declare class TokenManager {
|
|
137
|
+
private readonly credentials;
|
|
138
|
+
private accessToken;
|
|
139
|
+
private expiresAt;
|
|
140
|
+
private refreshPromise;
|
|
141
|
+
constructor(credentials: OAuthCredentials);
|
|
142
|
+
/**
|
|
143
|
+
* Get a valid access token, refreshing if needed.
|
|
144
|
+
* Deduplicates concurrent refresh calls.
|
|
145
|
+
*/
|
|
146
|
+
getToken(): Promise<string>;
|
|
147
|
+
/**
|
|
148
|
+
* Invalidate the cached token (e.g., after a 401 response).
|
|
149
|
+
*/
|
|
150
|
+
invalidate(): void;
|
|
151
|
+
private fetchToken;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Authentication mode for the HTTP client.
|
|
155
|
+
*/
|
|
156
|
+
type AuthMode = {
|
|
157
|
+
type: "api-key";
|
|
158
|
+
apiKey: string;
|
|
159
|
+
} | {
|
|
160
|
+
type: "oauth";
|
|
161
|
+
tokenManager: TokenManager;
|
|
162
|
+
};
|
|
75
163
|
/**
|
|
76
164
|
* HTTP client configuration.
|
|
77
165
|
*/
|
|
78
166
|
interface HttpClientConfig {
|
|
79
167
|
baseUrl: string;
|
|
80
|
-
|
|
168
|
+
auth: AuthMode;
|
|
81
169
|
timeout?: number;
|
|
82
170
|
maxRetries?: number;
|
|
83
171
|
retryDelay?: number;
|
|
@@ -93,6 +181,10 @@ declare class HttpClient {
|
|
|
93
181
|
* Build query string from options.
|
|
94
182
|
*/
|
|
95
183
|
private buildQueryString;
|
|
184
|
+
/**
|
|
185
|
+
* Build query string from search params object.
|
|
186
|
+
*/
|
|
187
|
+
buildSearchQueryString(params: Record<string, unknown>): string;
|
|
96
188
|
/**
|
|
97
189
|
* Parse error response from API.
|
|
98
190
|
*/
|
|
@@ -101,6 +193,10 @@ declare class HttpClient {
|
|
|
101
193
|
* Sleep for a given number of milliseconds.
|
|
102
194
|
*/
|
|
103
195
|
private sleep;
|
|
196
|
+
/**
|
|
197
|
+
* Get auth headers for the current request.
|
|
198
|
+
*/
|
|
199
|
+
private getAuthHeaders;
|
|
104
200
|
/**
|
|
105
201
|
* Make an HTTP request with retries.
|
|
106
202
|
*/
|
|
@@ -113,6 +209,10 @@ declare class HttpClient {
|
|
|
113
209
|
* Make a POST request.
|
|
114
210
|
*/
|
|
115
211
|
post<T>(endpoint: string, body: unknown, options?: LookupOptions): Promise<T>;
|
|
212
|
+
/**
|
|
213
|
+
* Make a GET request with search parameters.
|
|
214
|
+
*/
|
|
215
|
+
search<T>(endpoint: string, params: Record<string, unknown>): Promise<T>;
|
|
116
216
|
}
|
|
117
217
|
|
|
118
218
|
/**
|
|
@@ -167,6 +267,45 @@ interface NdcFull extends NdcStandard {
|
|
|
167
267
|
* NDC response type based on shape.
|
|
168
268
|
*/
|
|
169
269
|
type NdcData = NdcCompact | NdcStandard | NdcFull;
|
|
270
|
+
/**
|
|
271
|
+
* NDC search parameters.
|
|
272
|
+
*/
|
|
273
|
+
interface NdcSearchParams {
|
|
274
|
+
/** General text search across product names */
|
|
275
|
+
q?: string;
|
|
276
|
+
/** Search by product name */
|
|
277
|
+
name?: string;
|
|
278
|
+
/** Search by brand name */
|
|
279
|
+
brand?: string;
|
|
280
|
+
/** Search by generic name */
|
|
281
|
+
generic?: string;
|
|
282
|
+
/** Search by active ingredient */
|
|
283
|
+
ingredient?: string;
|
|
284
|
+
/** Filter by strength (e.g., "200mg", "10mg/5ml") */
|
|
285
|
+
strength?: string;
|
|
286
|
+
/** Filter by dosage form (e.g., "TABLET", "CAPSULE") */
|
|
287
|
+
dosage_form?: string;
|
|
288
|
+
/** Filter by administration route */
|
|
289
|
+
route?: string;
|
|
290
|
+
/** Filter by labeler/manufacturer name */
|
|
291
|
+
labeler?: string;
|
|
292
|
+
/** Filter by product type: "otc", "rx", or "all" */
|
|
293
|
+
product_type?: "otc" | "rx" | "all";
|
|
294
|
+
/** Filter by DEA schedule: "ci", "cii", "ciii", "civ", "cv", "none" */
|
|
295
|
+
dea_schedule?: "ci" | "cii" | "ciii" | "civ" | "cv" | "none";
|
|
296
|
+
/** Filter by marketing category */
|
|
297
|
+
marketing_category?: string;
|
|
298
|
+
/** Filter by pharmacologic class */
|
|
299
|
+
pharm_class?: string;
|
|
300
|
+
/** Filter by active status */
|
|
301
|
+
is_active?: boolean;
|
|
302
|
+
/** Filter by RxNorm linkage */
|
|
303
|
+
has_rxcui?: boolean;
|
|
304
|
+
/** Filter by specific RxNorm CUI */
|
|
305
|
+
rxcui?: string;
|
|
306
|
+
/** Sort order: "relevance", "name", "labeler" */
|
|
307
|
+
sort?: "relevance" | "name" | "labeler";
|
|
308
|
+
}
|
|
170
309
|
|
|
171
310
|
/**
|
|
172
311
|
* NDC (National Drug Code) API endpoint.
|
|
@@ -213,6 +352,32 @@ declare class NdcEndpoint {
|
|
|
213
352
|
* ```
|
|
214
353
|
*/
|
|
215
354
|
lookupMany(codes: string[], options?: BatchLookupOptions): Promise<BatchResponse<NdcData>>;
|
|
355
|
+
/**
|
|
356
|
+
* Search for NDC products.
|
|
357
|
+
*
|
|
358
|
+
* @param params - Search parameters (q, name, brand, ingredient, etc.)
|
|
359
|
+
* @param options - Pagination and response shape options
|
|
360
|
+
* @returns Search results with facets
|
|
361
|
+
*
|
|
362
|
+
* @example
|
|
363
|
+
* ```ts
|
|
364
|
+
* // Search by drug name
|
|
365
|
+
* const results = await client.ndc.search({ q: "advil" });
|
|
366
|
+
*
|
|
367
|
+
* // Search with filters
|
|
368
|
+
* const results = await client.ndc.search({
|
|
369
|
+
* ingredient: "ibuprofen",
|
|
370
|
+
* dosage_form: "TABLET",
|
|
371
|
+
* product_type: "otc"
|
|
372
|
+
* });
|
|
373
|
+
*
|
|
374
|
+
* console.log(`Found ${results.total} products`);
|
|
375
|
+
* for (const item of results.items) {
|
|
376
|
+
* console.log(item.product_name);
|
|
377
|
+
* }
|
|
378
|
+
* ```
|
|
379
|
+
*/
|
|
380
|
+
search(params: NdcSearchParams, options?: SearchOptions): Promise<SearchResponse<NdcData>>;
|
|
216
381
|
}
|
|
217
382
|
|
|
218
383
|
/**
|
|
@@ -292,6 +457,39 @@ interface NpiFull extends NpiStandard {
|
|
|
292
457
|
* NPI response type based on shape.
|
|
293
458
|
*/
|
|
294
459
|
type NpiData = NpiCompact | NpiStandard | NpiFull;
|
|
460
|
+
/**
|
|
461
|
+
* NPI search parameters.
|
|
462
|
+
*/
|
|
463
|
+
interface NpiSearchParams {
|
|
464
|
+
/** General text search */
|
|
465
|
+
q?: string;
|
|
466
|
+
/** Search by provider name */
|
|
467
|
+
name?: string;
|
|
468
|
+
/** Filter by first name (individuals only) */
|
|
469
|
+
first_name?: string;
|
|
470
|
+
/** Filter by last name (individuals only) */
|
|
471
|
+
last_name?: string;
|
|
472
|
+
/** Search by organization name */
|
|
473
|
+
organization?: string;
|
|
474
|
+
/** Filter by taxonomy code */
|
|
475
|
+
taxonomy?: string;
|
|
476
|
+
/** Search by specialty description */
|
|
477
|
+
specialty?: string;
|
|
478
|
+
/** Filter by state (2-letter code) */
|
|
479
|
+
state?: string;
|
|
480
|
+
/** Filter by city */
|
|
481
|
+
city?: string;
|
|
482
|
+
/** Filter by postal code */
|
|
483
|
+
postal_code?: string;
|
|
484
|
+
/** Filter by phone number */
|
|
485
|
+
phone?: string;
|
|
486
|
+
/** Filter by entity type */
|
|
487
|
+
entity_type?: "individual" | "organization";
|
|
488
|
+
/** Filter by active status */
|
|
489
|
+
active?: boolean;
|
|
490
|
+
/** Sort order: "relevance", "name", "location" */
|
|
491
|
+
sort?: "relevance" | "name" | "location";
|
|
492
|
+
}
|
|
295
493
|
|
|
296
494
|
/**
|
|
297
495
|
* NPI (National Provider Identifier) API endpoint.
|
|
@@ -329,6 +527,29 @@ declare class NpiEndpoint {
|
|
|
329
527
|
* ```
|
|
330
528
|
*/
|
|
331
529
|
lookupMany(npis: string[], options?: BatchLookupOptions): Promise<BatchResponse<NpiData>>;
|
|
530
|
+
/**
|
|
531
|
+
* Search for healthcare providers.
|
|
532
|
+
*
|
|
533
|
+
* @param params - Search parameters (q, name, specialty, state, etc.)
|
|
534
|
+
* @param options - Pagination and response shape options
|
|
535
|
+
* @returns Search results with facets
|
|
536
|
+
*
|
|
537
|
+
* @example
|
|
538
|
+
* ```ts
|
|
539
|
+
* // Search by name
|
|
540
|
+
* const results = await client.npi.search({ q: "smith" });
|
|
541
|
+
*
|
|
542
|
+
* // Search with filters
|
|
543
|
+
* const results = await client.npi.search({
|
|
544
|
+
* specialty: "cardiology",
|
|
545
|
+
* state: "CA",
|
|
546
|
+
* entity_type: "individual"
|
|
547
|
+
* });
|
|
548
|
+
*
|
|
549
|
+
* console.log(`Found ${results.total} providers`);
|
|
550
|
+
* ```
|
|
551
|
+
*/
|
|
552
|
+
search(params: NpiSearchParams, options?: SearchOptions): Promise<SearchResponse<NpiData>>;
|
|
332
553
|
}
|
|
333
554
|
|
|
334
555
|
/**
|
|
@@ -380,6 +601,33 @@ interface RxNormFull extends RxNormStandard {
|
|
|
380
601
|
* RxNorm response type based on shape.
|
|
381
602
|
*/
|
|
382
603
|
type RxNormData = RxNormCompact | RxNormStandard | RxNormFull;
|
|
604
|
+
/**
|
|
605
|
+
* RxNorm search parameters.
|
|
606
|
+
*/
|
|
607
|
+
interface RxNormSearchParams {
|
|
608
|
+
/** General text search */
|
|
609
|
+
q?: string;
|
|
610
|
+
/** Search by drug name */
|
|
611
|
+
name?: string;
|
|
612
|
+
/** Search by ingredient name */
|
|
613
|
+
ingredient?: string;
|
|
614
|
+
/** Search by brand name */
|
|
615
|
+
brand?: string;
|
|
616
|
+
/** Filter by term type(s), comma-separated (e.g., "SCD,SBD") */
|
|
617
|
+
tty?: string;
|
|
618
|
+
/** Filter by prescribable status */
|
|
619
|
+
is_prescribable?: boolean;
|
|
620
|
+
/** Filter by status: "active", "removed", "remapped", "obsolete" */
|
|
621
|
+
status?: string;
|
|
622
|
+
/** Filter by semantic type */
|
|
623
|
+
semantic_type?: string;
|
|
624
|
+
/** Filter by NDC linkage */
|
|
625
|
+
has_ndc?: boolean;
|
|
626
|
+
/** Filter by specific NDC */
|
|
627
|
+
ndc?: string;
|
|
628
|
+
/** Sort order: "relevance", "name" */
|
|
629
|
+
sort?: "relevance" | "name";
|
|
630
|
+
}
|
|
383
631
|
|
|
384
632
|
/**
|
|
385
633
|
* RxNorm API endpoint.
|
|
@@ -409,6 +657,26 @@ declare class RxNormEndpoint {
|
|
|
409
657
|
* @returns Batch response with results for each RxCUI
|
|
410
658
|
*/
|
|
411
659
|
lookupMany(rxcuis: string[], options?: BatchLookupOptions): Promise<BatchResponse<RxNormData>>;
|
|
660
|
+
/**
|
|
661
|
+
* Search for drugs in RxNorm.
|
|
662
|
+
*
|
|
663
|
+
* @param params - Search parameters (q, name, ingredient, brand, etc.)
|
|
664
|
+
* @param options - Pagination and response shape options
|
|
665
|
+
* @returns Search results with facets
|
|
666
|
+
*
|
|
667
|
+
* @example
|
|
668
|
+
* ```ts
|
|
669
|
+
* // Search by drug name
|
|
670
|
+
* const results = await client.rxnorm.search({ q: "lipitor" });
|
|
671
|
+
*
|
|
672
|
+
* // Search prescribable drugs by ingredient
|
|
673
|
+
* const results = await client.rxnorm.search({
|
|
674
|
+
* ingredient: "metformin",
|
|
675
|
+
* is_prescribable: true
|
|
676
|
+
* });
|
|
677
|
+
* ```
|
|
678
|
+
*/
|
|
679
|
+
search(params: RxNormSearchParams, options?: SearchOptions): Promise<SearchResponse<RxNormData>>;
|
|
412
680
|
}
|
|
413
681
|
|
|
414
682
|
/**
|
|
@@ -465,6 +733,31 @@ interface LoincFull extends LoincStandard {
|
|
|
465
733
|
* LOINC response type based on shape.
|
|
466
734
|
*/
|
|
467
735
|
type LoincData = LoincCompact | LoincStandard | LoincFull;
|
|
736
|
+
/**
|
|
737
|
+
* LOINC search parameters.
|
|
738
|
+
*/
|
|
739
|
+
interface LoincSearchParams {
|
|
740
|
+
/** General text search */
|
|
741
|
+
q?: string;
|
|
742
|
+
/** Search by component name */
|
|
743
|
+
component?: string;
|
|
744
|
+
/** Filter by LOINC class (e.g., "CHEM", "HEM/BC") */
|
|
745
|
+
class?: string;
|
|
746
|
+
/** Filter by specimen/system type (e.g., "Bld", "Ser", "Urine") */
|
|
747
|
+
system?: string;
|
|
748
|
+
/** Filter by property */
|
|
749
|
+
property?: string;
|
|
750
|
+
/** Filter by scale type: "Qn", "Ord", "Nom", "Nar", etc. */
|
|
751
|
+
scale?: string;
|
|
752
|
+
/** Filter by method */
|
|
753
|
+
method?: string;
|
|
754
|
+
/** Filter by order/observation type: "Order", "Observation", "Both" */
|
|
755
|
+
order_obs?: string;
|
|
756
|
+
/** Filter by status: "ACTIVE", "DEPRECATED", "DISCOURAGED", etc. */
|
|
757
|
+
status?: string;
|
|
758
|
+
/** Sort order: "relevance", "name", "code" */
|
|
759
|
+
sort?: "relevance" | "name" | "code";
|
|
760
|
+
}
|
|
468
761
|
|
|
469
762
|
/**
|
|
470
763
|
* LOINC API endpoint.
|
|
@@ -494,6 +787,27 @@ declare class LoincEndpoint {
|
|
|
494
787
|
* @returns Batch response with results for each LOINC
|
|
495
788
|
*/
|
|
496
789
|
lookupMany(loincNums: string[], options?: BatchLookupOptions): Promise<BatchResponse<LoincData>>;
|
|
790
|
+
/**
|
|
791
|
+
* Search for LOINC codes.
|
|
792
|
+
*
|
|
793
|
+
* @param params - Search parameters (q, component, class, system, etc.)
|
|
794
|
+
* @param options - Pagination and response shape options
|
|
795
|
+
* @returns Search results with facets
|
|
796
|
+
*
|
|
797
|
+
* @example
|
|
798
|
+
* ```ts
|
|
799
|
+
* // Search by term
|
|
800
|
+
* const results = await client.loinc.search({ q: "glucose" });
|
|
801
|
+
*
|
|
802
|
+
* // Search blood chemistry tests
|
|
803
|
+
* const results = await client.loinc.search({
|
|
804
|
+
* class: "CHEM",
|
|
805
|
+
* system: "Bld",
|
|
806
|
+
* scale: "Qn"
|
|
807
|
+
* });
|
|
808
|
+
* ```
|
|
809
|
+
*/
|
|
810
|
+
search(params: LoincSearchParams, options?: SearchOptions): Promise<SearchResponse<LoincData>>;
|
|
497
811
|
}
|
|
498
812
|
|
|
499
813
|
/**
|
|
@@ -546,6 +860,33 @@ interface Icd10Full extends Icd10Standard {
|
|
|
546
860
|
* ICD-10 response type based on shape.
|
|
547
861
|
*/
|
|
548
862
|
type Icd10Data = Icd10Compact | Icd10Standard | Icd10Full;
|
|
863
|
+
/**
|
|
864
|
+
* ICD-10 search parameters.
|
|
865
|
+
*/
|
|
866
|
+
interface Icd10SearchParams {
|
|
867
|
+
/** General text search */
|
|
868
|
+
q?: string;
|
|
869
|
+
/** Filter by code system: "CM" (diagnosis) or "PCS" (procedure) */
|
|
870
|
+
code_system?: "CM" | "PCS";
|
|
871
|
+
/** Filter by chapter (CM only) */
|
|
872
|
+
chapter?: string;
|
|
873
|
+
/** Filter by block (CM only) */
|
|
874
|
+
block?: string;
|
|
875
|
+
/** Filter by billable codes only */
|
|
876
|
+
billable?: boolean;
|
|
877
|
+
/** Filter by section (PCS only) */
|
|
878
|
+
section?: string;
|
|
879
|
+
/** Filter by body system (PCS only) */
|
|
880
|
+
body_system?: string;
|
|
881
|
+
/** Filter by root operation (PCS only) */
|
|
882
|
+
root_operation?: string;
|
|
883
|
+
/** Filter by approach (PCS only) */
|
|
884
|
+
approach?: string;
|
|
885
|
+
/** Filter by status */
|
|
886
|
+
status?: string;
|
|
887
|
+
/** Sort order: "relevance", "code", "display" */
|
|
888
|
+
sort?: "relevance" | "code" | "display";
|
|
889
|
+
}
|
|
549
890
|
|
|
550
891
|
/**
|
|
551
892
|
* ICD-10 API endpoint.
|
|
@@ -597,6 +938,30 @@ declare class Icd10Endpoint {
|
|
|
597
938
|
* @returns Batch response with results for each code
|
|
598
939
|
*/
|
|
599
940
|
lookupPcsMany(codes: string[], options?: BatchLookupOptions): Promise<BatchResponse<Icd10Data>>;
|
|
941
|
+
/**
|
|
942
|
+
* Search for ICD-10 codes (both CM and PCS).
|
|
943
|
+
*
|
|
944
|
+
* @param params - Search parameters (q, code_system, chapter, billable, etc.)
|
|
945
|
+
* @param options - Pagination and response shape options
|
|
946
|
+
* @returns Search results with facets
|
|
947
|
+
*
|
|
948
|
+
* @example
|
|
949
|
+
* ```ts
|
|
950
|
+
* // Search diagnosis codes
|
|
951
|
+
* const results = await client.icd10.search({
|
|
952
|
+
* q: "diabetes",
|
|
953
|
+
* code_system: "CM",
|
|
954
|
+
* billable: true
|
|
955
|
+
* });
|
|
956
|
+
*
|
|
957
|
+
* // Search procedure codes
|
|
958
|
+
* const results = await client.icd10.search({
|
|
959
|
+
* q: "bypass",
|
|
960
|
+
* code_system: "PCS"
|
|
961
|
+
* });
|
|
962
|
+
* ```
|
|
963
|
+
*/
|
|
964
|
+
search(params: Icd10SearchParams, options?: SearchOptions): Promise<SearchResponse<Icd10Data>>;
|
|
600
965
|
}
|
|
601
966
|
|
|
602
967
|
/**
|
|
@@ -628,6 +993,21 @@ interface CvxFull extends CvxStandard {
|
|
|
628
993
|
* CVX response type based on shape.
|
|
629
994
|
*/
|
|
630
995
|
type CvxData = CvxCompact | CvxStandard | CvxFull;
|
|
996
|
+
/**
|
|
997
|
+
* CVX search parameters.
|
|
998
|
+
*/
|
|
999
|
+
interface CvxSearchParams {
|
|
1000
|
+
/** General text search */
|
|
1001
|
+
q?: string;
|
|
1002
|
+
/** Filter by status: "active", "inactive" */
|
|
1003
|
+
status?: string;
|
|
1004
|
+
/** Filter by vaccine type (e.g., "mRNA", "live", "inactivated") */
|
|
1005
|
+
vaccine_type?: string;
|
|
1006
|
+
/** Filter for COVID-19 vaccines only */
|
|
1007
|
+
is_covid_vaccine?: boolean;
|
|
1008
|
+
/** Sort order: "relevance", "name", "code" */
|
|
1009
|
+
sort?: "relevance" | "name" | "code";
|
|
1010
|
+
}
|
|
631
1011
|
|
|
632
1012
|
/**
|
|
633
1013
|
* CVX (Vaccine Codes) API endpoint.
|
|
@@ -657,6 +1037,26 @@ declare class CvxEndpoint {
|
|
|
657
1037
|
* @returns Batch response with results for each code
|
|
658
1038
|
*/
|
|
659
1039
|
lookupMany(cvxCodes: string[], options?: BatchLookupOptions): Promise<BatchResponse<CvxData>>;
|
|
1040
|
+
/**
|
|
1041
|
+
* Search for vaccine codes.
|
|
1042
|
+
*
|
|
1043
|
+
* @param params - Search parameters (q, status, vaccine_type, is_covid_vaccine)
|
|
1044
|
+
* @param options - Pagination and response shape options
|
|
1045
|
+
* @returns Search results with facets
|
|
1046
|
+
*
|
|
1047
|
+
* @example
|
|
1048
|
+
* ```ts
|
|
1049
|
+
* // Search for flu vaccines
|
|
1050
|
+
* const results = await client.cvx.search({ q: "influenza" });
|
|
1051
|
+
*
|
|
1052
|
+
* // Find all COVID-19 vaccines
|
|
1053
|
+
* const results = await client.cvx.search({
|
|
1054
|
+
* is_covid_vaccine: true,
|
|
1055
|
+
* status: "active"
|
|
1056
|
+
* });
|
|
1057
|
+
* ```
|
|
1058
|
+
*/
|
|
1059
|
+
search(params: CvxSearchParams, options?: SearchOptions): Promise<SearchResponse<CvxData>>;
|
|
660
1060
|
}
|
|
661
1061
|
|
|
662
1062
|
/**
|
|
@@ -687,6 +1087,17 @@ interface MvxFull extends MvxStandard {
|
|
|
687
1087
|
* MVX response type based on shape.
|
|
688
1088
|
*/
|
|
689
1089
|
type MvxData = MvxCompact | MvxStandard | MvxFull;
|
|
1090
|
+
/**
|
|
1091
|
+
* MVX search parameters.
|
|
1092
|
+
*/
|
|
1093
|
+
interface MvxSearchParams {
|
|
1094
|
+
/** General text search */
|
|
1095
|
+
q?: string;
|
|
1096
|
+
/** Filter by status: "active", "inactive" */
|
|
1097
|
+
status?: string;
|
|
1098
|
+
/** Sort order: "relevance", "name", "code" */
|
|
1099
|
+
sort?: "relevance" | "name" | "code";
|
|
1100
|
+
}
|
|
690
1101
|
|
|
691
1102
|
/**
|
|
692
1103
|
* MVX (Vaccine Manufacturer Codes) API endpoint.
|
|
@@ -716,6 +1127,23 @@ declare class MvxEndpoint {
|
|
|
716
1127
|
* @returns Batch response with results for each code
|
|
717
1128
|
*/
|
|
718
1129
|
lookupMany(mvxCodes: string[], options?: BatchLookupOptions): Promise<BatchResponse<MvxData>>;
|
|
1130
|
+
/**
|
|
1131
|
+
* Search for vaccine manufacturers.
|
|
1132
|
+
*
|
|
1133
|
+
* @param params - Search parameters (q, status)
|
|
1134
|
+
* @param options - Pagination and response shape options
|
|
1135
|
+
* @returns Search results with facets
|
|
1136
|
+
*
|
|
1137
|
+
* @example
|
|
1138
|
+
* ```ts
|
|
1139
|
+
* // Search by name
|
|
1140
|
+
* const results = await client.mvx.search({ q: "pfizer" });
|
|
1141
|
+
*
|
|
1142
|
+
* // List all active manufacturers
|
|
1143
|
+
* const results = await client.mvx.search({ status: "active" });
|
|
1144
|
+
* ```
|
|
1145
|
+
*/
|
|
1146
|
+
search(params: MvxSearchParams, options?: SearchOptions): Promise<SearchResponse<MvxData>>;
|
|
719
1147
|
}
|
|
720
1148
|
|
|
721
1149
|
/**
|
|
@@ -766,6 +1194,41 @@ interface FdaLabelFull extends FdaLabelStandard {
|
|
|
766
1194
|
* FDA Label response type based on shape.
|
|
767
1195
|
*/
|
|
768
1196
|
type FdaLabelData = FdaLabelCompact | FdaLabelStandard | FdaLabelFull;
|
|
1197
|
+
/**
|
|
1198
|
+
* FDA Label search parameters.
|
|
1199
|
+
*/
|
|
1200
|
+
interface FdaLabelSearchParams {
|
|
1201
|
+
/** General text search */
|
|
1202
|
+
q?: string;
|
|
1203
|
+
/** Search by product name */
|
|
1204
|
+
name?: string;
|
|
1205
|
+
/** Search by brand name */
|
|
1206
|
+
brand?: string;
|
|
1207
|
+
/** Search by generic name */
|
|
1208
|
+
generic?: string;
|
|
1209
|
+
/** Search by active substance/ingredient */
|
|
1210
|
+
substance?: string;
|
|
1211
|
+
/** Search by manufacturer name */
|
|
1212
|
+
manufacturer?: string;
|
|
1213
|
+
/** Filter by product type: "otc", "rx", "cellular" */
|
|
1214
|
+
product_type?: "otc" | "rx" | "cellular";
|
|
1215
|
+
/** Filter by administration route */
|
|
1216
|
+
route?: string;
|
|
1217
|
+
/** Filter by pharmacologic class */
|
|
1218
|
+
pharm_class?: string;
|
|
1219
|
+
/** Filter by RxNorm linkage */
|
|
1220
|
+
has_rxcui?: boolean;
|
|
1221
|
+
/** Filter by specific RxCUI */
|
|
1222
|
+
rxcui?: string;
|
|
1223
|
+
/** Filter by specific NDC */
|
|
1224
|
+
ndc?: string;
|
|
1225
|
+
/** Filter by FDA application number */
|
|
1226
|
+
application_number?: string;
|
|
1227
|
+
/** Filter for current labels only (default: true) */
|
|
1228
|
+
is_current?: boolean;
|
|
1229
|
+
/** Sort order: "relevance", "name", "manufacturer" */
|
|
1230
|
+
sort?: "relevance" | "name" | "manufacturer";
|
|
1231
|
+
}
|
|
769
1232
|
|
|
770
1233
|
/**
|
|
771
1234
|
* FDA Labels API endpoint.
|
|
@@ -809,17 +1272,38 @@ declare class FdaLabelsEndpoint {
|
|
|
809
1272
|
* @returns Batch response with results for each Set ID
|
|
810
1273
|
*/
|
|
811
1274
|
lookupMany(setIds: string[], options?: BatchLookupOptions): Promise<BatchResponse<FdaLabelData>>;
|
|
1275
|
+
/**
|
|
1276
|
+
* Search for FDA drug labels.
|
|
1277
|
+
*
|
|
1278
|
+
* @param params - Search parameters (q, name, brand, substance, manufacturer, etc.)
|
|
1279
|
+
* @param options - Pagination and response shape options
|
|
1280
|
+
* @returns Search results with facets
|
|
1281
|
+
*
|
|
1282
|
+
* @example
|
|
1283
|
+
* ```ts
|
|
1284
|
+
* // Search by drug name
|
|
1285
|
+
* const results = await client.fdaLabels.search({ q: "advil" });
|
|
1286
|
+
*
|
|
1287
|
+
* // Search OTC pain relievers
|
|
1288
|
+
* const results = await client.fdaLabels.search({
|
|
1289
|
+
* substance: "acetaminophen",
|
|
1290
|
+
* product_type: "otc"
|
|
1291
|
+
* });
|
|
1292
|
+
*
|
|
1293
|
+
* // Search by manufacturer
|
|
1294
|
+
* const results = await client.fdaLabels.search({
|
|
1295
|
+
* manufacturer: "pfizer",
|
|
1296
|
+
* product_type: "rx"
|
|
1297
|
+
* });
|
|
1298
|
+
* ```
|
|
1299
|
+
*/
|
|
1300
|
+
search(params: FdaLabelSearchParams, options?: SearchOptions): Promise<SearchResponse<FdaLabelData>>;
|
|
812
1301
|
}
|
|
813
1302
|
|
|
814
1303
|
/**
|
|
815
|
-
*
|
|
1304
|
+
* Base configuration options shared by all auth modes.
|
|
816
1305
|
*/
|
|
817
|
-
interface
|
|
818
|
-
/**
|
|
819
|
-
* Your FHIRfly API key.
|
|
820
|
-
* Get one at https://fhirfly.io/dashboard
|
|
821
|
-
*/
|
|
822
|
-
apiKey: string;
|
|
1306
|
+
interface FhirflyBaseConfig {
|
|
823
1307
|
/**
|
|
824
1308
|
* Base URL for the API.
|
|
825
1309
|
* @default "https://api.fhirfly.io"
|
|
@@ -841,6 +1325,48 @@ interface FhirflyConfig {
|
|
|
841
1325
|
*/
|
|
842
1326
|
retryDelay?: number;
|
|
843
1327
|
}
|
|
1328
|
+
/**
|
|
1329
|
+
* Configuration using an API key (simple credentials).
|
|
1330
|
+
*/
|
|
1331
|
+
interface FhirflyApiKeyConfig extends FhirflyBaseConfig {
|
|
1332
|
+
/**
|
|
1333
|
+
* Your FHIRfly API key.
|
|
1334
|
+
* Get one at https://fhirfly.io/dashboard
|
|
1335
|
+
*/
|
|
1336
|
+
apiKey: string;
|
|
1337
|
+
clientId?: never;
|
|
1338
|
+
clientSecret?: never;
|
|
1339
|
+
tokenUrl?: never;
|
|
1340
|
+
scopes?: never;
|
|
1341
|
+
}
|
|
1342
|
+
/**
|
|
1343
|
+
* Configuration using OAuth2 client credentials (secure credentials).
|
|
1344
|
+
*/
|
|
1345
|
+
interface FhirflyOAuthConfig extends FhirflyBaseConfig {
|
|
1346
|
+
/**
|
|
1347
|
+
* OAuth2 client ID from your secure credential.
|
|
1348
|
+
*/
|
|
1349
|
+
clientId: string;
|
|
1350
|
+
/**
|
|
1351
|
+
* OAuth2 client secret from your secure credential.
|
|
1352
|
+
*/
|
|
1353
|
+
clientSecret: string;
|
|
1354
|
+
/**
|
|
1355
|
+
* OAuth2 token endpoint URL.
|
|
1356
|
+
* @default "{baseUrl}/oauth2/token"
|
|
1357
|
+
*/
|
|
1358
|
+
tokenUrl?: string;
|
|
1359
|
+
/**
|
|
1360
|
+
* OAuth2 scopes to request.
|
|
1361
|
+
*/
|
|
1362
|
+
scopes?: string[];
|
|
1363
|
+
apiKey?: never;
|
|
1364
|
+
}
|
|
1365
|
+
/**
|
|
1366
|
+
* Configuration options for the FHIRfly client.
|
|
1367
|
+
* Provide either `apiKey` OR `clientId`+`clientSecret`, not both.
|
|
1368
|
+
*/
|
|
1369
|
+
type FhirflyConfig = FhirflyApiKeyConfig | FhirflyOAuthConfig;
|
|
844
1370
|
/**
|
|
845
1371
|
* FHIRfly API client.
|
|
846
1372
|
*
|
|
@@ -852,21 +1378,18 @@ interface FhirflyConfig {
|
|
|
852
1378
|
* ```ts
|
|
853
1379
|
* import { Fhirfly } from "@fhirfly/sdk";
|
|
854
1380
|
*
|
|
855
|
-
*
|
|
1381
|
+
* // Option A: API key (simple)
|
|
1382
|
+
* const client = new Fhirfly({ apiKey: "ffly_sk_live_..." });
|
|
1383
|
+
*
|
|
1384
|
+
* // Option B: Client credentials (secure)
|
|
1385
|
+
* const client = new Fhirfly({
|
|
1386
|
+
* clientId: "ffly_client_...",
|
|
1387
|
+
* clientSecret: "ffly_secret_...",
|
|
1388
|
+
* });
|
|
856
1389
|
*
|
|
857
1390
|
* // Look up a drug by NDC
|
|
858
1391
|
* const ndc = await client.ndc.lookup("0069-0151-01");
|
|
859
1392
|
* console.log(ndc.data.product_name); // "Lipitor"
|
|
860
|
-
*
|
|
861
|
-
* // Look up a provider by NPI
|
|
862
|
-
* const npi = await client.npi.lookup("1234567890");
|
|
863
|
-
* console.log(npi.data.name);
|
|
864
|
-
*
|
|
865
|
-
* // Batch lookups
|
|
866
|
-
* const results = await client.ndc.lookupMany([
|
|
867
|
-
* "0069-0151-01",
|
|
868
|
-
* "0069-0151-02"
|
|
869
|
-
* ]);
|
|
870
1393
|
* ```
|
|
871
1394
|
*/
|
|
872
1395
|
declare class Fhirfly {
|
|
@@ -906,8 +1429,8 @@ declare class Fhirfly {
|
|
|
906
1429
|
/**
|
|
907
1430
|
* Create a new FHIRfly client.
|
|
908
1431
|
*
|
|
909
|
-
* @param config - Client configuration
|
|
910
|
-
* @throws {Error} If apiKey is
|
|
1432
|
+
* @param config - Client configuration (API key or OAuth2 client credentials)
|
|
1433
|
+
* @throws {Error} If neither apiKey nor clientId+clientSecret is provided
|
|
911
1434
|
*/
|
|
912
1435
|
constructor(config: FhirflyConfig);
|
|
913
1436
|
}
|
|
@@ -988,4 +1511,4 @@ declare class TimeoutError extends FhirflyError {
|
|
|
988
1511
|
constructor(timeoutMs: number);
|
|
989
1512
|
}
|
|
990
1513
|
|
|
991
|
-
export { type ActiveIngredient, ApiError, type ApiResponse, AuthenticationError, type BatchLookupOptions, type BatchResponse, type BatchResultItem, type CvxCompact, type CvxData, type CvxFull, type CvxStandard, type DisplayField, type FdaLabelCompact, type FdaLabelData, type FdaLabelFull, type FdaLabelStandard, Fhirfly, type FhirflyConfig, FhirflyError, type Icd10Compact, type Icd10Data, type Icd10Full, type Icd10Standard, type Icd10Type, type IncludeOption, type LegalInfo, type LoincCompact, type LoincData, type LoincFull, type LoincStandard, type LookupOptions, type MvxCompact, type MvxData, type MvxFull, type MvxStandard, type NdcCompact, type NdcData, type NdcFull, type NdcPackaging, type NdcStandard, NetworkError, NotFoundError, type NpiAddress, type NpiCompact, type NpiData, type NpiFull, type NpiIdentifier, type NpiStandard, type NpiTaxonomy, QuotaExceededError, RateLimitError, type ResponseMeta, type ResponseShape, type RxNormCompact, type RxNormData, type RxNormFull, type RxNormStandard, type RxTermType, ServerError, TimeoutError, ValidationError };
|
|
1514
|
+
export { type ActiveIngredient, ApiError, type ApiResponse, AuthenticationError, type BatchLookupOptions, type BatchResponse, type BatchResultItem, type CvxCompact, type CvxData, type CvxFull, type CvxSearchParams, type CvxStandard, type DisplayField, type FdaLabelCompact, type FdaLabelData, type FdaLabelFull, type FdaLabelSearchParams, type FdaLabelStandard, Fhirfly, type FhirflyApiKeyConfig, type FhirflyConfig, FhirflyError, type FhirflyOAuthConfig, type Icd10Compact, type Icd10Data, type Icd10Full, type Icd10SearchParams, type Icd10Standard, type Icd10Type, type IncludeOption, type LegalInfo, type LoincCompact, type LoincData, type LoincFull, type LoincSearchParams, type LoincStandard, type LookupOptions, type MvxCompact, type MvxData, type MvxFull, type MvxSearchParams, type MvxStandard, type NdcCompact, type NdcData, type NdcFull, type NdcPackaging, type NdcSearchParams, type NdcStandard, NetworkError, NotFoundError, type NpiAddress, type NpiCompact, type NpiData, type NpiFull, type NpiIdentifier, type NpiSearchParams, type NpiStandard, type NpiTaxonomy, 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, ServerError, TimeoutError, TokenManager, ValidationError };
|