phenoml 0.0.8 → 0.0.9

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 (94) hide show
  1. package/dist/cjs/Client.js +2 -2
  2. package/dist/cjs/api/resources/agent/client/Client.d.ts +2 -0
  3. package/dist/cjs/api/resources/agent/client/Client.js +20 -2
  4. package/dist/cjs/api/resources/agent/client/requests/AgentChatRequest.d.ts +12 -0
  5. package/dist/cjs/api/resources/construe/client/Client.d.ts +0 -18
  6. package/dist/cjs/api/resources/construe/client/Client.js +0 -74
  7. package/dist/cjs/api/resources/construe/client/requests/index.d.ts +0 -1
  8. package/dist/cjs/api/resources/construe/types/ExtractRequestConfig.d.ts +28 -2
  9. package/dist/cjs/api/resources/construe/types/ExtractRequestConfig.js +14 -2
  10. package/dist/cjs/api/resources/construe/types/ExtractRequestSystem.d.ts +2 -0
  11. package/dist/cjs/api/resources/construe/types/index.d.ts +0 -4
  12. package/dist/cjs/api/resources/construe/types/index.js +0 -4
  13. package/dist/cjs/api/resources/fhir/client/Client.d.ts +18 -9
  14. package/dist/cjs/api/resources/fhir/client/Client.js +30 -15
  15. package/dist/cjs/api/resources/fhir/client/requests/FhirCreateRequest.d.ts +11 -2
  16. package/dist/cjs/api/resources/fhir/client/requests/FhirDeleteRequest.d.ts +11 -2
  17. package/dist/cjs/api/resources/fhir/client/requests/FhirExecuteBundleRequest.d.ts +11 -2
  18. package/dist/cjs/api/resources/fhir/client/requests/FhirPatchRequest.d.ts +17 -5
  19. package/dist/cjs/api/resources/fhir/client/requests/FhirSearchRequest.d.ts +13 -3
  20. package/dist/cjs/api/resources/fhir/client/requests/FhirUpsertRequest.d.ts +11 -2
  21. package/dist/cjs/api/resources/fhirProvider/client/Client.js +2 -2
  22. package/dist/cjs/api/resources/fhirProvider/client/requests/FhirProviderAddAuthConfigRequest.d.ts +2 -1
  23. package/dist/cjs/api/resources/fhirProvider/client/requests/FhirProviderCreateRequest.d.ts +2 -1
  24. package/dist/cjs/api/resources/fhirProvider/types/AuthMethod.d.ts +2 -1
  25. package/dist/cjs/api/resources/fhirProvider/types/AuthMethod.js +2 -1
  26. package/dist/cjs/api/resources/fhirProvider/types/Role.d.ts +22 -0
  27. package/dist/cjs/api/resources/fhirProvider/types/Role.js +25 -0
  28. package/dist/cjs/api/resources/fhirProvider/types/index.d.ts +1 -0
  29. package/dist/cjs/api/resources/fhirProvider/types/index.js +1 -0
  30. package/dist/cjs/api/resources/tools/client/Client.d.ts +6 -0
  31. package/dist/cjs/api/resources/tools/client/Client.js +38 -6
  32. package/dist/cjs/api/resources/tools/client/requests/CohortRequest.d.ts +12 -0
  33. package/dist/cjs/api/resources/tools/client/requests/Lang2FhirAndCreateRequest.d.ts +12 -0
  34. package/dist/cjs/api/resources/tools/client/requests/Lang2FhirAndSearchRequest.d.ts +12 -0
  35. package/dist/cjs/version.d.ts +1 -1
  36. package/dist/cjs/version.js +1 -1
  37. package/dist/esm/Client.mjs +2 -2
  38. package/dist/esm/api/resources/agent/client/Client.d.mts +2 -0
  39. package/dist/esm/api/resources/agent/client/Client.mjs +20 -2
  40. package/dist/esm/api/resources/agent/client/requests/AgentChatRequest.d.mts +12 -0
  41. package/dist/esm/api/resources/construe/client/Client.d.mts +0 -18
  42. package/dist/esm/api/resources/construe/client/Client.mjs +0 -74
  43. package/dist/esm/api/resources/construe/client/requests/index.d.mts +0 -1
  44. package/dist/esm/api/resources/construe/types/ExtractRequestConfig.d.mts +28 -2
  45. package/dist/esm/api/resources/construe/types/ExtractRequestConfig.mjs +14 -2
  46. package/dist/esm/api/resources/construe/types/ExtractRequestSystem.d.mts +2 -0
  47. package/dist/esm/api/resources/construe/types/index.d.mts +0 -4
  48. package/dist/esm/api/resources/construe/types/index.mjs +0 -4
  49. package/dist/esm/api/resources/fhir/client/Client.d.mts +18 -9
  50. package/dist/esm/api/resources/fhir/client/Client.mjs +30 -15
  51. package/dist/esm/api/resources/fhir/client/requests/FhirCreateRequest.d.mts +11 -2
  52. package/dist/esm/api/resources/fhir/client/requests/FhirDeleteRequest.d.mts +11 -2
  53. package/dist/esm/api/resources/fhir/client/requests/FhirExecuteBundleRequest.d.mts +11 -2
  54. package/dist/esm/api/resources/fhir/client/requests/FhirPatchRequest.d.mts +17 -5
  55. package/dist/esm/api/resources/fhir/client/requests/FhirSearchRequest.d.mts +13 -3
  56. package/dist/esm/api/resources/fhir/client/requests/FhirUpsertRequest.d.mts +11 -2
  57. package/dist/esm/api/resources/fhirProvider/client/Client.mjs +2 -2
  58. package/dist/esm/api/resources/fhirProvider/client/requests/FhirProviderAddAuthConfigRequest.d.mts +2 -1
  59. package/dist/esm/api/resources/fhirProvider/client/requests/FhirProviderCreateRequest.d.mts +2 -1
  60. package/dist/esm/api/resources/fhirProvider/types/AuthMethod.d.mts +2 -1
  61. package/dist/esm/api/resources/fhirProvider/types/AuthMethod.mjs +2 -1
  62. package/dist/esm/api/resources/fhirProvider/types/Role.d.mts +22 -0
  63. package/dist/esm/api/resources/fhirProvider/types/Role.mjs +22 -0
  64. package/dist/esm/api/resources/fhirProvider/types/index.d.mts +1 -0
  65. package/dist/esm/api/resources/fhirProvider/types/index.mjs +1 -0
  66. package/dist/esm/api/resources/tools/client/Client.d.mts +6 -0
  67. package/dist/esm/api/resources/tools/client/Client.mjs +38 -6
  68. package/dist/esm/api/resources/tools/client/requests/CohortRequest.d.mts +12 -0
  69. package/dist/esm/api/resources/tools/client/requests/Lang2FhirAndCreateRequest.d.mts +12 -0
  70. package/dist/esm/api/resources/tools/client/requests/Lang2FhirAndSearchRequest.d.mts +12 -0
  71. package/dist/esm/version.d.mts +1 -1
  72. package/dist/esm/version.mjs +1 -1
  73. package/package.json +1 -1
  74. package/reference.md +20 -72
  75. package/dist/cjs/api/resources/construe/client/requests/ConstrueCohortRequest.d.ts +0 -23
  76. package/dist/cjs/api/resources/construe/client/requests/ConstrueCohortRequest.js +0 -3
  77. package/dist/cjs/api/resources/construe/types/BadRequestErrorBody.d.ts +0 -6
  78. package/dist/cjs/api/resources/construe/types/BadRequestErrorBody.js +0 -3
  79. package/dist/cjs/api/resources/construe/types/ConstrueCohortResponse.d.ts +0 -46
  80. package/dist/cjs/api/resources/construe/types/ConstrueCohortResponse.js +0 -3
  81. package/dist/cjs/api/resources/construe/types/InternalServerErrorBody.d.ts +0 -6
  82. package/dist/cjs/api/resources/construe/types/InternalServerErrorBody.js +0 -3
  83. package/dist/cjs/api/resources/construe/types/UnauthorizedErrorBody.d.ts +0 -6
  84. package/dist/cjs/api/resources/construe/types/UnauthorizedErrorBody.js +0 -3
  85. package/dist/esm/api/resources/construe/client/requests/ConstrueCohortRequest.d.mts +0 -23
  86. package/dist/esm/api/resources/construe/client/requests/ConstrueCohortRequest.mjs +0 -2
  87. package/dist/esm/api/resources/construe/types/BadRequestErrorBody.d.mts +0 -6
  88. package/dist/esm/api/resources/construe/types/BadRequestErrorBody.mjs +0 -2
  89. package/dist/esm/api/resources/construe/types/ConstrueCohortResponse.d.mts +0 -46
  90. package/dist/esm/api/resources/construe/types/ConstrueCohortResponse.mjs +0 -2
  91. package/dist/esm/api/resources/construe/types/InternalServerErrorBody.d.mts +0 -6
  92. package/dist/esm/api/resources/construe/types/InternalServerErrorBody.mjs +0 -2
  93. package/dist/esm/api/resources/construe/types/UnauthorizedErrorBody.d.mts +0 -6
  94. package/dist/esm/api/resources/construe/types/UnauthorizedErrorBody.mjs +0 -2
