phenoml 0.0.8 → 0.0.10

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
@@ -1,12 +1,14 @@
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
  * @example
8
9
  * {
9
- * "X-Phenoml-On-Behalf-Of": "user@example.com"
10
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
11
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c..."
10
12
  * }
11
13
  */
12
14
  export interface FhirSearchRequest {
@@ -18,6 +20,14 @@ export interface FhirSearchRequest {
18
20
  * - Search prefixes for dates, numbers, quantities (eq, ne, gt, ge, lt, le, sa, eb, ap)
19
21
  */
20
22
  query_parameters?: Record<string, string | undefined>;
21
- /** 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
+ */
22
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;
23
33
  }
@@ -2,7 +2,8 @@ import type * as phenoml from "../../../../index.mjs";
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
  * id: "123",
@@ -21,7 +22,15 @@ import type * as phenoml from "../../../../index.mjs";
21
22
  * }
22
23
  */
23
24
  export interface FhirUpsertRequest {
24
- /** Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity. */
25
+ /**
26
+ * Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity.
27
+ * Must be in the format: Patient/{uuid} or Practitioner/{uuid}
28
+ */
25
29
  "X-Phenoml-On-Behalf-Of"?: string;
30
+ /**
31
+ * Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}.
32
+ * Multiple FHIR provider integrations can be provided as comma-separated values.
33
+ */
34
+ "X-Phenoml-Fhir-Provider"?: string;
26
35
  body: phenoml.fhir.FhirResource;
27
36
  }
@@ -44,7 +44,7 @@ export class FhirProvider {
44
44
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
45
45
  const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
46
46
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
47
- 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/create"),
47
+ 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"),
48
48
  method: "POST",
49
49
  headers: _headers,
50
50
  contentType: "application/json",
@@ -87,7 +87,7 @@ export class FhirProvider {
87
87
  rawResponse: _response.rawResponse,
88
88
  });
89
89
  case "timeout":
90
- throw new errors.phenomlTimeoutError("Timeout exceeded when calling POST /fhir-provider/create.");
90
+ throw new errors.phenomlTimeoutError("Timeout exceeded when calling POST /fhir-provider.");
91
91
  case "unknown":
