phenoml 0.0.2__py3-none-any.whl → 0.0.17__py3-none-any.whl

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 (149) hide show
  1. phenoml/agent/__init__.py +6 -8
  2. phenoml/agent/client.py +85 -67
  3. phenoml/agent/raw_client.py +61 -77
  4. phenoml/agent/types/__init__.py +6 -8
  5. phenoml/agent/types/agent_create_request.py +53 -0
  6. phenoml/agent/types/agent_create_request_provider.py +5 -0
  7. phenoml/agent/types/agent_template.py +3 -6
  8. phenoml/agent/types/agent_template_provider.py +5 -0
  9. phenoml/agent/types/json_patch_operation.py +5 -1
  10. phenoml/client.py +12 -0
  11. phenoml/construe/__init__.py +2 -16
  12. phenoml/construe/client.py +0 -90
  13. phenoml/construe/raw_client.py +0 -180
  14. phenoml/construe/types/__init__.py +2 -20
  15. phenoml/construe/types/extract_request_config.py +33 -4
  16. phenoml/construe/types/extract_request_config_chunking_method.py +3 -1
  17. phenoml/construe/types/extract_request_config_validation_method.py +5 -0
  18. phenoml/construe/types/extract_request_system.py +2 -0
  19. phenoml/core/client_wrapper.py +2 -2
  20. phenoml/fhir/__init__.py +36 -0
  21. phenoml/fhir/client.py +1072 -0
  22. phenoml/fhir/errors/__init__.py +10 -0
  23. phenoml/fhir/errors/bad_request_error.py +10 -0
  24. phenoml/fhir/errors/internal_server_error.py +10 -0
  25. phenoml/fhir/errors/not_found_error.py +10 -0
  26. phenoml/fhir/errors/unauthorized_error.py +10 -0
  27. phenoml/fhir/raw_client.py +1469 -0
  28. phenoml/fhir/types/__init__.py +29 -0
  29. phenoml/{agent/types/chat_fhir_client_config.py → fhir/types/error_response.py} +11 -6
  30. phenoml/fhir/types/fhir_bundle.py +43 -0
  31. phenoml/fhir/types/fhir_bundle_entry_item.py +34 -0
  32. phenoml/fhir/types/fhir_bundle_entry_item_request.py +25 -0
  33. phenoml/fhir/types/fhir_bundle_entry_item_request_method.py +5 -0
  34. phenoml/{construe/types/bad_request_error_body.py → fhir/types/fhir_bundle_entry_item_response.py} +4 -7
  35. phenoml/fhir/types/fhir_patch_request_body_item.py +40 -0
  36. phenoml/fhir/types/fhir_patch_request_body_item_op.py +7 -0
  37. phenoml/fhir/types/fhir_resource.py +40 -0
  38. phenoml/fhir/types/fhir_resource_meta.py +28 -0
  39. phenoml/fhir/types/fhir_search_response.py +8 -0
  40. phenoml/fhir_provider/__init__.py +45 -0
  41. phenoml/fhir_provider/client.py +748 -0
  42. phenoml/fhir_provider/errors/__init__.py +11 -0
  43. phenoml/fhir_provider/errors/bad_request_error.py +10 -0
  44. phenoml/fhir_provider/errors/forbidden_error.py +10 -0
  45. phenoml/fhir_provider/errors/internal_server_error.py +10 -0
  46. phenoml/fhir_provider/errors/not_found_error.py +10 -0
  47. phenoml/fhir_provider/errors/unauthorized_error.py +10 -0
  48. phenoml/fhir_provider/raw_client.py +1462 -0
  49. phenoml/fhir_provider/types/__init__.py +37 -0
  50. phenoml/fhir_provider/types/auth_method.py +7 -0
  51. phenoml/fhir_provider/types/fhir_provider_auth_config.py +53 -0
  52. phenoml/fhir_provider/types/fhir_provider_delete_response.py +20 -0
  53. phenoml/fhir_provider/types/fhir_provider_list_response.py +22 -0
  54. phenoml/fhir_provider/types/fhir_provider_remove_auth_config_response.py +22 -0
  55. phenoml/fhir_provider/types/fhir_provider_response.py +22 -0
  56. phenoml/fhir_provider/types/fhir_provider_set_active_auth_config_response.py +22 -0
  57. phenoml/fhir_provider/types/fhir_provider_template.py +66 -0
  58. phenoml/fhir_provider/types/fhir_query_response.py +27 -0
  59. phenoml/fhir_provider/types/fhir_query_response_data.py +5 -0
  60. phenoml/fhir_provider/types/json_web_key.py +51 -0
  61. phenoml/fhir_provider/types/provider.py +8 -0
  62. phenoml/fhir_provider/types/role.py +27 -0
  63. phenoml/fhir_provider/types/service_account_key.py +35 -0
  64. phenoml/fhir_provider/types/smart_configuration.py +46 -0
  65. phenoml/lang2fhir/__init__.py +10 -0
  66. phenoml/lang2fhir/client.py +111 -6
  67. phenoml/lang2fhir/raw_client.py +189 -0
  68. phenoml/lang2fhir/types/__init__.py +10 -0
  69. phenoml/lang2fhir/types/create_multi_response.py +39 -0
  70. phenoml/lang2fhir/types/create_multi_response_bundle.py +28 -0
  71. phenoml/lang2fhir/types/create_multi_response_bundle_entry_item.py +24 -0
  72. phenoml/lang2fhir/types/create_multi_response_bundle_entry_item_request.py +20 -0
  73. phenoml/{construe/types/construe_cohort_response_queries_item_code_extract_results_item_codes_item.py → lang2fhir/types/create_multi_response_resources_item.py} +13 -7
  74. phenoml/summary/__init__.py +41 -0
  75. phenoml/summary/client.py +668 -0
  76. phenoml/summary/errors/__init__.py +11 -0
  77. phenoml/summary/errors/bad_request_error.py +10 -0
  78. phenoml/summary/errors/forbidden_error.py +10 -0
  79. phenoml/summary/errors/internal_server_error.py +10 -0
  80. phenoml/summary/errors/not_found_error.py +10 -0
  81. phenoml/summary/errors/unauthorized_error.py +10 -0
  82. phenoml/summary/raw_client.py +1202 -0
  83. phenoml/summary/types/__init__.py +33 -0
  84. phenoml/summary/types/create_summary_request_fhir_resources.py +8 -0
  85. phenoml/summary/types/create_summary_request_mode.py +5 -0
  86. phenoml/{agent/types/agent_fhir_config.py → summary/types/create_summary_response.py} +7 -9
  87. phenoml/summary/types/create_summary_template_response.py +23 -0
  88. phenoml/{construe/types/unauthorized_error_body.py → summary/types/error_response.py} +4 -8
  89. phenoml/summary/types/fhir_bundle.py +23 -0
  90. phenoml/summary/types/fhir_bundle_entry_item.py +20 -0
  91. phenoml/summary/types/fhir_resource.py +24 -0
  92. phenoml/summary/types/summary_delete_template_response.py +20 -0
  93. phenoml/summary/types/summary_get_template_response.py +21 -0
  94. phenoml/summary/types/summary_list_templates_response.py +21 -0
  95. phenoml/summary/types/summary_template.py +41 -0
  96. phenoml/summary/types/summary_update_template_response.py +22 -0
  97. phenoml/tools/__init__.py +6 -8
  98. phenoml/tools/client.py +259 -44
  99. phenoml/tools/raw_client.py +347 -55
  100. phenoml/tools/types/__init__.py +6 -8
  101. phenoml/tools/types/lang2fhir_and_create_multi_response.py +41 -0
  102. phenoml/{construe/types/construe_cohort_response_queries_item_code_extract_results_item.py → tools/types/lang2fhir_and_create_multi_response_resource_info_item.py} +14 -7
  103. phenoml/tools/types/lang2fhir_and_create_multi_response_response_bundle.py +27 -0
  104. phenoml/workflows/__init__.py +61 -0
  105. phenoml/workflows/client.py +694 -0
  106. phenoml/workflows/errors/__init__.py +11 -0
  107. phenoml/workflows/errors/bad_request_error.py +10 -0
  108. phenoml/workflows/errors/forbidden_error.py +10 -0
  109. phenoml/workflows/errors/internal_server_error.py +10 -0
  110. phenoml/workflows/errors/not_found_error.py +10 -0
  111. phenoml/workflows/errors/unauthorized_error.py +10 -0
  112. phenoml/workflows/raw_client.py +1266 -0
  113. phenoml/workflows/types/__init__.py +53 -0
  114. phenoml/workflows/types/create_workflow_request_fhir_provider_id.py +5 -0
  115. phenoml/workflows/types/create_workflow_response.py +44 -0
  116. phenoml/{tools/types/fhir_client_config.py → workflows/types/decision_node_definition.py} +7 -6
  117. phenoml/workflows/types/execute_workflow_response.py +30 -0
  118. phenoml/{construe/types/internal_server_error_body.py → workflows/types/execute_workflow_response_results.py} +3 -8
  119. phenoml/workflows/types/lang2fhir_create_definition.py +37 -0
  120. phenoml/workflows/types/lang2fhir_search_definition.py +42 -0
  121. phenoml/workflows/types/list_workflows_response.py +39 -0
  122. phenoml/workflows/types/step_operation.py +26 -0
  123. phenoml/workflows/types/sub_workflow_definition.py +32 -0
  124. phenoml/workflows/types/update_workflow_request_fhir_provider_id.py +5 -0
  125. phenoml/workflows/types/workflow_config.py +27 -0
  126. phenoml/workflows/types/workflow_definition.py +57 -0
  127. phenoml/workflows/types/workflow_graph.py +23 -0
  128. phenoml/workflows/types/workflow_response.py +61 -0
  129. phenoml/workflows/types/workflow_response_graph.py +23 -0
  130. phenoml/workflows/types/workflow_step.py +55 -0
  131. phenoml/workflows/types/workflow_step_summary.py +47 -0
  132. phenoml/workflows/types/workflow_step_summary_type.py +5 -0
  133. phenoml/workflows/types/workflow_step_type.py +5 -0
  134. phenoml/workflows/types/workflows_delete_response.py +20 -0
  135. phenoml/workflows/types/workflows_get_response.py +26 -0
  136. phenoml/workflows/types/workflows_update_response.py +31 -0
  137. phenoml-0.0.17.dist-info/LICENSE +21 -0
  138. {phenoml-0.0.2.dist-info → phenoml-0.0.17.dist-info}/METADATA +1 -1
  139. phenoml-0.0.17.dist-info/RECORD +251 -0
  140. phenoml/agent/types/agent_provider.py +0 -7
  141. phenoml/agent/types/provider_type.py +0 -5
  142. phenoml/construe/types/construe_cohort_request_config.py +0 -37
  143. phenoml/construe/types/construe_cohort_response.py +0 -33
  144. phenoml/construe/types/construe_cohort_response_queries_item.py +0 -49
  145. phenoml/tools/types/cohort_request_provider.py +0 -5
  146. phenoml/tools/types/lang2fhir_and_create_request_provider.py +0 -7
  147. phenoml/tools/types/lang2fhir_and_search_request_provider.py +0 -7
  148. phenoml-0.0.2.dist-info/RECORD +0 -153
  149. {phenoml-0.0.2.dist-info → phenoml-0.0.17.dist-info}/WHEEL +0 -0
