phenoml 12.5.0 → 13.0.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/BaseClient.js +2 -2
- package/dist/cjs/api/resources/lang2Fhir/client/Client.d.ts +11 -3
- package/dist/cjs/api/resources/lang2Fhir/client/Client.js +10 -2
- package/dist/cjs/api/resources/lang2Fhir/client/requests/DocumentMultiRequest.d.ts +2 -0
- package/dist/cjs/api/resources/lang2Fhir/client/requests/DocumentRequest.d.ts +2 -0
- package/dist/cjs/api/resources/lang2Fhir/types/CreateMultiResponse.d.ts +3 -1
- package/dist/cjs/api/resources/lang2Fhir/types/DocumentConfig.d.ts +7 -0
- package/dist/cjs/api/resources/lang2Fhir/types/DocumentConfig.js +3 -0
- package/dist/cjs/api/resources/lang2Fhir/types/DocumentMultiResponse.d.ts +5 -0
- package/dist/cjs/api/resources/lang2Fhir/types/DocumentMultiResponse.js +3 -0
- package/dist/cjs/api/resources/lang2Fhir/types/PageClassification.d.ts +11 -0
- package/dist/cjs/api/resources/lang2Fhir/types/PageClassification.js +3 -0
- package/dist/cjs/api/resources/lang2Fhir/types/PageFilter.d.ts +7 -0
- package/dist/cjs/api/resources/lang2Fhir/types/PageFilter.js +3 -0
- package/dist/cjs/api/resources/lang2Fhir/types/index.d.ts +4 -0
- package/dist/cjs/api/resources/lang2Fhir/types/index.js +4 -0
- package/dist/cjs/api/resources/tools/client/requests/Lang2FhirAndSearchRequest.d.ts +0 -2
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/api/resources/lang2Fhir/client/Client.d.mts +11 -3
- package/dist/esm/api/resources/lang2Fhir/client/Client.mjs +10 -2
- package/dist/esm/api/resources/lang2Fhir/client/requests/DocumentMultiRequest.d.mts +2 -0
- package/dist/esm/api/resources/lang2Fhir/client/requests/DocumentRequest.d.mts +2 -0
- package/dist/esm/api/resources/lang2Fhir/types/CreateMultiResponse.d.mts +3 -1
- package/dist/esm/api/resources/lang2Fhir/types/DocumentConfig.d.mts +7 -0
- package/dist/esm/api/resources/lang2Fhir/types/DocumentConfig.mjs +2 -0
- package/dist/esm/api/resources/lang2Fhir/types/DocumentMultiResponse.d.mts +5 -0
- package/dist/esm/api/resources/lang2Fhir/types/DocumentMultiResponse.mjs +2 -0
- package/dist/esm/api/resources/lang2Fhir/types/PageClassification.d.mts +11 -0
- package/dist/esm/api/resources/lang2Fhir/types/PageClassification.mjs +2 -0
- package/dist/esm/api/resources/lang2Fhir/types/PageFilter.d.mts +7 -0
- package/dist/esm/api/resources/lang2Fhir/types/PageFilter.mjs +2 -0
- package/dist/esm/api/resources/lang2Fhir/types/index.d.mts +4 -0
- package/dist/esm/api/resources/lang2Fhir/types/index.mjs +4 -0
- package/dist/esm/api/resources/tools/client/requests/Lang2FhirAndSearchRequest.d.mts +0 -2
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +11 -3
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "phenoml",
|
|
46
|
-
"X-Fern-SDK-Version": "
|
|
47
|
-
"User-Agent": "phenoml/
|
|
46
|
+
"X-Fern-SDK-Version": "13.0.0",
|
|
47
|
+
"User-Agent": "phenoml/13.0.0",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -11,7 +11,9 @@ export declare class Lang2FhirClient {
|
|
|
11
11
|
protected readonly _options: NormalizedClientOptionsWithAuth<Lang2FhirClient.Options>;
|
|
12
12
|
constructor(options?: Lang2FhirClient.Options);
|
|
13
13
|
/**
|
|
14
|
-
* Converts natural language text into a structured FHIR resource
|
|
14
|
+
* Converts natural language text into a structured FHIR resource.
|
|
15
|
+
*
|
|
16
|
+
* **Patient identifier handling.** When generating a `patient` (or `patient-canvas`) resource, US Core requires `Patient.identifier` (a business identifier such as an MRN). When the source text contains an identifier, it is extracted with an appropriate URI system. When the source text does not contain a detectable identifier, a synthetic one is generated with `system: "urn:phenoml:lang2fhir-generated-id"` and a UUID `value` so the resource remains FHIR-valid and US Core conformant. Callers who need a tenant-specific namespace should rewrite the synthetic system after extraction.
|
|
15
17
|
*
|
|
16
18
|
* @param {phenoml.lang2Fhir.CreateRequest} request
|
|
17
19
|
* @param {Lang2FhirClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -34,6 +36,8 @@ export declare class Lang2FhirClient {
|
|
|
34
36
|
* Automatically detects Patient, Condition, MedicationRequest, Observation, and other resource types from the text.
|
|
35
37
|
* Resources are linked with proper references (e.g., Conditions reference the Patient).
|
|
36
38
|
*
|
|
39
|
+
* **Patient identifier handling.** US Core requires `Patient.identifier` (a business identifier such as an MRN). When the source text contains an identifier, it is extracted with an appropriate URI system. When the source text does not contain a detectable identifier, a synthetic one is generated with `system: "urn:phenoml:lang2fhir-generated-id"` and a UUID `value` so the bundle remains FHIR-valid and US Core conformant. Callers who need a tenant-specific namespace should rewrite the synthetic system after extraction.
|
|
40
|
+
*
|
|
37
41
|
* @param {phenoml.lang2Fhir.CreateMultiRequest} request
|
|
38
42
|
* @param {Lang2FhirClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
39
43
|
*
|
|
@@ -101,7 +105,9 @@ export declare class Lang2FhirClient {
|
|
|
101
105
|
uploadProfile(request: phenoml.lang2Fhir.ProfileUploadRequest, requestOptions?: Lang2FhirClient.RequestOptions): core.HttpResponsePromise<phenoml.lang2Fhir.Lang2FhirUploadProfileResponse>;
|
|
102
106
|
private __uploadProfile;
|
|
103
107
|
/**
|
|
104
|
-
* Extracts text from a document (PDF or image) and converts it into a structured FHIR resource
|
|
108
|
+
* Extracts text from a document (PDF or image) and converts it into a structured FHIR resource.
|
|
109
|
+
*
|
|
110
|
+
* **Patient identifier handling.** When generating a `patient` (or `patient-canvas`) resource, US Core requires `Patient.identifier` (a business identifier such as an MRN). When the source text contains an identifier, it is extracted with an appropriate URI system. When the source text does not contain a detectable identifier, a synthetic one is generated with `system: "urn:phenoml:lang2fhir-generated-id"` and a UUID `value` so the resource remains FHIR-valid and US Core conformant. Callers who need a tenant-specific namespace should rewrite the synthetic system after extraction.
|
|
105
111
|
*
|
|
106
112
|
* @param {phenoml.lang2Fhir.DocumentRequest} request
|
|
107
113
|
* @param {Lang2FhirClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -125,6 +131,8 @@ export declare class Lang2FhirClient {
|
|
|
125
131
|
* Automatically detects Patient, Condition, MedicationRequest, Observation, and other resource types.
|
|
126
132
|
* Resources are linked with proper references (e.g., Conditions reference the Patient).
|
|
127
133
|
*
|
|
134
|
+
* **Patient identifier handling.** US Core requires `Patient.identifier` (a business identifier such as an MRN). When the source text contains an identifier, it is extracted with an appropriate URI system. When the source text does not contain a detectable identifier, a synthetic one is generated with `system: "urn:phenoml:lang2fhir-generated-id"` and a UUID `value` so the bundle remains FHIR-valid and US Core conformant. Callers who need a tenant-specific namespace should rewrite the synthetic system after extraction.
|
|
135
|
+
*
|
|
128
136
|
* @param {phenoml.lang2Fhir.DocumentMultiRequest} request
|
|
129
137
|
* @param {Lang2FhirClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
130
138
|
*
|
|
@@ -139,6 +147,6 @@ export declare class Lang2FhirClient {
|
|
|
139
147
|
* content: "content"
|
|
140
148
|
* })
|
|
141
149
|
*/
|
|
142
|
-
extractMultipleFhirResourcesFromADocument(request: phenoml.lang2Fhir.DocumentMultiRequest, requestOptions?: Lang2FhirClient.RequestOptions): core.HttpResponsePromise<phenoml.lang2Fhir.
|
|
150
|
+
extractMultipleFhirResourcesFromADocument(request: phenoml.lang2Fhir.DocumentMultiRequest, requestOptions?: Lang2FhirClient.RequestOptions): core.HttpResponsePromise<phenoml.lang2Fhir.DocumentMultiResponse>;
|
|
143
151
|
private __extractMultipleFhirResourcesFromADocument;
|
|
144
152
|
}
|
|
@@ -56,7 +56,9 @@ class Lang2FhirClient {
|
|
|
56
56
|
this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
|
-
* Converts natural language text into a structured FHIR resource
|
|
59
|
+
* Converts natural language text into a structured FHIR resource.
|
|
60
|
+
*
|
|
61
|
+
* **Patient identifier handling.** When generating a `patient` (or `patient-canvas`) resource, US Core requires `Patient.identifier` (a business identifier such as an MRN). When the source text contains an identifier, it is extracted with an appropriate URI system. When the source text does not contain a detectable identifier, a synthetic one is generated with `system: "urn:phenoml:lang2fhir-generated-id"` and a UUID `value` so the resource remains FHIR-valid and US Core conformant. Callers who need a tenant-specific namespace should rewrite the synthetic system after extraction.
|
|
60
62
|
*
|
|
61
63
|
* @param {phenoml.lang2Fhir.CreateRequest} request
|
|
62
64
|
* @param {Lang2FhirClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -121,6 +123,8 @@ class Lang2FhirClient {
|
|
|
121
123
|
* Automatically detects Patient, Condition, MedicationRequest, Observation, and other resource types from the text.
|
|
122
124
|
* Resources are linked with proper references (e.g., Conditions reference the Patient).
|
|
123
125
|
*
|
|
126
|
+
* **Patient identifier handling.** US Core requires `Patient.identifier` (a business identifier such as an MRN). When the source text contains an identifier, it is extracted with an appropriate URI system. When the source text does not contain a detectable identifier, a synthetic one is generated with `system: "urn:phenoml:lang2fhir-generated-id"` and a UUID `value` so the bundle remains FHIR-valid and US Core conformant. Callers who need a tenant-specific namespace should rewrite the synthetic system after extraction.
|
|
127
|
+
*
|
|
124
128
|
* @param {phenoml.lang2Fhir.CreateMultiRequest} request
|
|
125
129
|
* @param {Lang2FhirClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
126
130
|
*
|
|
@@ -324,7 +328,9 @@ class Lang2FhirClient {
|
|
|
324
328
|
});
|
|
325
329
|
}
|
|
326
330
|
/**
|
|
327
|
-
* Extracts text from a document (PDF or image) and converts it into a structured FHIR resource
|
|
331
|
+
* Extracts text from a document (PDF or image) and converts it into a structured FHIR resource.
|
|
332
|
+
*
|
|
333
|
+
* **Patient identifier handling.** When generating a `patient` (or `patient-canvas`) resource, US Core requires `Patient.identifier` (a business identifier such as an MRN). When the source text contains an identifier, it is extracted with an appropriate URI system. When the source text does not contain a detectable identifier, a synthetic one is generated with `system: "urn:phenoml:lang2fhir-generated-id"` and a UUID `value` so the resource remains FHIR-valid and US Core conformant. Callers who need a tenant-specific namespace should rewrite the synthetic system after extraction.
|
|
328
334
|
*
|
|
329
335
|
* @param {phenoml.lang2Fhir.DocumentRequest} request
|
|
330
336
|
* @param {Lang2FhirClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -390,6 +396,8 @@ class Lang2FhirClient {
|
|
|
390
396
|
* Automatically detects Patient, Condition, MedicationRequest, Observation, and other resource types.
|
|
391
397
|
* Resources are linked with proper references (e.g., Conditions reference the Patient).
|
|
392
398
|
*
|
|
399
|
+
* **Patient identifier handling.** US Core requires `Patient.identifier` (a business identifier such as an MRN). When the source text contains an identifier, it is extracted with an appropriate URI system. When the source text does not contain a detectable identifier, a synthetic one is generated with `system: "urn:phenoml:lang2fhir-generated-id"` and a UUID `value` so the bundle remains FHIR-valid and US Core conformant. Callers who need a tenant-specific namespace should rewrite the synthetic system after extraction.
|
|
400
|
+
*
|
|
393
401
|
* @param {phenoml.lang2Fhir.DocumentMultiRequest} request
|
|
394
402
|
* @param {Lang2FhirClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
395
403
|
*
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type * as phenoml from "../../../../index.js";
|
|
1
2
|
/**
|
|
2
3
|
* @example
|
|
3
4
|
* {
|
|
@@ -22,6 +23,7 @@ export interface DocumentMultiRequest {
|
|
|
22
23
|
detection_effort?: DocumentMultiRequest.DetectionEffort;
|
|
23
24
|
/** FHIR validation method to apply to the generated bundle. 'none' skips validation (default). 'check' runs the bundle through a FHIR structure validator and includes the results in the response. 'fix' runs validation and attempts to auto-correct errors using an LLM (up to 3 validation passes). The response includes results from each pass. Warning: 'fix' can significantly increase latency due to multiple LLM and validation round-trips. */
|
|
24
25
|
validation_method?: DocumentMultiRequest.ValidationMethod;
|
|
26
|
+
config?: phenoml.lang2Fhir.DocumentConfig;
|
|
25
27
|
}
|
|
26
28
|
export declare namespace DocumentMultiRequest {
|
|
27
29
|
/** Detection effort. 'standard' runs detection once, 'deep' runs detection multiple times for higher recall. */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type * as phenoml from "../../../../index.js";
|
|
1
2
|
/**
|
|
2
3
|
* @example
|
|
3
4
|
* {
|
|
@@ -17,4 +18,5 @@ export interface DocumentRequest {
|
|
|
17
18
|
* File type is auto-detected from content magic bytes.
|
|
18
19
|
*/
|
|
19
20
|
content: string;
|
|
21
|
+
config?: phenoml.lang2Fhir.DocumentConfig;
|
|
20
22
|
}
|
|
@@ -42,8 +42,10 @@ export declare namespace CreateMultiResponse {
|
|
|
42
42
|
tempId?: string | undefined;
|
|
43
43
|
/** FHIR resource type */
|
|
44
44
|
resourceType?: string | undefined;
|
|
45
|
-
/**
|
|
45
|
+
/** Context-enriched rewritten text excerpt for this resource */
|
|
46
46
|
description?: string | undefined;
|
|
47
|
+
/** Verbatim text excerpt from the original clinical document */
|
|
48
|
+
originalText?: string | undefined;
|
|
47
49
|
}
|
|
48
50
|
}
|
|
49
51
|
/**
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type * as phenoml from "../../../index.js";
|
|
2
|
+
export interface DocumentMultiResponse extends phenoml.lang2Fhir.CreateMultiResponse {
|
|
3
|
+
/** Per-page classifier decisions. Populated only when a page_filter was supplied in the request. Contains one entry per input page, including both kept and dropped pages. */
|
|
4
|
+
page_classifications?: phenoml.lang2Fhir.PageClassification[] | undefined;
|
|
5
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The classifier's decision for a single page of the input document.
|
|
3
|
+
*/
|
|
4
|
+
export interface PageClassification {
|
|
5
|
+
/** 1-indexed page number. */
|
|
6
|
+
page_number?: number | undefined;
|
|
7
|
+
/** Whether the page was kept (true) or dropped (false) from FHIR extraction. */
|
|
8
|
+
include?: boolean | undefined;
|
|
9
|
+
/** Short LLM-generated explanation of the decision. */
|
|
10
|
+
reason?: string | undefined;
|
|
11
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configures per-page pre-extraction filtering. When set, each page of text extracted from the document is classified by an LLM, and pages classified as irrelevant to the supplied context are dropped before FHIR extraction.
|
|
3
|
+
*/
|
|
4
|
+
export interface PageFilter {
|
|
5
|
+
/** Natural-language description of what IS relevant to the extraction goal. Pages that do not match are dropped from downstream FHIR extraction. */
|
|
6
|
+
context: string;
|
|
7
|
+
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export * from "./CreateMultiResponse.js";
|
|
2
|
+
export * from "./DocumentConfig.js";
|
|
3
|
+
export * from "./DocumentMultiResponse.js";
|
|
2
4
|
export * from "./FhirResource.js";
|
|
3
5
|
export * from "./Lang2FhirUploadProfileResponse.js";
|
|
6
|
+
export * from "./PageClassification.js";
|
|
7
|
+
export * from "./PageFilter.js";
|
|
4
8
|
export * from "./SearchResponse.js";
|
|
@@ -15,6 +15,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./CreateMultiResponse.js"), exports);
|
|
18
|
+
__exportStar(require("./DocumentConfig.js"), exports);
|
|
19
|
+
__exportStar(require("./DocumentMultiResponse.js"), exports);
|
|
18
20
|
__exportStar(require("./FhirResource.js"), exports);
|
|
19
21
|
__exportStar(require("./Lang2FhirUploadProfileResponse.js"), exports);
|
|
22
|
+
__exportStar(require("./PageClassification.js"), exports);
|
|
23
|
+
__exportStar(require("./PageFilter.js"), exports);
|
|
20
24
|
__exportStar(require("./SearchResponse.js"), exports);
|
|
@@ -21,8 +21,6 @@ export interface Lang2FhirAndSearchRequest {
|
|
|
21
21
|
text: string;
|
|
22
22
|
/** Patient ID to filter results */
|
|
23
23
|
patient_id?: string;
|
|
24
|
-
/** Practitioner ID to filter results */
|
|
25
|
-
practitioner_id?: string;
|
|
26
24
|
/** Maximum number of results to return */
|
|
27
25
|
count?: number;
|
|
28
26
|
/** FHIR provider ID - must be a valid UUID from existing FHIR providers. also supports provider by name (e.g. medplum) */
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "
|
|
1
|
+
export declare const SDK_VERSION = "13.0.0";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
|
|
|
6
6
|
const headers = mergeHeaders({
|
|
7
7
|
"X-Fern-Language": "JavaScript",
|
|
8
8
|
"X-Fern-SDK-Name": "phenoml",
|
|
9
|
-
"X-Fern-SDK-Version": "
|
|
10
|
-
"User-Agent": "phenoml/
|
|
9
|
+
"X-Fern-SDK-Version": "13.0.0",
|
|
10
|
+
"User-Agent": "phenoml/13.0.0",
|
|
11
11
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
12
12
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
13
13
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -11,7 +11,9 @@ export declare class Lang2FhirClient {
|
|
|
11
11
|
protected readonly _options: NormalizedClientOptionsWithAuth<Lang2FhirClient.Options>;
|
|
12
12
|
constructor(options?: Lang2FhirClient.Options);
|
|
13
13
|
/**
|
|
14
|
-
* Converts natural language text into a structured FHIR resource
|
|
14
|
+
* Converts natural language text into a structured FHIR resource.
|
|
15
|
+
*
|
|
16
|
+
* **Patient identifier handling.** When generating a `patient` (or `patient-canvas`) resource, US Core requires `Patient.identifier` (a business identifier such as an MRN). When the source text contains an identifier, it is extracted with an appropriate URI system. When the source text does not contain a detectable identifier, a synthetic one is generated with `system: "urn:phenoml:lang2fhir-generated-id"` and a UUID `value` so the resource remains FHIR-valid and US Core conformant. Callers who need a tenant-specific namespace should rewrite the synthetic system after extraction.
|
|
15
17
|
*
|
|
16
18
|
* @param {phenoml.lang2Fhir.CreateRequest} request
|
|
17
19
|
* @param {Lang2FhirClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -34,6 +36,8 @@ export declare class Lang2FhirClient {
|
|
|
34
36
|
* Automatically detects Patient, Condition, MedicationRequest, Observation, and other resource types from the text.
|
|
35
37
|
* Resources are linked with proper references (e.g., Conditions reference the Patient).
|
|
36
38
|
*
|
|
39
|
+
* **Patient identifier handling.** US Core requires `Patient.identifier` (a business identifier such as an MRN). When the source text contains an identifier, it is extracted with an appropriate URI system. When the source text does not contain a detectable identifier, a synthetic one is generated with `system: "urn:phenoml:lang2fhir-generated-id"` and a UUID `value` so the bundle remains FHIR-valid and US Core conformant. Callers who need a tenant-specific namespace should rewrite the synthetic system after extraction.
|
|
40
|
+
*
|
|
37
41
|
* @param {phenoml.lang2Fhir.CreateMultiRequest} request
|
|
38
42
|
* @param {Lang2FhirClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
39
43
|
*
|
|
@@ -101,7 +105,9 @@ export declare class Lang2FhirClient {
|
|
|
101
105
|
uploadProfile(request: phenoml.lang2Fhir.ProfileUploadRequest, requestOptions?: Lang2FhirClient.RequestOptions): core.HttpResponsePromise<phenoml.lang2Fhir.Lang2FhirUploadProfileResponse>;
|
|
102
106
|
private __uploadProfile;
|
|
103
107
|
/**
|
|
104
|
-
* Extracts text from a document (PDF or image) and converts it into a structured FHIR resource
|
|
108
|
+
* Extracts text from a document (PDF or image) and converts it into a structured FHIR resource.
|
|
109
|
+
*
|
|
110
|
+
* **Patient identifier handling.** When generating a `patient` (or `patient-canvas`) resource, US Core requires `Patient.identifier` (a business identifier such as an MRN). When the source text contains an identifier, it is extracted with an appropriate URI system. When the source text does not contain a detectable identifier, a synthetic one is generated with `system: "urn:phenoml:lang2fhir-generated-id"` and a UUID `value` so the resource remains FHIR-valid and US Core conformant. Callers who need a tenant-specific namespace should rewrite the synthetic system after extraction.
|
|
105
111
|
*
|
|
106
112
|
* @param {phenoml.lang2Fhir.DocumentRequest} request
|
|
107
113
|
* @param {Lang2FhirClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -125,6 +131,8 @@ export declare class Lang2FhirClient {
|
|
|
125
131
|
* Automatically detects Patient, Condition, MedicationRequest, Observation, and other resource types.
|
|
126
132
|
* Resources are linked with proper references (e.g., Conditions reference the Patient).
|
|
127
133
|
*
|
|
134
|
+
* **Patient identifier handling.** US Core requires `Patient.identifier` (a business identifier such as an MRN). When the source text contains an identifier, it is extracted with an appropriate URI system. When the source text does not contain a detectable identifier, a synthetic one is generated with `system: "urn:phenoml:lang2fhir-generated-id"` and a UUID `value` so the bundle remains FHIR-valid and US Core conformant. Callers who need a tenant-specific namespace should rewrite the synthetic system after extraction.
|
|
135
|
+
*
|
|
128
136
|
* @param {phenoml.lang2Fhir.DocumentMultiRequest} request
|
|
129
137
|
* @param {Lang2FhirClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
130
138
|
*
|
|
@@ -139,6 +147,6 @@ export declare class Lang2FhirClient {
|
|
|
139
147
|
* content: "content"
|
|
140
148
|
* })
|
|
141
149
|
*/
|
|
142
|
-
extractMultipleFhirResourcesFromADocument(request: phenoml.lang2Fhir.DocumentMultiRequest, requestOptions?: Lang2FhirClient.RequestOptions): core.HttpResponsePromise<phenoml.lang2Fhir.
|
|
150
|
+
extractMultipleFhirResourcesFromADocument(request: phenoml.lang2Fhir.DocumentMultiRequest, requestOptions?: Lang2FhirClient.RequestOptions): core.HttpResponsePromise<phenoml.lang2Fhir.DocumentMultiResponse>;
|
|
143
151
|
private __extractMultipleFhirResourcesFromADocument;
|
|
144
152
|
}
|
|
@@ -20,7 +20,9 @@ export class Lang2FhirClient {
|
|
|
20
20
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
* Converts natural language text into a structured FHIR resource
|
|
23
|
+
* Converts natural language text into a structured FHIR resource.
|
|
24
|
+
*
|
|
25
|
+
* **Patient identifier handling.** When generating a `patient` (or `patient-canvas`) resource, US Core requires `Patient.identifier` (a business identifier such as an MRN). When the source text contains an identifier, it is extracted with an appropriate URI system. When the source text does not contain a detectable identifier, a synthetic one is generated with `system: "urn:phenoml:lang2fhir-generated-id"` and a UUID `value` so the resource remains FHIR-valid and US Core conformant. Callers who need a tenant-specific namespace should rewrite the synthetic system after extraction.
|
|
24
26
|
*
|
|
25
27
|
* @param {phenoml.lang2Fhir.CreateRequest} request
|
|
26
28
|
* @param {Lang2FhirClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -85,6 +87,8 @@ export class Lang2FhirClient {
|
|
|
85
87
|
* Automatically detects Patient, Condition, MedicationRequest, Observation, and other resource types from the text.
|
|
86
88
|
* Resources are linked with proper references (e.g., Conditions reference the Patient).
|
|
87
89
|
*
|
|
90
|
+
* **Patient identifier handling.** US Core requires `Patient.identifier` (a business identifier such as an MRN). When the source text contains an identifier, it is extracted with an appropriate URI system. When the source text does not contain a detectable identifier, a synthetic one is generated with `system: "urn:phenoml:lang2fhir-generated-id"` and a UUID `value` so the bundle remains FHIR-valid and US Core conformant. Callers who need a tenant-specific namespace should rewrite the synthetic system after extraction.
|
|
91
|
+
*
|
|
88
92
|
* @param {phenoml.lang2Fhir.CreateMultiRequest} request
|
|
89
93
|
* @param {Lang2FhirClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
90
94
|
*
|
|
@@ -288,7 +292,9 @@ export class Lang2FhirClient {
|
|
|
288
292
|
});
|
|
289
293
|
}
|
|
290
294
|
/**
|
|
291
|
-
* Extracts text from a document (PDF or image) and converts it into a structured FHIR resource
|
|
295
|
+
* Extracts text from a document (PDF or image) and converts it into a structured FHIR resource.
|
|
296
|
+
*
|
|
297
|
+
* **Patient identifier handling.** When generating a `patient` (or `patient-canvas`) resource, US Core requires `Patient.identifier` (a business identifier such as an MRN). When the source text contains an identifier, it is extracted with an appropriate URI system. When the source text does not contain a detectable identifier, a synthetic one is generated with `system: "urn:phenoml:lang2fhir-generated-id"` and a UUID `value` so the resource remains FHIR-valid and US Core conformant. Callers who need a tenant-specific namespace should rewrite the synthetic system after extraction.
|
|
292
298
|
*
|
|
293
299
|
* @param {phenoml.lang2Fhir.DocumentRequest} request
|
|
294
300
|
* @param {Lang2FhirClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -354,6 +360,8 @@ export class Lang2FhirClient {
|
|
|
354
360
|
* Automatically detects Patient, Condition, MedicationRequest, Observation, and other resource types.
|
|
355
361
|
* Resources are linked with proper references (e.g., Conditions reference the Patient).
|
|
356
362
|
*
|
|
363
|
+
* **Patient identifier handling.** US Core requires `Patient.identifier` (a business identifier such as an MRN). When the source text contains an identifier, it is extracted with an appropriate URI system. When the source text does not contain a detectable identifier, a synthetic one is generated with `system: "urn:phenoml:lang2fhir-generated-id"` and a UUID `value` so the bundle remains FHIR-valid and US Core conformant. Callers who need a tenant-specific namespace should rewrite the synthetic system after extraction.
|
|
364
|
+
*
|
|
357
365
|
* @param {phenoml.lang2Fhir.DocumentMultiRequest} request
|
|
358
366
|
* @param {Lang2FhirClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
359
367
|
*
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type * as phenoml from "../../../../index.mjs";
|
|
1
2
|
/**
|
|
2
3
|
* @example
|
|
3
4
|
* {
|
|
@@ -22,6 +23,7 @@ export interface DocumentMultiRequest {
|
|
|
22
23
|
detection_effort?: DocumentMultiRequest.DetectionEffort;
|
|
23
24
|
/** FHIR validation method to apply to the generated bundle. 'none' skips validation (default). 'check' runs the bundle through a FHIR structure validator and includes the results in the response. 'fix' runs validation and attempts to auto-correct errors using an LLM (up to 3 validation passes). The response includes results from each pass. Warning: 'fix' can significantly increase latency due to multiple LLM and validation round-trips. */
|
|
24
25
|
validation_method?: DocumentMultiRequest.ValidationMethod;
|
|
26
|
+
config?: phenoml.lang2Fhir.DocumentConfig;
|
|
25
27
|
}
|
|
26
28
|
export declare namespace DocumentMultiRequest {
|
|
27
29
|
/** Detection effort. 'standard' runs detection once, 'deep' runs detection multiple times for higher recall. */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type * as phenoml from "../../../../index.mjs";
|
|
1
2
|
/**
|
|
2
3
|
* @example
|
|
3
4
|
* {
|
|
@@ -17,4 +18,5 @@ export interface DocumentRequest {
|
|
|
17
18
|
* File type is auto-detected from content magic bytes.
|
|
18
19
|
*/
|
|
19
20
|
content: string;
|
|
21
|
+
config?: phenoml.lang2Fhir.DocumentConfig;
|
|
20
22
|
}
|
|
@@ -42,8 +42,10 @@ export declare namespace CreateMultiResponse {
|
|
|
42
42
|
tempId?: string | undefined;
|
|
43
43
|
/** FHIR resource type */
|
|
44
44
|
resourceType?: string | undefined;
|
|
45
|
-
/**
|
|
45
|
+
/** Context-enriched rewritten text excerpt for this resource */
|
|
46
46
|
description?: string | undefined;
|
|
47
|
+
/** Verbatim text excerpt from the original clinical document */
|
|
48
|
+
originalText?: string | undefined;
|
|
47
49
|
}
|
|
48
50
|
}
|
|
49
51
|
/**
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type * as phenoml from "../../../index.mjs";
|
|
2
|
+
export interface DocumentMultiResponse extends phenoml.lang2Fhir.CreateMultiResponse {
|
|
3
|
+
/** Per-page classifier decisions. Populated only when a page_filter was supplied in the request. Contains one entry per input page, including both kept and dropped pages. */
|
|
4
|
+
page_classifications?: phenoml.lang2Fhir.PageClassification[] | undefined;
|
|
5
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The classifier's decision for a single page of the input document.
|
|
3
|
+
*/
|
|
4
|
+
export interface PageClassification {
|
|
5
|
+
/** 1-indexed page number. */
|
|
6
|
+
page_number?: number | undefined;
|
|
7
|
+
/** Whether the page was kept (true) or dropped (false) from FHIR extraction. */
|
|
8
|
+
include?: boolean | undefined;
|
|
9
|
+
/** Short LLM-generated explanation of the decision. */
|
|
10
|
+
reason?: string | undefined;
|
|
11
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configures per-page pre-extraction filtering. When set, each page of text extracted from the document is classified by an LLM, and pages classified as irrelevant to the supplied context are dropped before FHIR extraction.
|
|
3
|
+
*/
|
|
4
|
+
export interface PageFilter {
|
|
5
|
+
/** Natural-language description of what IS relevant to the extraction goal. Pages that do not match are dropped from downstream FHIR extraction. */
|
|
6
|
+
context: string;
|
|
7
|
+
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export * from "./CreateMultiResponse.mjs";
|
|
2
|
+
export * from "./DocumentConfig.mjs";
|
|
3
|
+
export * from "./DocumentMultiResponse.mjs";
|
|
2
4
|
export * from "./FhirResource.mjs";
|
|
3
5
|
export * from "./Lang2FhirUploadProfileResponse.mjs";
|
|
6
|
+
export * from "./PageClassification.mjs";
|
|
7
|
+
export * from "./PageFilter.mjs";
|
|
4
8
|
export * from "./SearchResponse.mjs";
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export * from "./CreateMultiResponse.mjs";
|
|
2
|
+
export * from "./DocumentConfig.mjs";
|
|
3
|
+
export * from "./DocumentMultiResponse.mjs";
|
|
2
4
|
export * from "./FhirResource.mjs";
|
|
3
5
|
export * from "./Lang2FhirUploadProfileResponse.mjs";
|
|
6
|
+
export * from "./PageClassification.mjs";
|
|
7
|
+
export * from "./PageFilter.mjs";
|
|
4
8
|
export * from "./SearchResponse.mjs";
|
|
@@ -21,8 +21,6 @@ export interface Lang2FhirAndSearchRequest {
|
|
|
21
21
|
text: string;
|
|
22
22
|
/** Patient ID to filter results */
|
|
23
23
|
patient_id?: string;
|
|
24
|
-
/** Practitioner ID to filter results */
|
|
25
|
-
practitioner_id?: string;
|
|
26
24
|
/** Maximum number of results to return */
|
|
27
25
|
count?: number;
|
|
28
26
|
/** FHIR provider ID - must be a valid UUID from existing FHIR providers. also supports provider by name (e.g. medplum) */
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "
|
|
1
|
+
export declare const SDK_VERSION = "13.0.0";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "
|
|
1
|
+
export const SDK_VERSION = "13.0.0";
|
package/package.json
CHANGED
package/reference.md
CHANGED
|
@@ -3171,7 +3171,9 @@ await client.fhirProvider.removeAuthConfig("1716d214-de93-43a4-aa6b-a878d864e2ad
|
|
|
3171
3171
|
<dl>
|
|
3172
3172
|
<dd>
|
|
3173
3173
|
|
|
3174
|
-
Converts natural language text into a structured FHIR resource
|
|
3174
|
+
Converts natural language text into a structured FHIR resource.
|
|
3175
|
+
|
|
3176
|
+
**Patient identifier handling.** When generating a `patient` (or `patient-canvas`) resource, US Core requires `Patient.identifier` (a business identifier such as an MRN). When the source text contains an identifier, it is extracted with an appropriate URI system. When the source text does not contain a detectable identifier, a synthetic one is generated with `system: "urn:phenoml:lang2fhir-generated-id"` and a UUID `value` so the resource remains FHIR-valid and US Core conformant. Callers who need a tenant-specific namespace should rewrite the synthetic system after extraction.
|
|
3175
3177
|
</dd>
|
|
3176
3178
|
</dl>
|
|
3177
3179
|
</dd>
|
|
@@ -3241,6 +3243,8 @@ await client.lang2Fhir.create({
|
|
|
3241
3243
|
Analyzes natural language text and extracts multiple FHIR resources, returning them as a transaction Bundle.
|
|
3242
3244
|
Automatically detects Patient, Condition, MedicationRequest, Observation, and other resource types from the text.
|
|
3243
3245
|
Resources are linked with proper references (e.g., Conditions reference the Patient).
|
|
3246
|
+
|
|
3247
|
+
**Patient identifier handling.** US Core requires `Patient.identifier` (a business identifier such as an MRN). When the source text contains an identifier, it is extracted with an appropriate URI system. When the source text does not contain a detectable identifier, a synthetic one is generated with `system: "urn:phenoml:lang2fhir-generated-id"` and a UUID `value` so the bundle remains FHIR-valid and US Core conformant. Callers who need a tenant-specific namespace should rewrite the synthetic system after extraction.
|
|
3244
3248
|
</dd>
|
|
3245
3249
|
</dl>
|
|
3246
3250
|
</dd>
|
|
@@ -3451,7 +3455,9 @@ await client.lang2Fhir.uploadProfile({
|
|
|
3451
3455
|
<dl>
|
|
3452
3456
|
<dd>
|
|
3453
3457
|
|
|
3454
|
-
Extracts text from a document (PDF or image) and converts it into a structured FHIR resource
|
|
3458
|
+
Extracts text from a document (PDF or image) and converts it into a structured FHIR resource.
|
|
3459
|
+
|
|
3460
|
+
**Patient identifier handling.** When generating a `patient` (or `patient-canvas`) resource, US Core requires `Patient.identifier` (a business identifier such as an MRN). When the source text contains an identifier, it is extracted with an appropriate URI system. When the source text does not contain a detectable identifier, a synthetic one is generated with `system: "urn:phenoml:lang2fhir-generated-id"` and a UUID `value` so the resource remains FHIR-valid and US Core conformant. Callers who need a tenant-specific namespace should rewrite the synthetic system after extraction.
|
|
3455
3461
|
</dd>
|
|
3456
3462
|
</dl>
|
|
3457
3463
|
</dd>
|
|
@@ -3506,7 +3512,7 @@ await client.lang2Fhir.document({
|
|
|
3506
3512
|
</dl>
|
|
3507
3513
|
</details>
|
|
3508
3514
|
|
|
3509
|
-
<details><summary><code>client.lang2Fhir.<a href="/src/api/resources/lang2Fhir/client/Client.ts">extractMultipleFhirResourcesFromADocument</a>({ ...params }) -> phenoml.
|
|
3515
|
+
<details><summary><code>client.lang2Fhir.<a href="/src/api/resources/lang2Fhir/client/Client.ts">extractMultipleFhirResourcesFromADocument</a>({ ...params }) -> phenoml.DocumentMultiResponse</code></summary>
|
|
3510
3516
|
<dl>
|
|
3511
3517
|
<dd>
|
|
3512
3518
|
|
|
@@ -3522,6 +3528,8 @@ Extracts text from a document (PDF or image) and converts it into multiple FHIR
|
|
|
3522
3528
|
returned as a transaction Bundle. Combines document text extraction with multi-resource detection.
|
|
3523
3529
|
Automatically detects Patient, Condition, MedicationRequest, Observation, and other resource types.
|
|
3524
3530
|
Resources are linked with proper references (e.g., Conditions reference the Patient).
|
|
3531
|
+
|
|
3532
|
+
**Patient identifier handling.** US Core requires `Patient.identifier` (a business identifier such as an MRN). When the source text contains an identifier, it is extracted with an appropriate URI system. When the source text does not contain a detectable identifier, a synthetic one is generated with `system: "urn:phenoml:lang2fhir-generated-id"` and a UUID `value` so the bundle remains FHIR-valid and US Core conformant. Callers who need a tenant-specific namespace should rewrite the synthetic system after extraction.
|
|
3525
3533
|
</dd>
|
|
3526
3534
|
</dl>
|
|
3527
3535
|
</dd>
|