phenoml 0.0.6__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 (244) hide show
  1. phenoml/__init__.py +30 -0
  2. phenoml/agent/__init__.py +56 -0
  3. phenoml/agent/client.py +939 -0
  4. phenoml/agent/errors/__init__.py +11 -0
  5. phenoml/agent/errors/bad_request_error.py +10 -0
  6. phenoml/agent/errors/forbidden_error.py +10 -0
  7. phenoml/agent/errors/internal_server_error.py +10 -0
  8. phenoml/agent/errors/not_found_error.py +10 -0
  9. phenoml/agent/errors/unauthorized_error.py +10 -0
  10. phenoml/agent/prompts/__init__.py +7 -0
  11. phenoml/agent/prompts/client.py +707 -0
  12. phenoml/agent/prompts/raw_client.py +1345 -0
  13. phenoml/agent/prompts/types/__init__.py +8 -0
  14. phenoml/agent/prompts/types/prompts_delete_response.py +20 -0
  15. phenoml/agent/prompts/types/prompts_list_response.py +22 -0
  16. phenoml/agent/raw_client.py +1668 -0
  17. phenoml/agent/types/__init__.py +43 -0
  18. phenoml/agent/types/agent_chat_response.py +33 -0
  19. phenoml/agent/types/agent_create_request.py +53 -0
  20. phenoml/agent/types/agent_create_request_provider.py +5 -0
  21. phenoml/agent/types/agent_delete_response.py +20 -0
  22. phenoml/agent/types/agent_get_chat_messages_request_order.py +5 -0
  23. phenoml/agent/types/agent_get_chat_messages_response.py +22 -0
  24. phenoml/agent/types/agent_list_response.py +22 -0
  25. phenoml/agent/types/agent_prompts_response.py +22 -0
  26. phenoml/agent/types/agent_response.py +22 -0
  27. phenoml/agent/types/agent_template.py +58 -0
  28. phenoml/agent/types/agent_template_provider.py +5 -0
  29. phenoml/agent/types/chat_message_template.py +72 -0
  30. phenoml/agent/types/chat_session_template.py +67 -0
  31. phenoml/agent/types/json_patch.py +7 -0
  32. phenoml/agent/types/json_patch_operation.py +40 -0
  33. phenoml/agent/types/json_patch_operation_op.py +5 -0
  34. phenoml/agent/types/prompt_template.py +52 -0
  35. phenoml/agent/types/success_response.py +20 -0
  36. phenoml/authtoken/__init__.py +17 -0
  37. phenoml/authtoken/auth/__init__.py +7 -0
  38. phenoml/authtoken/auth/client.py +129 -0
  39. phenoml/authtoken/auth/raw_client.py +173 -0
  40. phenoml/authtoken/auth/types/__init__.py +7 -0
  41. phenoml/authtoken/auth/types/auth_generate_token_response.py +22 -0
  42. phenoml/authtoken/client.py +39 -0
  43. phenoml/authtoken/errors/__init__.py +8 -0
  44. phenoml/authtoken/errors/bad_request_error.py +10 -0
  45. phenoml/authtoken/errors/unauthorized_error.py +10 -0
  46. phenoml/authtoken/raw_client.py +13 -0
  47. phenoml/authtoken/types/__init__.py +8 -0
  48. phenoml/authtoken/types/bad_request_error_body.py +21 -0
  49. phenoml/authtoken/types/unauthorized_error_body.py +21 -0
  50. phenoml/client.py +177 -0
  51. phenoml/cohort/__init__.py +8 -0
  52. phenoml/cohort/client.py +113 -0
  53. phenoml/cohort/errors/__init__.py +9 -0
  54. phenoml/cohort/errors/bad_request_error.py +10 -0
  55. phenoml/cohort/errors/internal_server_error.py +10 -0
  56. phenoml/cohort/errors/unauthorized_error.py +10 -0
  57. phenoml/cohort/raw_client.py +185 -0
  58. phenoml/cohort/types/__init__.py +8 -0
  59. phenoml/cohort/types/cohort_response.py +33 -0
  60. phenoml/cohort/types/search_concept.py +37 -0
  61. phenoml/construe/__init__.py +45 -0
  62. phenoml/construe/client.py +399 -0
  63. phenoml/construe/errors/__init__.py +11 -0
  64. phenoml/construe/errors/bad_request_error.py +10 -0
  65. phenoml/construe/errors/conflict_error.py +10 -0
  66. phenoml/construe/errors/failed_dependency_error.py +10 -0
  67. phenoml/construe/errors/internal_server_error.py +10 -0
  68. phenoml/construe/errors/unauthorized_error.py +10 -0
  69. phenoml/construe/raw_client.py +706 -0
  70. phenoml/construe/types/__init__.py +41 -0
  71. phenoml/construe/types/bad_request_error_body.py +27 -0
  72. phenoml/construe/types/construe_cohort_request_config.py +37 -0
  73. phenoml/construe/types/construe_cohort_response.py +33 -0
  74. phenoml/construe/types/construe_cohort_response_queries_item.py +49 -0
  75. phenoml/construe/types/construe_cohort_response_queries_item_code_extract_results_item.py +31 -0
  76. phenoml/construe/types/construe_cohort_response_queries_item_code_extract_results_item_codes_item.py +32 -0
  77. phenoml/construe/types/construe_upload_code_system_response.py +19 -0
  78. phenoml/construe/types/extract_codes_result.py +22 -0
  79. phenoml/construe/types/extract_request_config.py +23 -0
  80. phenoml/construe/types/extract_request_config_chunking_method.py +5 -0
  81. phenoml/construe/types/extract_request_system.py +37 -0
  82. phenoml/construe/types/extracted_code_result.py +41 -0
  83. phenoml/construe/types/internal_server_error_body.py +27 -0
  84. phenoml/construe/types/unauthorized_error_body.py +27 -0
  85. phenoml/construe/types/upload_request_format.py +5 -0
  86. phenoml/core/__init__.py +52 -0
  87. phenoml/core/api_error.py +23 -0
  88. phenoml/core/client_wrapper.py +87 -0
  89. phenoml/core/datetime_utils.py +28 -0
  90. phenoml/core/file.py +67 -0
  91. phenoml/core/force_multipart.py +16 -0
  92. phenoml/core/http_client.py +543 -0
  93. phenoml/core/http_response.py +55 -0
  94. phenoml/core/jsonable_encoder.py +100 -0
  95. phenoml/core/pydantic_utilities.py +255 -0
  96. phenoml/core/query_encoder.py +58 -0
  97. phenoml/core/remove_none_from_dict.py +11 -0
  98. phenoml/core/request_options.py +35 -0
  99. phenoml/core/serialization.py +276 -0
  100. phenoml/environment.py +7 -0
  101. phenoml/fhir/__init__.py +36 -0
  102. phenoml/fhir/client.py +970 -0
  103. phenoml/fhir/errors/__init__.py +10 -0
  104. phenoml/fhir/errors/bad_request_error.py +10 -0
  105. phenoml/fhir/errors/internal_server_error.py +10 -0
  106. phenoml/fhir/errors/not_found_error.py +10 -0
  107. phenoml/fhir/errors/unauthorized_error.py +10 -0
  108. phenoml/fhir/raw_client.py +1385 -0
  109. phenoml/fhir/types/__init__.py +29 -0
  110. phenoml/fhir/types/error_response.py +36 -0
  111. phenoml/fhir/types/fhir_bundle.py +43 -0
  112. phenoml/fhir/types/fhir_bundle_entry_item.py +34 -0
  113. phenoml/fhir/types/fhir_bundle_entry_item_request.py +25 -0
  114. phenoml/fhir/types/fhir_bundle_entry_item_request_method.py +5 -0
  115. phenoml/fhir/types/fhir_bundle_entry_item_response.py +24 -0
  116. phenoml/fhir/types/fhir_patch_request_body_item.py +40 -0
  117. phenoml/fhir/types/fhir_patch_request_body_item_op.py +7 -0
  118. phenoml/fhir/types/fhir_resource.py +40 -0
  119. phenoml/fhir/types/fhir_resource_meta.py +28 -0
  120. phenoml/fhir/types/fhir_search_response.py +8 -0
  121. phenoml/fhir_provider/__init__.py +43 -0
  122. phenoml/fhir_provider/client.py +731 -0
  123. phenoml/fhir_provider/errors/__init__.py +11 -0
  124. phenoml/fhir_provider/errors/bad_request_error.py +10 -0
  125. phenoml/fhir_provider/errors/forbidden_error.py +10 -0
  126. phenoml/fhir_provider/errors/internal_server_error.py +10 -0
  127. phenoml/fhir_provider/errors/not_found_error.py +10 -0
  128. phenoml/fhir_provider/errors/unauthorized_error.py +10 -0
  129. phenoml/fhir_provider/raw_client.py +1445 -0
  130. phenoml/fhir_provider/types/__init__.py +35 -0
  131. phenoml/fhir_provider/types/auth_method.py +7 -0
  132. phenoml/fhir_provider/types/fhir_provider_auth_config.py +53 -0
  133. phenoml/fhir_provider/types/fhir_provider_delete_response.py +20 -0
  134. phenoml/fhir_provider/types/fhir_provider_list_response.py +22 -0
  135. phenoml/fhir_provider/types/fhir_provider_remove_auth_config_response.py +22 -0
  136. phenoml/fhir_provider/types/fhir_provider_response.py +22 -0
  137. phenoml/fhir_provider/types/fhir_provider_set_active_auth_config_response.py +22 -0
  138. phenoml/fhir_provider/types/fhir_provider_template.py +66 -0
  139. phenoml/fhir_provider/types/fhir_query_response.py +27 -0
  140. phenoml/fhir_provider/types/fhir_query_response_data.py +5 -0
  141. phenoml/fhir_provider/types/json_web_key.py +51 -0
  142. phenoml/fhir_provider/types/provider.py +8 -0
  143. phenoml/fhir_provider/types/service_account_key.py +35 -0
  144. phenoml/fhir_provider/types/smart_configuration.py +46 -0
  145. phenoml/lang2fhir/__init__.py +27 -0
  146. phenoml/lang2fhir/client.py +430 -0
  147. phenoml/lang2fhir/errors/__init__.py +11 -0
  148. phenoml/lang2fhir/errors/bad_request_error.py +10 -0
  149. phenoml/lang2fhir/errors/failed_dependency_error.py +10 -0
  150. phenoml/lang2fhir/errors/forbidden_error.py +10 -0
  151. phenoml/lang2fhir/errors/internal_server_error.py +10 -0
  152. phenoml/lang2fhir/errors/unauthorized_error.py +10 -0
  153. phenoml/lang2fhir/raw_client.py +788 -0
  154. phenoml/lang2fhir/types/__init__.py +19 -0
  155. phenoml/lang2fhir/types/create_request_resource.py +25 -0
  156. phenoml/lang2fhir/types/document_request_file_type.py +7 -0
  157. phenoml/lang2fhir/types/document_request_resource.py +5 -0
  158. phenoml/lang2fhir/types/fhir_resource.py +5 -0
  159. phenoml/lang2fhir/types/lang2fhir_upload_profile_response.py +23 -0
  160. phenoml/lang2fhir/types/search_response.py +33 -0
  161. phenoml/py.typed +0 -0
  162. phenoml/tools/__init__.py +37 -0
  163. phenoml/tools/client.py +359 -0
  164. phenoml/tools/errors/__init__.py +11 -0
  165. phenoml/tools/errors/bad_request_error.py +10 -0
  166. phenoml/tools/errors/failed_dependency_error.py +10 -0
  167. phenoml/tools/errors/forbidden_error.py +10 -0
  168. phenoml/tools/errors/internal_server_error.py +10 -0
  169. phenoml/tools/errors/unauthorized_error.py +10 -0
  170. phenoml/tools/mcp_server/__init__.py +7 -0
  171. phenoml/tools/mcp_server/client.py +336 -0
  172. phenoml/tools/mcp_server/raw_client.py +641 -0
  173. phenoml/tools/mcp_server/tools/__init__.py +4 -0
  174. phenoml/tools/mcp_server/tools/client.py +358 -0
  175. phenoml/tools/mcp_server/tools/raw_client.py +656 -0
  176. phenoml/tools/raw_client.py +696 -0
  177. phenoml/tools/types/__init__.py +27 -0
  178. phenoml/tools/types/cohort_response.py +49 -0
  179. phenoml/tools/types/lang2fhir_and_create_request_resource.py +25 -0
  180. phenoml/tools/types/lang2fhir_and_create_response.py +33 -0
  181. phenoml/tools/types/lang2fhir_and_search_response.py +40 -0
  182. phenoml/tools/types/mcp_server_response.py +33 -0
  183. phenoml/tools/types/mcp_server_response_data.py +51 -0
  184. phenoml/tools/types/mcp_server_tool_call_response.py +37 -0
  185. phenoml/tools/types/mcp_server_tool_response.py +33 -0
  186. phenoml/tools/types/mcp_server_tool_response_data.py +61 -0
  187. phenoml/tools/types/search_concept.py +41 -0
  188. phenoml/types/__init__.py +21 -0
  189. phenoml/types/cohort_response.py +5 -0
  190. phenoml/types/lang2fhir_and_create_response.py +5 -0
  191. phenoml/types/lang2fhir_and_search_response.py +5 -0
  192. phenoml/types/mcp_server_response.py +5 -0
  193. phenoml/types/mcp_server_tool_call_response.py +5 -0
  194. phenoml/types/mcp_server_tool_response.py +5 -0
  195. phenoml/types/search_concept.py +5 -0
  196. phenoml/version.py +3 -0
  197. phenoml/workflows/__init__.py +66 -0
  198. phenoml/workflows/client.py +210 -0
  199. phenoml/workflows/errors/__init__.py +11 -0
  200. phenoml/workflows/errors/bad_request_error.py +10 -0
  201. phenoml/workflows/errors/forbidden_error.py +10 -0
  202. phenoml/workflows/errors/internal_server_error.py +10 -0
  203. phenoml/workflows/errors/not_found_error.py +10 -0
  204. phenoml/workflows/errors/unauthorized_error.py +10 -0
  205. phenoml/workflows/mcp_server/__init__.py +7 -0
  206. phenoml/workflows/mcp_server/client.py +274 -0
  207. phenoml/workflows/mcp_server/raw_client.py +226 -0
  208. phenoml/workflows/mcp_server/tools/__init__.py +4 -0
  209. phenoml/workflows/mcp_server/tools/client.py +287 -0
  210. phenoml/workflows/mcp_server/tools/raw_client.py +244 -0
  211. phenoml/workflows/raw_client.py +169 -0
  212. phenoml/workflows/types/__init__.py +43 -0
  213. phenoml/workflows/types/create_workflow_response.py +44 -0
  214. phenoml/workflows/types/decision_node_definition.py +32 -0
  215. phenoml/workflows/types/execute_workflow_response.py +30 -0
  216. phenoml/workflows/types/execute_workflow_response_results.py +22 -0
  217. phenoml/workflows/types/lang2fhir_create_definition.py +37 -0
  218. phenoml/workflows/types/lang2fhir_search_definition.py +42 -0
  219. phenoml/workflows/types/list_workflows_response.py +39 -0
  220. phenoml/workflows/types/step_operation.py +26 -0
  221. phenoml/workflows/types/sub_workflow_definition.py +32 -0
  222. phenoml/workflows/types/workflow_config.py +27 -0
  223. phenoml/workflows/types/workflow_definition.py +57 -0
  224. phenoml/workflows/types/workflow_graph.py +23 -0
  225. phenoml/workflows/types/workflow_response.py +61 -0
  226. phenoml/workflows/types/workflow_response_graph.py +23 -0
  227. phenoml/workflows/types/workflow_step.py +55 -0
  228. phenoml/workflows/types/workflow_step_summary.py +47 -0
  229. phenoml/workflows/types/workflow_step_summary_type.py +5 -0
  230. phenoml/workflows/types/workflow_step_type.py +5 -0
  231. phenoml/workflows/workflows/__init__.py +19 -0
  232. phenoml/workflows/workflows/client.py +694 -0
  233. phenoml/workflows/workflows/raw_client.py +1266 -0
  234. phenoml/workflows/workflows/types/__init__.py +17 -0
  235. phenoml/workflows/workflows/types/create_workflow_request_fhir_provider_id.py +5 -0
  236. phenoml/workflows/workflows/types/update_workflow_request_fhir_provider_id.py +5 -0
  237. phenoml/workflows/workflows/types/workflows_delete_response.py +20 -0
  238. phenoml/workflows/workflows/types/workflows_get_response.py +26 -0
  239. phenoml/workflows/workflows/types/workflows_update_response.py +31 -0
  240. phenoml/wrapper_client.py +123 -0
  241. phenoml-0.0.6.dist-info/LICENSE +21 -0
  242. phenoml-0.0.6.dist-info/METADATA +192 -0
  243. phenoml-0.0.6.dist-info/RECORD +244 -0
  244. phenoml-0.0.6.dist-info/WHEEL +4 -0
