phenoml 0.0.2__py3-none-any.whl → 0.0.5__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.

Potentially problematic release.


This version of phenoml might be problematic. Click here for more details.

Files changed (68) hide show
  1. phenoml/agent/__init__.py +6 -8
  2. phenoml/agent/client.py +45 -75
  3. phenoml/agent/raw_client.py +37 -77
  4. phenoml/agent/types/__init__.py +6 -8
  5. phenoml/agent/types/agent_create_request.py +53 -0
  6. phenoml/agent/types/agent_create_request_provider.py +5 -0
  7. phenoml/agent/types/agent_template.py +3 -6
  8. phenoml/agent/types/agent_template_provider.py +5 -0
  9. phenoml/client.py +6 -0
  10. phenoml/core/client_wrapper.py +2 -2
  11. phenoml/fhir/__init__.py +36 -0
  12. phenoml/fhir/client.py +970 -0
  13. phenoml/fhir/errors/__init__.py +10 -0
  14. phenoml/fhir/errors/bad_request_error.py +10 -0
  15. phenoml/fhir/errors/internal_server_error.py +10 -0
  16. phenoml/fhir/errors/not_found_error.py +10 -0
  17. phenoml/fhir/errors/unauthorized_error.py +10 -0
  18. phenoml/fhir/raw_client.py +1385 -0
  19. phenoml/fhir/types/__init__.py +29 -0
  20. phenoml/{agent/types/chat_fhir_client_config.py → fhir/types/error_response.py} +11 -6
  21. phenoml/fhir/types/fhir_bundle.py +43 -0
  22. phenoml/fhir/types/fhir_bundle_entry_item.py +34 -0
  23. phenoml/{agent/types/agent_fhir_config.py → fhir/types/fhir_bundle_entry_item_request.py} +5 -11
  24. phenoml/fhir/types/fhir_bundle_entry_item_request_method.py +5 -0
  25. phenoml/fhir/types/fhir_bundle_entry_item_response.py +24 -0
  26. phenoml/fhir/types/fhir_patch_request_body_item.py +36 -0
  27. phenoml/fhir/types/fhir_patch_request_body_item_op.py +7 -0
  28. phenoml/fhir/types/fhir_resource.py +40 -0
  29. phenoml/fhir/types/fhir_resource_meta.py +28 -0
  30. phenoml/fhir/types/fhir_search_response.py +8 -0
  31. phenoml/fhir_provider/__init__.py +43 -0
  32. phenoml/fhir_provider/client.py +731 -0
  33. phenoml/fhir_provider/errors/__init__.py +11 -0
  34. phenoml/fhir_provider/errors/bad_request_error.py +10 -0
  35. phenoml/fhir_provider/errors/forbidden_error.py +10 -0
  36. phenoml/fhir_provider/errors/internal_server_error.py +10 -0
  37. phenoml/fhir_provider/errors/not_found_error.py +10 -0
  38. phenoml/fhir_provider/errors/unauthorized_error.py +10 -0
  39. phenoml/fhir_provider/raw_client.py +1445 -0
  40. phenoml/fhir_provider/types/__init__.py +35 -0
  41. phenoml/fhir_provider/types/auth_method.py +7 -0
  42. phenoml/fhir_provider/types/fhir_provider_auth_config.py +53 -0
  43. phenoml/fhir_provider/types/fhir_provider_delete_response.py +20 -0
  44. phenoml/fhir_provider/types/fhir_provider_list_response.py +22 -0
  45. phenoml/fhir_provider/types/fhir_provider_remove_auth_config_response.py +22 -0
  46. phenoml/fhir_provider/types/fhir_provider_response.py +22 -0
  47. phenoml/fhir_provider/types/fhir_provider_set_active_auth_config_response.py +22 -0
  48. phenoml/fhir_provider/types/fhir_provider_template.py +66 -0
  49. phenoml/fhir_provider/types/fhir_query_response.py +27 -0
  50. phenoml/fhir_provider/types/fhir_query_response_data.py +5 -0
  51. phenoml/fhir_provider/types/json_web_key.py +51 -0
  52. phenoml/fhir_provider/types/provider.py +8 -0
  53. phenoml/fhir_provider/types/service_account_key.py +35 -0
  54. phenoml/fhir_provider/types/smart_configuration.py +46 -0
  55. phenoml/tools/__init__.py +0 -8
  56. phenoml/tools/client.py +24 -60
  57. phenoml/tools/raw_client.py +18 -67
  58. phenoml/tools/types/__init__.py +0 -8
  59. phenoml-0.0.5.dist-info/LICENSE +21 -0
  60. {phenoml-0.0.2.dist-info → phenoml-0.0.5.dist-info}/METADATA +1 -1
  61. {phenoml-0.0.2.dist-info → phenoml-0.0.5.dist-info}/RECORD +62 -22
  62. phenoml/agent/types/agent_provider.py +0 -7
  63. phenoml/agent/types/provider_type.py +0 -5
  64. phenoml/tools/types/cohort_request_provider.py +0 -5
  65. phenoml/tools/types/fhir_client_config.py +0 -31
  66. phenoml/tools/types/lang2fhir_and_create_request_provider.py +0 -7
  67. phenoml/tools/types/lang2fhir_and_search_request_provider.py +0 -7
  68. {phenoml-0.0.2.dist-info → phenoml-0.0.5.dist-info}/WHEEL +0 -0
