phenoml 12.4.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.
Files changed (48) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/lang2Fhir/client/Client.d.ts +11 -3
  3. package/dist/cjs/api/resources/lang2Fhir/client/Client.js +10 -2
  4. package/dist/cjs/api/resources/lang2Fhir/client/requests/CreateMultiRequest.d.ts +9 -0
  5. package/dist/cjs/api/resources/lang2Fhir/client/requests/CreateMultiRequest.js +6 -0
  6. package/dist/cjs/api/resources/lang2Fhir/client/requests/DocumentMultiRequest.d.ts +11 -0
  7. package/dist/cjs/api/resources/lang2Fhir/client/requests/DocumentMultiRequest.js +6 -0
  8. package/dist/cjs/api/resources/lang2Fhir/client/requests/DocumentRequest.d.ts +2 -0
  9. package/dist/cjs/api/resources/lang2Fhir/types/CreateMultiResponse.d.ts +66 -1
  10. package/dist/cjs/api/resources/lang2Fhir/types/CreateMultiResponse.js +26 -0
  11. package/dist/cjs/api/resources/lang2Fhir/types/DocumentConfig.d.ts +7 -0
  12. package/dist/cjs/api/resources/lang2Fhir/types/DocumentConfig.js +3 -0
  13. package/dist/cjs/api/resources/lang2Fhir/types/DocumentMultiResponse.d.ts +5 -0
  14. package/dist/cjs/api/resources/lang2Fhir/types/DocumentMultiResponse.js +3 -0
  15. package/dist/cjs/api/resources/lang2Fhir/types/PageClassification.d.ts +11 -0
  16. package/dist/cjs/api/resources/lang2Fhir/types/PageClassification.js +3 -0
  17. package/dist/cjs/api/resources/lang2Fhir/types/PageFilter.d.ts +7 -0
  18. package/dist/cjs/api/resources/lang2Fhir/types/PageFilter.js +3 -0
  19. package/dist/cjs/api/resources/lang2Fhir/types/index.d.ts +4 -0
  20. package/dist/cjs/api/resources/lang2Fhir/types/index.js +4 -0
  21. package/dist/cjs/api/resources/tools/client/requests/Lang2FhirAndSearchRequest.d.ts +0 -2
  22. package/dist/cjs/version.d.ts +1 -1
  23. package/dist/cjs/version.js +1 -1
  24. package/dist/esm/BaseClient.mjs +2 -2
  25. package/dist/esm/api/resources/lang2Fhir/client/Client.d.mts +11 -3
  26. package/dist/esm/api/resources/lang2Fhir/client/Client.mjs +10 -2
  27. package/dist/esm/api/resources/lang2Fhir/client/requests/CreateMultiRequest.d.mts +9 -0
  28. package/dist/esm/api/resources/lang2Fhir/client/requests/CreateMultiRequest.mjs +6 -0
  29. package/dist/esm/api/resources/lang2Fhir/client/requests/DocumentMultiRequest.d.mts +11 -0
  30. package/dist/esm/api/resources/lang2Fhir/client/requests/DocumentMultiRequest.mjs +6 -0
  31. package/dist/esm/api/resources/lang2Fhir/client/requests/DocumentRequest.d.mts +2 -0
  32. package/dist/esm/api/resources/lang2Fhir/types/CreateMultiResponse.d.mts +66 -1
  33. package/dist/esm/api/resources/lang2Fhir/types/CreateMultiResponse.mjs +25 -1
  34. package/dist/esm/api/resources/lang2Fhir/types/DocumentConfig.d.mts +7 -0
  35. package/dist/esm/api/resources/lang2Fhir/types/DocumentConfig.mjs +2 -0
  36. package/dist/esm/api/resources/lang2Fhir/types/DocumentMultiResponse.d.mts +5 -0
  37. package/dist/esm/api/resources/lang2Fhir/types/DocumentMultiResponse.mjs +2 -0
  38. package/dist/esm/api/resources/lang2Fhir/types/PageClassification.d.mts +11 -0
  39. package/dist/esm/api/resources/lang2Fhir/types/PageClassification.mjs +2 -0
  40. package/dist/esm/api/resources/lang2Fhir/types/PageFilter.d.mts +7 -0
  41. package/dist/esm/api/resources/lang2Fhir/types/PageFilter.mjs +2 -0
  42. package/dist/esm/api/resources/lang2Fhir/types/index.d.mts +4 -0
  43. package/dist/esm/api/resources/lang2Fhir/types/index.mjs +4 -0
  44. package/dist/esm/api/resources/tools/client/requests/Lang2FhirAndSearchRequest.d.mts +0 -2
  45. package/dist/esm/version.d.mts +1 -1
  46. package/dist/esm/version.mjs +1 -1
  47. package/package.json +1 -1
  48. package/reference.md +11 -3