@@ -0,0 +1,694 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
6
+ from ...core.request_options import RequestOptions
7
+ from ..types.create_workflow_response import CreateWorkflowResponse
8
+ from ..types.execute_workflow_response import ExecuteWorkflowResponse
9
+ from ..types.list_workflows_response import ListWorkflowsResponse
10
+ from .raw_client import AsyncRawWorkflowsClient, RawWorkflowsClient
11
+ from .types.create_workflow_request_fhir_provider_id import CreateWorkflowRequestFhirProviderId
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, ...)
19
+
20
+
21
+ class WorkflowsClient:
22
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
23
+ self._raw_client = RawWorkflowsClient(client_wrapper=client_wrapper)
24
+
25
+ @property
26
+ def with_raw_response(self) -> RawWorkflowsClient:
27
+ """
28
+ Retrieves a raw implementation of this client that returns raw responses.
29
+
30
+ Returns
31
+ -------
32
+ RawWorkflowsClient
33
+ """
34
+ return self._raw_client
35
+
36
+ def list(
37
+ self, *, verbose: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None
38
+ ) -> ListWorkflowsResponse:
39
+ """
40
+ Retrieves all workflow definitions for the authenticated user
41
+
42
+ Parameters
43
+ ----------
44
+ verbose : typing.Optional[bool]
45
+ If true, includes full workflow implementation details in workflow_details field
46
+
47
+ request_options : typing.Optional[RequestOptions]
48
+ Request-specific configuration.
49
+
50
+ Returns
51
+ -------
52
+ ListWorkflowsResponse
53
+ Successfully retrieved workflows
54
+
55
+ Examples
56
+ --------
57
+ from phenoml import phenoml
58
+
59
+ client = phenoml(
60
+ token="YOUR_TOKEN",
61
+ )
62
+ client.workflows.workflows.list(
63
+ verbose=True,
64
+ )
65
+ """
66
+ _response = self._raw_client.list(verbose=verbose, request_options=request_options)
67
+ return _response.data
68
+
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:
80
+ """
81
+ Creates a new workflow definition with graph generation from workflow instructions
82
+
83
+ Parameters
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
+
103
+ request_options : typing.Optional[RequestOptions]
104
+ Request-specific configuration.
105
+
106
+ Returns
107
+ -------
108
+ CreateWorkflowResponse
109
+ Successfully created workflow
110
+
111
+ Examples
112
+ --------
113
+ from phenoml import phenoml
114
+
115
+ client = phenoml(
116
+ token="YOUR_TOKEN",
117
+ )
118
+ client.workflows.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
+ )
129
+ """
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
+ )
139
+ return _response.data
140
+
141
+ def get(
142
+ self, id: str, *, verbose: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None
143
+ ) -> WorkflowsGetResponse:
144
+ """
145
+ Retrieves a workflow definition by its ID
146
+
147
+ Parameters
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
+
155
+ request_options : typing.Optional[RequestOptions]
156
+ Request-specific configuration.
157
+
158
+ Returns
159
+ -------
160
+ WorkflowsGetResponse
161
+ Successfully retrieved workflow
162
+
163
+ Examples
164
+ --------
165
+ from phenoml import phenoml
166
+
167
+ client = phenoml(
168
+ token="YOUR_TOKEN",
169
+ )
170
+ client.workflows.workflows.get(
171
+ id="id",
172
+ verbose=True,
173
+ )
174
+ """
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.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.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.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)
331
+ return _response.data
332
+
333
+
334
+ class AsyncWorkflowsClient:
335
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
336
+ self._raw_client = AsyncRawWorkflowsClient(client_wrapper=client_wrapper)
337
+
338
+ @property
339
+ def with_raw_response(self) -> AsyncRawWorkflowsClient:
340
+ """
341
+ Retrieves a raw implementation of this client that returns raw responses.
342
+
343
+ Returns
344
+ -------
345
+ AsyncRawWorkflowsClient
346
+ """
347
+ return self._raw_client
348
+
349
+ async def list(
350
+ self, *, verbose: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None
351
+ ) -> ListWorkflowsResponse:
352
+ """
353
+ Retrieves all workflow definitions for the authenticated user
354
+
355
+ Parameters
356
+ ----------
357
+ verbose : typing.Optional[bool]
358
+ If true, includes full workflow implementation details in workflow_details field
359
+
360
+ request_options : typing.Optional[RequestOptions]
361
+ Request-specific configuration.
362
+
363
+ Returns
364
+ -------
365
+ ListWorkflowsResponse
366
+ Successfully retrieved workflows
367
+
368
+ Examples
369
+ --------
370
+ import asyncio
371
+
372
+ from phenoml import Asyncphenoml
373
+
374
+ client = Asyncphenoml(
375
+ token="YOUR_TOKEN",
376
+ )
377
+
378
+
379
+ async def main() -> None:
380
+ await client.workflows.workflows.list(
381
+ verbose=True,
382
+ )
383
+
384
+
385
+ asyncio.run(main())
386
+ """
387
+ _response = await self._raw_client.list(verbose=verbose, request_options=request_options)
388
+ return _response.data
389
+
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:
401
+ """
402
+ Creates a new workflow definition with graph generation from workflow instructions
403
+
404
+ Parameters
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.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.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.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
+
612
+ request_options : typing.Optional[RequestOptions]
613
+ Request-specific configuration.
614
+
615
+ Returns
616
+ -------
617
+ WorkflowsDeleteResponse
618
+ Successfully deleted workflow
619
+
620
+ Examples
621
+ --------
622
+ import asyncio
623
+
624
+ from phenoml import Asyncphenoml
625
+
626
+ client = Asyncphenoml(
627
+ token="YOUR_TOKEN",
628
+ )
629
+
630
+
631
+ async def main() -> None:
632
+ await client.workflows.workflows.delete(
633
+ id="id",
634
+ )
635
+
636
+
637
+ asyncio.run(main())
638
+ """
639
+ _response = await self._raw_client.delete(id, request_options=request_options)
640
+ return _response.data
641
+
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:
649
+ """
650
+ Executes a workflow with provided input data and returns results
651
+
652
+ Parameters
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
+
660
+ request_options : typing.Optional[RequestOptions]
661
+ Request-specific configuration.
662
+
663
+ Returns
664
+ -------
665
+ ExecuteWorkflowResponse
666
+ Successfully executed workflow
667
+
668
+ Examples
669
+ --------
670
+ import asyncio
671
+
672
+ from phenoml import Asyncphenoml
673
+
674
+ client = Asyncphenoml(
675
+ token="YOUR_TOKEN",
676
+ )
677
+
678
+
679
+ async def main() -> None:
680
+ await client.workflows.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
+ )
689
+
690
+
691
+ asyncio.run(main())
692
+ """
693
+ _response = await self._raw_client.execute(id, input_data=input_data, request_options=request_options)
694
+ return _response.data