@@ -0,0 +1,748 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import datetime as dt
4
+ import typing
5
+
6
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
7
+ from ..core.request_options import RequestOptions
8
+ from .raw_client import AsyncRawFhirProviderClient, RawFhirProviderClient
9
+ from .types.auth_method import AuthMethod
10
+ from .types.fhir_provider_delete_response import FhirProviderDeleteResponse
11
+ from .types.fhir_provider_list_response import FhirProviderListResponse
12
+ from .types.fhir_provider_remove_auth_config_response import FhirProviderRemoveAuthConfigResponse
13
+ from .types.fhir_provider_response import FhirProviderResponse
14
+ from .types.fhir_provider_set_active_auth_config_response import FhirProviderSetActiveAuthConfigResponse
15
+ from .types.provider import Provider
16
+ from .types.role import Role
17
+ from .types.service_account_key import ServiceAccountKey
18
+
19
+ # this is used as the default value for optional parameters
20
+ OMIT = typing.cast(typing.Any, ...)
21
+
22
+
23
+ class FhirProviderClient:
24
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
25
+ self._raw_client = RawFhirProviderClient(client_wrapper=client_wrapper)
26
+
27
+ @property
28
+ def with_raw_response(self) -> RawFhirProviderClient:
29
+ """
30
+ Retrieves a raw implementation of this client that returns raw responses.
31
+
32
+ Returns
33
+ -------
34
+ RawFhirProviderClient
35
+ """
36
+ return self._raw_client
37
+
38
+ def create(
39
+ self,
40
+ *,
41
+ name: str,
42
+ provider: Provider,
43
+ auth_method: AuthMethod,
44
+ base_url: str,
45
+ description: typing.Optional[str] = OMIT,
46
+ client_id: typing.Optional[str] = OMIT,
47
+ client_secret: typing.Optional[str] = OMIT,
48
+ service_account_key: typing.Optional[ServiceAccountKey] = OMIT,
49
+ role: typing.Optional[Role] = OMIT,
50
+ scopes: typing.Optional[str] = OMIT,
51
+ request_options: typing.Optional[RequestOptions] = None,
52
+ ) -> FhirProviderResponse:
53
+ """
54
+ Creates a new FHIR provider configuration with authentication credentials
55
+
56
+ Parameters
57
+ ----------
58
+ name : str
59
+ Display name for the FHIR provider
60
+
61
+ provider : Provider
62
+
63
+ auth_method : AuthMethod
64
+
65
+ base_url : str
66
+ Base URL of the FHIR server
67
+
68
+ description : typing.Optional[str]
69
+ Optional description of the FHIR provider
70
+
71
+ client_id : typing.Optional[str]
72
+ OAuth client ID (required for most auth methods)
73
+
74
+ client_secret : typing.Optional[str]
75
+ OAuth client secret (required for client_secret and on_behalf_of auth methods)
76
+
77
+ service_account_key : typing.Optional[ServiceAccountKey]
78
+
79
+ role : typing.Optional[Role]
80
+
81
+ scopes : typing.Optional[str]
82
+ 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.
83
+
84
+ request_options : typing.Optional[RequestOptions]
85
+ Request-specific configuration.
86
+
87
+ Returns
88
+ -------
89
+ FhirProviderResponse
90
+ FHIR provider created successfully
91
+
92
+ Examples
93
+ --------
94
+ from phenoml import phenoml
95
+
96
+ client = phenoml(
97
+ token="YOUR_TOKEN",
98
+ )
99
+ client.fhir_provider.create(
100
+ name="Epic Sandbox",
101
+ provider="athenahealth",
102
+ auth_method="client_secret",
103
+ base_url="https://fhir.epic.com/interconnect-fhir-oauth/api/FHIR/R4",
104
+ )
105
+ """
106
+ _response = self._raw_client.create(
107
+ name=name,
108
+ provider=provider,
109
+ auth_method=auth_method,
110
+ base_url=base_url,
111
+ description=description,
112
+ client_id=client_id,
113
+ client_secret=client_secret,
114
+ service_account_key=service_account_key,
115
+ role=role,
116
+ scopes=scopes,
117
+ request_options=request_options,
118
+ )
119
+ return _response.data
120
+
121
+ def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> FhirProviderListResponse:
122
+ """
123
+ Retrieves a list of all active FHIR providers for the authenticated user
124
+
125
+ Parameters
126
+ ----------
127
+ request_options : typing.Optional[RequestOptions]
128
+ Request-specific configuration.
129
+
130
+ Returns
131
+ -------
132
+ FhirProviderListResponse
133
+ FHIR providers retrieved successfully
134
+
135
+ Examples
136
+ --------
137
+ from phenoml import phenoml
138
+
139
+ client = phenoml(
140
+ token="YOUR_TOKEN",
141
+ )
142
+ client.fhir_provider.list()
143
+ """
144
+ _response = self._raw_client.list(request_options=request_options)
145
+ return _response.data
146
+
147
+ def get(
148
+ self, fhir_provider_id: str, *, request_options: typing.Optional[RequestOptions] = None
149
+ ) -> FhirProviderResponse:
150
+ """
151
+ Retrieves a specific FHIR provider configuration by its ID
152
+
153
+ Parameters
154
+ ----------
155
+ fhir_provider_id : str
156
+ ID of the FHIR provider to retrieve
157
+
158
+ request_options : typing.Optional[RequestOptions]
159
+ Request-specific configuration.
160
+
161
+ Returns
162
+ -------
163
+ FhirProviderResponse
164
+ FHIR provider retrieved successfully
165
+
166
+ Examples
167
+ --------
168
+ from phenoml import phenoml
169
+
170
+ client = phenoml(
171
+ token="YOUR_TOKEN",
172
+ )
173
+ client.fhir_provider.get(
174
+ fhir_provider_id="fhir_provider_id",
175
+ )
176
+ """
177
+ _response = self._raw_client.get(fhir_provider_id, request_options=request_options)
178
+ return _response.data
179
+
180
+ def delete(
181
+ self, fhir_provider_id: str, *, request_options: typing.Optional[RequestOptions] = None
182
+ ) -> FhirProviderDeleteResponse:
183
+ """
184
+ Soft deletes a FHIR provider by setting is_active to false
185
+
186
+ Parameters
187
+ ----------
188
+ fhir_provider_id : str
189
+ ID of the FHIR provider to delete
190
+
191
+ request_options : typing.Optional[RequestOptions]
192
+ Request-specific configuration.
193
+
194
+ Returns
195
+ -------
196
+ FhirProviderDeleteResponse
197
+ FHIR provider deleted successfully
198
+
199
+ Examples
200
+ --------
201
+ from phenoml import phenoml
202
+
203
+ client = phenoml(
204
+ token="YOUR_TOKEN",
205
+ )
206
+ client.fhir_provider.delete(
207
+ fhir_provider_id="fhir_provider_id",
208
+ )
209
+ """
210
+ _response = self._raw_client.delete(fhir_provider_id, request_options=request_options)
211
+ return _response.data
212
+
213
+ def add_auth_config(
214
+ self,
215
+ fhir_provider_id: str,
216
+ *,
217
+ auth_method: AuthMethod,
218
+ client_secret: typing.Optional[str] = OMIT,
219
+ service_account_key: typing.Optional[ServiceAccountKey] = OMIT,
220
+ credential_expiry: typing.Optional[dt.datetime] = OMIT,
221
+ role: typing.Optional[Role] = OMIT,
222
+ scopes: typing.Optional[str] = OMIT,
223
+ request_options: typing.Optional[RequestOptions] = None,
224
+ ) -> FhirProviderResponse:
225
+ """
226
+ Adds a new authentication configuration to an existing FHIR provider. This enables key rotation and multiple auth configurations per provider.
227
+
228
+ Parameters
229
+ ----------
230
+ fhir_provider_id : str
231
+ ID of the FHIR provider to add auth config to
232
+
233
+ auth_method : AuthMethod
234
+
235
+ client_secret : typing.Optional[str]
236
+ OAuth client secret (required for client_secret and on_behalf_of auth methods)
237
+
238
+ service_account_key : typing.Optional[ServiceAccountKey]
239
+
240
+ credential_expiry : typing.Optional[dt.datetime]
241
+ Expiry time for JWT credentials (only applicable for JWT auth method)
242
+
243
+ role : typing.Optional[Role]
244
+
245
+ scopes : typing.Optional[str]
246
+ 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.
247
+
248
+ request_options : typing.Optional[RequestOptions]
249
+ Request-specific configuration.
250
+
251
+ Returns
252
+ -------
253
+ FhirProviderResponse
254
+ Auth configuration added successfully
255
+
256
+ Examples
257
+ --------
258
+ from phenoml import phenoml
259
+
260
+ client = phenoml(
261
+ token="YOUR_TOKEN",
262
+ )
263
+ client.fhir_provider.add_auth_config(
264
+ fhir_provider_id="1716d214-de93-43a4-aa6b-a878d864e2ad",
265
+ auth_method="client_secret",
266
+ )
267
+ """
268
+ _response = self._raw_client.add_auth_config(
269
+ fhir_provider_id,
270
+ auth_method=auth_method,
271
+ client_secret=client_secret,
272
+ service_account_key=service_account_key,
273
+ credential_expiry=credential_expiry,
274
+ role=role,
275
+ scopes=scopes,
276
+ request_options=request_options,
277
+ )
278
+ return _response.data
279
+
280
+ def set_active_auth_config(
281
+ self, fhir_provider_id: str, *, auth_config_id: str, request_options: typing.Optional[RequestOptions] = None
282
+ ) -> FhirProviderSetActiveAuthConfigResponse:
283
+ """
284
+ Sets which authentication configuration should be active for a FHIR provider. Only one auth config can be active at a time.
285
+
286
+ Parameters
287
+ ----------
288
+ fhir_provider_id : str
289
+ ID of the FHIR provider
290
+
291
+ auth_config_id : str
292
+ ID of the auth configuration to set as active
293
+
294
+ request_options : typing.Optional[RequestOptions]
295
+ Request-specific configuration.
296
+
297
+ Returns
298
+ -------
299
+ FhirProviderSetActiveAuthConfigResponse
300
+ Active auth configuration set successfully
301
+
302
+ Examples
303
+ --------
304
+ from phenoml import phenoml
305
+
306
+ client = phenoml(
307
+ token="YOUR_TOKEN",
308
+ )
309
+ client.fhir_provider.set_active_auth_config(
310
+ fhir_provider_id="1716d214-de93-43a4-aa6b-a878d864e2ad",
311
+ auth_config_id="auth-config-123",
312
+ )
313
+ """
314
+ _response = self._raw_client.set_active_auth_config(
315
+ fhir_provider_id, auth_config_id=auth_config_id, request_options=request_options
316
+ )
317
+ return _response.data
318
+
319
+ def remove_auth_config(
320
+ self, fhir_provider_id: str, *, auth_config_id: str, request_options: typing.Optional[RequestOptions] = None
321
+ ) -> FhirProviderRemoveAuthConfigResponse:
322
+ """
323
+ Removes an authentication configuration from a FHIR provider. Cannot remove the currently active auth configuration.
324
+
325
+ Parameters
326
+ ----------
327
+ fhir_provider_id : str
328
+ ID of the FHIR provider
329
+
330
+ auth_config_id : str
331
+ ID of the auth configuration to remove
332
+
333
+ request_options : typing.Optional[RequestOptions]
334
+ Request-specific configuration.
335
+
336
+ Returns
337
+ -------
338
+ FhirProviderRemoveAuthConfigResponse
339
+ Auth configuration removed successfully
340
+
341
+ Examples
342
+ --------
343
+ from phenoml import phenoml
344
+
345
+ client = phenoml(
346
+ token="YOUR_TOKEN",
347
+ )
348
+ client.fhir_provider.remove_auth_config(
349
+ fhir_provider_id="1716d214-de93-43a4-aa6b-a878d864e2ad",
350
+ auth_config_id="auth-config-123",
351
+ )
352
+ """
353
+ _response = self._raw_client.remove_auth_config(
354
+ fhir_provider_id, auth_config_id=auth_config_id, request_options=request_options
355
+ )
356
+ return _response.data
357
+
358
+
359
+ class AsyncFhirProviderClient:
360
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
361
+ self._raw_client = AsyncRawFhirProviderClient(client_wrapper=client_wrapper)
362
+
363
+ @property
364
+ def with_raw_response(self) -> AsyncRawFhirProviderClient:
365
+ """
366
+ Retrieves a raw implementation of this client that returns raw responses.
367
+
368
+ Returns
369
+ -------
370
+ AsyncRawFhirProviderClient
371
+ """
372
+ return self._raw_client
373
+
374
+ async def create(
375
+ self,
376
+ *,
377
+ name: str,
378
+ provider: Provider,
379
+ auth_method: AuthMethod,
380
+ base_url: str,
381
+ description: typing.Optional[str] = OMIT,
382
+ client_id: typing.Optional[str] = OMIT,
383
+ client_secret: typing.Optional[str] = OMIT,
384
+ service_account_key: typing.Optional[ServiceAccountKey] = OMIT,
385
+ role: typing.Optional[Role] = OMIT,
386
+ scopes: typing.Optional[str] = OMIT,
387
+ request_options: typing.Optional[RequestOptions] = None,
388
+ ) -> FhirProviderResponse:
389
+ """
390
+ Creates a new FHIR provider configuration with authentication credentials
391
+
392
+ Parameters
393
+ ----------
394
+ name : str
395
+ Display name for the FHIR provider
396
+
397
+ provider : Provider
398
+
399
+ auth_method : AuthMethod
400
+
401
+ base_url : str
402
+ Base URL of the FHIR server
403
+
404
+ description : typing.Optional[str]
405
+ Optional description of the FHIR provider
406
+
407
+ client_id : typing.Optional[str]
408
+ OAuth client ID (required for most auth methods)
409
+
410
+ client_secret : typing.Optional[str]
411
+ OAuth client secret (required for client_secret and on_behalf_of auth methods)
412
+
413
+ service_account_key : typing.Optional[ServiceAccountKey]
414
+
415
+ role : typing.Optional[Role]
416
+
417
+ scopes : typing.Optional[str]
418
+ 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.
419
+
420
+ request_options : typing.Optional[RequestOptions]
421
+ Request-specific configuration.
422
+
423
+ Returns
424
+ -------
425
+ FhirProviderResponse
426
+ FHIR provider created successfully
427
+
428
+ Examples
429
+ --------
430
+ import asyncio
431
+
432
+ from phenoml import Asyncphenoml
433
+
434
+ client = Asyncphenoml(
435
+ token="YOUR_TOKEN",
436
+ )
437
+
438
+
439
+ async def main() -> None:
440
+ await client.fhir_provider.create(
441
+ name="Epic Sandbox",
442
+ provider="athenahealth",
443
+ auth_method="client_secret",
444
+ base_url="https://fhir.epic.com/interconnect-fhir-oauth/api/FHIR/R4",
445
+ )
446
+
447
+
448
+ asyncio.run(main())
449
+ """
450
+ _response = await self._raw_client.create(
451
+ name=name,
452
+ provider=provider,
453
+ auth_method=auth_method,
454
+ base_url=base_url,
455
+ description=description,
456
+ client_id=client_id,
457
+ client_secret=client_secret,
458
+ service_account_key=service_account_key,
459
+ role=role,
460
+ scopes=scopes,
461
+ request_options=request_options,
462
+ )
463
+ return _response.data
464
+
465
+ async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> FhirProviderListResponse:
466
+ """
467
+ Retrieves a list of all active FHIR providers for the authenticated user
468
+
469
+ Parameters
470
+ ----------
471
+ request_options : typing.Optional[RequestOptions]
472
+ Request-specific configuration.
473
+
474
+ Returns
475
+ -------
476
+ FhirProviderListResponse
477
+ FHIR providers retrieved successfully
478
+
479
+ Examples
480
+ --------
481
+ import asyncio
482
+
483
+ from phenoml import Asyncphenoml
484
+
485
+ client = Asyncphenoml(
486
+ token="YOUR_TOKEN",
487
+ )
488
+
489
+
490
+ async def main() -> None:
491
+ await client.fhir_provider.list()
492
+
493
+
494
+ asyncio.run(main())
495
+ """
496
+ _response = await self._raw_client.list(request_options=request_options)
497
+ return _response.data
498
+
499
+ async def get(
500
+ self, fhir_provider_id: str, *, request_options: typing.Optional[RequestOptions] = None
501
+ ) -> FhirProviderResponse:
502
+ """
503
+ Retrieves a specific FHIR provider configuration by its ID
504
+
505
+ Parameters
506
+ ----------
507
+ fhir_provider_id : str
508
+ ID of the FHIR provider to retrieve
509
+
510
+ request_options : typing.Optional[RequestOptions]
511
+ Request-specific configuration.
512
+
513
+ Returns
514
+ -------
515
+ FhirProviderResponse
516
+ FHIR provider retrieved successfully
517
+
518
+ Examples
519
+ --------
520
+ import asyncio
521
+
522
+ from phenoml import Asyncphenoml
523
+
524
+ client = Asyncphenoml(
525
+ token="YOUR_TOKEN",
526
+ )
527
+
528
+
529
+ async def main() -> None:
530
+ await client.fhir_provider.get(
531
+ fhir_provider_id="fhir_provider_id",
532
+ )
533
+
534
+
535
+ asyncio.run(main())
536
+ """
537
+ _response = await self._raw_client.get(fhir_provider_id, request_options=request_options)
538
+ return _response.data
539
+
540
+ async def delete(
541
+ self, fhir_provider_id: str, *, request_options: typing.Optional[RequestOptions] = None
542
+ ) -> FhirProviderDeleteResponse:
543
+ """
544
+ Soft deletes a FHIR provider by setting is_active to false
545
+
546
+ Parameters
547
+ ----------
548
+ fhir_provider_id : str
549
+ ID of the FHIR provider to delete
550
+
551
+ request_options : typing.Optional[RequestOptions]
552
+ Request-specific configuration.
553
+
554
+ Returns
555
+ -------
556
+ FhirProviderDeleteResponse
557
+ FHIR provider deleted successfully
558
+
559
+ Examples
560
+ --------
561
+ import asyncio
562
+
563
+ from phenoml import Asyncphenoml
564
+
565
+ client = Asyncphenoml(
566
+ token="YOUR_TOKEN",
567
+ )
568
+
569
+
570
+ async def main() -> None:
571
+ await client.fhir_provider.delete(
572
+ fhir_provider_id="fhir_provider_id",
573
+ )
574
+
575
+
576
+ asyncio.run(main())
577
+ """
578
+ _response = await self._raw_client.delete(fhir_provider_id, request_options=request_options)
579
+ return _response.data
580
+
581
+ async def add_auth_config(
582
+ self,
583
+ fhir_provider_id: str,
584
+ *,
585
+ auth_method: AuthMethod,
586
+ client_secret: typing.Optional[str] = OMIT,
587
+ service_account_key: typing.Optional[ServiceAccountKey] = OMIT,
588
+ credential_expiry: typing.Optional[dt.datetime] = OMIT,
589
+ role: typing.Optional[Role] = OMIT,
590
+ scopes: typing.Optional[str] = OMIT,
591
+ request_options: typing.Optional[RequestOptions] = None,
592
+ ) -> FhirProviderResponse:
593
+ """
594
+ Adds a new authentication configuration to an existing FHIR provider. This enables key rotation and multiple auth configurations per provider.
595
+
596
+ Parameters
597
+ ----------
598
+ fhir_provider_id : str
599
+ ID of the FHIR provider to add auth config to
600
+
601
+ auth_method : AuthMethod
602
+
603
+ client_secret : typing.Optional[str]
604
+ OAuth client secret (required for client_secret and on_behalf_of auth methods)
605
+
606
+ service_account_key : typing.Optional[ServiceAccountKey]
607
+
608
+ credential_expiry : typing.Optional[dt.datetime]
609
+ Expiry time for JWT credentials (only applicable for JWT auth method)
610
+
611
+ role : typing.Optional[Role]
612
+
613
+ scopes : typing.Optional[str]
614
+ 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.
615
+
616
+ request_options : typing.Optional[RequestOptions]
617
+ Request-specific configuration.
618
+
619
+ Returns
620
+ -------
621
+ FhirProviderResponse
622
+ Auth configuration added successfully
623
+
624
+ Examples
625
+ --------
626
+ import asyncio
627
+
628
+ from phenoml import Asyncphenoml
629
+
630
+ client = Asyncphenoml(
631
+ token="YOUR_TOKEN",
632
+ )
633
+
634
+
635
+ async def main() -> None:
636
+ await client.fhir_provider.add_auth_config(
637
+ fhir_provider_id="1716d214-de93-43a4-aa6b-a878d864e2ad",
638
+ auth_method="client_secret",
639
+ )
640
+
641
+
642
+ asyncio.run(main())
643
+ """
644
+ _response = await self._raw_client.add_auth_config(
645
+ fhir_provider_id,
646
+ auth_method=auth_method,
647
+ client_secret=client_secret,
648
+ service_account_key=service_account_key,
649
+ credential_expiry=credential_expiry,
650
+ role=role,
651
+ scopes=scopes,
652
+ request_options=request_options,
653
+ )
654
+ return _response.data
655
+
656
+ async def set_active_auth_config(
657
+ self, fhir_provider_id: str, *, auth_config_id: str, request_options: typing.Optional[RequestOptions] = None
658
+ ) -> FhirProviderSetActiveAuthConfigResponse:
659
+ """
660
+ Sets which authentication configuration should be active for a FHIR provider. Only one auth config can be active at a time.
661
+
662
+ Parameters
663
+ ----------
664
+ fhir_provider_id : str
665
+ ID of the FHIR provider
666
+
667
+ auth_config_id : str
668
+ ID of the auth configuration to set as active
669
+
670
+ request_options : typing.Optional[RequestOptions]
671
+ Request-specific configuration.
672
+
673
+ Returns
674
+ -------
675
+ FhirProviderSetActiveAuthConfigResponse
676
+ Active auth configuration set successfully
677
+
678
+ Examples
679
+ --------
680
+ import asyncio
681
+
682
+ from phenoml import Asyncphenoml
683
+
684
+ client = Asyncphenoml(
685
+ token="YOUR_TOKEN",
686
+ )
687
+
688
+
689
+ async def main() -> None:
690
+ await client.fhir_provider.set_active_auth_config(
691
+ fhir_provider_id="1716d214-de93-43a4-aa6b-a878d864e2ad",
692
+ auth_config_id="auth-config-123",
693
+ )
694
+
695
+
696
+ asyncio.run(main())
697
+ """
698
+ _response = await self._raw_client.set_active_auth_config(
699
+ fhir_provider_id, auth_config_id=auth_config_id, request_options=request_options
700
+ )
701
+ return _response.data
702
+
703
+ async def remove_auth_config(
704
+ self, fhir_provider_id: str, *, auth_config_id: str, request_options: typing.Optional[RequestOptions] = None
705
+ ) -> FhirProviderRemoveAuthConfigResponse:
706
+ """
707
+ Removes an authentication configuration from a FHIR provider. Cannot remove the currently active auth configuration.
708
+
709
+ Parameters
710
+ ----------
711
+ fhir_provider_id : str
712
+ ID of the FHIR provider
713
+
714
+ auth_config_id : str
715
+ ID of the auth configuration to remove
716
+
717
+ request_options : typing.Optional[RequestOptions]
718
+ Request-specific configuration.
719
+
720
+ Returns
721
+ -------
722
+ FhirProviderRemoveAuthConfigResponse
723
+ Auth configuration removed successfully
724
+
725
+ Examples
726
+ --------
727
+ import asyncio
728
+
729
+ from phenoml import Asyncphenoml
730
+
731
+ client = Asyncphenoml(
732
+ token="YOUR_TOKEN",
733
+ )
734
+
735
+
736
+ async def main() -> None:
737
+ await client.fhir_provider.remove_auth_config(
738
+ fhir_provider_id="1716d214-de93-43a4-aa6b-a878d864e2ad",
739
+ auth_config_id="auth-config-123",
740
+ )
741
+
742
+
743
+ asyncio.run(main())
744
+ """
745
+ _response = await self._raw_client.remove_auth_config(
746
+ fhir_provider_id, auth_config_id=auth_config_id, request_options=request_options
747
+ )
748
+ return _response.data