@@ -52,8 +52,8 @@ class phenomlClient {
52
52
  this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
53
53
  "X-Fern-Language": "JavaScript",
54
54
  "X-Fern-SDK-Name": "phenoml",
55
- "X-Fern-SDK-Version": "0.0.8",
56
- "User-Agent": "phenoml/0.0.8",
55
+ "X-Fern-SDK-Version": "0.0.9",
56
+ "User-Agent": "phenoml/AUTO",
57
57
  "X-Fern-Runtime": core.RUNTIME.type,
58
58
  "X-Fern-Runtime-Version": core.RUNTIME.version,
59
59
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -147,6 +147,8 @@ export declare class Agent {
147
147
  *
148
148
  * @example
149
149
  * await client.agent.chat({
150
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
151
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
150
152
  * message: "What is the patient's current condition?",
151
153
  * agent_id: "agent-123"
152
154
  * })
@@ -42,6 +42,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
42
42
  step((generator = generator.apply(thisArg, _arguments || [])).next());
43
43
  });
44
44
  };
45
+ var __rest = (this && this.__rest) || function (s, e) {
46
+ var t = {};
47
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
48
+ t[p] = s[p];
49
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
50
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
51
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
52
+ t[p[i]] = s[p[i]];
53
+ }
54
+ return t;
55
+ };
45
56
  Object.defineProperty(exports, "__esModule", { value: true });