@@ -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": "12.4.0",
47
- "User-Agent": "phenoml/12.4.0",
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.CreateMultiResponse>;
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
  *
@@ -15,6 +15,8 @@ export interface CreateMultiRequest {
15
15
  implementation_guide?: string;
16
16
  /** Detection effort. 'standard' runs detection once, 'deep' runs detection multiple times for higher recall. */
17
17
  detection_effort?: CreateMultiRequest.DetectionEffort;
18
+ /** 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. */
19
+ validation_method?: CreateMultiRequest.ValidationMethod;
18
20
  }
19
21
  export declare namespace CreateMultiRequest {
20
22
  /** Detection effort. 'standard' runs detection once, 'deep' runs detection multiple times for higher recall. */
@@ -23,4 +25,11 @@ export declare namespace CreateMultiRequest {
23
25
  readonly Deep: "deep";
24
26
  };
25
27
  type DetectionEffort = (typeof DetectionEffort)[keyof typeof DetectionEffort];
28
+ /** 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. */
29
+ const ValidationMethod: {
30
+ readonly None: "none";
31
+ readonly Check: "check";
32
+ readonly Fix: "fix";
33
+ };
34
+ type ValidationMethod = (typeof ValidationMethod)[keyof typeof ValidationMethod];
26
35
  }
@@ -9,4 +9,10 @@ var CreateMultiRequest;
9
9
  Standard: "standard",
10
10
  Deep: "deep",
11
11
  };
12
+ /** 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. */
13
+ CreateMultiRequest.ValidationMethod = {
14
+ None: "none",
15
+ Check: "check",
16
+ Fix: "fix",
17
+ };
12
18
  })(CreateMultiRequest || (exports.CreateMultiRequest = CreateMultiRequest = {}));
@@ -1,3 +1,4 @@
1
+ import type * as phenoml from "../../../../index.js";
1
2
  /**
2
3
  * @example
3
4
  * {
@@ -20,6 +21,9 @@ export interface DocumentMultiRequest {
20
21
  implementation_guide?: string;
21
22
  /** Detection effort. 'standard' runs detection once, 'deep' runs detection multiple times for higher recall. */
22
23
  detection_effort?: DocumentMultiRequest.DetectionEffort;
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. */
25
+ validation_method?: DocumentMultiRequest.ValidationMethod;
26
+ config?: phenoml.lang2Fhir.DocumentConfig;
23
27
  }
24
28
  export declare namespace DocumentMultiRequest {
25
29
  /** Detection effort. 'standard' runs detection once, 'deep' runs detection multiple times for higher recall. */
@@ -28,4 +32,11 @@ export declare namespace DocumentMultiRequest {
28
32
  readonly Deep: "deep";
29
33
  };
30
34
  type DetectionEffort = (typeof DetectionEffort)[keyof typeof DetectionEffort];
35
+ /** 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. */
36
+ const ValidationMethod: {
37
+ readonly None: "none";
38
+ readonly Check: "check";
39
+ readonly Fix: "fix";
40
+ };
41
+ type ValidationMethod = (typeof ValidationMethod)[keyof typeof ValidationMethod];
31
42
  }
@@ -9,4 +9,10 @@ var DocumentMultiRequest;
9
9
  Standard: "standard",
10
10
  Deep: "deep",
11
11
  };
12
+ /** 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. */
13
+ DocumentMultiRequest.ValidationMethod = {
14
+ None: "none",
15
+ Check: "check",
16
+ Fix: "fix",
17
+ };
12
18
  })(DocumentMultiRequest || (exports.DocumentMultiRequest = DocumentMultiRequest = {}));
@@ -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
  }
@@ -7,6 +7,8 @@ export interface CreateMultiResponse {
7
7
  bundle?: CreateMultiResponse.Bundle | undefined;
8
8
  /** Summary of extracted resources */
9
9
  resources?: CreateMultiResponse.Resources.Item[] | undefined;
10
+ /** FHIR validation results. Present when validation_method is 'check' or 'fix'. Contains results from each validation pass. For 'check', there is one pass. For 'fix', there may be up to 3 passes as the system attempts auto-correction. */
11
+ validation?: CreateMultiResponse.Validation | undefined;
10
12
  }