@@ -0,0 +1,35 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+
5
+ from .auth_method import AuthMethod
6
+ from .fhir_provider_auth_config import FhirProviderAuthConfig
7
+ from .fhir_provider_delete_response import FhirProviderDeleteResponse
8
+ from .fhir_provider_list_response import FhirProviderListResponse
9
+ from .fhir_provider_remove_auth_config_response import FhirProviderRemoveAuthConfigResponse
10
+ from .fhir_provider_response import FhirProviderResponse
11
+ from .fhir_provider_set_active_auth_config_response import FhirProviderSetActiveAuthConfigResponse
12
+ from .fhir_provider_template import FhirProviderTemplate
13
+ from .fhir_query_response import FhirQueryResponse
14
+ from .fhir_query_response_data import FhirQueryResponseData
15
+ from .json_web_key import JsonWebKey
16
+ from .provider import Provider
17
+ from .service_account_key import ServiceAccountKey
18
+ from .smart_configuration import SmartConfiguration
19
+
20
+ __all__ = [
21
+ "AuthMethod",
22
+ "FhirProviderAuthConfig",
23
+ "FhirProviderDeleteResponse",
24
+ "FhirProviderListResponse",
25
+ "FhirProviderRemoveAuthConfigResponse",
26
+ "FhirProviderResponse",
27
+ "FhirProviderSetActiveAuthConfigResponse",
28
+ "FhirProviderTemplate",
29
+ "FhirQueryResponse",
30
+ "FhirQueryResponseData",
31
+ "JsonWebKey",
32
+ "Provider",
33
+ "ServiceAccountKey",
34
+ "SmartConfiguration",
35
+ ]
@@ -0,0 +1,7 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ AuthMethod = typing.Union[
6
+ typing.Literal["client_secret", "google_healthcare", "jwt", "on_behalf_of", "none"], typing.Any
7
+ ]
@@ -0,0 +1,53 @@
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
+ from .auth_method import AuthMethod
9
+ from .json_web_key import JsonWebKey
10
+ from .smart_configuration import SmartConfiguration
11
+
12
+
13
+ class FhirProviderAuthConfig(UniversalBaseModel):
14
+ """
15
+ Authentication configuration for a FHIR provider (sensitive fields are hidden from JSON responses)
16
+ """
17
+
18
+ auth_config_id: typing.Optional[str] = pydantic.Field(default=None)
19
+ """
20
+ Unique identifier for this auth configuration
21
+ """
22
+
23
+ auth_method: typing.Optional[AuthMethod] = None
24
+ is_active_auth_config: typing.Optional[bool] = pydantic.Field(default=None)
25
+ """
26
+ Whether this auth configuration is currently active
27
+ """
28
+
29
+ public_key_cert_pem: typing.Optional[str] = pydantic.Field(default=None)
30
+ """
31
+ Public key certificate in PEM format (visible for JWT auth)
32
+ """
33
+
34
+ json_web_key: typing.Optional[JsonWebKey] = None
35
+ credential_expiry: typing.Optional[dt.datetime] = pydantic.Field(default=None)
36
+ """
37
+ Expiry time for credentials (JWT auth only)
38
+ """
39
+
40
+ smart_configuration: typing.Optional[SmartConfiguration] = None
41
+ scopes: typing.Optional[str] = pydantic.Field(default=None)
42
+ """
43
+ OAuth scopes
44
+ """
45
+
46
+ if IS_PYDANTIC_V2:
47
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
48
+ else:
49
+
50
+ class Config:
51
+ frozen = True
52
+ smart_union = True
53
+ extra = pydantic.Extra.allow
@@ -0,0 +1,20 @@
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 FhirProviderDeleteResponse(UniversalBaseModel):
10
+ success: typing.Optional[bool] = None
11
+ message: typing.Optional[str] = None
12
+
13
+ if IS_PYDANTIC_V2:
14
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
15
+ else:
16
+
17
+ class Config:
18
+ frozen = True
19
+ smart_union = True
20
+ 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 .fhir_provider_template import FhirProviderTemplate
8
+
9
+
10
+ class FhirProviderListResponse(UniversalBaseModel):
11
+ success: typing.Optional[bool] = None
12
+ message: typing.Optional[str] = None
13
+ fhir_providers: typing.Optional[typing.List[FhirProviderTemplate]] = 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
@@ -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 .fhir_provider_template import FhirProviderTemplate
8
+
9
+
10
+ class FhirProviderRemoveAuthConfigResponse(UniversalBaseModel):
11
+ success: typing.Optional[bool] = None
12
+ message: typing.Optional[str] = None
13
+ data: typing.Optional[FhirProviderTemplate] = 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
@@ -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 .fhir_provider_template import FhirProviderTemplate
8
+
9
+
10
+ class FhirProviderResponse(UniversalBaseModel):
11
+ success: typing.Optional[bool] = None
12
+ message: typing.Optional[str] = None
13
+ data: typing.Optional[FhirProviderTemplate] = 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
@@ -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 .fhir_provider_template import FhirProviderTemplate
8
+
9
+
10
+ class FhirProviderSetActiveAuthConfigResponse(UniversalBaseModel):
11
+ success: typing.Optional[bool] = None
12
+ message: typing.Optional[str] = None
13
+ data: typing.Optional[FhirProviderTemplate] = 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
@@ -0,0 +1,66 @@
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
+ from .fhir_provider_auth_config import FhirProviderAuthConfig
9
+ from .provider import Provider
10
+
11
+
12
+ class FhirProviderTemplate(UniversalBaseModel):
13
+ id: typing.Optional[str] = pydantic.Field(default=None)
14
+ """
15
+ Unique identifier for the FHIR provider
16
+ """
17
+
18
+ user_id: typing.Optional[str] = pydantic.Field(default=None)
19
+ """
20
+ ID of the user who owns this FHIR provider
21
+ """
22
+
23
+ name: typing.Optional[str] = pydantic.Field(default=None)
24
+ """
25
+ Display name for the FHIR provider
26
+ """
27
+
28
+ description: typing.Optional[str] = pydantic.Field(default=None)
29
+ """
30
+ Optional description of the FHIR provider
31
+ """
32
+
33
+ provider: typing.Optional[Provider] = None
34
+ base_url: typing.Optional[str] = pydantic.Field(default=None)
35
+ """
36
+ Base URL of the FHIR server
37
+ """
38
+
39
+ client_id: typing.Optional[str] = pydantic.Field(default=None)
40
+ """
41
+ OAuth client ID
42
+ """
43
+
44
+ auth_configs: typing.Optional[typing.Dict[str, FhirProviderAuthConfig]] = pydantic.Field(default=None)
45
+ """
46
+ Map of authentication configurations (key is auth_config_id)
47
+ """
48
+
49
+ is_active: typing.Optional[bool] = pydantic.Field(default=None)
50
+ """
51
+ Whether the FHIR provider is active
52
+ """
53
+
54
+ last_updated: typing.Optional[dt.datetime] = pydantic.Field(default=None)
55
+ """
56
+ Timestamp when the provider was last updated
57
+ """
58
+
59
+ if IS_PYDANTIC_V2:
60
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
61
+ else:
62
+
63
+ class Config:
64
+ frozen = True
65
+ smart_union = True
66
+ 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
+ from .fhir_query_response_data import FhirQueryResponseData
8
+
9
+
10
+ class FhirQueryResponse(UniversalBaseModel):
11
+ success: typing.Optional[bool] = None
12
+ status: typing.Optional[int] = pydantic.Field(default=None)
13
+ """
14
+ HTTP status code from the FHIR server response
15
+ """
16
+
17
+ message: typing.Optional[str] = None
18
+ data: typing.Optional[FhirQueryResponseData] = None
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,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ FhirQueryResponseData = typing.Union[typing.Dict[str, typing.Optional[typing.Any]], str]
@@ -0,0 +1,51 @@
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 JsonWebKey(UniversalBaseModel):
10
+ """
11
+ JSON Web Key structure for RSA keys used in JWT authentication. Keys are automatically generated using RSA-2048 with RS384 signing algorithm. The Key ID (kid) is derived from a SHA256 hash of the public key PEM format.
12
+ """
13
+
14
+ kty: typing.Optional[str] = pydantic.Field(default=None)
15
+ """
16
+ Key Type
17
+ """
18
+
19
+ use: typing.Optional[str] = pydantic.Field(default=None)
20
+ """
21
+ Usage (sig for signature)
22
+ """
23
+
24
+ kid: typing.Optional[str] = pydantic.Field(default=None)
25
+ """
26
+ Key ID - SHA256 hash of the public key PEM (including headers) encoded as base64url. Generated by taking the public key in PEM format, hashing with SHA256, then base64url encoding (replacing + with -, / with _, and removing padding).
27
+ """
28
+
29
+ alg: typing.Optional[str] = pydantic.Field(default=None)
30
+ """
31
+ Algorithm used for JWT signing (RSA with SHA-384)
32
+ """
33
+
34
+ n: typing.Optional[str] = pydantic.Field(default=None)
35
+ """
36
+ RSA Modulus (base64url encoded)
37
+ """
38
+
39
+ e: typing.Optional[str] = pydantic.Field(default=None)
40
+ """
41
+ RSA Exponent (base64url encoded)
42
+ """
43
+
44
+ if IS_PYDANTIC_V2:
45
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
46
+ else:
47
+
48
+ class Config:
49
+ frozen = True
50
+ smart_union = True
51
+ extra = pydantic.Extra.allow
@@ -0,0 +1,8 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ Provider = typing.Union[
6
+ typing.Literal["athenahealth", "canvas", "cerner", "elation", "epic", "google_healthcare", "hapi", "medplum"],
7
+ typing.Any,
8
+ ]
@@ -0,0 +1,35 @@
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 ServiceAccountKey(UniversalBaseModel):
12
+ """
13
+ Google Cloud Service Account key (required for google_healthcare auth method)
14
+ """
15
+
16
+ type: str
17
+ project_id: str
18
+ private_key_id: str
19
+ private_key: str
20
+ client_email: str
21
+ client_id: str
22
+ auth_uri: str
23
+ token_uri: str
24
+ auth_provider_x509cert_url: typing_extensions.Annotated[str, FieldMetadata(alias="auth_provider_x509_cert_url")]
25
+ client_x509cert_url: typing_extensions.Annotated[str, FieldMetadata(alias="client_x509_cert_url")]
26
+ universe_domain: str
27
+
28
+ if IS_PYDANTIC_V2:
29
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
30
+ else:
31
+
32
+ class Config:
33
+ frozen = True
34
+ smart_union = True
35
+ extra = pydantic.Extra.allow
@@ -0,0 +1,46 @@
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 SmartConfiguration(UniversalBaseModel):
10
+ """
11
+ SMART on FHIR configuration for OAuth-based providers
12
+ """
13
+
14
+ authorization_endpoint: typing.Optional[str] = pydantic.Field(default=None)
15
+ """
16
+ OAuth2 authorization endpoint
17
+ """
18
+
19
+ token_endpoint: typing.Optional[str] = pydantic.Field(default=None)
20
+ """
21
+ OAuth2 token endpoint
22
+ """
23
+
24
+ issuer: typing.Optional[str] = pydantic.Field(default=None)
25
+ """
26
+ OIDC issuer URL
27
+ """
28
+
29
+ jwks_uri: typing.Optional[str] = pydantic.Field(default=None)
30
+ """
31
+ JSON Web Key Set URI
32
+ """
33
+
34
+ scopes_supported: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
35
+ """
36
+ List of supported scopes
37
+ """
38
+
39
+ if IS_PYDANTIC_V2:
40
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
41
+ else:
42
+
43
+ class Config:
44
+ frozen = True
45
+ smart_union = True
46
+ extra = pydantic.Extra.allow
phenoml/tools/__init__.py CHANGED
@@ -3,13 +3,9 @@
3
3
  # isort: skip_file
4
4
 
5
5
  from .types import (
6
- CohortRequestProvider,
7
6
  CohortResponse,
8
- FhirClientConfig,
9
- Lang2FhirAndCreateRequestProvider,
10
7
  Lang2FhirAndCreateRequestResource,
11
8
  Lang2FhirAndCreateResponse,
12
- Lang2FhirAndSearchRequestProvider,
13
9
  Lang2FhirAndSearchResponse,
14
10
  McpServerResponse,
15
11
  McpServerResponseData,
@@ -23,16 +19,12 @@ from . import mcp_server
23
19
 
24
20
  __all__ = [
25
21
  "BadRequestError",
26
- "CohortRequestProvider",
27
22
  "CohortResponse",
28
23
  "FailedDependencyError",
29
- "FhirClientConfig",
30
24
  "ForbiddenError",
31
25
  "InternalServerError",
32
- "Lang2FhirAndCreateRequestProvider",
33
26
  "Lang2FhirAndCreateRequestResource",
34
27
  "Lang2FhirAndCreateResponse",
35
- "Lang2FhirAndSearchRequestProvider",
36
28
  "Lang2FhirAndSearchResponse",
37
29
  "McpServerResponse",
38
30
  "McpServerResponseData",