92
92
  throw new errors.phenomlError({
93
93
  message: _response.error.errorMessage,
@@ -12,6 +12,7 @@ export interface FhirProviderAddAuthConfigRequest {
12
12
  service_account_key?: phenoml.fhirProvider.ServiceAccountKey;
13
13
  /** Expiry time for JWT credentials (only applicable for JWT auth method) */
14
14
  credential_expiry?: string;
15
- /** OAuth scopes to request */
15
+ role?: phenoml.fhirProvider.Role;
16
+ /** OAuth scopes to request. Cannot be specified with role. If neither role nor scopes are specified, the provider-specific default role will be used. You are solely responsible for ensuring the scopes are valid options for the provider being created or updated. */
16
17
  scopes?: string;
17
18
  }
@@ -22,6 +22,7 @@ export interface FhirProviderCreateRequest {
22
22
  /** OAuth client secret (required for client_secret and on_behalf_of auth methods) */
23
23
  client_secret?: string;
24
24
  service_account_key?: phenoml.fhirProvider.ServiceAccountKey;
25
- /** OAuth scopes to request */
25
+ role?: phenoml.fhirProvider.Role;
26
+ /** OAuth scopes to request. Cannot be specified with role. If neither role nor scopes are specified, the provider-specific default role will be used. You are solely responsible for ensuring the scopes are valid options for the provider being created or updated. */
26
27
  scopes?: string;
27
28
  }
@@ -1,9 +1,10 @@
1
- /** Authentication method for the FHIR provider */
1
+ /** Authentication method for the FHIR provider. Only one authentication method can be used at a time, but these can be rotated on the FHIR Provider as needed. For the 'token_passthrough' authentication method, you must provide the token in the X-Phenoml-Fhir-Provider header in the format {fhir_provider_id}:{oauth2_token}. For the 'on_behalf_of' authentication method, you must provide the Patient or Practitioner reference in the X-Phenoml-On-Behalf-Of header in the format Patient/{uuid} or Practitioner/{uuid}. This only works for the medplum provider currently. More on the authentication headers and how to structure them can be found in the FHIR Proxy, Tools and Agent documentation. */
2
2
  export declare const AuthMethod: {
3
3
  readonly ClientSecret: "client_secret";
4
4
  readonly GoogleHealthcare: "google_healthcare";
5
5
  readonly Jwt: "jwt";
6
6
  readonly OnBehalfOf: "on_behalf_of";
7
+ readonly TokenPassthrough: "token_passthrough";
7
8
  readonly None: "none";
8
9
  };
9
10
  export type AuthMethod = (typeof AuthMethod)[keyof typeof AuthMethod];
@@ -1,9 +1,10 @@
1
1
  // This file was auto-generated by Fern from our API Definition.
2
- /** Authentication method for the FHIR provider */
2
+ /** Authentication method for the FHIR provider. Only one authentication method can be used at a time, but these can be rotated on the FHIR Provider as needed. For the 'token_passthrough' authentication method, you must provide the token in the X-Phenoml-Fhir-Provider header in the format {fhir_provider_id}:{oauth2_token}. For the 'on_behalf_of' authentication method, you must provide the Patient or Practitioner reference in the X-Phenoml-On-Behalf-Of header in the format Patient/{uuid} or Practitioner/{uuid}. This only works for the medplum provider currently. More on the authentication headers and how to structure them can be found in the FHIR Proxy, Tools and Agent documentation. */
3
3
  export const AuthMethod = {
4
4
  ClientSecret: "client_secret",
5
5
  GoogleHealthcare: "google_healthcare",
6
6
  Jwt: "jwt",
7
7
  OnBehalfOf: "on_behalf_of",
8
+ TokenPassthrough: "token_passthrough",
8
9
  None: "none",
9
10
  };
@@ -0,0 +1,22 @@
1
+ /** Predefined role that specifies OAuth scopes. Cannot be specified with scopes. Available roles depend on the provider being created or updated. */
2
+ export declare const Role: {
3
+ readonly SmartV1Admin: "SmartV1Admin";
4
+ readonly SmartV1Read: "SmartV1Read";
5
+ readonly SmartV1Write: "SmartV1Write";
6
+ readonly SmartV2Admin: "SmartV2Admin";
7
+ readonly SmartV2Read: "SmartV2Read";
8
+ readonly SmartV2Write: "SmartV2Write";
9
+ readonly UscdiSmartV1Admin: "USCDISmartV1Admin";
10
+ readonly UscdiSmartV1Read: "USCDISmartV1Read";
11
+ readonly UscdiSmartV1Write: "USCDISmartV1Write";
12
+ readonly UscdiSmartV2Admin: "USCDISmartV2Admin";
13
+ readonly UscdiSmartV2Read: "USCDISmartV2Read";
14
+ readonly UscdiSmartV2Write: "USCDISmartV2Write";
15
+ readonly CernerSmartV1Admin: "CernerSmartV1Admin";
16
+ readonly CernerSmartV1Read: "CernerSmartV1Read";
17
+ readonly CernerSmartV1Write: "CernerSmartV1Write";
18
+ readonly CernerSmartV2Admin: "CernerSmartV2Admin";
19
+ readonly CernerSmartV2Read: "CernerSmartV2Read";
20
+ readonly CernerSmartV2Write: "CernerSmartV2Write";
21
+ };
22
+ export type Role = (typeof Role)[keyof typeof Role];
@@ -0,0 +1,22 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ /** Predefined role that specifies OAuth scopes. Cannot be specified with scopes. Available roles depend on the provider being created or updated. */
3
+ export const Role = {
4
+ SmartV1Admin: "SmartV1Admin",
5
+ SmartV1Read: "SmartV1Read",
6
+ SmartV1Write: "SmartV1Write",
7
+ SmartV2Admin: "SmartV2Admin",
8
+ SmartV2Read: "SmartV2Read",
9
+ SmartV2Write: "SmartV2Write",
10
+ UscdiSmartV1Admin: "USCDISmartV1Admin",
11
+ UscdiSmartV1Read: "USCDISmartV1Read",
12
+ UscdiSmartV1Write: "USCDISmartV1Write",
13
+ UscdiSmartV2Admin: "USCDISmartV2Admin",
14
+ UscdiSmartV2Read: "USCDISmartV2Read",
15
+ UscdiSmartV2Write: "USCDISmartV2Write",
16
+ CernerSmartV1Admin: "CernerSmartV1Admin",
17
+ CernerSmartV1Read: "CernerSmartV1Read",
18
+ CernerSmartV1Write: "CernerSmartV1Write",
19
+ CernerSmartV2Admin: "CernerSmartV2Admin",
20
+ CernerSmartV2Read: "CernerSmartV2Read",
21
+ CernerSmartV2Write: "CernerSmartV2Write",
22
+ };
@@ -9,5 +9,6 @@ export * from "./FhirProviderTemplate.mjs";
9
9
  export * from "./FhirQueryResponse.mjs";
10
10
  export * from "./JsonWebKey.mjs";
11
11
  export * from "./Provider.mjs";
12
+ export * from "./Role.mjs";
12
13
  export * from "./ServiceAccountKey.mjs";
13
14
  export * from "./SmartConfiguration.mjs";
@@ -9,5 +9,6 @@ export * from "./FhirProviderTemplate.mjs";
9
9
  export * from "./FhirQueryResponse.mjs";
10
10
  export * from "./JsonWebKey.mjs";
11
11
  export * from "./Provider.mjs";
12
+ export * from "./Role.mjs";
12
13
  export * from "./ServiceAccountKey.mjs";
13
14
  export * from "./SmartConfiguration.mjs";
@@ -27,6 +27,8 @@ export declare class Tools {
27
27
  *
28
28
  * @example
29
29
  * await client.tools.createFhirResource({
30
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
31
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
30
32
  * resource: "auto",
31
33
  * text: "Patient John Doe has severe asthma with acute exacerbation"
32
34
  * })
@@ -47,6 +49,8 @@ export declare class Tools {
47
49
  *
48
50
  * @example
49
51
  * await client.tools.searchFhirResources({
52
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
53
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
50
54
  * text: "Find all appointments for patient John Doe next week"
51
55
  * })
52
56
  */
@@ -65,6 +69,8 @@ export declare class Tools {
65
69
  *
66
70
  * @example
67
71
  * await client.tools.analyzeCohort({
72
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
73
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
68
74
  * text: "female patients over 20 with diabetes but not hypertension",
69
75
  * provider: "550e8400-e29b-41d4-a716-446655440000"
70
76
  * })
@@ -8,6 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
11
22
  import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
12
23
  import * as core from "../../../../core/index.mjs";
13
24
  import * as environments from "../../../../environments.mjs";
@@ -36,6 +47,8 @@ export class Tools {
36
47
  *
37
48
  * @example
38
49
  * await client.tools.createFhirResource({
50
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
51
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
39
52
  * resource: "auto",
40
53
  * text: "Patient John Doe has severe asthma with acute exacerbation"
41
54
  * })
@@ -46,7 +59,12 @@ export class Tools {
46
59
  __createFhirResource(request, requestOptions) {
47
60
  return __awaiter(this, void 0, void 0, function* () {
48
61
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
49
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
62
+ 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"]);
63
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
64
+ Authorization: yield this._getAuthorizationHeader(),
65
+ "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf != null ? phenomlOnBehalfOf : undefined,
66
+ "X-Phenoml-Fhir-Provider": phenomlFhirProvider != null ? phenomlFhirProvider : undefined,
67
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
50
68
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
51
69
  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, "tools/lang2fhir-and-create"),
52
70
  method: "POST",
@@ -54,7 +72,7 @@ export class Tools {
54
72
  contentType: "application/json",
55
73
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
56
74
  requestType: "json",
57
- body: request,
75
+ body: _body,
58
76
  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,
59
77
  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,
60
78
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -116,6 +134,8 @@ export class Tools {
116
134
  *
117
135
  * @example
118
136
  * await client.tools.searchFhirResources({
137
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
138
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
119
139
  * text: "Find all appointments for patient John Doe next week"
120
140
  * })
121
141
  */
@@ -125,7 +145,12 @@ export class Tools {
125
145
  __searchFhirResources(request, requestOptions) {
126
146
  return __awaiter(this, void 0, void 0, function* () {
127
147
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
128
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
148
+ 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"]);
149
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
150
+ Authorization: yield this._getAuthorizationHeader(),
151
+ "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf != null ? phenomlOnBehalfOf : undefined,
152
+ "X-Phenoml-Fhir-Provider": phenomlFhirProvider != null ? phenomlFhirProvider : undefined,
153
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
129
154
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
130
155
  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, "tools/lang2fhir-and-search"),
131
156
  method: "POST",
@@ -133,7 +158,7 @@ export class Tools {
133
158
  contentType: "application/json",
134
159
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
135
160
  requestType: "json",
136
- body: request,
161
+ body: _body,
137
162
  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,
138
163
  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,
139
164
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -194,6 +219,8 @@ export class Tools {
194
219
  *
195
220
  * @example
196
221
  * await client.tools.analyzeCohort({
222
+ * "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
223
+ * "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
197
224
  * text: "female patients over 20 with diabetes but not hypertension",
198
225
  * provider: "550e8400-e29b-41d4-a716-446655440000"
199
226
  * })
@@ -204,7 +231,12 @@ export class Tools {
204
231
  __analyzeCohort(request, requestOptions) {
205
232
  return __awaiter(this, void 0, void 0, function* () {
206
233
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
207
- const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
234
+ 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"]);
235
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
236
+ Authorization: yield this._getAuthorizationHeader(),
237
+ "X-Phenoml-On-Behalf-Of": phenomlOnBehalfOf != null ? phenomlOnBehalfOf : undefined,
238
+ "X-Phenoml-Fhir-Provider": phenomlFhirProvider != null ? phenomlFhirProvider : undefined,
239
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
208
240
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
209
241
  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, "tools/cohort"),
210
242
  method: "POST",
@@ -212,7 +244,7 @@ export class Tools {
212
244
  contentType: "application/json",
213
245
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
214
246
  requestType: "json",
215
- body: request,
247
+ body: _body,
216
248
  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,
217
249
  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,
218
250
  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
  * text: "female patients over 20 with diabetes but not hypertension",
5
7
  * provider: "550e8400-e29b-41d4-a716-446655440000"
6
8
  * }
7
9
  */
8
10
  export interface CohortRequest {
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
  /** Natural language text describing the patient cohort criteria */
10
22
  text: string;
11
23
  /** FHIR provider ID - must be a valid UUID from existing FHIR providers. also supports provider by name (e.g. medplum) */
@@ -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
  * resource: "auto",
5
7
  * text: "Patient John Doe has severe asthma with acute exacerbation"
6
8
  * }
7
9
  */
8
10
  export interface Lang2FhirAndCreateRequest {
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
  /** Type of FHIR resource to create. Use 'auto' for automatic resource type detection, or specify a supported US Core profile. */
10
22
  resource: Lang2FhirAndCreateRequest.Resource;
11
23
  /** Natural language text to convert to FHIR resource */
@@ -1,10 +1,22 @@
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
  * text: "Find all appointments for patient John Doe next week"
5
7
  * }
6
8
  */
7
9
  export interface Lang2FhirAndSearchRequest {
10
+ /**
11
+ * Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity.
12
+ * Must be in the format: Patient/{uuid} or Practitioner/{uuid}
13
+ */
14
+ "X-Phenoml-On-Behalf-Of"?: string;
15
+ /**
16
+ * Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}.
17
+ * Multiple FHIR provider integrations can be provided as comma-separated values.
18
+ */
19
+ "X-Phenoml-Fhir-Provider"?: string;
8
20
  /** Natural language text to convert to FHIR search parameters */
9
21
  text: string;
10
22
  /** Patient ID to filter results */
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.0.8";
1
+ export declare const SDK_VERSION = "0.0.10";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.0.8";
1
+ export const SDK_VERSION = "0.0.10";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phenoml",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "private": false,
5
5
  "repository": "github:PhenoML/phenoml-ts-sdk",
6
6
  "type": "commonjs",
package/reference.md CHANGED
@@ -444,6 +444,8 @@ Send a message to an agent and receive a response
444
444
 
445
445
  ```typescript
446
446
  await client.agent.chat({
447
+ "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
448
+ "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
447
449
  message: "What is the patient's current condition?",
448
450
  agent_id: "agent-123"
449
451
  });
@@ -1272,72 +1274,6 @@ await client.construe.extractCodes({
1272
1274
  </dl>
1273
1275
 
1274
1276
 
1275
- </dd>
1276
- </dl>
1277
- </details>
1278
-
1279
- <details><summary><code>client.construe.<a href="/src/api/resources/construe/client/Client.ts">cohort</a>({ ...params }) -> phenoml.ConstrueCohortResponse</code></summary>
1280
- <dl>
1281
- <dd>
1282
-
1283
- #### 📝 Description
1284
-
1285
- <dl>
1286
- <dd>
1287
-
1288
- <dl>
1289
- <dd>
1290
-
1291
- Creates a patient cohort based on a natural language description.
1292
- Translates the description into FHIR search queries and optional SQL queries.
1293
- </dd>
1294
- </dl>
1295
- </dd>
1296
- </dl>
1297
-
1298
- #### 🔌 Usage
1299
-
1300
- <dl>
1301
- <dd>
1302
-
1303
- <dl>
1304
- <dd>
1305
-
1306
- ```typescript
1307
- await client.construe.cohort({
1308
- text: "Between 20 and 40 years old with hyperlipidemia"
1309
- });
1310
-
1311
- ```
1312
- </dd>
1313
- </dl>
1314
- </dd>
1315
- </dl>
1316
-
1317
- #### ⚙️ Parameters
1318
-
1319
- <dl>
1320
- <dd>
1321
-
1322
- <dl>
1323
- <dd>
1324
-
1325
- **request:** `phenoml.construe.ConstrueCohortRequest`
1326
-
1327
- </dd>
1328
- </dl>
1329
-
1330
- <dl>
1331
- <dd>
1332
-
1333
- **requestOptions:** `Construe.RequestOptions`
1334
-
1335
- </dd>
1336
- </dl>
1337
- </dd>
1338
- </dl>
1339
-
1340
-
1341
1277
  </dd>
1342
1278
  </dl>
1343
1279
  </details>
@@ -1373,7 +1309,8 @@ The request is proxied to the configured FHIR server with appropriate authentica
1373
1309
 
1374
1310
  ```typescript
1375
1311
  await client.fhir.search("550e8400-e29b-41d4-a716-446655440000", "Patient", {
1376
- "X-Phenoml-On-Behalf-Of": "user@example.com"
1312
+ "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
1313
+ "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c..."
1377
1314
  });
1378
1315
 
1379
1316
  ```
@@ -1466,7 +1403,8 @@ The request is proxied to the configured FHIR server with appropriate authentica
1466
1403
 
1467
1404
  ```typescript
1468
1405
  await client.fhir.create("550e8400-e29b-41d4-a716-446655440000", "Patient", {
1469
- "X-Phenoml-On-Behalf-Of": "user@example.com",
1406
+ "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
1407
+ "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
1470
1408
  body: {
1471
1409
  resourceType: "Patient",
1472
1410
  name: [
@@ -1572,7 +1510,8 @@ The request is proxied to the configured FHIR server with appropriate authentica
1572
1510
 
1573
1511
  ```typescript
1574
1512
  await client.fhir.upsert("550e8400-e29b-41d4-a716-446655440000", "Patient", {
1575
- "X-Phenoml-On-Behalf-Of": "user@example.com",
1513
+ "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
1514
+ "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
1576
1515
  body: {
1577
1516
  resourceType: "Patient",
1578
1517
  id: "123",
@@ -1680,7 +1619,8 @@ The request is proxied to the configured FHIR server with appropriate authentica
1680
1619
 
1681
1620
  ```typescript
1682
1621
  await client.fhir.delete("550e8400-e29b-41d4-a716-446655440000", "Patient", {
1683
- "X-Phenoml-On-Behalf-Of": "user@example.com"
1622
+ "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
1623
+ "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c..."
1684
1624
  });
1685
1625
 
1686
1626
  ```
@@ -1778,7 +1718,8 @@ The request is proxied to the configured FHIR server with appropriate authentica
1778
1718
 
1779
1719
  ```typescript
1780
1720
  await client.fhir.patch("550e8400-e29b-41d4-a716-446655440000", "Patient", {
1781
- "X-Phenoml-On-Behalf-Of": "user@example.com",
1721
+ "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
1722
+ "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
1782
1723
  body: [{
1783
1724
  op: "replace",
1784
1725
  path: "/name/0/family",
@@ -1878,7 +1819,8 @@ The request is proxied to the configured FHIR server with appropriate authentica
1878
1819
 
1879
1820
  ```typescript
1880
1821
  await client.fhir.executeBundle("550e8400-e29b-41d4-a716-446655440000", {
1881
- "X-Phenoml-On-Behalf-Of": "user@example.com",
1822
+ "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
1823
+ "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
1882
1824
  body: {
1883
1825
  resourceType: "Bundle",
1884
1826
  entry: [{
@@ -3120,6 +3062,8 @@ Converts natural language to FHIR resource and optionally stores it in a FHIR se
3120
3062
 
3121
3063
  ```typescript
3122
3064
  await client.tools.createFhirResource({
3065
+ "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
3066
+ "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
3123
3067
  resource: "auto",
3124
3068
  text: "Patient John Doe has severe asthma with acute exacerbation"
3125
3069
  });
@@ -3186,6 +3130,8 @@ Converts natural language to FHIR search parameters and executes search in FHIR
3186
3130
 
3187
3131
  ```typescript
3188
3132
  await client.tools.searchFhirResources({
3133
+ "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
3134
+ "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
3189
3135
  text: "Find all appointments for patient John Doe next week"
3190
3136
  });
3191
3137
 
@@ -3251,6 +3197,8 @@ Uses LLM to extract search concepts from natural language and builds patient coh
3251
3197
 
3252
3198
  ```typescript
3253
3199
  await client.tools.analyzeCohort({
3200
+ "X-Phenoml-On-Behalf-Of": "Patient/550e8400-e29b-41d4-a716-446655440000",
3201
+ "X-Phenoml-Fhir-Provider": "550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
3254
3202
  text: "female patients over 20 with diabetes but not hypertension",
3255
3203
  provider: "550e8400-e29b-41d4-a716-446655440000"
3256
3204
  });
@@ -1,23 +0,0 @@
1
- /**
2
- * @example
3
- * {
4
- * text: "Between 20 and 40 years old with hyperlipidemia"
5
- * }
6
- */
7
- export interface ConstrueCohortRequest {
8
- config?: ConstrueCohortRequest.Config;
9
- /** Natural language description of the desired patient cohort. */
10
- text: string;
11
- }
12
- export declare namespace ConstrueCohortRequest {
13
- interface Config {
14
- /** When enabled, includes detailed information about medical codes extracted from the text. */
15
- include_extract_results?: boolean;
16
- /** When enabled, includes AI-generated explanations for each query component and code extraction. */
17
- include_rationale?: boolean;
18
- /** Controls whether deceased patients should be excluded from the cohort. */
19
- exclude_deceased?: boolean;
20
- /** Specifies the SQL dialect for query generation. Currently, only "bigquery" is supported. */
21
- sql_syntax?: "bigquery";
22
- }
23
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- // This file was auto-generated by Fern from our API Definition.
3
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +0,0 @@
1
- export interface BadRequestErrorBody {
2
- /** HTTP status code. */
3
- status?: number;
4
- /** Error message. */
5
- message?: string;
6
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- // This file was auto-generated by Fern from our API Definition.
3
- Object.defineProperty(exports, "__esModule", { value: true });