11
13
  export declare namespace CreateMultiResponse {
12
14
  /**
@@ -40,8 +42,71 @@ export declare namespace CreateMultiResponse {
40
42
  tempId?: string | undefined;
41
43
  /** FHIR resource type */
42
44
  resourceType?: string | undefined;
43
- /** Text excerpt this resource was extracted from */
45
+ /** Context-enriched rewritten text excerpt for this resource */
44
46
  description?: string | undefined;
47
+ /** Verbatim text excerpt from the original clinical document */
48
+ originalText?: string | undefined;
49
+ }
50
+ }
51
+ /**
52
+ * FHIR validation results. Present when validation_method is 'check' or 'fix'. Contains results from each validation pass. For 'check', there is one pass. For 'fix', there may be up to 3 passes as the system attempts auto-correction.
53
+ */
54
+ interface Validation {
55
+ /** Results from each validation pass, in chronological order */
56
+ passes?: Validation.Passes.Item[] | undefined;
57
+ /** Whether validation errors were successfully fixed by the LLM. Always false for 'check' mode. For 'fix' mode, true if errors were resolved and the returned bundle is the corrected version. */
58
+ fixed?: boolean | undefined;
59
+ /** Total number of validation passes run (1 for check, 1-3 for fix) */
60
+ attempts?: number | undefined;
61
+ /** Human-readable summary of the validation outcome */
62
+ summary?: string | undefined;
63
+ }
64
+ namespace Validation {
65
+ type Passes = Passes.Item[];
66
+ namespace Passes {
67
+ interface Item {
68
+ /** Validation issues found in this pass */
69
+ issues?: Item.Issues.Item[] | undefined;
70
+ /** Validation statistics for this pass */
71
+ stats?: Item.Stats | undefined;
72
+ }
73
+ namespace Item {
74
+ type Issues = Issues.Item[];
75
+ namespace Issues {
76
+ interface Item {
77
+ /** Issue severity level */
78
+ severity?: Item.Severity | undefined;
79
+ /** Issue type code */
80
+ code?: string | undefined;
81
+ /** Human-readable description of the issue */
82
+ diagnostics?: string | undefined;
83
+ /** FHIRPath expression(s) pointing to the issue location */
84
+ expression?: string[] | undefined;
85
+ /** Validation phase that generated this issue */
86
+ source?: string | undefined;
87
+ }
88
+ namespace Item {
89
+ /** Issue severity level */
90
+ const Severity: {
91
+ readonly Fatal: "fatal";
92
+ readonly Error: "error";
93
+ readonly Warning: "warning";
94
+ readonly Information: "information";
95
+ };
96
+ type Severity = (typeof Severity)[keyof typeof Severity];
97
+ }
98
+ }
99
+ /**
100
+ * Validation statistics for this pass
101
+ */
102
+ interface Stats {
103
+ resource_type?: string | undefined;
104
+ profile_url?: string | undefined;
105
+ is_custom_profile?: boolean | undefined;
106
+ /** Validation duration in milliseconds */
107
+ duration_ms?: number | undefined;
108
+ }
109
+ }
45
110
  }
46
111
  }
47
112
  }
@@ -1,3 +1,29 @@
1
1
  "use strict";
2
2
  // This file was auto-generated by Fern from our API Definition.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.CreateMultiResponse = void 0;
5
+ var CreateMultiResponse;
6
+ (function (CreateMultiResponse) {
7
+ let Validation;
8
+ (function (Validation) {
9
+ let Passes;
10
+ (function (Passes) {
11
+ let Item;
12
+ (function (Item_1) {
13
+ let Issues;
14
+ (function (Issues) {
15
+ let Item;
16
+ (function (Item) {
17
+ /** Issue severity level */
18
+ Item.Severity = {
19
+ Fatal: "fatal",
20
+ Error: "error",
21
+ Warning: "warning",
22
+ Information: "information",
23
+ };
24
+ })(Item = Issues.Item || (Issues.Item = {}));
25
+ })(Issues = Item_1.Issues || (Item_1.Issues = {}));
26
+ })(Item = Passes.Item || (Passes.Item = {}));
27
+ })(Passes = Validation.Passes || (Validation.Passes = {}));
28
+ })(Validation = CreateMultiResponse.Validation || (CreateMultiResponse.Validation = {}));
29
+ })(CreateMultiResponse || (exports.CreateMultiResponse = CreateMultiResponse = {}));
@@ -0,0 +1,7 @@
1
+ import type * as phenoml from "../../../index.js";
2
+ /**
3
+ * Optional processing configuration shared across document endpoints.
4
+ */
5
+ export interface DocumentConfig {
6
+ page_filter?: phenoml.lang2Fhir.PageFilter | undefined;
7
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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) */
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "12.4.0";
1
+ export declare const SDK_VERSION = "13.0.0";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "12.4.0";
4
+ exports.SDK_VERSION = "13.0.0";
@@ -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": "12.4.0",
10
- "User-Agent": "phenoml/12.4.0",
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.CreateMultiResponse>;
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
  *
