phenoml 0.0.2__py3-none-any.whl → 0.0.17__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/__init__.py +6 -8
- phenoml/agent/client.py +85 -67
- phenoml/agent/raw_client.py +61 -77
- phenoml/agent/types/__init__.py +6 -8
- phenoml/agent/types/agent_create_request.py +53 -0
- phenoml/agent/types/agent_create_request_provider.py +5 -0
- phenoml/agent/types/agent_template.py +3 -6
- phenoml/agent/types/agent_template_provider.py +5 -0
- phenoml/agent/types/json_patch_operation.py +5 -1
- phenoml/client.py +12 -0
- 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 +2 -2
- phenoml/fhir/__init__.py +36 -0
- phenoml/fhir/client.py +1072 -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 +1469 -0
- phenoml/fhir/types/__init__.py +29 -0
- phenoml/{agent/types/chat_fhir_client_config.py → fhir/types/error_response.py} +11 -6
- 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/{construe/types/bad_request_error_body.py → fhir/types/fhir_bundle_entry_item_response.py} +4 -7
- 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 +45 -0
- phenoml/fhir_provider/client.py +748 -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 +1462 -0
- phenoml/fhir_provider/types/__init__.py +37 -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/role.py +27 -0
- phenoml/fhir_provider/types/service_account_key.py +35 -0
- phenoml/fhir_provider/types/smart_configuration.py +46 -0
- phenoml/lang2fhir/__init__.py +10 -0
- phenoml/lang2fhir/client.py +111 -6
- phenoml/lang2fhir/raw_client.py +189 -0
- phenoml/lang2fhir/types/__init__.py +10 -0
- phenoml/lang2fhir/types/create_multi_response.py +39 -0
- phenoml/lang2fhir/types/create_multi_response_bundle.py +28 -0
- phenoml/lang2fhir/types/create_multi_response_bundle_entry_item.py +24 -0
- phenoml/lang2fhir/types/create_multi_response_bundle_entry_item_request.py +20 -0
- phenoml/{construe/types/construe_cohort_response_queries_item_code_extract_results_item_codes_item.py → lang2fhir/types/create_multi_response_resources_item.py} +13 -7
- phenoml/summary/__init__.py +41 -0
- phenoml/summary/client.py +668 -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 +1202 -0
- phenoml/summary/types/__init__.py +33 -0
- phenoml/summary/types/create_summary_request_fhir_resources.py +8 -0
- phenoml/summary/types/create_summary_request_mode.py +5 -0
- phenoml/{agent/types/agent_fhir_config.py → summary/types/create_summary_response.py} +7 -9
- phenoml/summary/types/create_summary_template_response.py +23 -0
- phenoml/{construe/types/unauthorized_error_body.py → summary/types/error_response.py} +4 -8
- phenoml/summary/types/fhir_bundle.py +23 -0
- phenoml/summary/types/fhir_bundle_entry_item.py +20 -0
- phenoml/summary/types/fhir_resource.py +24 -0
- phenoml/summary/types/summary_delete_template_response.py +20 -0
- phenoml/summary/types/summary_get_template_response.py +21 -0
- phenoml/summary/types/summary_list_templates_response.py +21 -0
- phenoml/summary/types/summary_template.py +41 -0
- phenoml/summary/types/summary_update_template_response.py +22 -0
- phenoml/tools/__init__.py +6 -8
- phenoml/tools/client.py +259 -44
- phenoml/tools/raw_client.py +347 -55
- phenoml/tools/types/__init__.py +6 -8
- phenoml/tools/types/lang2fhir_and_create_multi_response.py +41 -0
- phenoml/{construe/types/construe_cohort_response_queries_item_code_extract_results_item.py → tools/types/lang2fhir_and_create_multi_response_resource_info_item.py} +14 -7
- phenoml/tools/types/lang2fhir_and_create_multi_response_response_bundle.py +27 -0
- phenoml/workflows/__init__.py +61 -0
- phenoml/workflows/client.py +694 -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/raw_client.py +1266 -0
- phenoml/workflows/types/__init__.py +53 -0
- phenoml/workflows/types/create_workflow_request_fhir_provider_id.py +5 -0
- phenoml/workflows/types/create_workflow_response.py +44 -0
- phenoml/{tools/types/fhir_client_config.py → workflows/types/decision_node_definition.py} +7 -6
- phenoml/workflows/types/execute_workflow_response.py +30 -0
- phenoml/{construe/types/internal_server_error_body.py → workflows/types/execute_workflow_response_results.py} +3 -8
- 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/update_workflow_request_fhir_provider_id.py +5 -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/types/workflows_delete_response.py +20 -0
- phenoml/workflows/types/workflows_get_response.py +26 -0
- phenoml/workflows/types/workflows_update_response.py +31 -0
- phenoml-0.0.17.dist-info/LICENSE +21 -0
- {phenoml-0.0.2.dist-info → phenoml-0.0.17.dist-info}/METADATA +1 -1
- phenoml-0.0.17.dist-info/RECORD +251 -0
- phenoml/agent/types/agent_provider.py +0 -7
- phenoml/agent/types/provider_type.py +0 -5
- 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/tools/types/cohort_request_provider.py +0 -5
- phenoml/tools/types/lang2fhir_and_create_request_provider.py +0 -7
- phenoml/tools/types/lang2fhir_and_search_request_provider.py +0 -7
- phenoml-0.0.2.dist-info/RECORD +0 -153
- {phenoml-0.0.2.dist-info → phenoml-0.0.17.dist-info}/WHEEL +0 -0
phenoml/construe/raw_client.py
CHANGED
|
@@ -14,8 +14,6 @@ from .errors.conflict_error import ConflictError
|
|
|
14
14
|
from .errors.failed_dependency_error import FailedDependencyError
|
|
15
15
|
from .errors.internal_server_error import InternalServerError
|
|
16
16
|
from .errors.unauthorized_error import UnauthorizedError
|
|
17
|
-
from .types.construe_cohort_request_config import ConstrueCohortRequestConfig
|
|
18
|
-
from .types.construe_cohort_response import ConstrueCohortResponse
|
|
19
17
|
from .types.construe_upload_code_system_response import ConstrueUploadCodeSystemResponse
|
|
20
18
|
from .types.extract_codes_result import ExtractCodesResult
|
|
21
19
|
from .types.extract_request_config import ExtractRequestConfig
|
|
@@ -276,95 +274,6 @@ class RawConstrueClient:
|
|
|
276
274
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
277
275
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
278
276
|
|
|
279
|
-
def cohort(
|
|
280
|
-
self,
|
|
281
|
-
*,
|
|
282
|
-
text: str,
|
|
283
|
-
config: typing.Optional[ConstrueCohortRequestConfig] = OMIT,
|
|
284
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
285
|
-
) -> HttpResponse[ConstrueCohortResponse]:
|
|
286
|
-
"""
|
|
287
|
-
Creates a patient cohort based on a natural language description.
|
|
288
|
-
Translates the description into FHIR search queries and optional SQL queries.
|
|
289
|
-
|
|
290
|
-
Parameters
|
|
291
|
-
----------
|
|
292
|
-
text : str
|
|
293
|
-
Natural language description of the desired patient cohort.
|
|
294
|
-
|
|
295
|
-
config : typing.Optional[ConstrueCohortRequestConfig]
|
|
296
|
-
|
|
297
|
-
request_options : typing.Optional[RequestOptions]
|
|
298
|
-
Request-specific configuration.
|
|
299
|
-
|
|
300
|
-
Returns
|
|
301
|
-
-------
|
|
302
|
-
HttpResponse[ConstrueCohortResponse]
|
|
303
|
-
Cohort creation successful
|
|
304
|
-
"""
|
|
305
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
306
|
-
"construe/cohort",
|
|
307
|
-
method="POST",
|
|
308
|
-
json={
|
|
309
|
-
"config": convert_and_respect_annotation_metadata(
|
|
310
|
-
object_=config, annotation=ConstrueCohortRequestConfig, direction="write"
|
|
311
|
-
),
|
|
312
|
-
"text": text,
|
|
313
|
-
},
|
|
314
|
-
headers={
|
|
315
|
-
"content-type": "application/json",
|
|
316
|
-
},
|
|
317
|
-
request_options=request_options,
|
|
318
|
-
omit=OMIT,
|
|
319
|
-
)
|
|
320
|
-
try:
|
|
321
|
-
if 200 <= _response.status_code < 300:
|
|
322
|
-
_data = typing.cast(
|
|
323
|
-
ConstrueCohortResponse,
|
|
324
|
-
parse_obj_as(
|
|
325
|
-
type_=ConstrueCohortResponse, # type: ignore
|
|
326
|
-
object_=_response.json(),
|
|
327
|
-
),
|
|
328
|
-
)
|
|
329
|
-
return HttpResponse(response=_response, data=_data)
|
|
330
|
-
if _response.status_code == 400:
|
|
331
|
-
raise BadRequestError(
|
|
332
|
-
headers=dict(_response.headers),
|
|
333
|
-
body=typing.cast(
|
|
334
|
-
typing.Optional[typing.Any],
|
|
335
|
-
parse_obj_as(
|
|
336
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
337
|
-
object_=_response.json(),
|
|
338
|
-
),
|
|
339
|
-
),
|
|
340
|
-
)
|
|
341
|
-
if _response.status_code == 401:
|
|
342
|
-
raise UnauthorizedError(
|
|
343
|
-
headers=dict(_response.headers),
|
|
344
|
-
body=typing.cast(
|
|
345
|
-
typing.Optional[typing.Any],
|
|
346
|
-
parse_obj_as(
|
|
347
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
348
|
-
object_=_response.json(),
|
|
349
|
-
),
|
|
350
|
-
),
|
|
351
|
-
)
|
|
352
|
-
if _response.status_code == 500:
|
|
353
|
-
raise InternalServerError(
|
|
354
|
-
headers=dict(_response.headers),
|
|
355
|
-
body=typing.cast(
|
|
356
|
-
typing.Optional[typing.Any],
|
|
357
|
-
parse_obj_as(
|
|
358
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
359
|
-
object_=_response.json(),
|
|
360
|
-
),
|
|
361
|
-
),
|
|
362
|
-
)
|
|
363
|
-
_response_json = _response.json()
|
|
364
|
-
except JSONDecodeError:
|
|
365
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
366
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
367
|
-
|
|
368
277
|
|
|
369
278
|
class AsyncRawConstrueClient:
|
|
370
279
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
@@ -615,92 +524,3 @@ class AsyncRawConstrueClient:
|
|
|
615
524
|
except JSONDecodeError:
|
|
616
525
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
617
526
|
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
618
|
-
|
|
619
|
-
async def cohort(
|
|
620
|
-
self,
|
|
621
|
-
*,
|
|
622
|
-
text: str,
|
|
623
|
-
config: typing.Optional[ConstrueCohortRequestConfig] = OMIT,
|
|
624
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
625
|
-
) -> AsyncHttpResponse[ConstrueCohortResponse]:
|
|
626
|
-
"""
|
|
627
|
-
Creates a patient cohort based on a natural language description.
|
|
628
|
-
Translates the description into FHIR search queries and optional SQL queries.
|
|
629
|
-
|
|
630
|
-
Parameters
|
|
631
|
-
----------
|
|
632
|
-
text : str
|
|
633
|
-
Natural language description of the desired patient cohort.
|
|
634
|
-
|
|
635
|
-
config : typing.Optional[ConstrueCohortRequestConfig]
|
|
636
|
-
|
|
637
|
-
request_options : typing.Optional[RequestOptions]
|
|
638
|
-
Request-specific configuration.
|
|
639
|
-
|
|
640
|
-
Returns
|
|
641
|
-
-------
|
|
642
|
-
AsyncHttpResponse[ConstrueCohortResponse]
|
|
643
|
-
Cohort creation successful
|
|
644
|
-
"""
|
|
645
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
646
|
-
"construe/cohort",
|
|
647
|
-
method="POST",
|
|
648
|
-
json={
|
|
649
|
-
"config": convert_and_respect_annotation_metadata(
|
|
650
|
-
object_=config, annotation=ConstrueCohortRequestConfig, direction="write"
|
|
651
|
-
),
|
|
652
|
-
"text": text,
|
|
653
|
-
},
|
|
654
|
-
headers={
|
|
655
|
-
"content-type": "application/json",
|
|
656
|
-
},
|
|
657
|
-
request_options=request_options,
|
|
658
|
-
omit=OMIT,
|
|
659
|
-
)
|
|
660
|
-
try:
|
|
661
|
-
if 200 <= _response.status_code < 300:
|
|
662
|
-
_data = typing.cast(
|
|
663
|
-
ConstrueCohortResponse,
|
|
664
|
-
parse_obj_as(
|
|
665
|
-
type_=ConstrueCohortResponse, # type: ignore
|
|
666
|
-
object_=_response.json(),
|
|
667
|
-
),
|
|
668
|
-
)
|
|
669
|
-
return AsyncHttpResponse(response=_response, data=_data)
|
|
670
|
-
if _response.status_code == 400:
|
|
671
|
-
raise BadRequestError(
|
|
672
|
-
headers=dict(_response.headers),
|
|
673
|
-
body=typing.cast(
|
|
674
|
-
typing.Optional[typing.Any],
|
|
675
|
-
parse_obj_as(
|
|
676
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
677
|
-
object_=_response.json(),
|
|
678
|
-
),
|
|
679
|
-
),
|
|
680
|
-
)
|
|
681
|
-
if _response.status_code == 401:
|
|
682
|
-
raise UnauthorizedError(
|
|
683
|
-
headers=dict(_response.headers),
|
|
684
|
-
body=typing.cast(
|
|
685
|
-
typing.Optional[typing.Any],
|
|
686
|
-
parse_obj_as(
|
|
687
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
688
|
-
object_=_response.json(),
|
|
689
|
-
),
|
|
690
|
-
),
|
|
691
|
-
)
|
|
692
|
-
if _response.status_code == 500:
|
|
693
|
-
raise InternalServerError(
|
|
694
|
-
headers=dict(_response.headers),
|
|
695
|
-
body=typing.cast(
|
|
696
|
-
typing.Optional[typing.Any],
|
|
697
|
-
parse_obj_as(
|
|
698
|
-
type_=typing.Optional[typing.Any], # type: ignore
|
|
699
|
-
object_=_response.json(),
|
|
700
|
-
),
|
|
701
|
-
),
|
|
702
|
-
)
|
|
703
|
-
_response_json = _response.json()
|
|
704
|
-
except JSONDecodeError:
|
|
705
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
706
|
-
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
@@ -2,40 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
# isort: skip_file
|
|
4
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
5
|
from .construe_upload_code_system_response import ConstrueUploadCodeSystemResponse
|
|
16
6
|
from .extract_codes_result import ExtractCodesResult
|
|
17
7
|
from .extract_request_config import ExtractRequestConfig
|
|
18
8
|
from .extract_request_config_chunking_method import ExtractRequestConfigChunkingMethod
|
|
9
|
+
from .extract_request_config_validation_method import ExtractRequestConfigValidationMethod
|
|
19
10
|
from .extract_request_system import ExtractRequestSystem
|
|
20
11
|
from .extracted_code_result import ExtractedCodeResult
|
|
21
|
-
from .internal_server_error_body import InternalServerErrorBody
|
|
22
|
-
from .unauthorized_error_body import UnauthorizedErrorBody
|
|
23
12
|
from .upload_request_format import UploadRequestFormat
|
|
24
13
|
|
|
25
14
|
__all__ = [
|
|
26
|
-
"BadRequestErrorBody",
|
|
27
|
-
"ConstrueCohortRequestConfig",
|
|
28
|
-
"ConstrueCohortResponse",
|
|
29
|
-
"ConstrueCohortResponseQueriesItem",
|
|
30
|
-
"ConstrueCohortResponseQueriesItemCodeExtractResultsItem",
|
|
31
|
-
"ConstrueCohortResponseQueriesItemCodeExtractResultsItemCodesItem",
|
|
32
15
|
"ConstrueUploadCodeSystemResponse",
|
|
33
16
|
"ExtractCodesResult",
|
|
34
17
|
"ExtractRequestConfig",
|
|
35
18
|
"ExtractRequestConfigChunkingMethod",
|
|
19
|
+
"ExtractRequestConfigValidationMethod",
|
|
36
20
|
"ExtractRequestSystem",
|
|
37
21
|
"ExtractedCodeResult",
|
|
38
|
-
"InternalServerErrorBody",
|
|
39
|
-
"UnauthorizedErrorBody",
|
|
40
22
|
"UploadRequestFormat",
|
|
41
23
|
]
|
|
@@ -5,13 +5,42 @@ import typing
|
|
|
5
5
|
import pydantic
|
|
6
6
|
from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
7
7
|
from .extract_request_config_chunking_method import ExtractRequestConfigChunkingMethod
|
|
8
|
+
from .extract_request_config_validation_method import ExtractRequestConfigValidationMethod
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
class ExtractRequestConfig(UniversalBaseModel):
|
|
11
|
-
chunking_method: typing.Optional[ExtractRequestConfigChunkingMethod] = None
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
chunking_method: typing.Optional[ExtractRequestConfigChunkingMethod] = pydantic.Field(default=None)
|
|
13
|
+
"""
|
|
14
|
+
Method for splitting input text into chunks before code extraction
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
max_codes_per_chunk: typing.Optional[int] = pydantic.Field(default=None)
|
|
18
|
+
"""
|
|
19
|
+
Maximum number of codes to extract per chunk
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
code_similarity_filter: typing.Optional[float] = pydantic.Field(default=None)
|
|
23
|
+
"""
|
|
24
|
+
Threshold for filtering similar codes (0.0-1.0)
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
validation_method: typing.Optional[ExtractRequestConfigValidationMethod] = pydantic.Field(default=None)
|
|
28
|
+
"""
|
|
29
|
+
Method for validating extracted codes:
|
|
30
|
+
* none - No validation, returns all candidate codes
|
|
31
|
+
* simple - LLM-based validation
|
|
32
|
+
* medication_search - LLM-based validation tailored for medication concepts
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
include_rationale: typing.Optional[bool] = pydantic.Field(default=None)
|
|
36
|
+
"""
|
|
37
|
+
Whether to include explanations for why each code was extracted
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
include_ancestors: typing.Optional[bool] = pydantic.Field(default=None)
|
|
41
|
+
"""
|
|
42
|
+
Whether to include ancestor/parent codes in the results
|
|
43
|
+
"""
|
|
15
44
|
|
|
16
45
|
if IS_PYDANTIC_V2:
|
|
17
46
|
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
@@ -2,4 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import typing
|
|
4
4
|
|
|
5
|
-
ExtractRequestConfigChunkingMethod = typing.Union[
|
|
5
|
+
ExtractRequestConfigChunkingMethod = typing.Union[
|
|
6
|
+
typing.Literal["none", "sentences", "paragraphs", "topics"], typing.Any
|
|
7
|
+
]
|
|
@@ -17,6 +17,8 @@ class ExtractRequestSystem(UniversalBaseModel):
|
|
|
17
17
|
* ICD-10-CM - version 2025
|
|
18
18
|
* ICD-10-PCS - version 2025
|
|
19
19
|
* LOINC - version 2.78
|
|
20
|
+
* HPO - version 2025
|
|
21
|
+
* CPT - version 2025
|
|
20
22
|
|
|
21
23
|
Custom systems:
|
|
22
24
|
* Any valid system name configured in your environment. Must have self-hosted construe module.
|
phenoml/core/client_wrapper.py
CHANGED
|
@@ -22,10 +22,10 @@ class BaseClientWrapper:
|
|
|
22
22
|
|
|
23
23
|
def get_headers(self) -> typing.Dict[str, str]:
|
|
24
24
|
headers: typing.Dict[str, str] = {
|
|
25
|
-
"User-Agent": "phenoml/
|
|
25
|
+
"User-Agent": "phenoml/v0.0.17",
|
|
26
26
|
"X-Fern-Language": "Python",
|
|
27
27
|
"X-Fern-SDK-Name": "phenoml",
|
|
28
|
-
"X-Fern-SDK-Version": "
|
|
28
|
+
"X-Fern-SDK-Version": "v0.0.17",
|
|
29
29
|
**(self.get_custom_headers() or {}),
|
|
30
30
|
}
|
|
31
31
|
headers["Authorization"] = f"Bearer {self._get_token()}"
|
phenoml/fhir/__init__.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
# isort: skip_file
|
|
4
|
+
|
|
5
|
+
from .types import (
|
|
6
|
+
ErrorResponse,
|
|
7
|
+
FhirBundle,
|
|
8
|
+
FhirBundleEntryItem,
|
|
9
|
+
FhirBundleEntryItemRequest,
|
|
10
|
+
FhirBundleEntryItemRequestMethod,
|
|
11
|
+
FhirBundleEntryItemResponse,
|
|
12
|
+
FhirPatchRequestBodyItem,
|
|
13
|
+
FhirPatchRequestBodyItemOp,
|
|
14
|
+
FhirResource,
|
|
15
|
+
FhirResourceMeta,
|
|
16
|
+
FhirSearchResponse,
|
|
17
|
+
)
|
|
18
|
+
from .errors import BadRequestError, InternalServerError, NotFoundError, UnauthorizedError
|
|
19
|
+
|
|
20
|
+
__all__ = [
|
|
21
|
+
"BadRequestError",
|
|
22
|
+
"ErrorResponse",
|
|
23
|
+
"FhirBundle",
|
|
24
|
+
"FhirBundleEntryItem",
|
|
25
|
+
"FhirBundleEntryItemRequest",
|
|
26
|
+
"FhirBundleEntryItemRequestMethod",
|
|
27
|
+
"FhirBundleEntryItemResponse",
|
|
28
|
+
"FhirPatchRequestBodyItem",
|
|
29
|
+
"FhirPatchRequestBodyItemOp",
|
|
30
|
+
"FhirResource",
|
|
31
|
+
"FhirResourceMeta",
|
|
32
|
+
"FhirSearchResponse",
|
|
33
|
+
"InternalServerError",
|
|
34
|
+
"NotFoundError",
|
|
35
|
+
"UnauthorizedError",
|
|
36
|
+
]
|