phenoml 9.1.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/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/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 +69 -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) });
|
|
@@ -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) });
|
|
@@ -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
|
@@ -3523,6 +3523,75 @@ await client.lang2Fhir.document({
|
|
|
3523
3523
|
</dl>
|
|
3524
3524
|
|
|
3525
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
|
+
|
|
3526
3595
|
</dd>
|
|
3527
3596
|
</dl>
|
|
3528
3597
|
</details>
|