@@ -15,6 +15,8 @@ export interface CreateMultiRequest {
15
15
  implementation_guide?: string;
16
16
  /** Detection effort. 'standard' runs detection once, 'deep' runs detection multiple times for higher recall. */
17
17
  detection_effort?: CreateMultiRequest.DetectionEffort;
18
+ /** 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. */
19
+ validation_method?: CreateMultiRequest.ValidationMethod;
18
20
  }
19
21
  export declare namespace CreateMultiRequest {
20
22
  /** Detection effort. 'standard' runs detection once, 'deep' runs detection multiple times for higher recall. */
@@ -23,4 +25,11 @@ export declare namespace CreateMultiRequest {
23
25
  readonly Deep: "deep";
24
26
  };
25
27
  type DetectionEffort = (typeof DetectionEffort)[keyof typeof DetectionEffort];
28
+ /** 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. */
29
+ const ValidationMethod: {
30
+ readonly None: "none";
31
+ readonly Check: "check";
32
+ readonly Fix: "fix";
33
+ };
34
+ type ValidationMethod = (typeof ValidationMethod)[keyof typeof ValidationMethod];
26
35
  }
@@ -6,4 +6,10 @@ export var CreateMultiRequest;
6
6
  Standard: "standard",
7
7
  Deep: "deep",
8
8
  };
9
+ /** 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. */
10
+ CreateMultiRequest.ValidationMethod = {
11
+ None: "none",
12
+ Check: "check",
13
+ Fix: "fix",
14
+ };
9
15
  })(CreateMultiRequest || (CreateMultiRequest = {}));
@@ -1,3 +1,4 @@
1
+ import type * as phenoml from "../../../../index.mjs";
1
2
  /**
2
3
  * @example
3
4
  * {
@@ -20,6 +21,9 @@ export interface DocumentMultiRequest {
20
21
  implementation_guide?: string;
21
22
  /** Detection effort. 'standard' runs detection once, 'deep' runs detection multiple times for higher recall. */
22
23
  detection_effort?: DocumentMultiRequest.DetectionEffort;
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. */
25
+ validation_method?: DocumentMultiRequest.ValidationMethod;
26
+ config?: phenoml.lang2Fhir.DocumentConfig;
23
27
  }
24
28
  export declare namespace DocumentMultiRequest {
25
29
  /** Detection effort. 'standard' runs detection once, 'deep' runs detection multiple times for higher recall. */
@@ -28,4 +32,11 @@ export declare namespace DocumentMultiRequest {
28
32
  readonly Deep: "deep";
29
33
  };
30
34
  type DetectionEffort = (typeof DetectionEffort)[keyof typeof DetectionEffort];
35
+ /** 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. */
36
+ const ValidationMethod: {
37
+ readonly None: "none";
38
+ readonly Check: "check";
39
+ readonly Fix: "fix";
40
+ };
41
+ type ValidationMethod = (typeof ValidationMethod)[keyof typeof ValidationMethod];
31
42
  }
@@ -6,4 +6,10 @@ export var DocumentMultiRequest;
6
6
  Standard: "standard",
7
7
  Deep: "deep",
8
8
  };
9
+ /** 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. */
10
+ DocumentMultiRequest.ValidationMethod = {
11
+ None: "none",
12
+ Check: "check",
13
+ Fix: "fix",
14
+ };
9
15
  })(DocumentMultiRequest || (DocumentMultiRequest = {}));
@@ -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
  }
@@ -7,6 +7,8 @@ export interface CreateMultiResponse {
7
7
  bundle?: CreateMultiResponse.Bundle | undefined;
8
8
  /** Summary of extracted resources */
9
9
  resources?: CreateMultiResponse.Resources.Item[] | undefined;
10
+ /** FHIR validation results. Present when validation_method is 'check' or 'fix'. Contains results from each validation pass. For 'check', there is one pass. For 'fix', there may be up to 3 passes as the system attempts auto-correction. */
11
+ validation?: CreateMultiResponse.Validation | undefined;
10
12
  }
