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,19 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+
5
+ from .create_request_resource import CreateRequestResource
6
+ from .document_request_file_type import DocumentRequestFileType
7
+ from .document_request_resource import DocumentRequestResource
8
+ from .fhir_resource import FhirResource
9
+ from .lang2fhir_upload_profile_response import Lang2FhirUploadProfileResponse
10
+ from .search_response import SearchResponse
11
+
12
+ __all__ = [
13
+ "CreateRequestResource",
14
+ "DocumentRequestFileType",
15
+ "DocumentRequestResource",
16
+ "FhirResource",
17
+ "Lang2FhirUploadProfileResponse",
18
+ "SearchResponse",
19
+ ]
@@ -0,0 +1,25 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ CreateRequestResource = typing.Union[
6
+ typing.Literal[
7
+ "auto",
8
+ "appointment",
9
+ "condition-encounter-diagnosis",
10
+ "medicationrequest",
11
+ "careplan",
12
+ "condition-problems-health-concerns",
13
+ "coverage",
14
+ "encounter",
15
+ "observation-clinical-result",
16
+ "observation-lab",
17
+ "patient",
18
+ "procedure",
19
+ "questionnaire",
20
+ "questionnaireresponse",
21
+ "simple-observation",
22
+ "vital-signs",
23
+ ],
24
+ typing.Any,
25
+ ]
@@ -0,0 +1,7 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ DocumentRequestFileType = typing.Union[
6
+ typing.Literal["application/pdf", "image/png", "image/jpeg", "image/jpg"], typing.Any
7
+ ]
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ DocumentRequestResource = typing.Union[typing.Literal["questionnaire", "questionnaireresponse"], typing.Any]
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ FhirResource = typing.Dict[str, typing.Optional[typing.Any]]
@@ -0,0 +1,23 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ import pydantic
6
+ from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
7
+
8
+
9
+ class Lang2FhirUploadProfileResponse(UniversalBaseModel):
10
+ message: typing.Optional[str] = None
11
+ id: typing.Optional[str] = None
12
+ resource: typing.Optional[str] = None
13
+ version: typing.Optional[str] = None
14
+ url: typing.Optional[str] = None
15
+
16
+ if IS_PYDANTIC_V2:
17
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
18
+ else:
19
+
20
+ class Config:
21
+ frozen = True
22
+ smart_union = True
23
+ extra = pydantic.Extra.allow
@@ -0,0 +1,33 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ import pydantic
6
+ import typing_extensions
7
+ from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
8
+ from ...core.serialization import FieldMetadata
9
+
10
+
11
+ class SearchResponse(UniversalBaseModel):
12
+ resource_type: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="resourceType")] = (
13
+ pydantic.Field(default=None)
14
+ )
15
+ """
16
+ The FHIR resource type identified for the search
17
+ """
18
+
19
+ search_params: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="searchParams")] = (
20
+ pydantic.Field(default=None)
21
+ )
22
+ """
23
+ FHIR search parameters in standard format
24
+ """
25
+
26
+ if IS_PYDANTIC_V2:
27
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
28
+ else:
29
+
30
+ class Config:
31
+ frozen = True
32
+ smart_union = True
33
+ extra = pydantic.Extra.allow
phenoml/py.typed ADDED
File without changes
@@ -0,0 +1,37 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+
5
+ from .types import (
6
+ CohortResponse,
7
+ Lang2FhirAndCreateRequestResource,
8
+ Lang2FhirAndCreateResponse,
9
+ Lang2FhirAndSearchResponse,
10
+ McpServerResponse,
11
+ McpServerResponseData,
12
+ McpServerToolCallResponse,
13
+ McpServerToolResponse,
14
+ McpServerToolResponseData,
15
+ SearchConcept,
16
+ )
17
+ from .errors import BadRequestError, FailedDependencyError, ForbiddenError, InternalServerError, UnauthorizedError
18
+ from . import mcp_server
19
+
20
+ __all__ = [
21
+ "BadRequestError",
22
+ "CohortResponse",
23
+ "FailedDependencyError",
24
+ "ForbiddenError",
25
+ "InternalServerError",
26
+ "Lang2FhirAndCreateRequestResource",
27
+ "Lang2FhirAndCreateResponse",
28
+ "Lang2FhirAndSearchResponse",
29
+ "McpServerResponse",
30
+ "McpServerResponseData",
31
+ "McpServerToolCallResponse",
32
+ "McpServerToolResponse",
33
+ "McpServerToolResponseData",
34
+ "SearchConcept",
35
+ "UnauthorizedError",
36
+ "mcp_server",
37
+ ]
@@ -0,0 +1,359 @@
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 .mcp_server.client import AsyncMcpServerClient, McpServerClient
8
+ from .raw_client import AsyncRawToolsClient, RawToolsClient
9
+ from .types.cohort_response import CohortResponse
10
+ from .types.lang2fhir_and_create_request_resource import Lang2FhirAndCreateRequestResource
11
+ from .types.lang2fhir_and_create_response import Lang2FhirAndCreateResponse
12
+ from .types.lang2fhir_and_search_response import Lang2FhirAndSearchResponse
13
+
14
+ # this is used as the default value for optional parameters
15
+ OMIT = typing.cast(typing.Any, ...)
16
+
17
+
18
+ class ToolsClient:
19
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
20
+ self._raw_client = RawToolsClient(client_wrapper=client_wrapper)
21
+ self.mcp_server = McpServerClient(client_wrapper=client_wrapper)
22
+
23
+ @property
24
+ def with_raw_response(self) -> RawToolsClient:
25
+ """
26
+ Retrieves a raw implementation of this client that returns raw responses.
27
+
28
+ Returns
29
+ -------
30
+ RawToolsClient
31
+ """
32
+ return self._raw_client
33
+
34
+ def create_fhir_resource(
35
+ self,
36
+ *,
37
+ resource: Lang2FhirAndCreateRequestResource,
38
+ text: str,
39
+ provider: typing.Optional[str] = OMIT,
40
+ request_options: typing.Optional[RequestOptions] = None,
41
+ ) -> Lang2FhirAndCreateResponse:
42
+ """
43
+ Converts natural language to FHIR resource and optionally stores it in a FHIR server
44
+
45
+ Parameters
46
+ ----------
47
+ resource : Lang2FhirAndCreateRequestResource
48
+ Type of FHIR resource to create. Use 'auto' for automatic resource type detection, or specify a supported US Core profile.
49
+
50
+ text : str
51
+ Natural language text to convert to FHIR resource
52
+
53
+ provider : typing.Optional[str]
54
+ FHIR provider ID - must be a valid UUID from existing FHIR providers. also supports provider by name (e.g. medplum)
55
+
56
+ request_options : typing.Optional[RequestOptions]
57
+ Request-specific configuration.
58
+
59
+ Returns
60
+ -------
61
+ Lang2FhirAndCreateResponse
62
+ Successfully created FHIR resource
63
+
64
+ Examples
65
+ --------
66
+ from phenoml import phenoml
67
+
68
+ client = phenoml(
69
+ token="YOUR_TOKEN",
70
+ )
71
+ client.tools.create_fhir_resource(
72
+ resource="auto",
73
+ text="Patient John Doe has severe asthma with acute exacerbation",
74
+ )
75
+ """
76
+ _response = self._raw_client.create_fhir_resource(
77
+ resource=resource, text=text, provider=provider, request_options=request_options
78
+ )
79
+ return _response.data
80
+
81
+ def search_fhir_resources(
82
+ self,
83
+ *,
84
+ text: str,
85
+ patient_id: typing.Optional[str] = OMIT,
86
+ practitioner_id: typing.Optional[str] = OMIT,
87
+ count: typing.Optional[int] = OMIT,
88
+ provider: typing.Optional[str] = OMIT,
89
+ request_options: typing.Optional[RequestOptions] = None,
90
+ ) -> Lang2FhirAndSearchResponse:
91
+ """
92
+ Converts natural language to FHIR search parameters and executes search in FHIR server
93
+
94
+ Parameters
95
+ ----------
96
+ text : str
97
+ Natural language text to convert to FHIR search parameters
98
+
99
+ patient_id : typing.Optional[str]
100
+ Patient ID to filter results
101
+
102
+ practitioner_id : typing.Optional[str]
103
+ Practitioner ID to filter results
104
+
105
+ count : typing.Optional[int]
106
+ Maximum number of results to return
107
+
108
+ provider : typing.Optional[str]
109
+ FHIR provider ID - must be a valid UUID from existing FHIR providers. also supports provider by name (e.g. medplum)
110
+
111
+ request_options : typing.Optional[RequestOptions]
112
+ Request-specific configuration.
113
+
114
+ Returns
115
+ -------
116
+ Lang2FhirAndSearchResponse
117
+ Successfully generated search and retrieved results
118
+
119
+ Examples
120
+ --------
121
+ from phenoml import phenoml
122
+
123
+ client = phenoml(
124
+ token="YOUR_TOKEN",
125
+ )
126
+ client.tools.search_fhir_resources(
127
+ text="Find all appointments for patient John Doe next week",
128
+ )
129
+ """
130
+ _response = self._raw_client.search_fhir_resources(
131
+ text=text,
132
+ patient_id=patient_id,
133
+ practitioner_id=practitioner_id,
134
+ count=count,
135
+ provider=provider,
136
+ request_options=request_options,
137
+ )
138
+ return _response.data
139
+
140
+ def analyze_cohort(
141
+ self, *, text: str, provider: str, request_options: typing.Optional[RequestOptions] = None
142
+ ) -> CohortResponse:
143
+ """
144
+ Uses LLM to extract search concepts from natural language and builds patient cohorts with inclusion/exclusion criteria
145
+
146
+ Parameters
147
+ ----------
148
+ text : str
149
+ Natural language text describing the patient cohort criteria
150
+
151
+ provider : str
152
+ FHIR provider ID - must be a valid UUID from existing FHIR providers. also supports provider by name (e.g. medplum)
153
+
154
+ request_options : typing.Optional[RequestOptions]
155
+ Request-specific configuration.
156
+
157
+ Returns
158
+ -------
159
+ CohortResponse
160
+ Successfully analyzed cohort and retrieved patient list
161
+
162
+ Examples
163
+ --------
164
+ from phenoml import phenoml
165
+
166
+ client = phenoml(
167
+ token="YOUR_TOKEN",
168
+ )
169
+ client.tools.analyze_cohort(
170
+ text="female patients over 20 with diabetes but not hypertension",
171
+ provider="550e8400-e29b-41d4-a716-446655440000",
172
+ )
173
+ """
174
+ _response = self._raw_client.analyze_cohort(text=text, provider=provider, request_options=request_options)
175
+ return _response.data
176
+
177
+
178
+ class AsyncToolsClient:
179
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
180
+ self._raw_client = AsyncRawToolsClient(client_wrapper=client_wrapper)
181
+ self.mcp_server = AsyncMcpServerClient(client_wrapper=client_wrapper)
182
+
183
+ @property
184
+ def with_raw_response(self) -> AsyncRawToolsClient:
185
+ """
186
+ Retrieves a raw implementation of this client that returns raw responses.
187
+
188
+ Returns
189
+ -------
190
+ AsyncRawToolsClient
191
+ """
192
+ return self._raw_client
193
+
194
+ async def create_fhir_resource(
195
+ self,
196
+ *,
197
+ resource: Lang2FhirAndCreateRequestResource,
198
+ text: str,
199
+ provider: typing.Optional[str] = OMIT,
200
+ request_options: typing.Optional[RequestOptions] = None,
201
+ ) -> Lang2FhirAndCreateResponse:
202
+ """
203
+ Converts natural language to FHIR resource and optionally stores it in a FHIR server
204
+
205
+ Parameters
206
+ ----------
207
+ resource : Lang2FhirAndCreateRequestResource
208
+ Type of FHIR resource to create. Use 'auto' for automatic resource type detection, or specify a supported US Core profile.
209
+
210
+ text : str
211
+ Natural language text to convert to FHIR resource
212
+
213
+ provider : typing.Optional[str]
214
+ FHIR provider ID - must be a valid UUID from existing FHIR providers. also supports provider by name (e.g. medplum)
215
+
216
+ request_options : typing.Optional[RequestOptions]
217
+ Request-specific configuration.
218
+
219
+ Returns
220
+ -------
221
+ Lang2FhirAndCreateResponse
222
+ Successfully created FHIR resource
223
+
224
+ Examples
225
+ --------
226
+ import asyncio
227
+
228
+ from phenoml import Asyncphenoml
229
+
230
+ client = Asyncphenoml(
231
+ token="YOUR_TOKEN",
232
+ )
233
+
234
+
235
+ async def main() -> None:
236
+ await client.tools.create_fhir_resource(
237
+ resource="auto",
238
+ text="Patient John Doe has severe asthma with acute exacerbation",
239
+ )
240
+
241
+
242
+ asyncio.run(main())
243
+ """
244
+ _response = await self._raw_client.create_fhir_resource(
245
+ resource=resource, text=text, provider=provider, request_options=request_options
246
+ )
247
+ return _response.data
248
+
249
+ async def search_fhir_resources(
250
+ self,
251
+ *,
252
+ text: str,
253
+ patient_id: typing.Optional[str] = OMIT,
254
+ practitioner_id: typing.Optional[str] = OMIT,
255
+ count: typing.Optional[int] = OMIT,
256
+ provider: typing.Optional[str] = OMIT,
257
+ request_options: typing.Optional[RequestOptions] = None,
258
+ ) -> Lang2FhirAndSearchResponse:
259
+ """
260
+ Converts natural language to FHIR search parameters and executes search in FHIR server
261
+
262
+ Parameters
263
+ ----------
264
+ text : str
265
+ Natural language text to convert to FHIR search parameters
266
+
267
+ patient_id : typing.Optional[str]
268
+ Patient ID to filter results
269
+
270
+ practitioner_id : typing.Optional[str]
271
+ Practitioner ID to filter results
272
+
273
+ count : typing.Optional[int]
274
+ Maximum number of results to return
275
+
276
+ provider : typing.Optional[str]
277
+ FHIR provider ID - must be a valid UUID from existing FHIR providers. also supports provider by name (e.g. medplum)
278
+
279
+ request_options : typing.Optional[RequestOptions]
280
+ Request-specific configuration.
281
+
282
+ Returns
283
+ -------
284
+ Lang2FhirAndSearchResponse
285
+ Successfully generated search and retrieved results
286
+
287
+ Examples
288
+ --------
289
+ import asyncio
290
+
291
+ from phenoml import Asyncphenoml
292
+
293
+ client = Asyncphenoml(
294
+ token="YOUR_TOKEN",
295
+ )
296
+
297
+
298
+ async def main() -> None:
299
+ await client.tools.search_fhir_resources(
300
+ text="Find all appointments for patient John Doe next week",
301
+ )
302
+
303
+
304
+ asyncio.run(main())
305
+ """
306
+ _response = await self._raw_client.search_fhir_resources(
307
+ text=text,
308
+ patient_id=patient_id,
309
+ practitioner_id=practitioner_id,
310
+ count=count,
311
+ provider=provider,
312
+ request_options=request_options,
313
+ )
314
+ return _response.data
315
+
316
+ async def analyze_cohort(
317
+ self, *, text: str, provider: str, request_options: typing.Optional[RequestOptions] = None
318
+ ) -> CohortResponse:
319
+ """
320
+ Uses LLM to extract search concepts from natural language and builds patient cohorts with inclusion/exclusion criteria
321
+
322
+ Parameters
323
+ ----------
324
+ text : str
325
+ Natural language text describing the patient cohort criteria
326
+
327
+ provider : str
328
+ FHIR provider ID - must be a valid UUID from existing FHIR providers. also supports provider by name (e.g. medplum)
329
+
330
+ request_options : typing.Optional[RequestOptions]
331
+ Request-specific configuration.
332
+
333
+ Returns
334
+ -------
335
+ CohortResponse
336
+ Successfully analyzed cohort and retrieved patient list
337
+
338
+ Examples
339
+ --------
340
+ import asyncio
341
+
342
+ from phenoml import Asyncphenoml
343
+
344
+ client = Asyncphenoml(
345
+ token="YOUR_TOKEN",
346
+ )
347
+
348
+
349
+ async def main() -> None:
350
+ await client.tools.analyze_cohort(
351
+ text="female patients over 20 with diabetes but not hypertension",
352
+ provider="550e8400-e29b-41d4-a716-446655440000",
353
+ )
354
+
355
+
356
+ asyncio.run(main())
357
+ """
358
+ _response = await self._raw_client.analyze_cohort(text=text, provider=provider, request_options=request_options)
359
+ return _response.data
@@ -0,0 +1,11 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+
5
+ from .bad_request_error import BadRequestError
6
+ from .failed_dependency_error import FailedDependencyError
7
+ from .forbidden_error import ForbiddenError
8
+ from .internal_server_error import InternalServerError
9
+ from .unauthorized_error import UnauthorizedError
10
+
11
+ __all__ = ["BadRequestError", "FailedDependencyError", "ForbiddenError", "InternalServerError", "UnauthorizedError"]
@@ -0,0 +1,10 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ...core.api_error import ApiError
6
+
7
+
8
+ class BadRequestError(ApiError):
9
+ def __init__(self, body: typing.Optional[typing.Any], headers: typing.Optional[typing.Dict[str, str]] = None):
10
+ super().__init__(status_code=400, headers=headers, body=body)
@@ -0,0 +1,10 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ...core.api_error import ApiError
6
+
7
+
8
+ class FailedDependencyError(ApiError):
9
+ def __init__(self, body: typing.Optional[typing.Any], headers: typing.Optional[typing.Dict[str, str]] = None):
10
+ super().__init__(status_code=424, headers=headers, body=body)
@@ -0,0 +1,10 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ...core.api_error import ApiError
6
+
7
+
8
+ class ForbiddenError(ApiError):
9
+ def __init__(self, body: typing.Optional[typing.Any], headers: typing.Optional[typing.Dict[str, str]] = None):
10
+ super().__init__(status_code=403, headers=headers, body=body)
@@ -0,0 +1,10 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ...core.api_error import ApiError
6
+
7
+
8
+ class InternalServerError(ApiError):
9
+ def __init__(self, body: typing.Optional[typing.Any], headers: typing.Optional[typing.Dict[str, str]] = None):
10
+ super().__init__(status_code=500, headers=headers, body=body)
@@ -0,0 +1,10 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ...core.api_error import ApiError
6
+
7
+
8
+ class UnauthorizedError(ApiError):
9
+ def __init__(self, body: typing.Optional[typing.Any], headers: typing.Optional[typing.Dict[str, str]] = None):
10
+ super().__init__(status_code=401, headers=headers, body=body)
@@ -0,0 +1,7 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+
5
+ from . import tools
6
+
7
+ __all__ = ["tools"]