diff --git a/README.md b/README.md index 06f8e7a..0c24891 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ - # Metriport Python Library [![pypi](https://img.shields.io/pypi/v/fern-metriport.svg)](https://pypi.python.org/pypi/fern-metriport) -[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-SDK%20generated%20by%20Fern-brightgreen)](https://github.com/fern-api/fern) +[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-SDK%20generated%20by%20Fern-brightgreen)](https://buildwithfern.com/?utm_source=metriport/metriport-python/readme) ## Documentation @@ -13,9 +12,9 @@ API reference documentation is available [here](https://docs.metriport.com/home/ Add this dependency to your project's build file: ```bash -pip install fern-metriport +pip install metriport # or -poetry add fern-metriport +poetry add metriport ``` ## Usage @@ -117,3 +116,25 @@ This SDK is in beta, and there may be breaking changes between versions without While we value open-source contributions to this SDK, this library is generated programmatically. Additions made directly to this library would have to be moved over to our generation code, otherwise they would be overwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we will not be able to merge it as-is. We suggest opening an issue first to discuss with us! On the other hand, contributions to the README are always very welcome! + +## + +``` + ,▄, + ▄▓███▌ + ▄▀╙ ▀▓▀ ²▄ + ▄└ ╙▌ + ,▀ ╨▄ + ▌ ║ + ▌ + ▌ +,▓██▄ ╔███▄ +╙███▌ ▀███▀ + ▀▄ + ▀╗▄ ,▄ + '╙▀▀▀▀▀╙'' + + + by Metriport Inc. + +``` diff --git a/poetry.lock b/poetry.lock index 05e7950..c23d386 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.7.0 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. [[package]] name = "annotated-types" @@ -38,13 +38,13 @@ trio = ["trio (<0.22)"] [[package]] name = "certifi" -version = "2023.11.17" +version = "2024.2.2" description = "Python package for providing Mozilla's CA Bundle." optional = false python-versions = ">=3.6" files = [ - {file = "certifi-2023.11.17-py3-none-any.whl", hash = "sha256:e036ab49d5b79556f99cfc2d9320b34cfbe5be05c5871b51de9329f0603b0474"}, - {file = "certifi-2023.11.17.tar.gz", hash = "sha256:9b469f3a900bf28dc19b8cfbf8019bf47f7fdd1a65a1d4ffb98fc14166beb4d1"}, + {file = "certifi-2024.2.2-py3-none-any.whl", hash = "sha256:dc383c07b76109f368f6106eee2b593b04a011ea4d55f652c6ca24a754d1cdd1"}, + {file = "certifi-2024.2.2.tar.gz", hash = "sha256:0569859f95fc761b18b45ef421b1290a0f65f147e92a1e5eb3e635f9a5e4e66f"}, ] [[package]] @@ -60,13 +60,13 @@ files = [ [[package]] name = "exceptiongroup" -version = "1.1.3" +version = "1.2.0" description = "Backport of PEP 654 (exception groups)" optional = false python-versions = ">=3.7" files = [ - {file = "exceptiongroup-1.1.3-py3-none-any.whl", hash = "sha256:343280667a4585d195ca1cf9cef84a4e178c4b6cf2274caef9859782b567d5e3"}, - {file = "exceptiongroup-1.1.3.tar.gz", hash = "sha256:097acd85d473d75af5bb98e41b61ff7fe35efe6675e4f9370ec6ec5126d160e9"}, + {file = "exceptiongroup-1.2.0-py3-none-any.whl", hash = "sha256:4bfd3996ac73b41e9b9628b04e079f193850720ea5945fc96a08633c66912f14"}, + {file = "exceptiongroup-1.2.0.tar.gz", hash = "sha256:91f5c769735f051a4290d52edd0858999b57e5876e9f85937691bd4c9fa3ed68"}, ] [package.extras] @@ -132,13 +132,13 @@ socks = ["socksio (==1.*)"] [[package]] name = "idna" -version = "3.4" +version = "3.6" description = "Internationalized Domain Names in Applications (IDNA)" optional = false python-versions = ">=3.5" files = [ - {file = "idna-3.4-py3-none-any.whl", hash = "sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2"}, - {file = "idna-3.4.tar.gz", hash = "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"}, + {file = "idna-3.6-py3-none-any.whl", hash = "sha256:c05567e9c24a6b9faaa835c4821bad0590fbb9d5779e7caa6e1cc4978e7eb24f"}, + {file = "idna-3.6.tar.gz", hash = "sha256:9ecdbbd083b06798ae1e86adcbfe8ab1479cf864e4ee30fe4e46a003d12491ca"}, ] [[package]] @@ -394,13 +394,13 @@ typing-extensions = ">=4.6.0,<4.7.0 || >4.7.0" [[package]] name = "pytest" -version = "7.4.3" +version = "7.4.4" description = "pytest: simple powerful testing with Python" optional = false python-versions = ">=3.7" files = [ - {file = "pytest-7.4.3-py3-none-any.whl", hash = "sha256:0d009c083ea859a71b76adf7c1d502e4bc170b80a8ef002da5806527b9591fac"}, - {file = "pytest-7.4.3.tar.gz", hash = "sha256:d989d136982de4e3b29dabcc838ad581c64e8ed52c11fbe86ddebd9da0818cd5"}, + {file = "pytest-7.4.4-py3-none-any.whl", hash = "sha256:b090cdf5ed60bf4c45261be03239c2c1c22df034fbffe691abe93cd80cea01d8"}, + {file = "pytest-7.4.4.tar.gz", hash = "sha256:2cf0005922c6ace4a3e2ec8b4080eb0d9753fdc93107415332f50ce9e7994280"}, ] [package.dependencies] diff --git a/pyproject.toml b/pyproject.toml index bb5554c..8f5ad12 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "metriport" -version = "8.0.0-alpha1" +version = "8.0.0-beta" description = "" readme = "README.md" authors = [] diff --git a/src/metriport/__init__.py b/src/metriport/__init__.py index 210c5da..ac83f61 100644 --- a/src/metriport/__init__.py +++ b/src/metriport/__init__.py @@ -1,6 +1,6 @@ # This file was auto-generated by Fern from our API Definition. -from .resources import Address, UsState, commons, medical +from .resources import Address, UsState, commons, fhir, medical from .environment import MetriportEnvironment -__all__ = ["Address", "MetriportEnvironment", "UsState", "commons", "medical"] +__all__ = ["Address", "MetriportEnvironment", "UsState", "commons", "fhir", "medical"] diff --git a/src/metriport/core/client_wrapper.py b/src/metriport/core/client_wrapper.py index bd103a4..4892636 100644 --- a/src/metriport/core/client_wrapper.py +++ b/src/metriport/core/client_wrapper.py @@ -14,7 +14,7 @@ def get_headers(self) -> typing.Dict[str, str]: headers: typing.Dict[str, str] = { "X-Fern-Language": "Python", "X-Fern-SDK-Name": "metriport", - "X-Fern-SDK-Version": "8.0.0-alpha1", + "X-Fern-SDK-Version": "8.0.0-beta", } headers["X-API-Key"] = self.api_key return headers diff --git a/src/metriport/resources/__init__.py b/src/metriport/resources/__init__.py index 4facb37..6f3b86d 100644 --- a/src/metriport/resources/__init__.py +++ b/src/metriport/resources/__init__.py @@ -1,6 +1,6 @@ # This file was auto-generated by Fern from our API Definition. -from . import commons, medical +from . import commons, fhir, medical from .commons import Address, UsState -__all__ = ["Address", "UsState", "commons", "medical"] +__all__ = ["Address", "UsState", "commons", "fhir", "medical"] diff --git a/src/metriport/resources/commons/types/address.py b/src/metriport/resources/commons/types/address.py index e282ee6..f7c234e 100644 --- a/src/metriport/resources/commons/types/address.py +++ b/src/metriport/resources/commons/types/address.py @@ -33,7 +33,7 @@ class Address(pydantic.BaseModel): city: str = pydantic.Field(description="The city.") state: UsState = pydantic.Field(description="The 2 letter state acronym, for example `CA`") zip: str = pydantic.Field(description="Zip must be a string consisting of 5 numbers.") - country: str = pydantic.Field(description="Defaults to “USA”") + country: typing.Optional[str] = pydantic.Field(description="Defaults to “USA”") def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/src/metriport/resources/fhir/__init__.py b/src/metriport/resources/fhir/__init__.py new file mode 100644 index 0000000..336c937 --- /dev/null +++ b/src/metriport/resources/fhir/__init__.py @@ -0,0 +1,183 @@ +# This file was auto-generated by Fern from our API Definition. + +from .types import ( + Address, + AddressType, + AddressUse, + Age, + AgeComparator, + Annotation, + Attachment, + Base64Binary, + BaseResource, + Bundle, + BundleEntry, + BundleLink, + BundleRequest, + BundleRequestMethod, + BundleResponse, + BundleSearch, + BundleSearchMode, + BundleType, + Canonical, + Code, + CodeableConcept, + Coding, + ContactDetail, + ContactPoint, + ContactPointSystem, + ContactPointUse, + Contributor, + ContributorType, + Count, + CountComparator, + DataRequirement, + DataRequirementCodeFilter, + DataRequirementDateFilter, + DataRequirementSort, + DataRequirementSortDirection, + DateTime, + Decimal, + Distance, + DistanceComparator, + DocumentReference, + DocumentReferenceContent, + DocumentReferenceContext, + DocumentReferenceRelatesTo, + DocumentReferenceRelatesToCode, + DocumentReferenceStatus, + Dosage, + DosageDoseAndRate, + Duration, + DurationComparator, + Expression, + ExpressionLanguage, + Extension, + HumanName, + HumanNameUse, + Id, + Identifier, + IdentifierUse, + Instant, + Markdown, + Meta, + Money, + Narrative, + NarrativeStatus, + ParameterDefinition, + Period, + PositiveInt, + Quantity, + QuantityComparator, + Range, + Ratio, + Reference, + RelatedArtifact, + RelatedArtifactType, + SampledData, + Signature, + Time, + Timing, + TimingRepeat, + TimingRepeatDurationUnit, + TimingRepeatPeriodUnit, + TimingRepeatWhenItem, + TriggerDefinition, + TriggerDefinitionType, + UnsignedInt, + Uri, + Url, + UsageContext, + Xhtml, +) + +__all__ = [ + "Address", + "AddressType", + "AddressUse", + "Age", + "AgeComparator", + "Annotation", + "Attachment", + "Base64Binary", + "BaseResource", + "Bundle", + "BundleEntry", + "BundleLink", + "BundleRequest", + "BundleRequestMethod", + "BundleResponse", + "BundleSearch", + "BundleSearchMode", + "BundleType", + "Canonical", + "Code", + "CodeableConcept", + "Coding", + "ContactDetail", + "ContactPoint", + "ContactPointSystem", + "ContactPointUse", + "Contributor", + "ContributorType", + "Count", + "CountComparator", + "DataRequirement", + "DataRequirementCodeFilter", + "DataRequirementDateFilter", + "DataRequirementSort", + "DataRequirementSortDirection", + "DateTime", + "Decimal", + "Distance", + "DistanceComparator", + "DocumentReference", + "DocumentReferenceContent", + "DocumentReferenceContext", + "DocumentReferenceRelatesTo", + "DocumentReferenceRelatesToCode", + "DocumentReferenceStatus", + "Dosage", + "DosageDoseAndRate", + "Duration", + "DurationComparator", + "Expression", + "ExpressionLanguage", + "Extension", + "HumanName", + "HumanNameUse", + "Id", + "Identifier", + "IdentifierUse", + "Instant", + "Markdown", + "Meta", + "Money", + "Narrative", + "NarrativeStatus", + "ParameterDefinition", + "Period", + "PositiveInt", + "Quantity", + "QuantityComparator", + "Range", + "Ratio", + "Reference", + "RelatedArtifact", + "RelatedArtifactType", + "SampledData", + "Signature", + "Time", + "Timing", + "TimingRepeat", + "TimingRepeatDurationUnit", + "TimingRepeatPeriodUnit", + "TimingRepeatWhenItem", + "TriggerDefinition", + "TriggerDefinitionType", + "UnsignedInt", + "Uri", + "Url", + "UsageContext", + "Xhtml", +] diff --git a/src/metriport/resources/fhir/types/__init__.py b/src/metriport/resources/fhir/types/__init__.py new file mode 100644 index 0000000..be60fa3 --- /dev/null +++ b/src/metriport/resources/fhir/types/__init__.py @@ -0,0 +1,181 @@ +# This file was auto-generated by Fern from our API Definition. + +from .address import Address +from .address_type import AddressType +from .address_use import AddressUse +from .age import Age +from .age_comparator import AgeComparator +from .annotation import Annotation +from .attachment import Attachment +from .base_64_binary import Base64Binary +from .base_resource import BaseResource +from .bundle import Bundle +from .bundle_entry import BundleEntry +from .bundle_link import BundleLink +from .bundle_request import BundleRequest +from .bundle_request_method import BundleRequestMethod +from .bundle_response import BundleResponse +from .bundle_search import BundleSearch +from .bundle_search_mode import BundleSearchMode +from .bundle_type import BundleType +from .canonical import Canonical +from .code import Code +from .codeable_concept import CodeableConcept +from .coding import Coding +from .contact_detail import ContactDetail +from .contact_point import ContactPoint +from .contact_point_system import ContactPointSystem +from .contact_point_use import ContactPointUse +from .contributor import Contributor +from .contributor_type import ContributorType +from .count import Count +from .count_comparator import CountComparator +from .data_requirement import DataRequirement +from .data_requirement_code_filter import DataRequirementCodeFilter +from .data_requirement_date_filter import DataRequirementDateFilter +from .data_requirement_sort import DataRequirementSort +from .data_requirement_sort_direction import DataRequirementSortDirection +from .date_time import DateTime +from .decimal import Decimal +from .distance import Distance +from .distance_comparator import DistanceComparator +from .document_reference import DocumentReference +from .document_reference_content import DocumentReferenceContent +from .document_reference_context import DocumentReferenceContext +from .document_reference_relates_to import DocumentReferenceRelatesTo +from .document_reference_relates_to_code import DocumentReferenceRelatesToCode +from .document_reference_status import DocumentReferenceStatus +from .dosage import Dosage +from .dosage_dose_and_rate import DosageDoseAndRate +from .duration import Duration +from .duration_comparator import DurationComparator +from .expression import Expression +from .expression_language import ExpressionLanguage +from .extension import Extension +from .human_name import HumanName +from .human_name_use import HumanNameUse +from .id import Id +from .identifier import Identifier +from .identifier_use import IdentifierUse +from .instant import Instant +from .markdown import Markdown +from .meta import Meta +from .money import Money +from .narrative import Narrative +from .narrative_status import NarrativeStatus +from .parameter_definition import ParameterDefinition +from .period import Period +from .positive_int import PositiveInt +from .quantity import Quantity +from .quantity_comparator import QuantityComparator +from .range import Range +from .ratio import Ratio +from .reference import Reference +from .related_artifact import RelatedArtifact +from .related_artifact_type import RelatedArtifactType +from .sampled_data import SampledData +from .signature import Signature +from .time import Time +from .timing import Timing +from .timing_repeat import TimingRepeat +from .timing_repeat_duration_unit import TimingRepeatDurationUnit +from .timing_repeat_period_unit import TimingRepeatPeriodUnit +from .timing_repeat_when_item import TimingRepeatWhenItem +from .trigger_definition import TriggerDefinition +from .trigger_definition_type import TriggerDefinitionType +from .unsigned_int import UnsignedInt +from .uri import Uri +from .url import Url +from .usage_context import UsageContext +from .xhtml import Xhtml + +__all__ = [ + "Address", + "AddressType", + "AddressUse", + "Age", + "AgeComparator", + "Annotation", + "Attachment", + "Base64Binary", + "BaseResource", + "Bundle", + "BundleEntry", + "BundleLink", + "BundleRequest", + "BundleRequestMethod", + "BundleResponse", + "BundleSearch", + "BundleSearchMode", + "BundleType", + "Canonical", + "Code", + "CodeableConcept", + "Coding", + "ContactDetail", + "ContactPoint", + "ContactPointSystem", + "ContactPointUse", + "Contributor", + "ContributorType", + "Count", + "CountComparator", + "DataRequirement", + "DataRequirementCodeFilter", + "DataRequirementDateFilter", + "DataRequirementSort", + "DataRequirementSortDirection", + "DateTime", + "Decimal", + "Distance", + "DistanceComparator", + "DocumentReference", + "DocumentReferenceContent", + "DocumentReferenceContext", + "DocumentReferenceRelatesTo", + "DocumentReferenceRelatesToCode", + "DocumentReferenceStatus", + "Dosage", + "DosageDoseAndRate", + "Duration", + "DurationComparator", + "Expression", + "ExpressionLanguage", + "Extension", + "HumanName", + "HumanNameUse", + "Id", + "Identifier", + "IdentifierUse", + "Instant", + "Markdown", + "Meta", + "Money", + "Narrative", + "NarrativeStatus", + "ParameterDefinition", + "Period", + "PositiveInt", + "Quantity", + "QuantityComparator", + "Range", + "Ratio", + "Reference", + "RelatedArtifact", + "RelatedArtifactType", + "SampledData", + "Signature", + "Time", + "Timing", + "TimingRepeat", + "TimingRepeatDurationUnit", + "TimingRepeatPeriodUnit", + "TimingRepeatWhenItem", + "TriggerDefinition", + "TriggerDefinitionType", + "UnsignedInt", + "Uri", + "Url", + "UsageContext", + "Xhtml", +] diff --git a/src/metriport/resources/fhir/types/address.py b/src/metriport/resources/fhir/types/address.py new file mode 100644 index 0000000..4bf6619 --- /dev/null +++ b/src/metriport/resources/fhir/types/address.py @@ -0,0 +1,72 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .address_type import AddressType +from .address_use import AddressUse + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class Address(pydantic.BaseModel): + """ + An address expressed using postal conventions (as opposed to GPS or other location definition formats). This data type may be used to convey addresses for use in delivering mail as well as for visiting locations which might not be valid for mail delivery. There are a variety of postal address formats defined around the world. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + use: typing.Optional[AddressUse] = pydantic.Field(description="The purpose of this address.") + type: typing.Optional[AddressType] = pydantic.Field( + description="Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both." + ) + text: typing.Optional[str] = pydantic.Field( + description="Specifies the entire address as it should be displayed e.g. on a postal label. This may be provided instead of or as well as the specific parts." + ) + line: typing.Optional[typing.List[str]] = pydantic.Field( + description="This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information." + ) + city: typing.Optional[str] = pydantic.Field( + description="The name of the city, town, suburb, village or other community or delivery center." + ) + district: typing.Optional[str] = pydantic.Field(description="The name of the administrative area (county).") + state: typing.Optional[str] = pydantic.Field( + description="Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (e.g. US 2 letter state codes)." + ) + postal_code: typing.Optional[str] = pydantic.Field( + alias="postalCode", description="A postal code designating a region defined by the postal service." + ) + country: typing.Optional[str] = pydantic.Field( + description="Country - a nation as commonly understood or generally accepted." + ) + period: typing.Optional[Period] = pydantic.Field(description="Time period when address was/is in use.") + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .extension import Extension # noqa: E402 +from .period import Period # noqa: E402 + +Address.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/address_type.py b/src/metriport/resources/fhir/types/address_type.py new file mode 100644 index 0000000..257e164 --- /dev/null +++ b/src/metriport/resources/fhir/types/address_type.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import enum +import typing + +T_Result = typing.TypeVar("T_Result") + + +class AddressType(str, enum.Enum): + """ + Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both. + """ + + POSTAL = "postal" + PHYSICAL = "physical" + BOTH = "both" + + def visit( + self, + postal: typing.Callable[[], T_Result], + physical: typing.Callable[[], T_Result], + both: typing.Callable[[], T_Result], + ) -> T_Result: + if self is AddressType.POSTAL: + return postal() + if self is AddressType.PHYSICAL: + return physical() + if self is AddressType.BOTH: + return both() diff --git a/src/metriport/resources/fhir/types/address_use.py b/src/metriport/resources/fhir/types/address_use.py new file mode 100644 index 0000000..3c283b6 --- /dev/null +++ b/src/metriport/resources/fhir/types/address_use.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import enum +import typing + +T_Result = typing.TypeVar("T_Result") + + +class AddressUse(str, enum.Enum): + """ + The purpose of this address. + """ + + HOME = "home" + WORK = "work" + TEMP = "temp" + OLD = "old" + BILLING = "billing" + + def visit( + self, + home: typing.Callable[[], T_Result], + work: typing.Callable[[], T_Result], + temp: typing.Callable[[], T_Result], + old: typing.Callable[[], T_Result], + billing: typing.Callable[[], T_Result], + ) -> T_Result: + if self is AddressUse.HOME: + return home() + if self is AddressUse.WORK: + return work() + if self is AddressUse.TEMP: + return temp() + if self is AddressUse.OLD: + return old() + if self is AddressUse.BILLING: + return billing() diff --git a/src/metriport/resources/fhir/types/age.py b/src/metriport/resources/fhir/types/age.py new file mode 100644 index 0000000..3117a8b --- /dev/null +++ b/src/metriport/resources/fhir/types/age.py @@ -0,0 +1,61 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .age_comparator import AgeComparator +from .code import Code +from .decimal import Decimal +from .uri import Uri + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class Age(pydantic.BaseModel): + """ + A duration of time during which an organism (or a process) has existed. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + value: typing.Optional[Decimal] = pydantic.Field( + description="The value of the measured amount. The value includes an implicit precision in the presentation of the value." + ) + comparator: typing.Optional[AgeComparator] = pydantic.Field( + description='How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is "<" , then the real value is < stated value.' + ) + unit: typing.Optional[str] = pydantic.Field(description="A human-readable form of the unit.") + system: typing.Optional[Uri] = pydantic.Field( + description="The identification of the system that provides the coded form of the unit." + ) + code: typing.Optional[Code] = pydantic.Field( + description="A computer processable form of the unit in some unit representation system." + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .extension import Extension # noqa: E402 + +Age.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/age_comparator.py b/src/metriport/resources/fhir/types/age_comparator.py new file mode 100644 index 0000000..6146a64 --- /dev/null +++ b/src/metriport/resources/fhir/types/age_comparator.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import enum +import typing + +T_Result = typing.TypeVar("T_Result") + + +class AgeComparator(str, enum.Enum): + """ + How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is "<" , then the real value is < stated value. + """ + + LESS_THAN = "<" + LESS_THAN_OR_EQUAL_TO = "<=" + GREATER_THAN_OR_EQUAL_TO = ">=" + GREATER_THAN = ">" + + def visit( + self, + less_than: typing.Callable[[], T_Result], + less_than_or_equal_to: typing.Callable[[], T_Result], + greater_than_or_equal_to: typing.Callable[[], T_Result], + greater_than: typing.Callable[[], T_Result], + ) -> T_Result: + if self is AgeComparator.LESS_THAN: + return less_than() + if self is AgeComparator.LESS_THAN_OR_EQUAL_TO: + return less_than_or_equal_to() + if self is AgeComparator.GREATER_THAN_OR_EQUAL_TO: + return greater_than_or_equal_to() + if self is AgeComparator.GREATER_THAN: + return greater_than() diff --git a/src/metriport/resources/fhir/types/annotation.py b/src/metriport/resources/fhir/types/annotation.py new file mode 100644 index 0000000..c4d951b --- /dev/null +++ b/src/metriport/resources/fhir/types/annotation.py @@ -0,0 +1,56 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .date_time import DateTime +from .markdown import Markdown + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class Annotation(pydantic.BaseModel): + """ + A text note which also contains information about who made the statement and when. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + author_reference: typing.Optional[Reference] = pydantic.Field( + alias="authorReference", description="The individual responsible for making the annotation." + ) + author_string: typing.Optional[str] = pydantic.Field( + alias="authorString", description="The individual responsible for making the annotation." + ) + time: typing.Optional[DateTime] = pydantic.Field(description="Indicates when this particular annotation was made.") + text: typing.Optional[Markdown] = pydantic.Field(description="The text of the annotation in markdown format.") + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .extension import Extension # noqa: E402 +from .reference import Reference # noqa: E402 + +Annotation.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/attachment.py b/src/metriport/resources/fhir/types/attachment.py new file mode 100644 index 0000000..e48425e --- /dev/null +++ b/src/metriport/resources/fhir/types/attachment.py @@ -0,0 +1,69 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .base_64_binary import Base64Binary +from .code import Code +from .date_time import DateTime +from .unsigned_int import UnsignedInt +from .url import Url + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class Attachment(pydantic.BaseModel): + """ + For referring to data content defined in other formats. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + content_type: typing.Optional[Code] = pydantic.Field( + alias="contentType", + description="Identifies the type of the data in the attachment and allows a method to be chosen to interpret or render the data. Includes mime type parameters such as charset where appropriate.", + ) + language: typing.Optional[Code] = pydantic.Field( + description="The human language of the content. The value can be any valid value according to BCP 47." + ) + data: typing.Optional[Base64Binary] = pydantic.Field( + description="The actual data of the attachment - a sequence of bytes, base64 encoded." + ) + url: typing.Optional[Url] = pydantic.Field(description="A location where the data can be accessed.") + size: typing.Optional[UnsignedInt] = pydantic.Field( + description="The number of bytes of data that make up this attachment (before base64 encoding, if that is done)." + ) + hash: typing.Optional[Base64Binary] = pydantic.Field( + description="The calculated hash of the data using SHA-1. Represented using base64." + ) + title: typing.Optional[str] = pydantic.Field(description="A label or set of text to display in place of the data.") + creation: typing.Optional[DateTime] = pydantic.Field(description="The date that the attachment was first created.") + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .extension import Extension # noqa: E402 + +Attachment.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/base_64_binary.py b/src/metriport/resources/fhir/types/base_64_binary.py new file mode 100644 index 0000000..c40e24f --- /dev/null +++ b/src/metriport/resources/fhir/types/base_64_binary.py @@ -0,0 +1,3 @@ +# This file was auto-generated by Fern from our API Definition. + +Base64Binary = str diff --git a/src/metriport/resources/fhir/types/base_resource.py b/src/metriport/resources/fhir/types/base_resource.py new file mode 100644 index 0000000..7cc7523 --- /dev/null +++ b/src/metriport/resources/fhir/types/base_resource.py @@ -0,0 +1,58 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .code import Code +from .extension import Extension +from .id import Id +from .meta import Meta +from .narrative import Narrative +from .uri import Uri + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class BaseResource(pydantic.BaseModel): + id: typing.Optional[Id] = pydantic.Field( + description="The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes." + ) + meta: typing.Optional[Meta] = pydantic.Field( + description="The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content might not always be associated with version changes to the resource." + ) + implicit_rules: typing.Optional[Uri] = pydantic.Field( + alias="implicitRules", + description="A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.", + ) + language: typing.Optional[Code] = pydantic.Field(description="The base language in which the resource is written.") + text: typing.Optional[Narrative] = pydantic.Field( + description='A human-readable narrative that contains a summary of the resource and can be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.' + ) + contained: typing.Any = pydantic.Field( + description="These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the resource. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + modifier_extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + alias="modifierExtension", + description="May be used to represent additional information that is not part of the basic definition of the resource and that modifies the understanding of the element that contains it and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions. Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).", + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/metriport/resources/fhir/types/bundle.py b/src/metriport/resources/fhir/types/bundle.py new file mode 100644 index 0000000..4c60b28 --- /dev/null +++ b/src/metriport/resources/fhir/types/bundle.py @@ -0,0 +1,78 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +import typing_extensions + +from ....core.datetime_utils import serialize_datetime +from .bundle_entry import BundleEntry +from .bundle_link import BundleLink +from .bundle_type import BundleType +from .code import Code +from .id import Id +from .identifier import Identifier +from .instant import Instant +from .meta import Meta +from .signature import Signature +from .unsigned_int import UnsignedInt +from .uri import Uri + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class Bundle(pydantic.BaseModel): + """ + A container for a collection of resources. + """ + + resource_type: typing_extensions.Literal["Bundle"] = pydantic.Field(alias="resourceType") + id: typing.Optional[Id] = pydantic.Field( + description="The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes." + ) + meta: typing.Optional[Meta] = pydantic.Field( + description="The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content might not always be associated with version changes to the resource." + ) + implicit_rules: typing.Optional[Uri] = pydantic.Field( + alias="implicitRules", + description="A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.", + ) + language: typing.Optional[Code] = pydantic.Field(description="The base language in which the resource is written.") + identifier: typing.Optional[Identifier] = pydantic.Field( + description="A persistent identifier for the bundle that won't change as a bundle is copied from server to server." + ) + type: typing.Optional[BundleType] = pydantic.Field( + description="Indicates the purpose of this bundle - how it is intended to be used." + ) + timestamp: typing.Optional[Instant] = pydantic.Field( + description="The date/time that the bundle was assembled - i.e. when the resources were placed in the bundle." + ) + total: typing.Optional[UnsignedInt] = pydantic.Field( + description="If a set of search matches, this is the total number of entries of type 'match' across all pages in the search. It does not include search.mode = 'include' or 'outcome' entries and it does not provide a count of the number of entries in the Bundle." + ) + link: typing.Optional[typing.List[BundleLink]] = pydantic.Field( + description="A series of links that provide context to this bundle." + ) + entry: typing.Optional[typing.List[BundleEntry]] = pydantic.Field( + description="An entry in a bundle resource - will either contain a resource or information about a resource (transactions and history only)." + ) + signature: typing.Optional[Signature] = pydantic.Field( + description="Digital Signature - base64 encoded. XML-DSig or a JWT." + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/metriport/resources/fhir/types/bundle_entry.py b/src/metriport/resources/fhir/types/bundle_entry.py new file mode 100644 index 0000000..99eb861 --- /dev/null +++ b/src/metriport/resources/fhir/types/bundle_entry.py @@ -0,0 +1,67 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .bundle_link import BundleLink +from .bundle_request import BundleRequest +from .bundle_response import BundleResponse +from .bundle_search import BundleSearch +from .extension import Extension +from .uri import Uri + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class BundleEntry(pydantic.BaseModel): + """ + A container for a collection of resources. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + modifier_extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + alias="modifierExtension", + description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions. Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).", + ) + link: typing.Optional[typing.List[BundleLink]] = pydantic.Field( + description="A series of links that provide context to this entry." + ) + full_url: typing.Optional[Uri] = pydantic.Field( + alias="fullUrl", + description="The Absolute URL for the resource. The fullUrl SHALL NOT disagree with the id in the resource - i.e. if the fullUrl is not a urn:uuid, the URL shall be version-independent URL consistent with the Resource.id. The fullUrl is a version independent reference to the resource. The fullUrl element SHALL have a value except that: _ fullUrl can be empty on a POST (although it does not need to when specifying a temporary id for reference in the bundle) _ Results from operations might involve resources that are not identified.", + ) + resource: typing.Any = pydantic.Field( + description="The Resource for the entry. The purpose/meaning of the resource is determined by the Bundle.type." + ) + search: typing.Optional[BundleSearch] = pydantic.Field( + description="Information about the search process that lead to the creation of this entry." + ) + request: typing.Optional[BundleRequest] = pydantic.Field( + description="Additional information about how this entry should be processed as part of a transaction or batch. For history, it shows how the entry was processed to create the version contained in the entry." + ) + response: typing.Optional[BundleResponse] = pydantic.Field( + description="Indicates the results of processing the corresponding 'request' entry in the batch or transaction being responded to or what the results of an operation where when returning history." + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/metriport/resources/fhir/types/bundle_link.py b/src/metriport/resources/fhir/types/bundle_link.py new file mode 100644 index 0000000..bf7f325 --- /dev/null +++ b/src/metriport/resources/fhir/types/bundle_link.py @@ -0,0 +1,48 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .extension import Extension +from .uri import Uri + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class BundleLink(pydantic.BaseModel): + """ + A container for a collection of resources. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + modifier_extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + alias="modifierExtension", + description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions. Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).", + ) + relation: typing.Optional[str] = pydantic.Field( + description="A name which details the functional use for this link - see [http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1](http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1)." + ) + url: typing.Optional[Uri] = pydantic.Field(description="The reference details for the link.") + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/metriport/resources/fhir/types/bundle_request.py b/src/metriport/resources/fhir/types/bundle_request.py new file mode 100644 index 0000000..e681184 --- /dev/null +++ b/src/metriport/resources/fhir/types/bundle_request.py @@ -0,0 +1,68 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .bundle_request_method import BundleRequestMethod +from .extension import Extension +from .instant import Instant +from .uri import Uri + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class BundleRequest(pydantic.BaseModel): + """ + A container for a collection of resources. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + modifier_extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + alias="modifierExtension", + description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions. Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).", + ) + method: typing.Optional[BundleRequestMethod] = pydantic.Field( + description="In a transaction or batch, this is the HTTP action to be executed for this entry. In a history bundle, this indicates the HTTP action that occurred." + ) + url: typing.Optional[Uri] = pydantic.Field( + description="The URL for this entry, relative to the root (the address to which the request is posted)." + ) + if_none_match: typing.Optional[str] = pydantic.Field( + alias="ifNoneMatch", + description='If the ETag values match, return a 304 Not Modified status. See the API documentation for ["Conditional Read"](http.html#cread).', + ) + if_modified_since: typing.Optional[Instant] = pydantic.Field( + alias="ifModifiedSince", + description='Only perform the operation if the last updated date matches. See the API documentation for ["Conditional Read"](http.html#cread).', + ) + if_match: typing.Optional[str] = pydantic.Field( + alias="ifMatch", + description='Only perform the operation if the Etag value matches. For more information, see the API section ["Managing Resource Contention"](http.html#concurrency).', + ) + if_none_exist: typing.Optional[str] = pydantic.Field( + alias="ifNoneExist", + description='Instruct the server not to perform the create if a specified resource already exists. For further information, see the API documentation for ["Conditional Create"](http.html#ccreate). This is just the query portion of the URL - what follows the "?" (not including the "?").', + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/metriport/resources/fhir/types/bundle_request_method.py b/src/metriport/resources/fhir/types/bundle_request_method.py new file mode 100644 index 0000000..c79a588 --- /dev/null +++ b/src/metriport/resources/fhir/types/bundle_request_method.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import enum +import typing + +T_Result = typing.TypeVar("T_Result") + + +class BundleRequestMethod(str, enum.Enum): + """ + In a transaction or batch, this is the HTTP action to be executed for this entry. In a history bundle, this indicates the HTTP action that occurred. + """ + + GET = "GET" + HEAD = "HEAD" + POST = "POST" + PUT = "PUT" + DELETE = "DELETE" + PATCH = "PATCH" + + def visit( + self, + get: typing.Callable[[], T_Result], + head: typing.Callable[[], T_Result], + post: typing.Callable[[], T_Result], + put: typing.Callable[[], T_Result], + delete: typing.Callable[[], T_Result], + patch: typing.Callable[[], T_Result], + ) -> T_Result: + if self is BundleRequestMethod.GET: + return get() + if self is BundleRequestMethod.HEAD: + return head() + if self is BundleRequestMethod.POST: + return post() + if self is BundleRequestMethod.PUT: + return put() + if self is BundleRequestMethod.DELETE: + return delete() + if self is BundleRequestMethod.PATCH: + return patch() diff --git a/src/metriport/resources/fhir/types/bundle_response.py b/src/metriport/resources/fhir/types/bundle_response.py new file mode 100644 index 0000000..ed290a8 --- /dev/null +++ b/src/metriport/resources/fhir/types/bundle_response.py @@ -0,0 +1,60 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .extension import Extension +from .instant import Instant +from .uri import Uri + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class BundleResponse(pydantic.BaseModel): + """ + A container for a collection of resources. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + modifier_extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + alias="modifierExtension", + description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions. Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).", + ) + status: typing.Optional[str] = pydantic.Field( + description="The status code returned by processing this entry. The status SHALL start with a 3 digit HTTP code (e.g. 404) and may contain the standard HTTP description associated with the status code." + ) + location: typing.Optional[Uri] = pydantic.Field( + description="The location header created by processing this operation, populated if the operation returns a location." + ) + etag: typing.Optional[str] = pydantic.Field( + description="The Etag for the resource, if the operation for the entry produced a versioned resource (see [Resource Metadata and Versioning](http.html#versioning) and [Managing Resource Contention](http.html#concurrency))." + ) + last_modified: typing.Optional[Instant] = pydantic.Field( + alias="lastModified", description="The date/time that the resource was modified on the server." + ) + outcome: typing.Any = pydantic.Field( + description="An OperationOutcome containing hints and warnings produced as part of processing this entry in a batch or transaction." + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/metriport/resources/fhir/types/bundle_search.py b/src/metriport/resources/fhir/types/bundle_search.py new file mode 100644 index 0000000..c4471d9 --- /dev/null +++ b/src/metriport/resources/fhir/types/bundle_search.py @@ -0,0 +1,51 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .bundle_search_mode import BundleSearchMode +from .decimal import Decimal +from .extension import Extension + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class BundleSearch(pydantic.BaseModel): + """ + A container for a collection of resources. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + modifier_extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + alias="modifierExtension", + description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions. Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).", + ) + mode: typing.Optional[BundleSearchMode] = pydantic.Field( + description="Why this entry is in the result set - whether it's included as a match or because of an \_include requirement, or to convey information or warning information about the search process." + ) + score: typing.Optional[Decimal] = pydantic.Field( + description="When searching, the server's search ranking score for the entry." + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/metriport/resources/fhir/types/bundle_search_mode.py b/src/metriport/resources/fhir/types/bundle_search_mode.py new file mode 100644 index 0000000..672600d --- /dev/null +++ b/src/metriport/resources/fhir/types/bundle_search_mode.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import enum +import typing + +T_Result = typing.TypeVar("T_Result") + + +class BundleSearchMode(str, enum.Enum): + """ + Why this entry is in the result set - whether it's included as a match or because of an \_include requirement, or to convey information or warning information about the search process. + """ + + MATCH = "match" + INCLUDE = "include" + OUTCOME = "outcome" + + def visit( + self, + match: typing.Callable[[], T_Result], + include: typing.Callable[[], T_Result], + outcome: typing.Callable[[], T_Result], + ) -> T_Result: + if self is BundleSearchMode.MATCH: + return match() + if self is BundleSearchMode.INCLUDE: + return include() + if self is BundleSearchMode.OUTCOME: + return outcome() diff --git a/src/metriport/resources/fhir/types/bundle_type.py b/src/metriport/resources/fhir/types/bundle_type.py new file mode 100644 index 0000000..f1d35fe --- /dev/null +++ b/src/metriport/resources/fhir/types/bundle_type.py @@ -0,0 +1,53 @@ +# This file was auto-generated by Fern from our API Definition. + +import enum +import typing + +T_Result = typing.TypeVar("T_Result") + + +class BundleType(str, enum.Enum): + """ + Indicates the purpose of this bundle - how it is intended to be used. + """ + + DOCUMENT = "document" + MESSAGE = "message" + TRANSACTION = "transaction" + TRANSACTION_RESPONSE = "transaction-response" + BATCH = "batch" + BATCH_RESPONSE = "batch-response" + HISTORY = "history" + SEARCHSET = "searchset" + COLLECTION = "collection" + + def visit( + self, + document: typing.Callable[[], T_Result], + message: typing.Callable[[], T_Result], + transaction: typing.Callable[[], T_Result], + transaction_response: typing.Callable[[], T_Result], + batch: typing.Callable[[], T_Result], + batch_response: typing.Callable[[], T_Result], + history: typing.Callable[[], T_Result], + searchset: typing.Callable[[], T_Result], + collection: typing.Callable[[], T_Result], + ) -> T_Result: + if self is BundleType.DOCUMENT: + return document() + if self is BundleType.MESSAGE: + return message() + if self is BundleType.TRANSACTION: + return transaction() + if self is BundleType.TRANSACTION_RESPONSE: + return transaction_response() + if self is BundleType.BATCH: + return batch() + if self is BundleType.BATCH_RESPONSE: + return batch_response() + if self is BundleType.HISTORY: + return history() + if self is BundleType.SEARCHSET: + return searchset() + if self is BundleType.COLLECTION: + return collection() diff --git a/src/metriport/resources/fhir/types/canonical.py b/src/metriport/resources/fhir/types/canonical.py new file mode 100644 index 0000000..8555014 --- /dev/null +++ b/src/metriport/resources/fhir/types/canonical.py @@ -0,0 +1,3 @@ +# This file was auto-generated by Fern from our API Definition. + +Canonical = str diff --git a/src/metriport/resources/fhir/types/code.py b/src/metriport/resources/fhir/types/code.py new file mode 100644 index 0000000..2713487 --- /dev/null +++ b/src/metriport/resources/fhir/types/code.py @@ -0,0 +1,3 @@ +# This file was auto-generated by Fern from our API Definition. + +Code = str diff --git a/src/metriport/resources/fhir/types/codeable_concept.py b/src/metriport/resources/fhir/types/codeable_concept.py new file mode 100644 index 0000000..a403cf6 --- /dev/null +++ b/src/metriport/resources/fhir/types/codeable_concept.py @@ -0,0 +1,51 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class CodeableConcept(pydantic.BaseModel): + """ + A concept that may be defined by a formal reference to a terminology or ontology or may be provided by text. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + coding: typing.Optional[typing.List[Coding]] = pydantic.Field( + description="A reference to a code defined by a terminology system." + ) + text: typing.Optional[str] = pydantic.Field( + description="A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user." + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .coding import Coding # noqa: E402 +from .extension import Extension # noqa: E402 + +CodeableConcept.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/coding.py b/src/metriport/resources/fhir/types/coding.py new file mode 100644 index 0000000..e8f03a8 --- /dev/null +++ b/src/metriport/resources/fhir/types/coding.py @@ -0,0 +1,63 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .code import Code +from .uri import Uri + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class Coding(pydantic.BaseModel): + """ + A reference to a code defined by a terminology system. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + system: typing.Optional[Uri] = pydantic.Field( + description="The identification of the code system that defines the meaning of the symbol in the code." + ) + version: typing.Optional[str] = pydantic.Field( + description="The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured, and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged." + ) + code: typing.Optional[Code] = pydantic.Field( + description="A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination)." + ) + display: typing.Optional[str] = pydantic.Field( + description="A representation of the meaning of the code in the system, following the rules of the system." + ) + user_selected: typing.Optional[bool] = pydantic.Field( + alias="userSelected", + description="Indicates that this coding was chosen by a user directly - e.g. off a pick list of available items (codes or displays).", + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .extension import Extension # noqa: E402 + +Coding.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/contact_detail.py b/src/metriport/resources/fhir/types/contact_detail.py new file mode 100644 index 0000000..3abdc22 --- /dev/null +++ b/src/metriport/resources/fhir/types/contact_detail.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class ContactDetail(pydantic.BaseModel): + """ + Specifies contact information for a person or organization. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + name: typing.Optional[str] = pydantic.Field(description="The name of an individual to contact.") + telecom: typing.Optional[typing.List[ContactPoint]] = pydantic.Field( + description="The contact details for the individual (if a name was provided) or the organization." + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .contact_point import ContactPoint # noqa: E402 +from .extension import Extension # noqa: E402 + +ContactDetail.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/contact_point.py b/src/metriport/resources/fhir/types/contact_point.py new file mode 100644 index 0000000..2420bf5 --- /dev/null +++ b/src/metriport/resources/fhir/types/contact_point.py @@ -0,0 +1,59 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .contact_point_system import ContactPointSystem +from .contact_point_use import ContactPointUse +from .positive_int import PositiveInt + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class ContactPoint(pydantic.BaseModel): + """ + Details for all kinds of technology mediated contact points for a person or organization, including telephone, email, etc. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + system: typing.Optional[ContactPointSystem] = pydantic.Field( + description="Telecommunications form for contact point - what communications system is required to make use of the contact." + ) + value: typing.Optional[str] = pydantic.Field( + description="The actual contact point details, in a form that is meaningful to the designated communication system (i.e. phone number or email address)." + ) + use: typing.Optional[ContactPointUse] = pydantic.Field(description="Identifies the purpose for the contact point.") + rank: typing.Optional[PositiveInt] = pydantic.Field( + description="Specifies a preferred order in which to use a set of contacts. ContactPoints with lower rank values are more preferred than those with higher rank values." + ) + period: typing.Optional[Period] = pydantic.Field(description="Time period when the contact point was/is in use.") + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .extension import Extension # noqa: E402 +from .period import Period # noqa: E402 + +ContactPoint.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/contact_point_system.py b/src/metriport/resources/fhir/types/contact_point_system.py new file mode 100644 index 0000000..a347a88 --- /dev/null +++ b/src/metriport/resources/fhir/types/contact_point_system.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +import enum +import typing + +T_Result = typing.TypeVar("T_Result") + + +class ContactPointSystem(str, enum.Enum): + """ + Telecommunications form for contact point - what communications system is required to make use of the contact. + """ + + PHONE = "phone" + FAX = "fax" + EMAIL = "email" + PAGER = "pager" + URL = "url" + SMS = "sms" + OTHER = "other" + + def visit( + self, + phone: typing.Callable[[], T_Result], + fax: typing.Callable[[], T_Result], + email: typing.Callable[[], T_Result], + pager: typing.Callable[[], T_Result], + url: typing.Callable[[], T_Result], + sms: typing.Callable[[], T_Result], + other: typing.Callable[[], T_Result], + ) -> T_Result: + if self is ContactPointSystem.PHONE: + return phone() + if self is ContactPointSystem.FAX: + return fax() + if self is ContactPointSystem.EMAIL: + return email() + if self is ContactPointSystem.PAGER: + return pager() + if self is ContactPointSystem.URL: + return url() + if self is ContactPointSystem.SMS: + return sms() + if self is ContactPointSystem.OTHER: + return other() diff --git a/src/metriport/resources/fhir/types/contact_point_use.py b/src/metriport/resources/fhir/types/contact_point_use.py new file mode 100644 index 0000000..27b328e --- /dev/null +++ b/src/metriport/resources/fhir/types/contact_point_use.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import enum +import typing + +T_Result = typing.TypeVar("T_Result") + + +class ContactPointUse(str, enum.Enum): + """ + Identifies the purpose for the contact point. + """ + + HOME = "home" + WORK = "work" + TEMP = "temp" + OLD = "old" + MOBILE = "mobile" + + def visit( + self, + home: typing.Callable[[], T_Result], + work: typing.Callable[[], T_Result], + temp: typing.Callable[[], T_Result], + old: typing.Callable[[], T_Result], + mobile: typing.Callable[[], T_Result], + ) -> T_Result: + if self is ContactPointUse.HOME: + return home() + if self is ContactPointUse.WORK: + return work() + if self is ContactPointUse.TEMP: + return temp() + if self is ContactPointUse.OLD: + return old() + if self is ContactPointUse.MOBILE: + return mobile() diff --git a/src/metriport/resources/fhir/types/contributor.py b/src/metriport/resources/fhir/types/contributor.py new file mode 100644 index 0000000..44b9411 --- /dev/null +++ b/src/metriport/resources/fhir/types/contributor.py @@ -0,0 +1,53 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .contributor_type import ContributorType + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class Contributor(pydantic.BaseModel): + """ + A contributor to the content of a knowledge asset, including authors, editors, reviewers, and endorsers. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + type: typing.Optional[ContributorType] = pydantic.Field(description="The type of contributor.") + name: typing.Optional[str] = pydantic.Field( + description="The name of the individual or organization responsible for the contribution." + ) + contact: typing.Optional[typing.List[ContactDetail]] = pydantic.Field( + description="Contact details to assist a user in finding and communicating with the contributor." + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .contact_detail import ContactDetail # noqa: E402 +from .extension import Extension # noqa: E402 + +Contributor.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/contributor_type.py b/src/metriport/resources/fhir/types/contributor_type.py new file mode 100644 index 0000000..6b81b7a --- /dev/null +++ b/src/metriport/resources/fhir/types/contributor_type.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import enum +import typing + +T_Result = typing.TypeVar("T_Result") + + +class ContributorType(str, enum.Enum): + """ + The type of contributor. + """ + + AUTHOR = "author" + EDITOR = "editor" + REVIEWER = "reviewer" + ENDORSER = "endorser" + + def visit( + self, + author: typing.Callable[[], T_Result], + editor: typing.Callable[[], T_Result], + reviewer: typing.Callable[[], T_Result], + endorser: typing.Callable[[], T_Result], + ) -> T_Result: + if self is ContributorType.AUTHOR: + return author() + if self is ContributorType.EDITOR: + return editor() + if self is ContributorType.REVIEWER: + return reviewer() + if self is ContributorType.ENDORSER: + return endorser() diff --git a/src/metriport/resources/fhir/types/count.py b/src/metriport/resources/fhir/types/count.py new file mode 100644 index 0000000..0d51169 --- /dev/null +++ b/src/metriport/resources/fhir/types/count.py @@ -0,0 +1,61 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .code import Code +from .count_comparator import CountComparator +from .decimal import Decimal +from .uri import Uri + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class Count(pydantic.BaseModel): + """ + A measured amount (or an amount that can potentially be measured). Note that measured amounts include amounts that are not precisely quantified, including amounts involving arbitrary units and floating currencies. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + value: typing.Optional[Decimal] = pydantic.Field( + description="The value of the measured amount. The value includes an implicit precision in the presentation of the value." + ) + comparator: typing.Optional[CountComparator] = pydantic.Field( + description='How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is "<" , then the real value is < stated value.' + ) + unit: typing.Optional[str] = pydantic.Field(description="A human-readable form of the unit.") + system: typing.Optional[Uri] = pydantic.Field( + description="The identification of the system that provides the coded form of the unit." + ) + code: typing.Optional[Code] = pydantic.Field( + description="A computer processable form of the unit in some unit representation system." + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .extension import Extension # noqa: E402 + +Count.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/count_comparator.py b/src/metriport/resources/fhir/types/count_comparator.py new file mode 100644 index 0000000..bc74adb --- /dev/null +++ b/src/metriport/resources/fhir/types/count_comparator.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import enum +import typing + +T_Result = typing.TypeVar("T_Result") + + +class CountComparator(str, enum.Enum): + """ + How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is "<" , then the real value is < stated value. + """ + + LESS_THAN = "<" + LESS_THAN_OR_EQUAL_TO = "<=" + GREATER_THAN_OR_EQUAL_TO = ">=" + GREATER_THAN = ">" + + def visit( + self, + less_than: typing.Callable[[], T_Result], + less_than_or_equal_to: typing.Callable[[], T_Result], + greater_than_or_equal_to: typing.Callable[[], T_Result], + greater_than: typing.Callable[[], T_Result], + ) -> T_Result: + if self is CountComparator.LESS_THAN: + return less_than() + if self is CountComparator.LESS_THAN_OR_EQUAL_TO: + return less_than_or_equal_to() + if self is CountComparator.GREATER_THAN_OR_EQUAL_TO: + return greater_than_or_equal_to() + if self is CountComparator.GREATER_THAN: + return greater_than() diff --git a/src/metriport/resources/fhir/types/data_requirement.py b/src/metriport/resources/fhir/types/data_requirement.py new file mode 100644 index 0000000..4f6ccd3 --- /dev/null +++ b/src/metriport/resources/fhir/types/data_requirement.py @@ -0,0 +1,85 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .canonical import Canonical +from .code import Code +from .positive_int import PositiveInt + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class DataRequirement(pydantic.BaseModel): + """ + Describes a required data item for evaluation in terms of the type of data, and optional code or date-based filters of the data. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + type: typing.Optional[Code] = pydantic.Field( + description="The type of the required data, specified as the type name of a resource. For profiles, this value is set to the type of the base resource of the profile." + ) + profile: typing.Optional[typing.List[Canonical]] = pydantic.Field( + description="The profile of the required data, specified as the uri of the profile definition." + ) + subject_codeable_concept: typing.Optional[CodeableConcept] = pydantic.Field( + alias="subjectCodeableConcept", + description="The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed.", + ) + subject_reference: typing.Optional[Reference] = pydantic.Field( + alias="subjectReference", + description="The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed.", + ) + must_support: typing.Optional[typing.List[str]] = pydantic.Field( + alias="mustSupport", + description="Indicates that specific elements of the type are referenced by the knowledge module and must be supported by the consumer in order to obtain an effective evaluation. This does not mean that a value is required for this element, only that the consuming system must understand the element and be able to provide values for it if they are available. The value of mustSupport SHALL be a FHIRPath resolveable on the type of the DataRequirement. The path SHALL consist only of identifiers, constant indexers, and .resolve() (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details).", + ) + code_filter: typing.Optional[typing.List[DataRequirementCodeFilter]] = pydantic.Field( + alias="codeFilter", + description="Code filters specify additional constraints on the data, specifying the value set of interest for a particular element of the data. Each code filter defines an additional constraint on the data, i.e. code filters are AND'ed, not OR'ed.", + ) + date_filter: typing.Optional[typing.List[DataRequirementDateFilter]] = pydantic.Field( + alias="dateFilter", + description="Date filters specify additional constraints on the data in terms of the applicable date range for specific elements. Each date filter specifies an additional constraint on the data, i.e. date filters are AND'ed, not OR'ed.", + ) + limit: typing.Optional[PositiveInt] = pydantic.Field( + description="Specifies a maximum number of results that are required (uses the \_count search parameter)." + ) + sort: typing.Optional[typing.List[DataRequirementSort]] = pydantic.Field( + description="Specifies the order of the results to be returned." + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .codeable_concept import CodeableConcept # noqa: E402 +from .data_requirement_code_filter import DataRequirementCodeFilter # noqa: E402 +from .data_requirement_date_filter import DataRequirementDateFilter # noqa: E402 +from .data_requirement_sort import DataRequirementSort # noqa: E402 +from .extension import Extension # noqa: E402 +from .reference import Reference # noqa: E402 + +DataRequirement.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/data_requirement_code_filter.py b/src/metriport/resources/fhir/types/data_requirement_code_filter.py new file mode 100644 index 0000000..d8e63c3 --- /dev/null +++ b/src/metriport/resources/fhir/types/data_requirement_code_filter.py @@ -0,0 +1,65 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .canonical import Canonical + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class DataRequirementCodeFilter(pydantic.BaseModel): + """ + Describes a required data item for evaluation in terms of the type of data, and optional code or date-based filters of the data. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + modifier_extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + alias="modifierExtension", + description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions. Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).", + ) + path: typing.Optional[str] = pydantic.Field( + description="The code-valued attribute of the filter. The specified path SHALL be a FHIRPath resolveable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of type code, Coding, or CodeableConcept." + ) + search_param: typing.Optional[str] = pydantic.Field( + alias="searchParam", + description="A token parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type code, Coding, or CodeableConcept.", + ) + value_set: typing.Optional[Canonical] = pydantic.Field( + alias="valueSet", + description="The valueset for the code filter. The valueSet and code elements are additive. If valueSet is specified, the filter will return only those data items for which the value of the code-valued element specified in the path is a member of the specified valueset.", + ) + code: typing.Optional[typing.List[Coding]] = pydantic.Field( + description="The codes for the code filter. If values are given, the filter will return only those data items for which the code-valued attribute specified by the path has a value that is one of the specified codes. If codes are specified in addition to a value set, the filter returns items matching a code in the value set or one of the specified codes." + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .coding import Coding # noqa: E402 +from .extension import Extension # noqa: E402 + +DataRequirementCodeFilter.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/data_requirement_date_filter.py b/src/metriport/resources/fhir/types/data_requirement_date_filter.py new file mode 100644 index 0000000..117880a --- /dev/null +++ b/src/metriport/resources/fhir/types/data_requirement_date_filter.py @@ -0,0 +1,70 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class DataRequirementDateFilter(pydantic.BaseModel): + """ + Describes a required data item for evaluation in terms of the type of data, and optional code or date-based filters of the data. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + modifier_extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + alias="modifierExtension", + description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions. Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).", + ) + path: typing.Optional[str] = pydantic.Field( + description="The date-valued attribute of the filter. The specified path SHALL be a FHIRPath resolveable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of type date, dateTime, Period, Schedule, or Timing." + ) + search_param: typing.Optional[str] = pydantic.Field( + alias="searchParam", + description="A date parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type date, dateTime, Period, Schedule, or Timing.", + ) + value_date_time: typing.Optional[str] = pydantic.Field( + alias="valueDateTime", + description="The value of the filter. If period is specified, the filter will return only those data items that fall within the bounds determined by the Period, inclusive of the period boundaries. If dateTime is specified, the filter will return only those data items that are equal to the specified dateTime. If a Duration is specified, the filter will return only those data items that fall within Duration before now.", + ) + value_period: typing.Optional[Period] = pydantic.Field( + alias="valuePeriod", + description="The value of the filter. If period is specified, the filter will return only those data items that fall within the bounds determined by the Period, inclusive of the period boundaries. If dateTime is specified, the filter will return only those data items that are equal to the specified dateTime. If a Duration is specified, the filter will return only those data items that fall within Duration before now.", + ) + value_duration: typing.Optional[Duration] = pydantic.Field( + alias="valueDuration", + description="The value of the filter. If period is specified, the filter will return only those data items that fall within the bounds determined by the Period, inclusive of the period boundaries. If dateTime is specified, the filter will return only those data items that are equal to the specified dateTime. If a Duration is specified, the filter will return only those data items that fall within Duration before now.", + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .duration import Duration # noqa: E402 +from .extension import Extension # noqa: E402 +from .period import Period # noqa: E402 + +DataRequirementDateFilter.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/data_requirement_sort.py b/src/metriport/resources/fhir/types/data_requirement_sort.py new file mode 100644 index 0000000..95c4167 --- /dev/null +++ b/src/metriport/resources/fhir/types/data_requirement_sort.py @@ -0,0 +1,56 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .data_requirement_sort_direction import DataRequirementSortDirection + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class DataRequirementSort(pydantic.BaseModel): + """ + Describes a required data item for evaluation in terms of the type of data, and optional code or date-based filters of the data. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + modifier_extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + alias="modifierExtension", + description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions. Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).", + ) + path: typing.Optional[str] = pydantic.Field( + description="The attribute of the sort. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant." + ) + direction: typing.Optional[DataRequirementSortDirection] = pydantic.Field( + description="The direction of the sort, ascending or descending." + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .extension import Extension # noqa: E402 + +DataRequirementSort.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/data_requirement_sort_direction.py b/src/metriport/resources/fhir/types/data_requirement_sort_direction.py new file mode 100644 index 0000000..69f9282 --- /dev/null +++ b/src/metriport/resources/fhir/types/data_requirement_sort_direction.py @@ -0,0 +1,21 @@ +# This file was auto-generated by Fern from our API Definition. + +import enum +import typing + +T_Result = typing.TypeVar("T_Result") + + +class DataRequirementSortDirection(str, enum.Enum): + """ + The direction of the sort, ascending or descending. + """ + + ASCENDING = "ascending" + DESCENDING = "descending" + + def visit(self, ascending: typing.Callable[[], T_Result], descending: typing.Callable[[], T_Result]) -> T_Result: + if self is DataRequirementSortDirection.ASCENDING: + return ascending() + if self is DataRequirementSortDirection.DESCENDING: + return descending() diff --git a/src/metriport/resources/fhir/types/date_time.py b/src/metriport/resources/fhir/types/date_time.py new file mode 100644 index 0000000..8a83df4 --- /dev/null +++ b/src/metriport/resources/fhir/types/date_time.py @@ -0,0 +1,3 @@ +# This file was auto-generated by Fern from our API Definition. + +DateTime = str diff --git a/src/metriport/resources/fhir/types/decimal.py b/src/metriport/resources/fhir/types/decimal.py new file mode 100644 index 0000000..241ef51 --- /dev/null +++ b/src/metriport/resources/fhir/types/decimal.py @@ -0,0 +1,3 @@ +# This file was auto-generated by Fern from our API Definition. + +Decimal = float diff --git a/src/metriport/resources/fhir/types/distance.py b/src/metriport/resources/fhir/types/distance.py new file mode 100644 index 0000000..030f21f --- /dev/null +++ b/src/metriport/resources/fhir/types/distance.py @@ -0,0 +1,61 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .code import Code +from .decimal import Decimal +from .distance_comparator import DistanceComparator +from .uri import Uri + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class Distance(pydantic.BaseModel): + """ + A length - a value with a unit that is a physical distance. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + value: typing.Optional[Decimal] = pydantic.Field( + description="The value of the measured amount. The value includes an implicit precision in the presentation of the value." + ) + comparator: typing.Optional[DistanceComparator] = pydantic.Field( + description='How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is "<" , then the real value is < stated value.' + ) + unit: typing.Optional[str] = pydantic.Field(description="A human-readable form of the unit.") + system: typing.Optional[Uri] = pydantic.Field( + description="The identification of the system that provides the coded form of the unit." + ) + code: typing.Optional[Code] = pydantic.Field( + description="A computer processable form of the unit in some unit representation system." + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .extension import Extension # noqa: E402 + +Distance.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/distance_comparator.py b/src/metriport/resources/fhir/types/distance_comparator.py new file mode 100644 index 0000000..b21640f --- /dev/null +++ b/src/metriport/resources/fhir/types/distance_comparator.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import enum +import typing + +T_Result = typing.TypeVar("T_Result") + + +class DistanceComparator(str, enum.Enum): + """ + How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is "<" , then the real value is < stated value. + """ + + LESS_THAN = "<" + LESS_THAN_OR_EQUAL_TO = "<=" + GREATER_THAN_OR_EQUAL_TO = ">=" + GREATER_THAN = ">" + + def visit( + self, + less_than: typing.Callable[[], T_Result], + less_than_or_equal_to: typing.Callable[[], T_Result], + greater_than_or_equal_to: typing.Callable[[], T_Result], + greater_than: typing.Callable[[], T_Result], + ) -> T_Result: + if self is DistanceComparator.LESS_THAN: + return less_than() + if self is DistanceComparator.LESS_THAN_OR_EQUAL_TO: + return less_than_or_equal_to() + if self is DistanceComparator.GREATER_THAN_OR_EQUAL_TO: + return greater_than_or_equal_to() + if self is DistanceComparator.GREATER_THAN: + return greater_than() diff --git a/src/metriport/resources/fhir/types/document_reference.py b/src/metriport/resources/fhir/types/document_reference.py new file mode 100644 index 0000000..fc09963 --- /dev/null +++ b/src/metriport/resources/fhir/types/document_reference.py @@ -0,0 +1,92 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +import typing_extensions + +from ....core.datetime_utils import serialize_datetime +from .base_resource import BaseResource +from .code import Code +from .codeable_concept import CodeableConcept +from .document_reference_content import DocumentReferenceContent +from .document_reference_context import DocumentReferenceContext +from .document_reference_relates_to import DocumentReferenceRelatesTo +from .document_reference_status import DocumentReferenceStatus +from .identifier import Identifier +from .instant import Instant +from .reference import Reference + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class DocumentReference(BaseResource): + """ + A reference to a document of any kind for any purpose. Provides metadata about the document so that the document can be discovered and managed. The scope of a document is any seralized object with a mime-type, so includes formal patient centric documents (CDA), cliical notes, scanned paper, and non-patient specific documents like policy text. + """ + + resource_type: typing_extensions.Literal["DocumentReference"] = pydantic.Field(alias="resourceType") + master_identifier: typing.Optional[Identifier] = pydantic.Field( + alias="masterIdentifier", + description="Document identifier as assigned by the source of the document. This identifier is specific to this version of the document. This unique identifier may be used elsewhere to identify this version of the document.", + ) + identifier: typing.Optional[typing.List[Identifier]] = pydantic.Field( + description="Other identifiers associated with the document, including version independent identifiers." + ) + status: typing.Optional[DocumentReferenceStatus] = pydantic.Field( + description="The status of this document reference." + ) + doc_status: typing.Optional[Code] = pydantic.Field( + alias="docStatus", description="The status of the underlying document." + ) + type: typing.Optional[CodeableConcept] = pydantic.Field( + description="Specifies the particular kind of document referenced (e.g. History and Physical, Discharge Summary, Progress Note). This usually equates to the purpose of making the document referenced." + ) + category: typing.Optional[typing.List[CodeableConcept]] = pydantic.Field( + description="A categorization for the type of document referenced - helps for indexing and searching. This may be implied by or derived from the code specified in the DocumentReference.type." + ) + subject: typing.Optional[Reference] = pydantic.Field( + description="Who or what the document is about. The document can be about a person, (patient or healthcare practitioner), a device (e.g. a machine) or even a group of subjects (such as a document about a herd of farm animals, or a set of patients that share a common exposure)." + ) + date: typing.Optional[Instant] = pydantic.Field(description="When the document reference was created.") + author: typing.Optional[typing.List[Reference]] = pydantic.Field( + description="Identifies who is responsible for adding the information to the document." + ) + authenticator: typing.Optional[Reference] = pydantic.Field( + description="Which person or organization authenticates that this document is valid." + ) + custodian: typing.Optional[Reference] = pydantic.Field( + description="Identifies the organization or group who is responsible for ongoing maintenance of and access to the document." + ) + relates_to: typing.Optional[typing.List[DocumentReferenceRelatesTo]] = pydantic.Field( + alias="relatesTo", + description="Relationships that this document has with other document references that already exist.", + ) + description: typing.Optional[str] = pydantic.Field(description="Human-readable description of the source document.") + security_label: typing.Optional[typing.List[CodeableConcept]] = pydantic.Field( + alias="securityLabel", + description='A set of Security-Tag codes specifying the level of privacy/security of the Document. Note that DocumentReference.meta.security contains the security labels of the "reference" to the document, while DocumentReference.securityLabel contains a snapshot of the security labels on the document the reference refers to.', + ) + content: typing.List[DocumentReferenceContent] = pydantic.Field( + description="The document and format referenced. There may be multiple content element repetitions, each with a different format." + ) + context: typing.Optional[DocumentReferenceContext] = pydantic.Field( + description="The clinical context in which the document was prepared." + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/metriport/resources/fhir/types/document_reference_content.py b/src/metriport/resources/fhir/types/document_reference_content.py new file mode 100644 index 0000000..fa0f7ce --- /dev/null +++ b/src/metriport/resources/fhir/types/document_reference_content.py @@ -0,0 +1,51 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .attachment import Attachment +from .coding import Coding +from .extension import Extension + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class DocumentReferenceContent(pydantic.BaseModel): + """ + A reference to a document of any kind for any purpose. Provides metadata about the document so that the document can be discovered and managed. The scope of a document is any seralized object with a mime-type, so includes formal patient centric documents (CDA), cliical notes, scanned paper, and non-patient specific documents like policy text. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + modifier_extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + alias="modifierExtension", + description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions. Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).", + ) + attachment: Attachment = pydantic.Field( + description="The document or URL of the document along with critical metadata to prove content has integrity." + ) + format: typing.Optional[Coding] = pydantic.Field( + description="An identifier of the document encoding, structure, and template that the document conforms to beyond the base format indicated in the mimeType." + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/metriport/resources/fhir/types/document_reference_context.py b/src/metriport/resources/fhir/types/document_reference_context.py new file mode 100644 index 0000000..3303be3 --- /dev/null +++ b/src/metriport/resources/fhir/types/document_reference_context.py @@ -0,0 +1,69 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .codeable_concept import CodeableConcept +from .extension import Extension +from .period import Period +from .reference import Reference + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class DocumentReferenceContext(pydantic.BaseModel): + """ + A reference to a document of any kind for any purpose. Provides metadata about the document so that the document can be discovered and managed. The scope of a document is any seralized object with a mime-type, so includes formal patient centric documents (CDA), cliical notes, scanned paper, and non-patient specific documents like policy text. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + modifier_extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + alias="modifierExtension", + description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions. Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).", + ) + encounter: typing.Optional[typing.List[Reference]] = pydantic.Field( + description="Describes the clinical encounter or type of care that the document content is associated with." + ) + event: typing.Optional[typing.List[CodeableConcept]] = pydantic.Field( + description='This list of codes represents the main clinical acts, such as a colonoscopy or an appendectomy, being documented. In some cases, the event is inherent in the type Code, such as a "History and Physical Report" in which the procedure being documented is necessarily a "History and Physical" act.' + ) + period: typing.Optional[Period] = pydantic.Field( + description="The time period over which the service that is described by the document was provided." + ) + facility_type: typing.Optional[CodeableConcept] = pydantic.Field( + alias="facilityType", description="The kind of facility where the patient was seen." + ) + practice_setting: typing.Optional[CodeableConcept] = pydantic.Field( + alias="practiceSetting", + description="This property may convey specifics about the practice setting where the content was created, often reflecting the clinical specialty.", + ) + source_patient_info: typing.Optional[Reference] = pydantic.Field( + alias="sourcePatientInfo", + description="The Patient Information as known when the document was published. May be a reference to a version specific, or contained.", + ) + related: typing.Optional[typing.List[Reference]] = pydantic.Field( + description="Related identifiers or resources associated with the DocumentReference." + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/metriport/resources/fhir/types/document_reference_relates_to.py b/src/metriport/resources/fhir/types/document_reference_relates_to.py new file mode 100644 index 0000000..da9d896 --- /dev/null +++ b/src/metriport/resources/fhir/types/document_reference_relates_to.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .document_reference_relates_to_code import DocumentReferenceRelatesToCode +from .extension import Extension +from .reference import Reference + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class DocumentReferenceRelatesTo(pydantic.BaseModel): + """ + A reference to a document of any kind for any purpose. Provides metadata about the document so that the document can be discovered and managed. The scope of a document is any seralized object with a mime-type, so includes formal patient centric documents (CDA), cliical notes, scanned paper, and non-patient specific documents like policy text. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + modifier_extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + alias="modifierExtension", + description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions. Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).", + ) + code: typing.Optional[DocumentReferenceRelatesToCode] = pydantic.Field( + description="The type of relationship that this document has with anther document." + ) + target: Reference = pydantic.Field(description="The target document of this relationship.") + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/metriport/resources/fhir/types/document_reference_relates_to_code.py b/src/metriport/resources/fhir/types/document_reference_relates_to_code.py new file mode 100644 index 0000000..9f999e1 --- /dev/null +++ b/src/metriport/resources/fhir/types/document_reference_relates_to_code.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import enum +import typing + +T_Result = typing.TypeVar("T_Result") + + +class DocumentReferenceRelatesToCode(str, enum.Enum): + """ + The type of relationship that this document has with anther document. + """ + + REPLACES = "replaces" + TRANSFORMS = "transforms" + SIGNS = "signs" + APPENDS = "appends" + + def visit( + self, + replaces: typing.Callable[[], T_Result], + transforms: typing.Callable[[], T_Result], + signs: typing.Callable[[], T_Result], + appends: typing.Callable[[], T_Result], + ) -> T_Result: + if self is DocumentReferenceRelatesToCode.REPLACES: + return replaces() + if self is DocumentReferenceRelatesToCode.TRANSFORMS: + return transforms() + if self is DocumentReferenceRelatesToCode.SIGNS: + return signs() + if self is DocumentReferenceRelatesToCode.APPENDS: + return appends() diff --git a/src/metriport/resources/fhir/types/document_reference_status.py b/src/metriport/resources/fhir/types/document_reference_status.py new file mode 100644 index 0000000..ae8be83 --- /dev/null +++ b/src/metriport/resources/fhir/types/document_reference_status.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import enum +import typing + +T_Result = typing.TypeVar("T_Result") + + +class DocumentReferenceStatus(str, enum.Enum): + """ + The status of this document reference. + """ + + CURRENT = "current" + SUPERSEDED = "superseded" + ENTERED_IN_ERROR = "entered-in-error" + + def visit( + self, + current: typing.Callable[[], T_Result], + superseded: typing.Callable[[], T_Result], + entered_in_error: typing.Callable[[], T_Result], + ) -> T_Result: + if self is DocumentReferenceStatus.CURRENT: + return current() + if self is DocumentReferenceStatus.SUPERSEDED: + return superseded() + if self is DocumentReferenceStatus.ENTERED_IN_ERROR: + return entered_in_error() diff --git a/src/metriport/resources/fhir/types/dosage.py b/src/metriport/resources/fhir/types/dosage.py new file mode 100644 index 0000000..718b50d --- /dev/null +++ b/src/metriport/resources/fhir/types/dosage.py @@ -0,0 +1,89 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class Dosage(pydantic.BaseModel): + """ + Indicates how the medication is/was taken or should be taken by the patient. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + modifier_extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + alias="modifierExtension", + description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions. Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).", + ) + sequence: typing.Optional[int] = pydantic.Field( + description="Indicates the order in which the dosage instructions should be applied or interpreted." + ) + text: typing.Optional[str] = pydantic.Field(description="Free text dosage instructions e.g. SIG.") + additional_instruction: typing.Optional[typing.List[CodeableConcept]] = pydantic.Field( + alias="additionalInstruction", + description='Supplemental instructions to the patient on how to take the medication (e.g. "with meals" or"take half to one hour before food") or warnings for the patient about the medication (e.g. "may cause drowsiness" or "avoid exposure of skin to direct sunlight or sunlamps").', + ) + patient_instruction: typing.Optional[str] = pydantic.Field( + alias="patientInstruction", description="Instructions in terms that are understood by the patient or consumer." + ) + timing: typing.Optional[Timing] = pydantic.Field(description="When medication should be administered.") + as_needed_boolean: typing.Optional[bool] = pydantic.Field( + alias="asNeededBoolean", + description="Indicates whether the Medication is only taken when needed within a specific dosing schedule (Boolean option), or it indicates the precondition for taking the Medication (CodeableConcept).", + ) + as_needed_codeable_concept: typing.Optional[CodeableConcept] = pydantic.Field( + alias="asNeededCodeableConcept", + description="Indicates whether the Medication is only taken when needed within a specific dosing schedule (Boolean option), or it indicates the precondition for taking the Medication (CodeableConcept).", + ) + site: typing.Optional[CodeableConcept] = pydantic.Field(description="Body site to administer to.") + route: typing.Optional[CodeableConcept] = pydantic.Field(description="How drug should enter body.") + method: typing.Optional[CodeableConcept] = pydantic.Field(description="Technique for administering medication.") + dose_and_rate: typing.Optional[typing.List[DosageDoseAndRate]] = pydantic.Field( + alias="doseAndRate", description="The amount of medication administered." + ) + max_dose_per_period: typing.Optional[Ratio] = pydantic.Field( + alias="maxDosePerPeriod", description="Upper limit on medication per unit of time." + ) + max_dose_per_administration: typing.Optional[Quantity] = pydantic.Field( + alias="maxDosePerAdministration", description="Upper limit on medication per administration." + ) + max_dose_per_lifetime: typing.Optional[Quantity] = pydantic.Field( + alias="maxDosePerLifetime", description="Upper limit on medication per lifetime of the patient." + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .codeable_concept import CodeableConcept # noqa: E402 +from .dosage_dose_and_rate import DosageDoseAndRate # noqa: E402 +from .extension import Extension # noqa: E402 +from .quantity import Quantity # noqa: E402 +from .ratio import Ratio # noqa: E402 +from .timing import Timing # noqa: E402 + +Dosage.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/dosage_dose_and_rate.py b/src/metriport/resources/fhir/types/dosage_dose_and_rate.py new file mode 100644 index 0000000..9070321 --- /dev/null +++ b/src/metriport/resources/fhir/types/dosage_dose_and_rate.py @@ -0,0 +1,69 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class DosageDoseAndRate(pydantic.BaseModel): + """ + Indicates how the medication is/was taken or should be taken by the patient. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + modifier_extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + alias="modifierExtension", + description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions. Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).", + ) + type: typing.Optional[CodeableConcept] = pydantic.Field( + description="The kind of dose or rate specified, for example, ordered or calculated." + ) + dose_range: typing.Optional[Range] = pydantic.Field(alias="doseRange", description="Amount of medication per dose.") + dose_quantity: typing.Optional[Quantity] = pydantic.Field( + alias="doseQuantity", description="Amount of medication per dose." + ) + rate_ratio: typing.Optional[Ratio] = pydantic.Field( + alias="rateRatio", description="Amount of medication per unit of time." + ) + rate_range: typing.Optional[Range] = pydantic.Field( + alias="rateRange", description="Amount of medication per unit of time." + ) + rate_quantity: typing.Optional[Quantity] = pydantic.Field( + alias="rateQuantity", description="Amount of medication per unit of time." + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .codeable_concept import CodeableConcept # noqa: E402 +from .extension import Extension # noqa: E402 +from .quantity import Quantity # noqa: E402 +from .range import Range # noqa: E402 +from .ratio import Ratio # noqa: E402 + +DosageDoseAndRate.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/duration.py b/src/metriport/resources/fhir/types/duration.py new file mode 100644 index 0000000..a0ab636 --- /dev/null +++ b/src/metriport/resources/fhir/types/duration.py @@ -0,0 +1,61 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .code import Code +from .decimal import Decimal +from .duration_comparator import DurationComparator +from .uri import Uri + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class Duration(pydantic.BaseModel): + """ + A length of time. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + value: typing.Optional[Decimal] = pydantic.Field( + description="The value of the measured amount. The value includes an implicit precision in the presentation of the value." + ) + comparator: typing.Optional[DurationComparator] = pydantic.Field( + description='How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is "<" , then the real value is < stated value.' + ) + unit: typing.Optional[str] = pydantic.Field(description="A human-readable form of the unit.") + system: typing.Optional[Uri] = pydantic.Field( + description="The identification of the system that provides the coded form of the unit." + ) + code: typing.Optional[Code] = pydantic.Field( + description="A computer processable form of the unit in some unit representation system." + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .extension import Extension # noqa: E402 + +Duration.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/duration_comparator.py b/src/metriport/resources/fhir/types/duration_comparator.py new file mode 100644 index 0000000..c1c351f --- /dev/null +++ b/src/metriport/resources/fhir/types/duration_comparator.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import enum +import typing + +T_Result = typing.TypeVar("T_Result") + + +class DurationComparator(str, enum.Enum): + """ + How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is "<" , then the real value is < stated value. + """ + + LESS_THAN = "<" + LESS_THAN_OR_EQUAL_TO = "<=" + GREATER_THAN_OR_EQUAL_TO = ">=" + GREATER_THAN = ">" + + def visit( + self, + less_than: typing.Callable[[], T_Result], + less_than_or_equal_to: typing.Callable[[], T_Result], + greater_than_or_equal_to: typing.Callable[[], T_Result], + greater_than: typing.Callable[[], T_Result], + ) -> T_Result: + if self is DurationComparator.LESS_THAN: + return less_than() + if self is DurationComparator.LESS_THAN_OR_EQUAL_TO: + return less_than_or_equal_to() + if self is DurationComparator.GREATER_THAN_OR_EQUAL_TO: + return greater_than_or_equal_to() + if self is DurationComparator.GREATER_THAN: + return greater_than() diff --git a/src/metriport/resources/fhir/types/expression.py b/src/metriport/resources/fhir/types/expression.py new file mode 100644 index 0000000..960e148 --- /dev/null +++ b/src/metriport/resources/fhir/types/expression.py @@ -0,0 +1,60 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .expression_language import ExpressionLanguage +from .id import Id +from .uri import Uri + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class Expression(pydantic.BaseModel): + """ + A expression that is evaluated in a specified context and returns a value. The context of use of the expression must specify the context in which the expression is evaluated, and how the result of the expression is used. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + description: typing.Optional[str] = pydantic.Field( + description="A brief, natural language description of the condition that effectively communicates the intended semantics." + ) + name: typing.Optional[Id] = pydantic.Field( + description="A short name assigned to the expression to allow for multiple reuse of the expression in the context where it is defined." + ) + language: typing.Optional[ExpressionLanguage] = pydantic.Field( + description="The media type of the language for the expression." + ) + expression: typing.Optional[str] = pydantic.Field( + description="An expression in the specified language that returns a value." + ) + reference: typing.Optional[Uri] = pydantic.Field(description="A URI that defines where the expression is found.") + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .extension import Extension # noqa: E402 + +Expression.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/expression_language.py b/src/metriport/resources/fhir/types/expression_language.py new file mode 100644 index 0000000..5ec471a --- /dev/null +++ b/src/metriport/resources/fhir/types/expression_language.py @@ -0,0 +1,29 @@ +# This file was auto-generated by Fern from our API Definition. + +import enum +import typing + +T_Result = typing.TypeVar("T_Result") + + +class ExpressionLanguage(str, enum.Enum): + """ + The media type of the language for the expression. + """ + + TEXT_CQL = "text/cql" + TEXT_FHIRPATH = "text/fhirpath" + APPLICATION_X_FHIR_QUERY = "application/x-fhir-query" + + def visit( + self, + text_cql: typing.Callable[[], T_Result], + text_fhirpath: typing.Callable[[], T_Result], + application_x_fhir_query: typing.Callable[[], T_Result], + ) -> T_Result: + if self is ExpressionLanguage.TEXT_CQL: + return text_cql() + if self is ExpressionLanguage.TEXT_FHIRPATH: + return text_fhirpath() + if self is ExpressionLanguage.APPLICATION_X_FHIR_QUERY: + return application_x_fhir_query() diff --git a/src/metriport/resources/fhir/types/extension.py b/src/metriport/resources/fhir/types/extension.py new file mode 100644 index 0000000..ee3950c --- /dev/null +++ b/src/metriport/resources/fhir/types/extension.py @@ -0,0 +1,279 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .uri import Uri + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class Extension(pydantic.BaseModel): + """ + Optional Extension Element - found in all resources. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + url: typing.Optional[Uri] = pydantic.Field( + description="Source of the definition for the extension code - a logical name or a URL." + ) + value_base_64_binary: typing.Optional[str] = pydantic.Field( + alias="valueBase64Binary", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_boolean: typing.Optional[bool] = pydantic.Field( + alias="valueBoolean", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_canonical: typing.Optional[str] = pydantic.Field( + alias="valueCanonical", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_code: typing.Optional[str] = pydantic.Field( + alias="valueCode", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_date: typing.Optional[str] = pydantic.Field( + alias="valueDate", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_date_time: typing.Optional[str] = pydantic.Field( + alias="valueDateTime", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_decimal: typing.Optional[float] = pydantic.Field( + alias="valueDecimal", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_id: typing.Optional[str] = pydantic.Field( + alias="valueId", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_instant: typing.Optional[str] = pydantic.Field( + alias="valueInstant", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_integer: typing.Optional[float] = pydantic.Field( + alias="valueInteger", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_markdown: typing.Optional[str] = pydantic.Field( + alias="valueMarkdown", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_oid: typing.Optional[str] = pydantic.Field( + alias="valueOid", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_positive_int: typing.Optional[float] = pydantic.Field( + alias="valuePositiveInt", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_string: typing.Optional[str] = pydantic.Field( + alias="valueString", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_time: typing.Optional[str] = pydantic.Field( + alias="valueTime", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_unsigned_int: typing.Optional[float] = pydantic.Field( + alias="valueUnsignedInt", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_uri: typing.Optional[str] = pydantic.Field( + alias="valueUri", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_url: typing.Optional[str] = pydantic.Field( + alias="valueUrl", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_uuid: typing.Optional[str] = pydantic.Field( + alias="valueUuid", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_address: typing.Optional[Address] = pydantic.Field( + alias="valueAddress", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_age: typing.Optional[Age] = pydantic.Field( + alias="valueAge", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_annotation: typing.Optional[Annotation] = pydantic.Field( + alias="valueAnnotation", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_attachment: typing.Optional[Attachment] = pydantic.Field( + alias="valueAttachment", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_codeable_concept: typing.Optional[CodeableConcept] = pydantic.Field( + alias="valueCodeableConcept", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_coding: typing.Optional[Coding] = pydantic.Field( + alias="valueCoding", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_contact_point: typing.Optional[ContactPoint] = pydantic.Field( + alias="valueContactPoint", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_count: typing.Optional[Count] = pydantic.Field( + alias="valueCount", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_distance: typing.Optional[Distance] = pydantic.Field( + alias="valueDistance", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_duration: typing.Optional[Duration] = pydantic.Field( + alias="valueDuration", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_human_name: typing.Optional[HumanName] = pydantic.Field( + alias="valueHumanName", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_identifier: typing.Optional[Identifier] = pydantic.Field( + alias="valueIdentifier", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_money: typing.Optional[Money] = pydantic.Field( + alias="valueMoney", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_period: typing.Optional[Period] = pydantic.Field( + alias="valuePeriod", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_quantity: typing.Optional[Quantity] = pydantic.Field( + alias="valueQuantity", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_range: typing.Optional[Range] = pydantic.Field( + alias="valueRange", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_ratio: typing.Optional[Ratio] = pydantic.Field( + alias="valueRatio", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_reference: typing.Optional[Reference] = pydantic.Field( + alias="valueReference", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_sampled_data: typing.Optional[SampledData] = pydantic.Field( + alias="valueSampledData", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_signature: typing.Optional[Signature] = pydantic.Field( + alias="valueSignature", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_timing: typing.Optional[Timing] = pydantic.Field( + alias="valueTiming", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_contact_detail: typing.Optional[ContactDetail] = pydantic.Field( + alias="valueContactDetail", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_contributor: typing.Optional[Contributor] = pydantic.Field( + alias="valueContributor", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_data_requirement: typing.Optional[DataRequirement] = pydantic.Field( + alias="valueDataRequirement", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_expression: typing.Optional[Expression] = pydantic.Field( + alias="valueExpression", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_parameter_definition: typing.Optional[ParameterDefinition] = pydantic.Field( + alias="valueParameterDefinition", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_related_artifact: typing.Optional[RelatedArtifact] = pydantic.Field( + alias="valueRelatedArtifact", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_trigger_definition: typing.Optional[TriggerDefinition] = pydantic.Field( + alias="valueTriggerDefinition", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_usage_context: typing.Optional[UsageContext] = pydantic.Field( + alias="valueUsageContext", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_dosage: typing.Optional[Dosage] = pydantic.Field( + alias="valueDosage", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + value_meta: typing.Optional[Meta] = pydantic.Field( + alias="valueMeta", + description="Value of extension - must be one of a constrained set of the data types (see [Extensibility](extensibility.html) for a list).", + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .address import Address # noqa: E402 +from .age import Age # noqa: E402 +from .annotation import Annotation # noqa: E402 +from .attachment import Attachment # noqa: E402 +from .codeable_concept import CodeableConcept # noqa: E402 +from .coding import Coding # noqa: E402 +from .contact_detail import ContactDetail # noqa: E402 +from .contact_point import ContactPoint # noqa: E402 +from .contributor import Contributor # noqa: E402 +from .count import Count # noqa: E402 +from .data_requirement import DataRequirement # noqa: E402 +from .distance import Distance # noqa: E402 +from .dosage import Dosage # noqa: E402 +from .duration import Duration # noqa: E402 +from .expression import Expression # noqa: E402 +from .human_name import HumanName # noqa: E402 +from .identifier import Identifier # noqa: E402 +from .meta import Meta # noqa: E402 +from .money import Money # noqa: E402 +from .parameter_definition import ParameterDefinition # noqa: E402 +from .period import Period # noqa: E402 +from .quantity import Quantity # noqa: E402 +from .range import Range # noqa: E402 +from .ratio import Ratio # noqa: E402 +from .reference import Reference # noqa: E402 +from .related_artifact import RelatedArtifact # noqa: E402 +from .sampled_data import SampledData # noqa: E402 +from .signature import Signature # noqa: E402 +from .timing import Timing # noqa: E402 +from .trigger_definition import TriggerDefinition # noqa: E402 +from .usage_context import UsageContext # noqa: E402 + +Extension.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/human_name.py b/src/metriport/resources/fhir/types/human_name.py new file mode 100644 index 0000000..3670205 --- /dev/null +++ b/src/metriport/resources/fhir/types/human_name.py @@ -0,0 +1,63 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .human_name_use import HumanNameUse + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class HumanName(pydantic.BaseModel): + """ + A human's name with the ability to identify parts and usage. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + use: typing.Optional[HumanNameUse] = pydantic.Field(description="Identifies the purpose for this name.") + text: typing.Optional[str] = pydantic.Field( + description="Specifies the entire name as it should be displayed e.g. on an application UI. This may be provided instead of or as well as the specific parts." + ) + family: typing.Optional[str] = pydantic.Field( + description="The part of a name that links to the genealogy. In some cultures (e.g. Eritrea) the family name of a son is the first name of his father." + ) + given: typing.Optional[typing.List[str]] = pydantic.Field(description="Given name.") + prefix: typing.Optional[typing.List[str]] = pydantic.Field( + description="Part of the name that is acquired as a title due to academic, legal, employment or nobility status, etc. and that appears at the start of the name." + ) + suffix: typing.Optional[typing.List[str]] = pydantic.Field( + description="Part of the name that is acquired as a title due to academic, legal, employment or nobility status, etc. and that appears at the end of the name." + ) + period: typing.Optional[Period] = pydantic.Field( + description="Indicates the period of time when this name was valid for the named person." + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .extension import Extension # noqa: E402 +from .period import Period # noqa: E402 + +HumanName.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/human_name_use.py b/src/metriport/resources/fhir/types/human_name_use.py new file mode 100644 index 0000000..9e2a44e --- /dev/null +++ b/src/metriport/resources/fhir/types/human_name_use.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +import enum +import typing + +T_Result = typing.TypeVar("T_Result") + + +class HumanNameUse(str, enum.Enum): + """ + Identifies the purpose for this name. + """ + + USUAL = "usual" + OFFICIAL = "official" + TEMP = "temp" + NICKNAME = "nickname" + ANONYMOUS = "anonymous" + OLD = "old" + MAIDEN = "maiden" + + def visit( + self, + usual: typing.Callable[[], T_Result], + official: typing.Callable[[], T_Result], + temp: typing.Callable[[], T_Result], + nickname: typing.Callable[[], T_Result], + anonymous: typing.Callable[[], T_Result], + old: typing.Callable[[], T_Result], + maiden: typing.Callable[[], T_Result], + ) -> T_Result: + if self is HumanNameUse.USUAL: + return usual() + if self is HumanNameUse.OFFICIAL: + return official() + if self is HumanNameUse.TEMP: + return temp() + if self is HumanNameUse.NICKNAME: + return nickname() + if self is HumanNameUse.ANONYMOUS: + return anonymous() + if self is HumanNameUse.OLD: + return old() + if self is HumanNameUse.MAIDEN: + return maiden() diff --git a/src/metriport/resources/fhir/types/id.py b/src/metriport/resources/fhir/types/id.py new file mode 100644 index 0000000..f066d64 --- /dev/null +++ b/src/metriport/resources/fhir/types/id.py @@ -0,0 +1,3 @@ +# This file was auto-generated by Fern from our API Definition. + +Id = str diff --git a/src/metriport/resources/fhir/types/identifier.py b/src/metriport/resources/fhir/types/identifier.py new file mode 100644 index 0000000..5a64f80 --- /dev/null +++ b/src/metriport/resources/fhir/types/identifier.py @@ -0,0 +1,65 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .identifier_use import IdentifierUse +from .uri import Uri + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class Identifier(pydantic.BaseModel): + """ + An identifier - identifies some entity uniquely and unambiguously. Typically this is used for business identifiers. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + use: typing.Optional[IdentifierUse] = pydantic.Field(description="The purpose of this identifier.") + type: typing.Optional[CodeableConcept] = pydantic.Field( + description="A coded type for the identifier that can be used to determine which identifier to use for a specific purpose." + ) + system: typing.Optional[Uri] = pydantic.Field( + description="Establishes the namespace for the value - that is, a URL that describes a set values that are unique." + ) + value: typing.Optional[str] = pydantic.Field( + description="The portion of the identifier typically relevant to the user and which is unique within the context of the system." + ) + period: typing.Optional[Period] = pydantic.Field( + description="Time period during which identifier is/was valid for use." + ) + assigner: typing.Optional[Reference] = pydantic.Field( + description="Organization that issued/manages the identifier." + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .codeable_concept import CodeableConcept # noqa: E402 +from .extension import Extension # noqa: E402 +from .period import Period # noqa: E402 +from .reference import Reference # noqa: E402 + +Identifier.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/identifier_use.py b/src/metriport/resources/fhir/types/identifier_use.py new file mode 100644 index 0000000..6323dd9 --- /dev/null +++ b/src/metriport/resources/fhir/types/identifier_use.py @@ -0,0 +1,37 @@ +# This file was auto-generated by Fern from our API Definition. + +import enum +import typing + +T_Result = typing.TypeVar("T_Result") + + +class IdentifierUse(str, enum.Enum): + """ + The purpose of this identifier. + """ + + USUAL = "usual" + OFFICIAL = "official" + TEMP = "temp" + SECONDARY = "secondary" + OLD = "old" + + def visit( + self, + usual: typing.Callable[[], T_Result], + official: typing.Callable[[], T_Result], + temp: typing.Callable[[], T_Result], + secondary: typing.Callable[[], T_Result], + old: typing.Callable[[], T_Result], + ) -> T_Result: + if self is IdentifierUse.USUAL: + return usual() + if self is IdentifierUse.OFFICIAL: + return official() + if self is IdentifierUse.TEMP: + return temp() + if self is IdentifierUse.SECONDARY: + return secondary() + if self is IdentifierUse.OLD: + return old() diff --git a/src/metriport/resources/fhir/types/instant.py b/src/metriport/resources/fhir/types/instant.py new file mode 100644 index 0000000..060202b --- /dev/null +++ b/src/metriport/resources/fhir/types/instant.py @@ -0,0 +1,3 @@ +# This file was auto-generated by Fern from our API Definition. + +Instant = str diff --git a/src/metriport/resources/fhir/types/markdown.py b/src/metriport/resources/fhir/types/markdown.py new file mode 100644 index 0000000..45b3211 --- /dev/null +++ b/src/metriport/resources/fhir/types/markdown.py @@ -0,0 +1,3 @@ +# This file was auto-generated by Fern from our API Definition. + +Markdown = str diff --git a/src/metriport/resources/fhir/types/meta.py b/src/metriport/resources/fhir/types/meta.py new file mode 100644 index 0000000..fb24c05 --- /dev/null +++ b/src/metriport/resources/fhir/types/meta.py @@ -0,0 +1,80 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .canonical import Canonical +from .id import Id +from .instant import Instant +from .uri import Uri + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class Meta(pydantic.BaseModel): + """ + The metadata about a resource. This is content in the resource that is maintained by the infrastructure. Changes to the content might not always be associated with version changes to the resource. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + version_id: typing.Optional[Id] = pydantic.Field( + alias="versionId", + description="The version specific identifier, as it appears in the version portion of the URL. This value changes when the resource is created, updated, or deleted.", + ) + last_updated: typing.Optional[Instant] = pydantic.Field( + alias="lastUpdated", description="When the resource last changed - e.g. when the version changed." + ) + source: typing.Optional[Uri] = pydantic.Field( + description="A uri that identifies the source system of the resource. This provides a minimal amount of [[[Provenance]]] information that can be used to track or differentiate the source of information in the resource. The source may identify another FHIR server, document, message, database, etc." + ) + profile: typing.Optional[typing.List[Canonical]] = pydantic.Field( + description="A list of profiles (references to [[[StructureDefinition]]] resources) that this resource claims to conform to. The URL is a reference to [[[StructureDefinition.url]]]." + ) + security: typing.Optional[typing.List[Coding]] = pydantic.Field( + description="Security labels applied to this resource. These tags connect specific resources to the overall security policy and infrastructure." + ) + tag: typing.Optional[typing.List[Coding]] = pydantic.Field( + description="Tags applied to this resource. Tags are intended to be used to identify and relate resources to process and workflow, and applications are not required to consider the tags when interpreting the meaning of a resource." + ) + project: typing.Optional[Uri] = pydantic.Field(description="The project that contains this resource.") + author: typing.Optional[Reference] = pydantic.Field( + description="The individual, device or organization who initiated the last change." + ) + account: typing.Optional[Reference] = pydantic.Field( + description="Optional account reference that can be used for sub-project compartments." + ) + compartment: typing.Optional[typing.List[Reference]] = pydantic.Field( + description="The list of compartments containing this resource. This is readonly and is set by the server." + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .coding import Coding # noqa: E402 +from .extension import Extension # noqa: E402 +from .reference import Reference # noqa: E402 + +Meta.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/money.py b/src/metriport/resources/fhir/types/money.py new file mode 100644 index 0000000..ac179fb --- /dev/null +++ b/src/metriport/resources/fhir/types/money.py @@ -0,0 +1,48 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .code import Code +from .decimal import Decimal + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class Money(pydantic.BaseModel): + """ + An amount of economic utility in some recognized currency. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + value: typing.Optional[Decimal] = pydantic.Field(description="Numerical value (with implicit precision).") + currency: typing.Optional[Code] = pydantic.Field(description="ISO 4217 Currency Code.") + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .extension import Extension # noqa: E402 + +Money.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/narrative.py b/src/metriport/resources/fhir/types/narrative.py new file mode 100644 index 0000000..509c520 --- /dev/null +++ b/src/metriport/resources/fhir/types/narrative.py @@ -0,0 +1,44 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .extension import Extension +from .narrative_status import NarrativeStatus +from .xhtml import Xhtml + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class Narrative(pydantic.BaseModel): + """ + A human-readable summary of the resource conveying the essential clinical and business information for the resource. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + status: typing.Optional[NarrativeStatus] = pydantic.Field( + description="The status of the narrative - whether it's entirely generated (from just the defined data or the extensions too), or whether a human authored it and it may contain additional data." + ) + div: Xhtml = pydantic.Field(description="The actual narrative content, a stripped down version of XHTML.") + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/metriport/resources/fhir/types/narrative_status.py b/src/metriport/resources/fhir/types/narrative_status.py new file mode 100644 index 0000000..aa82aaa --- /dev/null +++ b/src/metriport/resources/fhir/types/narrative_status.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import enum +import typing + +T_Result = typing.TypeVar("T_Result") + + +class NarrativeStatus(str, enum.Enum): + """ + The status of the narrative - whether it's entirely generated (from just the defined data or the extensions too), or whether a human authored it and it may contain additional data. + """ + + GENERATED = "generated" + EXTENSIONS = "extensions" + ADDITIONAL = "additional" + EMPTY = "empty" + + def visit( + self, + generated: typing.Callable[[], T_Result], + extensions: typing.Callable[[], T_Result], + additional: typing.Callable[[], T_Result], + empty: typing.Callable[[], T_Result], + ) -> T_Result: + if self is NarrativeStatus.GENERATED: + return generated() + if self is NarrativeStatus.EXTENSIONS: + return extensions() + if self is NarrativeStatus.ADDITIONAL: + return additional() + if self is NarrativeStatus.EMPTY: + return empty() diff --git a/src/metriport/resources/fhir/types/parameter_definition.py b/src/metriport/resources/fhir/types/parameter_definition.py new file mode 100644 index 0000000..16c7a6e --- /dev/null +++ b/src/metriport/resources/fhir/types/parameter_definition.py @@ -0,0 +1,63 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .canonical import Canonical +from .code import Code + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class ParameterDefinition(pydantic.BaseModel): + """ + The parameters to the module. This collection specifies both the input and output parameters. Input parameters are provided by the caller as part of the $evaluate operation. Output parameters are included in the GuidanceResponse. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + name: typing.Optional[Code] = pydantic.Field( + description="The name of the parameter used to allow access to the value of the parameter in evaluation contexts." + ) + use: typing.Optional[Code] = pydantic.Field(description="Whether the parameter is input or output for the module.") + min: typing.Optional[int] = pydantic.Field( + description="The minimum number of times this parameter SHALL appear in the request or response." + ) + max: typing.Optional[str] = pydantic.Field( + description="The maximum number of times this element is permitted to appear in the request or response." + ) + documentation: typing.Optional[str] = pydantic.Field( + description="A brief discussion of what the parameter is for and how it is used by the module." + ) + type: typing.Optional[Code] = pydantic.Field(description="The type of the parameter.") + profile: typing.Optional[Canonical] = pydantic.Field( + description="If specified, this indicates a profile that the input data must conform to, or that the output data will conform to." + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .extension import Extension # noqa: E402 + +ParameterDefinition.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/period.py b/src/metriport/resources/fhir/types/period.py new file mode 100644 index 0000000..dca15e4 --- /dev/null +++ b/src/metriport/resources/fhir/types/period.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .date_time import DateTime + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class Period(pydantic.BaseModel): + """ + A time period defined by a start and end date and optionally time. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + start: typing.Optional[DateTime] = pydantic.Field(description="The start of the period. The boundary is inclusive.") + end: typing.Optional[DateTime] = pydantic.Field( + description="The end of the period. If the end of the period is missing, it means no end was known or planned at the time the instance was created. The start may be in the past, and the end date in the future, which means that period is expected/planned to end at that time." + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .extension import Extension # noqa: E402 + +Period.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/positive_int.py b/src/metriport/resources/fhir/types/positive_int.py new file mode 100644 index 0000000..8800951 --- /dev/null +++ b/src/metriport/resources/fhir/types/positive_int.py @@ -0,0 +1,3 @@ +# This file was auto-generated by Fern from our API Definition. + +PositiveInt = float diff --git a/src/metriport/resources/fhir/types/quantity.py b/src/metriport/resources/fhir/types/quantity.py new file mode 100644 index 0000000..181aba4 --- /dev/null +++ b/src/metriport/resources/fhir/types/quantity.py @@ -0,0 +1,61 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .code import Code +from .decimal import Decimal +from .quantity_comparator import QuantityComparator +from .uri import Uri + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class Quantity(pydantic.BaseModel): + """ + A measured amount (or an amount that can potentially be measured). Note that measured amounts include amounts that are not precisely quantified, including amounts involving arbitrary units and floating currencies. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + value: typing.Optional[Decimal] = pydantic.Field( + description="The value of the measured amount. The value includes an implicit precision in the presentation of the value." + ) + comparator: typing.Optional[QuantityComparator] = pydantic.Field( + description='How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is "<" , then the real value is < stated value.' + ) + unit: typing.Optional[str] = pydantic.Field(description="A human-readable form of the unit.") + system: typing.Optional[Uri] = pydantic.Field( + description="The identification of the system that provides the coded form of the unit." + ) + code: typing.Optional[Code] = pydantic.Field( + description="A computer processable form of the unit in some unit representation system." + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .extension import Extension # noqa: E402 + +Quantity.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/quantity_comparator.py b/src/metriport/resources/fhir/types/quantity_comparator.py new file mode 100644 index 0000000..09061f3 --- /dev/null +++ b/src/metriport/resources/fhir/types/quantity_comparator.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import enum +import typing + +T_Result = typing.TypeVar("T_Result") + + +class QuantityComparator(str, enum.Enum): + """ + How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is "<" , then the real value is < stated value. + """ + + LESS_THAN = "<" + LESS_THAN_OR_EQUAL_TO = "<=" + GREATER_THAN_OR_EQUAL_TO = ">=" + GREATER_THAN = ">" + + def visit( + self, + less_than: typing.Callable[[], T_Result], + less_than_or_equal_to: typing.Callable[[], T_Result], + greater_than_or_equal_to: typing.Callable[[], T_Result], + greater_than: typing.Callable[[], T_Result], + ) -> T_Result: + if self is QuantityComparator.LESS_THAN: + return less_than() + if self is QuantityComparator.LESS_THAN_OR_EQUAL_TO: + return less_than_or_equal_to() + if self is QuantityComparator.GREATER_THAN_OR_EQUAL_TO: + return greater_than_or_equal_to() + if self is QuantityComparator.GREATER_THAN: + return greater_than() diff --git a/src/metriport/resources/fhir/types/range.py b/src/metriport/resources/fhir/types/range.py new file mode 100644 index 0000000..82181e7 --- /dev/null +++ b/src/metriport/resources/fhir/types/range.py @@ -0,0 +1,47 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class Range(pydantic.BaseModel): + """ + A set of ordered Quantities defined by a low and high limit. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + low: typing.Optional[Quantity] = pydantic.Field(description="The low limit. The boundary is inclusive.") + high: typing.Optional[Quantity] = pydantic.Field(description="The high limit. The boundary is inclusive.") + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .extension import Extension # noqa: E402 +from .quantity import Quantity # noqa: E402 + +Range.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/ratio.py b/src/metriport/resources/fhir/types/ratio.py new file mode 100644 index 0000000..8765e15 --- /dev/null +++ b/src/metriport/resources/fhir/types/ratio.py @@ -0,0 +1,47 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class Ratio(pydantic.BaseModel): + """ + A relationship of two Quantity values - expressed as a numerator and a denominator. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + numerator: typing.Optional[Quantity] = pydantic.Field(description="The value of the numerator.") + denominator: typing.Optional[Quantity] = pydantic.Field(description="The value of the denominator.") + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .extension import Extension # noqa: E402 +from .quantity import Quantity # noqa: E402 + +Ratio.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/reference.py b/src/metriport/resources/fhir/types/reference.py new file mode 100644 index 0000000..4cda258 --- /dev/null +++ b/src/metriport/resources/fhir/types/reference.py @@ -0,0 +1,59 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .uri import Uri + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class Reference(pydantic.BaseModel): + """ + A reference from one resource to another. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + reference: typing.Optional[str] = pydantic.Field( + description="A reference to a location at which the other resource is found. The reference may be a relative reference, in which case it is relative to the service base URL, or an absolute URL that resolves to the location where the resource is found. The reference may be version specific or not. If the reference is not to a FHIR RESTful server, then it should be assumed to be version specific. Internal fragment references (start with '#') refer to contained resources." + ) + type: typing.Optional[Uri] = pydantic.Field( + description='The expected type of the target of the reference. If both Reference.type and Reference.reference are populated and Reference.reference is a FHIR URL, both SHALL be consistent. The type is the Canonical URL of Resource Definition that is the type this reference refers to. References are URLs that are relative to http://hl7.org/fhir/StructureDefinition/ e.g. "Patient" is a reference to http://hl7.org/fhir/StructureDefinition/Patient. Absolute URLs are only allowed for logical models (and can only be used in references in logical models, not resources).' + ) + identifier: typing.Optional[Identifier] = pydantic.Field( + description="An identifier for the target resource. This is used when there is no way to reference the other resource directly, either because the entity it represents is not available through a FHIR server, or because there is no way for the author of the resource to convert a known identifier to an actual location. There is no requirement that a Reference.identifier point to something that is actually exposed as a FHIR instance, but it SHALL point to a business concept that would be expected to be exposed as a FHIR instance, and that instance would need to be of a FHIR resource type allowed by the reference." + ) + display: typing.Optional[str] = pydantic.Field( + description="Plain text narrative that identifies the resource in addition to the resource reference." + ) + resource: typing.Any = pydantic.Field(description="Optional Resource referred to by this reference.") + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .extension import Extension # noqa: E402 +from .identifier import Identifier # noqa: E402 + +Reference.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/related_artifact.py b/src/metriport/resources/fhir/types/related_artifact.py new file mode 100644 index 0000000..7bd0329 --- /dev/null +++ b/src/metriport/resources/fhir/types/related_artifact.py @@ -0,0 +1,70 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .canonical import Canonical +from .markdown import Markdown +from .related_artifact_type import RelatedArtifactType +from .url import Url + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class RelatedArtifact(pydantic.BaseModel): + """ + Related artifacts such as additional documentation, justification, or bibliographic references. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + type: typing.Optional[RelatedArtifactType] = pydantic.Field( + description="The type of relationship to the related artifact." + ) + label: typing.Optional[str] = pydantic.Field( + description="A short label that can be used to reference the citation from elsewhere in the containing artifact, such as a footnote index." + ) + display: typing.Optional[str] = pydantic.Field( + description="A brief description of the document or knowledge resource being referenced, suitable for display to a consumer." + ) + citation: typing.Optional[Markdown] = pydantic.Field( + description="A bibliographic citation for the related artifact. This text SHOULD be formatted according to an accepted citation format." + ) + url: typing.Optional[Url] = pydantic.Field( + description="A url for the artifact that can be followed to access the actual content." + ) + document: typing.Optional[Attachment] = pydantic.Field( + description="The document being referenced, represented as an attachment. This is exclusive with the resource element." + ) + resource: typing.Optional[Canonical] = pydantic.Field( + description="The related resource, such as a library, value set, profile, or other knowledge resource." + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .attachment import Attachment # noqa: E402 +from .extension import Extension # noqa: E402 + +RelatedArtifact.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/related_artifact_type.py b/src/metriport/resources/fhir/types/related_artifact_type.py new file mode 100644 index 0000000..aeb849a --- /dev/null +++ b/src/metriport/resources/fhir/types/related_artifact_type.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +import enum +import typing + +T_Result = typing.TypeVar("T_Result") + + +class RelatedArtifactType(str, enum.Enum): + """ + The type of relationship to the related artifact. + """ + + DOCUMENTATION = "documentation" + JUSTIFICATION = "justification" + CITATION = "citation" + PREDECESSOR = "predecessor" + SUCCESSOR = "successor" + DERIVED_FROM = "derived-from" + DEPENDS_ON = "depends-on" + COMPOSED_OF = "composed-of" + + def visit( + self, + documentation: typing.Callable[[], T_Result], + justification: typing.Callable[[], T_Result], + citation: typing.Callable[[], T_Result], + predecessor: typing.Callable[[], T_Result], + successor: typing.Callable[[], T_Result], + derived_from: typing.Callable[[], T_Result], + depends_on: typing.Callable[[], T_Result], + composed_of: typing.Callable[[], T_Result], + ) -> T_Result: + if self is RelatedArtifactType.DOCUMENTATION: + return documentation() + if self is RelatedArtifactType.JUSTIFICATION: + return justification() + if self is RelatedArtifactType.CITATION: + return citation() + if self is RelatedArtifactType.PREDECESSOR: + return predecessor() + if self is RelatedArtifactType.SUCCESSOR: + return successor() + if self is RelatedArtifactType.DERIVED_FROM: + return derived_from() + if self is RelatedArtifactType.DEPENDS_ON: + return depends_on() + if self is RelatedArtifactType.COMPOSED_OF: + return composed_of() diff --git a/src/metriport/resources/fhir/types/sampled_data.py b/src/metriport/resources/fhir/types/sampled_data.py new file mode 100644 index 0000000..0a387cb --- /dev/null +++ b/src/metriport/resources/fhir/types/sampled_data.py @@ -0,0 +1,71 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .decimal import Decimal +from .positive_int import PositiveInt + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class SampledData(pydantic.BaseModel): + """ + A series of measurements taken by a device, with upper and lower limits. There may be more than one dimension in the data. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + origin: Quantity = pydantic.Field( + description="The base quantity that a measured value of zero represents. In addition, this provides the units of the entire measurement series." + ) + period: typing.Optional[Decimal] = pydantic.Field( + description="The length of time between sampling times, measured in milliseconds." + ) + factor: typing.Optional[Decimal] = pydantic.Field( + description="A correction factor that is applied to the sampled data points before they are added to the origin." + ) + lower_limit: typing.Optional[Decimal] = pydantic.Field( + alias="lowerLimit", + description='The lower limit of detection of the measured points. This is needed if any of the data points have the value "L" (lower than detection limit).', + ) + upper_limit: typing.Optional[Decimal] = pydantic.Field( + alias="upperLimit", + description='The upper limit of detection of the measured points. This is needed if any of the data points have the value "U" (higher than detection limit).', + ) + dimensions: typing.Optional[PositiveInt] = pydantic.Field( + description="The number of sample points at each time point. If this value is greater than one, then the dimensions will be interlaced - all the sample points for a point in time will be recorded at once." + ) + data: typing.Optional[str] = pydantic.Field( + description='A series of data points which are decimal values separated by a single space (character u20). The special values "E" (error), "L" (below detection limit) and "U" (above detection limit) can also be used in place of a decimal value.' + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .extension import Extension # noqa: E402 +from .quantity import Quantity # noqa: E402 + +SampledData.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/signature.py b/src/metriport/resources/fhir/types/signature.py new file mode 100644 index 0000000..992a992 --- /dev/null +++ b/src/metriport/resources/fhir/types/signature.py @@ -0,0 +1,72 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .base_64_binary import Base64Binary +from .code import Code +from .instant import Instant + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class Signature(pydantic.BaseModel): + """ + A signature along with supporting context. The signature may be a digital signature that is cryptographic in nature, or some other signature acceptable to the domain. This other signature may be as simple as a graphical image representing a hand-written signature, or a signature ceremony Different signature approaches have different utilities. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + type: typing.List[Coding] = pydantic.Field( + description="An indication of the reason that the entity signed this document. This may be explicitly included as part of the signature information and can be used when determining accountability for various actions concerning the document." + ) + when: typing.Optional[Instant] = pydantic.Field(description="When the digital signature was signed.") + who: Reference = pydantic.Field( + description="A reference to an application-usable description of the identity that signed (e.g. the signature used their private key)." + ) + on_behalf_of: typing.Optional[Reference] = pydantic.Field( + alias="onBehalfOf", + description="A reference to an application-usable description of the identity that is represented by the signature.", + ) + target_format: typing.Optional[Code] = pydantic.Field( + alias="targetFormat", + description="A mime type that indicates the technical format of the target resources signed by the signature.", + ) + sig_format: typing.Optional[Code] = pydantic.Field( + alias="sigFormat", + description="A mime type that indicates the technical format of the signature. Important mime types are application/signature+xml for X ML DigSig, application/jose for JWS, and image/\* for a graphical image of a signature, etc.", + ) + data: typing.Optional[Base64Binary] = pydantic.Field( + description="The base64 encoding of the Signature content. When signature is not recorded electronically this element would be empty." + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .coding import Coding # noqa: E402 +from .extension import Extension # noqa: E402 +from .reference import Reference # noqa: E402 + +Signature.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/time.py b/src/metriport/resources/fhir/types/time.py new file mode 100644 index 0000000..07d3390 --- /dev/null +++ b/src/metriport/resources/fhir/types/time.py @@ -0,0 +1,3 @@ +# This file was auto-generated by Fern from our API Definition. + +Time = str diff --git a/src/metriport/resources/fhir/types/timing.py b/src/metriport/resources/fhir/types/timing.py new file mode 100644 index 0000000..44a41ee --- /dev/null +++ b/src/metriport/resources/fhir/types/timing.py @@ -0,0 +1,61 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .date_time import DateTime + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class Timing(pydantic.BaseModel): + """ + Specifies an event that may occur multiple times. Timing schedules are used to record when things are planned, expected or requested to occur. The most common usage is in dosage instructions for medications. They are also used when planning care of various kinds, and may be used for reporting the schedule to which past regular activities were carried out. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + modifier_extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + alias="modifierExtension", + description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions. Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).", + ) + event: typing.Optional[typing.List[DateTime]] = pydantic.Field( + description="Identifies specific times when the event occurs." + ) + repeat: typing.Optional[TimingRepeat] = pydantic.Field( + description="A set of rules that describe when the event is scheduled." + ) + code: typing.Optional[CodeableConcept] = pydantic.Field( + description="A code for the timing schedule (or just text in code.text). Some codes such as BID are ubiquitous, but many institutions define their own additional codes. If a code is provided, the code is understood to be a complete statement of whatever is specified in the structured timing data, and either the code or the data may be used to interpret the Timing, with the exception that .repeat.bounds still applies over the code (and is not contained in the code)." + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .codeable_concept import CodeableConcept # noqa: E402 +from .extension import Extension # noqa: E402 +from .timing_repeat import TimingRepeat # noqa: E402 + +Timing.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/timing_repeat.py b/src/metriport/resources/fhir/types/timing_repeat.py new file mode 100644 index 0000000..9d0c732 --- /dev/null +++ b/src/metriport/resources/fhir/types/timing_repeat.py @@ -0,0 +1,119 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .code import Code +from .decimal import Decimal +from .positive_int import PositiveInt +from .time import Time +from .timing_repeat_duration_unit import TimingRepeatDurationUnit +from .timing_repeat_period_unit import TimingRepeatPeriodUnit +from .timing_repeat_when_item import TimingRepeatWhenItem +from .unsigned_int import UnsignedInt + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class TimingRepeat(pydantic.BaseModel): + """ + Specifies an event that may occur multiple times. Timing schedules are used to record when things are planned, expected or requested to occur. The most common usage is in dosage instructions for medications. They are also used when planning care of various kinds, and may be used for reporting the schedule to which past regular activities were carried out. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + modifier_extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + alias="modifierExtension", + description="May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions. Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).", + ) + bounds_duration: typing.Optional[Duration] = pydantic.Field( + alias="boundsDuration", + description="Either a duration for the length of the timing schedule, a range of possible length, or outer bounds for start and/or end limits of the timing schedule.", + ) + bounds_range: typing.Optional[Range] = pydantic.Field( + alias="boundsRange", + description="Either a duration for the length of the timing schedule, a range of possible length, or outer bounds for start and/or end limits of the timing schedule.", + ) + bounds_period: typing.Optional[Period] = pydantic.Field( + alias="boundsPeriod", + description="Either a duration for the length of the timing schedule, a range of possible length, or outer bounds for start and/or end limits of the timing schedule.", + ) + count: typing.Optional[PositiveInt] = pydantic.Field( + description="A total count of the desired number of repetitions across the duration of the entire timing specification. If countMax is present, this element indicates the lower bound of the allowed range of count values." + ) + count_max: typing.Optional[PositiveInt] = pydantic.Field( + alias="countMax", + description="If present, indicates that the count is a range - so to perform the action between [count] and [countMax] times.", + ) + duration: typing.Optional[Decimal] = pydantic.Field( + description="How long this thing happens for when it happens. If durationMax is present, this element indicates the lower bound of the allowed range of the duration." + ) + duration_max: typing.Optional[Decimal] = pydantic.Field( + alias="durationMax", + description="If present, indicates that the duration is a range - so to perform the action between [duration] and [durationMax] time length.", + ) + duration_unit: typing.Optional[TimingRepeatDurationUnit] = pydantic.Field( + alias="durationUnit", description="The units of time for the duration, in UCUM units." + ) + frequency: typing.Optional[PositiveInt] = pydantic.Field( + description="The number of times to repeat the action within the specified period. If frequencyMax is present, this element indicates the lower bound of the allowed range of the frequency." + ) + frequency_max: typing.Optional[PositiveInt] = pydantic.Field( + alias="frequencyMax", + description="If present, indicates that the frequency is a range - so to repeat between [frequency] and [frequencyMax] times within the period or period range.", + ) + period: typing.Optional[Decimal] = pydantic.Field( + description='Indicates the duration of time over which repetitions are to occur; e.g. to express "3 times per day", 3 would be the frequency and "1 day" would be the period. If periodMax is present, this element indicates the lower bound of the allowed range of the period length.' + ) + period_max: typing.Optional[Decimal] = pydantic.Field( + alias="periodMax", + description='If present, indicates that the period is a range from [period] to [periodMax], allowing expressing concepts such as "do this once every 3-5 days.', + ) + period_unit: typing.Optional[TimingRepeatPeriodUnit] = pydantic.Field( + alias="periodUnit", description="The units of time for the period in UCUM units." + ) + day_of_week: typing.Optional[typing.List[Code]] = pydantic.Field( + alias="dayOfWeek", + description="If one or more days of week is provided, then the action happens only on the specified day(s).", + ) + time_of_day: typing.Optional[typing.List[Time]] = pydantic.Field( + alias="timeOfDay", description="Specified time of day for action to take place." + ) + when: typing.Optional[typing.List[TimingRepeatWhenItem]] = pydantic.Field( + description="An approximate time period during the day, potentially linked to an event of daily living that indicates when the action should occur." + ) + offset: typing.Optional[UnsignedInt] = pydantic.Field( + description="The number of minutes from the event. If the event code does not indicate whether the minutes is before or after the event, then the offset is assumed to be after the event." + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .duration import Duration # noqa: E402 +from .extension import Extension # noqa: E402 +from .period import Period # noqa: E402 +from .range import Range # noqa: E402 + +TimingRepeat.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/timing_repeat_duration_unit.py b/src/metriport/resources/fhir/types/timing_repeat_duration_unit.py new file mode 100644 index 0000000..2d1acd2 --- /dev/null +++ b/src/metriport/resources/fhir/types/timing_repeat_duration_unit.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +import enum +import typing + +T_Result = typing.TypeVar("T_Result") + + +class TimingRepeatDurationUnit(str, enum.Enum): + """ + The units of time for the duration, in UCUM units. + """ + + S = "s" + MIN = "min" + H = "h" + D = "d" + WK = "wk" + MO = "mo" + A = "a" + + def visit( + self, + s: typing.Callable[[], T_Result], + min: typing.Callable[[], T_Result], + h: typing.Callable[[], T_Result], + d: typing.Callable[[], T_Result], + wk: typing.Callable[[], T_Result], + mo: typing.Callable[[], T_Result], + a: typing.Callable[[], T_Result], + ) -> T_Result: + if self is TimingRepeatDurationUnit.S: + return s() + if self is TimingRepeatDurationUnit.MIN: + return min() + if self is TimingRepeatDurationUnit.H: + return h() + if self is TimingRepeatDurationUnit.D: + return d() + if self is TimingRepeatDurationUnit.WK: + return wk() + if self is TimingRepeatDurationUnit.MO: + return mo() + if self is TimingRepeatDurationUnit.A: + return a() diff --git a/src/metriport/resources/fhir/types/timing_repeat_period_unit.py b/src/metriport/resources/fhir/types/timing_repeat_period_unit.py new file mode 100644 index 0000000..609fc88 --- /dev/null +++ b/src/metriport/resources/fhir/types/timing_repeat_period_unit.py @@ -0,0 +1,45 @@ +# This file was auto-generated by Fern from our API Definition. + +import enum +import typing + +T_Result = typing.TypeVar("T_Result") + + +class TimingRepeatPeriodUnit(str, enum.Enum): + """ + The units of time for the period in UCUM units. + """ + + S = "s" + MIN = "min" + H = "h" + D = "d" + WK = "wk" + MO = "mo" + A = "a" + + def visit( + self, + s: typing.Callable[[], T_Result], + min: typing.Callable[[], T_Result], + h: typing.Callable[[], T_Result], + d: typing.Callable[[], T_Result], + wk: typing.Callable[[], T_Result], + mo: typing.Callable[[], T_Result], + a: typing.Callable[[], T_Result], + ) -> T_Result: + if self is TimingRepeatPeriodUnit.S: + return s() + if self is TimingRepeatPeriodUnit.MIN: + return min() + if self is TimingRepeatPeriodUnit.H: + return h() + if self is TimingRepeatPeriodUnit.D: + return d() + if self is TimingRepeatPeriodUnit.WK: + return wk() + if self is TimingRepeatPeriodUnit.MO: + return mo() + if self is TimingRepeatPeriodUnit.A: + return a() diff --git a/src/metriport/resources/fhir/types/timing_repeat_when_item.py b/src/metriport/resources/fhir/types/timing_repeat_when_item.py new file mode 100644 index 0000000..434b131 --- /dev/null +++ b/src/metriport/resources/fhir/types/timing_repeat_when_item.py @@ -0,0 +1,117 @@ +# This file was auto-generated by Fern from our API Definition. + +import enum +import typing + +T_Result = typing.TypeVar("T_Result") + + +class TimingRepeatWhenItem(str, enum.Enum): + MORN = "MORN" + MORN_EARLY = "MORN.early" + MORN_LATE = "MORN.late" + NOON = "NOON" + AFT = "AFT" + AFT_EARLY = "AFT.early" + AFT_LATE = "AFT.late" + EVE = "EVE" + EVE_EARLY = "EVE.early" + EVE_LATE = "EVE.late" + NIGHT = "NIGHT" + PHS = "PHS" + HS = "HS" + WAKE = "WAKE" + C = "C" + CM = "CM" + CD = "CD" + CV = "CV" + AC = "AC" + ACM = "ACM" + ACD = "ACD" + ACV = "ACV" + PC = "PC" + PCM = "PCM" + PCD = "PCD" + PCV = "PCV" + + def visit( + self, + morn: typing.Callable[[], T_Result], + morn_early: typing.Callable[[], T_Result], + morn_late: typing.Callable[[], T_Result], + noon: typing.Callable[[], T_Result], + aft: typing.Callable[[], T_Result], + aft_early: typing.Callable[[], T_Result], + aft_late: typing.Callable[[], T_Result], + eve: typing.Callable[[], T_Result], + eve_early: typing.Callable[[], T_Result], + eve_late: typing.Callable[[], T_Result], + night: typing.Callable[[], T_Result], + phs: typing.Callable[[], T_Result], + hs: typing.Callable[[], T_Result], + wake: typing.Callable[[], T_Result], + c: typing.Callable[[], T_Result], + cm: typing.Callable[[], T_Result], + cd: typing.Callable[[], T_Result], + cv: typing.Callable[[], T_Result], + ac: typing.Callable[[], T_Result], + acm: typing.Callable[[], T_Result], + acd: typing.Callable[[], T_Result], + acv: typing.Callable[[], T_Result], + pc: typing.Callable[[], T_Result], + pcm: typing.Callable[[], T_Result], + pcd: typing.Callable[[], T_Result], + pcv: typing.Callable[[], T_Result], + ) -> T_Result: + if self is TimingRepeatWhenItem.MORN: + return morn() + if self is TimingRepeatWhenItem.MORN_EARLY: + return morn_early() + if self is TimingRepeatWhenItem.MORN_LATE: + return morn_late() + if self is TimingRepeatWhenItem.NOON: + return noon() + if self is TimingRepeatWhenItem.AFT: + return aft() + if self is TimingRepeatWhenItem.AFT_EARLY: + return aft_early() + if self is TimingRepeatWhenItem.AFT_LATE: + return aft_late() + if self is TimingRepeatWhenItem.EVE: + return eve() + if self is TimingRepeatWhenItem.EVE_EARLY: + return eve_early() + if self is TimingRepeatWhenItem.EVE_LATE: + return eve_late() + if self is TimingRepeatWhenItem.NIGHT: + return night() + if self is TimingRepeatWhenItem.PHS: + return phs() + if self is TimingRepeatWhenItem.HS: + return hs() + if self is TimingRepeatWhenItem.WAKE: + return wake() + if self is TimingRepeatWhenItem.C: + return c() + if self is TimingRepeatWhenItem.CM: + return cm() + if self is TimingRepeatWhenItem.CD: + return cd() + if self is TimingRepeatWhenItem.CV: + return cv() + if self is TimingRepeatWhenItem.AC: + return ac() + if self is TimingRepeatWhenItem.ACM: + return acm() + if self is TimingRepeatWhenItem.ACD: + return acd() + if self is TimingRepeatWhenItem.ACV: + return acv() + if self is TimingRepeatWhenItem.PC: + return pc() + if self is TimingRepeatWhenItem.PCM: + return pcm() + if self is TimingRepeatWhenItem.PCD: + return pcd() + if self is TimingRepeatWhenItem.PCV: + return pcv() diff --git a/src/metriport/resources/fhir/types/trigger_definition.py b/src/metriport/resources/fhir/types/trigger_definition.py new file mode 100644 index 0000000..06f8235 --- /dev/null +++ b/src/metriport/resources/fhir/types/trigger_definition.py @@ -0,0 +1,72 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime +from .trigger_definition_type import TriggerDefinitionType + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class TriggerDefinition(pydantic.BaseModel): + """ + A description of a triggering event. Triggering events can be named events, data events, or periodic, as determined by the type element. + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + type: typing.Optional[TriggerDefinitionType] = pydantic.Field(description="The type of triggering event.") + name: typing.Optional[str] = pydantic.Field( + description="A formal name for the event. This may be an absolute URI that identifies the event formally (e.g. from a trigger registry), or a simple relative URI that identifies the event in a local context." + ) + timing_timing: typing.Optional[Timing] = pydantic.Field( + alias="timingTiming", description="The timing of the event (if this is a periodic trigger)." + ) + timing_reference: typing.Optional[Reference] = pydantic.Field( + alias="timingReference", description="The timing of the event (if this is a periodic trigger)." + ) + timing_date: typing.Optional[str] = pydantic.Field( + alias="timingDate", description="The timing of the event (if this is a periodic trigger)." + ) + timing_date_time: typing.Optional[str] = pydantic.Field( + alias="timingDateTime", description="The timing of the event (if this is a periodic trigger)." + ) + data: typing.Optional[typing.List[DataRequirement]] = pydantic.Field( + description="The triggering data of the event (if this is a data trigger). If more than one data is requirement is specified, then all the data requirements must be true." + ) + condition: typing.Optional[Expression] = pydantic.Field( + description="A boolean-valued expression that is evaluated in the context of the container of the trigger definition and returns whether or not the trigger fires." + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .data_requirement import DataRequirement # noqa: E402 +from .expression import Expression # noqa: E402 +from .extension import Extension # noqa: E402 +from .reference import Reference # noqa: E402 +from .timing import Timing # noqa: E402 + +TriggerDefinition.update_forward_refs() diff --git a/src/metriport/resources/fhir/types/trigger_definition_type.py b/src/metriport/resources/fhir/types/trigger_definition_type.py new file mode 100644 index 0000000..8fe2f97 --- /dev/null +++ b/src/metriport/resources/fhir/types/trigger_definition_type.py @@ -0,0 +1,49 @@ +# This file was auto-generated by Fern from our API Definition. + +import enum +import typing + +T_Result = typing.TypeVar("T_Result") + + +class TriggerDefinitionType(str, enum.Enum): + """ + The type of triggering event. + """ + + NAMED_EVENT = "named-event" + PERIODIC = "periodic" + DATA_CHANGED = "data-changed" + DATA_ADDED = "data-added" + DATA_MODIFIED = "data-modified" + DATA_REMOVED = "data-removed" + DATA_ACCESSED = "data-accessed" + DATA_ACCESS_ENDED = "data-access-ended" + + def visit( + self, + named_event: typing.Callable[[], T_Result], + periodic: typing.Callable[[], T_Result], + data_changed: typing.Callable[[], T_Result], + data_added: typing.Callable[[], T_Result], + data_modified: typing.Callable[[], T_Result], + data_removed: typing.Callable[[], T_Result], + data_accessed: typing.Callable[[], T_Result], + data_access_ended: typing.Callable[[], T_Result], + ) -> T_Result: + if self is TriggerDefinitionType.NAMED_EVENT: + return named_event() + if self is TriggerDefinitionType.PERIODIC: + return periodic() + if self is TriggerDefinitionType.DATA_CHANGED: + return data_changed() + if self is TriggerDefinitionType.DATA_ADDED: + return data_added() + if self is TriggerDefinitionType.DATA_MODIFIED: + return data_modified() + if self is TriggerDefinitionType.DATA_REMOVED: + return data_removed() + if self is TriggerDefinitionType.DATA_ACCESSED: + return data_accessed() + if self is TriggerDefinitionType.DATA_ACCESS_ENDED: + return data_access_ended() diff --git a/src/metriport/resources/fhir/types/unsigned_int.py b/src/metriport/resources/fhir/types/unsigned_int.py new file mode 100644 index 0000000..2109df2 --- /dev/null +++ b/src/metriport/resources/fhir/types/unsigned_int.py @@ -0,0 +1,3 @@ +# This file was auto-generated by Fern from our API Definition. + +UnsignedInt = float diff --git a/src/metriport/resources/fhir/types/uri.py b/src/metriport/resources/fhir/types/uri.py new file mode 100644 index 0000000..114894f --- /dev/null +++ b/src/metriport/resources/fhir/types/uri.py @@ -0,0 +1,3 @@ +# This file was auto-generated by Fern from our API Definition. + +Uri = str diff --git a/src/metriport/resources/fhir/types/url.py b/src/metriport/resources/fhir/types/url.py new file mode 100644 index 0000000..cb34106 --- /dev/null +++ b/src/metriport/resources/fhir/types/url.py @@ -0,0 +1,3 @@ +# This file was auto-generated by Fern from our API Definition. + +Url = str diff --git a/src/metriport/resources/fhir/types/usage_context.py b/src/metriport/resources/fhir/types/usage_context.py new file mode 100644 index 0000000..8f8fd67 --- /dev/null +++ b/src/metriport/resources/fhir/types/usage_context.py @@ -0,0 +1,69 @@ +# This file was auto-generated by Fern from our API Definition. + +from __future__ import annotations + +import datetime as dt +import typing + +from ....core.datetime_utils import serialize_datetime + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class UsageContext(pydantic.BaseModel): + """ + Specifies clinical/business/etc. metadata that can be used to retrieve, index and/or categorize an artifact. This metadata can either be specific to the applicable population (e.g., age category, DRG) or the specific context of care (e.g., venue, care setting, provider of care). + """ + + id: typing.Optional[str] = pydantic.Field( + description="Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." + ) + extension: typing.Optional[typing.List[Extension]] = pydantic.Field( + description="May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." + ) + code: Coding = pydantic.Field( + description="A code that identifies the type of context being specified by this usage context." + ) + value_codeable_concept: typing.Optional[CodeableConcept] = pydantic.Field( + alias="valueCodeableConcept", + description="A value that defines the context specified in this context of use. The interpretation of the value is defined by the code.", + ) + value_quantity: typing.Optional[Quantity] = pydantic.Field( + alias="valueQuantity", + description="A value that defines the context specified in this context of use. The interpretation of the value is defined by the code.", + ) + value_range: typing.Optional[Range] = pydantic.Field( + alias="valueRange", + description="A value that defines the context specified in this context of use. The interpretation of the value is defined by the code.", + ) + value_reference: typing.Optional[Reference] = pydantic.Field( + alias="valueReference", + description="A value that defines the context specified in this context of use. The interpretation of the value is defined by the code.", + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} + + +from .codeable_concept import CodeableConcept # noqa: E402 +from .coding import Coding # noqa: E402 +from .extension import Extension # noqa: E402 +from .quantity import Quantity # noqa: E402 +from .range import Range # noqa: E402 +from .reference import Reference # noqa: E402 + +UsageContext.update_forward_refs() diff --git a/src/metriport/resources/medical/resources/patient/types/contacts.py b/src/metriport/resources/fhir/types/xhtml.py similarity index 55% rename from src/metriport/resources/medical/resources/patient/types/contacts.py rename to src/metriport/resources/fhir/types/xhtml.py index 4a13420..7aa3933 100644 --- a/src/metriport/resources/medical/resources/patient/types/contacts.py +++ b/src/metriport/resources/fhir/types/xhtml.py @@ -2,6 +2,4 @@ import typing -from .contact import Contact - -Contacts = typing.Union[Contact] +Xhtml = typing.Any diff --git a/src/metriport/resources/medical/__init__.py b/src/metriport/resources/medical/__init__.py index e1bbb70..cc0dc8d 100644 --- a/src/metriport/resources/medical/__init__.py +++ b/src/metriport/resources/medical/__init__.py @@ -1,79 +1,97 @@ # This file was auto-generated by Fern from our API Definition. from .resources import ( - Addresses, BaseFacility, BasePatient, - CodeableConcept, - Coding, + BulkGetDocumentUrlQuery, + ConsolidatedBundleUpload, ConsolidatedCountResponse, + ConsolidatedWebhookStatus, Contact, - Contacts, ConversionType, DocumentQuery, DocumentQueryStatus, - DocumentReference, DocumentUrl, DriversLicense, Facility, FacilityId, Filter, + Filters, GetConsolidatedQueryStatusResponse, - ListDocumentsResponse, + ListDocumentReferences, ListFacilitiesResponse, ListPatientsResponse, + MapiWebhookStatus, + MedicalRecordStatus, OrgType, Organization, OrganizationCreate, Patient, PatientConsolidatedDataStatus, - Period, + PayloadPatient, PersonalIdentifier, PersonalIdentifier_DriversLicense, Progress, + RecordStatus, StartConsolidatedQueryResponse, + UploadDocumentResponse, + WebhookDocumentDataPayload, + WebhookMetadataPayload, + WebhookPatientConsolidatedDataPayload, + WebhookPatientDocumentDataPayload, + WebhookPatientPayload, document, facility, fhir, organization, patient, + webhooks, ) __all__ = [ - "Addresses", "BaseFacility", "BasePatient", - "CodeableConcept", - "Coding", + "BulkGetDocumentUrlQuery", + "ConsolidatedBundleUpload", "ConsolidatedCountResponse", + "ConsolidatedWebhookStatus", "Contact", - "Contacts", "ConversionType", "DocumentQuery", "DocumentQueryStatus", - "DocumentReference", "DocumentUrl", "DriversLicense", "Facility", "FacilityId", "Filter", + "Filters", "GetConsolidatedQueryStatusResponse", - "ListDocumentsResponse", + "ListDocumentReferences", "ListFacilitiesResponse", "ListPatientsResponse", + "MapiWebhookStatus", + "MedicalRecordStatus", "OrgType", "Organization", "OrganizationCreate", "Patient", "PatientConsolidatedDataStatus", - "Period", + "PayloadPatient", "PersonalIdentifier", "PersonalIdentifier_DriversLicense", "Progress", + "RecordStatus", "StartConsolidatedQueryResponse", + "UploadDocumentResponse", + "WebhookDocumentDataPayload", + "WebhookMetadataPayload", + "WebhookPatientConsolidatedDataPayload", + "WebhookPatientDocumentDataPayload", + "WebhookPatientPayload", "document", "facility", "fhir", "organization", "patient", + "webhooks", ] diff --git a/src/metriport/resources/medical/resources/__init__.py b/src/metriport/resources/medical/resources/__init__.py index e2481d8..e735dde 100644 --- a/src/metriport/resources/medical/resources/__init__.py +++ b/src/metriport/resources/medical/resources/__init__.py @@ -1,19 +1,19 @@ # This file was auto-generated by Fern from our API Definition. -from . import document, facility, fhir, organization, patient +from . import document, facility, fhir, organization, patient, webhooks from .document import ( - CodeableConcept, - Coding, + BulkGetDocumentUrlQuery, ConversionType, DocumentQuery, DocumentQueryStatus, - DocumentReference, DocumentUrl, - ListDocumentsResponse, + ListDocumentReferences, Progress, + UploadDocumentResponse, ) from .facility import BaseFacility, Facility, ListFacilitiesResponse from .fhir import ( + ConsolidatedBundleUpload, ConsolidatedCountResponse, Filter, GetConsolidatedQueryStatusResponse, @@ -22,54 +22,73 @@ ) from .organization import OrgType, Organization, OrganizationCreate from .patient import ( - Addresses, BasePatient, Contact, - Contacts, DriversLicense, FacilityId, ListPatientsResponse, + MedicalRecordStatus, Patient, - Period, PersonalIdentifier, PersonalIdentifier_DriversLicense, + RecordStatus, +) +from .webhooks import ( + ConsolidatedWebhookStatus, + Filters, + MapiWebhookStatus, + PayloadPatient, + WebhookDocumentDataPayload, + WebhookMetadataPayload, + WebhookPatientConsolidatedDataPayload, + WebhookPatientDocumentDataPayload, + WebhookPatientPayload, ) __all__ = [ - "Addresses", "BaseFacility", "BasePatient", - "CodeableConcept", - "Coding", + "BulkGetDocumentUrlQuery", + "ConsolidatedBundleUpload", "ConsolidatedCountResponse", + "ConsolidatedWebhookStatus", "Contact", - "Contacts", "ConversionType", "DocumentQuery", "DocumentQueryStatus", - "DocumentReference", "DocumentUrl", "DriversLicense", "Facility", "FacilityId", "Filter", + "Filters", "GetConsolidatedQueryStatusResponse", - "ListDocumentsResponse", + "ListDocumentReferences", "ListFacilitiesResponse", "ListPatientsResponse", + "MapiWebhookStatus", + "MedicalRecordStatus", "OrgType", "Organization", "OrganizationCreate", "Patient", "PatientConsolidatedDataStatus", - "Period", + "PayloadPatient", "PersonalIdentifier", "PersonalIdentifier_DriversLicense", "Progress", + "RecordStatus", "StartConsolidatedQueryResponse", + "UploadDocumentResponse", + "WebhookDocumentDataPayload", + "WebhookMetadataPayload", + "WebhookPatientConsolidatedDataPayload", + "WebhookPatientDocumentDataPayload", + "WebhookPatientPayload", "document", "facility", "fhir", "organization", "patient", + "webhooks", ] diff --git a/src/metriport/resources/medical/resources/document/__init__.py b/src/metriport/resources/medical/resources/document/__init__.py index 208489c..918e7d7 100644 --- a/src/metriport/resources/medical/resources/document/__init__.py +++ b/src/metriport/resources/medical/resources/document/__init__.py @@ -1,25 +1,23 @@ # This file was auto-generated by Fern from our API Definition. from .types import ( - CodeableConcept, - Coding, + BulkGetDocumentUrlQuery, ConversionType, DocumentQuery, DocumentQueryStatus, - DocumentReference, DocumentUrl, - ListDocumentsResponse, + ListDocumentReferences, Progress, + UploadDocumentResponse, ) __all__ = [ - "CodeableConcept", - "Coding", + "BulkGetDocumentUrlQuery", "ConversionType", "DocumentQuery", "DocumentQueryStatus", - "DocumentReference", "DocumentUrl", - "ListDocumentsResponse", + "ListDocumentReferences", "Progress", + "UploadDocumentResponse", ] diff --git a/src/metriport/resources/medical/resources/document/client.py b/src/metriport/resources/medical/resources/document/client.py index e53369c..5c0dd2b 100644 --- a/src/metriport/resources/medical/resources/document/client.py +++ b/src/metriport/resources/medical/resources/document/client.py @@ -6,23 +6,32 @@ from .....core.api_error import ApiError from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .....core.jsonable_encoder import jsonable_encoder from .....core.remove_none_from_dict import remove_none_from_dict +from ....fhir.types.document_reference import DocumentReference +from .types.bulk_get_document_url_query import BulkGetDocumentUrlQuery from .types.conversion_type import ConversionType from .types.document_query import DocumentQuery from .types.document_url import DocumentUrl -from .types.list_documents_response import ListDocumentsResponse +from .types.list_document_references import ListDocumentReferences +from .types.upload_document_response import UploadDocumentResponse try: import pydantic.v1 as pydantic # type: ignore except ImportError: import pydantic # type: ignore +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + class DocumentClient: def __init__(self, *, client_wrapper: SyncClientWrapper): self._client_wrapper = client_wrapper - def start_query(self, *, patient_id: str, facility_id: str) -> DocumentQuery: + def start_query( + self, *, patient_id: str, facility_id: str, request: typing.Optional[typing.Dict[str, str]] = None + ) -> DocumentQuery: """ Triggers a document query for the specified patient across HIEs. When executed, this endpoint triggers an asynchronous document query across HIEs. @@ -41,6 +50,8 @@ def start_query(self, *, patient_id: str, facility_id: str) -> DocumentQuery: - patient_id: str. The ID of the Patient for which to list available Documents. - facility_id: str. The ID of the Facility where the patient is receiving care. + + - request: typing.Optional[typing.Dict[str, str]]. --- from metriport.client import Metriport @@ -50,12 +61,14 @@ def start_query(self, *, patient_id: str, facility_id: str) -> DocumentQuery: client.medical.document.start_query( patient_id="12345678", facility_id="12345678", + request={"youCan": "putAny", "stringKeyValue": "pairsHere"}, ) """ _response = self._client_wrapper.httpx_client.request( "POST", urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "medical/v1/document/query"), params=remove_none_from_dict({"patientId": patient_id, "facilityId": facility_id}), + json=jsonable_encoder(request), headers=self._client_wrapper.get_headers(), timeout=60, ) @@ -105,10 +118,10 @@ def list( self, *, patient_id: str, - facility_id: str, date_from: typing.Optional[str] = None, date_to: typing.Optional[str] = None, - ) -> ListDocumentsResponse: + content: typing.Optional[str] = None, + ) -> ListDocumentReferences: """ Lists all Documents that can be retrieved for a Patient. This endpoint returns the document references available @@ -118,33 +131,23 @@ def list( Parameters: - patient_id: str. The ID of the Patient for which to list available Documents. - - facility_id: str. The ID of the Facility where the patient is receiving care. - - date_from: typing.Optional[str]. The start date (inclusive) for which to filter returned documents - formatted `YYYY-MM-DD` as per ISO 8601. If not provided, no start date filter will be applied. - date_to: typing.Optional[str]. The end date (inclusive) for which to filter returned documents - formatted `YYYY-MM-DD` as per ISO 8601. If not provided, no end date filter will be applied. - --- - from metriport.client import Metriport - client = Metriport( - api_key="YOUR_API_KEY", - ) - client.medical.document.list( - patient_id="12345678", - facility_id="12345678", - ) + - content: typing.Optional[str]. Value to search within the document reference and the actual contents of the document (minimum 3 chars). """ _response = self._client_wrapper.httpx_client.request( "GET", urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "medical/v1/document"), params=remove_none_from_dict( - {"patientId": patient_id, "facilityId": facility_id, "dateFrom": date_from, "dateTo": date_to} + {"patientId": patient_id, "dateFrom": date_from, "dateTo": date_to, "content": content} ), headers=self._client_wrapper.get_headers(), timeout=60, ) if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(ListDocumentsResponse, _response.json()) # type: ignore + return pydantic.parse_obj_as(ListDocumentReferences, _response.json()) # type: ignore try: _response_json = _response.json() except JSONDecodeError: @@ -153,7 +156,7 @@ def list( def get_url(self, *, file_name: str, conversion_type: typing.Optional[ConversionType] = None) -> DocumentUrl: """ - Gets a presigned URL for downloading the specified document. + Gets a downloadable URL for downloading the specified document. This endpoint returns a URL which you can use to download the specified document and/or convert using the file name provided from the [List Documents](/api-reference/medical/document/list) endpoint. @@ -162,8 +165,7 @@ def get_url(self, *, file_name: str, conversion_type: typing.Optional[Conversion - file_name: str. The file name of the document - conversion_type: typing.Optional[ConversionType]. The doc type to convert to. Either `html` or `pdf`. - This parameter should only be used for converting XML/CDA files. - --- + This parameter should only be used for converting XML/CDA files.--- from metriport.client import Metriport from metriport.resources.medical import ConversionType @@ -177,7 +179,7 @@ def get_url(self, *, file_name: str, conversion_type: typing.Optional[Conversion """ _response = self._client_wrapper.httpx_client.request( "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "medical/v1/document/downloadUrl"), + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "medical/v1/document/download-url"), params=remove_none_from_dict({"fileName": file_name, "conversionType": conversion_type}), headers=self._client_wrapper.get_headers(), timeout=60, @@ -190,12 +192,126 @@ def get_url(self, *, file_name: str, conversion_type: typing.Optional[Conversion raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) + def create_document_reference(self, *, patient_id: str, request: DocumentReference) -> UploadDocumentResponse: + """ + Creates a DocumentReference and returns its ID and a URL to use for a medical document upload to our servers. + + Parameters: + - patient_id: str. The ID of the Patient for which to list available Documents. + + - request: DocumentReference. + --- + from metriport.client import Metriport + from metriport.resources.fhir import ( + Attachment, + CodeableConcept, + Coding, + DocumentReference, + DocumentReferenceContent, + DocumentReferenceContext, + Period, + ) + + client = Metriport( + api_key="YOUR_API_KEY", + ) + client.medical.document.create_document_reference( + patient_id="12345678", + request=DocumentReference( + resource_type="DocumentReference", + content=[ + DocumentReferenceContent( + attachment=Attachment( + title="Burn management Hospital Progress note", + ), + ) + ], + contained=[ + {"resourceType": "ExampleResource", "id": "exampleId1"}, + {"resourceType": "ExampleResource", "id": "exampleId2"}, + ], + description="Third degree wrist burn treatment", + type=CodeableConcept( + text="Burn management Hospital Progress note", + coding=[ + Coding( + code="100556-0", + system="http://loinc.org", + display="Burn management Hospital Progress note", + ) + ], + ), + context=DocumentReferenceContext( + period=Period( + start="2023-10-10T14:14:17Z", + end="2023-10-10T15:30:30Z", + ), + facility_type=CodeableConcept( + text="John Snow Clinic - Acute Care Centre", + ), + ), + ), + ) + """ + _response = self._client_wrapper.httpx_client.request( + "POST", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "medical/v1/document/upload"), + params=remove_none_from_dict({"patientId": patient_id}), + json=jsonable_encoder(request), + headers=self._client_wrapper.get_headers(), + timeout=60, + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(UploadDocumentResponse, _response.json()) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def start_bulk_get_document_url(self, *, patient_id: str) -> BulkGetDocumentUrlQuery: + """ + Triggers a process to generate a list of download URLs for all of the patient's documents. + The status of the process is returned in the response. Initially, it will be `processing`, + and when the process is finished, the status will be updated to `completed` or `failed`. + If you trigger this endpoint again while the process is still running, you will get a response + that reflects the current progress. + + Parameters: + - patient_id: str. The ID of the patient for which to initiate the bulk URL generation. + --- + from metriport.client import Metriport + + client = Metriport( + api_key="YOUR_API_KEY", + ) + client.medical.document.start_bulk_get_document_url( + patient_id="12345678", + ) + """ + _response = self._client_wrapper.httpx_client.request( + "POST", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "medical/v1/document/download-url/bulk"), + params=remove_none_from_dict({"patientId": patient_id}), + headers=self._client_wrapper.get_headers(), + timeout=60, + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(BulkGetDocumentUrlQuery, _response.json()) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + class AsyncDocumentClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): self._client_wrapper = client_wrapper - async def start_query(self, *, patient_id: str, facility_id: str) -> DocumentQuery: + async def start_query( + self, *, patient_id: str, facility_id: str, request: typing.Optional[typing.Dict[str, str]] = None + ) -> DocumentQuery: """ Triggers a document query for the specified patient across HIEs. When executed, this endpoint triggers an asynchronous document query across HIEs. @@ -214,6 +330,8 @@ async def start_query(self, *, patient_id: str, facility_id: str) -> DocumentQue - patient_id: str. The ID of the Patient for which to list available Documents. - facility_id: str. The ID of the Facility where the patient is receiving care. + + - request: typing.Optional[typing.Dict[str, str]]. --- from metriport.client import AsyncMetriport @@ -223,12 +341,14 @@ async def start_query(self, *, patient_id: str, facility_id: str) -> DocumentQue await client.medical.document.start_query( patient_id="12345678", facility_id="12345678", + request={"youCan": "putAny", "stringKeyValue": "pairsHere"}, ) """ _response = await self._client_wrapper.httpx_client.request( "POST", urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "medical/v1/document/query"), params=remove_none_from_dict({"patientId": patient_id, "facilityId": facility_id}), + json=jsonable_encoder(request), headers=self._client_wrapper.get_headers(), timeout=60, ) @@ -278,10 +398,10 @@ async def list( self, *, patient_id: str, - facility_id: str, date_from: typing.Optional[str] = None, date_to: typing.Optional[str] = None, - ) -> ListDocumentsResponse: + content: typing.Optional[str] = None, + ) -> ListDocumentReferences: """ Lists all Documents that can be retrieved for a Patient. This endpoint returns the document references available @@ -291,33 +411,23 @@ async def list( Parameters: - patient_id: str. The ID of the Patient for which to list available Documents. - - facility_id: str. The ID of the Facility where the patient is receiving care. - - date_from: typing.Optional[str]. The start date (inclusive) for which to filter returned documents - formatted `YYYY-MM-DD` as per ISO 8601. If not provided, no start date filter will be applied. - date_to: typing.Optional[str]. The end date (inclusive) for which to filter returned documents - formatted `YYYY-MM-DD` as per ISO 8601. If not provided, no end date filter will be applied. - --- - from metriport.client import AsyncMetriport - client = AsyncMetriport( - api_key="YOUR_API_KEY", - ) - await client.medical.document.list( - patient_id="12345678", - facility_id="12345678", - ) + - content: typing.Optional[str]. Value to search within the document reference and the actual contents of the document (minimum 3 chars). """ _response = await self._client_wrapper.httpx_client.request( "GET", urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "medical/v1/document"), params=remove_none_from_dict( - {"patientId": patient_id, "facilityId": facility_id, "dateFrom": date_from, "dateTo": date_to} + {"patientId": patient_id, "dateFrom": date_from, "dateTo": date_to, "content": content} ), headers=self._client_wrapper.get_headers(), timeout=60, ) if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(ListDocumentsResponse, _response.json()) # type: ignore + return pydantic.parse_obj_as(ListDocumentReferences, _response.json()) # type: ignore try: _response_json = _response.json() except JSONDecodeError: @@ -326,7 +436,7 @@ async def list( async def get_url(self, *, file_name: str, conversion_type: typing.Optional[ConversionType] = None) -> DocumentUrl: """ - Gets a presigned URL for downloading the specified document. + Gets a downloadable URL for downloading the specified document. This endpoint returns a URL which you can use to download the specified document and/or convert using the file name provided from the [List Documents](/api-reference/medical/document/list) endpoint. @@ -335,8 +445,7 @@ async def get_url(self, *, file_name: str, conversion_type: typing.Optional[Conv - file_name: str. The file name of the document - conversion_type: typing.Optional[ConversionType]. The doc type to convert to. Either `html` or `pdf`. - This parameter should only be used for converting XML/CDA files. - --- + This parameter should only be used for converting XML/CDA files.--- from metriport.client import AsyncMetriport from metriport.resources.medical import ConversionType @@ -350,7 +459,7 @@ async def get_url(self, *, file_name: str, conversion_type: typing.Optional[Conv """ _response = await self._client_wrapper.httpx_client.request( "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "medical/v1/document/downloadUrl"), + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "medical/v1/document/download-url"), params=remove_none_from_dict({"fileName": file_name, "conversionType": conversion_type}), headers=self._client_wrapper.get_headers(), timeout=60, @@ -362,3 +471,115 @@ async def get_url(self, *, file_name: str, conversion_type: typing.Optional[Conv except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) + + async def create_document_reference(self, *, patient_id: str, request: DocumentReference) -> UploadDocumentResponse: + """ + Creates a DocumentReference and returns its ID and a URL to use for a medical document upload to our servers. + + Parameters: + - patient_id: str. The ID of the Patient for which to list available Documents. + + - request: DocumentReference. + --- + from metriport.client import AsyncMetriport + from metriport.resources.fhir import ( + Attachment, + CodeableConcept, + Coding, + DocumentReference, + DocumentReferenceContent, + DocumentReferenceContext, + Period, + ) + + client = AsyncMetriport( + api_key="YOUR_API_KEY", + ) + await client.medical.document.create_document_reference( + patient_id="12345678", + request=DocumentReference( + resource_type="DocumentReference", + content=[ + DocumentReferenceContent( + attachment=Attachment( + title="Burn management Hospital Progress note", + ), + ) + ], + contained=[ + {"resourceType": "ExampleResource", "id": "exampleId1"}, + {"resourceType": "ExampleResource", "id": "exampleId2"}, + ], + description="Third degree wrist burn treatment", + type=CodeableConcept( + text="Burn management Hospital Progress note", + coding=[ + Coding( + code="100556-0", + system="http://loinc.org", + display="Burn management Hospital Progress note", + ) + ], + ), + context=DocumentReferenceContext( + period=Period( + start="2023-10-10T14:14:17Z", + end="2023-10-10T15:30:30Z", + ), + facility_type=CodeableConcept( + text="John Snow Clinic - Acute Care Centre", + ), + ), + ), + ) + """ + _response = await self._client_wrapper.httpx_client.request( + "POST", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "medical/v1/document/upload"), + params=remove_none_from_dict({"patientId": patient_id}), + json=jsonable_encoder(request), + headers=self._client_wrapper.get_headers(), + timeout=60, + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(UploadDocumentResponse, _response.json()) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def start_bulk_get_document_url(self, *, patient_id: str) -> BulkGetDocumentUrlQuery: + """ + Triggers a process to generate a list of download URLs for all of the patient's documents. + The status of the process is returned in the response. Initially, it will be `processing`, + and when the process is finished, the status will be updated to `completed` or `failed`. + If you trigger this endpoint again while the process is still running, you will get a response + that reflects the current progress. + + Parameters: + - patient_id: str. The ID of the patient for which to initiate the bulk URL generation. + --- + from metriport.client import AsyncMetriport + + client = AsyncMetriport( + api_key="YOUR_API_KEY", + ) + await client.medical.document.start_bulk_get_document_url( + patient_id="12345678", + ) + """ + _response = await self._client_wrapper.httpx_client.request( + "POST", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "medical/v1/document/download-url/bulk"), + params=remove_none_from_dict({"patientId": patient_id}), + headers=self._client_wrapper.get_headers(), + timeout=60, + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(BulkGetDocumentUrlQuery, _response.json()) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/metriport/resources/medical/resources/document/types/__init__.py b/src/metriport/resources/medical/resources/document/types/__init__.py index 1b0c0ca..c9548b5 100644 --- a/src/metriport/resources/medical/resources/document/types/__init__.py +++ b/src/metriport/resources/medical/resources/document/types/__init__.py @@ -1,23 +1,21 @@ # This file was auto-generated by Fern from our API Definition. -from .codeable_concept import CodeableConcept -from .coding import Coding +from .bulk_get_document_url_query import BulkGetDocumentUrlQuery from .conversion_type import ConversionType from .document_query import DocumentQuery from .document_query_status import DocumentQueryStatus -from .document_reference import DocumentReference from .document_url import DocumentUrl -from .list_documents_response import ListDocumentsResponse +from .list_document_references import ListDocumentReferences from .progress import Progress +from .upload_document_response import UploadDocumentResponse __all__ = [ - "CodeableConcept", - "Coding", + "BulkGetDocumentUrlQuery", "ConversionType", "DocumentQuery", "DocumentQueryStatus", - "DocumentReference", "DocumentUrl", - "ListDocumentsResponse", + "ListDocumentReferences", "Progress", + "UploadDocumentResponse", ] diff --git a/src/metriport/resources/medical/resources/document/types/codeable_concept.py b/src/metriport/resources/medical/resources/document/types/bulk_get_document_url_query.py similarity index 57% rename from src/metriport/resources/medical/resources/document/types/codeable_concept.py rename to src/metriport/resources/medical/resources/document/types/bulk_get_document_url_query.py index 031e9d6..230e83d 100644 --- a/src/metriport/resources/medical/resources/document/types/codeable_concept.py +++ b/src/metriport/resources/medical/resources/document/types/bulk_get_document_url_query.py @@ -4,7 +4,7 @@ import typing from ......core.datetime_utils import serialize_datetime -from .coding import Coding +from .document_query_status import DocumentQueryStatus try: import pydantic.v1 as pydantic # type: ignore @@ -12,26 +12,21 @@ import pydantic # type: ignore -class CodeableConcept(pydantic.BaseModel): +class BulkGetDocumentUrlQuery(pydantic.BaseModel): """ - from metriport.resources.medical import CodeableConcept, Coding - - CodeableConcept( - coding=[ - Coding( - system="http://snomed.info/sct", - code="62479008", - display="Diagnoses", - ) - ], - text="Diagnoses", + from metriport.resources.medical import ( + BulkGetDocumentUrlQuery, + DocumentQueryStatus, ) - """ - coding: typing.Optional[typing.List[Coding]] = pydantic.Field( - description="Array containing the coding defined by a terminology system." + BulkGetDocumentUrlQuery( + status=DocumentQueryStatus.PROCESSING, + request_id="018c1e9d-dfce-70cb-8c0e-edfbbd2a7f5f", ) - text: typing.Optional[str] = pydantic.Field(description="Plain text representation of the concept.") + """ + + status: DocumentQueryStatus = pydantic.Field(description="The status of the URL generation process.") + request_id: typing.Optional[str] = pydantic.Field(alias="requestId", description="The ID of the request.") def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} @@ -44,4 +39,5 @@ def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: class Config: frozen = True smart_union = True + allow_population_by_field_name = True json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/metriport/resources/medical/resources/document/types/document_query.py b/src/metriport/resources/medical/resources/document/types/document_query.py index 39ed2f6..c4829d5 100644 --- a/src/metriport/resources/medical/resources/document/types/document_query.py +++ b/src/metriport/resources/medical/resources/document/types/document_query.py @@ -35,6 +35,7 @@ class DocumentQuery(pydantic.BaseModel): download: typing.Optional[Progress] convert: typing.Optional[Progress] + request_id: typing.Optional[str] = pydantic.Field(alias="requestId", description="The ID of the Document Query.") def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} @@ -47,4 +48,5 @@ def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: class Config: frozen = True smart_union = True + allow_population_by_field_name = True json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/metriport/resources/medical/resources/document/types/document_reference.py b/src/metriport/resources/medical/resources/document/types/document_reference.py deleted file mode 100644 index cfddecd..0000000 --- a/src/metriport/resources/medical/resources/document/types/document_reference.py +++ /dev/null @@ -1,78 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -from ......core.datetime_utils import serialize_datetime -from .codeable_concept import CodeableConcept - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - - -class DocumentReference(pydantic.BaseModel): - """ - import datetime - - from metriport.resources.medical import ( - CodeableConcept, - Coding, - DocumentReference, - ) - - DocumentReference( - id="1.2.543.1.34.1.34.134", - file_name="CCDA_Diag.xml", - location="https://fhir.metriport.com/oauth/fhir/Binary/2.16.840.1.113883.3.777.666.5.700009.969696", - description="Patient Diagnoses", - status="current", - indexed=datetime.datetime.fromisoformat( - "2019-09-07 15:50:00+00:00", - ), - mime_type="application/xml", - size=17344007, - type=CodeableConcept( - coding=[ - Coding( - system="http://snomed.info/sct", - code="62479008", - display="Diagnoses", - ) - ], - ), - ) - """ - - id: str = pydantic.Field(description="The Document ID.") - file_name: str = pydantic.Field(alias="fileName", description="Name of the file.") - location: str = pydantic.Field(description="URL that can be used to retrieve the Document.") - description: typing.Optional[str] = pydantic.Field(description="Human-readable description of the Document.") - status: typing.Optional[str] = pydantic.Field( - description="Can be one of `current`, `superceded`, or `entered in error`." - ) - indexed: typing.Optional[dt.datetime] = pydantic.Field( - description="When this Document reference was created - formatted to ISO 8601." - ) - mime_type: typing.Optional[str] = pydantic.Field( - alias="mimeType", description="Document MIME type - usually `application/xml`, or `application/pdf`." - ) - size: typing.Optional[int] = pydantic.Field(description="Size of the Document in bytes.") - type: typing.Optional[CodeableConcept] = pydantic.Field( - description="What kind of document this is (LOINC if possible)." - ) - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) - - class Config: - frozen = True - smart_union = True - allow_population_by_field_name = True - json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/metriport/resources/medical/resources/document/types/coding.py b/src/metriport/resources/medical/resources/document/types/list_document_references.py similarity index 61% rename from src/metriport/resources/medical/resources/document/types/coding.py rename to src/metriport/resources/medical/resources/document/types/list_document_references.py index e80f1c4..6d6f81d 100644 --- a/src/metriport/resources/medical/resources/document/types/coding.py +++ b/src/metriport/resources/medical/resources/document/types/list_document_references.py @@ -4,6 +4,7 @@ import typing from ......core.datetime_utils import serialize_datetime +from .....fhir.types.document_reference import DocumentReference try: import pydantic.v1 as pydantic # type: ignore @@ -11,20 +12,10 @@ import pydantic # type: ignore -class Coding(pydantic.BaseModel): - """ - from metriport.resources.medical import Coding - - Coding( - system="http://snomed.info/sct", - code="62479008", - display="Diagnoses", +class ListDocumentReferences(pydantic.BaseModel): + documents: typing.List[DocumentReference] = pydantic.Field( + description="An array of objects describing the Documents that can be retrieved for the Patient." ) - """ - - system: typing.Optional[str] = pydantic.Field(description="Identity of the terminology system.") - code: typing.Optional[str] = pydantic.Field(description="Symbol in syntax defined by the system.") - display: typing.Optional[str] = pydantic.Field(description="Representation defined by the system.") def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/src/metriport/resources/medical/resources/document/types/list_documents_response.py b/src/metriport/resources/medical/resources/document/types/list_documents_response.py deleted file mode 100644 index 157ade6..0000000 --- a/src/metriport/resources/medical/resources/document/types/list_documents_response.py +++ /dev/null @@ -1,66 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -from ......core.datetime_utils import serialize_datetime -from .document_reference import DocumentReference - -try: - import pydantic.v1 as pydantic # type: ignore -except ImportError: - import pydantic # type: ignore - - -class ListDocumentsResponse(pydantic.BaseModel): - """ - import datetime - - from metriport.resources.medical import ( - CodeableConcept, - Coding, - DocumentReference, - ListDocumentsResponse, - ) - - ListDocumentsResponse( - documents=[ - DocumentReference( - id="1.2.543.1.34.1.34.134", - file_name="CCDA_Diag.xml", - location="https://fhir.metriport.com/oauth/fhir/Binary/2.16.840.1.113883.3.777.666.5.700009.969696", - description="Patient Diagnoses", - status="current", - indexed=datetime.datetime.fromisoformat( - "2019-09-07 15:50:00+00:00", - ), - mime_type="application/xml", - size=17344007, - type=CodeableConcept( - coding=[ - Coding( - system="http://snomed.info/sct", - code="62479008", - display="Diagnoses", - ) - ], - ), - ) - ], - ) - """ - - documents: typing.List[DocumentReference] - - def json(self, **kwargs: typing.Any) -> str: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().json(**kwargs_with_defaults) - - def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: - kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} - return super().dict(**kwargs_with_defaults) - - class Config: - frozen = True - smart_union = True - json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/metriport/resources/medical/resources/document/types/upload_document_response.py b/src/metriport/resources/medical/resources/document/types/upload_document_response.py new file mode 100644 index 0000000..80cb833 --- /dev/null +++ b/src/metriport/resources/medical/resources/document/types/upload_document_response.py @@ -0,0 +1,41 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ......core.datetime_utils import serialize_datetime + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class UploadDocumentResponse(pydantic.BaseModel): + """ + from metriport.resources.medical import UploadDocumentResponse + + UploadDocumentResponse( + document_reference_id="", + upload_url="", + ) + """ + + document_reference_id: str = pydantic.Field( + alias="documentReferenceId", description="The ID of the DocumentReference." + ) + upload_url: str = pydantic.Field(alias="uploadUrl", description="The URL to use for uploading the document.") + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/metriport/resources/medical/resources/facility/client.py b/src/metriport/resources/medical/resources/facility/client.py index 6c43c60..ffe7419 100644 --- a/src/metriport/resources/medical/resources/facility/client.py +++ b/src/metriport/resources/medical/resources/facility/client.py @@ -76,8 +76,7 @@ def get(self, id: str) -> Facility: Parameters: - id: str. The ID assigned to this Facility. This ID will be used - to uniquely identify this Facility in medical documents. - --- + to uniquely identify this Facility in medical documents.--- from metriport.client import Metriport client = Metriport( @@ -233,8 +232,7 @@ async def get(self, id: str) -> Facility: Parameters: - id: str. The ID assigned to this Facility. This ID will be used - to uniquely identify this Facility in medical documents. - --- + to uniquely identify this Facility in medical documents.--- from metriport.client import AsyncMetriport client = AsyncMetriport( diff --git a/src/metriport/resources/medical/resources/facility/types/facility.py b/src/metriport/resources/medical/resources/facility/types/facility.py index 479aff7..e9749c3 100644 --- a/src/metriport/resources/medical/resources/facility/types/facility.py +++ b/src/metriport/resources/medical/resources/facility/types/facility.py @@ -36,7 +36,7 @@ class Facility(BaseFacility): id: str = pydantic.Field( description=( - "The ID assigned to this Facility. This ID will be used \n" + "The ID assigned to this Facility. This ID will be used\n" "to uniquely identify this Facility in medical documents.\n" ) ) diff --git a/src/metriport/resources/medical/resources/fhir/__init__.py b/src/metriport/resources/medical/resources/fhir/__init__.py index 8691d78..be62ca8 100644 --- a/src/metriport/resources/medical/resources/fhir/__init__.py +++ b/src/metriport/resources/medical/resources/fhir/__init__.py @@ -1,6 +1,7 @@ # This file was auto-generated by Fern from our API Definition. from .types import ( + ConsolidatedBundleUpload, ConsolidatedCountResponse, Filter, GetConsolidatedQueryStatusResponse, @@ -9,6 +10,7 @@ ) __all__ = [ + "ConsolidatedBundleUpload", "ConsolidatedCountResponse", "Filter", "GetConsolidatedQueryStatusResponse", diff --git a/src/metriport/resources/medical/resources/fhir/client.py b/src/metriport/resources/medical/resources/fhir/client.py index 38af56b..ac64084 100644 --- a/src/metriport/resources/medical/resources/fhir/client.py +++ b/src/metriport/resources/medical/resources/fhir/client.py @@ -6,7 +6,10 @@ from .....core.api_error import ApiError from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper +from .....core.jsonable_encoder import jsonable_encoder from .....core.remove_none_from_dict import remove_none_from_dict +from ....fhir.types.bundle import Bundle +from .types.consolidated_bundle_upload import ConsolidatedBundleUpload from .types.consolidated_count_response import ConsolidatedCountResponse from .types.get_consolidated_query_status_response import GetConsolidatedQueryStatusResponse from .types.start_consolidated_query_response import StartConsolidatedQueryResponse @@ -16,6 +19,9 @@ except ImportError: import pydantic # type: ignore +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + class FhirClient: def __init__(self, *, client_wrapper: SyncClientWrapper): @@ -28,6 +34,8 @@ def start_consolidated_query( resources: typing.Optional[str] = None, date_from: typing.Optional[str] = None, date_to: typing.Optional[str] = None, + conversion_type: typing.Optional[str] = None, + request: typing.Optional[typing.Dict[str, str]] = None, ) -> StartConsolidatedQueryResponse: """ Trigger a consolidated data query for the given patient @@ -37,15 +45,16 @@ def start_consolidated_query( - resources: typing.Optional[str]. A comma separated, case sensitive list of resources to be returned. If none are provided all resources will be included. - - date_from: typing.Optional[str]. The start date (inclusive) for which to filter returned resources - formatted `YYYY-MM-DD` as per ISO 8601. If not provided, no start date filter will be applied. - - date_to: typing.Optional[str]. The end date (inclusive) for which to filter returned resources - formatted `YYYY-MM-DD` as per ISO 8601. If not provided, - no end date filter will be applied. - --- + no end date filter will be applied. + - conversion_type: typing.Optional[str]. The doc type to convert to. Either `html` or `pdf`. + + - request: typing.Optional[typing.Dict[str, str]]. + --- from metriport.client import Metriport client = Metriport( @@ -60,7 +69,10 @@ def start_consolidated_query( urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"medical/v1/patient/{id}/consolidated/query" ), - params=remove_none_from_dict({"resources": resources, "dateFrom": date_from, "dateTo": date_to}), + params=remove_none_from_dict( + {"resources": resources, "dateFrom": date_from, "dateTo": date_to, "conversionType": conversion_type} + ), + json=jsonable_encoder(request), headers=self._client_wrapper.get_headers(), timeout=60, ) @@ -104,6 +116,64 @@ def get_consolidated_query_status(self, id: str) -> GetConsolidatedQueryStatusRe raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) + def create_patient_consolidated(self, id: str, *, request: ConsolidatedBundleUpload) -> Bundle: + """ + Create Patient's Consolidated Data with a FHIR Bundle. + + Parameters: + - id: str. The ID of the Patient + + - request: ConsolidatedBundleUpload. + --- + from metriport.client import Metriport + from metriport.resources.medical import ConsolidatedBundleUpload + + client = Metriport( + api_key="YOUR_API_KEY", + ) + client.medical.fhir.create_patient_consolidated( + id="12345678", + request=ConsolidatedBundleUpload( + resource_type="Bundle", + type="collection", + entry=[ + { + "resource": { + "resourceType": "Observation", + "code": {"text": "Cancer"}, + "valueCodeableConcept": {"text": "NEGATIVE"}, + "status": "final", + "category": [ + { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/observation-category", + "code": "laboratory", + } + ] + } + ], + } + } + ], + ), + ) + """ + _response = self._client_wrapper.httpx_client.request( + "PUT", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"medical/v1/patient/{id}/consolidated"), + json=jsonable_encoder(request), + headers=self._client_wrapper.get_headers(), + timeout=60, + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(Bundle, _response.json()) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + def count_patient_data( self, id: str, @@ -120,15 +190,12 @@ def count_patient_data( - resources: typing.Optional[str]. A comma separated, case sensitive list of resources to be returned. If none are provided all resources will be included. - - date_from: typing.Optional[str]. The start date (inclusive) for which to filter returned resources - formatted `YYYY-MM-DD` as per ISO 8601. If not provided, no start date filter will be applied. - - date_to: typing.Optional[str]. The end date (inclusive) for which to filter returned resources - formatted `YYYY-MM-DD` as per ISO 8601. If not provided, - no end date filter will be applied. - + no end date filter will be applied. """ _response = self._client_wrapper.httpx_client.request( "GET", @@ -159,6 +226,8 @@ async def start_consolidated_query( resources: typing.Optional[str] = None, date_from: typing.Optional[str] = None, date_to: typing.Optional[str] = None, + conversion_type: typing.Optional[str] = None, + request: typing.Optional[typing.Dict[str, str]] = None, ) -> StartConsolidatedQueryResponse: """ Trigger a consolidated data query for the given patient @@ -168,15 +237,16 @@ async def start_consolidated_query( - resources: typing.Optional[str]. A comma separated, case sensitive list of resources to be returned. If none are provided all resources will be included. - - date_from: typing.Optional[str]. The start date (inclusive) for which to filter returned resources - formatted `YYYY-MM-DD` as per ISO 8601. If not provided, no start date filter will be applied. - - date_to: typing.Optional[str]. The end date (inclusive) for which to filter returned resources - formatted `YYYY-MM-DD` as per ISO 8601. If not provided, - no end date filter will be applied. - --- + no end date filter will be applied. + - conversion_type: typing.Optional[str]. The doc type to convert to. Either `html` or `pdf`. + + - request: typing.Optional[typing.Dict[str, str]]. + --- from metriport.client import AsyncMetriport client = AsyncMetriport( @@ -191,7 +261,10 @@ async def start_consolidated_query( urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"medical/v1/patient/{id}/consolidated/query" ), - params=remove_none_from_dict({"resources": resources, "dateFrom": date_from, "dateTo": date_to}), + params=remove_none_from_dict( + {"resources": resources, "dateFrom": date_from, "dateTo": date_to, "conversionType": conversion_type} + ), + json=jsonable_encoder(request), headers=self._client_wrapper.get_headers(), timeout=60, ) @@ -235,6 +308,64 @@ async def get_consolidated_query_status(self, id: str) -> GetConsolidatedQuerySt raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) + async def create_patient_consolidated(self, id: str, *, request: ConsolidatedBundleUpload) -> Bundle: + """ + Create Patient's Consolidated Data with a FHIR Bundle. + + Parameters: + - id: str. The ID of the Patient + + - request: ConsolidatedBundleUpload. + --- + from metriport.client import AsyncMetriport + from metriport.resources.medical import ConsolidatedBundleUpload + + client = AsyncMetriport( + api_key="YOUR_API_KEY", + ) + await client.medical.fhir.create_patient_consolidated( + id="12345678", + request=ConsolidatedBundleUpload( + resource_type="Bundle", + type="collection", + entry=[ + { + "resource": { + "resourceType": "Observation", + "code": {"text": "Cancer"}, + "valueCodeableConcept": {"text": "NEGATIVE"}, + "status": "final", + "category": [ + { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/observation-category", + "code": "laboratory", + } + ] + } + ], + } + } + ], + ), + ) + """ + _response = await self._client_wrapper.httpx_client.request( + "PUT", + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"medical/v1/patient/{id}/consolidated"), + json=jsonable_encoder(request), + headers=self._client_wrapper.get_headers(), + timeout=60, + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(Bundle, _response.json()) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + async def count_patient_data( self, id: str, @@ -251,15 +382,12 @@ async def count_patient_data( - resources: typing.Optional[str]. A comma separated, case sensitive list of resources to be returned. If none are provided all resources will be included. - - date_from: typing.Optional[str]. The start date (inclusive) for which to filter returned resources - formatted `YYYY-MM-DD` as per ISO 8601. If not provided, no start date filter will be applied. - - date_to: typing.Optional[str]. The end date (inclusive) for which to filter returned resources - formatted `YYYY-MM-DD` as per ISO 8601. If not provided, - no end date filter will be applied. - + no end date filter will be applied. """ _response = await self._client_wrapper.httpx_client.request( "GET", diff --git a/src/metriport/resources/medical/resources/fhir/types/__init__.py b/src/metriport/resources/medical/resources/fhir/types/__init__.py index 09459bb..27cb672 100644 --- a/src/metriport/resources/medical/resources/fhir/types/__init__.py +++ b/src/metriport/resources/medical/resources/fhir/types/__init__.py @@ -1,5 +1,6 @@ # This file was auto-generated by Fern from our API Definition. +from .consolidated_bundle_upload import ConsolidatedBundleUpload from .consolidated_count_response import ConsolidatedCountResponse from .filter import Filter from .get_consolidated_query_status_response import GetConsolidatedQueryStatusResponse @@ -7,6 +8,7 @@ from .start_consolidated_query_response import StartConsolidatedQueryResponse __all__ = [ + "ConsolidatedBundleUpload", "ConsolidatedCountResponse", "Filter", "GetConsolidatedQueryStatusResponse", diff --git a/src/metriport/resources/medical/resources/fhir/types/consolidated_bundle_upload.py b/src/metriport/resources/medical/resources/fhir/types/consolidated_bundle_upload.py new file mode 100644 index 0000000..2015b46 --- /dev/null +++ b/src/metriport/resources/medical/resources/fhir/types/consolidated_bundle_upload.py @@ -0,0 +1,62 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ......core.datetime_utils import serialize_datetime + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class ConsolidatedBundleUpload(pydantic.BaseModel): + """ + from metriport.resources.medical import ConsolidatedBundleUpload + + ConsolidatedBundleUpload( + resource_type="Bundle", + type="collection", + entry=[ + { + "resource": { + "resourceType": "Observation", + "code": {"text": "Cancer"}, + "valueCodeableConcept": {"text": "NEGATIVE"}, + "status": "final", + "category": [ + { + "coding": [ + { + "system": "http://terminology.hl7.org/CodeSystem/observation-category", + "code": "laboratory", + } + ] + } + ], + } + } + ], + ) + """ + + resource_type: str = pydantic.Field(alias="resourceType", description="The resource needs to be “Bundle”") + type: str = pydantic.Field(description="The type needs to be “collection”") + entry: typing.List[typing.Dict[str, typing.Any]] = pydantic.Field( + description="The entry needs to be an array of FHIR resources." + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/metriport/resources/medical/resources/fhir/types/consolidated_count_response.py b/src/metriport/resources/medical/resources/fhir/types/consolidated_count_response.py index 40f87cd..ab0dc09 100644 --- a/src/metriport/resources/medical/resources/fhir/types/consolidated_count_response.py +++ b/src/metriport/resources/medical/resources/fhir/types/consolidated_count_response.py @@ -17,7 +17,7 @@ class ConsolidatedCountResponse(pydantic.BaseModel): resources: typing.Dict[str, int] = pydantic.Field( description=( "Object containing resource types as properties and the amount of entries for\n" - "the resource as the value (integer). Only resource types with amount \n" + "the resource as the value (integer). Only resource types with amount\n" "of entries higher than one are included.\n" ) ) diff --git a/src/metriport/resources/medical/resources/fhir/types/filter.py b/src/metriport/resources/medical/resources/fhir/types/filter.py index d4e72b5..904610f 100644 --- a/src/metriport/resources/medical/resources/fhir/types/filter.py +++ b/src/metriport/resources/medical/resources/fhir/types/filter.py @@ -14,23 +14,23 @@ class Filter(pydantic.BaseModel): resources: str = pydantic.Field( description=( - "Comma-separated list of resource types. If not specified on the \n" "request, this will be `all`.\n" + "Comma-separated list of resource types. If not specified on the\n" "request, this will be `all`.\n" ) ) date_from: typing.Optional[str] = pydantic.Field( alias="dateFrom", description=( - "The start date (inclusive) for which to filter returned resources - \n" - "formatted `YYYY-MM-DD` as per ISO 8601. If not provided, \n" + "The start date (inclusive) for which to filter returned resources -\n" + "formatted `YYYY-MM-DD` as per ISO 8601. If not provided,\n" "no start date filter will be applied.\n" ), ) date_to: typing.Optional[str] = pydantic.Field( alias="dateTo", description=( - "The end date (inclusive) for which to filter returned resources - \n" + "The end date (inclusive) for which to filter returned resources -\n" "formatted `YYYY-MM-DD` as per ISO 8601. If not provided,\n" - " no end date filter will be applied.\n" + "no end date filter will be applied.\n" ), ) diff --git a/src/metriport/resources/medical/resources/fhir/types/get_consolidated_query_status_response.py b/src/metriport/resources/medical/resources/fhir/types/get_consolidated_query_status_response.py index 8884a0d..aa5ad6f 100644 --- a/src/metriport/resources/medical/resources/fhir/types/get_consolidated_query_status_response.py +++ b/src/metriport/resources/medical/resources/fhir/types/get_consolidated_query_status_response.py @@ -25,7 +25,7 @@ class GetConsolidatedQueryStatusResponse(pydantic.BaseModel): ) """ - status: PatientConsolidatedDataStatus + status: typing.Optional[PatientConsolidatedDataStatus] message: typing.Optional[str] def json(self, **kwargs: typing.Any) -> str: diff --git a/src/metriport/resources/medical/resources/organization/types/organization.py b/src/metriport/resources/medical/resources/organization/types/organization.py index aa72525..c4a2416 100644 --- a/src/metriport/resources/medical/resources/organization/types/organization.py +++ b/src/metriport/resources/medical/resources/organization/types/organization.py @@ -34,7 +34,7 @@ class Organization(OrganizationCreate): id: str = pydantic.Field( description=( - "The ID assigned to your organization. \n" + "The ID assigned to your organization.\n" "This ID will be used to uniquely identify your organization in medical documents.\n" ) ) diff --git a/src/metriport/resources/medical/resources/organization/types/organization_create.py b/src/metriport/resources/medical/resources/organization/types/organization_create.py index da45ed7..a301560 100644 --- a/src/metriport/resources/medical/resources/organization/types/organization_create.py +++ b/src/metriport/resources/medical/resources/organization/types/organization_create.py @@ -16,8 +16,8 @@ class OrganizationCreate(pydantic.BaseModel): name: str = pydantic.Field( description=( - "The name of your organization. \n" - "This is usually your legal corporate entity name - \n" + "The name of your organization.\n" + "This is usually your legal corporate entity name -\n" "for example `Metriport Inc.`.\n" ) ) diff --git a/src/metriport/resources/medical/resources/patient/__init__.py b/src/metriport/resources/medical/resources/patient/__init__.py index aa91c2e..76c0b95 100644 --- a/src/metriport/resources/medical/resources/patient/__init__.py +++ b/src/metriport/resources/medical/resources/patient/__init__.py @@ -1,29 +1,27 @@ # This file was auto-generated by Fern from our API Definition. from .types import ( - Addresses, BasePatient, Contact, - Contacts, DriversLicense, FacilityId, ListPatientsResponse, + MedicalRecordStatus, Patient, - Period, PersonalIdentifier, PersonalIdentifier_DriversLicense, + RecordStatus, ) __all__ = [ - "Addresses", "BasePatient", "Contact", - "Contacts", "DriversLicense", "FacilityId", "ListPatientsResponse", + "MedicalRecordStatus", "Patient", - "Period", "PersonalIdentifier", "PersonalIdentifier_DriversLicense", + "RecordStatus", ] diff --git a/src/metriport/resources/medical/resources/patient/client.py b/src/metriport/resources/medical/resources/patient/client.py index f12f071..c9d536d 100644 --- a/src/metriport/resources/medical/resources/patient/client.py +++ b/src/metriport/resources/medical/resources/patient/client.py @@ -10,6 +10,7 @@ from .....core.remove_none_from_dict import remove_none_from_dict from .types.base_patient import BasePatient from .types.list_patients_response import ListPatientsResponse +from .types.medical_record_status import MedicalRecordStatus from .types.patient import Patient try: @@ -38,7 +39,7 @@ def create(self, *, facility_id: str, request: BasePatient) -> Patient: - request: BasePatient. --- - from metriport import UsState + from metriport import Address, UsState from metriport.client import Metriport from metriport.resources.medical import ( BasePatient, @@ -62,6 +63,16 @@ def create(self, *, facility_id: str, request: BasePatient) -> Patient: value="51227265", ) ], + address=[ + Address( + address_line_1="2261 Market Street", + address_line_2="#4818", + city="San Francisco", + state=UsState.CA, + zip="94114", + country="USA", + ) + ], ), ) """ @@ -140,7 +151,7 @@ def update(self, id: str, *, facility_id: str, request: BasePatient) -> Patient: def list(self, *, facility_id: typing.Optional[str] = None) -> ListPatientsResponse: """ - Lists all Patients receiving care at the specified Facility. + Lists all Patients receiving care at the specified Facility, or all Patients if no Facility is specified. Parameters: - facility_id: typing.Optional[str]. The ID of the Facility where the patient is receiving care. @@ -184,6 +195,55 @@ def delete(self, id: str, *, facility_id: typing.Optional[str] = None) -> None: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) + def get_medical_record_summary(self, patient_id: str, *, conversion_type: str) -> str: + """ + Returns the URL for a medical record summary + + Parameters: + - patient_id: str. The ID of the Patient. + + - conversion_type: str. The type of conversion to perform. `html` or `pdf` + """ + _response = self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"medical/v1/patient/{patient_id}/medical-record" + ), + params=remove_none_from_dict({"conversionType": conversion_type}), + headers=self._client_wrapper.get_headers(), + timeout=60, + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(str, _response.json()) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + def get_medical_record_summary_status(self, patient_id: str) -> MedicalRecordStatus: + """ + Returns the status of a medical record summary + + Parameters: + - patient_id: str. The ID of the Patient. + """ + _response = self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"medical/v1/patient/{patient_id}/medical-record-status" + ), + headers=self._client_wrapper.get_headers(), + timeout=60, + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(MedicalRecordStatus, _response.json()) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + class AsyncPatientClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): @@ -202,7 +262,7 @@ async def create(self, *, facility_id: str, request: BasePatient) -> Patient: - request: BasePatient. --- - from metriport import UsState + from metriport import Address, UsState from metriport.client import AsyncMetriport from metriport.resources.medical import ( BasePatient, @@ -226,6 +286,16 @@ async def create(self, *, facility_id: str, request: BasePatient) -> Patient: value="51227265", ) ], + address=[ + Address( + address_line_1="2261 Market Street", + address_line_2="#4818", + city="San Francisco", + state=UsState.CA, + zip="94114", + country="USA", + ) + ], ), ) """ @@ -304,7 +374,7 @@ async def update(self, id: str, *, facility_id: str, request: BasePatient) -> Pa async def list(self, *, facility_id: typing.Optional[str] = None) -> ListPatientsResponse: """ - Lists all Patients receiving care at the specified Facility. + Lists all Patients receiving care at the specified Facility, or all Patients if no Facility is specified. Parameters: - facility_id: typing.Optional[str]. The ID of the Facility where the patient is receiving care. @@ -347,3 +417,52 @@ async def delete(self, id: str, *, facility_id: typing.Optional[str] = None) -> except JSONDecodeError: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_medical_record_summary(self, patient_id: str, *, conversion_type: str) -> str: + """ + Returns the URL for a medical record summary + + Parameters: + - patient_id: str. The ID of the Patient. + + - conversion_type: str. The type of conversion to perform. `html` or `pdf` + """ + _response = await self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"medical/v1/patient/{patient_id}/medical-record" + ), + params=remove_none_from_dict({"conversionType": conversion_type}), + headers=self._client_wrapper.get_headers(), + timeout=60, + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(str, _response.json()) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) + + async def get_medical_record_summary_status(self, patient_id: str) -> MedicalRecordStatus: + """ + Returns the status of a medical record summary + + Parameters: + - patient_id: str. The ID of the Patient. + """ + _response = await self._client_wrapper.httpx_client.request( + "GET", + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"medical/v1/patient/{patient_id}/medical-record-status" + ), + headers=self._client_wrapper.get_headers(), + timeout=60, + ) + if 200 <= _response.status_code < 300: + return pydantic.parse_obj_as(MedicalRecordStatus, _response.json()) # type: ignore + try: + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, body=_response.text) + raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/metriport/resources/medical/resources/patient/types/__init__.py b/src/metriport/resources/medical/resources/patient/types/__init__.py index 3159dce..a8fc2fe 100644 --- a/src/metriport/resources/medical/resources/patient/types/__init__.py +++ b/src/metriport/resources/medical/resources/patient/types/__init__.py @@ -1,26 +1,24 @@ # This file was auto-generated by Fern from our API Definition. -from .addresses import Addresses from .base_patient import BasePatient from .contact import Contact -from .contacts import Contacts from .drivers_license import DriversLicense from .facility_id import FacilityId from .list_patients_response import ListPatientsResponse +from .medical_record_status import MedicalRecordStatus from .patient import Patient -from .period import Period from .personal_identifier import PersonalIdentifier, PersonalIdentifier_DriversLicense +from .record_status import RecordStatus __all__ = [ - "Addresses", "BasePatient", "Contact", - "Contacts", "DriversLicense", "FacilityId", "ListPatientsResponse", + "MedicalRecordStatus", "Patient", - "Period", "PersonalIdentifier", "PersonalIdentifier_DriversLicense", + "RecordStatus", ] diff --git a/src/metriport/resources/medical/resources/patient/types/addresses.py b/src/metriport/resources/medical/resources/patient/types/addresses.py deleted file mode 100644 index baf45a3..0000000 --- a/src/metriport/resources/medical/resources/patient/types/addresses.py +++ /dev/null @@ -1,7 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -from .....commons.types.address import Address - -Addresses = typing.Union[Address, typing.List[Address]] diff --git a/src/metriport/resources/medical/resources/patient/types/base_patient.py b/src/metriport/resources/medical/resources/patient/types/base_patient.py index 0a4b9bb..1431f6b 100644 --- a/src/metriport/resources/medical/resources/patient/types/base_patient.py +++ b/src/metriport/resources/medical/resources/patient/types/base_patient.py @@ -4,8 +4,8 @@ import typing from ......core.datetime_utils import serialize_datetime -from .addresses import Addresses -from .contacts import Contacts +from .....commons.types.address import Address +from .contact import Contact from .personal_identifier import PersonalIdentifier try: @@ -18,9 +18,9 @@ class BasePatient(pydantic.BaseModel): first_name: str = pydantic.Field( alias="firstName", description=( - "The Patient's first name(s). \n" - "You may provide a comma/space delimited string to specify \n" - "multiple first and last names. For example, the following inputs \n" + "The Patient's first name(s).\n" + "You may provide a comma/space delimited string to specify\n" + "multiple first and last names. For example, the following inputs\n" 'would be equivalent: "John,Jonathan" & "John Jonathan"\n' ), ) @@ -31,10 +31,13 @@ class BasePatient(pydantic.BaseModel): ) personal_identifiers: typing.Optional[typing.List[PersonalIdentifier]] = pydantic.Field( alias="personalIdentifiers", - description=("An array of the Patient's personal IDs, such as a driver's license. \n" "May be empty.\n"), + description=("An array of the Patient's personal IDs, such as a driver's license.\n" "May be empty.\n"), + ) + address: typing.List[Address] + contact: typing.Optional[typing.List[Contact]] + external_id: typing.Optional[str] = pydantic.Field( + alias="externalID", description="An external Patient ID to associate to a Patient in Metriport." ) - address: typing.Optional[Addresses] - contact: typing.Optional[Contacts] def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/src/metriport/resources/medical/resources/patient/types/contact.py b/src/metriport/resources/medical/resources/patient/types/contact.py index 60d0d7c..78060f2 100644 --- a/src/metriport/resources/medical/resources/patient/types/contact.py +++ b/src/metriport/resources/medical/resources/patient/types/contact.py @@ -4,7 +4,6 @@ import typing from ......core.datetime_utils import serialize_datetime -from .facility_id import FacilityId try: import pydantic.v1 as pydantic # type: ignore @@ -19,10 +18,6 @@ class Contact(pydantic.BaseModel): Contact( phone="1234567899", email="karen@cvspharmacy.com", - facility_ids=[ - "2.16.840.1.113883.3.666.5.2004.4.2005", - "2.16.840.1.113883.3.666.123", - ], ) """ @@ -30,9 +25,6 @@ class Contact(pydantic.BaseModel): description="The Patient's 10 digit phone number, formatted `1234567899`." ) email: typing.Optional[str] = pydantic.Field(description="The Patient's email address.") - facility_ids: typing.List[FacilityId] = pydantic.Field( - alias="facilityIds", description="Array of the IDs of the Facilities where the Patient is receiving care." - ) def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} @@ -45,5 +37,4 @@ def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: class Config: frozen = True smart_union = True - allow_population_by_field_name = True json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/metriport/resources/medical/resources/patient/types/drivers_license.py b/src/metriport/resources/medical/resources/patient/types/drivers_license.py index c1087ab..d2f75f3 100644 --- a/src/metriport/resources/medical/resources/patient/types/drivers_license.py +++ b/src/metriport/resources/medical/resources/patient/types/drivers_license.py @@ -5,7 +5,7 @@ from ......core.datetime_utils import serialize_datetime from .....commons.types.us_state import UsState -from .period import Period +from .....fhir.types.period import Period try: import pydantic.v1 as pydantic # type: ignore diff --git a/src/metriport/resources/medical/resources/patient/types/period.py b/src/metriport/resources/medical/resources/patient/types/medical_record_status.py similarity index 75% rename from src/metriport/resources/medical/resources/patient/types/period.py rename to src/metriport/resources/medical/resources/patient/types/medical_record_status.py index fa5f6c8..b1fa625 100644 --- a/src/metriport/resources/medical/resources/patient/types/period.py +++ b/src/metriport/resources/medical/resources/patient/types/medical_record_status.py @@ -4,6 +4,7 @@ import typing from ......core.datetime_utils import serialize_datetime +from .record_status import RecordStatus try: import pydantic.v1 as pydantic # type: ignore @@ -11,9 +12,9 @@ import pydantic # type: ignore -class Period(pydantic.BaseModel): - start: typing.Optional[str] - end: typing.Optional[str] +class MedicalRecordStatus(pydantic.BaseModel): + html: RecordStatus = pydantic.Field(description="The status of the html conversion") + pdf: RecordStatus = pydantic.Field(description="The status of the pdf conversion") def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/src/metriport/resources/medical/resources/patient/types/patient.py b/src/metriport/resources/medical/resources/patient/types/patient.py index a4bb856..60c8e1f 100644 --- a/src/metriport/resources/medical/resources/patient/types/patient.py +++ b/src/metriport/resources/medical/resources/patient/types/patient.py @@ -5,6 +5,7 @@ from ......core.datetime_utils import serialize_datetime from .base_patient import BasePatient +from .facility_id import FacilityId try: import pydantic.v1 as pydantic # type: ignore @@ -14,7 +15,7 @@ class Patient(BasePatient): """ - from metriport import UsState + from metriport import Address, UsState from metriport.resources.medical import ( Patient, PersonalIdentifier_DriversLicense, @@ -33,15 +34,29 @@ class Patient(BasePatient): value="51227265", ) ], + address=[ + Address( + address_line_1="2261 Market Street", + address_line_2="#4818", + city="San Francisco", + state=UsState.CA, + zip="94114", + country="USA", + ) + ], + facility_ids=["2.16.840.1.113883.3.666.5.2004.4.2005"], ) """ id: str = pydantic.Field( description=( - "The ID assigned to this Patient. This ID will be used to uniquely \n" + "The ID assigned to this Patient. This ID will be used to uniquely\n" "identify this Patient in medical documents.\n" ) ) + facility_ids: typing.List[FacilityId] = pydantic.Field( + alias="facilityIds", description="Array of the IDs of the Facilities where the Patient is receiving care." + ) def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/src/metriport/resources/medical/resources/patient/types/record_status.py b/src/metriport/resources/medical/resources/patient/types/record_status.py new file mode 100644 index 0000000..ddb496e --- /dev/null +++ b/src/metriport/resources/medical/resources/patient/types/record_status.py @@ -0,0 +1,30 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ......core.datetime_utils import serialize_datetime + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class RecordStatus(pydantic.BaseModel): + exists: bool = pydantic.Field(description="Whether or not the record exists") + created_at: typing.Optional[str] = pydantic.Field(alias="createdAt", description="The date the record was created") + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/metriport/resources/medical/resources/webhooks/__init__.py b/src/metriport/resources/medical/resources/webhooks/__init__.py new file mode 100644 index 0000000..ce2eafa --- /dev/null +++ b/src/metriport/resources/medical/resources/webhooks/__init__.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +from .types import ( + ConsolidatedWebhookStatus, + Filters, + MapiWebhookStatus, + PayloadPatient, + WebhookDocumentDataPayload, + WebhookMetadataPayload, + WebhookPatientConsolidatedDataPayload, + WebhookPatientDocumentDataPayload, + WebhookPatientPayload, +) + +__all__ = [ + "ConsolidatedWebhookStatus", + "Filters", + "MapiWebhookStatus", + "PayloadPatient", + "WebhookDocumentDataPayload", + "WebhookMetadataPayload", + "WebhookPatientConsolidatedDataPayload", + "WebhookPatientDocumentDataPayload", + "WebhookPatientPayload", +] diff --git a/src/metriport/resources/medical/resources/webhooks/types/__init__.py b/src/metriport/resources/medical/resources/webhooks/types/__init__.py new file mode 100644 index 0000000..11124d4 --- /dev/null +++ b/src/metriport/resources/medical/resources/webhooks/types/__init__.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +from .consolidated_webhook_status import ConsolidatedWebhookStatus +from .filters import Filters +from .mapi_webhook_status import MapiWebhookStatus +from .payload_patient import PayloadPatient +from .webhook_document_data_payload import WebhookDocumentDataPayload +from .webhook_metadata_payload import WebhookMetadataPayload +from .webhook_patient_consolidated_data_payload import WebhookPatientConsolidatedDataPayload +from .webhook_patient_document_data_payload import WebhookPatientDocumentDataPayload +from .webhook_patient_payload import WebhookPatientPayload + +__all__ = [ + "ConsolidatedWebhookStatus", + "Filters", + "MapiWebhookStatus", + "PayloadPatient", + "WebhookDocumentDataPayload", + "WebhookMetadataPayload", + "WebhookPatientConsolidatedDataPayload", + "WebhookPatientDocumentDataPayload", + "WebhookPatientPayload", +] diff --git a/src/metriport/resources/medical/resources/webhooks/types/consolidated_webhook_status.py b/src/metriport/resources/medical/resources/webhooks/types/consolidated_webhook_status.py new file mode 100644 index 0000000..e20c8d4 --- /dev/null +++ b/src/metriport/resources/medical/resources/webhooks/types/consolidated_webhook_status.py @@ -0,0 +1,17 @@ +# This file was auto-generated by Fern from our API Definition. + +import enum +import typing + +T_Result = typing.TypeVar("T_Result") + + +class ConsolidatedWebhookStatus(str, enum.Enum): + COMPLETED = "completed" + FAILED = "failed" + + def visit(self, completed: typing.Callable[[], T_Result], failed: typing.Callable[[], T_Result]) -> T_Result: + if self is ConsolidatedWebhookStatus.COMPLETED: + return completed() + if self is ConsolidatedWebhookStatus.FAILED: + return failed() diff --git a/src/metriport/resources/medical/resources/webhooks/types/filters.py b/src/metriport/resources/medical/resources/webhooks/types/filters.py new file mode 100644 index 0000000..45c6542 --- /dev/null +++ b/src/metriport/resources/medical/resources/webhooks/types/filters.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +Filters = typing.Dict[str, typing.Optional[str]] diff --git a/src/metriport/resources/medical/resources/webhooks/types/mapi_webhook_status.py b/src/metriport/resources/medical/resources/webhooks/types/mapi_webhook_status.py new file mode 100644 index 0000000..86f6aab --- /dev/null +++ b/src/metriport/resources/medical/resources/webhooks/types/mapi_webhook_status.py @@ -0,0 +1,25 @@ +# This file was auto-generated by Fern from our API Definition. + +import enum +import typing + +T_Result = typing.TypeVar("T_Result") + + +class MapiWebhookStatus(str, enum.Enum): + PROCESSING = "processing" + COMPLETED = "completed" + FAILED = "failed" + + def visit( + self, + processing: typing.Callable[[], T_Result], + completed: typing.Callable[[], T_Result], + failed: typing.Callable[[], T_Result], + ) -> T_Result: + if self is MapiWebhookStatus.PROCESSING: + return processing() + if self is MapiWebhookStatus.COMPLETED: + return completed() + if self is MapiWebhookStatus.FAILED: + return failed() diff --git a/src/metriport/resources/medical/resources/webhooks/types/payload_patient.py b/src/metriport/resources/medical/resources/webhooks/types/payload_patient.py new file mode 100644 index 0000000..ccba112 --- /dev/null +++ b/src/metriport/resources/medical/resources/webhooks/types/payload_patient.py @@ -0,0 +1,40 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ......core.datetime_utils import serialize_datetime +from .....fhir.types.bundle import Bundle +from .consolidated_webhook_status import ConsolidatedWebhookStatus +from .filters import Filters + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class PayloadPatient(pydantic.BaseModel): + patient_id: str = pydantic.Field(alias="patientId", description="The ID of the patient.") + external_id: typing.Optional[str] = pydantic.Field( + alias="externalId", description="The external ID of the patient." + ) + status: ConsolidatedWebhookStatus = pydantic.Field(description="The status of the webhook.") + bundle: typing.Optional[Bundle] = pydantic.Field( + description="The FHIR bundle with the patient's consolidated data." + ) + filters: typing.Optional[Filters] = pydantic.Field(description="The filters used to obtain the bundle.") + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/metriport/resources/medical/resources/webhooks/types/webhook_document_data_payload.py b/src/metriport/resources/medical/resources/webhooks/types/webhook_document_data_payload.py new file mode 100644 index 0000000..eaf1bb4 --- /dev/null +++ b/src/metriport/resources/medical/resources/webhooks/types/webhook_document_data_payload.py @@ -0,0 +1,38 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ......core.datetime_utils import serialize_datetime +from .....fhir.types.codeable_concept import CodeableConcept + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class WebhookDocumentDataPayload(pydantic.BaseModel): + id: str = pydantic.Field(description="The ID of the Document.") + file_name: str = pydantic.Field(alias="fileName", description="The file name of the document.") + description: typing.Optional[str] = pydantic.Field(description="The description of the document.") + mime_type: typing.Optional[str] = pydantic.Field(alias="mimeType", description="The MIME type of the document.") + size: typing.Optional[int] = pydantic.Field(description="The size of the document in bytes.") + url: typing.Optional[str] = pydantic.Field(description="The URL of the document.") + status: typing.Optional[str] = pydantic.Field(description="The status of the document.") + indexed: typing.Optional[str] = pydantic.Field(description="The indexed date of the document in ISO-8601 format.") + type: typing.Optional[CodeableConcept] = pydantic.Field(description="The type of the document.") + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/metriport/resources/medical/resources/webhooks/types/webhook_metadata_payload.py b/src/metriport/resources/medical/resources/webhooks/types/webhook_metadata_payload.py new file mode 100644 index 0000000..f0eccdb --- /dev/null +++ b/src/metriport/resources/medical/resources/webhooks/types/webhook_metadata_payload.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ......core.datetime_utils import serialize_datetime + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class WebhookMetadataPayload(pydantic.BaseModel): + message_id: str = pydantic.Field(alias="messageId", description="The ID of the message.") + when: str = pydantic.Field(description="The timestamp of when the webhook was triggered.") + type: str = pydantic.Field(description="The type of the webhook.") + data: typing.Optional[typing.Any] = pydantic.Field(description="Any additional data associated with the webhook.") + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/metriport/resources/medical/resources/webhooks/types/webhook_patient_consolidated_data_payload.py b/src/metriport/resources/medical/resources/webhooks/types/webhook_patient_consolidated_data_payload.py new file mode 100644 index 0000000..72e85c4 --- /dev/null +++ b/src/metriport/resources/medical/resources/webhooks/types/webhook_patient_consolidated_data_payload.py @@ -0,0 +1,31 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ......core.datetime_utils import serialize_datetime +from .payload_patient import PayloadPatient +from .webhook_metadata_payload import WebhookMetadataPayload + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class WebhookPatientConsolidatedDataPayload(pydantic.BaseModel): + meta: WebhookMetadataPayload = pydantic.Field(description="The metadata of the webhook.") + patients: typing.List[PayloadPatient] = pydantic.Field(description="An array of Payload Patient objects.") + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/metriport/resources/medical/resources/webhooks/types/webhook_patient_document_data_payload.py b/src/metriport/resources/medical/resources/webhooks/types/webhook_patient_document_data_payload.py new file mode 100644 index 0000000..d47be71 --- /dev/null +++ b/src/metriport/resources/medical/resources/webhooks/types/webhook_patient_document_data_payload.py @@ -0,0 +1,33 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ......core.datetime_utils import serialize_datetime +from .webhook_metadata_payload import WebhookMetadataPayload +from .webhook_patient_payload import WebhookPatientPayload + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class WebhookPatientDocumentDataPayload(pydantic.BaseModel): + meta: WebhookMetadataPayload = pydantic.Field(description="The metadata of the webhook.") + patients: typing.List[WebhookPatientPayload] = pydantic.Field( + description="An array of WebhookPatientPayload objects." + ) + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/metriport/resources/medical/resources/webhooks/types/webhook_patient_payload.py b/src/metriport/resources/medical/resources/webhooks/types/webhook_patient_payload.py new file mode 100644 index 0000000..20a6169 --- /dev/null +++ b/src/metriport/resources/medical/resources/webhooks/types/webhook_patient_payload.py @@ -0,0 +1,39 @@ +# This file was auto-generated by Fern from our API Definition. + +import datetime as dt +import typing + +from ......core.datetime_utils import serialize_datetime +from .mapi_webhook_status import MapiWebhookStatus +from .webhook_document_data_payload import WebhookDocumentDataPayload + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class WebhookPatientPayload(pydantic.BaseModel): + patient_id: str = pydantic.Field(alias="patientId", description="The ID of the patient.") + external_id: typing.Optional[str] = pydantic.Field( + alias="externalId", description="The external ID of the patient." + ) + type: str = pydantic.Field(description="The type of the webhook.") + documents: typing.Optional[typing.List[WebhookDocumentDataPayload]] = pydantic.Field( + description="An array of WebhookDocumentDataPayload objects." + ) + status: MapiWebhookStatus = pydantic.Field(description="The status of the webhook.") + + def json(self, **kwargs: typing.Any) -> str: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().json(**kwargs_with_defaults) + + def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]: + kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} + return super().dict(**kwargs_with_defaults) + + class Config: + frozen = True + smart_union = True + allow_population_by_field_name = True + json_encoders = {dt.datetime: serialize_datetime}