11
13
  export declare namespace CreateMultiResponse {
12
14
  /**
@@ -40,8 +42,71 @@ export declare namespace CreateMultiResponse {
40
42
  tempId?: string | undefined;
41
43
  /** FHIR resource type */
42
44
  resourceType?: string | undefined;
43
- /** Text excerpt this resource was extracted from */
45
+ /** Context-enriched rewritten text excerpt for this resource */
44
46
  description?: string | undefined;
47
+ /** Verbatim text excerpt from the original clinical document */
48
+ originalText?: string | undefined;
49
+ }
50
+ }
51
+ /**
52
+ * FHIR validation results. Present when validation_method is 'check' or 'fix'. Contains results from each validation pass. For 'check', there is one pass. For 'fix', there may be up to 3 passes as the system attempts auto-correction.
53
+ */
54
+ interface Validation {
55
+ /** Results from each validation pass, in chronological order */
56
+ passes?: Validation.Passes.Item[] | undefined;
57
+ /** Whether validation errors were successfully fixed by the LLM. Always false for 'check' mode. For 'fix' mode, true if errors were resolved and the returned bundle is the corrected version. */
58
+ fixed?: boolean | undefined;
59
+ /** Total number of validation passes run (1 for check, 1-3 for fix) */
60
+ attempts?: number | undefined;
61
+ /** Human-readable summary of the validation outcome */
62
+ summary?: string | undefined;
63
+ }
64
+ namespace Validation {
65
+ type Passes = Passes.Item[];
66
+ namespace Passes {
67
+ interface Item {
68
+ /** Validation issues found in this pass */
69
+ issues?: Item.Issues.Item[] | undefined;
70
+ /** Validation statistics for this pass */
71
+ stats?: Item.Stats | undefined;
72
+ }
73
+ namespace Item {
74
+ type Issues = Issues.Item[];
75
+ namespace Issues {
76
+ interface Item {
77
+ /** Issue severity level */
78
+ severity?: Item.Severity | undefined;
79
+ /** Issue type code */
80
+ code?: string | undefined;
81
+ /** Human-readable description of the issue */
82
+ diagnostics?: string | undefined;
83
+ /** FHIRPath expression(s) pointing to the issue location */
84
+ expression?: string[] | undefined;
85
+ /** Validation phase that generated this issue */
86
+ source?: string | undefined;
87
+ }
88
+ namespace Item {
89
+ /** Issue severity level */
90
+ const Severity: {
91
+ readonly Fatal: "fatal";
92
+ readonly Error: "error";
93
+ readonly Warning: "warning";
94
+ readonly Information: "information";
95
+ };
96
+ type Severity = (typeof Severity)[keyof typeof Severity];
97
+ }
98
+ }
99
+ /**
100
+ * Validation statistics for this pass
101
+ */
102
+ interface Stats {
103
+ resource_type?: string | undefined;
104
+ profile_url?: string | undefined;
105
+ is_custom_profile?: boolean | undefined;
106
+ /** Validation duration in milliseconds */
107
+ duration_ms?: number | undefined;
108
+ }
109
+ }
45
110
  }
46
111
  }
47
112
  }
@@ -1,2 +1,26 @@
1
1
  // This file was auto-generated by Fern from our API Definition.
2
- export {};
2
+ export var CreateMultiResponse;
3
+ (function (CreateMultiResponse) {
4
+ let Validation;
5
+ (function (Validation) {
6
+ let Passes;
7
+ (function (Passes) {
8
+ let Item;
9
+ (function (Item_1) {
10
+ let Issues;
11
+ (function (Issues) {
12
+ let Item;
13
+ (function (Item) {
14
+ /** Issue severity level */
15
+ Item.Severity = {
16
+ Fatal: "fatal",
17
+ Error: "error",
18
+ Warning: "warning",
19
+ Information: "information",
20
+ };
21
+ })(Item = Issues.Item || (Issues.Item = {}));
22
+ })(Issues = Item_1.Issues || (Item_1.Issues = {}));
23
+ })(Item = Passes.Item || (Passes.Item = {}));
24
+ })(Passes = Validation.Passes || (Validation.Passes = {}));
25
+ })(Validation = CreateMultiResponse.Validation || (CreateMultiResponse.Validation = {}));
26
+ })(CreateMultiResponse || (CreateMultiResponse = {}));
@@ -0,0 +1,7 @@
1
+ import type * as phenoml from "../../../index.mjs";
2
+ /**
3
+ * Optional processing configuration shared across document endpoints.
4
+ */
5
+ export interface DocumentConfig {
6
+ page_filter?: phenoml.lang2Fhir.PageFilter | undefined;
7
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -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,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -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,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -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
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -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) */
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "12.4.0";
1
+ export declare const SDK_VERSION = "13.0.0";
@@ -1 +1 @@
1
- export const SDK_VERSION = "12.4.0";
1
+ export const SDK_VERSION = "13.0.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phenoml",
3
- "version": "12.4.0",
3
+ "version": "13.0.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
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.CreateMultiResponse</code></summary>
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>