phenoml 0.0.7__py3-none-any.whl → 0.0.9__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/agent/client.py +38 -2
- phenoml/agent/raw_client.py +24 -0
- phenoml/client.py +7 -4
- phenoml/construe/__init__.py +2 -16
- phenoml/construe/client.py +0 -90
- phenoml/construe/raw_client.py +0 -180
- phenoml/construe/types/__init__.py +2 -20
- phenoml/construe/types/extract_request_config.py +33 -4
- phenoml/construe/types/extract_request_config_chunking_method.py +3 -1
- phenoml/construe/types/extract_request_config_validation_method.py +5 -0
- phenoml/construe/types/extract_request_system.py +2 -0
- phenoml/core/client_wrapper.py +8 -10
- phenoml/fhir/client.py +116 -14
- phenoml/fhir/raw_client.py +84 -0
- phenoml/fhir_provider/__init__.py +2 -0
- phenoml/fhir_provider/client.py +21 -4
- phenoml/fhir_provider/raw_client.py +23 -6
- phenoml/fhir_provider/types/__init__.py +2 -0
- phenoml/fhir_provider/types/auth_method.py +1 -1
- phenoml/fhir_provider/types/role.py +27 -0
- phenoml/summary/__init__.py +39 -0
- phenoml/summary/client.py +656 -0
- phenoml/summary/errors/__init__.py +11 -0
- phenoml/summary/errors/bad_request_error.py +10 -0
- phenoml/summary/errors/forbidden_error.py +10 -0
- phenoml/summary/errors/internal_server_error.py +10 -0
- phenoml/summary/errors/not_found_error.py +10 -0
- phenoml/summary/errors/unauthorized_error.py +10 -0
- phenoml/summary/raw_client.py +1190 -0
- phenoml/summary/types/__init__.py +31 -0
- phenoml/summary/types/create_summary_request_fhir_resources.py +8 -0
- phenoml/summary/types/create_summary_request_mode.py +5 -0
- phenoml/{construe/types/construe_cohort_response_queries_item_code_extract_results_item_codes_item.py → summary/types/create_summary_response.py} +7 -10
- phenoml/summary/types/create_summary_template_response.py +23 -0
- phenoml/summary/types/fhir_bundle.py +23 -0
- phenoml/{construe/types/bad_request_error_body.py → summary/types/fhir_bundle_entry_item.py} +3 -10
- phenoml/{construe/types/unauthorized_error_body.py → summary/types/fhir_resource.py} +5 -8
- phenoml/{construe/types/internal_server_error_body.py → summary/types/summary_delete_template_response.py} +3 -10
- phenoml/summary/types/summary_get_template_response.py +21 -0
- phenoml/summary/types/summary_list_templates_response.py +21 -0
- phenoml/summary/types/summary_template.py +41 -0
- phenoml/summary/types/summary_update_template_response.py +22 -0
- phenoml/tools/client.py +112 -6
- phenoml/tools/raw_client.py +82 -2
- {phenoml-0.0.7.dist-info → phenoml-0.0.9.dist-info}/METADATA +1 -1
- {phenoml-0.0.7.dist-info → phenoml-0.0.9.dist-info}/RECORD +48 -32
- phenoml/construe/types/construe_cohort_request_config.py +0 -37
- phenoml/construe/types/construe_cohort_response.py +0 -33
- phenoml/construe/types/construe_cohort_response_queries_item.py +0 -49
- phenoml/construe/types/construe_cohort_response_queries_item_code_extract_results_item.py +0 -31
- {phenoml-0.0.7.dist-info → phenoml-0.0.9.dist-info}/LICENSE +0 -0
- {phenoml-0.0.7.dist-info → phenoml-0.0.9.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
# isort: skip_file
|
|
4
|
+
|
|
5
|
+
from .create_summary_request_fhir_resources import CreateSummaryRequestFhirResources
|
|
6
|
+
from .create_summary_request_mode import CreateSummaryRequestMode
|
|
7
|
+
from .create_summary_response import CreateSummaryResponse
|
|
8
|
+
from .create_summary_template_response import CreateSummaryTemplateResponse
|
|
9
|
+
from .fhir_bundle import FhirBundle
|
|
10
|
+
from .fhir_bundle_entry_item import FhirBundleEntryItem
|
|
11
|
+
from .fhir_resource import FhirResource
|
|
12
|
+
from .summary_delete_template_response import SummaryDeleteTemplateResponse
|
|
13
|
+
from .summary_get_template_response import SummaryGetTemplateResponse
|
|
14
|
+
from .summary_list_templates_response import SummaryListTemplatesResponse
|
|
15
|
+
from .summary_template import SummaryTemplate
|
|
16
|
+
from .summary_update_template_response import SummaryUpdateTemplateResponse
|
|
17
|
+
|
|
18
|
+
__all__ = [
|
|
19
|
+
"CreateSummaryRequestFhirResources",
|
|
20
|
+
"CreateSummaryRequestMode",
|
|
21
|
+
"CreateSummaryResponse",
|
|
22
|
+
"CreateSummaryTemplateResponse",
|
|
23
|
+
"FhirBundle",
|
|
24
|
+
"FhirBundleEntryItem",
|
|
25
|
+
"FhirResource",
|
|
26
|
+
"SummaryDeleteTemplateResponse",
|
|
27
|
+
"SummaryGetTemplateResponse",
|
|
28
|
+
"SummaryListTemplatesResponse",
|
|
29
|
+
"SummaryTemplate",
|
|
30
|
+
"SummaryUpdateTemplateResponse",
|
|
31
|
+
]
|
|
@@ -6,20 +6,17 @@ import pydantic
|
|
|
6
6
|
from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
class
|
|
10
|
-
|
|
9
|
+
class CreateSummaryResponse(UniversalBaseModel):
|
|
10
|
+
success: typing.Optional[bool] = None
|
|
11
|
+
message: typing.Optional[str] = None
|
|
12
|
+
summary: typing.Optional[str] = pydantic.Field(default=None)
|
|
11
13
|
"""
|
|
12
|
-
|
|
14
|
+
Generated summary text
|
|
13
15
|
"""
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
warnings: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
|
|
16
18
|
"""
|
|
17
|
-
|
|
18
|
-
"""
|
|
19
|
-
|
|
20
|
-
reason: typing.Optional[str] = pydantic.Field(default=None)
|
|
21
|
-
"""
|
|
22
|
-
Reason for selecting the code.
|
|
19
|
+
Unresolved placeholders or issues (narrative mode only)
|
|
23
20
|
"""
|
|
24
21
|
|
|
25
22
|
if IS_PYDANTIC_V2:
|
|
@@ -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 .summary_template import SummaryTemplate
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class CreateSummaryTemplateResponse(UniversalBaseModel):
|
|
11
|
+
success: typing.Optional[bool] = None
|
|
12
|
+
message: typing.Optional[str] = None
|
|
13
|
+
template_id: typing.Optional[str] = None
|
|
14
|
+
template: typing.Optional[SummaryTemplate] = 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,23 @@
|
|
|
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 .fhir_bundle_entry_item import FhirBundleEntryItem
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class FhirBundle(UniversalBaseModel):
|
|
13
|
+
resource_type: typing_extensions.Annotated[typing.Literal["Bundle"], FieldMetadata(alias="resourceType")] = "Bundle"
|
|
14
|
+
entry: typing.List[FhirBundleEntryItem]
|
|
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
|
phenoml/{construe/types/bad_request_error_body.py → summary/types/fhir_bundle_entry_item.py}
RENAMED
|
@@ -4,18 +4,11 @@ import typing
|
|
|
4
4
|
|
|
5
5
|
import pydantic
|
|
6
6
|
from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
7
|
+
from .fhir_resource import FhirResource
|
|
7
8
|
|
|
8
9
|
|
|
9
|
-
class
|
|
10
|
-
|
|
11
|
-
"""
|
|
12
|
-
HTTP status code.
|
|
13
|
-
"""
|
|
14
|
-
|
|
15
|
-
message: typing.Optional[str] = pydantic.Field(default=None)
|
|
16
|
-
"""
|
|
17
|
-
Error message.
|
|
18
|
-
"""
|
|
10
|
+
class FhirBundleEntryItem(UniversalBaseModel):
|
|
11
|
+
resource: typing.Optional[FhirResource] = None
|
|
19
12
|
|
|
20
13
|
if IS_PYDANTIC_V2:
|
|
21
14
|
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
@@ -3,18 +3,15 @@
|
|
|
3
3
|
import typing
|
|
4
4
|
|
|
5
5
|
import pydantic
|
|
6
|
+
import typing_extensions
|
|
6
7
|
from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
8
|
+
from ...core.serialization import FieldMetadata
|
|
7
9
|
|
|
8
10
|
|
|
9
|
-
class
|
|
10
|
-
|
|
11
|
+
class FhirResource(UniversalBaseModel):
|
|
12
|
+
resource_type: typing_extensions.Annotated[str, FieldMetadata(alias="resourceType")] = pydantic.Field()
|
|
11
13
|
"""
|
|
12
|
-
|
|
13
|
-
"""
|
|
14
|
-
|
|
15
|
-
message: typing.Optional[str] = pydantic.Field(default=None)
|
|
16
|
-
"""
|
|
17
|
-
Error message.
|
|
14
|
+
FHIR resource type
|
|
18
15
|
"""
|
|
19
16
|
|
|
20
17
|
if IS_PYDANTIC_V2:
|
|
@@ -6,16 +6,9 @@ import pydantic
|
|
|
6
6
|
from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
class
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
HTTP status code.
|
|
13
|
-
"""
|
|
14
|
-
|
|
15
|
-
message: typing.Optional[str] = pydantic.Field(default=None)
|
|
16
|
-
"""
|
|
17
|
-
Error message.
|
|
18
|
-
"""
|
|
9
|
+
class SummaryDeleteTemplateResponse(UniversalBaseModel):
|
|
10
|
+
success: typing.Optional[bool] = None
|
|
11
|
+
message: typing.Optional[str] = None
|
|
19
12
|
|
|
20
13
|
if IS_PYDANTIC_V2:
|
|
21
14
|
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
@@ -0,0 +1,21 @@
|
|
|
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 .summary_template import SummaryTemplate
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class SummaryGetTemplateResponse(UniversalBaseModel):
|
|
11
|
+
success: typing.Optional[bool] = None
|
|
12
|
+
template: typing.Optional[SummaryTemplate] = None
|
|
13
|
+
|
|
14
|
+
if IS_PYDANTIC_V2:
|
|
15
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
16
|
+
else:
|
|
17
|
+
|
|
18
|
+
class Config:
|
|
19
|
+
frozen = True
|
|
20
|
+
smart_union = True
|
|
21
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,21 @@
|
|
|
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 .summary_template import SummaryTemplate
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class SummaryListTemplatesResponse(UniversalBaseModel):
|
|
11
|
+
success: typing.Optional[bool] = None
|
|
12
|
+
templates: typing.Optional[typing.List[SummaryTemplate]] = None
|
|
13
|
+
|
|
14
|
+
if IS_PYDANTIC_V2:
|
|
15
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
16
|
+
else:
|
|
17
|
+
|
|
18
|
+
class Config:
|
|
19
|
+
frozen = True
|
|
20
|
+
smart_union = True
|
|
21
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import datetime as dt
|
|
4
|
+
import typing
|
|
5
|
+
|
|
6
|
+
import pydantic
|
|
7
|
+
from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class SummaryTemplate(UniversalBaseModel):
|
|
11
|
+
id: typing.Optional[str] = None
|
|
12
|
+
user_id: typing.Optional[str] = None
|
|
13
|
+
name: typing.Optional[str] = None
|
|
14
|
+
description: typing.Optional[str] = None
|
|
15
|
+
template: typing.Optional[str] = pydantic.Field(default=None)
|
|
16
|
+
"""
|
|
17
|
+
Template with {{resource.field}} placeholders
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
target_resources: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
|
|
21
|
+
"""
|
|
22
|
+
List of FHIR resource types/profiles
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
mode: typing.Optional[str] = pydantic.Field(default=None)
|
|
26
|
+
"""
|
|
27
|
+
Template mode (stored value)
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = None
|
|
31
|
+
created_at: typing.Optional[dt.datetime] = None
|
|
32
|
+
updated_at: typing.Optional[dt.datetime] = None
|
|
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,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 .summary_template import SummaryTemplate
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class SummaryUpdateTemplateResponse(UniversalBaseModel):
|
|
11
|
+
success: typing.Optional[bool] = None
|
|
12
|
+
message: typing.Optional[str] = None
|
|
13
|
+
template: typing.Optional[SummaryTemplate] = None
|
|
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
|
phenoml/tools/client.py
CHANGED
|
@@ -36,6 +36,8 @@ class ToolsClient:
|
|
|
36
36
|
*,
|
|
37
37
|
resource: Lang2FhirAndCreateRequestResource,
|
|
38
38
|
text: str,
|
|
39
|
+
phenoml_on_behalf_of: typing.Optional[str] = None,
|
|
40
|
+
phenoml_fhir_provider: typing.Optional[str] = None,
|
|
39
41
|
provider: typing.Optional[str] = OMIT,
|
|
40
42
|
request_options: typing.Optional[RequestOptions] = None,
|
|
41
43
|
) -> Lang2FhirAndCreateResponse:
|
|
@@ -50,6 +52,14 @@ class ToolsClient:
|
|
|
50
52
|
text : str
|
|
51
53
|
Natural language text to convert to FHIR resource
|
|
52
54
|
|
|
55
|
+
phenoml_on_behalf_of : typing.Optional[str]
|
|
56
|
+
Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity.
|
|
57
|
+
Must be in the format: Patient/{uuid} or Practitioner/{uuid}
|
|
58
|
+
|
|
59
|
+
phenoml_fhir_provider : typing.Optional[str]
|
|
60
|
+
Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}.
|
|
61
|
+
Multiple FHIR provider integrations can be provided as comma-separated values.
|
|
62
|
+
|
|
53
63
|
provider : typing.Optional[str]
|
|
54
64
|
FHIR provider ID - must be a valid UUID from existing FHIR providers. also supports provider by name (e.g. medplum)
|
|
55
65
|
|
|
@@ -69,12 +79,19 @@ class ToolsClient:
|
|
|
69
79
|
token="YOUR_TOKEN",
|
|
70
80
|
)
|
|
71
81
|
client.tools.create_fhir_resource(
|
|
82
|
+
phenoml_on_behalf_of="Patient/550e8400-e29b-41d4-a716-446655440000",
|
|
83
|
+
phenoml_fhir_provider="550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
|
|
72
84
|
resource="auto",
|
|
73
85
|
text="Patient John Doe has severe asthma with acute exacerbation",
|
|
74
86
|
)
|
|
75
87
|
"""
|
|
76
88
|
_response = self._raw_client.create_fhir_resource(
|
|
77
|
-
resource=resource,
|
|
89
|
+
resource=resource,
|
|
90
|
+
text=text,
|
|
91
|
+
phenoml_on_behalf_of=phenoml_on_behalf_of,
|
|
92
|
+
phenoml_fhir_provider=phenoml_fhir_provider,
|
|
93
|
+
provider=provider,
|
|
94
|
+
request_options=request_options,
|
|
78
95
|
)
|
|
79
96
|
return _response.data
|
|
80
97
|
|
|
@@ -82,6 +99,8 @@ class ToolsClient:
|
|
|
82
99
|
self,
|
|
83
100
|
*,
|
|
84
101
|
text: str,
|
|
102
|
+
phenoml_on_behalf_of: typing.Optional[str] = None,
|
|
103
|
+
phenoml_fhir_provider: typing.Optional[str] = None,
|
|
85
104
|
patient_id: typing.Optional[str] = OMIT,
|
|
86
105
|
practitioner_id: typing.Optional[str] = OMIT,
|
|
87
106
|
count: typing.Optional[int] = OMIT,
|
|
@@ -96,6 +115,14 @@ class ToolsClient:
|
|
|
96
115
|
text : str
|
|
97
116
|
Natural language text to convert to FHIR search parameters
|
|
98
117
|
|
|
118
|
+
phenoml_on_behalf_of : typing.Optional[str]
|
|
119
|
+
Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity.
|
|
120
|
+
Must be in the format: Patient/{uuid} or Practitioner/{uuid}
|
|
121
|
+
|
|
122
|
+
phenoml_fhir_provider : typing.Optional[str]
|
|
123
|
+
Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}.
|
|
124
|
+
Multiple FHIR provider integrations can be provided as comma-separated values.
|
|
125
|
+
|
|
99
126
|
patient_id : typing.Optional[str]
|
|
100
127
|
Patient ID to filter results
|
|
101
128
|
|
|
@@ -124,11 +151,15 @@ class ToolsClient:
|
|
|
124
151
|
token="YOUR_TOKEN",
|
|
125
152
|
)
|
|
126
153
|
client.tools.search_fhir_resources(
|
|
154
|
+
phenoml_on_behalf_of="Patient/550e8400-e29b-41d4-a716-446655440000",
|
|
155
|
+
phenoml_fhir_provider="550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
|
|
127
156
|
text="Find all appointments for patient John Doe next week",
|
|
128
157
|
)
|
|
129
158
|
"""
|
|
130
159
|
_response = self._raw_client.search_fhir_resources(
|
|
131
160
|
text=text,
|
|
161
|
+
phenoml_on_behalf_of=phenoml_on_behalf_of,
|
|
162
|
+
phenoml_fhir_provider=phenoml_fhir_provider,
|
|
132
163
|
patient_id=patient_id,
|
|
133
164
|
practitioner_id=practitioner_id,
|
|
134
165
|
count=count,
|
|
@@ -138,7 +169,13 @@ class ToolsClient:
|
|
|
138
169
|
return _response.data
|
|
139
170
|
|
|
140
171
|
def analyze_cohort(
|
|
141
|
-
self,
|
|
172
|
+
self,
|
|
173
|
+
*,
|
|
174
|
+
text: str,
|
|
175
|
+
provider: str,
|
|
176
|
+
phenoml_on_behalf_of: typing.Optional[str] = None,
|
|
177
|
+
phenoml_fhir_provider: typing.Optional[str] = None,
|
|
178
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
142
179
|
) -> CohortResponse:
|
|
143
180
|
"""
|
|
144
181
|
Uses LLM to extract search concepts from natural language and builds patient cohorts with inclusion/exclusion criteria
|
|
@@ -151,6 +188,14 @@ class ToolsClient:
|
|
|
151
188
|
provider : str
|
|
152
189
|
FHIR provider ID - must be a valid UUID from existing FHIR providers. also supports provider by name (e.g. medplum)
|
|
153
190
|
|
|
191
|
+
phenoml_on_behalf_of : typing.Optional[str]
|
|
192
|
+
Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity.
|
|
193
|
+
Must be in the format: Patient/{uuid} or Practitioner/{uuid}
|
|
194
|
+
|
|
195
|
+
phenoml_fhir_provider : typing.Optional[str]
|
|
196
|
+
Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}.
|
|
197
|
+
Multiple FHIR provider integrations can be provided as comma-separated values.
|
|
198
|
+
|
|
154
199
|
request_options : typing.Optional[RequestOptions]
|
|
155
200
|
Request-specific configuration.
|
|
156
201
|
|
|
@@ -167,11 +212,19 @@ class ToolsClient:
|
|
|
167
212
|
token="YOUR_TOKEN",
|
|
168
213
|
)
|
|
169
214
|
client.tools.analyze_cohort(
|
|
215
|
+
phenoml_on_behalf_of="Patient/550e8400-e29b-41d4-a716-446655440000",
|
|
216
|
+
phenoml_fhir_provider="550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
|
|
170
217
|
text="female patients over 20 with diabetes but not hypertension",
|
|
171
218
|
provider="550e8400-e29b-41d4-a716-446655440000",
|
|
172
219
|
)
|
|
173
220
|
"""
|
|
174
|
-
_response = self._raw_client.analyze_cohort(
|
|
221
|
+
_response = self._raw_client.analyze_cohort(
|
|
222
|
+
text=text,
|
|
223
|
+
provider=provider,
|
|
224
|
+
phenoml_on_behalf_of=phenoml_on_behalf_of,
|
|
225
|
+
phenoml_fhir_provider=phenoml_fhir_provider,
|
|
226
|
+
request_options=request_options,
|
|
227
|
+
)
|
|
175
228
|
return _response.data
|
|
176
229
|
|
|
177
230
|
|
|
@@ -196,6 +249,8 @@ class AsyncToolsClient:
|
|
|
196
249
|
*,
|
|
197
250
|
resource: Lang2FhirAndCreateRequestResource,
|
|
198
251
|
text: str,
|
|
252
|
+
phenoml_on_behalf_of: typing.Optional[str] = None,
|
|
253
|
+
phenoml_fhir_provider: typing.Optional[str] = None,
|
|
199
254
|
provider: typing.Optional[str] = OMIT,
|
|
200
255
|
request_options: typing.Optional[RequestOptions] = None,
|
|
201
256
|
) -> Lang2FhirAndCreateResponse:
|
|
@@ -210,6 +265,14 @@ class AsyncToolsClient:
|
|
|
210
265
|
text : str
|
|
211
266
|
Natural language text to convert to FHIR resource
|
|
212
267
|
|
|
268
|
+
phenoml_on_behalf_of : typing.Optional[str]
|
|
269
|
+
Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity.
|
|
270
|
+
Must be in the format: Patient/{uuid} or Practitioner/{uuid}
|
|
271
|
+
|
|
272
|
+
phenoml_fhir_provider : typing.Optional[str]
|
|
273
|
+
Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}.
|
|
274
|
+
Multiple FHIR provider integrations can be provided as comma-separated values.
|
|
275
|
+
|
|
213
276
|
provider : typing.Optional[str]
|
|
214
277
|
FHIR provider ID - must be a valid UUID from existing FHIR providers. also supports provider by name (e.g. medplum)
|
|
215
278
|
|
|
@@ -234,6 +297,8 @@ class AsyncToolsClient:
|
|
|
234
297
|
|
|
235
298
|
async def main() -> None:
|
|
236
299
|
await client.tools.create_fhir_resource(
|
|
300
|
+
phenoml_on_behalf_of="Patient/550e8400-e29b-41d4-a716-446655440000",
|
|
301
|
+
phenoml_fhir_provider="550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
|
|
237
302
|
resource="auto",
|
|
238
303
|
text="Patient John Doe has severe asthma with acute exacerbation",
|
|
239
304
|
)
|
|
@@ -242,7 +307,12 @@ class AsyncToolsClient:
|
|
|
242
307
|
asyncio.run(main())
|
|
243
308
|
"""
|
|
244
309
|
_response = await self._raw_client.create_fhir_resource(
|
|
245
|
-
resource=resource,
|
|
310
|
+
resource=resource,
|
|
311
|
+
text=text,
|
|
312
|
+
phenoml_on_behalf_of=phenoml_on_behalf_of,
|
|
313
|
+
phenoml_fhir_provider=phenoml_fhir_provider,
|
|
314
|
+
provider=provider,
|
|
315
|
+
request_options=request_options,
|
|
246
316
|
)
|
|
247
317
|
return _response.data
|
|
248
318
|
|
|
@@ -250,6 +320,8 @@ class AsyncToolsClient:
|
|
|
250
320
|
self,
|
|
251
321
|
*,
|
|
252
322
|
text: str,
|
|
323
|
+
phenoml_on_behalf_of: typing.Optional[str] = None,
|
|
324
|
+
phenoml_fhir_provider: typing.Optional[str] = None,
|
|
253
325
|
patient_id: typing.Optional[str] = OMIT,
|
|
254
326
|
practitioner_id: typing.Optional[str] = OMIT,
|
|
255
327
|
count: typing.Optional[int] = OMIT,
|
|
@@ -264,6 +336,14 @@ class AsyncToolsClient:
|
|
|
264
336
|
text : str
|
|
265
337
|
Natural language text to convert to FHIR search parameters
|
|
266
338
|
|
|
339
|
+
phenoml_on_behalf_of : typing.Optional[str]
|
|
340
|
+
Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity.
|
|
341
|
+
Must be in the format: Patient/{uuid} or Practitioner/{uuid}
|
|
342
|
+
|
|
343
|
+
phenoml_fhir_provider : typing.Optional[str]
|
|
344
|
+
Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}.
|
|
345
|
+
Multiple FHIR provider integrations can be provided as comma-separated values.
|
|
346
|
+
|
|
267
347
|
patient_id : typing.Optional[str]
|
|
268
348
|
Patient ID to filter results
|
|
269
349
|
|
|
@@ -297,6 +377,8 @@ class AsyncToolsClient:
|
|
|
297
377
|
|
|
298
378
|
async def main() -> None:
|
|
299
379
|
await client.tools.search_fhir_resources(
|
|
380
|
+
phenoml_on_behalf_of="Patient/550e8400-e29b-41d4-a716-446655440000",
|
|
381
|
+
phenoml_fhir_provider="550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
|
|
300
382
|
text="Find all appointments for patient John Doe next week",
|
|
301
383
|
)
|
|
302
384
|
|
|
@@ -305,6 +387,8 @@ class AsyncToolsClient:
|
|
|
305
387
|
"""
|
|
306
388
|
_response = await self._raw_client.search_fhir_resources(
|
|
307
389
|
text=text,
|
|
390
|
+
phenoml_on_behalf_of=phenoml_on_behalf_of,
|
|
391
|
+
phenoml_fhir_provider=phenoml_fhir_provider,
|
|
308
392
|
patient_id=patient_id,
|
|
309
393
|
practitioner_id=practitioner_id,
|
|
310
394
|
count=count,
|
|
@@ -314,7 +398,13 @@ class AsyncToolsClient:
|
|
|
314
398
|
return _response.data
|
|
315
399
|
|
|
316
400
|
async def analyze_cohort(
|
|
317
|
-
self,
|
|
401
|
+
self,
|
|
402
|
+
*,
|
|
403
|
+
text: str,
|
|
404
|
+
provider: str,
|
|
405
|
+
phenoml_on_behalf_of: typing.Optional[str] = None,
|
|
406
|
+
phenoml_fhir_provider: typing.Optional[str] = None,
|
|
407
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
318
408
|
) -> CohortResponse:
|
|
319
409
|
"""
|
|
320
410
|
Uses LLM to extract search concepts from natural language and builds patient cohorts with inclusion/exclusion criteria
|
|
@@ -327,6 +417,14 @@ class AsyncToolsClient:
|
|
|
327
417
|
provider : str
|
|
328
418
|
FHIR provider ID - must be a valid UUID from existing FHIR providers. also supports provider by name (e.g. medplum)
|
|
329
419
|
|
|
420
|
+
phenoml_on_behalf_of : typing.Optional[str]
|
|
421
|
+
Optional header for on-behalf-of authentication. Used when making requests on behalf of another user or entity.
|
|
422
|
+
Must be in the format: Patient/{uuid} or Practitioner/{uuid}
|
|
423
|
+
|
|
424
|
+
phenoml_fhir_provider : typing.Optional[str]
|
|
425
|
+
Optional header for FHIR provider authentication. Contains credentials in the format {fhir_provider_id}:{oauth2_token}.
|
|
426
|
+
Multiple FHIR provider integrations can be provided as comma-separated values.
|
|
427
|
+
|
|
330
428
|
request_options : typing.Optional[RequestOptions]
|
|
331
429
|
Request-specific configuration.
|
|
332
430
|
|
|
@@ -348,6 +446,8 @@ class AsyncToolsClient:
|
|
|
348
446
|
|
|
349
447
|
async def main() -> None:
|
|
350
448
|
await client.tools.analyze_cohort(
|
|
449
|
+
phenoml_on_behalf_of="Patient/550e8400-e29b-41d4-a716-446655440000",
|
|
450
|
+
phenoml_fhir_provider="550e8400-e29b-41d4-a716-446655440000:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c...",
|
|
351
451
|
text="female patients over 20 with diabetes but not hypertension",
|
|
352
452
|
provider="550e8400-e29b-41d4-a716-446655440000",
|
|
353
453
|
)
|
|
@@ -355,5 +455,11 @@ class AsyncToolsClient:
|
|
|
355
455
|
|
|
356
456
|
asyncio.run(main())
|
|
357
457
|
"""
|
|
358
|
-
_response = await self._raw_client.analyze_cohort(
|
|
458
|
+
_response = await self._raw_client.analyze_cohort(
|
|
459
|
+
text=text,
|
|
460
|
+
provider=provider,
|
|
461
|
+
phenoml_on_behalf_of=phenoml_on_behalf_of,
|
|
462
|
+
phenoml_fhir_provider=phenoml_fhir_provider,
|
|
463
|
+
request_options=request_options,
|
|
464
|
+
)
|
|
359
465
|
return _response.data
|