phenoml 0.0.6__py3-none-any.whl → 0.0.8__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.
- phenoml/client.py +3 -0
- phenoml/core/client_wrapper.py +2 -2
- phenoml/summary/__init__.py +39 -0
- phenoml/summary/client.py +656 -0
- phenoml/summary/errors/__init__.py +11 -0
- phenoml/summary/errors/bad_request_error.py +10 -0
- phenoml/summary/errors/forbidden_error.py +10 -0
- phenoml/summary/errors/internal_server_error.py +10 -0
- phenoml/summary/errors/not_found_error.py +10 -0
- phenoml/summary/errors/unauthorized_error.py +10 -0
- phenoml/{workflows/workflows → summary}/raw_client.py +236 -312
- phenoml/summary/types/__init__.py +31 -0
- phenoml/summary/types/create_summary_request_fhir_resources.py +8 -0
- phenoml/summary/types/create_summary_request_mode.py +5 -0
- phenoml/summary/types/create_summary_response.py +29 -0
- phenoml/summary/types/create_summary_template_response.py +23 -0
- phenoml/summary/types/fhir_bundle.py +23 -0
- phenoml/summary/types/fhir_bundle_entry_item.py +20 -0
- phenoml/summary/types/fhir_resource.py +24 -0
- phenoml/summary/types/summary_delete_template_response.py +20 -0
- phenoml/summary/types/summary_get_template_response.py +21 -0
- phenoml/summary/types/summary_list_templates_response.py +21 -0
- phenoml/summary/types/summary_template.py +41 -0
- phenoml/summary/types/summary_update_template_response.py +22 -0
- phenoml/workflows/__init__.py +3 -8
- phenoml/workflows/client.py +517 -33
- phenoml/workflows/raw_client.py +1129 -32
- phenoml/workflows/types/__init__.py +10 -0
- phenoml/workflows/{workflows/types → types}/workflows_delete_response.py +1 -1
- phenoml/workflows/{workflows/types → types}/workflows_get_response.py +3 -3
- phenoml/workflows/{workflows/types → types}/workflows_update_response.py +3 -3
- {phenoml-0.0.6.dist-info → phenoml-0.0.8.dist-info}/METADATA +1 -1
- {phenoml-0.0.6.dist-info → phenoml-0.0.8.dist-info}/RECORD +37 -33
- phenoml/types/__init__.py +0 -21
- phenoml/types/cohort_response.py +0 -5
- phenoml/types/lang2fhir_and_create_response.py +0 -5
- phenoml/types/lang2fhir_and_search_response.py +0 -5
- phenoml/types/mcp_server_response.py +0 -5
- phenoml/types/mcp_server_tool_call_response.py +0 -5
- phenoml/types/mcp_server_tool_response.py +0 -5
- phenoml/types/search_concept.py +0 -5
- phenoml/workflows/mcp_server/__init__.py +0 -7
- phenoml/workflows/mcp_server/client.py +0 -274
- phenoml/workflows/mcp_server/raw_client.py +0 -226
- phenoml/workflows/mcp_server/tools/__init__.py +0 -4
- phenoml/workflows/mcp_server/tools/client.py +0 -287
- phenoml/workflows/mcp_server/tools/raw_client.py +0 -244
- phenoml/workflows/workflows/__init__.py +0 -19
- phenoml/workflows/workflows/client.py +0 -694
- phenoml/workflows/workflows/types/__init__.py +0 -17
- /phenoml/workflows/{workflows/types → types}/create_workflow_request_fhir_provider_id.py +0 -0
- /phenoml/workflows/{workflows/types → types}/update_workflow_request_fhir_provider_id.py +0 -0
- {phenoml-0.0.6.dist-info → phenoml-0.0.8.dist-info}/LICENSE +0 -0
- {phenoml-0.0.6.dist-info → phenoml-0.0.8.dist-info}/WHEEL +0 -0
phenoml/workflows/client.py
CHANGED
|
@@ -4,18 +4,23 @@ import typing
|
|
|
4
4
|
|
|
5
5
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
6
6
|
from ..core.request_options import RequestOptions
|
|
7
|
-
from .mcp_server.client import AsyncMcpServerClient, McpServerClient
|
|
8
7
|
from .raw_client import AsyncRawWorkflowsClient, RawWorkflowsClient
|
|
9
|
-
from .
|
|
10
|
-
from .
|
|
8
|
+
from .types.create_workflow_request_fhir_provider_id import CreateWorkflowRequestFhirProviderId
|
|
9
|
+
from .types.create_workflow_response import CreateWorkflowResponse
|
|
10
|
+
from .types.execute_workflow_response import ExecuteWorkflowResponse
|
|
11
|
+
from .types.list_workflows_response import ListWorkflowsResponse
|
|
12
|
+
from .types.update_workflow_request_fhir_provider_id import UpdateWorkflowRequestFhirProviderId
|
|
13
|
+
from .types.workflows_delete_response import WorkflowsDeleteResponse
|
|
14
|
+
from .types.workflows_get_response import WorkflowsGetResponse
|
|
15
|
+
from .types.workflows_update_response import WorkflowsUpdateResponse
|
|
16
|
+
|
|
17
|
+
# this is used as the default value for optional parameters
|
|
18
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
11
19
|
|
|
12
20
|
|
|
13
21
|
class WorkflowsClient:
|
|
14
22
|
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
15
23
|
self._raw_client = RawWorkflowsClient(client_wrapper=client_wrapper)
|
|
16
|
-
self.workflows = workflows_workflows_client_WorkflowsClient(client_wrapper=client_wrapper)
|
|
17
|
-
|
|
18
|
-
self.mcp_server = McpServerClient(client_wrapper=client_wrapper)
|
|
19
24
|
|
|
20
25
|
@property
|
|
21
26
|
def with_raw_response(self) -> RawWorkflowsClient:
|
|
@@ -28,16 +33,24 @@ class WorkflowsClient:
|
|
|
28
33
|
"""
|
|
29
34
|
return self._raw_client
|
|
30
35
|
|
|
31
|
-
def
|
|
36
|
+
def list(
|
|
37
|
+
self, *, verbose: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None
|
|
38
|
+
) -> ListWorkflowsResponse:
|
|
32
39
|
"""
|
|
40
|
+
Retrieves all workflow definitions for the authenticated user
|
|
41
|
+
|
|
33
42
|
Parameters
|
|
34
43
|
----------
|
|
44
|
+
verbose : typing.Optional[bool]
|
|
45
|
+
If true, includes full workflow implementation details in workflow_details field
|
|
46
|
+
|
|
35
47
|
request_options : typing.Optional[RequestOptions]
|
|
36
48
|
Request-specific configuration.
|
|
37
49
|
|
|
38
50
|
Returns
|
|
39
51
|
-------
|
|
40
|
-
|
|
52
|
+
ListWorkflowsResponse
|
|
53
|
+
Successfully retrieved workflows
|
|
41
54
|
|
|
42
55
|
Examples
|
|
43
56
|
--------
|
|
@@ -46,21 +59,54 @@ class WorkflowsClient:
|
|
|
46
59
|
client = phenoml(
|
|
47
60
|
token="YOUR_TOKEN",
|
|
48
61
|
)
|
|
49
|
-
client.workflows.
|
|
62
|
+
client.workflows.list(
|
|
63
|
+
verbose=True,
|
|
64
|
+
)
|
|
50
65
|
"""
|
|
51
|
-
_response = self._raw_client.
|
|
66
|
+
_response = self._raw_client.list(verbose=verbose, request_options=request_options)
|
|
52
67
|
return _response.data
|
|
53
68
|
|
|
54
|
-
def
|
|
69
|
+
def create(
|
|
70
|
+
self,
|
|
71
|
+
*,
|
|
72
|
+
name: str,
|
|
73
|
+
workflow_instructions: str,
|
|
74
|
+
sample_data: typing.Dict[str, typing.Optional[typing.Any]],
|
|
75
|
+
fhir_provider_id: CreateWorkflowRequestFhirProviderId,
|
|
76
|
+
verbose: typing.Optional[bool] = None,
|
|
77
|
+
dynamic_generation: typing.Optional[bool] = OMIT,
|
|
78
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
79
|
+
) -> CreateWorkflowResponse:
|
|
55
80
|
"""
|
|
81
|
+
Creates a new workflow definition with graph generation from workflow instructions
|
|
82
|
+
|
|
56
83
|
Parameters
|
|
57
84
|
----------
|
|
85
|
+
name : str
|
|
86
|
+
Human-readable name for the workflow
|
|
87
|
+
|
|
88
|
+
workflow_instructions : str
|
|
89
|
+
Natural language instructions that define the workflow logic
|
|
90
|
+
|
|
91
|
+
sample_data : typing.Dict[str, typing.Optional[typing.Any]]
|
|
92
|
+
Sample data to use for workflow graph generation
|
|
93
|
+
|
|
94
|
+
fhir_provider_id : CreateWorkflowRequestFhirProviderId
|
|
95
|
+
FHIR provider ID(s) - must be valid UUID(s) from existing FHIR providers
|
|
96
|
+
|
|
97
|
+
verbose : typing.Optional[bool]
|
|
98
|
+
If true, includes full workflow implementation details in workflow_details field
|
|
99
|
+
|
|
100
|
+
dynamic_generation : typing.Optional[bool]
|
|
101
|
+
Enable dynamic lang2fhir calls instead of pre-populated templates
|
|
102
|
+
|
|
58
103
|
request_options : typing.Optional[RequestOptions]
|
|
59
104
|
Request-specific configuration.
|
|
60
105
|
|
|
61
106
|
Returns
|
|
62
107
|
-------
|
|
63
|
-
|
|
108
|
+
CreateWorkflowResponse
|
|
109
|
+
Successfully created workflow
|
|
64
110
|
|
|
65
111
|
Examples
|
|
66
112
|
--------
|
|
@@ -69,21 +115,50 @@ class WorkflowsClient:
|
|
|
69
115
|
client = phenoml(
|
|
70
116
|
token="YOUR_TOKEN",
|
|
71
117
|
)
|
|
72
|
-
client.workflows.
|
|
118
|
+
client.workflows.create(
|
|
119
|
+
verbose=True,
|
|
120
|
+
name="Patient Data Mapping Workflow",
|
|
121
|
+
workflow_instructions="Given diagnosis data, find the patient and create condition record",
|
|
122
|
+
sample_data={
|
|
123
|
+
"patient_last_name": "Rippin",
|
|
124
|
+
"patient_first_name": "Clay",
|
|
125
|
+
"diagnosis_code": "I10",
|
|
126
|
+
},
|
|
127
|
+
fhir_provider_id="550e8400-e29b-41d4-a716-446655440000",
|
|
128
|
+
)
|
|
73
129
|
"""
|
|
74
|
-
_response = self._raw_client.
|
|
130
|
+
_response = self._raw_client.create(
|
|
131
|
+
name=name,
|
|
132
|
+
workflow_instructions=workflow_instructions,
|
|
133
|
+
sample_data=sample_data,
|
|
134
|
+
fhir_provider_id=fhir_provider_id,
|
|
135
|
+
verbose=verbose,
|
|
136
|
+
dynamic_generation=dynamic_generation,
|
|
137
|
+
request_options=request_options,
|
|
138
|
+
)
|
|
75
139
|
return _response.data
|
|
76
140
|
|
|
77
|
-
def
|
|
141
|
+
def get(
|
|
142
|
+
self, id: str, *, verbose: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None
|
|
143
|
+
) -> WorkflowsGetResponse:
|
|
78
144
|
"""
|
|
145
|
+
Retrieves a workflow definition by its ID
|
|
146
|
+
|
|
79
147
|
Parameters
|
|
80
148
|
----------
|
|
149
|
+
id : str
|
|
150
|
+
ID of the workflow to retrieve
|
|
151
|
+
|
|
152
|
+
verbose : typing.Optional[bool]
|
|
153
|
+
If true, includes full workflow implementation details in workflow_details field
|
|
154
|
+
|
|
81
155
|
request_options : typing.Optional[RequestOptions]
|
|
82
156
|
Request-specific configuration.
|
|
83
157
|
|
|
84
158
|
Returns
|
|
85
159
|
-------
|
|
86
|
-
|
|
160
|
+
WorkflowsGetResponse
|
|
161
|
+
Successfully retrieved workflow
|
|
87
162
|
|
|
88
163
|
Examples
|
|
89
164
|
--------
|
|
@@ -92,18 +167,173 @@ class WorkflowsClient:
|
|
|
92
167
|
client = phenoml(
|
|
93
168
|
token="YOUR_TOKEN",
|
|
94
169
|
)
|
|
95
|
-
client.workflows.
|
|
170
|
+
client.workflows.get(
|
|
171
|
+
id="id",
|
|
172
|
+
verbose=True,
|
|
173
|
+
)
|
|
96
174
|
"""
|
|
97
|
-
_response = self._raw_client.
|
|
175
|
+
_response = self._raw_client.get(id, verbose=verbose, request_options=request_options)
|
|
176
|
+
return _response.data
|
|
177
|
+
|
|
178
|
+
def update(
|
|
179
|
+
self,
|
|
180
|
+
id: str,
|
|
181
|
+
*,
|
|
182
|
+
name: str,
|
|
183
|
+
workflow_instructions: str,
|
|
184
|
+
sample_data: typing.Dict[str, typing.Optional[typing.Any]],
|
|
185
|
+
fhir_provider_id: UpdateWorkflowRequestFhirProviderId,
|
|
186
|
+
verbose: typing.Optional[bool] = None,
|
|
187
|
+
dynamic_generation: typing.Optional[bool] = OMIT,
|
|
188
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
189
|
+
) -> WorkflowsUpdateResponse:
|
|
190
|
+
"""
|
|
191
|
+
Updates an existing workflow definition
|
|
192
|
+
|
|
193
|
+
Parameters
|
|
194
|
+
----------
|
|
195
|
+
id : str
|
|
196
|
+
ID of the workflow to update
|
|
197
|
+
|
|
198
|
+
name : str
|
|
199
|
+
Human-readable name for the workflow
|
|
200
|
+
|
|
201
|
+
workflow_instructions : str
|
|
202
|
+
Natural language instructions that define the workflow logic
|
|
203
|
+
|
|
204
|
+
sample_data : typing.Dict[str, typing.Optional[typing.Any]]
|
|
205
|
+
Sample data to use for workflow graph generation
|
|
206
|
+
|
|
207
|
+
fhir_provider_id : UpdateWorkflowRequestFhirProviderId
|
|
208
|
+
FHIR provider ID(s) - must be valid UUID(s) from existing FHIR providers
|
|
209
|
+
|
|
210
|
+
verbose : typing.Optional[bool]
|
|
211
|
+
If true, includes full workflow implementation details in workflow_details field
|
|
212
|
+
|
|
213
|
+
dynamic_generation : typing.Optional[bool]
|
|
214
|
+
Enable dynamic lang2fhir calls instead of pre-populated templates
|
|
215
|
+
|
|
216
|
+
request_options : typing.Optional[RequestOptions]
|
|
217
|
+
Request-specific configuration.
|
|
218
|
+
|
|
219
|
+
Returns
|
|
220
|
+
-------
|
|
221
|
+
WorkflowsUpdateResponse
|
|
222
|
+
Successfully updated workflow
|
|
223
|
+
|
|
224
|
+
Examples
|
|
225
|
+
--------
|
|
226
|
+
from phenoml import phenoml
|
|
227
|
+
|
|
228
|
+
client = phenoml(
|
|
229
|
+
token="YOUR_TOKEN",
|
|
230
|
+
)
|
|
231
|
+
client.workflows.update(
|
|
232
|
+
id="id",
|
|
233
|
+
verbose=True,
|
|
234
|
+
name="Updated Patient Data Mapping Workflow",
|
|
235
|
+
workflow_instructions="Given diagnosis data, find the patient and create condition record",
|
|
236
|
+
sample_data={
|
|
237
|
+
"patient_last_name": "Smith",
|
|
238
|
+
"patient_first_name": "John",
|
|
239
|
+
"diagnosis_code": "E11",
|
|
240
|
+
},
|
|
241
|
+
fhir_provider_id="550e8400-e29b-41d4-a716-446655440000",
|
|
242
|
+
)
|
|
243
|
+
"""
|
|
244
|
+
_response = self._raw_client.update(
|
|
245
|
+
id,
|
|
246
|
+
name=name,
|
|
247
|
+
workflow_instructions=workflow_instructions,
|
|
248
|
+
sample_data=sample_data,
|
|
249
|
+
fhir_provider_id=fhir_provider_id,
|
|
250
|
+
verbose=verbose,
|
|
251
|
+
dynamic_generation=dynamic_generation,
|
|
252
|
+
request_options=request_options,
|
|
253
|
+
)
|
|
254
|
+
return _response.data
|
|
255
|
+
|
|
256
|
+
def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> WorkflowsDeleteResponse:
|
|
257
|
+
"""
|
|
258
|
+
Deletes a workflow definition by its ID
|
|
259
|
+
|
|
260
|
+
Parameters
|
|
261
|
+
----------
|
|
262
|
+
id : str
|
|
263
|
+
ID of the workflow to delete
|
|
264
|
+
|
|
265
|
+
request_options : typing.Optional[RequestOptions]
|
|
266
|
+
Request-specific configuration.
|
|
267
|
+
|
|
268
|
+
Returns
|
|
269
|
+
-------
|
|
270
|
+
WorkflowsDeleteResponse
|
|
271
|
+
Successfully deleted workflow
|
|
272
|
+
|
|
273
|
+
Examples
|
|
274
|
+
--------
|
|
275
|
+
from phenoml import phenoml
|
|
276
|
+
|
|
277
|
+
client = phenoml(
|
|
278
|
+
token="YOUR_TOKEN",
|
|
279
|
+
)
|
|
280
|
+
client.workflows.delete(
|
|
281
|
+
id="id",
|
|
282
|
+
)
|
|
283
|
+
"""
|
|
284
|
+
_response = self._raw_client.delete(id, request_options=request_options)
|
|
285
|
+
return _response.data
|
|
286
|
+
|
|
287
|
+
def execute(
|
|
288
|
+
self,
|
|
289
|
+
id: str,
|
|
290
|
+
*,
|
|
291
|
+
input_data: typing.Dict[str, typing.Optional[typing.Any]],
|
|
292
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
293
|
+
) -> ExecuteWorkflowResponse:
|
|
294
|
+
"""
|
|
295
|
+
Executes a workflow with provided input data and returns results
|
|
296
|
+
|
|
297
|
+
Parameters
|
|
298
|
+
----------
|
|
299
|
+
id : str
|
|
300
|
+
ID of the workflow to execute
|
|
301
|
+
|
|
302
|
+
input_data : typing.Dict[str, typing.Optional[typing.Any]]
|
|
303
|
+
Input data for workflow execution
|
|
304
|
+
|
|
305
|
+
request_options : typing.Optional[RequestOptions]
|
|
306
|
+
Request-specific configuration.
|
|
307
|
+
|
|
308
|
+
Returns
|
|
309
|
+
-------
|
|
310
|
+
ExecuteWorkflowResponse
|
|
311
|
+
Successfully executed workflow
|
|
312
|
+
|
|
313
|
+
Examples
|
|
314
|
+
--------
|
|
315
|
+
from phenoml import phenoml
|
|
316
|
+
|
|
317
|
+
client = phenoml(
|
|
318
|
+
token="YOUR_TOKEN",
|
|
319
|
+
)
|
|
320
|
+
client.workflows.execute(
|
|
321
|
+
id="id",
|
|
322
|
+
input_data={
|
|
323
|
+
"patient_last_name": "Johnson",
|
|
324
|
+
"patient_first_name": "Mary",
|
|
325
|
+
"diagnosis_code": "M79.3",
|
|
326
|
+
"encounter_date": "2024-01-15",
|
|
327
|
+
},
|
|
328
|
+
)
|
|
329
|
+
"""
|
|
330
|
+
_response = self._raw_client.execute(id, input_data=input_data, request_options=request_options)
|
|
98
331
|
return _response.data
|
|
99
332
|
|
|
100
333
|
|
|
101
334
|
class AsyncWorkflowsClient:
|
|
102
335
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
103
336
|
self._raw_client = AsyncRawWorkflowsClient(client_wrapper=client_wrapper)
|
|
104
|
-
self.workflows = workflows_workflows_client_AsyncWorkflowsClient(client_wrapper=client_wrapper)
|
|
105
|
-
|
|
106
|
-
self.mcp_server = AsyncMcpServerClient(client_wrapper=client_wrapper)
|
|
107
337
|
|
|
108
338
|
@property
|
|
109
339
|
def with_raw_response(self) -> AsyncRawWorkflowsClient:
|
|
@@ -116,16 +346,24 @@ class AsyncWorkflowsClient:
|
|
|
116
346
|
"""
|
|
117
347
|
return self._raw_client
|
|
118
348
|
|
|
119
|
-
async def
|
|
349
|
+
async def list(
|
|
350
|
+
self, *, verbose: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None
|
|
351
|
+
) -> ListWorkflowsResponse:
|
|
120
352
|
"""
|
|
353
|
+
Retrieves all workflow definitions for the authenticated user
|
|
354
|
+
|
|
121
355
|
Parameters
|
|
122
356
|
----------
|
|
357
|
+
verbose : typing.Optional[bool]
|
|
358
|
+
If true, includes full workflow implementation details in workflow_details field
|
|
359
|
+
|
|
123
360
|
request_options : typing.Optional[RequestOptions]
|
|
124
361
|
Request-specific configuration.
|
|
125
362
|
|
|
126
363
|
Returns
|
|
127
364
|
-------
|
|
128
|
-
|
|
365
|
+
ListWorkflowsResponse
|
|
366
|
+
Successfully retrieved workflows
|
|
129
367
|
|
|
130
368
|
Examples
|
|
131
369
|
--------
|
|
@@ -139,24 +377,245 @@ class AsyncWorkflowsClient:
|
|
|
139
377
|
|
|
140
378
|
|
|
141
379
|
async def main() -> None:
|
|
142
|
-
await client.workflows.
|
|
380
|
+
await client.workflows.list(
|
|
381
|
+
verbose=True,
|
|
382
|
+
)
|
|
143
383
|
|
|
144
384
|
|
|
145
385
|
asyncio.run(main())
|
|
146
386
|
"""
|
|
147
|
-
_response = await self._raw_client.
|
|
387
|
+
_response = await self._raw_client.list(verbose=verbose, request_options=request_options)
|
|
148
388
|
return _response.data
|
|
149
389
|
|
|
150
|
-
async def
|
|
390
|
+
async def create(
|
|
391
|
+
self,
|
|
392
|
+
*,
|
|
393
|
+
name: str,
|
|
394
|
+
workflow_instructions: str,
|
|
395
|
+
sample_data: typing.Dict[str, typing.Optional[typing.Any]],
|
|
396
|
+
fhir_provider_id: CreateWorkflowRequestFhirProviderId,
|
|
397
|
+
verbose: typing.Optional[bool] = None,
|
|
398
|
+
dynamic_generation: typing.Optional[bool] = OMIT,
|
|
399
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
400
|
+
) -> CreateWorkflowResponse:
|
|
151
401
|
"""
|
|
402
|
+
Creates a new workflow definition with graph generation from workflow instructions
|
|
403
|
+
|
|
152
404
|
Parameters
|
|
153
405
|
----------
|
|
406
|
+
name : str
|
|
407
|
+
Human-readable name for the workflow
|
|
408
|
+
|
|
409
|
+
workflow_instructions : str
|
|
410
|
+
Natural language instructions that define the workflow logic
|
|
411
|
+
|
|
412
|
+
sample_data : typing.Dict[str, typing.Optional[typing.Any]]
|
|
413
|
+
Sample data to use for workflow graph generation
|
|
414
|
+
|
|
415
|
+
fhir_provider_id : CreateWorkflowRequestFhirProviderId
|
|
416
|
+
FHIR provider ID(s) - must be valid UUID(s) from existing FHIR providers
|
|
417
|
+
|
|
418
|
+
verbose : typing.Optional[bool]
|
|
419
|
+
If true, includes full workflow implementation details in workflow_details field
|
|
420
|
+
|
|
421
|
+
dynamic_generation : typing.Optional[bool]
|
|
422
|
+
Enable dynamic lang2fhir calls instead of pre-populated templates
|
|
423
|
+
|
|
424
|
+
request_options : typing.Optional[RequestOptions]
|
|
425
|
+
Request-specific configuration.
|
|
426
|
+
|
|
427
|
+
Returns
|
|
428
|
+
-------
|
|
429
|
+
CreateWorkflowResponse
|
|
430
|
+
Successfully created workflow
|
|
431
|
+
|
|
432
|
+
Examples
|
|
433
|
+
--------
|
|
434
|
+
import asyncio
|
|
435
|
+
|
|
436
|
+
from phenoml import Asyncphenoml
|
|
437
|
+
|
|
438
|
+
client = Asyncphenoml(
|
|
439
|
+
token="YOUR_TOKEN",
|
|
440
|
+
)
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
async def main() -> None:
|
|
444
|
+
await client.workflows.create(
|
|
445
|
+
verbose=True,
|
|
446
|
+
name="Patient Data Mapping Workflow",
|
|
447
|
+
workflow_instructions="Given diagnosis data, find the patient and create condition record",
|
|
448
|
+
sample_data={
|
|
449
|
+
"patient_last_name": "Rippin",
|
|
450
|
+
"patient_first_name": "Clay",
|
|
451
|
+
"diagnosis_code": "I10",
|
|
452
|
+
},
|
|
453
|
+
fhir_provider_id="550e8400-e29b-41d4-a716-446655440000",
|
|
454
|
+
)
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
asyncio.run(main())
|
|
458
|
+
"""
|
|
459
|
+
_response = await self._raw_client.create(
|
|
460
|
+
name=name,
|
|
461
|
+
workflow_instructions=workflow_instructions,
|
|
462
|
+
sample_data=sample_data,
|
|
463
|
+
fhir_provider_id=fhir_provider_id,
|
|
464
|
+
verbose=verbose,
|
|
465
|
+
dynamic_generation=dynamic_generation,
|
|
466
|
+
request_options=request_options,
|
|
467
|
+
)
|
|
468
|
+
return _response.data
|
|
469
|
+
|
|
470
|
+
async def get(
|
|
471
|
+
self, id: str, *, verbose: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None
|
|
472
|
+
) -> WorkflowsGetResponse:
|
|
473
|
+
"""
|
|
474
|
+
Retrieves a workflow definition by its ID
|
|
475
|
+
|
|
476
|
+
Parameters
|
|
477
|
+
----------
|
|
478
|
+
id : str
|
|
479
|
+
ID of the workflow to retrieve
|
|
480
|
+
|
|
481
|
+
verbose : typing.Optional[bool]
|
|
482
|
+
If true, includes full workflow implementation details in workflow_details field
|
|
483
|
+
|
|
484
|
+
request_options : typing.Optional[RequestOptions]
|
|
485
|
+
Request-specific configuration.
|
|
486
|
+
|
|
487
|
+
Returns
|
|
488
|
+
-------
|
|
489
|
+
WorkflowsGetResponse
|
|
490
|
+
Successfully retrieved workflow
|
|
491
|
+
|
|
492
|
+
Examples
|
|
493
|
+
--------
|
|
494
|
+
import asyncio
|
|
495
|
+
|
|
496
|
+
from phenoml import Asyncphenoml
|
|
497
|
+
|
|
498
|
+
client = Asyncphenoml(
|
|
499
|
+
token="YOUR_TOKEN",
|
|
500
|
+
)
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
async def main() -> None:
|
|
504
|
+
await client.workflows.get(
|
|
505
|
+
id="id",
|
|
506
|
+
verbose=True,
|
|
507
|
+
)
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
asyncio.run(main())
|
|
511
|
+
"""
|
|
512
|
+
_response = await self._raw_client.get(id, verbose=verbose, request_options=request_options)
|
|
513
|
+
return _response.data
|
|
514
|
+
|
|
515
|
+
async def update(
|
|
516
|
+
self,
|
|
517
|
+
id: str,
|
|
518
|
+
*,
|
|
519
|
+
name: str,
|
|
520
|
+
workflow_instructions: str,
|
|
521
|
+
sample_data: typing.Dict[str, typing.Optional[typing.Any]],
|
|
522
|
+
fhir_provider_id: UpdateWorkflowRequestFhirProviderId,
|
|
523
|
+
verbose: typing.Optional[bool] = None,
|
|
524
|
+
dynamic_generation: typing.Optional[bool] = OMIT,
|
|
525
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
526
|
+
) -> WorkflowsUpdateResponse:
|
|
527
|
+
"""
|
|
528
|
+
Updates an existing workflow definition
|
|
529
|
+
|
|
530
|
+
Parameters
|
|
531
|
+
----------
|
|
532
|
+
id : str
|
|
533
|
+
ID of the workflow to update
|
|
534
|
+
|
|
535
|
+
name : str
|
|
536
|
+
Human-readable name for the workflow
|
|
537
|
+
|
|
538
|
+
workflow_instructions : str
|
|
539
|
+
Natural language instructions that define the workflow logic
|
|
540
|
+
|
|
541
|
+
sample_data : typing.Dict[str, typing.Optional[typing.Any]]
|
|
542
|
+
Sample data to use for workflow graph generation
|
|
543
|
+
|
|
544
|
+
fhir_provider_id : UpdateWorkflowRequestFhirProviderId
|
|
545
|
+
FHIR provider ID(s) - must be valid UUID(s) from existing FHIR providers
|
|
546
|
+
|
|
547
|
+
verbose : typing.Optional[bool]
|
|
548
|
+
If true, includes full workflow implementation details in workflow_details field
|
|
549
|
+
|
|
550
|
+
dynamic_generation : typing.Optional[bool]
|
|
551
|
+
Enable dynamic lang2fhir calls instead of pre-populated templates
|
|
552
|
+
|
|
553
|
+
request_options : typing.Optional[RequestOptions]
|
|
554
|
+
Request-specific configuration.
|
|
555
|
+
|
|
556
|
+
Returns
|
|
557
|
+
-------
|
|
558
|
+
WorkflowsUpdateResponse
|
|
559
|
+
Successfully updated workflow
|
|
560
|
+
|
|
561
|
+
Examples
|
|
562
|
+
--------
|
|
563
|
+
import asyncio
|
|
564
|
+
|
|
565
|
+
from phenoml import Asyncphenoml
|
|
566
|
+
|
|
567
|
+
client = Asyncphenoml(
|
|
568
|
+
token="YOUR_TOKEN",
|
|
569
|
+
)
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
async def main() -> None:
|
|
573
|
+
await client.workflows.update(
|
|
574
|
+
id="id",
|
|
575
|
+
verbose=True,
|
|
576
|
+
name="Updated Patient Data Mapping Workflow",
|
|
577
|
+
workflow_instructions="Given diagnosis data, find the patient and create condition record",
|
|
578
|
+
sample_data={
|
|
579
|
+
"patient_last_name": "Smith",
|
|
580
|
+
"patient_first_name": "John",
|
|
581
|
+
"diagnosis_code": "E11",
|
|
582
|
+
},
|
|
583
|
+
fhir_provider_id="550e8400-e29b-41d4-a716-446655440000",
|
|
584
|
+
)
|
|
585
|
+
|
|
586
|
+
|
|
587
|
+
asyncio.run(main())
|
|
588
|
+
"""
|
|
589
|
+
_response = await self._raw_client.update(
|
|
590
|
+
id,
|
|
591
|
+
name=name,
|
|
592
|
+
workflow_instructions=workflow_instructions,
|
|
593
|
+
sample_data=sample_data,
|
|
594
|
+
fhir_provider_id=fhir_provider_id,
|
|
595
|
+
verbose=verbose,
|
|
596
|
+
dynamic_generation=dynamic_generation,
|
|
597
|
+
request_options=request_options,
|
|
598
|
+
)
|
|
599
|
+
return _response.data
|
|
600
|
+
|
|
601
|
+
async def delete(
|
|
602
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
603
|
+
) -> WorkflowsDeleteResponse:
|
|
604
|
+
"""
|
|
605
|
+
Deletes a workflow definition by its ID
|
|
606
|
+
|
|
607
|
+
Parameters
|
|
608
|
+
----------
|
|
609
|
+
id : str
|
|
610
|
+
ID of the workflow to delete
|
|
611
|
+
|
|
154
612
|
request_options : typing.Optional[RequestOptions]
|
|
155
613
|
Request-specific configuration.
|
|
156
614
|
|
|
157
615
|
Returns
|
|
158
616
|
-------
|
|
159
|
-
|
|
617
|
+
WorkflowsDeleteResponse
|
|
618
|
+
Successfully deleted workflow
|
|
160
619
|
|
|
161
620
|
Examples
|
|
162
621
|
--------
|
|
@@ -170,24 +629,41 @@ class AsyncWorkflowsClient:
|
|
|
170
629
|
|
|
171
630
|
|
|
172
631
|
async def main() -> None:
|
|
173
|
-
await client.workflows.
|
|
632
|
+
await client.workflows.delete(
|
|
633
|
+
id="id",
|
|
634
|
+
)
|
|
174
635
|
|
|
175
636
|
|
|
176
637
|
asyncio.run(main())
|
|
177
638
|
"""
|
|
178
|
-
_response = await self._raw_client.
|
|
639
|
+
_response = await self._raw_client.delete(id, request_options=request_options)
|
|
179
640
|
return _response.data
|
|
180
641
|
|
|
181
|
-
async def
|
|
642
|
+
async def execute(
|
|
643
|
+
self,
|
|
644
|
+
id: str,
|
|
645
|
+
*,
|
|
646
|
+
input_data: typing.Dict[str, typing.Optional[typing.Any]],
|
|
647
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
648
|
+
) -> ExecuteWorkflowResponse:
|
|
182
649
|
"""
|
|
650
|
+
Executes a workflow with provided input data and returns results
|
|
651
|
+
|
|
183
652
|
Parameters
|
|
184
653
|
----------
|
|
654
|
+
id : str
|
|
655
|
+
ID of the workflow to execute
|
|
656
|
+
|
|
657
|
+
input_data : typing.Dict[str, typing.Optional[typing.Any]]
|
|
658
|
+
Input data for workflow execution
|
|
659
|
+
|
|
185
660
|
request_options : typing.Optional[RequestOptions]
|
|
186
661
|
Request-specific configuration.
|
|
187
662
|
|
|
188
663
|
Returns
|
|
189
664
|
-------
|
|
190
|
-
|
|
665
|
+
ExecuteWorkflowResponse
|
|
666
|
+
Successfully executed workflow
|
|
191
667
|
|
|
192
668
|
Examples
|
|
193
669
|
--------
|
|
@@ -201,10 +677,18 @@ class AsyncWorkflowsClient:
|
|
|
201
677
|
|
|
202
678
|
|
|
203
679
|
async def main() -> None:
|
|
204
|
-
await client.workflows.
|
|
680
|
+
await client.workflows.execute(
|
|
681
|
+
id="id",
|
|
682
|
+
input_data={
|
|
683
|
+
"patient_last_name": "Johnson",
|
|
684
|
+
"patient_first_name": "Mary",
|
|
685
|
+
"diagnosis_code": "M79.3",
|
|
686
|
+
"encounter_date": "2024-01-15",
|
|
687
|
+
},
|
|
688
|
+
)
|
|
205
689
|
|
|
206
690
|
|
|
207
691
|
asyncio.run(main())
|
|
208
692
|
"""
|
|
209
|
-
_response = await self._raw_client.
|
|
693
|
+
_response = await self._raw_client.execute(id, input_data=input_data, request_options=request_options)
|
|
210
694
|
return _response.data
|