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