phenoml 9.0.0 → 9.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/cjs/Client.js +2 -2
- package/dist/cjs/api/resources/construe/client/Client.d.ts +35 -0
- package/dist/cjs/api/resources/construe/client/Client.js +92 -0
- package/dist/cjs/api/resources/construe/client/requests/FeedbackRequest.d.ts +31 -0
- package/dist/cjs/api/resources/construe/client/requests/FeedbackRequest.js +3 -0
- package/dist/cjs/api/resources/construe/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/construe/types/FeedbackResponse.d.ts +4 -0
- package/dist/cjs/api/resources/construe/types/FeedbackResponse.js +3 -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/lang2Fhir/client/Client.d.ts +22 -0
- package/dist/cjs/api/resources/lang2Fhir/client/Client.js +82 -0
- package/dist/cjs/api/resources/lang2Fhir/client/requests/DocumentMultiRequest.d.ts +19 -0
- package/dist/cjs/api/resources/lang2Fhir/client/requests/DocumentMultiRequest.js +3 -0
- package/dist/cjs/api/resources/lang2Fhir/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/lang2Fhir/errors/UnprocessableEntityError.d.ts +5 -0
- package/dist/cjs/api/resources/lang2Fhir/errors/UnprocessableEntityError.js +50 -0
- package/dist/cjs/api/resources/lang2Fhir/errors/index.d.ts +1 -0
- package/dist/cjs/api/resources/lang2Fhir/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 +35 -0
- package/dist/esm/api/resources/construe/client/Client.mjs +92 -0
- package/dist/esm/api/resources/construe/client/requests/FeedbackRequest.d.mts +31 -0
- package/dist/esm/api/resources/construe/client/requests/FeedbackRequest.mjs +2 -0
- package/dist/esm/api/resources/construe/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/construe/types/FeedbackResponse.d.mts +4 -0
- package/dist/esm/api/resources/construe/types/FeedbackResponse.mjs +2 -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/lang2Fhir/client/Client.d.mts +22 -0
- package/dist/esm/api/resources/lang2Fhir/client/Client.mjs +82 -0
- package/dist/esm/api/resources/lang2Fhir/client/requests/DocumentMultiRequest.d.mts +19 -0
- package/dist/esm/api/resources/lang2Fhir/client/requests/DocumentMultiRequest.mjs +2 -0
- package/dist/esm/api/resources/lang2Fhir/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/lang2Fhir/errors/UnprocessableEntityError.d.mts +5 -0
- package/dist/esm/api/resources/lang2Fhir/errors/UnprocessableEntityError.mjs +13 -0
- package/dist/esm/api/resources/lang2Fhir/errors/index.d.mts +1 -0
- package/dist/esm/api/resources/lang2Fhir/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 +151 -0
package/dist/cjs/Client.js
CHANGED
|
@@ -52,8 +52,8 @@ class phenomlClient {
|
|
|
52
52
|
this._options = Object.assign(Object.assign({}, _options), { logging: core.logging.createLogger(_options === null || _options === void 0 ? void 0 : _options.logging), headers: (0, headers_js_1.mergeHeaders)({
|
|
53
53
|
"X-Fern-Language": "JavaScript",
|
|
54
54
|
"X-Fern-SDK-Name": "phenoml",
|
|
55
|
-
"X-Fern-SDK-Version": "9.
|
|
56
|
-
"User-Agent": "phenoml/9.
|
|
55
|
+
"X-Fern-SDK-Version": "9.2.0",
|
|
56
|
+
"User-Agent": "phenoml/9.2.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) });
|
|
@@ -218,6 +218,41 @@ export declare class Construe {
|
|
|
218
218
|
*/
|
|
219
219
|
semanticSearchEmbeddingBased(codesystem: string, request: phenoml.construe.GetConstrueCodesCodesystemSearchSemanticRequest, requestOptions?: Construe.RequestOptions): core.HttpResponsePromise<phenoml.construe.SemanticSearchResponse>;
|
|
220
220
|
private __semanticSearchEmbeddingBased;
|
|
221
|
+
/**
|
|
222
|
+
* Submits user feedback on results from the Construe extraction endpoint.
|
|
223
|
+
* Feedback includes the full extraction result received and the result the user expected.
|
|
224
|
+
*
|
|
225
|
+
* @param {phenoml.construe.FeedbackRequest} request
|
|
226
|
+
* @param {Construe.RequestOptions} requestOptions - Request-specific configuration.
|
|
227
|
+
*
|
|
228
|
+
* @throws {@link phenoml.construe.BadRequestError}
|
|
229
|
+
* @throws {@link phenoml.construe.UnauthorizedError}
|
|
230
|
+
* @throws {@link phenoml.construe.InternalServerError}
|
|
231
|
+
* @throws {@link phenoml.construe.ServiceUnavailableError}
|
|
232
|
+
*
|
|
233
|
+
* @example
|
|
234
|
+
* await client.construe.submitFeedbackOnExtractionResults({
|
|
235
|
+
* text: "Patient has type 2 diabetes with hyperglycemia",
|
|
236
|
+
* received_result: {
|
|
237
|
+
* system: {},
|
|
238
|
+
* codes: [{
|
|
239
|
+
* code: "195967001",
|
|
240
|
+
* description: "Asthma",
|
|
241
|
+
* valid: true
|
|
242
|
+
* }]
|
|
243
|
+
* },
|
|
244
|
+
* expected_result: {
|
|
245
|
+
* system: {},
|
|
246
|
+
* codes: [{
|
|
247
|
+
* code: "195967001",
|
|
248
|
+
* description: "Asthma",
|
|
249
|
+
* valid: true
|
|
250
|
+
* }]
|
|
251
|
+
* }
|
|
252
|
+
* })
|
|
253
|
+
*/
|
|
254
|
+
submitFeedbackOnExtractionResults(request: phenoml.construe.FeedbackRequest, requestOptions?: Construe.RequestOptions): core.HttpResponsePromise<phenoml.construe.FeedbackResponse>;
|
|
255
|
+
private __submitFeedbackOnExtractionResults;
|
|
221
256
|
/**
|
|
222
257
|
* Performs fast full-text search over code IDs and descriptions.
|
|
223
258
|
*
|
|
@@ -823,6 +823,98 @@ class Construe {
|
|
|
823
823
|
}
|
|
824
824
|
});
|
|
825
825
|
}
|
|
826
|
+
/**
|
|
827
|
+
* Submits user feedback on results from the Construe extraction endpoint.
|
|
828
|
+
* Feedback includes the full extraction result received and the result the user expected.
|
|
829
|
+
*
|
|
830
|
+
* @param {phenoml.construe.FeedbackRequest} request
|
|
831
|
+
* @param {Construe.RequestOptions} requestOptions - Request-specific configuration.
|
|
832
|
+
*
|
|
833
|
+
* @throws {@link phenoml.construe.BadRequestError}
|
|
834
|
+
* @throws {@link phenoml.construe.UnauthorizedError}
|
|
835
|
+
* @throws {@link phenoml.construe.InternalServerError}
|
|
836
|
+
* @throws {@link phenoml.construe.ServiceUnavailableError}
|
|
837
|
+
*
|
|
838
|
+
* @example
|
|
839
|
+
* await client.construe.submitFeedbackOnExtractionResults({
|
|
840
|
+
* text: "Patient has type 2 diabetes with hyperglycemia",
|
|
841
|
+
* received_result: {
|
|
842
|
+
* system: {},
|
|
843
|
+
* codes: [{
|
|
844
|
+
* code: "195967001",
|
|
845
|
+
* description: "Asthma",
|
|
846
|
+
* valid: true
|
|
847
|
+
* }]
|
|
848
|
+
* },
|
|
849
|
+
* expected_result: {
|
|
850
|
+
* system: {},
|
|
851
|
+
* codes: [{
|
|
852
|
+
* code: "195967001",
|
|
853
|
+
* description: "Asthma",
|
|
854
|
+
* valid: true
|
|
855
|
+
* }]
|
|
856
|
+
* }
|
|
857
|
+
* })
|
|
858
|
+
*/
|
|
859
|
+
submitFeedbackOnExtractionResults(request, requestOptions) {
|
|
860
|
+
return core.HttpResponsePromise.fromPromise(this.__submitFeedbackOnExtractionResults(request, requestOptions));
|
|
861
|
+
}
|
|
862
|
+
__submitFeedbackOnExtractionResults(request, requestOptions) {
|
|
863
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
864
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
865
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
866
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
867
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.phenomlEnvironment.Default, "construe/feedback"),
|
|
868
|
+
method: "POST",
|
|
869
|
+
headers: _headers,
|
|
870
|
+
contentType: "application/json",
|
|
871
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
872
|
+
requestType: "json",
|
|
873
|
+
body: request,
|
|
874
|
+
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
875
|
+
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
876
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
877
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
878
|
+
logging: this._options.logging,
|
|
879
|
+
});
|
|
880
|
+
if (_response.ok) {
|
|
881
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
882
|
+
}
|
|
883
|
+
if (_response.error.reason === "status-code") {
|
|
884
|
+
switch (_response.error.statusCode) {
|
|
885
|
+
case 400:
|
|
886
|
+
throw new phenoml.construe.BadRequestError(_response.error.body, _response.rawResponse);
|
|
887
|
+
case 401:
|
|
888
|
+
throw new phenoml.construe.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
889
|
+
case 500:
|
|
890
|
+
throw new phenoml.construe.InternalServerError(_response.error.body, _response.rawResponse);
|
|
891
|
+
case 503:
|
|
892
|
+
throw new phenoml.construe.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
893
|
+
default:
|
|
894
|
+
throw new errors.phenomlError({
|
|
895
|
+
statusCode: _response.error.statusCode,
|
|
896
|
+
body: _response.error.body,
|
|
897
|
+
rawResponse: _response.rawResponse,
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
switch (_response.error.reason) {
|
|
902
|
+
case "non-json":
|
|
903
|
+
throw new errors.phenomlError({
|
|
904
|
+
statusCode: _response.error.statusCode,
|
|
905
|
+
body: _response.error.rawBody,
|
|
906
|
+
rawResponse: _response.rawResponse,
|
|
907
|
+
});
|
|
908
|
+
case "timeout":
|
|
909
|
+
throw new errors.phenomlTimeoutError("Timeout exceeded when calling POST /construe/feedback.");
|
|
910
|
+
case "unknown":
|
|
911
|
+
throw new errors.phenomlError({
|
|
912
|
+
message: _response.error.errorMessage,
|
|
913
|
+
rawResponse: _response.rawResponse,
|
|
914
|
+
});
|
|
915
|
+
}
|
|
916
|
+
});
|
|
917
|
+
}
|
|
826
918
|
/**
|
|
827
919
|
* Performs fast full-text search over code IDs and descriptions.
|
|
828
920
|
*
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type * as phenoml from "../../../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {
|
|
5
|
+
* text: "Patient has type 2 diabetes with hyperglycemia",
|
|
6
|
+
* received_result: {
|
|
7
|
+
* system: {},
|
|
8
|
+
* codes: [{
|
|
9
|
+
* code: "195967001",
|
|
10
|
+
* description: "Asthma",
|
|
11
|
+
* valid: true
|
|
12
|
+
* }]
|
|
13
|
+
* },
|
|
14
|
+
* expected_result: {
|
|
15
|
+
* system: {},
|
|
16
|
+
* codes: [{
|
|
17
|
+
* code: "195967001",
|
|
18
|
+
* description: "Asthma",
|
|
19
|
+
* valid: true
|
|
20
|
+
* }]
|
|
21
|
+
* }
|
|
22
|
+
* }
|
|
23
|
+
*/
|
|
24
|
+
export interface FeedbackRequest {
|
|
25
|
+
/** The natural language text that was used for code extraction */
|
|
26
|
+
text: string;
|
|
27
|
+
received_result: phenoml.construe.ExtractCodesResult;
|
|
28
|
+
expected_result: phenoml.construe.ExtractCodesResult;
|
|
29
|
+
/** Optional details explaining the feedback */
|
|
30
|
+
detail?: string;
|
|
31
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export type { DeleteConstrueCodesSystemsCodesystemRequest } from "./DeleteConstrueCodesSystemsCodesystemRequest.js";
|
|
2
2
|
export type { ExtractRequest } from "./ExtractRequest.js";
|
|
3
|
+
export type { FeedbackRequest } from "./FeedbackRequest.js";
|
|
3
4
|
export type { GetConstrueCodesCodesystemCodeIdRequest } from "./GetConstrueCodesCodesystemCodeIdRequest.js";
|
|
4
5
|
export type { GetConstrueCodesCodesystemRequest } from "./GetConstrueCodesCodesystemRequest.js";
|
|
5
6
|
export type { GetConstrueCodesCodesystemSearchSemanticRequest } from "./GetConstrueCodesCodesystemSearchSemanticRequest.js";
|
|
@@ -9,6 +9,7 @@ export * from "./ExtractCodesResult.js";
|
|
|
9
9
|
export * from "./ExtractedCodeResult.js";
|
|
10
10
|
export * from "./ExtractRequestConfig.js";
|
|
11
11
|
export * from "./ExtractRequestSystem.js";
|
|
12
|
+
export * from "./FeedbackResponse.js";
|
|
12
13
|
export * from "./GetCodeResponse.js";
|
|
13
14
|
export * from "./GetCodeSystemDetailResponse.js";
|
|
14
15
|
export * from "./ListCodeSystemsResponse.js";
|
|
@@ -25,6 +25,7 @@ __exportStar(require("./ExtractCodesResult.js"), exports);
|
|
|
25
25
|
__exportStar(require("./ExtractedCodeResult.js"), exports);
|
|
26
26
|
__exportStar(require("./ExtractRequestConfig.js"), exports);
|
|
27
27
|
__exportStar(require("./ExtractRequestSystem.js"), exports);
|
|
28
|
+
__exportStar(require("./FeedbackResponse.js"), exports);
|
|
28
29
|
__exportStar(require("./GetCodeResponse.js"), exports);
|
|
29
30
|
__exportStar(require("./GetCodeSystemDetailResponse.js"), exports);
|
|
30
31
|
__exportStar(require("./ListCodeSystemsResponse.js"), exports);
|
|
@@ -119,5 +119,27 @@ export declare class Lang2Fhir {
|
|
|
119
119
|
*/
|
|
120
120
|
document(request: phenoml.lang2Fhir.DocumentRequest, requestOptions?: Lang2Fhir.RequestOptions): core.HttpResponsePromise<phenoml.lang2Fhir.FhirResource>;
|
|
121
121
|
private __document;
|
|
122
|
+
/**
|
|
123
|
+
* Extracts text from a document (PDF or image) and converts it into multiple FHIR resources,
|
|
124
|
+
* returned as a transaction Bundle. Combines document text extraction with multi-resource detection.
|
|
125
|
+
* Automatically detects Patient, Condition, MedicationRequest, Observation, and other resource types.
|
|
126
|
+
* Resources are linked with proper references (e.g., Conditions reference the Patient).
|
|
127
|
+
*
|
|
128
|
+
* @param {phenoml.lang2Fhir.DocumentMultiRequest} request
|
|
129
|
+
* @param {Lang2Fhir.RequestOptions} requestOptions - Request-specific configuration.
|
|
130
|
+
*
|
|
131
|
+
* @throws {@link phenoml.lang2Fhir.BadRequestError}
|
|
132
|
+
* @throws {@link phenoml.lang2Fhir.UnauthorizedError}
|
|
133
|
+
* @throws {@link phenoml.lang2Fhir.UnprocessableEntityError}
|
|
134
|
+
* @throws {@link phenoml.lang2Fhir.InternalServerError}
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* await client.lang2Fhir.extractMultipleFhirResourcesFromADocument({
|
|
138
|
+
* version: "R4",
|
|
139
|
+
* content: "content"
|
|
140
|
+
* })
|
|
141
|
+
*/
|
|
142
|
+
extractMultipleFhirResourcesFromADocument(request: phenoml.lang2Fhir.DocumentMultiRequest, requestOptions?: Lang2Fhir.RequestOptions): core.HttpResponsePromise<phenoml.lang2Fhir.CreateMultiResponse>;
|
|
143
|
+
private __extractMultipleFhirResourcesFromADocument;
|
|
122
144
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
123
145
|
}
|
|
@@ -447,6 +447,88 @@ class Lang2Fhir {
|
|
|
447
447
|
}
|
|
448
448
|
});
|
|
449
449
|
}
|
|
450
|
+
/**
|
|
451
|
+
* Extracts text from a document (PDF or image) and converts it into multiple FHIR resources,
|
|
452
|
+
* returned as a transaction Bundle. Combines document text extraction with multi-resource detection.
|
|
453
|
+
* Automatically detects Patient, Condition, MedicationRequest, Observation, and other resource types.
|
|
454
|
+
* Resources are linked with proper references (e.g., Conditions reference the Patient).
|
|
455
|
+
*
|
|
456
|
+
* @param {phenoml.lang2Fhir.DocumentMultiRequest} request
|
|
457
|
+
* @param {Lang2Fhir.RequestOptions} requestOptions - Request-specific configuration.
|
|
458
|
+
*
|
|
459
|
+
* @throws {@link phenoml.lang2Fhir.BadRequestError}
|
|
460
|
+
* @throws {@link phenoml.lang2Fhir.UnauthorizedError}
|
|
461
|
+
* @throws {@link phenoml.lang2Fhir.UnprocessableEntityError}
|
|
462
|
+
* @throws {@link phenoml.lang2Fhir.InternalServerError}
|
|
463
|
+
*
|
|
464
|
+
* @example
|
|
465
|
+
* await client.lang2Fhir.extractMultipleFhirResourcesFromADocument({
|
|
466
|
+
* version: "R4",
|
|
467
|
+
* content: "content"
|
|
468
|
+
* })
|
|
469
|
+
*/
|
|
470
|
+
extractMultipleFhirResourcesFromADocument(request, requestOptions) {
|
|
471
|
+
return core.HttpResponsePromise.fromPromise(this.__extractMultipleFhirResourcesFromADocument(request, requestOptions));
|
|
472
|
+
}
|
|
473
|
+
__extractMultipleFhirResourcesFromADocument(request, requestOptions) {
|
|
474
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
475
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
476
|
+
const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
477
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
478
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.phenomlEnvironment.Default, "lang2fhir/document/multi"),
|
|
479
|
+
method: "POST",
|
|
480
|
+
headers: _headers,
|
|
481
|
+
contentType: "application/json",
|
|
482
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
483
|
+
requestType: "json",
|
|
484
|
+
body: request,
|
|
485
|
+
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
486
|
+
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
487
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
488
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
489
|
+
logging: this._options.logging,
|
|
490
|
+
});
|
|
491
|
+
if (_response.ok) {
|
|
492
|
+
return {
|
|
493
|
+
data: _response.body,
|
|
494
|
+
rawResponse: _response.rawResponse,
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
if (_response.error.reason === "status-code") {
|
|
498
|
+
switch (_response.error.statusCode) {
|
|
499
|
+
case 400:
|
|
500
|
+
throw new phenoml.lang2Fhir.BadRequestError(_response.error.body, _response.rawResponse);
|
|
501
|
+
case 401:
|
|
502
|
+
throw new phenoml.lang2Fhir.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
503
|
+
case 422:
|
|
504
|
+
throw new phenoml.lang2Fhir.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
505
|
+
case 500:
|
|
506
|
+
throw new phenoml.lang2Fhir.InternalServerError(_response.error.body, _response.rawResponse);
|
|
507
|
+
default:
|
|
508
|
+
throw new errors.phenomlError({
|
|
509
|
+
statusCode: _response.error.statusCode,
|
|
510
|
+
body: _response.error.body,
|
|
511
|
+
rawResponse: _response.rawResponse,
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
switch (_response.error.reason) {
|
|
516
|
+
case "non-json":
|
|
517
|
+
throw new errors.phenomlError({
|
|
518
|
+
statusCode: _response.error.statusCode,
|
|
519
|
+
body: _response.error.rawBody,
|
|
520
|
+
rawResponse: _response.rawResponse,
|
|
521
|
+
});
|
|
522
|
+
case "timeout":
|
|
523
|
+
throw new errors.phenomlTimeoutError("Timeout exceeded when calling POST /lang2fhir/document/multi.");
|
|
524
|
+
case "unknown":
|
|
525
|
+
throw new errors.phenomlError({
|
|
526
|
+
message: _response.error.errorMessage,
|
|
527
|
+
rawResponse: _response.rawResponse,
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
}
|
|
450
532
|
_getAuthorizationHeader() {
|
|
451
533
|
return __awaiter(this, void 0, void 0, function* () {
|
|
452
534
|
return `Bearer ${yield core.Supplier.get(this._options.token)}`;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* version: "R4",
|
|
5
|
+
* content: "content"
|
|
6
|
+
* }
|
|
7
|
+
*/
|
|
8
|
+
export interface DocumentMultiRequest {
|
|
9
|
+
/** FHIR version to use */
|
|
10
|
+
version: string;
|
|
11
|
+
/**
|
|
12
|
+
* Base64 encoded file content.
|
|
13
|
+
* Supported file types: PDF (application/pdf), PNG (image/png), JPEG (image/jpeg).
|
|
14
|
+
* File type is auto-detected from content magic bytes.
|
|
15
|
+
*/
|
|
16
|
+
content: string;
|
|
17
|
+
/** Optional FHIR provider name for provider-specific profiles */
|
|
18
|
+
provider?: string;
|
|
19
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export type { CreateMultiRequest } from "./CreateMultiRequest.js";
|
|
2
2
|
export type { CreateRequest } from "./CreateRequest.js";
|
|
3
|
+
export type { DocumentMultiRequest } from "./DocumentMultiRequest.js";
|
|
3
4
|
export type { DocumentRequest } from "./DocumentRequest.js";
|
|
4
5
|
export type { ProfileUploadRequest } from "./ProfileUploadRequest.js";
|
|
5
6
|
export type { SearchRequest } from "./SearchRequest.js";
|
|
@@ -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.UnprocessableEntityError = void 0;
|
|
38
|
+
const errors = __importStar(require("../../../../errors/index.js"));
|
|
39
|
+
class UnprocessableEntityError extends errors.phenomlError {
|
|
40
|
+
constructor(body, rawResponse) {
|
|
41
|
+
super({
|
|
42
|
+
message: "UnprocessableEntityError",
|
|
43
|
+
statusCode: 422,
|
|
44
|
+
body: body,
|
|
45
|
+
rawResponse: rawResponse,
|
|
46
|
+
});
|
|
47
|
+
Object.setPrototypeOf(this, UnprocessableEntityError.prototype);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.UnprocessableEntityError = UnprocessableEntityError;
|
|
@@ -19,3 +19,4 @@ __exportStar(require("./FailedDependencyError.js"), exports);
|
|
|
19
19
|
__exportStar(require("./ForbiddenError.js"), exports);
|
|
20
20
|
__exportStar(require("./InternalServerError.js"), exports);
|
|
21
21
|
__exportStar(require("./UnauthorizedError.js"), exports);
|
|
22
|
+
__exportStar(require("./UnprocessableEntityError.js"), exports);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "9.
|
|
1
|
+
export declare const SDK_VERSION = "9.2.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), { logging: core.logging.createLogger(_options === null || _options === void 0 ? void 0 : _options.logging), headers: mergeHeaders({
|
|
17
17
|
"X-Fern-Language": "JavaScript",
|
|
18
18
|
"X-Fern-SDK-Name": "phenoml",
|
|
19
|
-
"X-Fern-SDK-Version": "9.
|
|
20
|
-
"User-Agent": "phenoml/9.
|
|
19
|
+
"X-Fern-SDK-Version": "9.2.0",
|
|
20
|
+
"User-Agent": "phenoml/9.2.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) });
|
|
@@ -218,6 +218,41 @@ export declare class Construe {
|
|
|
218
218
|
*/
|
|
219
219
|
semanticSearchEmbeddingBased(codesystem: string, request: phenoml.construe.GetConstrueCodesCodesystemSearchSemanticRequest, requestOptions?: Construe.RequestOptions): core.HttpResponsePromise<phenoml.construe.SemanticSearchResponse>;
|
|
220
220
|
private __semanticSearchEmbeddingBased;
|
|
221
|
+
/**
|
|
222
|
+
* Submits user feedback on results from the Construe extraction endpoint.
|
|
223
|
+
* Feedback includes the full extraction result received and the result the user expected.
|
|
224
|
+
*
|
|
225
|
+
* @param {phenoml.construe.FeedbackRequest} request
|
|
226
|
+
* @param {Construe.RequestOptions} requestOptions - Request-specific configuration.
|
|
227
|
+
*
|
|
228
|
+
* @throws {@link phenoml.construe.BadRequestError}
|
|
229
|
+
* @throws {@link phenoml.construe.UnauthorizedError}
|
|
230
|
+
* @throws {@link phenoml.construe.InternalServerError}
|
|
231
|
+
* @throws {@link phenoml.construe.ServiceUnavailableError}
|
|
232
|
+
*
|
|
233
|
+
* @example
|
|
234
|
+
* await client.construe.submitFeedbackOnExtractionResults({
|
|
235
|
+
* text: "Patient has type 2 diabetes with hyperglycemia",
|
|
236
|
+
* received_result: {
|
|
237
|
+
* system: {},
|
|
238
|
+
* codes: [{
|
|
239
|
+
* code: "195967001",
|
|
240
|
+
* description: "Asthma",
|
|
241
|
+
* valid: true
|
|
242
|
+
* }]
|
|
243
|
+
* },
|
|
244
|
+
* expected_result: {
|
|
245
|
+
* system: {},
|
|
246
|
+
* codes: [{
|
|
247
|
+
* code: "195967001",
|
|
248
|
+
* description: "Asthma",
|
|
249
|
+
* valid: true
|
|
250
|
+
* }]
|
|
251
|
+
* }
|
|
252
|
+
* })
|
|
253
|
+
*/
|
|
254
|
+
submitFeedbackOnExtractionResults(request: phenoml.construe.FeedbackRequest, requestOptions?: Construe.RequestOptions): core.HttpResponsePromise<phenoml.construe.FeedbackResponse>;
|
|
255
|
+
private __submitFeedbackOnExtractionResults;
|
|
221
256
|
/**
|
|
222
257
|
* Performs fast full-text search over code IDs and descriptions.
|
|
223
258
|
*
|
|
@@ -787,6 +787,98 @@ export class Construe {
|
|
|
787
787
|
}
|
|
788
788
|
});
|
|
789
789
|
}
|
|
790
|
+
/**
|
|
791
|
+
* Submits user feedback on results from the Construe extraction endpoint.
|
|
792
|
+
* Feedback includes the full extraction result received and the result the user expected.
|
|
793
|
+
*
|
|
794
|
+
* @param {phenoml.construe.FeedbackRequest} request
|
|
795
|
+
* @param {Construe.RequestOptions} requestOptions - Request-specific configuration.
|
|
796
|
+
*
|
|
797
|
+
* @throws {@link phenoml.construe.BadRequestError}
|
|
798
|
+
* @throws {@link phenoml.construe.UnauthorizedError}
|
|
799
|
+
* @throws {@link phenoml.construe.InternalServerError}
|
|
800
|
+
* @throws {@link phenoml.construe.ServiceUnavailableError}
|
|
801
|
+
*
|
|
802
|
+
* @example
|
|
803
|
+
* await client.construe.submitFeedbackOnExtractionResults({
|
|
804
|
+
* text: "Patient has type 2 diabetes with hyperglycemia",
|
|
805
|
+
* received_result: {
|
|
806
|
+
* system: {},
|
|
807
|
+
* codes: [{
|
|
808
|
+
* code: "195967001",
|
|
809
|
+
* description: "Asthma",
|
|
810
|
+
* valid: true
|
|
811
|
+
* }]
|
|
812
|
+
* },
|
|
813
|
+
* expected_result: {
|
|
814
|
+
* system: {},
|
|
815
|
+
* codes: [{
|
|
816
|
+
* code: "195967001",
|
|
817
|
+
* description: "Asthma",
|
|
818
|
+
* valid: true
|
|
819
|
+
* }]
|
|
820
|
+
* }
|
|
821
|
+
* })
|
|
822
|
+
*/
|
|
823
|
+
submitFeedbackOnExtractionResults(request, requestOptions) {
|
|
824
|
+
return core.HttpResponsePromise.fromPromise(this.__submitFeedbackOnExtractionResults(request, requestOptions));
|
|
825
|
+
}
|
|
826
|
+
__submitFeedbackOnExtractionResults(request, requestOptions) {
|
|
827
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
828
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
829
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
830
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
831
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.phenomlEnvironment.Default, "construe/feedback"),
|
|
832
|
+
method: "POST",
|
|
833
|
+
headers: _headers,
|
|
834
|
+
contentType: "application/json",
|
|
835
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
836
|
+
requestType: "json",
|
|
837
|
+
body: request,
|
|
838
|
+
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
839
|
+
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
840
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
841
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
842
|
+
logging: this._options.logging,
|
|
843
|
+
});
|
|
844
|
+
if (_response.ok) {
|
|
845
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
846
|
+
}
|
|
847
|
+
if (_response.error.reason === "status-code") {
|
|
848
|
+
switch (_response.error.statusCode) {
|
|
849
|
+
case 400:
|
|
850
|
+
throw new phenoml.construe.BadRequestError(_response.error.body, _response.rawResponse);
|
|
851
|
+
case 401:
|
|
852
|
+
throw new phenoml.construe.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
853
|
+
case 500:
|
|
854
|
+
throw new phenoml.construe.InternalServerError(_response.error.body, _response.rawResponse);
|
|
855
|
+
case 503:
|
|
856
|
+
throw new phenoml.construe.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
857
|
+
default:
|
|
858
|
+
throw new errors.phenomlError({
|
|
859
|
+
statusCode: _response.error.statusCode,
|
|
860
|
+
body: _response.error.body,
|
|
861
|
+
rawResponse: _response.rawResponse,
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
switch (_response.error.reason) {
|
|
866
|
+
case "non-json":
|
|
867
|
+
throw new errors.phenomlError({
|
|
868
|
+
statusCode: _response.error.statusCode,
|
|
869
|
+
body: _response.error.rawBody,
|
|
870
|
+
rawResponse: _response.rawResponse,
|
|
871
|
+
});
|
|
872
|
+
case "timeout":
|
|
873
|
+
throw new errors.phenomlTimeoutError("Timeout exceeded when calling POST /construe/feedback.");
|
|
874
|
+
case "unknown":
|
|
875
|
+
throw new errors.phenomlError({
|
|
876
|
+
message: _response.error.errorMessage,
|
|
877
|
+
rawResponse: _response.rawResponse,
|
|
878
|
+
});
|
|
879
|
+
}
|
|
880
|
+
});
|
|
881
|
+
}
|
|
790
882
|
/**
|
|
791
883
|
* Performs fast full-text search over code IDs and descriptions.
|
|
792
884
|
*
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type * as phenoml from "../../../../index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {
|
|
5
|
+
* text: "Patient has type 2 diabetes with hyperglycemia",
|
|
6
|
+
* received_result: {
|
|
7
|
+
* system: {},
|
|
8
|
+
* codes: [{
|
|
9
|
+
* code: "195967001",
|
|
10
|
+
* description: "Asthma",
|
|
11
|
+
* valid: true
|
|
12
|
+
* }]
|
|
13
|
+
* },
|
|
14
|
+
* expected_result: {
|
|
15
|
+
* system: {},
|
|
16
|
+
* codes: [{
|
|
17
|
+
* code: "195967001",
|
|
18
|
+
* description: "Asthma",
|
|
19
|
+
* valid: true
|
|
20
|
+
* }]
|
|
21
|
+
* }
|
|
22
|
+
* }
|
|
23
|
+
*/
|
|
24
|
+
export interface FeedbackRequest {
|
|
25
|
+
/** The natural language text that was used for code extraction */
|
|
26
|
+
text: string;
|
|
27
|
+
received_result: phenoml.construe.ExtractCodesResult;
|
|
28
|
+
expected_result: phenoml.construe.ExtractCodesResult;
|
|
29
|
+
/** Optional details explaining the feedback */
|
|
30
|
+
detail?: string;
|
|
31
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export type { DeleteConstrueCodesSystemsCodesystemRequest } from "./DeleteConstrueCodesSystemsCodesystemRequest.mjs";
|
|
2
2
|
export type { ExtractRequest } from "./ExtractRequest.mjs";
|
|
3
|
+
export type { FeedbackRequest } from "./FeedbackRequest.mjs";
|
|
3
4
|
export type { GetConstrueCodesCodesystemCodeIdRequest } from "./GetConstrueCodesCodesystemCodeIdRequest.mjs";
|
|
4
5
|
export type { GetConstrueCodesCodesystemRequest } from "./GetConstrueCodesCodesystemRequest.mjs";
|
|
5
6
|
export type { GetConstrueCodesCodesystemSearchSemanticRequest } from "./GetConstrueCodesCodesystemSearchSemanticRequest.mjs";
|
|
@@ -9,6 +9,7 @@ export * from "./ExtractCodesResult.mjs";
|
|
|
9
9
|
export * from "./ExtractedCodeResult.mjs";
|
|
10
10
|
export * from "./ExtractRequestConfig.mjs";
|
|
11
11
|
export * from "./ExtractRequestSystem.mjs";
|
|
12
|
+
export * from "./FeedbackResponse.mjs";
|
|
12
13
|
export * from "./GetCodeResponse.mjs";
|
|
13
14
|
export * from "./GetCodeSystemDetailResponse.mjs";
|
|
14
15
|
export * from "./ListCodeSystemsResponse.mjs";
|
|
@@ -9,6 +9,7 @@ export * from "./ExtractCodesResult.mjs";
|
|
|
9
9
|
export * from "./ExtractedCodeResult.mjs";
|
|
10
10
|
export * from "./ExtractRequestConfig.mjs";
|
|
11
11
|
export * from "./ExtractRequestSystem.mjs";
|
|
12
|
+
export * from "./FeedbackResponse.mjs";
|
|
12
13
|
export * from "./GetCodeResponse.mjs";
|
|
13
14
|
export * from "./GetCodeSystemDetailResponse.mjs";
|
|
14
15
|
export * from "./ListCodeSystemsResponse.mjs";
|
|
@@ -119,5 +119,27 @@ export declare class Lang2Fhir {
|
|
|
119
119
|
*/
|
|
120
120
|
document(request: phenoml.lang2Fhir.DocumentRequest, requestOptions?: Lang2Fhir.RequestOptions): core.HttpResponsePromise<phenoml.lang2Fhir.FhirResource>;
|
|
121
121
|
private __document;
|
|
122
|
+
/**
|
|
123
|
+
* Extracts text from a document (PDF or image) and converts it into multiple FHIR resources,
|
|
124
|
+
* returned as a transaction Bundle. Combines document text extraction with multi-resource detection.
|
|
125
|
+
* Automatically detects Patient, Condition, MedicationRequest, Observation, and other resource types.
|
|
126
|
+
* Resources are linked with proper references (e.g., Conditions reference the Patient).
|
|
127
|
+
*
|
|
128
|
+
* @param {phenoml.lang2Fhir.DocumentMultiRequest} request
|
|
129
|
+
* @param {Lang2Fhir.RequestOptions} requestOptions - Request-specific configuration.
|
|
130
|
+
*
|
|
131
|
+
* @throws {@link phenoml.lang2Fhir.BadRequestError}
|
|
132
|
+
* @throws {@link phenoml.lang2Fhir.UnauthorizedError}
|
|
133
|
+
* @throws {@link phenoml.lang2Fhir.UnprocessableEntityError}
|
|
134
|
+
* @throws {@link phenoml.lang2Fhir.InternalServerError}
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* await client.lang2Fhir.extractMultipleFhirResourcesFromADocument({
|
|
138
|
+
* version: "R4",
|
|
139
|
+
* content: "content"
|
|
140
|
+
* })
|
|
141
|
+
*/
|
|
142
|
+
extractMultipleFhirResourcesFromADocument(request: phenoml.lang2Fhir.DocumentMultiRequest, requestOptions?: Lang2Fhir.RequestOptions): core.HttpResponsePromise<phenoml.lang2Fhir.CreateMultiResponse>;
|
|
143
|
+
private __extractMultipleFhirResourcesFromADocument;
|
|
122
144
|
protected _getAuthorizationHeader(): Promise<string>;
|
|
123
145
|
}
|
|
@@ -411,6 +411,88 @@ export class Lang2Fhir {
|
|
|
411
411
|
}
|
|
412
412
|
});
|
|
413
413
|
}
|
|
414
|
+
/**
|
|
415
|
+
* Extracts text from a document (PDF or image) and converts it into multiple FHIR resources,
|
|
416
|
+
* returned as a transaction Bundle. Combines document text extraction with multi-resource detection.
|
|
417
|
+
* Automatically detects Patient, Condition, MedicationRequest, Observation, and other resource types.
|
|
418
|
+
* Resources are linked with proper references (e.g., Conditions reference the Patient).
|
|
419
|
+
*
|
|
420
|
+
* @param {phenoml.lang2Fhir.DocumentMultiRequest} request
|
|
421
|
+
* @param {Lang2Fhir.RequestOptions} requestOptions - Request-specific configuration.
|
|
422
|
+
*
|
|
423
|
+
* @throws {@link phenoml.lang2Fhir.BadRequestError}
|
|
424
|
+
* @throws {@link phenoml.lang2Fhir.UnauthorizedError}
|
|
425
|
+
* @throws {@link phenoml.lang2Fhir.UnprocessableEntityError}
|
|
426
|
+
* @throws {@link phenoml.lang2Fhir.InternalServerError}
|
|
427
|
+
*
|
|
428
|
+
* @example
|
|
429
|
+
* await client.lang2Fhir.extractMultipleFhirResourcesFromADocument({
|
|
430
|
+
* version: "R4",
|
|
431
|
+
* content: "content"
|
|
432
|
+
* })
|
|
433
|
+
*/
|
|
434
|
+
extractMultipleFhirResourcesFromADocument(request, requestOptions) {
|
|
435
|
+
return core.HttpResponsePromise.fromPromise(this.__extractMultipleFhirResourcesFromADocument(request, requestOptions));
|
|
436
|
+
}
|
|
437
|
+
__extractMultipleFhirResourcesFromADocument(request, requestOptions) {
|
|
438
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
439
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
440
|
+
const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
441
|
+
const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
|
|
442
|
+
url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.phenomlEnvironment.Default, "lang2fhir/document/multi"),
|
|
443
|
+
method: "POST",
|
|
444
|
+
headers: _headers,
|
|
445
|
+
contentType: "application/json",
|
|
446
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
447
|
+
requestType: "json",
|
|
448
|
+
body: request,
|
|
449
|
+
timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
|
|
450
|
+
maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
|
|
451
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
452
|
+
fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
|
|
453
|
+
logging: this._options.logging,
|
|
454
|
+
});
|
|
455
|
+
if (_response.ok) {
|
|
456
|
+
return {
|
|
457
|
+
data: _response.body,
|
|
458
|
+
rawResponse: _response.rawResponse,
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
if (_response.error.reason === "status-code") {
|
|
462
|
+
switch (_response.error.statusCode) {
|
|
463
|
+
case 400:
|
|
464
|
+
throw new phenoml.lang2Fhir.BadRequestError(_response.error.body, _response.rawResponse);
|
|
465
|
+
case 401:
|
|
466
|
+
throw new phenoml.lang2Fhir.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
467
|
+
case 422:
|
|
468
|
+
throw new phenoml.lang2Fhir.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
469
|
+
case 500:
|
|
470
|
+
throw new phenoml.lang2Fhir.InternalServerError(_response.error.body, _response.rawResponse);
|
|
471
|
+
default:
|
|
472
|
+
throw new errors.phenomlError({
|
|
473
|
+
statusCode: _response.error.statusCode,
|
|
474
|
+
body: _response.error.body,
|
|
475
|
+
rawResponse: _response.rawResponse,
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
switch (_response.error.reason) {
|
|
480
|
+
case "non-json":
|
|
481
|
+
throw new errors.phenomlError({
|
|
482
|
+
statusCode: _response.error.statusCode,
|
|
483
|
+
body: _response.error.rawBody,
|
|
484
|
+
rawResponse: _response.rawResponse,
|
|
485
|
+
});
|
|
486
|
+
case "timeout":
|
|
487
|
+
throw new errors.phenomlTimeoutError("Timeout exceeded when calling POST /lang2fhir/document/multi.");
|
|
488
|
+
case "unknown":
|
|
489
|
+
throw new errors.phenomlError({
|
|
490
|
+
message: _response.error.errorMessage,
|
|
491
|
+
rawResponse: _response.rawResponse,
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
});
|
|
495
|
+
}
|
|
414
496
|
_getAuthorizationHeader() {
|
|
415
497
|
return __awaiter(this, void 0, void 0, function* () {
|
|
416
498
|
return `Bearer ${yield core.Supplier.get(this._options.token)}`;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* version: "R4",
|
|
5
|
+
* content: "content"
|
|
6
|
+
* }
|
|
7
|
+
*/
|
|
8
|
+
export interface DocumentMultiRequest {
|
|
9
|
+
/** FHIR version to use */
|
|
10
|
+
version: string;
|
|
11
|
+
/**
|
|
12
|
+
* Base64 encoded file content.
|
|
13
|
+
* Supported file types: PDF (application/pdf), PNG (image/png), JPEG (image/jpeg).
|
|
14
|
+
* File type is auto-detected from content magic bytes.
|
|
15
|
+
*/
|
|
16
|
+
content: string;
|
|
17
|
+
/** Optional FHIR provider name for provider-specific profiles */
|
|
18
|
+
provider?: string;
|
|
19
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export type { CreateMultiRequest } from "./CreateMultiRequest.mjs";
|
|
2
2
|
export type { CreateRequest } from "./CreateRequest.mjs";
|
|
3
|
+
export type { DocumentMultiRequest } from "./DocumentMultiRequest.mjs";
|
|
3
4
|
export type { DocumentRequest } from "./DocumentRequest.mjs";
|
|
4
5
|
export type { ProfileUploadRequest } from "./ProfileUploadRequest.mjs";
|
|
5
6
|
export type { SearchRequest } from "./SearchRequest.mjs";
|
|
@@ -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 UnprocessableEntityError extends errors.phenomlError {
|
|
4
|
+
constructor(body, rawResponse) {
|
|
5
|
+
super({
|
|
6
|
+
message: "UnprocessableEntityError",
|
|
7
|
+
statusCode: 422,
|
|
8
|
+
body: body,
|
|
9
|
+
rawResponse: rawResponse,
|
|
10
|
+
});
|
|
11
|
+
Object.setPrototypeOf(this, UnprocessableEntityError.prototype);
|
|
12
|
+
}
|
|
13
|
+
}
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "9.
|
|
1
|
+
export declare const SDK_VERSION = "9.2.0";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "9.
|
|
1
|
+
export const SDK_VERSION = "9.2.0";
|
package/package.json
CHANGED
package/reference.md
CHANGED
|
@@ -1877,6 +1877,88 @@ await client.construe.semanticSearchEmbeddingBased("ICD-10-CM", {
|
|
|
1877
1877
|
</dl>
|
|
1878
1878
|
|
|
1879
1879
|
|
|
1880
|
+
</dd>
|
|
1881
|
+
</dl>
|
|
1882
|
+
</details>
|
|
1883
|
+
|
|
1884
|
+
<details><summary><code>client.construe.<a href="/src/api/resources/construe/client/Client.ts">submitFeedbackOnExtractionResults</a>({ ...params }) -> phenoml.FeedbackResponse</code></summary>
|
|
1885
|
+
<dl>
|
|
1886
|
+
<dd>
|
|
1887
|
+
|
|
1888
|
+
#### 📝 Description
|
|
1889
|
+
|
|
1890
|
+
<dl>
|
|
1891
|
+
<dd>
|
|
1892
|
+
|
|
1893
|
+
<dl>
|
|
1894
|
+
<dd>
|
|
1895
|
+
|
|
1896
|
+
Submits user feedback on results from the Construe extraction endpoint.
|
|
1897
|
+
Feedback includes the full extraction result received and the result the user expected.
|
|
1898
|
+
</dd>
|
|
1899
|
+
</dl>
|
|
1900
|
+
</dd>
|
|
1901
|
+
</dl>
|
|
1902
|
+
|
|
1903
|
+
#### 🔌 Usage
|
|
1904
|
+
|
|
1905
|
+
<dl>
|
|
1906
|
+
<dd>
|
|
1907
|
+
|
|
1908
|
+
<dl>
|
|
1909
|
+
<dd>
|
|
1910
|
+
|
|
1911
|
+
```typescript
|
|
1912
|
+
await client.construe.submitFeedbackOnExtractionResults({
|
|
1913
|
+
text: "Patient has type 2 diabetes with hyperglycemia",
|
|
1914
|
+
received_result: {
|
|
1915
|
+
system: {},
|
|
1916
|
+
codes: [{
|
|
1917
|
+
code: "195967001",
|
|
1918
|
+
description: "Asthma",
|
|
1919
|
+
valid: true
|
|
1920
|
+
}]
|
|
1921
|
+
},
|
|
1922
|
+
expected_result: {
|
|
1923
|
+
system: {},
|
|
1924
|
+
codes: [{
|
|
1925
|
+
code: "195967001",
|
|
1926
|
+
description: "Asthma",
|
|
1927
|
+
valid: true
|
|
1928
|
+
}]
|
|
1929
|
+
}
|
|
1930
|
+
});
|
|
1931
|
+
|
|
1932
|
+
```
|
|
1933
|
+
</dd>
|
|
1934
|
+
</dl>
|
|
1935
|
+
</dd>
|
|
1936
|
+
</dl>
|
|
1937
|
+
|
|
1938
|
+
#### ⚙️ Parameters
|
|
1939
|
+
|
|
1940
|
+
<dl>
|
|
1941
|
+
<dd>
|
|
1942
|
+
|
|
1943
|
+
<dl>
|
|
1944
|
+
<dd>
|
|
1945
|
+
|
|
1946
|
+
**request:** `phenoml.construe.FeedbackRequest`
|
|
1947
|
+
|
|
1948
|
+
</dd>
|
|
1949
|
+
</dl>
|
|
1950
|
+
|
|
1951
|
+
<dl>
|
|
1952
|
+
<dd>
|
|
1953
|
+
|
|
1954
|
+
**requestOptions:** `Construe.RequestOptions`
|
|
1955
|
+
|
|
1956
|
+
</dd>
|
|
1957
|
+
</dl>
|
|
1958
|
+
</dd>
|
|
1959
|
+
</dl>
|
|
1960
|
+
|
|
1961
|
+
|
|
1880
1962
|
</dd>
|
|
1881
1963
|
</dl>
|
|
1882
1964
|
</details>
|
|
@@ -3441,6 +3523,75 @@ await client.lang2Fhir.document({
|
|
|
3441
3523
|
</dl>
|
|
3442
3524
|
|
|
3443
3525
|
|
|
3526
|
+
</dd>
|
|
3527
|
+
</dl>
|
|
3528
|
+
</details>
|
|
3529
|
+
|
|
3530
|
+
<details><summary><code>client.lang2Fhir.<a href="/src/api/resources/lang2Fhir/client/Client.ts">extractMultipleFhirResourcesFromADocument</a>({ ...params }) -> phenoml.CreateMultiResponse</code></summary>
|
|
3531
|
+
<dl>
|
|
3532
|
+
<dd>
|
|
3533
|
+
|
|
3534
|
+
#### 📝 Description
|
|
3535
|
+
|
|
3536
|
+
<dl>
|
|
3537
|
+
<dd>
|
|
3538
|
+
|
|
3539
|
+
<dl>
|
|
3540
|
+
<dd>
|
|
3541
|
+
|
|
3542
|
+
Extracts text from a document (PDF or image) and converts it into multiple FHIR resources,
|
|
3543
|
+
returned as a transaction Bundle. Combines document text extraction with multi-resource detection.
|
|
3544
|
+
Automatically detects Patient, Condition, MedicationRequest, Observation, and other resource types.
|
|
3545
|
+
Resources are linked with proper references (e.g., Conditions reference the Patient).
|
|
3546
|
+
</dd>
|
|
3547
|
+
</dl>
|
|
3548
|
+
</dd>
|
|
3549
|
+
</dl>
|
|
3550
|
+
|
|
3551
|
+
#### 🔌 Usage
|
|
3552
|
+
|
|
3553
|
+
<dl>
|
|
3554
|
+
<dd>
|
|
3555
|
+
|
|
3556
|
+
<dl>
|
|
3557
|
+
<dd>
|
|
3558
|
+
|
|
3559
|
+
```typescript
|
|
3560
|
+
await client.lang2Fhir.extractMultipleFhirResourcesFromADocument({
|
|
3561
|
+
version: "R4",
|
|
3562
|
+
content: "content"
|
|
3563
|
+
});
|
|
3564
|
+
|
|
3565
|
+
```
|
|
3566
|
+
</dd>
|
|
3567
|
+
</dl>
|
|
3568
|
+
</dd>
|
|
3569
|
+
</dl>
|
|
3570
|
+
|
|
3571
|
+
#### ⚙️ Parameters
|
|
3572
|
+
|
|
3573
|
+
<dl>
|
|
3574
|
+
<dd>
|
|
3575
|
+
|
|
3576
|
+
<dl>
|
|
3577
|
+
<dd>
|
|
3578
|
+
|
|
3579
|
+
**request:** `phenoml.lang2Fhir.DocumentMultiRequest`
|
|
3580
|
+
|
|
3581
|
+
</dd>
|
|
3582
|
+
</dl>
|
|
3583
|
+
|
|
3584
|
+
<dl>
|
|
3585
|
+
<dd>
|
|
3586
|
+
|
|
3587
|
+
**requestOptions:** `Lang2Fhir.RequestOptions`
|
|
3588
|
+
|
|
3589
|
+
</dd>
|
|
3590
|
+
</dl>
|
|
3591
|
+
</dd>
|
|
3592
|
+
</dl>
|
|
3593
|
+
|
|
3594
|
+
|
|
3444
3595
|
</dd>
|
|
3445
3596
|
</dl>
|
|
3446
3597
|
</details>
|