phenoml 3.0.0 → 3.1.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/cjs/Client.js +2 -2
- package/dist/cjs/api/resources/construe/client/Client.d.ts +18 -8
- package/dist/cjs/api/resources/construe/client/Client.js +19 -9
- package/dist/cjs/api/resources/construe/types/Citation.d.ts +11 -0
- package/dist/cjs/api/resources/construe/types/Citation.js +3 -0
- package/dist/cjs/api/resources/construe/types/ExtractRequestConfig.d.ts +8 -0
- package/dist/cjs/api/resources/construe/types/ExtractRequestSystem.d.ts +3 -1
- package/dist/cjs/api/resources/construe/types/ExtractedCodeResult.d.ts +12 -0
- package/dist/cjs/api/resources/construe/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/construe/types/index.js +1 -0
- package/dist/cjs/api/resources/fhir/client/Client.d.ts +6 -0
- package/dist/cjs/api/resources/fhir/client/Client.js +18 -0
- package/dist/cjs/api/resources/fhir/errors/BadGatewayError.d.ts +6 -0
- package/dist/cjs/api/resources/fhir/errors/BadGatewayError.js +50 -0
- package/dist/cjs/api/resources/fhir/errors/index.d.ts +1 -0
- package/dist/cjs/api/resources/fhir/errors/index.js +1 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.mjs +2 -2
- package/dist/esm/api/resources/construe/client/Client.d.mts +18 -8
- package/dist/esm/api/resources/construe/client/Client.mjs +19 -9
- package/dist/esm/api/resources/construe/types/Citation.d.mts +11 -0
- package/dist/esm/api/resources/construe/types/Citation.mjs +2 -0
- package/dist/esm/api/resources/construe/types/ExtractRequestConfig.d.mts +8 -0
- package/dist/esm/api/resources/construe/types/ExtractRequestSystem.d.mts +3 -1
- package/dist/esm/api/resources/construe/types/ExtractedCodeResult.d.mts +12 -0
- package/dist/esm/api/resources/construe/types/index.d.mts +1 -0
- package/dist/esm/api/resources/construe/types/index.mjs +1 -0
- package/dist/esm/api/resources/fhir/client/Client.d.mts +6 -0
- package/dist/esm/api/resources/fhir/client/Client.mjs +18 -0
- package/dist/esm/api/resources/fhir/errors/BadGatewayError.d.mts +6 -0
- package/dist/esm/api/resources/fhir/errors/BadGatewayError.mjs +13 -0
- package/dist/esm/api/resources/fhir/errors/index.d.mts +1 -0
- package/dist/esm/api/resources/fhir/errors/index.mjs +1 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +17 -7
package/dist/cjs/Client.js
CHANGED
|
@@ -52,8 +52,8 @@ class phenomlClient {
|
|
|
52
52
|
this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
|
|
53
53
|
"X-Fern-Language": "JavaScript",
|
|
54
54
|
"X-Fern-SDK-Name": "phenoml",
|
|
55
|
-
"X-Fern-SDK-Version": "3.
|
|
56
|
-
"User-Agent": "phenoml/3.
|
|
55
|
+
"X-Fern-SDK-Version": "3.1.0",
|
|
56
|
+
"User-Agent": "phenoml/3.1.0",
|
|
57
57
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
58
58
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
59
59
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -11,7 +11,7 @@ export declare class Construe {
|
|
|
11
11
|
protected readonly _options: Construe.Options;
|
|
12
12
|
constructor(_options: Construe.Options);
|
|
13
13
|
/**
|
|
14
|
-
* Upload a custom medical code system with codes and descriptions for use in code extraction.
|
|
14
|
+
* Upload a custom medical code system with codes and descriptions for use in code extraction. Requires a paid plan.
|
|
15
15
|
* Upon upload, construe generates embeddings for all of the codes in the code system and stores them in the vector database so you can
|
|
16
16
|
* subsequently use the code system for construe/extract and lang2fhir/create (coming soon!)
|
|
17
17
|
*
|
|
@@ -35,7 +35,9 @@ export declare class Construe {
|
|
|
35
35
|
uploadCodeSystem(request: phenoml.construe.UploadRequest, requestOptions?: Construe.RequestOptions): core.HttpResponsePromise<phenoml.construe.ConstrueUploadCodeSystemResponse>;
|
|
36
36
|
private __uploadCodeSystem;
|
|
37
37
|
/**
|
|
38
|
-
* Converts natural language text into structured medical codes
|
|
38
|
+
* Converts natural language text into structured medical codes.
|
|
39
|
+
*
|
|
40
|
+
* Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
|
|
39
41
|
*
|
|
40
42
|
* @param {phenoml.construe.ExtractRequest} request
|
|
41
43
|
* @param {Construe.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -53,7 +55,7 @@ export declare class Construe {
|
|
|
53
55
|
extractCodes(request: phenoml.construe.ExtractRequest, requestOptions?: Construe.RequestOptions): core.HttpResponsePromise<phenoml.construe.ExtractCodesResult>;
|
|
54
56
|
private __extractCodes;
|
|
55
57
|
/**
|
|
56
|
-
* Returns
|
|
58
|
+
* Returns the terminology server's catalog of available code systems, including both built-in standard terminologies and custom uploaded systems.
|
|
57
59
|
*
|
|
58
60
|
* @param {Construe.RequestOptions} requestOptions - Request-specific configuration.
|
|
59
61
|
*
|
|
@@ -66,7 +68,9 @@ export declare class Construe {
|
|
|
66
68
|
listAvailableCodeSystems(requestOptions?: Construe.RequestOptions): core.HttpResponsePromise<phenoml.construe.ListCodeSystemsResponse>;
|
|
67
69
|
private __listAvailableCodeSystems;
|
|
68
70
|
/**
|
|
69
|
-
* Returns a paginated list of all codes in the specified code system.
|
|
71
|
+
* Returns a paginated list of all codes in the specified code system from the terminology server.
|
|
72
|
+
*
|
|
73
|
+
* Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
|
|
70
74
|
*
|
|
71
75
|
* @param {string} codesystem - Code system name (e.g., "ICD-10-CM", "SNOMED_CT_US_LITE")
|
|
72
76
|
* @param {phenoml.construe.GetConstrueCodesCodesystemRequest} request
|
|
@@ -87,7 +91,9 @@ export declare class Construe {
|
|
|
87
91
|
listCodesInACodeSystem(codesystem: string, request?: phenoml.construe.GetConstrueCodesCodesystemRequest, requestOptions?: Construe.RequestOptions): core.HttpResponsePromise<phenoml.construe.ListCodesResponse>;
|
|
88
92
|
private __listCodesInACodeSystem;
|
|
89
93
|
/**
|
|
90
|
-
*
|
|
94
|
+
* Looks up a specific code in the terminology server and returns its details.
|
|
95
|
+
*
|
|
96
|
+
* Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
|
|
91
97
|
*
|
|
92
98
|
* @param {string} codesystem - Code system name
|
|
93
99
|
* @param {string} codeId - The code identifier
|
|
@@ -123,6 +129,8 @@ export declare class Construe {
|
|
|
123
129
|
*
|
|
124
130
|
* See also: `/search/text` for faster keyword-based lookup with typo tolerance.
|
|
125
131
|
*
|
|
132
|
+
* Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
|
|
133
|
+
*
|
|
126
134
|
* @param {string} codesystem - Code system name
|
|
127
135
|
* @param {phenoml.construe.GetConstrueCodesCodesystemSearchSemanticRequest} request
|
|
128
136
|
* @param {Construe.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -161,6 +169,8 @@ export declare class Construe {
|
|
|
161
169
|
*
|
|
162
170
|
* See also: `/search/semantic` for finding conceptually similar codes.
|
|
163
171
|
*
|
|
172
|
+
* Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
|
|
173
|
+
*
|
|
164
174
|
* @param {string} codesystem - Code system name
|
|
165
175
|
* @param {phenoml.construe.GetConstrueCodesCodesystemSearchTextRequest} request
|
|
166
176
|
* @param {Construe.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -173,13 +183,13 @@ export declare class Construe {
|
|
|
173
183
|
* @throws {@link phenoml.construe.ServiceUnavailableError}
|
|
174
184
|
*
|
|
175
185
|
* @example
|
|
176
|
-
* await client.construe.
|
|
186
|
+
* await client.construe.terminologyServerTextSearch("ICD-10-CM", {
|
|
177
187
|
* q: "E11.65",
|
|
178
188
|
* version: "version",
|
|
179
189
|
* limit: 1
|
|
180
190
|
* })
|
|
181
191
|
*/
|
|
182
|
-
|
|
183
|
-
private
|
|
192
|
+
terminologyServerTextSearch(codesystem: string, request: phenoml.construe.GetConstrueCodesCodesystemSearchTextRequest, requestOptions?: Construe.RequestOptions): core.HttpResponsePromise<phenoml.construe.TextSearchResponse>;
|
|
193
|
+
private __terminologyServerTextSearch;
|
|
184
194
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
185
195
|
}
|
|
@@ -54,7 +54,7 @@ class Construe {
|
|
|
54
54
|
this._options = _options;
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
|
-
* Upload a custom medical code system with codes and descriptions for use in code extraction.
|
|
57
|
+
* Upload a custom medical code system with codes and descriptions for use in code extraction. Requires a paid plan.
|
|
58
58
|
* Upon upload, construe generates embeddings for all of the codes in the code system and stores them in the vector database so you can
|
|
59
59
|
* subsequently use the code system for construe/extract and lang2fhir/create (coming soon!)
|
|
60
60
|
*
|
|
@@ -138,7 +138,9 @@ class Construe {
|
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
140
|
/**
|
|
141
|
-
* Converts natural language text into structured medical codes
|
|
141
|
+
* Converts natural language text into structured medical codes.
|
|
142
|
+
*
|
|
143
|
+
* Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
|
|
142
144
|
*
|
|
143
145
|
* @param {phenoml.construe.ExtractRequest} request
|
|
144
146
|
* @param {Construe.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -211,7 +213,7 @@ class Construe {
|
|
|
211
213
|
});
|
|
212
214
|
}
|
|
213
215
|
/**
|
|
214
|
-
* Returns
|
|
216
|
+
* Returns the terminology server's catalog of available code systems, including both built-in standard terminologies and custom uploaded systems.
|
|
215
217
|
*
|
|
216
218
|
* @param {Construe.RequestOptions} requestOptions - Request-specific configuration.
|
|
217
219
|
*
|
|
@@ -275,7 +277,9 @@ class Construe {
|
|
|
275
277
|
});
|
|
276
278
|
}
|
|
277
279
|
/**
|
|
278
|
-
* Returns a paginated list of all codes in the specified code system.
|
|
280
|
+
* Returns a paginated list of all codes in the specified code system from the terminology server.
|
|
281
|
+
*
|
|
282
|
+
* Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
|
|
279
283
|
*
|
|
280
284
|
* @param {string} codesystem - Code system name (e.g., "ICD-10-CM", "SNOMED_CT_US_LITE")
|
|
281
285
|
* @param {phenoml.construe.GetConstrueCodesCodesystemRequest} request
|
|
@@ -359,7 +363,9 @@ class Construe {
|
|
|
359
363
|
});
|
|
360
364
|
}
|
|
361
365
|
/**
|
|
362
|
-
*
|
|
366
|
+
* Looks up a specific code in the terminology server and returns its details.
|
|
367
|
+
*
|
|
368
|
+
* Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
|
|
363
369
|
*
|
|
364
370
|
* @param {string} codesystem - Code system name
|
|
365
371
|
* @param {string} codeId - The code identifier
|
|
@@ -452,6 +458,8 @@ class Construe {
|
|
|
452
458
|
*
|
|
453
459
|
* See also: `/search/text` for faster keyword-based lookup with typo tolerance.
|
|
454
460
|
*
|
|
461
|
+
* Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
|
|
462
|
+
*
|
|
455
463
|
* @param {string} codesystem - Code system name
|
|
456
464
|
* @param {phenoml.construe.GetConstrueCodesCodesystemSearchSemanticRequest} request
|
|
457
465
|
* @param {Construe.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -554,6 +562,8 @@ class Construe {
|
|
|
554
562
|
*
|
|
555
563
|
* See also: `/search/semantic` for finding conceptually similar codes.
|
|
556
564
|
*
|
|
565
|
+
* Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
|
|
566
|
+
*
|
|
557
567
|
* @param {string} codesystem - Code system name
|
|
558
568
|
* @param {phenoml.construe.GetConstrueCodesCodesystemSearchTextRequest} request
|
|
559
569
|
* @param {Construe.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -566,16 +576,16 @@ class Construe {
|
|
|
566
576
|
* @throws {@link phenoml.construe.ServiceUnavailableError}
|
|
567
577
|
*
|
|
568
578
|
* @example
|
|
569
|
-
* await client.construe.
|
|
579
|
+
* await client.construe.terminologyServerTextSearch("ICD-10-CM", {
|
|
570
580
|
* q: "E11.65",
|
|
571
581
|
* version: "version",
|
|
572
582
|
* limit: 1
|
|
573
583
|
* })
|
|
574
584
|
*/
|
|
575
|
-
|
|
576
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
585
|
+
terminologyServerTextSearch(codesystem, request, requestOptions) {
|
|
586
|
+
return core.HttpResponsePromise.fromPromise(this.__terminologyServerTextSearch(codesystem, request, requestOptions));
|
|
577
587
|
}
|
|
578
|
-
|
|
588
|
+
__terminologyServerTextSearch(codesystem, request, requestOptions) {
|
|
579
589
|
return __awaiter(this, void 0, void 0, function* () {
|
|
580
590
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
581
591
|
const { q, version, limit } = request;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A reference to source text that led to a code extraction
|
|
3
|
+
*/
|
|
4
|
+
export interface Citation {
|
|
5
|
+
/** The exact text span containing evidence for the code */
|
|
6
|
+
text: string;
|
|
7
|
+
/** Starting byte offset in the original input text (0-indexed) */
|
|
8
|
+
begin_offset: number;
|
|
9
|
+
/** Ending byte offset (exclusive), such that input[begin_offset:end_offset] == text */
|
|
10
|
+
end_offset: number;
|
|
11
|
+
}
|
|
@@ -23,6 +23,14 @@ export interface ExtractRequestConfig {
|
|
|
23
23
|
include_ancestors?: boolean;
|
|
24
24
|
/** Whether to include codes that failed validation in the results */
|
|
25
25
|
include_invalid?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Whether to include source text citations for each extracted code.
|
|
28
|
+
* Citations show the exact text spans (with character offsets) that led to each code.
|
|
29
|
+
* Only available when using chunking_method: "sentences".
|
|
30
|
+
* The "none" method returns full text as one chunk (not useful for citations).
|
|
31
|
+
* LLM-based chunking (paragraphs, topics) does not support citations.
|
|
32
|
+
*/
|
|
33
|
+
include_citations?: boolean;
|
|
26
34
|
}
|
|
27
35
|
export declare namespace ExtractRequestConfig {
|
|
28
36
|
/** Method for splitting input text into chunks before code extraction */
|
|
@@ -12,7 +12,9 @@ export interface ExtractRequestSystem {
|
|
|
12
12
|
* * CPT - version 2025
|
|
13
13
|
*
|
|
14
14
|
* Custom systems:
|
|
15
|
-
* * Any valid system name
|
|
15
|
+
* * Any valid system name uploaded via /construe/upload. Requires a paid plan.
|
|
16
|
+
*
|
|
17
|
+
* Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
|
|
16
18
|
*/
|
|
17
19
|
name?: string;
|
|
18
20
|
/** Code system version. Must match the version available in your environment. */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type * as phenoml from "../../../index.js";
|
|
1
2
|
export interface ExtractedCodeResult {
|
|
2
3
|
/** The extracted code */
|
|
3
4
|
code: string;
|
|
@@ -9,4 +10,15 @@ export interface ExtractedCodeResult {
|
|
|
9
10
|
longDescription?: string;
|
|
10
11
|
/** Explanation for why this code was extracted (if include_rationale is true) */
|
|
11
12
|
rationale?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Whether this code is an ancestor (parent) of an extracted code rather than directly extracted.
|
|
15
|
+
* Only present when include_ancestors is true.
|
|
16
|
+
*/
|
|
17
|
+
is_ancestor?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Source text references showing where this code was found in the input.
|
|
20
|
+
* Only present when include_citations is true and chunking method supports it.
|
|
21
|
+
* Ancestor codes do not receive citations.
|
|
22
|
+
*/
|
|
23
|
+
citations?: phenoml.construe.Citation[];
|
|
12
24
|
}
|
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Citation.js"), exports);
|
|
17
18
|
__exportStar(require("./CodeResponse.js"), exports);
|
|
18
19
|
__exportStar(require("./CodeSystemDetails.js"), exports);
|
|
19
20
|
__exportStar(require("./CodeSystemInfo.js"), exports);
|
|
@@ -30,6 +30,7 @@ export declare class Fhir {
|
|
|
30
30
|
* @throws {@link phenoml.fhir.UnauthorizedError}
|
|
31
31
|
* @throws {@link phenoml.fhir.NotFoundError}
|
|
32
32
|
* @throws {@link phenoml.fhir.InternalServerError}
|
|
33
|
+
* @throws {@link phenoml.fhir.BadGatewayError}
|
|
33
34
|
*
|
|
34
35
|
* @example
|
|
35
36
|
* await client.fhir.search("550e8400-e29b-41d4-a716-446655440000", "Patient", {
|
|
@@ -58,6 +59,7 @@ export declare class Fhir {
|
|
|
58
59
|
* @throws {@link phenoml.fhir.BadRequestError}
|
|
59
60
|
* @throws {@link phenoml.fhir.UnauthorizedError}
|
|
60
61
|
* @throws {@link phenoml.fhir.InternalServerError}
|
|
62
|
+
* @throws {@link phenoml.fhir.BadGatewayError}
|
|
61
63
|
*
|
|
62
64
|
* @example
|
|
63
65
|
* await client.fhir.create("550e8400-e29b-41d4-a716-446655440000", "Patient", {
|
|
@@ -99,6 +101,7 @@ export declare class Fhir {
|
|
|
99
101
|
* @throws {@link phenoml.fhir.BadRequestError}
|
|
100
102
|
* @throws {@link phenoml.fhir.UnauthorizedError}
|
|
101
103
|
* @throws {@link phenoml.fhir.InternalServerError}
|
|
104
|
+
* @throws {@link phenoml.fhir.BadGatewayError}
|
|
102
105
|
*
|
|
103
106
|
* @example
|
|
104
107
|
* await client.fhir.upsert("550e8400-e29b-41d4-a716-446655440000", "Patient", {
|
|
@@ -143,6 +146,7 @@ export declare class Fhir {
|
|
|
143
146
|
* @throws {@link phenoml.fhir.UnauthorizedError}
|
|
144
147
|
* @throws {@link phenoml.fhir.NotFoundError}
|
|
145
148
|
* @throws {@link phenoml.fhir.InternalServerError}
|
|
149
|
+
* @throws {@link phenoml.fhir.BadGatewayError}
|
|
146
150
|
*
|
|
147
151
|
* @example
|
|
148
152
|
* await client.fhir.delete("550e8400-e29b-41d4-a716-446655440000", "Patient", {
|
|
@@ -177,6 +181,7 @@ export declare class Fhir {
|
|
|
177
181
|
* @throws {@link phenoml.fhir.UnauthorizedError}
|
|
178
182
|
* @throws {@link phenoml.fhir.NotFoundError}
|
|
179
183
|
* @throws {@link phenoml.fhir.InternalServerError}
|
|
184
|
+
* @throws {@link phenoml.fhir.BadGatewayError}
|
|
180
185
|
*
|
|
181
186
|
* @example
|
|
182
187
|
* await client.fhir.patch("550e8400-e29b-41d4-a716-446655440000", "Patient", {
|
|
@@ -258,6 +263,7 @@ export declare class Fhir {
|
|
|
258
263
|
* @throws {@link phenoml.fhir.BadRequestError}
|
|
259
264
|
* @throws {@link phenoml.fhir.UnauthorizedError}
|
|
260
265
|
* @throws {@link phenoml.fhir.InternalServerError}
|
|
266
|
+
* @throws {@link phenoml.fhir.BadGatewayError}
|
|
261
267
|
*
|
|
262
268
|
* @example
|
|
263
269
|
* await client.fhir.executeBundle("550e8400-e29b-41d4-a716-446655440000", {
|
|
@@ -74,6 +74,7 @@ class Fhir {
|
|
|
74
74
|
* @throws {@link phenoml.fhir.UnauthorizedError}
|
|
75
75
|
* @throws {@link phenoml.fhir.NotFoundError}
|
|
76
76
|
* @throws {@link phenoml.fhir.InternalServerError}
|
|
77
|
+
* @throws {@link phenoml.fhir.BadGatewayError}
|
|
77
78
|
*
|
|
78
79
|
* @example
|
|
79
80
|
* await client.fhir.search("550e8400-e29b-41d4-a716-446655440000", "Patient", {
|
|
@@ -119,6 +120,8 @@ class Fhir {
|
|
|
119
120
|
throw new phenoml.fhir.NotFoundError(_response.error.body, _response.rawResponse);
|
|
120
121
|
case 500:
|
|
121
122
|
throw new phenoml.fhir.InternalServerError(_response.error.body, _response.rawResponse);
|
|
123
|
+
case 502:
|
|
124
|
+
throw new phenoml.fhir.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
122
125
|
default:
|
|
123
126
|
throw new errors.phenomlError({
|
|
124
127
|
statusCode: _response.error.statusCode,
|
|
@@ -163,6 +166,7 @@ class Fhir {
|
|
|
163
166
|
* @throws {@link phenoml.fhir.BadRequestError}
|
|
164
167
|
* @throws {@link phenoml.fhir.UnauthorizedError}
|
|
165
168
|
* @throws {@link phenoml.fhir.InternalServerError}
|
|
169
|
+
* @throws {@link phenoml.fhir.BadGatewayError}
|
|
166
170
|
*
|
|
167
171
|
* @example
|
|
168
172
|
* await client.fhir.create("550e8400-e29b-41d4-a716-446655440000", "Patient", {
|
|
@@ -218,6 +222,8 @@ class Fhir {
|
|
|
218
222
|
throw new phenoml.fhir.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
219
223
|
case 500:
|
|
220
224
|
throw new phenoml.fhir.InternalServerError(_response.error.body, _response.rawResponse);
|
|
225
|
+
case 502:
|
|
226
|
+
throw new phenoml.fhir.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
221
227
|
default:
|
|
222
228
|
throw new errors.phenomlError({
|
|
223
229
|
statusCode: _response.error.statusCode,
|
|
@@ -262,6 +268,7 @@ class Fhir {
|
|
|
262
268
|
* @throws {@link phenoml.fhir.BadRequestError}
|
|
263
269
|
* @throws {@link phenoml.fhir.UnauthorizedError}
|
|
264
270
|
* @throws {@link phenoml.fhir.InternalServerError}
|
|
271
|
+
* @throws {@link phenoml.fhir.BadGatewayError}
|
|
265
272
|
*
|
|
266
273
|
* @example
|
|
267
274
|
* await client.fhir.upsert("550e8400-e29b-41d4-a716-446655440000", "Patient", {
|
|
@@ -319,6 +326,8 @@ class Fhir {
|
|
|
319
326
|
throw new phenoml.fhir.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
320
327
|
case 500:
|
|
321
328
|
throw new phenoml.fhir.InternalServerError(_response.error.body, _response.rawResponse);
|
|
329
|
+
case 502:
|
|
330
|
+
throw new phenoml.fhir.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
322
331
|
default:
|
|
323
332
|
throw new errors.phenomlError({
|
|
324
333
|
statusCode: _response.error.statusCode,
|
|
@@ -364,6 +373,7 @@ class Fhir {
|
|
|
364
373
|
* @throws {@link phenoml.fhir.UnauthorizedError}
|
|
365
374
|
* @throws {@link phenoml.fhir.NotFoundError}
|
|
366
375
|
* @throws {@link phenoml.fhir.InternalServerError}
|
|
376
|
+
* @throws {@link phenoml.fhir.BadGatewayError}
|
|
367
377
|
*
|
|
368
378
|
* @example
|
|
369
379
|
* await client.fhir.delete("550e8400-e29b-41d4-a716-446655440000", "Patient", {
|
|
@@ -405,6 +415,8 @@ class Fhir {
|
|
|
405
415
|
throw new phenoml.fhir.NotFoundError(_response.error.body, _response.rawResponse);
|
|
406
416
|
case 500:
|
|
407
417
|
throw new phenoml.fhir.InternalServerError(_response.error.body, _response.rawResponse);
|
|
418
|
+
case 502:
|
|
419
|
+
throw new phenoml.fhir.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
408
420
|
default:
|
|
409
421
|
throw new errors.phenomlError({
|
|
410
422
|
statusCode: _response.error.statusCode,
|
|
@@ -455,6 +467,7 @@ class Fhir {
|
|
|
455
467
|
* @throws {@link phenoml.fhir.UnauthorizedError}
|
|
456
468
|
* @throws {@link phenoml.fhir.NotFoundError}
|
|
457
469
|
* @throws {@link phenoml.fhir.InternalServerError}
|
|
470
|
+
* @throws {@link phenoml.fhir.BadGatewayError}
|
|
458
471
|
*
|
|
459
472
|
* @example
|
|
460
473
|
* await client.fhir.patch("550e8400-e29b-41d4-a716-446655440000", "Patient", {
|
|
@@ -555,6 +568,8 @@ class Fhir {
|
|
|
555
568
|
throw new phenoml.fhir.NotFoundError(_response.error.body, _response.rawResponse);
|
|
556
569
|
case 500:
|
|
557
570
|
throw new phenoml.fhir.InternalServerError(_response.error.body, _response.rawResponse);
|
|
571
|
+
case 502:
|
|
572
|
+
throw new phenoml.fhir.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
558
573
|
default:
|
|
559
574
|
throw new errors.phenomlError({
|
|
560
575
|
statusCode: _response.error.statusCode,
|
|
@@ -596,6 +611,7 @@ class Fhir {
|
|
|
596
611
|
* @throws {@link phenoml.fhir.BadRequestError}
|
|
597
612
|
* @throws {@link phenoml.fhir.UnauthorizedError}
|
|
598
613
|
* @throws {@link phenoml.fhir.InternalServerError}
|
|
614
|
+
* @throws {@link phenoml.fhir.BadGatewayError}
|
|
599
615
|
*
|
|
600
616
|
* @example
|
|
601
617
|
* await client.fhir.executeBundle("550e8400-e29b-41d4-a716-446655440000", {
|
|
@@ -670,6 +686,8 @@ class Fhir {
|
|
|
670
686
|
throw new phenoml.fhir.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
671
687
|
case 500:
|
|
672
688
|
throw new phenoml.fhir.InternalServerError(_response.error.body, _response.rawResponse);
|
|
689
|
+
case 502:
|
|
690
|
+
throw new phenoml.fhir.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
673
691
|
default:
|
|
674
692
|
throw new errors.phenomlError({
|
|
675
693
|
statusCode: _response.error.statusCode,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type * as core from "../../../../core/index.js";
|
|
2
|
+
import * as errors from "../../../../errors/index.js";
|
|
3
|
+
import type * as phenoml from "../../../index.js";
|
|
4
|
+
export declare class BadGatewayError extends errors.phenomlError {
|
|
5
|
+
constructor(body: phenoml.fhir.ErrorResponse, rawResponse?: core.RawResponse);
|
|
6
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.BadGatewayError = void 0;
|
|
38
|
+
const errors = __importStar(require("../../../../errors/index.js"));
|
|
39
|
+
class BadGatewayError extends errors.phenomlError {
|
|
40
|
+
constructor(body, rawResponse) {
|
|
41
|
+
super({
|
|
42
|
+
message: "BadGatewayError",
|
|
43
|
+
statusCode: 502,
|
|
44
|
+
body: body,
|
|
45
|
+
rawResponse: rawResponse,
|
|
46
|
+
});
|
|
47
|
+
Object.setPrototypeOf(this, BadGatewayError.prototype);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.BadGatewayError = BadGatewayError;
|
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./BadGatewayError.js"), exports);
|
|
17
18
|
__exportStar(require("./BadRequestError.js"), exports);
|
|
18
19
|
__exportStar(require("./InternalServerError.js"), exports);
|
|
19
20
|
__exportStar(require("./NotFoundError.js"), exports);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "3.
|
|
1
|
+
export declare const SDK_VERSION = "3.1.0";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/Client.mjs
CHANGED
|
@@ -16,8 +16,8 @@ export class phenomlClient {
|
|
|
16
16
|
this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
|
|
17
17
|
"X-Fern-Language": "JavaScript",
|
|
18
18
|
"X-Fern-SDK-Name": "phenoml",
|
|
19
|
-
"X-Fern-SDK-Version": "3.
|
|
20
|
-
"User-Agent": "phenoml/3.
|
|
19
|
+
"X-Fern-SDK-Version": "3.1.0",
|
|
20
|
+
"User-Agent": "phenoml/3.1.0",
|
|
21
21
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
22
22
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
23
23
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
|
@@ -11,7 +11,7 @@ export declare class Construe {
|
|
|
11
11
|
protected readonly _options: Construe.Options;
|
|
12
12
|
constructor(_options: Construe.Options);
|
|
13
13
|
/**
|
|
14
|
-
* Upload a custom medical code system with codes and descriptions for use in code extraction.
|
|
14
|
+
* Upload a custom medical code system with codes and descriptions for use in code extraction. Requires a paid plan.
|
|
15
15
|
* Upon upload, construe generates embeddings for all of the codes in the code system and stores them in the vector database so you can
|
|
16
16
|
* subsequently use the code system for construe/extract and lang2fhir/create (coming soon!)
|
|
17
17
|
*
|
|
@@ -35,7 +35,9 @@ export declare class Construe {
|
|
|
35
35
|
uploadCodeSystem(request: phenoml.construe.UploadRequest, requestOptions?: Construe.RequestOptions): core.HttpResponsePromise<phenoml.construe.ConstrueUploadCodeSystemResponse>;
|
|
36
36
|
private __uploadCodeSystem;
|
|
37
37
|
/**
|
|
38
|
-
* Converts natural language text into structured medical codes
|
|
38
|
+
* Converts natural language text into structured medical codes.
|
|
39
|
+
*
|
|
40
|
+
* Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
|
|
39
41
|
*
|
|
40
42
|
* @param {phenoml.construe.ExtractRequest} request
|
|
41
43
|
* @param {Construe.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -53,7 +55,7 @@ export declare class Construe {
|
|
|
53
55
|
extractCodes(request: phenoml.construe.ExtractRequest, requestOptions?: Construe.RequestOptions): core.HttpResponsePromise<phenoml.construe.ExtractCodesResult>;
|
|
54
56
|
private __extractCodes;
|
|
55
57
|
/**
|
|
56
|
-
* Returns
|
|
58
|
+
* Returns the terminology server's catalog of available code systems, including both built-in standard terminologies and custom uploaded systems.
|
|
57
59
|
*
|
|
58
60
|
* @param {Construe.RequestOptions} requestOptions - Request-specific configuration.
|
|
59
61
|
*
|
|
@@ -66,7 +68,9 @@ export declare class Construe {
|
|
|
66
68
|
listAvailableCodeSystems(requestOptions?: Construe.RequestOptions): core.HttpResponsePromise<phenoml.construe.ListCodeSystemsResponse>;
|
|
67
69
|
private __listAvailableCodeSystems;
|
|
68
70
|
/**
|
|
69
|
-
* Returns a paginated list of all codes in the specified code system.
|
|
71
|
+
* Returns a paginated list of all codes in the specified code system from the terminology server.
|
|
72
|
+
*
|
|
73
|
+
* Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
|
|
70
74
|
*
|
|
71
75
|
* @param {string} codesystem - Code system name (e.g., "ICD-10-CM", "SNOMED_CT_US_LITE")
|
|
72
76
|
* @param {phenoml.construe.GetConstrueCodesCodesystemRequest} request
|
|
@@ -87,7 +91,9 @@ export declare class Construe {
|
|
|
87
91
|
listCodesInACodeSystem(codesystem: string, request?: phenoml.construe.GetConstrueCodesCodesystemRequest, requestOptions?: Construe.RequestOptions): core.HttpResponsePromise<phenoml.construe.ListCodesResponse>;
|
|
88
92
|
private __listCodesInACodeSystem;
|
|
89
93
|
/**
|
|
90
|
-
*
|
|
94
|
+
* Looks up a specific code in the terminology server and returns its details.
|
|
95
|
+
*
|
|
96
|
+
* Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
|
|
91
97
|
*
|
|
92
98
|
* @param {string} codesystem - Code system name
|
|
93
99
|
* @param {string} codeId - The code identifier
|
|
@@ -123,6 +129,8 @@ export declare class Construe {
|
|
|
123
129
|
*
|
|
124
130
|
* See also: `/search/text` for faster keyword-based lookup with typo tolerance.
|
|
125
131
|
*
|
|
132
|
+
* Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
|
|
133
|
+
*
|
|
126
134
|
* @param {string} codesystem - Code system name
|
|
127
135
|
* @param {phenoml.construe.GetConstrueCodesCodesystemSearchSemanticRequest} request
|
|
128
136
|
* @param {Construe.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -161,6 +169,8 @@ export declare class Construe {
|
|
|
161
169
|
*
|
|
162
170
|
* See also: `/search/semantic` for finding conceptually similar codes.
|
|
163
171
|
*
|
|
172
|
+
* Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
|
|
173
|
+
*
|
|
164
174
|
* @param {string} codesystem - Code system name
|
|
165
175
|
* @param {phenoml.construe.GetConstrueCodesCodesystemSearchTextRequest} request
|
|
166
176
|
* @param {Construe.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -173,13 +183,13 @@ export declare class Construe {
|
|
|
173
183
|
* @throws {@link phenoml.construe.ServiceUnavailableError}
|
|
174
184
|
*
|
|
175
185
|
* @example
|
|
176
|
-
* await client.construe.
|
|
186
|
+
* await client.construe.terminologyServerTextSearch("ICD-10-CM", {
|
|
177
187
|
* q: "E11.65",
|
|
178
188
|
* version: "version",
|
|
179
189
|
* limit: 1
|
|
180
190
|
* })
|
|
181
191
|
*/
|
|
182
|
-
|
|
183
|
-
private
|
|
192
|
+
terminologyServerTextSearch(codesystem: string, request: phenoml.construe.GetConstrueCodesCodesystemSearchTextRequest, requestOptions?: Construe.RequestOptions): core.HttpResponsePromise<phenoml.construe.TextSearchResponse>;
|
|
193
|
+
private __terminologyServerTextSearch;
|
|
184
194
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
185
195
|
}
|
|
@@ -18,7 +18,7 @@ export class Construe {
|
|
|
18
18
|
this._options = _options;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
* Upload a custom medical code system with codes and descriptions for use in code extraction.
|
|
21
|
+
* Upload a custom medical code system with codes and descriptions for use in code extraction. Requires a paid plan.
|
|
22
22
|
* Upon upload, construe generates embeddings for all of the codes in the code system and stores them in the vector database so you can
|
|
23
23
|
* subsequently use the code system for construe/extract and lang2fhir/create (coming soon!)
|
|
24
24
|
*
|
|
@@ -102,7 +102,9 @@ export class Construe {
|
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
104
|
/**
|
|
105
|
-
* Converts natural language text into structured medical codes
|
|
105
|
+
* Converts natural language text into structured medical codes.
|
|
106
|
+
*
|
|
107
|
+
* Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
|
|
106
108
|
*
|
|
107
109
|
* @param {phenoml.construe.ExtractRequest} request
|
|
108
110
|
* @param {Construe.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -175,7 +177,7 @@ export class Construe {
|
|
|
175
177
|
});
|
|
176
178
|
}
|
|
177
179
|
/**
|
|
178
|
-
* Returns
|
|
180
|
+
* Returns the terminology server's catalog of available code systems, including both built-in standard terminologies and custom uploaded systems.
|
|
179
181
|
*
|
|
180
182
|
* @param {Construe.RequestOptions} requestOptions - Request-specific configuration.
|
|
181
183
|
*
|
|
@@ -239,7 +241,9 @@ export class Construe {
|
|
|
239
241
|
});
|
|
240
242
|
}
|
|
241
243
|
/**
|
|
242
|
-
* Returns a paginated list of all codes in the specified code system.
|
|
244
|
+
* Returns a paginated list of all codes in the specified code system from the terminology server.
|
|
245
|
+
*
|
|
246
|
+
* Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
|
|
243
247
|
*
|
|
244
248
|
* @param {string} codesystem - Code system name (e.g., "ICD-10-CM", "SNOMED_CT_US_LITE")
|
|
245
249
|
* @param {phenoml.construe.GetConstrueCodesCodesystemRequest} request
|
|
@@ -323,7 +327,9 @@ export class Construe {
|
|
|
323
327
|
});
|
|
324
328
|
}
|
|
325
329
|
/**
|
|
326
|
-
*
|
|
330
|
+
* Looks up a specific code in the terminology server and returns its details.
|
|
331
|
+
*
|
|
332
|
+
* Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
|
|
327
333
|
*
|
|
328
334
|
* @param {string} codesystem - Code system name
|
|
329
335
|
* @param {string} codeId - The code identifier
|
|
@@ -416,6 +422,8 @@ export class Construe {
|
|
|
416
422
|
*
|
|
417
423
|
* See also: `/search/text` for faster keyword-based lookup with typo tolerance.
|
|
418
424
|
*
|
|
425
|
+
* Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
|
|
426
|
+
*
|
|
419
427
|
* @param {string} codesystem - Code system name
|
|
420
428
|
* @param {phenoml.construe.GetConstrueCodesCodesystemSearchSemanticRequest} request
|
|
421
429
|
* @param {Construe.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -518,6 +526,8 @@ export class Construe {
|
|
|
518
526
|
*
|
|
519
527
|
* See also: `/search/semantic` for finding conceptually similar codes.
|
|
520
528
|
*
|
|
529
|
+
* Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
|
|
530
|
+
*
|
|
521
531
|
* @param {string} codesystem - Code system name
|
|
522
532
|
* @param {phenoml.construe.GetConstrueCodesCodesystemSearchTextRequest} request
|
|
523
533
|
* @param {Construe.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -530,16 +540,16 @@ export class Construe {
|
|
|
530
540
|
* @throws {@link phenoml.construe.ServiceUnavailableError}
|
|
531
541
|
*
|
|
532
542
|
* @example
|
|
533
|
-
* await client.construe.
|
|
543
|
+
* await client.construe.terminologyServerTextSearch("ICD-10-CM", {
|
|
534
544
|
* q: "E11.65",
|
|
535
545
|
* version: "version",
|
|
536
546
|
* limit: 1
|
|
537
547
|
* })
|
|
538
548
|
*/
|
|
539
|
-
|
|
540
|
-
return core.HttpResponsePromise.fromPromise(this.
|
|
549
|
+
terminologyServerTextSearch(codesystem, request, requestOptions) {
|
|
550
|
+
return core.HttpResponsePromise.fromPromise(this.__terminologyServerTextSearch(codesystem, request, requestOptions));
|
|
541
551
|
}
|
|
542
|
-
|
|
552
|
+
__terminologyServerTextSearch(codesystem, request, requestOptions) {
|
|
543
553
|
return __awaiter(this, void 0, void 0, function* () {
|
|
544
554
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
545
555
|
const { q, version, limit } = request;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A reference to source text that led to a code extraction
|
|
3
|
+
*/
|
|
4
|
+
export interface Citation {
|
|
5
|
+
/** The exact text span containing evidence for the code */
|
|
6
|
+
text: string;
|
|
7
|
+
/** Starting byte offset in the original input text (0-indexed) */
|
|
8
|
+
begin_offset: number;
|
|
9
|
+
/** Ending byte offset (exclusive), such that input[begin_offset:end_offset] == text */
|
|
10
|
+
end_offset: number;
|
|
11
|
+
}
|
|
@@ -23,6 +23,14 @@ export interface ExtractRequestConfig {
|
|
|
23
23
|
include_ancestors?: boolean;
|
|
24
24
|
/** Whether to include codes that failed validation in the results */
|
|
25
25
|
include_invalid?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Whether to include source text citations for each extracted code.
|
|
28
|
+
* Citations show the exact text spans (with character offsets) that led to each code.
|
|
29
|
+
* Only available when using chunking_method: "sentences".
|
|
30
|
+
* The "none" method returns full text as one chunk (not useful for citations).
|
|
31
|
+
* LLM-based chunking (paragraphs, topics) does not support citations.
|
|
32
|
+
*/
|
|
33
|
+
include_citations?: boolean;
|
|
26
34
|
}
|
|
27
35
|
export declare namespace ExtractRequestConfig {
|
|
28
36
|
/** Method for splitting input text into chunks before code extraction */
|
|
@@ -12,7 +12,9 @@ export interface ExtractRequestSystem {
|
|
|
12
12
|
* * CPT - version 2025
|
|
13
13
|
*
|
|
14
14
|
* Custom systems:
|
|
15
|
-
* * Any valid system name
|
|
15
|
+
* * Any valid system name uploaded via /construe/upload. Requires a paid plan.
|
|
16
|
+
*
|
|
17
|
+
* Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
|
|
16
18
|
*/
|
|
17
19
|
name?: string;
|
|
18
20
|
/** Code system version. Must match the version available in your environment. */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type * as phenoml from "../../../index.mjs";
|
|
1
2
|
export interface ExtractedCodeResult {
|
|
2
3
|
/** The extracted code */
|
|
3
4
|
code: string;
|
|
@@ -9,4 +10,15 @@ export interface ExtractedCodeResult {
|
|
|
9
10
|
longDescription?: string;
|
|
10
11
|
/** Explanation for why this code was extracted (if include_rationale is true) */
|
|
11
12
|
rationale?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Whether this code is an ancestor (parent) of an extracted code rather than directly extracted.
|
|
15
|
+
* Only present when include_ancestors is true.
|
|
16
|
+
*/
|
|
17
|
+
is_ancestor?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Source text references showing where this code was found in the input.
|
|
20
|
+
* Only present when include_citations is true and chunking method supports it.
|
|
21
|
+
* Ancestor codes do not receive citations.
|
|
22
|
+
*/
|
|
23
|
+
citations?: phenoml.construe.Citation[];
|
|
12
24
|
}
|
|
@@ -30,6 +30,7 @@ export declare class Fhir {
|
|
|
30
30
|
* @throws {@link phenoml.fhir.UnauthorizedError}
|
|
31
31
|
* @throws {@link phenoml.fhir.NotFoundError}
|
|
32
32
|
* @throws {@link phenoml.fhir.InternalServerError}
|
|
33
|
+
* @throws {@link phenoml.fhir.BadGatewayError}
|
|
33
34
|
*
|
|
34
35
|
* @example
|
|
35
36
|
* await client.fhir.search("550e8400-e29b-41d4-a716-446655440000", "Patient", {
|
|
@@ -58,6 +59,7 @@ export declare class Fhir {
|
|
|
58
59
|
* @throws {@link phenoml.fhir.BadRequestError}
|
|
59
60
|
* @throws {@link phenoml.fhir.UnauthorizedError}
|
|
60
61
|
* @throws {@link phenoml.fhir.InternalServerError}
|
|
62
|
+
* @throws {@link phenoml.fhir.BadGatewayError}
|
|
61
63
|
*
|
|
62
64
|
* @example
|
|
63
65
|
* await client.fhir.create("550e8400-e29b-41d4-a716-446655440000", "Patient", {
|
|
@@ -99,6 +101,7 @@ export declare class Fhir {
|
|
|
99
101
|
* @throws {@link phenoml.fhir.BadRequestError}
|
|
100
102
|
* @throws {@link phenoml.fhir.UnauthorizedError}
|
|
101
103
|
* @throws {@link phenoml.fhir.InternalServerError}
|
|
104
|
+
* @throws {@link phenoml.fhir.BadGatewayError}
|
|
102
105
|
*
|
|
103
106
|
* @example
|
|
104
107
|
* await client.fhir.upsert("550e8400-e29b-41d4-a716-446655440000", "Patient", {
|
|
@@ -143,6 +146,7 @@ export declare class Fhir {
|
|
|
143
146
|
* @throws {@link phenoml.fhir.UnauthorizedError}
|
|
144
147
|
* @throws {@link phenoml.fhir.NotFoundError}
|
|
145
148
|
* @throws {@link phenoml.fhir.InternalServerError}
|
|
149
|
+
* @throws {@link phenoml.fhir.BadGatewayError}
|
|
146
150
|
*
|
|
147
151
|
* @example
|
|
148
152
|
* await client.fhir.delete("550e8400-e29b-41d4-a716-446655440000", "Patient", {
|
|
@@ -177,6 +181,7 @@ export declare class Fhir {
|
|
|
177
181
|
* @throws {@link phenoml.fhir.UnauthorizedError}
|
|
178
182
|
* @throws {@link phenoml.fhir.NotFoundError}
|
|
179
183
|
* @throws {@link phenoml.fhir.InternalServerError}
|
|
184
|
+
* @throws {@link phenoml.fhir.BadGatewayError}
|
|
180
185
|
*
|
|
181
186
|
* @example
|
|
182
187
|
* await client.fhir.patch("550e8400-e29b-41d4-a716-446655440000", "Patient", {
|
|
@@ -258,6 +263,7 @@ export declare class Fhir {
|
|
|
258
263
|
* @throws {@link phenoml.fhir.BadRequestError}
|
|
259
264
|
* @throws {@link phenoml.fhir.UnauthorizedError}
|
|
260
265
|
* @throws {@link phenoml.fhir.InternalServerError}
|
|
266
|
+
* @throws {@link phenoml.fhir.BadGatewayError}
|
|
261
267
|
*
|
|
262
268
|
* @example
|
|
263
269
|
* await client.fhir.executeBundle("550e8400-e29b-41d4-a716-446655440000", {
|
|
@@ -38,6 +38,7 @@ export class Fhir {
|
|
|
38
38
|
* @throws {@link phenoml.fhir.UnauthorizedError}
|
|
39
39
|
* @throws {@link phenoml.fhir.NotFoundError}
|
|
40
40
|
* @throws {@link phenoml.fhir.InternalServerError}
|
|
41
|
+
* @throws {@link phenoml.fhir.BadGatewayError}
|
|
41
42
|
*
|
|
42
43
|
* @example
|
|
43
44
|
* await client.fhir.search("550e8400-e29b-41d4-a716-446655440000", "Patient", {
|
|
@@ -83,6 +84,8 @@ export class Fhir {
|
|
|
83
84
|
throw new phenoml.fhir.NotFoundError(_response.error.body, _response.rawResponse);
|
|
84
85
|
case 500:
|
|
85
86
|
throw new phenoml.fhir.InternalServerError(_response.error.body, _response.rawResponse);
|
|
87
|
+
case 502:
|
|
88
|
+
throw new phenoml.fhir.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
86
89
|
default:
|
|
87
90
|
throw new errors.phenomlError({
|
|
88
91
|
statusCode: _response.error.statusCode,
|
|
@@ -127,6 +130,7 @@ export class Fhir {
|
|
|
127
130
|
* @throws {@link phenoml.fhir.BadRequestError}
|
|
128
131
|
* @throws {@link phenoml.fhir.UnauthorizedError}
|
|
129
132
|
* @throws {@link phenoml.fhir.InternalServerError}
|
|
133
|
+
* @throws {@link phenoml.fhir.BadGatewayError}
|
|
130
134
|
*
|
|
131
135
|
* @example
|
|
132
136
|
* await client.fhir.create("550e8400-e29b-41d4-a716-446655440000", "Patient", {
|
|
@@ -182,6 +186,8 @@ export class Fhir {
|
|
|
182
186
|
throw new phenoml.fhir.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
183
187
|
case 500:
|
|
184
188
|
throw new phenoml.fhir.InternalServerError(_response.error.body, _response.rawResponse);
|
|
189
|
+
case 502:
|
|
190
|
+
throw new phenoml.fhir.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
185
191
|
default:
|
|
186
192
|
throw new errors.phenomlError({
|
|
187
193
|
statusCode: _response.error.statusCode,
|
|
@@ -226,6 +232,7 @@ export class Fhir {
|
|
|
226
232
|
* @throws {@link phenoml.fhir.BadRequestError}
|
|
227
233
|
* @throws {@link phenoml.fhir.UnauthorizedError}
|
|
228
234
|
* @throws {@link phenoml.fhir.InternalServerError}
|
|
235
|
+
* @throws {@link phenoml.fhir.BadGatewayError}
|
|
229
236
|
*
|
|
230
237
|
* @example
|
|
231
238
|
* await client.fhir.upsert("550e8400-e29b-41d4-a716-446655440000", "Patient", {
|
|
@@ -283,6 +290,8 @@ export class Fhir {
|
|
|
283
290
|
throw new phenoml.fhir.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
284
291
|
case 500:
|
|
285
292
|
throw new phenoml.fhir.InternalServerError(_response.error.body, _response.rawResponse);
|
|
293
|
+
case 502:
|
|
294
|
+
throw new phenoml.fhir.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
286
295
|
default:
|
|
287
296
|
throw new errors.phenomlError({
|
|
288
297
|
statusCode: _response.error.statusCode,
|
|
@@ -328,6 +337,7 @@ export class Fhir {
|
|
|
328
337
|
* @throws {@link phenoml.fhir.UnauthorizedError}
|
|
329
338
|
* @throws {@link phenoml.fhir.NotFoundError}
|
|
330
339
|
* @throws {@link phenoml.fhir.InternalServerError}
|
|
340
|
+
* @throws {@link phenoml.fhir.BadGatewayError}
|
|
331
341
|
*
|
|
332
342
|
* @example
|
|
333
343
|
* await client.fhir.delete("550e8400-e29b-41d4-a716-446655440000", "Patient", {
|
|
@@ -369,6 +379,8 @@ export class Fhir {
|
|
|
369
379
|
throw new phenoml.fhir.NotFoundError(_response.error.body, _response.rawResponse);
|
|
370
380
|
case 500:
|
|
371
381
|
throw new phenoml.fhir.InternalServerError(_response.error.body, _response.rawResponse);
|
|
382
|
+
case 502:
|
|
383
|
+
throw new phenoml.fhir.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
372
384
|
default:
|
|
373
385
|
throw new errors.phenomlError({
|
|
374
386
|
statusCode: _response.error.statusCode,
|
|
@@ -419,6 +431,7 @@ export class Fhir {
|
|
|
419
431
|
* @throws {@link phenoml.fhir.UnauthorizedError}
|
|
420
432
|
* @throws {@link phenoml.fhir.NotFoundError}
|
|
421
433
|
* @throws {@link phenoml.fhir.InternalServerError}
|
|
434
|
+
* @throws {@link phenoml.fhir.BadGatewayError}
|
|
422
435
|
*
|
|
423
436
|
* @example
|
|
424
437
|
* await client.fhir.patch("550e8400-e29b-41d4-a716-446655440000", "Patient", {
|
|
@@ -519,6 +532,8 @@ export class Fhir {
|
|
|
519
532
|
throw new phenoml.fhir.NotFoundError(_response.error.body, _response.rawResponse);
|
|
520
533
|
case 500:
|
|
521
534
|
throw new phenoml.fhir.InternalServerError(_response.error.body, _response.rawResponse);
|
|
535
|
+
case 502:
|
|
536
|
+
throw new phenoml.fhir.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
522
537
|
default:
|
|
523
538
|
throw new errors.phenomlError({
|
|
524
539
|
statusCode: _response.error.statusCode,
|
|
@@ -560,6 +575,7 @@ export class Fhir {
|
|
|
560
575
|
* @throws {@link phenoml.fhir.BadRequestError}
|
|
561
576
|
* @throws {@link phenoml.fhir.UnauthorizedError}
|
|
562
577
|
* @throws {@link phenoml.fhir.InternalServerError}
|
|
578
|
+
* @throws {@link phenoml.fhir.BadGatewayError}
|
|
563
579
|
*
|
|
564
580
|
* @example
|
|
565
581
|
* await client.fhir.executeBundle("550e8400-e29b-41d4-a716-446655440000", {
|
|
@@ -634,6 +650,8 @@ export class Fhir {
|
|
|
634
650
|
throw new phenoml.fhir.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
635
651
|
case 500:
|
|
636
652
|
throw new phenoml.fhir.InternalServerError(_response.error.body, _response.rawResponse);
|
|
653
|
+
case 502:
|
|
654
|
+
throw new phenoml.fhir.BadGatewayError(_response.error.body, _response.rawResponse);
|
|
637
655
|
default:
|
|
638
656
|
throw new errors.phenomlError({
|
|
639
657
|
statusCode: _response.error.statusCode,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type * as core from "../../../../core/index.mjs";
|
|
2
|
+
import * as errors from "../../../../errors/index.mjs";
|
|
3
|
+
import type * as phenoml from "../../../index.mjs";
|
|
4
|
+
export declare class BadGatewayError extends errors.phenomlError {
|
|
5
|
+
constructor(body: phenoml.fhir.ErrorResponse, rawResponse?: core.RawResponse);
|
|
6
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
import * as errors from "../../../../errors/index.mjs";
|
|
3
|
+
export class BadGatewayError extends errors.phenomlError {
|
|
4
|
+
constructor(body, rawResponse) {
|
|
5
|
+
super({
|
|
6
|
+
message: "BadGatewayError",
|
|
7
|
+
statusCode: 502,
|
|
8
|
+
body: body,
|
|
9
|
+
rawResponse: rawResponse,
|
|
10
|
+
});
|
|
11
|
+
Object.setPrototypeOf(this, BadGatewayError.prototype);
|
|
12
|
+
}
|
|
13
|
+
}
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "3.
|
|
1
|
+
export declare const SDK_VERSION = "3.1.0";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "3.
|
|
1
|
+
export const SDK_VERSION = "3.1.0";
|
package/package.json
CHANGED
package/reference.md
CHANGED
|
@@ -1153,7 +1153,7 @@ await client.cohort.analyze({
|
|
|
1153
1153
|
<dl>
|
|
1154
1154
|
<dd>
|
|
1155
1155
|
|
|
1156
|
-
Upload a custom medical code system with codes and descriptions for use in code extraction.
|
|
1156
|
+
Upload a custom medical code system with codes and descriptions for use in code extraction. Requires a paid plan.
|
|
1157
1157
|
Upon upload, construe generates embeddings for all of the codes in the code system and stores them in the vector database so you can
|
|
1158
1158
|
subsequently use the code system for construe/extract and lang2fhir/create (coming soon!)
|
|
1159
1159
|
</dd>
|
|
@@ -1223,7 +1223,9 @@ await client.construe.uploadCodeSystem({
|
|
|
1223
1223
|
<dl>
|
|
1224
1224
|
<dd>
|
|
1225
1225
|
|
|
1226
|
-
Converts natural language text into structured medical codes
|
|
1226
|
+
Converts natural language text into structured medical codes.
|
|
1227
|
+
|
|
1228
|
+
Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
|
|
1227
1229
|
</dd>
|
|
1228
1230
|
</dl>
|
|
1229
1231
|
</dd>
|
|
@@ -1288,7 +1290,7 @@ await client.construe.extractCodes({
|
|
|
1288
1290
|
<dl>
|
|
1289
1291
|
<dd>
|
|
1290
1292
|
|
|
1291
|
-
Returns
|
|
1293
|
+
Returns the terminology server's catalog of available code systems, including both built-in standard terminologies and custom uploaded systems.
|
|
1292
1294
|
</dd>
|
|
1293
1295
|
</dl>
|
|
1294
1296
|
</dd>
|
|
@@ -1343,7 +1345,9 @@ await client.construe.listAvailableCodeSystems();
|
|
|
1343
1345
|
<dl>
|
|
1344
1346
|
<dd>
|
|
1345
1347
|
|
|
1346
|
-
Returns a paginated list of all codes in the specified code system.
|
|
1348
|
+
Returns a paginated list of all codes in the specified code system from the terminology server.
|
|
1349
|
+
|
|
1350
|
+
Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
|
|
1347
1351
|
</dd>
|
|
1348
1352
|
</dl>
|
|
1349
1353
|
</dd>
|
|
@@ -1418,7 +1422,9 @@ await client.construe.listCodesInACodeSystem("ICD-10-CM", {
|
|
|
1418
1422
|
<dl>
|
|
1419
1423
|
<dd>
|
|
1420
1424
|
|
|
1421
|
-
|
|
1425
|
+
Looks up a specific code in the terminology server and returns its details.
|
|
1426
|
+
|
|
1427
|
+
Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
|
|
1422
1428
|
</dd>
|
|
1423
1429
|
</dl>
|
|
1424
1430
|
</dd>
|
|
@@ -1514,6 +1520,8 @@ not just keywords.
|
|
|
1514
1520
|
conceptually similar results that keyword search would miss.
|
|
1515
1521
|
|
|
1516
1522
|
See also: `/search/text` for faster keyword-based lookup with typo tolerance.
|
|
1523
|
+
|
|
1524
|
+
Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
|
|
1517
1525
|
</dd>
|
|
1518
1526
|
</dl>
|
|
1519
1527
|
</dd>
|
|
@@ -1576,7 +1584,7 @@ await client.construe.semanticSearchEmbeddingBased("ICD-10-CM", {
|
|
|
1576
1584
|
</dl>
|
|
1577
1585
|
</details>
|
|
1578
1586
|
|
|
1579
|
-
<details><summary><code>client.construe.<a href="/src/api/resources/construe/client/Client.ts">
|
|
1587
|
+
<details><summary><code>client.construe.<a href="/src/api/resources/construe/client/Client.ts">terminologyServerTextSearch</a>(codesystem, { ...params }) -> phenoml.TextSearchResponse</code></summary>
|
|
1580
1588
|
<dl>
|
|
1581
1589
|
<dd>
|
|
1582
1590
|
|
|
@@ -1606,6 +1614,8 @@ the code ID or specific keywords. Fast response times suitable for typeahead int
|
|
|
1606
1614
|
Won't find conceptually related codes with different terminology.
|
|
1607
1615
|
|
|
1608
1616
|
See also: `/search/semantic` for finding conceptually similar codes.
|
|
1617
|
+
|
|
1618
|
+
Usage of CPT is subject to AMA requirements: see PhenoML Terms of Service.
|
|
1609
1619
|
</dd>
|
|
1610
1620
|
</dl>
|
|
1611
1621
|
</dd>
|
|
@@ -1620,7 +1630,7 @@ See also: `/search/semantic` for finding conceptually similar codes.
|
|
|
1620
1630
|
<dd>
|
|
1621
1631
|
|
|
1622
1632
|
```typescript
|
|
1623
|
-
await client.construe.
|
|
1633
|
+
await client.construe.terminologyServerTextSearch("ICD-10-CM", {
|
|
1624
1634
|
q: "E11.65",
|
|
1625
1635
|
version: "version",
|
|
1626
1636
|
limit: 1
|