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.
- phenoml/__init__.py +30 -0
- phenoml/agent/__init__.py +56 -0
- phenoml/agent/client.py +939 -0
- phenoml/agent/errors/__init__.py +11 -0
- phenoml/agent/errors/bad_request_error.py +10 -0
- phenoml/agent/errors/forbidden_error.py +10 -0
- phenoml/agent/errors/internal_server_error.py +10 -0
- phenoml/agent/errors/not_found_error.py +10 -0
- phenoml/agent/errors/unauthorized_error.py +10 -0
- phenoml/agent/prompts/__init__.py +7 -0
- phenoml/agent/prompts/client.py +707 -0
- phenoml/agent/prompts/raw_client.py +1345 -0
- phenoml/agent/prompts/types/__init__.py +8 -0
- phenoml/agent/prompts/types/prompts_delete_response.py +20 -0
- phenoml/agent/prompts/types/prompts_list_response.py +22 -0
- phenoml/agent/raw_client.py +1668 -0
- phenoml/agent/types/__init__.py +43 -0
- phenoml/agent/types/agent_chat_response.py +33 -0
- phenoml/agent/types/agent_create_request.py +53 -0
- phenoml/agent/types/agent_create_request_provider.py +5 -0
- phenoml/agent/types/agent_delete_response.py +20 -0
- phenoml/agent/types/agent_get_chat_messages_request_order.py +5 -0
- phenoml/agent/types/agent_get_chat_messages_response.py +22 -0
- phenoml/agent/types/agent_list_response.py +22 -0
- phenoml/agent/types/agent_prompts_response.py +22 -0
- phenoml/agent/types/agent_response.py +22 -0
- phenoml/agent/types/agent_template.py +58 -0
- phenoml/agent/types/agent_template_provider.py +5 -0
- phenoml/agent/types/chat_message_template.py +72 -0
- phenoml/agent/types/chat_session_template.py +67 -0
- phenoml/agent/types/json_patch.py +7 -0
- phenoml/agent/types/json_patch_operation.py +40 -0
- phenoml/agent/types/json_patch_operation_op.py +5 -0
- phenoml/agent/types/prompt_template.py +52 -0
- phenoml/agent/types/success_response.py +20 -0
- phenoml/authtoken/__init__.py +17 -0
- phenoml/authtoken/auth/__init__.py +7 -0
- phenoml/authtoken/auth/client.py +129 -0
- phenoml/authtoken/auth/raw_client.py +173 -0
- phenoml/authtoken/auth/types/__init__.py +7 -0
- phenoml/authtoken/auth/types/auth_generate_token_response.py +22 -0
- phenoml/authtoken/client.py +39 -0
- phenoml/authtoken/errors/__init__.py +8 -0
- phenoml/authtoken/errors/bad_request_error.py +10 -0
- phenoml/authtoken/errors/unauthorized_error.py +10 -0
- phenoml/authtoken/raw_client.py +13 -0
- phenoml/authtoken/types/__init__.py +8 -0
- phenoml/authtoken/types/bad_request_error_body.py +21 -0
- phenoml/authtoken/types/unauthorized_error_body.py +21 -0
- phenoml/client.py +177 -0
- phenoml/cohort/__init__.py +8 -0
- phenoml/cohort/client.py +113 -0
- phenoml/cohort/errors/__init__.py +9 -0
- phenoml/cohort/errors/bad_request_error.py +10 -0
- phenoml/cohort/errors/internal_server_error.py +10 -0
- phenoml/cohort/errors/unauthorized_error.py +10 -0
- phenoml/cohort/raw_client.py +185 -0
- phenoml/cohort/types/__init__.py +8 -0
- phenoml/cohort/types/cohort_response.py +33 -0
- phenoml/cohort/types/search_concept.py +37 -0
- phenoml/construe/__init__.py +45 -0
- phenoml/construe/client.py +399 -0
- phenoml/construe/errors/__init__.py +11 -0
- phenoml/construe/errors/bad_request_error.py +10 -0
- phenoml/construe/errors/conflict_error.py +10 -0
- phenoml/construe/errors/failed_dependency_error.py +10 -0
- phenoml/construe/errors/internal_server_error.py +10 -0
- phenoml/construe/errors/unauthorized_error.py +10 -0
- phenoml/construe/raw_client.py +706 -0
- phenoml/construe/types/__init__.py +41 -0
- phenoml/construe/types/bad_request_error_body.py +27 -0
- phenoml/construe/types/construe_cohort_request_config.py +37 -0
- phenoml/construe/types/construe_cohort_response.py +33 -0
- phenoml/construe/types/construe_cohort_response_queries_item.py +49 -0
- phenoml/construe/types/construe_cohort_response_queries_item_code_extract_results_item.py +31 -0
- phenoml/construe/types/construe_cohort_response_queries_item_code_extract_results_item_codes_item.py +32 -0
- phenoml/construe/types/construe_upload_code_system_response.py +19 -0
- phenoml/construe/types/extract_codes_result.py +22 -0
- phenoml/construe/types/extract_request_config.py +23 -0
- phenoml/construe/types/extract_request_config_chunking_method.py +5 -0
- phenoml/construe/types/extract_request_system.py +37 -0
- phenoml/construe/types/extracted_code_result.py +41 -0
- phenoml/construe/types/internal_server_error_body.py +27 -0
- phenoml/construe/types/unauthorized_error_body.py +27 -0
- phenoml/construe/types/upload_request_format.py +5 -0
- phenoml/core/__init__.py +52 -0
- phenoml/core/api_error.py +23 -0
- phenoml/core/client_wrapper.py +87 -0
- phenoml/core/datetime_utils.py +28 -0
- phenoml/core/file.py +67 -0
- phenoml/core/force_multipart.py +16 -0
- phenoml/core/http_client.py +543 -0
- phenoml/core/http_response.py +55 -0
- phenoml/core/jsonable_encoder.py +100 -0
- phenoml/core/pydantic_utilities.py +255 -0
- phenoml/core/query_encoder.py +58 -0
- phenoml/core/remove_none_from_dict.py +11 -0
- phenoml/core/request_options.py +35 -0
- phenoml/core/serialization.py +276 -0
- phenoml/environment.py +7 -0
- phenoml/fhir/__init__.py +36 -0
- phenoml/fhir/client.py +970 -0
- phenoml/fhir/errors/__init__.py +10 -0
- phenoml/fhir/errors/bad_request_error.py +10 -0
- phenoml/fhir/errors/internal_server_error.py +10 -0
- phenoml/fhir/errors/not_found_error.py +10 -0
- phenoml/fhir/errors/unauthorized_error.py +10 -0
- phenoml/fhir/raw_client.py +1385 -0
- phenoml/fhir/types/__init__.py +29 -0
- phenoml/fhir/types/error_response.py +36 -0
- phenoml/fhir/types/fhir_bundle.py +43 -0
- phenoml/fhir/types/fhir_bundle_entry_item.py +34 -0
- phenoml/fhir/types/fhir_bundle_entry_item_request.py +25 -0
- phenoml/fhir/types/fhir_bundle_entry_item_request_method.py +5 -0
- phenoml/fhir/types/fhir_bundle_entry_item_response.py +24 -0
- phenoml/fhir/types/fhir_patch_request_body_item.py +40 -0
- phenoml/fhir/types/fhir_patch_request_body_item_op.py +7 -0
- phenoml/fhir/types/fhir_resource.py +40 -0
- phenoml/fhir/types/fhir_resource_meta.py +28 -0
- phenoml/fhir/types/fhir_search_response.py +8 -0
- phenoml/fhir_provider/__init__.py +43 -0
- phenoml/fhir_provider/client.py +731 -0
- phenoml/fhir_provider/errors/__init__.py +11 -0
- phenoml/fhir_provider/errors/bad_request_error.py +10 -0
- phenoml/fhir_provider/errors/forbidden_error.py +10 -0
- phenoml/fhir_provider/errors/internal_server_error.py +10 -0
- phenoml/fhir_provider/errors/not_found_error.py +10 -0
- phenoml/fhir_provider/errors/unauthorized_error.py +10 -0
- phenoml/fhir_provider/raw_client.py +1445 -0
- phenoml/fhir_provider/types/__init__.py +35 -0
- phenoml/fhir_provider/types/auth_method.py +7 -0
- phenoml/fhir_provider/types/fhir_provider_auth_config.py +53 -0
- phenoml/fhir_provider/types/fhir_provider_delete_response.py +20 -0
- phenoml/fhir_provider/types/fhir_provider_list_response.py +22 -0
- phenoml/fhir_provider/types/fhir_provider_remove_auth_config_response.py +22 -0
- phenoml/fhir_provider/types/fhir_provider_response.py +22 -0
- phenoml/fhir_provider/types/fhir_provider_set_active_auth_config_response.py +22 -0
- phenoml/fhir_provider/types/fhir_provider_template.py +66 -0
- phenoml/fhir_provider/types/fhir_query_response.py +27 -0
- phenoml/fhir_provider/types/fhir_query_response_data.py +5 -0
- phenoml/fhir_provider/types/json_web_key.py +51 -0
- phenoml/fhir_provider/types/provider.py +8 -0
- phenoml/fhir_provider/types/service_account_key.py +35 -0
- phenoml/fhir_provider/types/smart_configuration.py +46 -0
- phenoml/lang2fhir/__init__.py +27 -0
- phenoml/lang2fhir/client.py +430 -0
- phenoml/lang2fhir/errors/__init__.py +11 -0
- phenoml/lang2fhir/errors/bad_request_error.py +10 -0
- phenoml/lang2fhir/errors/failed_dependency_error.py +10 -0
- phenoml/lang2fhir/errors/forbidden_error.py +10 -0
- phenoml/lang2fhir/errors/internal_server_error.py +10 -0
- phenoml/lang2fhir/errors/unauthorized_error.py +10 -0
- phenoml/lang2fhir/raw_client.py +788 -0
- phenoml/lang2fhir/types/__init__.py +19 -0
- phenoml/lang2fhir/types/create_request_resource.py +25 -0
- phenoml/lang2fhir/types/document_request_file_type.py +7 -0
- phenoml/lang2fhir/types/document_request_resource.py +5 -0
- phenoml/lang2fhir/types/fhir_resource.py +5 -0
- phenoml/lang2fhir/types/lang2fhir_upload_profile_response.py +23 -0
- phenoml/lang2fhir/types/search_response.py +33 -0
- phenoml/py.typed +0 -0
- phenoml/tools/__init__.py +37 -0
- phenoml/tools/client.py +359 -0
- phenoml/tools/errors/__init__.py +11 -0
- phenoml/tools/errors/bad_request_error.py +10 -0
- phenoml/tools/errors/failed_dependency_error.py +10 -0
- phenoml/tools/errors/forbidden_error.py +10 -0
- phenoml/tools/errors/internal_server_error.py +10 -0
- phenoml/tools/errors/unauthorized_error.py +10 -0
- phenoml/tools/mcp_server/__init__.py +7 -0
- phenoml/tools/mcp_server/client.py +336 -0
- phenoml/tools/mcp_server/raw_client.py +641 -0
- phenoml/tools/mcp_server/tools/__init__.py +4 -0
- phenoml/tools/mcp_server/tools/client.py +358 -0
- phenoml/tools/mcp_server/tools/raw_client.py +656 -0
- phenoml/tools/raw_client.py +696 -0
- phenoml/tools/types/__init__.py +27 -0
- phenoml/tools/types/cohort_response.py +49 -0
- phenoml/tools/types/lang2fhir_and_create_request_resource.py +25 -0
- phenoml/tools/types/lang2fhir_and_create_response.py +33 -0
- phenoml/tools/types/lang2fhir_and_search_response.py +40 -0
- phenoml/tools/types/mcp_server_response.py +33 -0
- phenoml/tools/types/mcp_server_response_data.py +51 -0
- phenoml/tools/types/mcp_server_tool_call_response.py +37 -0
- phenoml/tools/types/mcp_server_tool_response.py +33 -0
- phenoml/tools/types/mcp_server_tool_response_data.py +61 -0
- phenoml/tools/types/search_concept.py +41 -0
- phenoml/types/__init__.py +21 -0
- phenoml/types/cohort_response.py +5 -0
- phenoml/types/lang2fhir_and_create_response.py +5 -0
- phenoml/types/lang2fhir_and_search_response.py +5 -0
- phenoml/types/mcp_server_response.py +5 -0
- phenoml/types/mcp_server_tool_call_response.py +5 -0
- phenoml/types/mcp_server_tool_response.py +5 -0
- phenoml/types/search_concept.py +5 -0
- phenoml/version.py +3 -0
- phenoml/workflows/__init__.py +66 -0
- phenoml/workflows/client.py +210 -0
- phenoml/workflows/errors/__init__.py +11 -0
- phenoml/workflows/errors/bad_request_error.py +10 -0
- phenoml/workflows/errors/forbidden_error.py +10 -0
- phenoml/workflows/errors/internal_server_error.py +10 -0
- phenoml/workflows/errors/not_found_error.py +10 -0
- phenoml/workflows/errors/unauthorized_error.py +10 -0
- phenoml/workflows/mcp_server/__init__.py +7 -0
- phenoml/workflows/mcp_server/client.py +274 -0
- phenoml/workflows/mcp_server/raw_client.py +226 -0
- phenoml/workflows/mcp_server/tools/__init__.py +4 -0
- phenoml/workflows/mcp_server/tools/client.py +287 -0
- phenoml/workflows/mcp_server/tools/raw_client.py +244 -0
- phenoml/workflows/raw_client.py +169 -0
- phenoml/workflows/types/__init__.py +43 -0
- phenoml/workflows/types/create_workflow_response.py +44 -0
- phenoml/workflows/types/decision_node_definition.py +32 -0
- phenoml/workflows/types/execute_workflow_response.py +30 -0
- phenoml/workflows/types/execute_workflow_response_results.py +22 -0
- phenoml/workflows/types/lang2fhir_create_definition.py +37 -0
- phenoml/workflows/types/lang2fhir_search_definition.py +42 -0
- phenoml/workflows/types/list_workflows_response.py +39 -0
- phenoml/workflows/types/step_operation.py +26 -0
- phenoml/workflows/types/sub_workflow_definition.py +32 -0
- phenoml/workflows/types/workflow_config.py +27 -0
- phenoml/workflows/types/workflow_definition.py +57 -0
- phenoml/workflows/types/workflow_graph.py +23 -0
- phenoml/workflows/types/workflow_response.py +61 -0
- phenoml/workflows/types/workflow_response_graph.py +23 -0
- phenoml/workflows/types/workflow_step.py +55 -0
- phenoml/workflows/types/workflow_step_summary.py +47 -0
- phenoml/workflows/types/workflow_step_summary_type.py +5 -0
- phenoml/workflows/types/workflow_step_type.py +5 -0
- phenoml/workflows/workflows/__init__.py +19 -0
- phenoml/workflows/workflows/client.py +694 -0
- phenoml/workflows/workflows/raw_client.py +1266 -0
- phenoml/workflows/workflows/types/__init__.py +17 -0
- phenoml/workflows/workflows/types/create_workflow_request_fhir_provider_id.py +5 -0
- phenoml/workflows/workflows/types/update_workflow_request_fhir_provider_id.py +5 -0
- phenoml/workflows/workflows/types/workflows_delete_response.py +20 -0
- phenoml/workflows/workflows/types/workflows_get_response.py +26 -0
- phenoml/workflows/workflows/types/workflows_update_response.py +31 -0
- phenoml/wrapper_client.py +123 -0
- phenoml-0.0.6.dist-info/LICENSE +21 -0
- phenoml-0.0.6.dist-info/METADATA +192 -0
- phenoml-0.0.6.dist-info/RECORD +244 -0
- phenoml-0.0.6.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
# isort: skip_file
|
|
4
|
+
|
|
5
|
+
from .bad_request_error_body import BadRequestErrorBody
|
|
6
|
+
from .construe_cohort_request_config import ConstrueCohortRequestConfig
|
|
7
|
+
from .construe_cohort_response import ConstrueCohortResponse
|
|
8
|
+
from .construe_cohort_response_queries_item import ConstrueCohortResponseQueriesItem
|
|
9
|
+
from .construe_cohort_response_queries_item_code_extract_results_item import (
|
|
10
|
+
ConstrueCohortResponseQueriesItemCodeExtractResultsItem,
|
|
11
|
+
)
|
|
12
|
+
from .construe_cohort_response_queries_item_code_extract_results_item_codes_item import (
|
|
13
|
+
ConstrueCohortResponseQueriesItemCodeExtractResultsItemCodesItem,
|
|
14
|
+
)
|
|
15
|
+
from .construe_upload_code_system_response import ConstrueUploadCodeSystemResponse
|
|
16
|
+
from .extract_codes_result import ExtractCodesResult
|
|
17
|
+
from .extract_request_config import ExtractRequestConfig
|
|
18
|
+
from .extract_request_config_chunking_method import ExtractRequestConfigChunkingMethod
|
|
19
|
+
from .extract_request_system import ExtractRequestSystem
|
|
20
|
+
from .extracted_code_result import ExtractedCodeResult
|
|
21
|
+
from .internal_server_error_body import InternalServerErrorBody
|
|
22
|
+
from .unauthorized_error_body import UnauthorizedErrorBody
|
|
23
|
+
from .upload_request_format import UploadRequestFormat
|
|
24
|
+
|
|
25
|
+
__all__ = [
|
|
26
|
+
"BadRequestErrorBody",
|
|
27
|
+
"ConstrueCohortRequestConfig",
|
|
28
|
+
"ConstrueCohortResponse",
|
|
29
|
+
"ConstrueCohortResponseQueriesItem",
|
|
30
|
+
"ConstrueCohortResponseQueriesItemCodeExtractResultsItem",
|
|
31
|
+
"ConstrueCohortResponseQueriesItemCodeExtractResultsItemCodesItem",
|
|
32
|
+
"ConstrueUploadCodeSystemResponse",
|
|
33
|
+
"ExtractCodesResult",
|
|
34
|
+
"ExtractRequestConfig",
|
|
35
|
+
"ExtractRequestConfigChunkingMethod",
|
|
36
|
+
"ExtractRequestSystem",
|
|
37
|
+
"ExtractedCodeResult",
|
|
38
|
+
"InternalServerErrorBody",
|
|
39
|
+
"UnauthorizedErrorBody",
|
|
40
|
+
"UploadRequestFormat",
|
|
41
|
+
]
|
|
@@ -0,0 +1,27 @@
|
|
|
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 BadRequestErrorBody(UniversalBaseModel):
|
|
10
|
+
status: typing.Optional[int] = pydantic.Field(default=None)
|
|
11
|
+
"""
|
|
12
|
+
HTTP status code.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
message: typing.Optional[str] = pydantic.Field(default=None)
|
|
16
|
+
"""
|
|
17
|
+
Error message.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
if IS_PYDANTIC_V2:
|
|
21
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
22
|
+
else:
|
|
23
|
+
|
|
24
|
+
class Config:
|
|
25
|
+
frozen = True
|
|
26
|
+
smart_union = True
|
|
27
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,37 @@
|
|
|
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 ConstrueCohortRequestConfig(UniversalBaseModel):
|
|
10
|
+
include_extract_results: typing.Optional[bool] = pydantic.Field(default=None)
|
|
11
|
+
"""
|
|
12
|
+
When enabled, includes detailed information about medical codes extracted from the text.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
include_rationale: typing.Optional[bool] = pydantic.Field(default=None)
|
|
16
|
+
"""
|
|
17
|
+
When enabled, includes AI-generated explanations for each query component and code extraction.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
exclude_deceased: typing.Optional[bool] = pydantic.Field(default=None)
|
|
21
|
+
"""
|
|
22
|
+
Controls whether deceased patients should be excluded from the cohort.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
sql_syntax: typing.Optional[typing.Literal["bigquery"]] = pydantic.Field(default=None)
|
|
26
|
+
"""
|
|
27
|
+
Specifies the SQL dialect for query generation. Currently, only "bigquery" is supported.
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
if IS_PYDANTIC_V2:
|
|
31
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
32
|
+
else:
|
|
33
|
+
|
|
34
|
+
class Config:
|
|
35
|
+
frozen = True
|
|
36
|
+
smart_union = True
|
|
37
|
+
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
|
+
from .construe_cohort_response_queries_item import ConstrueCohortResponseQueriesItem
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ConstrueCohortResponse(UniversalBaseModel):
|
|
13
|
+
queries: typing.Optional[typing.List[ConstrueCohortResponseQueriesItem]] = None
|
|
14
|
+
sql: typing.Optional[str] = pydantic.Field(default=None)
|
|
15
|
+
"""
|
|
16
|
+
Generated SQL query when `sql_syntax` is specified. Variables in curly braces need to be replaced with your actual table names.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
cohort_description: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="cohortDescription")] = (
|
|
20
|
+
pydantic.Field(default=None)
|
|
21
|
+
)
|
|
22
|
+
"""
|
|
23
|
+
Echo of the input text description for reference.
|
|
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
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
from .construe_cohort_response_queries_item_code_extract_results_item import (
|
|
10
|
+
ConstrueCohortResponseQueriesItemCodeExtractResultsItem,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class ConstrueCohortResponseQueriesItem(UniversalBaseModel):
|
|
15
|
+
resource: typing.Optional[str] = pydantic.Field(default=None)
|
|
16
|
+
"""
|
|
17
|
+
FHIR resource type (e.g., "Patient", "Condition").
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
search_params: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="searchParams")] = (
|
|
21
|
+
pydantic.Field(default=None)
|
|
22
|
+
)
|
|
23
|
+
"""
|
|
24
|
+
FHIR search parameters.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
exclude: typing.Optional[bool] = pydantic.Field(default=None)
|
|
28
|
+
"""
|
|
29
|
+
Indicates if this is an exclusion criteria.
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
rationale: typing.Optional[str] = pydantic.Field(default=None)
|
|
33
|
+
"""
|
|
34
|
+
AI-generated explanation for the query component.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
code_extract_results: typing_extensions.Annotated[
|
|
38
|
+
typing.Optional[typing.List[ConstrueCohortResponseQueriesItemCodeExtractResultsItem]],
|
|
39
|
+
FieldMetadata(alias="codeExtractResults"),
|
|
40
|
+
] = None
|
|
41
|
+
|
|
42
|
+
if IS_PYDANTIC_V2:
|
|
43
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
44
|
+
else:
|
|
45
|
+
|
|
46
|
+
class Config:
|
|
47
|
+
frozen = True
|
|
48
|
+
smart_union = True
|
|
49
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
from .construe_cohort_response_queries_item_code_extract_results_item_codes_item import (
|
|
10
|
+
ConstrueCohortResponseQueriesItemCodeExtractResultsItemCodesItem,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class ConstrueCohortResponseQueriesItemCodeExtractResultsItem(UniversalBaseModel):
|
|
15
|
+
system_name: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="systemName")] = pydantic.Field(
|
|
16
|
+
default=None
|
|
17
|
+
)
|
|
18
|
+
"""
|
|
19
|
+
Name of the coding system (e.g., "SNOMED_CT_US_LITE").
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
codes: typing.Optional[typing.List[ConstrueCohortResponseQueriesItemCodeExtractResultsItemCodesItem]] = None
|
|
23
|
+
|
|
24
|
+
if IS_PYDANTIC_V2:
|
|
25
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
26
|
+
else:
|
|
27
|
+
|
|
28
|
+
class Config:
|
|
29
|
+
frozen = True
|
|
30
|
+
smart_union = True
|
|
31
|
+
extra = pydantic.Extra.allow
|
phenoml/construe/types/construe_cohort_response_queries_item_code_extract_results_item_codes_item.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
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 ConstrueCohortResponseQueriesItemCodeExtractResultsItemCodesItem(UniversalBaseModel):
|
|
10
|
+
code: typing.Optional[str] = pydantic.Field(default=None)
|
|
11
|
+
"""
|
|
12
|
+
Medical code.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
description: typing.Optional[str] = pydantic.Field(default=None)
|
|
16
|
+
"""
|
|
17
|
+
Description of the medical code.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
reason: typing.Optional[str] = pydantic.Field(default=None)
|
|
21
|
+
"""
|
|
22
|
+
Reason for selecting the code.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
if IS_PYDANTIC_V2:
|
|
26
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
27
|
+
else:
|
|
28
|
+
|
|
29
|
+
class Config:
|
|
30
|
+
frozen = True
|
|
31
|
+
smart_union = True
|
|
32
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,19 @@
|
|
|
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 ConstrueUploadCodeSystemResponse(UniversalBaseModel):
|
|
10
|
+
status: typing.Optional[str] = None
|
|
11
|
+
|
|
12
|
+
if IS_PYDANTIC_V2:
|
|
13
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
14
|
+
else:
|
|
15
|
+
|
|
16
|
+
class Config:
|
|
17
|
+
frozen = True
|
|
18
|
+
smart_union = True
|
|
19
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
from .extract_request_system import ExtractRequestSystem
|
|
8
|
+
from .extracted_code_result import ExtractedCodeResult
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class ExtractCodesResult(UniversalBaseModel):
|
|
12
|
+
system: ExtractRequestSystem
|
|
13
|
+
codes: typing.List[ExtractedCodeResult]
|
|
14
|
+
|
|
15
|
+
if IS_PYDANTIC_V2:
|
|
16
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
17
|
+
else:
|
|
18
|
+
|
|
19
|
+
class Config:
|
|
20
|
+
frozen = True
|
|
21
|
+
smart_union = True
|
|
22
|
+
extra = pydantic.Extra.allow
|
|
@@ -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
|
+
from .extract_request_config_chunking_method import ExtractRequestConfigChunkingMethod
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ExtractRequestConfig(UniversalBaseModel):
|
|
11
|
+
chunking_method: typing.Optional[ExtractRequestConfigChunkingMethod] = None
|
|
12
|
+
max_codes_per_chunk: typing.Optional[int] = None
|
|
13
|
+
code_similarity_filter: typing.Optional[float] = None
|
|
14
|
+
include_rationale: typing.Optional[bool] = 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,37 @@
|
|
|
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 ExtractRequestSystem(UniversalBaseModel):
|
|
10
|
+
name: typing.Optional[str] = pydantic.Field(default=None)
|
|
11
|
+
"""
|
|
12
|
+
Code system name. Can be a built-in system or a custom system name.
|
|
13
|
+
|
|
14
|
+
Built-in systems:
|
|
15
|
+
* SNOMED_CT_US_LITE - version 20240901
|
|
16
|
+
* RXNORM - version 11042024
|
|
17
|
+
* ICD-10-CM - version 2025
|
|
18
|
+
* ICD-10-PCS - version 2025
|
|
19
|
+
* LOINC - version 2.78
|
|
20
|
+
|
|
21
|
+
Custom systems:
|
|
22
|
+
* Any valid system name configured in your environment. Must have self-hosted construe module.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
version: typing.Optional[str] = pydantic.Field(default=None)
|
|
26
|
+
"""
|
|
27
|
+
Code system version. Must match the version available in your environment.
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
if IS_PYDANTIC_V2:
|
|
31
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
32
|
+
else:
|
|
33
|
+
|
|
34
|
+
class Config:
|
|
35
|
+
frozen = True
|
|
36
|
+
smart_union = True
|
|
37
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,41 @@
|
|
|
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 ExtractedCodeResult(UniversalBaseModel):
|
|
12
|
+
code: str = pydantic.Field()
|
|
13
|
+
"""
|
|
14
|
+
The extracted code
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
description: str = pydantic.Field()
|
|
18
|
+
"""
|
|
19
|
+
Short description of the code
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
long_description: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="longDescription")] = (
|
|
23
|
+
pydantic.Field(default=None)
|
|
24
|
+
)
|
|
25
|
+
"""
|
|
26
|
+
Long description of the code
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
rationale: typing.Optional[str] = pydantic.Field(default=None)
|
|
30
|
+
"""
|
|
31
|
+
Explanation for why this code was extracted (if include_rationale is true)
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
if IS_PYDANTIC_V2:
|
|
35
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
36
|
+
else:
|
|
37
|
+
|
|
38
|
+
class Config:
|
|
39
|
+
frozen = True
|
|
40
|
+
smart_union = True
|
|
41
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,27 @@
|
|
|
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 InternalServerErrorBody(UniversalBaseModel):
|
|
10
|
+
status: typing.Optional[int] = pydantic.Field(default=None)
|
|
11
|
+
"""
|
|
12
|
+
HTTP status code.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
message: typing.Optional[str] = pydantic.Field(default=None)
|
|
16
|
+
"""
|
|
17
|
+
Error message.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
if IS_PYDANTIC_V2:
|
|
21
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
22
|
+
else:
|
|
23
|
+
|
|
24
|
+
class Config:
|
|
25
|
+
frozen = True
|
|
26
|
+
smart_union = True
|
|
27
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,27 @@
|
|
|
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 UnauthorizedErrorBody(UniversalBaseModel):
|
|
10
|
+
status: typing.Optional[int] = pydantic.Field(default=None)
|
|
11
|
+
"""
|
|
12
|
+
HTTP status code.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
message: typing.Optional[str] = pydantic.Field(default=None)
|
|
16
|
+
"""
|
|
17
|
+
Error message.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
if IS_PYDANTIC_V2:
|
|
21
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
22
|
+
else:
|
|
23
|
+
|
|
24
|
+
class Config:
|
|
25
|
+
frozen = True
|
|
26
|
+
smart_union = True
|
|
27
|
+
extra = pydantic.Extra.allow
|
phenoml/core/__init__.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
# isort: skip_file
|
|
4
|
+
|
|
5
|
+
from .api_error import ApiError
|
|
6
|
+
from .client_wrapper import AsyncClientWrapper, BaseClientWrapper, SyncClientWrapper
|
|
7
|
+
from .datetime_utils import serialize_datetime
|
|
8
|
+
from .file import File, convert_file_dict_to_httpx_tuples, with_content_type
|
|
9
|
+
from .http_client import AsyncHttpClient, HttpClient
|
|
10
|
+
from .http_response import AsyncHttpResponse, HttpResponse
|
|
11
|
+
from .jsonable_encoder import jsonable_encoder
|
|
12
|
+
from .pydantic_utilities import (
|
|
13
|
+
IS_PYDANTIC_V2,
|
|
14
|
+
UniversalBaseModel,
|
|
15
|
+
UniversalRootModel,
|
|
16
|
+
parse_obj_as,
|
|
17
|
+
universal_field_validator,
|
|
18
|
+
universal_root_validator,
|
|
19
|
+
update_forward_refs,
|
|
20
|
+
)
|
|
21
|
+
from .query_encoder import encode_query
|
|
22
|
+
from .remove_none_from_dict import remove_none_from_dict
|
|
23
|
+
from .request_options import RequestOptions
|
|
24
|
+
from .serialization import FieldMetadata, convert_and_respect_annotation_metadata
|
|
25
|
+
|
|
26
|
+
__all__ = [
|
|
27
|
+
"ApiError",
|
|
28
|
+
"AsyncClientWrapper",
|
|
29
|
+
"AsyncHttpClient",
|
|
30
|
+
"AsyncHttpResponse",
|
|
31
|
+
"BaseClientWrapper",
|
|
32
|
+
"FieldMetadata",
|
|
33
|
+
"File",
|
|
34
|
+
"HttpClient",
|
|
35
|
+
"HttpResponse",
|
|
36
|
+
"IS_PYDANTIC_V2",
|
|
37
|
+
"RequestOptions",
|
|
38
|
+
"SyncClientWrapper",
|
|
39
|
+
"UniversalBaseModel",
|
|
40
|
+
"UniversalRootModel",
|
|
41
|
+
"convert_and_respect_annotation_metadata",
|
|
42
|
+
"convert_file_dict_to_httpx_tuples",
|
|
43
|
+
"encode_query",
|
|
44
|
+
"jsonable_encoder",
|
|
45
|
+
"parse_obj_as",
|
|
46
|
+
"remove_none_from_dict",
|
|
47
|
+
"serialize_datetime",
|
|
48
|
+
"universal_field_validator",
|
|
49
|
+
"universal_root_validator",
|
|
50
|
+
"update_forward_refs",
|
|
51
|
+
"with_content_type",
|
|
52
|
+
]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from typing import Any, Dict, Optional
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ApiError(Exception):
|
|
7
|
+
headers: Optional[Dict[str, str]]
|
|
8
|
+
status_code: Optional[int]
|
|
9
|
+
body: Any
|
|
10
|
+
|
|
11
|
+
def __init__(
|
|
12
|
+
self,
|
|
13
|
+
*,
|
|
14
|
+
headers: Optional[Dict[str, str]] = None,
|
|
15
|
+
status_code: Optional[int] = None,
|
|
16
|
+
body: Any = None,
|
|
17
|
+
) -> None:
|
|
18
|
+
self.headers = headers
|
|
19
|
+
self.status_code = status_code
|
|
20
|
+
self.body = body
|
|
21
|
+
|
|
22
|
+
def __str__(self) -> str:
|
|
23
|
+
return f"headers: {self.headers}, status_code: {self.status_code}, body: {self.body}"
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
from .http_client import AsyncHttpClient, HttpClient
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class BaseClientWrapper:
|
|
10
|
+
def __init__(
|
|
11
|
+
self,
|
|
12
|
+
*,
|
|
13
|
+
token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
|
|
14
|
+
headers: typing.Optional[typing.Dict[str, str]] = None,
|
|
15
|
+
base_url: str,
|
|
16
|
+
timeout: typing.Optional[float] = None,
|
|
17
|
+
):
|
|
18
|
+
self._token = token
|
|
19
|
+
self._headers = headers
|
|
20
|
+
self._base_url = base_url
|
|
21
|
+
self._timeout = timeout
|
|
22
|
+
|
|
23
|
+
def get_headers(self) -> typing.Dict[str, str]:
|
|
24
|
+
headers: typing.Dict[str, str] = {
|
|
25
|
+
"User-Agent": "phenoml/0.0.6",
|
|
26
|
+
"X-Fern-Language": "Python",
|
|
27
|
+
"X-Fern-SDK-Name": "phenoml",
|
|
28
|
+
"X-Fern-SDK-Version": "0.0.6",
|
|
29
|
+
**(self.get_custom_headers() or {}),
|
|
30
|
+
}
|
|
31
|
+
token = self._get_token()
|
|
32
|
+
if token is not None:
|
|
33
|
+
headers["Authorization"] = f"Bearer {token}"
|
|
34
|
+
return headers
|
|
35
|
+
|
|
36
|
+
def _get_token(self) -> typing.Optional[str]:
|
|
37
|
+
if isinstance(self._token, str) or self._token is None:
|
|
38
|
+
return self._token
|
|
39
|
+
else:
|
|
40
|
+
return self._token()
|
|
41
|
+
|
|
42
|
+
def get_custom_headers(self) -> typing.Optional[typing.Dict[str, str]]:
|
|
43
|
+
return self._headers
|
|
44
|
+
|
|
45
|
+
def get_base_url(self) -> str:
|
|
46
|
+
return self._base_url
|
|
47
|
+
|
|
48
|
+
def get_timeout(self) -> typing.Optional[float]:
|
|
49
|
+
return self._timeout
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class SyncClientWrapper(BaseClientWrapper):
|
|
53
|
+
def __init__(
|
|
54
|
+
self,
|
|
55
|
+
*,
|
|
56
|
+
token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
|
|
57
|
+
headers: typing.Optional[typing.Dict[str, str]] = None,
|
|
58
|
+
base_url: str,
|
|
59
|
+
timeout: typing.Optional[float] = None,
|
|
60
|
+
httpx_client: httpx.Client,
|
|
61
|
+
):
|
|
62
|
+
super().__init__(token=token, headers=headers, base_url=base_url, timeout=timeout)
|
|
63
|
+
self.httpx_client = HttpClient(
|
|
64
|
+
httpx_client=httpx_client,
|
|
65
|
+
base_headers=self.get_headers,
|
|
66
|
+
base_timeout=self.get_timeout,
|
|
67
|
+
base_url=self.get_base_url,
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
class AsyncClientWrapper(BaseClientWrapper):
|
|
72
|
+
def __init__(
|
|
73
|
+
self,
|
|
74
|
+
*,
|
|
75
|
+
token: typing.Optional[typing.Union[str, typing.Callable[[], str]]] = None,
|
|
76
|
+
headers: typing.Optional[typing.Dict[str, str]] = None,
|
|
77
|
+
base_url: str,
|
|
78
|
+
timeout: typing.Optional[float] = None,
|
|
79
|
+
httpx_client: httpx.AsyncClient,
|
|
80
|
+
):
|
|
81
|
+
super().__init__(token=token, headers=headers, base_url=base_url, timeout=timeout)
|
|
82
|
+
self.httpx_client = AsyncHttpClient(
|
|
83
|
+
httpx_client=httpx_client,
|
|
84
|
+
base_headers=self.get_headers,
|
|
85
|
+
base_timeout=self.get_timeout,
|
|
86
|
+
base_url=self.get_base_url,
|
|
87
|
+
)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import datetime as dt
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def serialize_datetime(v: dt.datetime) -> str:
|
|
7
|
+
"""
|
|
8
|
+
Serialize a datetime including timezone info.
|
|
9
|
+
|
|
10
|
+
Uses the timezone info provided if present, otherwise uses the current runtime's timezone info.
|
|
11
|
+
|
|
12
|
+
UTC datetimes end in "Z" while all other timezones are represented as offset from UTC, e.g. +05:00.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def _serialize_zoned_datetime(v: dt.datetime) -> str:
|
|
16
|
+
if v.tzinfo is not None and v.tzinfo.tzname(None) == dt.timezone.utc.tzname(None):
|
|
17
|
+
# UTC is a special case where we use "Z" at the end instead of "+00:00"
|
|
18
|
+
return v.isoformat().replace("+00:00", "Z")
|
|
19
|
+
else:
|
|
20
|
+
# Delegate to the typical +/- offset format
|
|
21
|
+
return v.isoformat()
|
|
22
|
+
|
|
23
|
+
if v.tzinfo is not None:
|
|
24
|
+
return _serialize_zoned_datetime(v)
|
|
25
|
+
else:
|
|
26
|
+
local_tz = dt.datetime.now().astimezone().tzinfo
|
|
27
|
+
localized_dt = v.replace(tzinfo=local_tz)
|
|
28
|
+
return _serialize_zoned_datetime(localized_dt)
|