46
57
  exports.Agent = void 0;
47
58
  const headers_js_1 = require("../../../../core/headers.js");
@@ -523,6 +534,8 @@ class Agent {
523
534
  *
524
535
  * @example
525
536
  * await client.agent.chat({
537
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
538
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
526
539
  * message: "What is the patient's current condition?",
527
540
  * agent_id: "agent-123"
528
541
  * })
@@ -533,7 +546,12 @@ class Agent {
533
546
  __chat(request, requestOptions) {
534
547
  return __awaiter(this, void 0, void 0, function* () {
535
548
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
536
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
549
+ const { "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf, "X-Phenoml-Fhir-Provider": phenomlFhirProvider } = request, _body = __rest(request, ["X-Phenoml-On-Behalf-Of", "X-Phenoml-Fhir-Provider"]);
550
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
551
+ Authorization: yield this._getAuthorizationHeader(),
552
+ "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf != null ? phenomlOnBehalfOf : undefined,
553
+ "X-Phenoml-Fhir-Provider": phenomlFhirProvider != null ? phenomlFhirProvider : undefined,
554
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
537
555
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
538
556
  url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.phenomlEnvironment.Default, "agent/chat"),
539
557
  method: "POST",
@@ -541,7 +559,7 @@ class Agent {
541
559
  contentType: "application/json",
542
560
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
543
561
  requestType: "json",
544
- body: request,
562
+ body: _body,
545
563
  timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
546
564
  maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
547
565
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -1,11 +1,23 @@
1
1
  /**
2
2
  * @example
3
3
  * {
4
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
5
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
4
6
  * message: "What is the patient's current condition?",
5
7
  * agent_id: "agent-123"
6
8
  * }
7
9
  */
8
10
  export interface AgentChatRequest {
11
+ /**
12
+ * Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity.
13
+ * Must be in the format: Patient/{uuid} or Practitioner/{uuid}
14
+ */
15
+ "X-Phenoml-On-Behalf-Of"?: string;
16
+ /**
17
+ * Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}.
18
+ * Multiple FHIR provider integrations can be provided as comma-separated values.
19
+ */
20
+ "X-Phenoml-Fhir-Provider"?: string;
9
21
  /** The message to send to the agent */
10
22
  message: string;
11
23
  /** Optional context for the conversation */
@@ -52,23 +52,5 @@ export declare class Construe {
52
52
  */
53
53
  extractCodes(request: phenoml.construe.ExtractRequest, requestOptions?: Construe.RequestOptions): core.HttpResponsePromise<phenoml.construe.ExtractCodesResult>;
54
54
  private __extractCodes;
55
- /**
56
- * Creates a patient cohort based on a natural language description.
57
- * Translates the description into FHIR search queries and optional SQL queries.
58
- *
59
- * @param {phenoml.construe.ConstrueCohortRequest} request
60
- * @param {Construe.RequestOptions} requestOptions - Request-specific configuration.
61
- *
62
- * @throws {@link phenoml.construe.BadRequestError}
63
- * @throws {@link phenoml.construe.UnauthorizedError}
64
- * @throws {@link phenoml.construe.InternalServerError}
65
- *
66
- * @example
67
- * await client.construe.cohort({
68
- * text: "Between 20 and 40 years old with hyperlipidemia"
69
- * })
70
- */
71
- cohort(request: phenoml.construe.ConstrueCohortRequest, requestOptions?: Construe.RequestOptions): core.HttpResponsePromise<phenoml.construe.ConstrueCohortResponse>;
72
- private __cohort;
73
55
  protected _getAuthorizationHeader(): Promise<string>;
74
56
  }
@@ -210,80 +210,6 @@ class Construe {
210
210
  }
211
211
  });
212
212
  }
213
- /**
214
- * Creates a patient cohort based on a natural language description.
215
- * Translates the description into FHIR search queries and optional SQL queries.
216
- *
217
- * @param {phenoml.construe.ConstrueCohortRequest} request
218
- * @param {Construe.RequestOptions} requestOptions - Request-specific configuration.
219
- *
220
- * @throws {@link phenoml.construe.BadRequestError}
221
- * @throws {@link phenoml.construe.UnauthorizedError}
222
- * @throws {@link phenoml.construe.InternalServerError}
223
- *
224
- * @example
225
- * await client.construe.cohort({
226
- * text: "Between 20 and 40 years old with hyperlipidemia"
227
- * })
228
- */
229
- cohort(request, requestOptions) {
230
- return core.HttpResponsePromise.fromPromise(this.__cohort(request, requestOptions));
231
- }
232
- __cohort(request, requestOptions) {
233
- return __awaiter(this, void 0, void 0, function* () {
234
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
235
- const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
236
- const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
237
- url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.phenomlEnvironment.Default, "construe/cohort"),
238
- method: "POST",
239
- headers: _headers,
240
- contentType: "application/json",
241
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
242
- requestType: "json",
243
- body: request,
244
- timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
245
- maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
246
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
247
- });
248
- if (_response.ok) {
249
- return {
250
- data: _response.body,
251
- rawResponse: _response.rawResponse,
252
- };
253
- }
254
- if (_response.error.reason === "status-code") {
255
- switch (_response.error.statusCode) {
256
- case 400:
257
- throw new phenoml.construe.BadRequestError(_response.error.body, _response.rawResponse);
258
- case 401:
259
- throw new phenoml.construe.UnauthorizedError(_response.error.body, _response.rawResponse);
260
- case 500:
261
- throw new phenoml.construe.InternalServerError(_response.error.body, _response.rawResponse);
262
- default:
263
- throw new errors.phenomlError({
264
- statusCode: _response.error.statusCode,
265
- body: _response.error.body,
266
- rawResponse: _response.rawResponse,
267
- });
268
- }
269
- }
270
- switch (_response.error.reason) {
271
- case "non-json":
272
- throw new errors.phenomlError({
273
- statusCode: _response.error.statusCode,
274
- body: _response.error.rawBody,
275
- rawResponse: _response.rawResponse,
276
- });
277
- case "timeout":
278
- throw new errors.phenomlTimeoutError("Timeout exceeded when calling POST /construe/cohort.");
279
- case "unknown":
280
- throw new errors.phenomlError({
281
- message: _response.error.errorMessage,
282
- rawResponse: _response.rawResponse,
283
- });
284
- }
285
- });
286
- }
287
213
  _getAuthorizationHeader() {
288
214
  return __awaiter(this, void 0, void 0, function* () {
289
215
  return `Bearer ${yield core.Supplier.get(this._options.token)}`;
@@ -1,3 +1,2 @@
1
- export type { ConstrueCohortRequest } from "./ConstrueCohortRequest.js";
2
1
  export type { ExtractRequest } from "./ExtractRequest.js";
3
2
  export type { UploadRequest } from "./UploadRequest.js";
@@ -1,15 +1,41 @@
1
1
  export interface ExtractRequestConfig {
2
+ /** Method for splitting input text into chunks before code extraction */
2
3
  chunking_method?: ExtractRequestConfig.ChunkingMethod;
4
+ /** Maximum number of codes to extract per chunk */
3
5
  max_codes_per_chunk?: number;
6
+ /** Threshold for filtering similar codes (0.0-1.0) */
4
7
  code_similarity_filter?: number;
8
+ /**
9
+ * Method for validating extracted codes:
10
+ * * none - No validation, returns all candidate codes
11
+ * * simple - LLM-based validation
12
+ * * medication_search - LLM-based validation tailored for medication concepts
13
+ */
14
+ validation_method?: ExtractRequestConfig.ValidationMethod;
15
+ /** Whether to include explanations for why each code was extracted */
5
16
  include_rationale?: boolean;
17
+ /** Whether to include ancestor/parent codes in the results */
18
+ include_ancestors?: boolean;
6
19
  }
7
20
  export declare namespace ExtractRequestConfig {
21
+ /** Method for splitting input text into chunks before code extraction */
8
22
  const ChunkingMethod: {
9
23
  readonly None: "none";
10
- readonly Sentence: "sentence";
11
- readonly Paragraph: "paragraph";
24
+ readonly Sentences: "sentences";
25
+ readonly Paragraphs: "paragraphs";
12
26
  readonly Topics: "topics";
13
27
  };
14
28
  type ChunkingMethod = (typeof ChunkingMethod)[keyof typeof ChunkingMethod];
29
+ /**
30
+ * Method for validating extracted codes:
31
+ * * none - No validation, returns all candidate codes
32
+ * * simple - LLM-based validation
33
+ * * medication_search - LLM-based validation tailored for medication concepts
34
+ */
35
+ const ValidationMethod: {
36
+ readonly None: "none";
37
+ readonly Simple: "simple";
38
+ readonly MedicationSearch: "medication_search";
39
+ };
40
+ type ValidationMethod = (typeof ValidationMethod)[keyof typeof ValidationMethod];
15
41
  }
@@ -4,10 +4,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.ExtractRequestConfig = void 0;
5
5
  var ExtractRequestConfig;
6
6
  (function (ExtractRequestConfig) {
7
+ /** Method for splitting input text into chunks before code extraction */
7
8
  ExtractRequestConfig.ChunkingMethod = {
8
9
  None: "none",
9
- Sentence: "sentence",
10
- Paragraph: "paragraph",
10
+ Sentences: "sentences",
11
+ Paragraphs: "paragraphs",
11
12
  Topics: "topics",
12
13
  };
14
+ /**
15
+ * Method for validating extracted codes:
16
+ * * none - No validation, returns all candidate codes
17
+ * * simple - LLM-based validation
18
+ * * medication_search - LLM-based validation tailored for medication concepts
19
+ */
20
+ ExtractRequestConfig.ValidationMethod = {
21
+ None: "none",
22
+ Simple: "simple",
23
+ MedicationSearch: "medication_search",
24
+ };
13
25
  })(ExtractRequestConfig || (exports.ExtractRequestConfig = ExtractRequestConfig = {}));
@@ -8,6 +8,8 @@ export interface ExtractRequestSystem {
8
8
  * * ICD-10-CM - version 2025
9
9
  * * ICD-10-PCS - version 2025
10
10
  * * LOINC - version 2.78
11
+ * * HPO - version 2025
12
+ * * CPT - version 2025
11
13
  *
12
14
  * Custom systems:
13
15
  * * Any valid system name configured in your environment. Must have self-hosted construe module.
@@ -1,9 +1,5 @@
1
- export * from "./BadRequestErrorBody.js";
2
- export * from "./ConstrueCohortResponse.js";
3
1
  export * from "./ConstrueUploadCodeSystemResponse.js";
4
2
  export * from "./ExtractCodesResult.js";
5
3
  export * from "./ExtractedCodeResult.js";
6
4
  export * from "./ExtractRequestConfig.js";
7
5
  export * from "./ExtractRequestSystem.js";
8
- export * from "./InternalServerErrorBody.js";
9
- export * from "./UnauthorizedErrorBody.js";
@@ -14,12 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./BadRequestErrorBody.js"), exports);
18
- __exportStar(require("./ConstrueCohortResponse.js"), exports);
19
17
  __exportStar(require("./ConstrueUploadCodeSystemResponse.js"), exports);
20
18
  __exportStar(require("./ExtractCodesResult.js"), exports);
21
19
  __exportStar(require("./ExtractedCodeResult.js"), exports);
22
20
  __exportStar(require("./ExtractRequestConfig.js"), exports);
23
21
  __exportStar(require("./ExtractRequestSystem.js"), exports);
24
- __exportStar(require("./InternalServerErrorBody.js"), exports);
25
- __exportStar(require("./UnauthorizedErrorBody.js"), exports);
@@ -33,7 +33,8 @@ export declare class Fhir {
33
33
  *
34
34
  * @example
35
35
  * await client.fhir.search("550e8400-e29b-41d4-a716-446655440000", "Patient", {
36
- * "X-Phenoml-On-Behalf-Of": "user@example.com"
36
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
37
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c..."
37
38
  * })
38
39
  */
39
40
  search(fhirProviderId: string, fhirPath: string, request?: phenoml.fhir.FhirSearchRequest, requestOptions?: Fhir.RequestOptions): core.HttpResponsePromise<phenoml.fhir.FhirSearchResponse>;
@@ -60,7 +61,8 @@ export declare class Fhir {
60
61
  *
61
62
  * @example
62
63
  * await client.fhir.create("550e8400-e29b-41d4-a716-446655440000", "Patient", {
63
- * "X-Phenoml-On-Behalf-Of": "user@example.com",
64
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
65
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
64
66
  * body: {
65
67
  * resourceType: "Patient",
66
68
  * name: [
@@ -100,7 +102,8 @@ export declare class Fhir {
100
102
  *
101
103
  * @example
102
104
  * await client.fhir.upsert("550e8400-e29b-41d4-a716-446655440000", "Patient", {
103
- * "X-Phenoml-On-Behalf-Of": "user@example.com",
105
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
106
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
104
107
  * body: {
105
108
  * resourceType: "Patient",
106
109
  * id: "123",
@@ -143,7 +146,8 @@ export declare class Fhir {
143
146
  *
144
147
  * @example
145
148
  * await client.fhir.delete("550e8400-e29b-41d4-a716-446655440000", "Patient", {
146
- * "X-Phenoml-On-Behalf-Of": "user@example.com"
149
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
150
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c..."
147
151
  * })
148
152
  */
149
153
  delete(fhirProviderId: string, fhirPath: string, request?: phenoml.fhir.FhirDeleteRequest, requestOptions?: Fhir.RequestOptions): core.HttpResponsePromise<Record<string, unknown>>;
@@ -176,7 +180,8 @@ export declare class Fhir {
176
180
  *
177
181
  * @example
178
182
  * await client.fhir.patch("550e8400-e29b-41d4-a716-446655440000", "Patient", {
179
- * "X-Phenoml-On-Behalf-Of": "user@example.com",
183
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
184
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
180
185
  * body: [{
181
186
  * op: "replace",
182
187
  * path: "/name/0/family",
@@ -186,7 +191,8 @@ export declare class Fhir {
186
191
  *
187
192
  * @example
188
193
  * await client.fhir.patch("550e8400-e29b-41d4-a716-446655440000", "Patient", {
189
- * "X-Phenoml-On-Behalf-Of": "user@example.com",
194
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
195
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
190
196
  * body: [{
191
197
  * op: "add",
192
198
  * path: "/telecom/-",
@@ -200,7 +206,8 @@ export declare class Fhir {
200
206
  *
201
207
  * @example
202
208
  * await client.fhir.patch("550e8400-e29b-41d4-a716-446655440000", "Patient", {
203
- * "X-Phenoml-On-Behalf-Of": "user@example.com",
209
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
210
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
204
211
  * body: [{
205
212
  * op: "replace",
206
213
  * path: "/name/0/family",
@@ -220,7 +227,8 @@ export declare class Fhir {
220
227
  *
221
228
  * @example
222
229
  * await client.fhir.patch("550e8400-e29b-41d4-a716-446655440000", "Patient", {
223
- * "X-Phenoml-On-Behalf-Of": "user@example.com",
230
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
231
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
224
232
  * body: [{
225
233
  * op: "test",
226
234
  * path: "/gender",
@@ -253,7 +261,8 @@ export declare class Fhir {
253
261
  *
254
262
  * @example
255
263
  * await client.fhir.executeBundle("550e8400-e29b-41d4-a716-446655440000", {
256
- * "X-Phenoml-On-Behalf-Of": "user@example.com",
264
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
265
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
257
266
  * body: {
258
267
  * resourceType: "Bundle",
259
268
  * entry: [{
@@ -77,7 +77,8 @@ class Fhir {
77
77
  *
78
78
  * @example
79
79
  * await client.fhir.search("550e8400-e29b-41d4-a716-446655440000", "Patient", {
80
- * "X-Phenoml-On-Behalf-Of": "user@example.com"
80
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
81
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c..."
81
82
  * })
82
83
  */
83
84
  search(fhirProviderId, fhirPath, request = {}, requestOptions) {
@@ -86,7 +87,7 @@ class Fhir {
86
87
  __search(fhirProviderId_1, fhirPath_1) {
87
88
  return __awaiter(this, arguments, void 0, function* (fhirProviderId, fhirPath, request = {}, requestOptions) {
88
89
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
89
- const { query_parameters: queryParameters, "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf } = request;
90
+ const { query_parameters: queryParameters, "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf, "X-Phenoml-Fhir-Provider": phenomlFhirProvider, } = request;
90
91
  const _queryParams = {};
91
92
  if (queryParameters != null) {
92
93
  _queryParams.query_parameters = (0, json_js_1.toJson)(queryParameters);
@@ -94,6 +95,7 @@ class Fhir {
94
95
  const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
95
96
  Authorization: yield this._getAuthorizationHeader(),
96
97
  "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf != null ? phenomlOnBehalfOf : undefined,
98
+ "X-Phenoml-Fhir-Provider": phenomlFhirProvider != null ? phenomlFhirProvider : undefined,
97
99
  }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
98
100
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
99
101
  url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.phenomlEnvironment.Default, `fhir-provider/${core.url.encodePathParam(fhirProviderId)}/fhir/${core.url.encodePathParam(fhirPath)}`),
@@ -164,7 +166,8 @@ class Fhir {
164
166
  *
165
167
  * @example
166
168
  * await client.fhir.create("550e8400-e29b-41d4-a716-446655440000", "Patient", {
167
- * "X-Phenoml-On-Behalf-Of": "user@example.com",
169
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
170
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
168
171
  * body: {
169
172
  * resourceType: "Patient",
170
173
  * name: [
@@ -186,10 +189,11 @@ class Fhir {
186
189
  __create(fhirProviderId, fhirPath, request, requestOptions) {
187
190
  return __awaiter(this, void 0, void 0, function* () {
188
191
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
189
- const { "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf, body: _body } = request;
192
+ const { "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf, "X-Phenoml-Fhir-Provider": phenomlFhirProvider, body: _body, } = request;
190
193
  const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
191
194
  Authorization: yield this._getAuthorizationHeader(),
192
195
  "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf != null ? phenomlOnBehalfOf : undefined,
196
+ "X-Phenoml-Fhir-Provider": phenomlFhirProvider != null ? phenomlFhirProvider : undefined,
193
197
  }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
194
198
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
195
199
  url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.phenomlEnvironment.Default, `fhir-provider/${core.url.encodePathParam(fhirProviderId)}/fhir/${core.url.encodePathParam(fhirPath)}`),
@@ -261,7 +265,8 @@ class Fhir {
261
265
  *
262
266
  * @example
263
267
  * await client.fhir.upsert("550e8400-e29b-41d4-a716-446655440000", "Patient", {
264
- * "X-Phenoml-On-Behalf-Of": "user@example.com",
268
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
269
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
265
270
  * body: {
266
271
  * resourceType: "Patient",
267
272
  * id: "123",
@@ -285,10 +290,11 @@ class Fhir {
285
290
  __upsert(fhirProviderId, fhirPath, request, requestOptions) {
286
291
  return __awaiter(this, void 0, void 0, function* () {
287
292
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
288
- const { "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf, body: _body } = request;
293
+ const { "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf, "X-Phenoml-Fhir-Provider": phenomlFhirProvider, body: _body, } = request;
289
294
  const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
290
295
  Authorization: yield this._getAuthorizationHeader(),
291
296
  "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf != null ? phenomlOnBehalfOf : undefined,
297
+ "X-Phenoml-Fhir-Provider": phenomlFhirProvider != null ? phenomlFhirProvider : undefined,
292
298
  }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
293
299
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
294
300
  url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.phenomlEnvironment.Default, `fhir-provider/${core.url.encodePathParam(fhirProviderId)}/fhir/${core.url.encodePathParam(fhirPath)}`),
@@ -361,7 +367,8 @@ class Fhir {
361
367
  *
362
368
  * @example
363
369
  * await client.fhir.delete("550e8400-e29b-41d4-a716-446655440000", "Patient", {
364
- * "X-Phenoml-On-Behalf-Of": "user@example.com"
370
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
371
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c..."
365
372
  * })
366
373
  */
367
374
  delete(fhirProviderId, fhirPath, request = {}, requestOptions) {
@@ -370,10 +377,11 @@ class Fhir {
370
377
  __delete(fhirProviderId_1, fhirPath_1) {
371
378
  return __awaiter(this, arguments, void 0, function* (fhirProviderId, fhirPath, request = {}, requestOptions) {
372
379
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
373
- const { "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf } = request;
380
+ const { "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf, "X-Phenoml-Fhir-Provider": phenomlFhirProvider } = request;
374
381
  const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
375
382
  Authorization: yield this._getAuthorizationHeader(),
376
383
  "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf != null ? phenomlOnBehalfOf : undefined,
384
+ "X-Phenoml-Fhir-Provider": phenomlFhirProvider != null ? phenomlFhirProvider : undefined,
377
385
  }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
378
386
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
379
387
  url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.phenomlEnvironment.Default, `fhir-provider/${core.url.encodePathParam(fhirProviderId)}/fhir/${core.url.encodePathParam(fhirPath)}`),
@@ -450,7 +458,8 @@ class Fhir {
450
458
  *
451
459
  * @example
452
460
  * await client.fhir.patch("550e8400-e29b-41d4-a716-446655440000", "Patient", {
453
- * "X-Phenoml-On-Behalf-Of": "user@example.com",
461
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
462
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
454
463
  * body: [{
455
464
  * op: "replace",
456
465
  * path: "/name/0/family",
@@ -460,7 +469,8 @@ class Fhir {
460
469
  *
461
470
  * @example
462
471
  * await client.fhir.patch("550e8400-e29b-41d4-a716-446655440000", "Patient", {
463
- * "X-Phenoml-On-Behalf-Of": "user@example.com",
472
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
473
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
464
474
  * body: [{
465
475
  * op: "add",
466
476
  * path: "/telecom/-",
@@ -474,7 +484,8 @@ class Fhir {
474
484
  *
475
485
  * @example
476
486
  * await client.fhir.patch("550e8400-e29b-41d4-a716-446655440000", "Patient", {
477
- * "X-Phenoml-On-Behalf-Of": "user@example.com",
487
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
488
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
478
489
  * body: [{
479
490
  * op: "replace",
480
491
  * path: "/name/0/family",
@@ -494,7 +505,8 @@ class Fhir {
494
505
  *
495
506
  * @example
496
507
  * await client.fhir.patch("550e8400-e29b-41d4-a716-446655440000", "Patient", {
497
- * "X-Phenoml-On-Behalf-Of": "user@example.com",
508
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
509
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
498
510
  * body: [{
499
511
  * op: "test",
500
512
  * path: "/gender",
@@ -512,10 +524,11 @@ class Fhir {
512
524
  __patch(fhirProviderId, fhirPath, request, requestOptions) {
513
525
  return __awaiter(this, void 0, void 0, function* () {
514
526
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
515
- const { "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf, body: _body } = request;
527
+ const { "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf, "X-Phenoml-Fhir-Provider": phenomlFhirProvider, body: _body, } = request;
516
528
  const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
517
529
  Authorization: yield this._getAuthorizationHeader(),
518
530
  "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf != null ? phenomlOnBehalfOf : undefined,
531
+ "X-Phenoml-Fhir-Provider": phenomlFhirProvider != null ? phenomlFhirProvider : undefined,
519
532
  }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
520
533
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
521
534
  url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.phenomlEnvironment.Default, `fhir-provider/${core.url.encodePathParam(fhirProviderId)}/fhir/${core.url.encodePathParam(fhirPath)}`),
@@ -586,7 +599,8 @@ class Fhir {
586
599
  *
587
600
  * @example
588
601
  * await client.fhir.executeBundle("550e8400-e29b-41d4-a716-446655440000", {
589
- * "X-Phenoml-On-Behalf-Of": "user@example.com",
602
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
603
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
590
604
  * body: {
591
605
  * resourceType: "Bundle",
592
606
  * entry: [{
@@ -627,10 +641,11 @@ class Fhir {
627
641
  __executeBundle(fhirProviderId, request, requestOptions) {
628
642
  return __awaiter(this, void 0, void 0, function* () {
629
643
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
630
- const { "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf, body: _body } = request;
644
+ const { "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf, "X-Phenoml-Fhir-Provider": phenomlFhirProvider, body: _body, } = request;
631
645
  const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
632
646
  Authorization: yield this._getAuthorizationHeader(),
633
647
  "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf != null ? phenomlOnBehalfOf : undefined,
648
+ "X-Phenoml-Fhir-Provider": phenomlFhirProvider != null ? phenomlFhirProvider : undefined,
634
649
  }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
635
650
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
636
651
  url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.phenomlEnvironment.Default, `fhir-provider/${core.url.encodePathParam(fhirProviderId)}/fhir`),
@@ -2,7 +2,8 @@ import type * as phenoml from "../../../../index.js";
2
2
  /**
3
3
  * @example
4
4
  * {
5
- * "X-Phenoml-On-Behalf-Of": "user@example.com",
5
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
6
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
6
7
  * body: {
7
8
  * resourceType: "Patient",
8
9
  * name: [
@@ -19,7 +20,15 @@ import type * as phenoml from "../../../../index.js";
19
20
  * }
20
21
  */
21
22
  export interface FhirCreateRequest {
22
- /** Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity. */
23
+ /**
24
+ * Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity.
25
+ * Must be in the format: Patient/{uuid} or Practitioner/{uuid}
26
+ */
23
27
  "X-Phenoml-On-Behalf-Of"?: string;
28
+ /**
29
+ * Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}.
30
+ * Multiple FHIR provider integrations can be provided as comma-separated values.
31
+ */
32
+ "X-Phenoml-Fhir-Provider"?: string;
24
33
  body: phenoml.fhir.FhirResource;
25
34
  }
@@ -1,10 +1,19 @@
1
1
  /**
2
2
  * @example
3
3
  * {
4
- * "X-Phenoml-On-Behalf-Of": "user@example.com"
4
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
5
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c..."
5
6
  * }
6
7
  */
7
8
  export interface FhirDeleteRequest {
8
- /** Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity. */
9
+ /**
10
+ * Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity.
11
+ * Must be in the format: Patient/{uuid} or Practitioner/{uuid}
12
+ */
9
13
  "X-Phenoml-On-Behalf-Of"?: string;
14
+ /**
15
+ * Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}.
16
+ * Multiple FHIR provider integrations can be provided as comma-separated values.
17
+ */
18
+ "X-Phenoml-Fhir-Provider"?: string;
10
19
  }