From 81c71cfcdbb43892e4c5b49e8b6be5fb2b2d10c5 Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Mon, 20 Nov 2023 20:26:12 +0000 Subject: [PATCH 1/5] Release 8.0.0-alpha1 --- poetry.lock | 519 ++++++++++++++++++ pyproject.toml | 6 +- src/metriport/__init__.py | 4 +- src/metriport/client.py | 13 +- src/metriport/core/client_wrapper.py | 4 +- src/metriport/core/jsonable_encoder.py | 14 +- src/metriport/environment.py | 2 +- src/metriport/resources/__init__.py | 4 +- .../resources/commons/types/address.py | 20 +- src/metriport/resources/devices/__init__.py | 99 ---- src/metriport/resources/devices/client.py | 514 ----------------- .../resources/devices/resources/__init__.py | 20 - .../devices/resources/connect/__init__.py | 2 - .../devices/resources/connect/client.py | 82 --- .../devices/resources/users/__init__.py | 17 - .../devices/resources/users/client.py | 245 --------- .../devices/resources/users/types/__init__.py | 15 - .../users/types/connect_token_response.py | 33 -- .../types/connected_providers_response.py | 26 - .../users/types/metriport_user_id_response.py | 28 - .../resources/devices/types/__init__.py | 81 --- .../resources/devices/types/activity.py | 28 - .../devices/types/activity_durations.py | 30 - .../resources/devices/types/activity_log.py | 40 -- .../devices/types/activity_movement.py | 32 -- .../devices/types/activity_summary.py | 30 - .../resources/devices/types/aminos.py | 44 -- .../resources/devices/types/biometrics.py | 30 - .../resources/devices/types/blood_oxygen.py | 28 - src/metriport/resources/devices/types/body.py | 33 -- .../devices/types/connected_user_info.py | 28 - .../resources/devices/types/duration.py | 29 - .../resources/devices/types/elevation.py | 27 - .../devices/types/energy_expenditure.py | 28 - src/metriport/resources/devices/types/food.py | 30 - .../resources/devices/types/heart_rate.py | 30 - .../devices/types/heart_rate_variability.py | 27 - .../heart_rate_variability_measurement.py | 27 - .../resources/devices/types/lat_lon.py | 26 - .../resources/devices/types/location.py | 31 -- .../resources/devices/types/macros.py | 35 -- .../resources/devices/types/metadata.py | 31 -- .../resources/devices/types/metriport_data.py | 26 - .../resources/devices/types/micros.py | 50 -- .../resources/devices/types/nutrition.py | 28 - .../devices/types/nutrition_facts.py | 30 - .../devices/types/provider_source.py | 53 -- .../resources/devices/types/respiration.py | 33 -- .../resources/devices/types/sample.py | 29 - src/metriport/resources/devices/types/sex.py | 17 - .../resources/devices/types/sleep.py | 31 -- .../devices/types/sleep_biometrics.py | 32 -- .../devices/types/sleep_durations.py | 32 -- .../resources/devices/types/source_info.py | 29 - .../resources/devices/types/source_type.py | 17 - .../resources/devices/types/speed.py | 26 - .../resources/devices/types/temperature.py | 28 - .../devices/types/temperature_measurement.py | 27 - src/metriport/resources/devices/types/user.py | 36 -- src/metriport/resources/medical/__init__.py | 14 +- .../resources/medical/resources/__init__.py | 15 +- .../medical/resources/document/client.py | 95 +++- .../document/types/codeable_concept.py | 22 +- .../resources/document/types/coding.py | 17 +- .../document/types/document_query.py | 27 +- .../document/types/document_reference.py | 39 +- .../resources/document/types/document_url.py | 13 +- .../document/types/list_documents_response.py | 44 +- .../resources/document/types/progress.py | 15 +- .../medical/resources/facility/__init__.py | 4 +- .../medical/resources/facility/client.py | 170 +++++- .../resources/facility/types/__init__.py | 3 +- .../resources/facility/types/base_facility.py | 7 +- .../resources/facility/types/facility.py | 33 +- .../types/list_facilities_response.py} | 12 +- .../medical/resources/fhir/__init__.py | 6 - .../medical/resources/fhir/client.py | 65 ++- .../medical/resources/fhir/types/__init__.py | 6 - .../fhir/types/consolidated_count_response.py | 7 +- .../medical/resources/fhir/types/filter.py | 7 +- .../get_consolidated_query_status_response.py | 19 +- .../types/resource_type_for_consolidation.py | 8 - .../types/resources_searchable_by_patient.py | 261 --------- .../types/resources_searchable_by_subject.py | 17 - .../start_consolidated_query_response.py | 7 +- .../resources/organization/__init__.py | 4 +- .../medical/resources/organization/client.py | 170 +++++- .../resources/organization/types/__init__.py | 4 +- .../organization/types/organization.py | 33 +- ...organization.py => organization_create.py} | 9 +- .../medical/resources/patient/__init__.py | 2 + .../medical/resources/patient/client.py | 114 +++- .../resources/patient/types/__init__.py | 2 + .../resources/patient/types/base_patient.py | 7 +- .../resources/patient/types/contact.py | 20 +- .../patient/types/drivers_license.py | 7 +- .../resources/patient/types/facility_id.py | 3 + .../patient/types/list_patients_response.py} | 12 +- .../resources/patient/types/patient.py | 35 +- .../medical/resources/patient/types/period.py | 7 +- .../patient/types/personal_identifier.py | 10 + 101 files changed, 1479 insertions(+), 2809 deletions(-) create mode 100644 poetry.lock delete mode 100644 src/metriport/resources/devices/__init__.py delete mode 100644 src/metriport/resources/devices/client.py delete mode 100644 src/metriport/resources/devices/resources/__init__.py delete mode 100644 src/metriport/resources/devices/resources/connect/__init__.py delete mode 100644 src/metriport/resources/devices/resources/connect/client.py delete mode 100644 src/metriport/resources/devices/resources/users/__init__.py delete mode 100644 src/metriport/resources/devices/resources/users/client.py delete mode 100644 src/metriport/resources/devices/resources/users/types/__init__.py delete mode 100644 src/metriport/resources/devices/resources/users/types/connect_token_response.py delete mode 100644 src/metriport/resources/devices/resources/users/types/connected_providers_response.py delete mode 100644 src/metriport/resources/devices/resources/users/types/metriport_user_id_response.py delete mode 100644 src/metriport/resources/devices/types/__init__.py delete mode 100644 src/metriport/resources/devices/types/activity.py delete mode 100644 src/metriport/resources/devices/types/activity_durations.py delete mode 100644 src/metriport/resources/devices/types/activity_log.py delete mode 100644 src/metriport/resources/devices/types/activity_movement.py delete mode 100644 src/metriport/resources/devices/types/activity_summary.py delete mode 100644 src/metriport/resources/devices/types/aminos.py delete mode 100644 src/metriport/resources/devices/types/biometrics.py delete mode 100644 src/metriport/resources/devices/types/blood_oxygen.py delete mode 100644 src/metriport/resources/devices/types/body.py delete mode 100644 src/metriport/resources/devices/types/connected_user_info.py delete mode 100644 src/metriport/resources/devices/types/duration.py delete mode 100644 src/metriport/resources/devices/types/elevation.py delete mode 100644 src/metriport/resources/devices/types/energy_expenditure.py delete mode 100644 src/metriport/resources/devices/types/food.py delete mode 100644 src/metriport/resources/devices/types/heart_rate.py delete mode 100644 src/metriport/resources/devices/types/heart_rate_variability.py delete mode 100644 src/metriport/resources/devices/types/heart_rate_variability_measurement.py delete mode 100644 src/metriport/resources/devices/types/lat_lon.py delete mode 100644 src/metriport/resources/devices/types/location.py delete mode 100644 src/metriport/resources/devices/types/macros.py delete mode 100644 src/metriport/resources/devices/types/metadata.py delete mode 100644 src/metriport/resources/devices/types/metriport_data.py delete mode 100644 src/metriport/resources/devices/types/micros.py delete mode 100644 src/metriport/resources/devices/types/nutrition.py delete mode 100644 src/metriport/resources/devices/types/nutrition_facts.py delete mode 100644 src/metriport/resources/devices/types/provider_source.py delete mode 100644 src/metriport/resources/devices/types/respiration.py delete mode 100644 src/metriport/resources/devices/types/sample.py delete mode 100644 src/metriport/resources/devices/types/sex.py delete mode 100644 src/metriport/resources/devices/types/sleep.py delete mode 100644 src/metriport/resources/devices/types/sleep_biometrics.py delete mode 100644 src/metriport/resources/devices/types/sleep_durations.py delete mode 100644 src/metriport/resources/devices/types/source_info.py delete mode 100644 src/metriport/resources/devices/types/source_type.py delete mode 100644 src/metriport/resources/devices/types/speed.py delete mode 100644 src/metriport/resources/devices/types/temperature.py delete mode 100644 src/metriport/resources/devices/types/temperature_measurement.py delete mode 100644 src/metriport/resources/devices/types/user.py rename src/metriport/resources/{devices/resources/users/types/revoke_access_to_provider_response.py => medical/resources/facility/types/list_facilities_response.py} (75%) delete mode 100644 src/metriport/resources/medical/resources/fhir/types/resource_type_for_consolidation.py delete mode 100644 src/metriport/resources/medical/resources/fhir/types/resources_searchable_by_patient.py delete mode 100644 src/metriport/resources/medical/resources/fhir/types/resources_searchable_by_subject.py rename src/metriport/resources/medical/resources/organization/types/{base_organization.py => organization_create.py} (87%) rename src/metriport/resources/{devices/resources/users/types/delete_user_response.py => medical/resources/patient/types/list_patients_response.py} (75%) diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 0000000..05e7950 --- /dev/null +++ b/poetry.lock @@ -0,0 +1,519 @@ +# This file is automatically @generated by Poetry 1.7.0 and should not be changed by hand. + +[[package]] +name = "annotated-types" +version = "0.5.0" +description = "Reusable constraint types to use with typing.Annotated" +optional = false +python-versions = ">=3.7" +files = [ + {file = "annotated_types-0.5.0-py3-none-any.whl", hash = "sha256:58da39888f92c276ad970249761ebea80ba544b77acddaa1a4d6cf78287d45fd"}, + {file = "annotated_types-0.5.0.tar.gz", hash = "sha256:47cdc3490d9ac1506ce92c7aaa76c579dc3509ff11e098fc867e5130ab7be802"}, +] + +[package.dependencies] +typing-extensions = {version = ">=4.0.0", markers = "python_version < \"3.9\""} + +[[package]] +name = "anyio" +version = "3.7.1" +description = "High level compatibility layer for multiple asynchronous event loop implementations" +optional = false +python-versions = ">=3.7" +files = [ + {file = "anyio-3.7.1-py3-none-any.whl", hash = "sha256:91dee416e570e92c64041bd18b900d1d6fa78dff7048769ce5ac5ddad004fbb5"}, + {file = "anyio-3.7.1.tar.gz", hash = "sha256:44a3c9aba0f5defa43261a8b3efb97891f2bd7d804e0e1f56419befa1adfc780"}, +] + +[package.dependencies] +exceptiongroup = {version = "*", markers = "python_version < \"3.11\""} +idna = ">=2.8" +sniffio = ">=1.1" +typing-extensions = {version = "*", markers = "python_version < \"3.8\""} + +[package.extras] +doc = ["Sphinx", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphinx-rtd-theme (>=1.2.2)", "sphinxcontrib-jquery"] +test = ["anyio[trio]", "coverage[toml] (>=4.5)", "hypothesis (>=4.0)", "mock (>=4)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "uvloop (>=0.17)"] +trio = ["trio (<0.22)"] + +[[package]] +name = "certifi" +version = "2023.11.17" +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"}, +] + +[[package]] +name = "colorama" +version = "0.4.6" +description = "Cross-platform colored terminal text." +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +files = [ + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, +] + +[[package]] +name = "exceptiongroup" +version = "1.1.3" +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"}, +] + +[package.extras] +test = ["pytest (>=6)"] + +[[package]] +name = "h11" +version = "0.14.0" +description = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1" +optional = false +python-versions = ">=3.7" +files = [ + {file = "h11-0.14.0-py3-none-any.whl", hash = "sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761"}, + {file = "h11-0.14.0.tar.gz", hash = "sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d"}, +] + +[package.dependencies] +typing-extensions = {version = "*", markers = "python_version < \"3.8\""} + +[[package]] +name = "httpcore" +version = "0.17.3" +description = "A minimal low-level HTTP client." +optional = false +python-versions = ">=3.7" +files = [ + {file = "httpcore-0.17.3-py3-none-any.whl", hash = "sha256:c2789b767ddddfa2a5782e3199b2b7f6894540b17b16ec26b2c4d8e103510b87"}, + {file = "httpcore-0.17.3.tar.gz", hash = "sha256:a6f30213335e34c1ade7be6ec7c47f19f50c56db36abef1a9dfa3815b1cb3888"}, +] + +[package.dependencies] +anyio = ">=3.0,<5.0" +certifi = "*" +h11 = ">=0.13,<0.15" +sniffio = "==1.*" + +[package.extras] +http2 = ["h2 (>=3,<5)"] +socks = ["socksio (==1.*)"] + +[[package]] +name = "httpx" +version = "0.24.1" +description = "The next generation HTTP client." +optional = false +python-versions = ">=3.7" +files = [ + {file = "httpx-0.24.1-py3-none-any.whl", hash = "sha256:06781eb9ac53cde990577af654bd990a4949de37a28bdb4a230d434f3a30b9bd"}, + {file = "httpx-0.24.1.tar.gz", hash = "sha256:5853a43053df830c20f8110c5e69fe44d035d850b2dfe795e196f00fdb774bdd"}, +] + +[package.dependencies] +certifi = "*" +httpcore = ">=0.15.0,<0.18.0" +idna = "*" +sniffio = "*" + +[package.extras] +brotli = ["brotli", "brotlicffi"] +cli = ["click (==8.*)", "pygments (==2.*)", "rich (>=10,<14)"] +http2 = ["h2 (>=3,<5)"] +socks = ["socksio (==1.*)"] + +[[package]] +name = "idna" +version = "3.4" +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"}, +] + +[[package]] +name = "importlib-metadata" +version = "6.7.0" +description = "Read metadata from Python packages" +optional = false +python-versions = ">=3.7" +files = [ + {file = "importlib_metadata-6.7.0-py3-none-any.whl", hash = "sha256:cb52082e659e97afc5dac71e79de97d8681de3aa07ff18578330904a9d18e5b5"}, + {file = "importlib_metadata-6.7.0.tar.gz", hash = "sha256:1aaf550d4f73e5d6783e7acb77aec43d49da8017410afae93822cc9cca98c4d4"}, +] + +[package.dependencies] +typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""} +zipp = ">=0.5" + +[package.extras] +docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] +perf = ["ipython"] +testing = ["flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pyfakefs", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-mypy (>=0.9.1)", "pytest-perf (>=0.9.2)", "pytest-ruff"] + +[[package]] +name = "iniconfig" +version = "2.0.0" +description = "brain-dead simple config-ini parsing" +optional = false +python-versions = ">=3.7" +files = [ + {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, + {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, +] + +[[package]] +name = "mypy" +version = "0.971" +description = "Optional static typing for Python" +optional = false +python-versions = ">=3.6" +files = [ + {file = "mypy-0.971-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:f2899a3cbd394da157194f913a931edfd4be5f274a88041c9dc2d9cdcb1c315c"}, + {file = "mypy-0.971-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:98e02d56ebe93981c41211c05adb630d1d26c14195d04d95e49cd97dbc046dc5"}, + {file = "mypy-0.971-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:19830b7dba7d5356d3e26e2427a2ec91c994cd92d983142cbd025ebe81d69cf3"}, + {file = "mypy-0.971-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:02ef476f6dcb86e6f502ae39a16b93285fef97e7f1ff22932b657d1ef1f28655"}, + {file = "mypy-0.971-cp310-cp310-win_amd64.whl", hash = "sha256:25c5750ba5609a0c7550b73a33deb314ecfb559c350bb050b655505e8aed4103"}, + {file = "mypy-0.971-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:d3348e7eb2eea2472db611486846742d5d52d1290576de99d59edeb7cd4a42ca"}, + {file = "mypy-0.971-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:3fa7a477b9900be9b7dd4bab30a12759e5abe9586574ceb944bc29cddf8f0417"}, + {file = "mypy-0.971-cp36-cp36m-win_amd64.whl", hash = "sha256:2ad53cf9c3adc43cf3bea0a7d01a2f2e86db9fe7596dfecb4496a5dda63cbb09"}, + {file = "mypy-0.971-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:855048b6feb6dfe09d3353466004490b1872887150c5bb5caad7838b57328cc8"}, + {file = "mypy-0.971-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:23488a14a83bca6e54402c2e6435467a4138785df93ec85aeff64c6170077fb0"}, + {file = "mypy-0.971-cp37-cp37m-win_amd64.whl", hash = "sha256:4b21e5b1a70dfb972490035128f305c39bc4bc253f34e96a4adf9127cf943eb2"}, + {file = "mypy-0.971-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:9796a2ba7b4b538649caa5cecd398d873f4022ed2333ffde58eaf604c4d2cb27"}, + {file = "mypy-0.971-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:5a361d92635ad4ada1b1b2d3630fc2f53f2127d51cf2def9db83cba32e47c856"}, + {file = "mypy-0.971-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:b793b899f7cf563b1e7044a5c97361196b938e92f0a4343a5d27966a53d2ec71"}, + {file = "mypy-0.971-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:d1ea5d12c8e2d266b5fb8c7a5d2e9c0219fedfeb493b7ed60cd350322384ac27"}, + {file = "mypy-0.971-cp38-cp38-win_amd64.whl", hash = "sha256:23c7ff43fff4b0df93a186581885c8512bc50fc4d4910e0f838e35d6bb6b5e58"}, + {file = "mypy-0.971-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:1f7656b69974a6933e987ee8ffb951d836272d6c0f81d727f1d0e2696074d9e6"}, + {file = "mypy-0.971-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:d2022bfadb7a5c2ef410d6a7c9763188afdb7f3533f22a0a32be10d571ee4bbe"}, + {file = "mypy-0.971-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:ef943c72a786b0f8d90fd76e9b39ce81fb7171172daf84bf43eaf937e9f220a9"}, + {file = "mypy-0.971-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:d744f72eb39f69312bc6c2abf8ff6656973120e2eb3f3ec4f758ed47e414a4bf"}, + {file = "mypy-0.971-cp39-cp39-win_amd64.whl", hash = "sha256:77a514ea15d3007d33a9e2157b0ba9c267496acf12a7f2b9b9f8446337aac5b0"}, + {file = "mypy-0.971-py3-none-any.whl", hash = "sha256:0d054ef16b071149917085f51f89555a576e2618d5d9dd70bd6eea6410af3ac9"}, + {file = "mypy-0.971.tar.gz", hash = "sha256:40b0f21484238269ae6a57200c807d80debc6459d444c0489a102d7c6a75fa56"}, +] + +[package.dependencies] +mypy-extensions = ">=0.4.3" +tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} +typed-ast = {version = ">=1.4.0,<2", markers = "python_version < \"3.8\""} +typing-extensions = ">=3.10" + +[package.extras] +dmypy = ["psutil (>=4.0)"] +python2 = ["typed-ast (>=1.4.0,<2)"] +reports = ["lxml"] + +[[package]] +name = "mypy-extensions" +version = "1.0.0" +description = "Type system extensions for programs checked with the mypy type checker." +optional = false +python-versions = ">=3.5" +files = [ + {file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"}, + {file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"}, +] + +[[package]] +name = "packaging" +version = "23.2" +description = "Core utilities for Python packages" +optional = false +python-versions = ">=3.7" +files = [ + {file = "packaging-23.2-py3-none-any.whl", hash = "sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7"}, + {file = "packaging-23.2.tar.gz", hash = "sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5"}, +] + +[[package]] +name = "pluggy" +version = "1.2.0" +description = "plugin and hook calling mechanisms for python" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pluggy-1.2.0-py3-none-any.whl", hash = "sha256:c2fd55a7d7a3863cba1a013e4e2414658b1d07b6bc57b3919e0c63c9abb99849"}, + {file = "pluggy-1.2.0.tar.gz", hash = "sha256:d12f0c4b579b15f5e054301bb226ee85eeeba08ffec228092f8defbaa3a4c4b3"}, +] + +[package.dependencies] +importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} + +[package.extras] +dev = ["pre-commit", "tox"] +testing = ["pytest", "pytest-benchmark"] + +[[package]] +name = "pydantic" +version = "2.4.2" +description = "Data validation using Python type hints" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pydantic-2.4.2-py3-none-any.whl", hash = "sha256:bc3ddf669d234f4220e6e1c4d96b061abe0998185a8d7855c0126782b7abc8c1"}, + {file = "pydantic-2.4.2.tar.gz", hash = "sha256:94f336138093a5d7f426aac732dcfe7ab4eb4da243c88f891d65deb4a2556ee7"}, +] + +[package.dependencies] +annotated-types = ">=0.4.0" +pydantic-core = "2.10.1" +typing-extensions = ">=4.6.1" + +[package.extras] +email = ["email-validator (>=2.0.0)"] + +[[package]] +name = "pydantic-core" +version = "2.10.1" +description = "" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pydantic_core-2.10.1-cp310-cp310-macosx_10_7_x86_64.whl", hash = "sha256:d64728ee14e667ba27c66314b7d880b8eeb050e58ffc5fec3b7a109f8cddbd63"}, + {file = "pydantic_core-2.10.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:48525933fea744a3e7464c19bfede85df4aba79ce90c60b94d8b6e1eddd67096"}, + {file = "pydantic_core-2.10.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ef337945bbd76cce390d1b2496ccf9f90b1c1242a3a7bc242ca4a9fc5993427a"}, + {file = "pydantic_core-2.10.1-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:a1392e0638af203cee360495fd2cfdd6054711f2db5175b6e9c3c461b76f5175"}, + {file = "pydantic_core-2.10.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:0675ba5d22de54d07bccde38997e780044dcfa9a71aac9fd7d4d7a1d2e3e65f7"}, + {file = "pydantic_core-2.10.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:128552af70a64660f21cb0eb4876cbdadf1a1f9d5de820fed6421fa8de07c893"}, + {file = "pydantic_core-2.10.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8f6e6aed5818c264412ac0598b581a002a9f050cb2637a84979859e70197aa9e"}, + {file = "pydantic_core-2.10.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:ecaac27da855b8d73f92123e5f03612b04c5632fd0a476e469dfc47cd37d6b2e"}, + {file = "pydantic_core-2.10.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:b3c01c2fb081fced3bbb3da78510693dc7121bb893a1f0f5f4b48013201f362e"}, + {file = "pydantic_core-2.10.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:92f675fefa977625105708492850bcbc1182bfc3e997f8eecb866d1927c98ae6"}, + {file = "pydantic_core-2.10.1-cp310-none-win32.whl", hash = "sha256:420a692b547736a8d8703c39ea935ab5d8f0d2573f8f123b0a294e49a73f214b"}, + {file = "pydantic_core-2.10.1-cp310-none-win_amd64.whl", hash = "sha256:0880e239827b4b5b3e2ce05e6b766a7414e5f5aedc4523be6b68cfbc7f61c5d0"}, + {file = "pydantic_core-2.10.1-cp311-cp311-macosx_10_7_x86_64.whl", hash = "sha256:073d4a470b195d2b2245d0343569aac7e979d3a0dcce6c7d2af6d8a920ad0bea"}, + {file = "pydantic_core-2.10.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:600d04a7b342363058b9190d4e929a8e2e715c5682a70cc37d5ded1e0dd370b4"}, + {file = "pydantic_core-2.10.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:39215d809470f4c8d1881758575b2abfb80174a9e8daf8f33b1d4379357e417c"}, + {file = "pydantic_core-2.10.1-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:eeb3d3d6b399ffe55f9a04e09e635554012f1980696d6b0aca3e6cf42a17a03b"}, + {file = "pydantic_core-2.10.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a7a7902bf75779bc12ccfc508bfb7a4c47063f748ea3de87135d433a4cca7a2f"}, + {file = "pydantic_core-2.10.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3625578b6010c65964d177626fde80cf60d7f2e297d56b925cb5cdeda6e9925a"}, + {file = "pydantic_core-2.10.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:caa48fc31fc7243e50188197b5f0c4228956f97b954f76da157aae7f67269ae8"}, + {file = "pydantic_core-2.10.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:07ec6d7d929ae9c68f716195ce15e745b3e8fa122fc67698ac6498d802ed0fa4"}, + {file = "pydantic_core-2.10.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:e6f31a17acede6a8cd1ae2d123ce04d8cca74056c9d456075f4f6f85de055607"}, + {file = "pydantic_core-2.10.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:d8f1ebca515a03e5654f88411420fea6380fc841d1bea08effb28184e3d4899f"}, + {file = "pydantic_core-2.10.1-cp311-none-win32.whl", hash = "sha256:6db2eb9654a85ada248afa5a6db5ff1cf0f7b16043a6b070adc4a5be68c716d6"}, + {file = "pydantic_core-2.10.1-cp311-none-win_amd64.whl", hash = "sha256:4a5be350f922430997f240d25f8219f93b0c81e15f7b30b868b2fddfc2d05f27"}, + {file = "pydantic_core-2.10.1-cp311-none-win_arm64.whl", hash = "sha256:5fdb39f67c779b183b0c853cd6b45f7db84b84e0571b3ef1c89cdb1dfc367325"}, + {file = "pydantic_core-2.10.1-cp312-cp312-macosx_10_7_x86_64.whl", hash = "sha256:b1f22a9ab44de5f082216270552aa54259db20189e68fc12484873d926426921"}, + {file = "pydantic_core-2.10.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8572cadbf4cfa95fb4187775b5ade2eaa93511f07947b38f4cd67cf10783b118"}, + {file = "pydantic_core-2.10.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:db9a28c063c7c00844ae42a80203eb6d2d6bbb97070cfa00194dff40e6f545ab"}, + {file = "pydantic_core-2.10.1-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:0e2a35baa428181cb2270a15864ec6286822d3576f2ed0f4cd7f0c1708472aff"}, + {file = "pydantic_core-2.10.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:05560ab976012bf40f25d5225a58bfa649bb897b87192a36c6fef1ab132540d7"}, + {file = "pydantic_core-2.10.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d6495008733c7521a89422d7a68efa0a0122c99a5861f06020ef5b1f51f9ba7c"}, + {file = "pydantic_core-2.10.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:14ac492c686defc8e6133e3a2d9eaf5261b3df26b8ae97450c1647286750b901"}, + {file = "pydantic_core-2.10.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:8282bab177a9a3081fd3d0a0175a07a1e2bfb7fcbbd949519ea0980f8a07144d"}, + {file = "pydantic_core-2.10.1-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:aafdb89fdeb5fe165043896817eccd6434aee124d5ee9b354f92cd574ba5e78f"}, + {file = "pydantic_core-2.10.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:f6defd966ca3b187ec6c366604e9296f585021d922e666b99c47e78738b5666c"}, + {file = "pydantic_core-2.10.1-cp312-none-win32.whl", hash = "sha256:7c4d1894fe112b0864c1fa75dffa045720a194b227bed12f4be7f6045b25209f"}, + {file = "pydantic_core-2.10.1-cp312-none-win_amd64.whl", hash = "sha256:5994985da903d0b8a08e4935c46ed8daf5be1cf217489e673910951dc533d430"}, + {file = "pydantic_core-2.10.1-cp312-none-win_arm64.whl", hash = "sha256:0d8a8adef23d86d8eceed3e32e9cca8879c7481c183f84ed1a8edc7df073af94"}, + {file = "pydantic_core-2.10.1-cp37-cp37m-macosx_10_7_x86_64.whl", hash = "sha256:9badf8d45171d92387410b04639d73811b785b5161ecadabf056ea14d62d4ede"}, + {file = "pydantic_core-2.10.1-cp37-cp37m-macosx_11_0_arm64.whl", hash = "sha256:ebedb45b9feb7258fac0a268a3f6bec0a2ea4d9558f3d6f813f02ff3a6dc6698"}, + {file = "pydantic_core-2.10.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cfe1090245c078720d250d19cb05d67e21a9cd7c257698ef139bc41cf6c27b4f"}, + {file = "pydantic_core-2.10.1-cp37-cp37m-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:e357571bb0efd65fd55f18db0a2fb0ed89d0bb1d41d906b138f088933ae618bb"}, + {file = "pydantic_core-2.10.1-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b3dcd587b69bbf54fc04ca157c2323b8911033e827fffaecf0cafa5a892a0904"}, + {file = "pydantic_core-2.10.1-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9c120c9ce3b163b985a3b966bb701114beb1da4b0468b9b236fc754783d85aa3"}, + {file = "pydantic_core-2.10.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:15d6bca84ffc966cc9976b09a18cf9543ed4d4ecbd97e7086f9ce9327ea48891"}, + {file = "pydantic_core-2.10.1-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:5cabb9710f09d5d2e9e2748c3e3e20d991a4c5f96ed8f1132518f54ab2967221"}, + {file = "pydantic_core-2.10.1-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:82f55187a5bebae7d81d35b1e9aaea5e169d44819789837cdd4720d768c55d15"}, + {file = "pydantic_core-2.10.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:1d40f55222b233e98e3921df7811c27567f0e1a4411b93d4c5c0f4ce131bc42f"}, + {file = "pydantic_core-2.10.1-cp37-none-win32.whl", hash = "sha256:14e09ff0b8fe6e46b93d36a878f6e4a3a98ba5303c76bb8e716f4878a3bee92c"}, + {file = "pydantic_core-2.10.1-cp37-none-win_amd64.whl", hash = "sha256:1396e81b83516b9d5c9e26a924fa69164156c148c717131f54f586485ac3c15e"}, + {file = "pydantic_core-2.10.1-cp38-cp38-macosx_10_7_x86_64.whl", hash = "sha256:6835451b57c1b467b95ffb03a38bb75b52fb4dc2762bb1d9dbed8de31ea7d0fc"}, + {file = "pydantic_core-2.10.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:b00bc4619f60c853556b35f83731bd817f989cba3e97dc792bb8c97941b8053a"}, + {file = "pydantic_core-2.10.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0fa467fd300a6f046bdb248d40cd015b21b7576c168a6bb20aa22e595c8ffcdd"}, + {file = "pydantic_core-2.10.1-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d99277877daf2efe074eae6338453a4ed54a2d93fb4678ddfe1209a0c93a2468"}, + {file = "pydantic_core-2.10.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:fa7db7558607afeccb33c0e4bf1c9a9a835e26599e76af6fe2fcea45904083a6"}, + {file = "pydantic_core-2.10.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:aad7bd686363d1ce4ee930ad39f14e1673248373f4a9d74d2b9554f06199fb58"}, + {file = "pydantic_core-2.10.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:443fed67d33aa85357464f297e3d26e570267d1af6fef1c21ca50921d2976302"}, + {file = "pydantic_core-2.10.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:042462d8d6ba707fd3ce9649e7bf268633a41018d6a998fb5fbacb7e928a183e"}, + {file = "pydantic_core-2.10.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:ecdbde46235f3d560b18be0cb706c8e8ad1b965e5c13bbba7450c86064e96561"}, + {file = "pydantic_core-2.10.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:ed550ed05540c03f0e69e6d74ad58d026de61b9eaebebbaaf8873e585cbb18de"}, + {file = "pydantic_core-2.10.1-cp38-none-win32.whl", hash = "sha256:8cdbbd92154db2fec4ec973d45c565e767ddc20aa6dbaf50142676484cbff8ee"}, + {file = "pydantic_core-2.10.1-cp38-none-win_amd64.whl", hash = "sha256:9f6f3e2598604956480f6c8aa24a3384dbf6509fe995d97f6ca6103bb8c2534e"}, + {file = "pydantic_core-2.10.1-cp39-cp39-macosx_10_7_x86_64.whl", hash = "sha256:655f8f4c8d6a5963c9a0687793da37b9b681d9ad06f29438a3b2326d4e6b7970"}, + {file = "pydantic_core-2.10.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:e570ffeb2170e116a5b17e83f19911020ac79d19c96f320cbfa1fa96b470185b"}, + {file = "pydantic_core-2.10.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:64322bfa13e44c6c30c518729ef08fda6026b96d5c0be724b3c4ae4da939f875"}, + {file = "pydantic_core-2.10.1-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:485a91abe3a07c3a8d1e082ba29254eea3e2bb13cbbd4351ea4e5a21912cc9b0"}, + {file = "pydantic_core-2.10.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f7c2b8eb9fc872e68b46eeaf835e86bccc3a58ba57d0eedc109cbb14177be531"}, + {file = "pydantic_core-2.10.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a5cb87bdc2e5f620693148b5f8f842d293cae46c5f15a1b1bf7ceeed324a740c"}, + {file = "pydantic_core-2.10.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:25bd966103890ccfa028841a8f30cebcf5875eeac8c4bde4fe221364c92f0c9a"}, + {file = "pydantic_core-2.10.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f323306d0556351735b54acbf82904fe30a27b6a7147153cbe6e19aaaa2aa429"}, + {file = "pydantic_core-2.10.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:0c27f38dc4fbf07b358b2bc90edf35e82d1703e22ff2efa4af4ad5de1b3833e7"}, + {file = "pydantic_core-2.10.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:f1365e032a477c1430cfe0cf2856679529a2331426f8081172c4a74186f1d595"}, + {file = "pydantic_core-2.10.1-cp39-none-win32.whl", hash = "sha256:a1c311fd06ab3b10805abb72109f01a134019739bd3286b8ae1bc2fc4e50c07a"}, + {file = "pydantic_core-2.10.1-cp39-none-win_amd64.whl", hash = "sha256:ae8a8843b11dc0b03b57b52793e391f0122e740de3df1474814c700d2622950a"}, + {file = "pydantic_core-2.10.1-pp310-pypy310_pp73-macosx_10_7_x86_64.whl", hash = "sha256:d43002441932f9a9ea5d6f9efaa2e21458221a3a4b417a14027a1d530201ef1b"}, + {file = "pydantic_core-2.10.1-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:fcb83175cc4936a5425dde3356f079ae03c0802bbdf8ff82c035f8a54b333521"}, + {file = "pydantic_core-2.10.1-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:962ed72424bf1f72334e2f1e61b68f16c0e596f024ca7ac5daf229f7c26e4208"}, + {file = "pydantic_core-2.10.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2cf5bb4dd67f20f3bbc1209ef572a259027c49e5ff694fa56bed62959b41e1f9"}, + {file = "pydantic_core-2.10.1-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:e544246b859f17373bed915182ab841b80849ed9cf23f1f07b73b7c58baee5fb"}, + {file = "pydantic_core-2.10.1-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:c0877239307b7e69d025b73774e88e86ce82f6ba6adf98f41069d5b0b78bd1bf"}, + {file = "pydantic_core-2.10.1-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:53df009d1e1ba40f696f8995683e067e3967101d4bb4ea6f667931b7d4a01357"}, + {file = "pydantic_core-2.10.1-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:a1254357f7e4c82e77c348dabf2d55f1d14d19d91ff025004775e70a6ef40ada"}, + {file = "pydantic_core-2.10.1-pp37-pypy37_pp73-macosx_10_7_x86_64.whl", hash = "sha256:524ff0ca3baea164d6d93a32c58ac79eca9f6cf713586fdc0adb66a8cdeab96a"}, + {file = "pydantic_core-2.10.1-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3f0ac9fb8608dbc6eaf17956bf623c9119b4db7dbb511650910a82e261e6600f"}, + {file = "pydantic_core-2.10.1-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:320f14bd4542a04ab23747ff2c8a778bde727158b606e2661349557f0770711e"}, + {file = "pydantic_core-2.10.1-pp37-pypy37_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:63974d168b6233b4ed6a0046296803cb13c56637a7b8106564ab575926572a55"}, + {file = "pydantic_core-2.10.1-pp37-pypy37_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:417243bf599ba1f1fef2bb8c543ceb918676954734e2dcb82bf162ae9d7bd514"}, + {file = "pydantic_core-2.10.1-pp37-pypy37_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:dda81e5ec82485155a19d9624cfcca9be88a405e2857354e5b089c2a982144b2"}, + {file = "pydantic_core-2.10.1-pp37-pypy37_pp73-win_amd64.whl", hash = "sha256:14cfbb00959259e15d684505263d5a21732b31248a5dd4941f73a3be233865b9"}, + {file = "pydantic_core-2.10.1-pp38-pypy38_pp73-macosx_10_7_x86_64.whl", hash = "sha256:631cb7415225954fdcc2a024119101946793e5923f6c4d73a5914d27eb3d3a05"}, + {file = "pydantic_core-2.10.1-pp38-pypy38_pp73-macosx_11_0_arm64.whl", hash = "sha256:bec7dd208a4182e99c5b6c501ce0b1f49de2802448d4056091f8e630b28e9a52"}, + {file = "pydantic_core-2.10.1-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:149b8a07712f45b332faee1a2258d8ef1fb4a36f88c0c17cb687f205c5dc6e7d"}, + {file = "pydantic_core-2.10.1-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4d966c47f9dd73c2d32a809d2be529112d509321c5310ebf54076812e6ecd884"}, + {file = "pydantic_core-2.10.1-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:7eb037106f5c6b3b0b864ad226b0b7ab58157124161d48e4b30c4a43fef8bc4b"}, + {file = "pydantic_core-2.10.1-pp38-pypy38_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:154ea7c52e32dce13065dbb20a4a6f0cc012b4f667ac90d648d36b12007fa9f7"}, + {file = "pydantic_core-2.10.1-pp38-pypy38_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:e562617a45b5a9da5be4abe72b971d4f00bf8555eb29bb91ec2ef2be348cd132"}, + {file = "pydantic_core-2.10.1-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:f23b55eb5464468f9e0e9a9935ce3ed2a870608d5f534025cd5536bca25b1402"}, + {file = "pydantic_core-2.10.1-pp39-pypy39_pp73-macosx_10_7_x86_64.whl", hash = "sha256:e9121b4009339b0f751955baf4543a0bfd6bc3f8188f8056b1a25a2d45099934"}, + {file = "pydantic_core-2.10.1-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:0523aeb76e03f753b58be33b26540880bac5aa54422e4462404c432230543f33"}, + {file = "pydantic_core-2.10.1-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2e0e2959ef5d5b8dc9ef21e1a305a21a36e254e6a34432d00c72a92fdc5ecda5"}, + {file = "pydantic_core-2.10.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:da01bec0a26befab4898ed83b362993c844b9a607a86add78604186297eb047e"}, + {file = "pydantic_core-2.10.1-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f2e9072d71c1f6cfc79a36d4484c82823c560e6f5599c43c1ca6b5cdbd54f881"}, + {file = "pydantic_core-2.10.1-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:f36a3489d9e28fe4b67be9992a23029c3cec0babc3bd9afb39f49844a8c721c5"}, + {file = "pydantic_core-2.10.1-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:f64f82cc3443149292b32387086d02a6c7fb39b8781563e0ca7b8d7d9cf72bd7"}, + {file = "pydantic_core-2.10.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:b4a6db486ac8e99ae696e09efc8b2b9fea67b63c8f88ba7a1a16c24a057a0776"}, + {file = "pydantic_core-2.10.1.tar.gz", hash = "sha256:0f8682dbdd2f67f8e1edddcbffcc29f60a6182b4901c367fc8c1c40d30bb0a82"}, +] + +[package.dependencies] +typing-extensions = ">=4.6.0,<4.7.0 || >4.7.0" + +[[package]] +name = "pytest" +version = "7.4.3" +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"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "sys_platform == \"win32\""} +exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} +importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} +iniconfig = "*" +packaging = "*" +pluggy = ">=0.12,<2.0" +tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} + +[package.extras] +testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] + +[[package]] +name = "sniffio" +version = "1.3.0" +description = "Sniff out which async library your code is running under" +optional = false +python-versions = ">=3.7" +files = [ + {file = "sniffio-1.3.0-py3-none-any.whl", hash = "sha256:eecefdce1e5bbfb7ad2eeaabf7c1eeb404d7757c379bd1f7e5cce9d8bf425384"}, + {file = "sniffio-1.3.0.tar.gz", hash = "sha256:e60305c5e5d314f5389259b7f22aaa33d8f7dee49763119234af3755c55b9101"}, +] + +[[package]] +name = "tomli" +version = "2.0.1" +description = "A lil' TOML parser" +optional = false +python-versions = ">=3.7" +files = [ + {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, + {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, +] + +[[package]] +name = "typed-ast" +version = "1.5.5" +description = "a fork of Python 2 and 3 ast modules with type comment support" +optional = false +python-versions = ">=3.6" +files = [ + {file = "typed_ast-1.5.5-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:4bc1efe0ce3ffb74784e06460f01a223ac1f6ab31c6bc0376a21184bf5aabe3b"}, + {file = "typed_ast-1.5.5-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:5f7a8c46a8b333f71abd61d7ab9255440d4a588f34a21f126bbfc95f6049e686"}, + {file = "typed_ast-1.5.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:597fc66b4162f959ee6a96b978c0435bd63791e31e4f410622d19f1686d5e769"}, + {file = "typed_ast-1.5.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d41b7a686ce653e06c2609075d397ebd5b969d821b9797d029fccd71fdec8e04"}, + {file = "typed_ast-1.5.5-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:5fe83a9a44c4ce67c796a1b466c270c1272e176603d5e06f6afbc101a572859d"}, + {file = "typed_ast-1.5.5-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:d5c0c112a74c0e5db2c75882a0adf3133adedcdbfd8cf7c9d6ed77365ab90a1d"}, + {file = "typed_ast-1.5.5-cp310-cp310-win_amd64.whl", hash = "sha256:e1a976ed4cc2d71bb073e1b2a250892a6e968ff02aa14c1f40eba4f365ffec02"}, + {file = "typed_ast-1.5.5-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:c631da9710271cb67b08bd3f3813b7af7f4c69c319b75475436fcab8c3d21bee"}, + {file = "typed_ast-1.5.5-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:b445c2abfecab89a932b20bd8261488d574591173d07827c1eda32c457358b18"}, + {file = "typed_ast-1.5.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cc95ffaaab2be3b25eb938779e43f513e0e538a84dd14a5d844b8f2932593d88"}, + {file = "typed_ast-1.5.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:61443214d9b4c660dcf4b5307f15c12cb30bdfe9588ce6158f4a005baeb167b2"}, + {file = "typed_ast-1.5.5-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:6eb936d107e4d474940469e8ec5b380c9b329b5f08b78282d46baeebd3692dc9"}, + {file = "typed_ast-1.5.5-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:e48bf27022897577d8479eaed64701ecaf0467182448bd95759883300ca818c8"}, + {file = "typed_ast-1.5.5-cp311-cp311-win_amd64.whl", hash = "sha256:83509f9324011c9a39faaef0922c6f720f9623afe3fe220b6d0b15638247206b"}, + {file = "typed_ast-1.5.5-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:44f214394fc1af23ca6d4e9e744804d890045d1643dd7e8229951e0ef39429b5"}, + {file = "typed_ast-1.5.5-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:118c1ce46ce58fda78503eae14b7664163aa735b620b64b5b725453696f2a35c"}, + {file = "typed_ast-1.5.5-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:be4919b808efa61101456e87f2d4c75b228f4e52618621c77f1ddcaae15904fa"}, + {file = "typed_ast-1.5.5-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:fc2b8c4e1bc5cd96c1a823a885e6b158f8451cf6f5530e1829390b4d27d0807f"}, + {file = "typed_ast-1.5.5-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:16f7313e0a08c7de57f2998c85e2a69a642e97cb32f87eb65fbfe88381a5e44d"}, + {file = "typed_ast-1.5.5-cp36-cp36m-win_amd64.whl", hash = "sha256:2b946ef8c04f77230489f75b4b5a4a6f24c078be4aed241cfabe9cbf4156e7e5"}, + {file = "typed_ast-1.5.5-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:2188bc33d85951ea4ddad55d2b35598b2709d122c11c75cffd529fbc9965508e"}, + {file = "typed_ast-1.5.5-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0635900d16ae133cab3b26c607586131269f88266954eb04ec31535c9a12ef1e"}, + {file = "typed_ast-1.5.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:57bfc3cf35a0f2fdf0a88a3044aafaec1d2f24d8ae8cd87c4f58d615fb5b6311"}, + {file = "typed_ast-1.5.5-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:fe58ef6a764de7b4b36edfc8592641f56e69b7163bba9f9c8089838ee596bfb2"}, + {file = "typed_ast-1.5.5-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:d09d930c2d1d621f717bb217bf1fe2584616febb5138d9b3e8cdd26506c3f6d4"}, + {file = "typed_ast-1.5.5-cp37-cp37m-win_amd64.whl", hash = "sha256:d40c10326893ecab8a80a53039164a224984339b2c32a6baf55ecbd5b1df6431"}, + {file = "typed_ast-1.5.5-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:fd946abf3c31fb50eee07451a6aedbfff912fcd13cf357363f5b4e834cc5e71a"}, + {file = "typed_ast-1.5.5-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:ed4a1a42df8a3dfb6b40c3d2de109e935949f2f66b19703eafade03173f8f437"}, + {file = "typed_ast-1.5.5-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:045f9930a1550d9352464e5149710d56a2aed23a2ffe78946478f7b5416f1ede"}, + {file = "typed_ast-1.5.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:381eed9c95484ceef5ced626355fdc0765ab51d8553fec08661dce654a935db4"}, + {file = "typed_ast-1.5.5-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:bfd39a41c0ef6f31684daff53befddae608f9daf6957140228a08e51f312d7e6"}, + {file = "typed_ast-1.5.5-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:8c524eb3024edcc04e288db9541fe1f438f82d281e591c548903d5b77ad1ddd4"}, + {file = "typed_ast-1.5.5-cp38-cp38-win_amd64.whl", hash = "sha256:7f58fabdde8dcbe764cef5e1a7fcb440f2463c1bbbec1cf2a86ca7bc1f95184b"}, + {file = "typed_ast-1.5.5-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:042eb665ff6bf020dd2243307d11ed626306b82812aba21836096d229fdc6a10"}, + {file = "typed_ast-1.5.5-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:622e4a006472b05cf6ef7f9f2636edc51bda670b7bbffa18d26b255269d3d814"}, + {file = "typed_ast-1.5.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1efebbbf4604ad1283e963e8915daa240cb4bf5067053cf2f0baadc4d4fb51b8"}, + {file = "typed_ast-1.5.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f0aefdd66f1784c58f65b502b6cf8b121544680456d1cebbd300c2c813899274"}, + {file = "typed_ast-1.5.5-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:48074261a842acf825af1968cd912f6f21357316080ebaca5f19abbb11690c8a"}, + {file = "typed_ast-1.5.5-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:429ae404f69dc94b9361bb62291885894b7c6fb4640d561179548c849f8492ba"}, + {file = "typed_ast-1.5.5-cp39-cp39-win_amd64.whl", hash = "sha256:335f22ccb244da2b5c296e6f96b06ee9bed46526db0de38d2f0e5a6597b81155"}, + {file = "typed_ast-1.5.5.tar.gz", hash = "sha256:94282f7a354f36ef5dbce0ef3467ebf6a258e370ab33d5b40c249fa996e590dd"}, +] + +[[package]] +name = "typing-extensions" +version = "4.7.1" +description = "Backported and Experimental Type Hints for Python 3.7+" +optional = false +python-versions = ">=3.7" +files = [ + {file = "typing_extensions-4.7.1-py3-none-any.whl", hash = "sha256:440d5dd3af93b060174bf433bccd69b0babc3b15b1a8dca43789fd7f61514b36"}, + {file = "typing_extensions-4.7.1.tar.gz", hash = "sha256:b75ddc264f0ba5615db7ba217daeb99701ad295353c45f9e95963337ceeeffb2"}, +] + +[[package]] +name = "zipp" +version = "3.15.0" +description = "Backport of pathlib-compatible object wrapper for zip files" +optional = false +python-versions = ">=3.7" +files = [ + {file = "zipp-3.15.0-py3-none-any.whl", hash = "sha256:48904fc76a60e542af151aded95726c1a5c34ed43ab4134b597665c86d7ad556"}, + {file = "zipp-3.15.0.tar.gz", hash = "sha256:112929ad649da941c23de50f356a2b5570c954b65150642bccdd66bf194d224b"}, +] + +[package.extras] +docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] +testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more-itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)"] + +[metadata] +lock-version = "2.0" +python-versions = "^3.7" +content-hash = "4ac84aae6b05a415337279868d39fe7ce44104dffcd6b159af9e12dcea350ba1" diff --git a/pyproject.toml b/pyproject.toml index d14b221..bb5554c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] -name = "fern-metriport" -version = "0.1.8" +name = "metriport" +version = "8.0.0-alpha1" description = "" readme = "README.md" authors = [] @@ -11,7 +11,7 @@ packages = [ [tool.poetry.dependencies] python = "^3.7" httpx = ">=0.21.2" -pydantic = "^1.9.2" +pydantic = ">= 1.9.2, < 2.5.0" [tool.poetry.dev-dependencies] mypy = "0.971" diff --git a/src/metriport/__init__.py b/src/metriport/__init__.py index c9ca725..210c5da 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, devices, medical +from .resources import Address, UsState, commons, medical from .environment import MetriportEnvironment -__all__ = ["Address", "MetriportEnvironment", "UsState", "commons", "devices", "medical"] +__all__ = ["Address", "MetriportEnvironment", "UsState", "commons", "medical"] diff --git a/src/metriport/client.py b/src/metriport/client.py index 3cc4bae..cb8bf8b 100644 --- a/src/metriport/client.py +++ b/src/metriport/client.py @@ -6,7 +6,6 @@ from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper from .environment import MetriportEnvironment -from .resources.devices.client import AsyncDevicesClient, DevicesClient from .resources.medical.client import AsyncMedicalClient, MedicalClient @@ -17,14 +16,14 @@ def __init__( base_url: typing.Optional[str] = None, environment: MetriportEnvironment = MetriportEnvironment.PRODUCTION, api_key: str, - timeout: typing.Optional[float] = 60 + timeout: typing.Optional[float] = 60, + httpx_client: typing.Optional[httpx.Client] = None ): self._client_wrapper = SyncClientWrapper( base_url=_get_base_url(base_url=base_url, environment=environment), api_key=api_key, - httpx_client=httpx.Client(timeout=timeout), + httpx_client=httpx.Client(timeout=timeout) if httpx_client is None else httpx_client, ) - self.devices = DevicesClient(client_wrapper=self._client_wrapper) self.medical = MedicalClient(client_wrapper=self._client_wrapper) @@ -35,14 +34,14 @@ def __init__( base_url: typing.Optional[str] = None, environment: MetriportEnvironment = MetriportEnvironment.PRODUCTION, api_key: str, - timeout: typing.Optional[float] = 60 + timeout: typing.Optional[float] = 60, + httpx_client: typing.Optional[httpx.AsyncClient] = None ): self._client_wrapper = AsyncClientWrapper( base_url=_get_base_url(base_url=base_url, environment=environment), api_key=api_key, - httpx_client=httpx.AsyncClient(timeout=timeout), + httpx_client=httpx.AsyncClient(timeout=timeout) if httpx_client is None else httpx_client, ) - self.devices = AsyncDevicesClient(client_wrapper=self._client_wrapper) self.medical = AsyncMedicalClient(client_wrapper=self._client_wrapper) diff --git a/src/metriport/core/client_wrapper.py b/src/metriport/core/client_wrapper.py index 3b60763..bd103a4 100644 --- a/src/metriport/core/client_wrapper.py +++ b/src/metriport/core/client_wrapper.py @@ -13,8 +13,8 @@ def __init__(self, *, api_key: str, base_url: str): def get_headers(self) -> typing.Dict[str, str]: headers: typing.Dict[str, str] = { "X-Fern-Language": "Python", - "X-Fern-SDK-Name": "fern-metriport", - "X-Fern-SDK-Version": "0.1.8", + "X-Fern-SDK-Name": "metriport", + "X-Fern-SDK-Version": "8.0.0-alpha1", } headers["X-API-Key"] = self.api_key return headers diff --git a/src/metriport/core/jsonable_encoder.py b/src/metriport/core/jsonable_encoder.py index 5c3cfac..37238ab 100644 --- a/src/metriport/core/jsonable_encoder.py +++ b/src/metriport/core/jsonable_encoder.py @@ -16,8 +16,10 @@ from types import GeneratorType from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union -from pydantic import BaseModel -from pydantic.json import ENCODERS_BY_TYPE +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore from .datetime_utils import serialize_datetime @@ -34,7 +36,7 @@ def generate_encoders_by_class_tuples( return encoders_by_class_tuples -encoders_by_class_tuples = generate_encoders_by_class_tuples(ENCODERS_BY_TYPE) +encoders_by_class_tuples = generate_encoders_by_class_tuples(pydantic.json.ENCODERS_BY_TYPE) def jsonable_encoder(obj: Any, custom_encoder: Optional[Dict[Any, Callable[[Any], Any]]] = None) -> Any: @@ -46,7 +48,7 @@ def jsonable_encoder(obj: Any, custom_encoder: Optional[Dict[Any, Callable[[Any] for encoder_type, encoder_instance in custom_encoder.items(): if isinstance(obj, encoder_type): return encoder_instance(obj) - if isinstance(obj, BaseModel): + if isinstance(obj, pydantic.BaseModel): encoder = getattr(obj.__config__, "json_encoders", {}) if custom_encoder: encoder.update(custom_encoder) @@ -82,8 +84,8 @@ def jsonable_encoder(obj: Any, custom_encoder: Optional[Dict[Any, Callable[[Any] encoded_list.append(jsonable_encoder(item, custom_encoder=custom_encoder)) return encoded_list - if type(obj) in ENCODERS_BY_TYPE: - return ENCODERS_BY_TYPE[type(obj)](obj) + if type(obj) in pydantic.json.ENCODERS_BY_TYPE: + return pydantic.json.ENCODERS_BY_TYPE[type(obj)](obj) for encoder, classes_tuple in encoders_by_class_tuples.items(): if isinstance(obj, classes_tuple): return encoder(obj) diff --git a/src/metriport/environment.py b/src/metriport/environment.py index fba28f6..57d8d01 100644 --- a/src/metriport/environment.py +++ b/src/metriport/environment.py @@ -4,4 +4,4 @@ class MetriportEnvironment(enum.Enum): - PRODUCTION = "https://api.metriport.com/medical/v1" + PRODUCTION = "https://api.metriport.com" diff --git a/src/metriport/resources/__init__.py b/src/metriport/resources/__init__.py index 4c92ed3..4facb37 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, devices, medical +from . import commons, medical from .commons import Address, UsState -__all__ = ["Address", "UsState", "commons", "devices", "medical"] +__all__ = ["Address", "UsState", "commons", "medical"] diff --git a/src/metriport/resources/commons/types/address.py b/src/metriport/resources/commons/types/address.py index 621384e..e282ee6 100644 --- a/src/metriport/resources/commons/types/address.py +++ b/src/metriport/resources/commons/types/address.py @@ -3,13 +3,29 @@ import datetime as dt import typing -import pydantic - from ....core.datetime_utils import serialize_datetime from .us_state import UsState +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + class Address(pydantic.BaseModel): + """ + from metriport import Address, UsState + + Address( + address_line_1="2261 Market Street", + address_line_2="#4818", + city="San Francisco", + state=UsState.CA, + zip="94114", + country="USA", + ) + """ + address_line_1: str = pydantic.Field(alias="addressLine1", description="The address.") address_line_2: typing.Optional[str] = pydantic.Field( alias="addressLine2", description="The address details, for example `#4451`" diff --git a/src/metriport/resources/devices/__init__.py b/src/metriport/resources/devices/__init__.py deleted file mode 100644 index 77e8dcc..0000000 --- a/src/metriport/resources/devices/__init__.py +++ /dev/null @@ -1,99 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from .types import ( - Activity, - ActivityDurations, - ActivityLog, - ActivityMovement, - ActivitySummary, - Aminos, - Biometrics, - BloodOxygen, - Body, - ConnectedUserInfo, - Duration, - Elevation, - EnergyExpenditure, - Food, - HeartRate, - HeartRateVariability, - HeartRateVariabilityMeasurement, - LatLon, - Location, - Macros, - Metadata, - MetriportData, - Micros, - Nutrition, - NutritionFacts, - ProviderSource, - Respiration, - Sample, - Sex, - Sleep, - SleepBiometrics, - SleepDurations, - SourceInfo, - SourceType, - Speed, - Temperature, - TemperatureMeasurement, - User, -) -from .resources import ( - ConnectTokenResponse, - ConnectedProvidersResponse, - DeleteUserResponse, - MetriportUserIdResponse, - RevokeAccessToProviderResponse, - connect, - users, -) - -__all__ = [ - "Activity", - "ActivityDurations", - "ActivityLog", - "ActivityMovement", - "ActivitySummary", - "Aminos", - "Biometrics", - "BloodOxygen", - "Body", - "ConnectTokenResponse", - "ConnectedProvidersResponse", - "ConnectedUserInfo", - "DeleteUserResponse", - "Duration", - "Elevation", - "EnergyExpenditure", - "Food", - "HeartRate", - "HeartRateVariability", - "HeartRateVariabilityMeasurement", - "LatLon", - "Location", - "Macros", - "Metadata", - "MetriportData", - "MetriportUserIdResponse", - "Micros", - "Nutrition", - "NutritionFacts", - "ProviderSource", - "Respiration", - "RevokeAccessToProviderResponse", - "Sample", - "Sex", - "Sleep", - "SleepBiometrics", - "SleepDurations", - "SourceInfo", - "SourceType", - "Speed", - "Temperature", - "TemperatureMeasurement", - "User", - "connect", - "users", -] diff --git a/src/metriport/resources/devices/client.py b/src/metriport/resources/devices/client.py deleted file mode 100644 index 8678a9d..0000000 --- a/src/metriport/resources/devices/client.py +++ /dev/null @@ -1,514 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing -import urllib.parse -from json.decoder import JSONDecodeError - -import pydantic - -from ...core.api_error import ApiError -from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from ...core.remove_none_from_dict import remove_none_from_dict -from .resources.connect.client import AsyncConnectClient, ConnectClient -from .resources.users.client import AsyncUsersClient, UsersClient -from .types.activity import Activity -from .types.biometrics import Biometrics -from .types.body import Body -from .types.connected_user_info import ConnectedUserInfo -from .types.nutrition import Nutrition -from .types.sleep import Sleep -from .types.user import User - - -class DevicesClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - self.connect = ConnectClient(client_wrapper=self._client_wrapper) - self.users = UsersClient(client_wrapper=self._client_wrapper) - - def get_activity_data(self, *, user_id: str, date: str, timezone_id: str) -> typing.List[Activity]: - """ - Returns activity data from all of the specified users' connected providers. - - Parameters: - - user_id: str. The Metriport user ID to create a session token for. - - - date: str. Day for which to pull the data. Formatted YYYY-MM-DD. - - For simplicity, all queries assume the UTC timezone for the - specified date starting at 00:00 to 23:59 - unless otherwise - specified by the timezoneId parameter. - - - timezone_id: str. Timezone ID to use for the specified date. If not specified, - the UTC timezone is used. For example this can be valid timezones - like `America/Los_Angeles` or `Europe/Kiev`. - - Valid timezones can be found at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. - - Support for this parameter is under development, and currently only supported for the Google Fit provider. - - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "activity"), - params=remove_none_from_dict({"userId": user_id, "date": date, "timezoneId": timezone_id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.List[Activity], _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_biometrics_data(self, *, user_id: str, date: str, timezone_id: str) -> typing.List[Biometrics]: - """ - Returns biometrics data from all of the specified users' connected providers. - - Parameters: - - user_id: str. The Metriport user ID to create a session token for. - - - date: str. Day for which to pull the data. Formatted YYYY-MM-DD. - - For simplicity, all queries assume the UTC timezone for the - specified date starting at 00:00 to 23:59 - unless otherwise - specified by the timezoneId parameter. - - - timezone_id: str. Timezone ID to use for the specified date. If not specified, - the UTC timezone is used. For example this can be valid timezones - like `America/Los_Angeles` or `Europe/Kiev`. - - Valid timezones can be found at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. - - Support for this parameter is under development, and currently only supported for the Google Fit provider. - - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "biometrics"), - params=remove_none_from_dict({"userId": user_id, "date": date, "timezoneId": timezone_id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.List[Biometrics], _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_body_data(self, *, user_id: str, date: str, timezone_id: str) -> typing.List[Body]: - """ - Returns body data from all of the specified users' connected providers. - - Parameters: - - user_id: str. The Metriport user ID to create a session token for. - - - date: str. Day for which to pull the data. Formatted YYYY-MM-DD. - - For simplicity, all queries assume the UTC timezone for the - specified date starting at 00:00 to 23:59 - unless otherwise - specified by the timezoneId parameter. - - - timezone_id: str. Timezone ID to use for the specified date. If not specified, - the UTC timezone is used. For example this can be valid timezones - like `America/Los_Angeles` or `Europe/Kiev`. - - Valid timezones can be found at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. - - Support for this parameter is under development, and currently only supported for the Google Fit provider. - - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "body"), - params=remove_none_from_dict({"userId": user_id, "date": date, "timezoneId": timezone_id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.List[Body], _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_nutrition_data(self, *, user_id: str, date: str, timezone_id: str) -> typing.List[Nutrition]: - """ - Returns nutrition data from all of the specified users' connected providers. - - Parameters: - - user_id: str. The Metriport user ID to create a session token for. - - - date: str. Day for which to pull the data. Formatted YYYY-MM-DD. - - For simplicity, all queries assume the UTC timezone for the - specified date starting at 00:00 to 23:59 - unless otherwise - specified by the timezoneId parameter. - - - timezone_id: str. Timezone ID to use for the specified date. If not specified, - the UTC timezone is used. For example this can be valid timezones - like `America/Los_Angeles` or `Europe/Kiev`. - - Valid timezones can be found at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. - - Support for this parameter is under development, and currently only supported for the Google Fit provider. - - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "nutrition"), - params=remove_none_from_dict({"userId": user_id, "date": date, "timezoneId": timezone_id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.List[Nutrition], _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_sleep_data(self, *, user_id: str, date: str, timezone_id: str) -> typing.List[Sleep]: - """ - Returns sleep data from all of the specified users' connected providers. - - Parameters: - - user_id: str. The Metriport user ID to create a session token for. - - - date: str. Day for which to pull the data. Formatted YYYY-MM-DD. - - For simplicity, all queries assume the UTC timezone for the - specified date starting at 00:00 to 23:59 - unless otherwise - specified by the timezoneId parameter. - - - timezone_id: str. Timezone ID to use for the specified date. If not specified, - the UTC timezone is used. For example this can be valid timezones - like `America/Los_Angeles` or `Europe/Kiev`. - - Valid timezones can be found at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. - - Support for this parameter is under development, and currently only supported for the Google Fit provider. - - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "sleep"), - params=remove_none_from_dict({"userId": user_id, "date": date, "timezoneId": timezone_id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.List[Sleep], _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_user_data(self, *, user_id: str, date: str, timezone_id: str) -> typing.List[User]: - """ - Returns user info from all of the specified users' connected providers. - - Parameters: - - user_id: str. The Metriport user ID to create a session token for. - - - date: str. Day for which to pull the data. Formatted YYYY-MM-DD. - - For simplicity, all queries assume the UTC timezone for the - specified date starting at 00:00 to 23:59 - unless otherwise - specified by the timezoneId parameter. - - - timezone_id: str. Timezone ID to use for the specified date. If not specified, - the UTC timezone is used. For example this can be valid timezones - like `America/Los_Angeles` or `Europe/Kiev`. - - Valid timezones can be found at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. - - Support for this parameter is under development, and currently only supported for the Google Fit provider. - - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "user"), - params=remove_none_from_dict({"userId": user_id, "date": date, "timezoneId": timezone_id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.List[User], _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_connected_users(self) -> typing.List[ConnectedUserInfo]: - """ - Returns a list of users with their IDs and connected providers. - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "user"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.List[ConnectedUserInfo], _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 AsyncDevicesClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - self.connect = AsyncConnectClient(client_wrapper=self._client_wrapper) - self.users = AsyncUsersClient(client_wrapper=self._client_wrapper) - - async def get_activity_data(self, *, user_id: str, date: str, timezone_id: str) -> typing.List[Activity]: - """ - Returns activity data from all of the specified users' connected providers. - - Parameters: - - user_id: str. The Metriport user ID to create a session token for. - - - date: str. Day for which to pull the data. Formatted YYYY-MM-DD. - - For simplicity, all queries assume the UTC timezone for the - specified date starting at 00:00 to 23:59 - unless otherwise - specified by the timezoneId parameter. - - - timezone_id: str. Timezone ID to use for the specified date. If not specified, - the UTC timezone is used. For example this can be valid timezones - like `America/Los_Angeles` or `Europe/Kiev`. - - Valid timezones can be found at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. - - Support for this parameter is under development, and currently only supported for the Google Fit provider. - - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "activity"), - params=remove_none_from_dict({"userId": user_id, "date": date, "timezoneId": timezone_id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.List[Activity], _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_biometrics_data(self, *, user_id: str, date: str, timezone_id: str) -> typing.List[Biometrics]: - """ - Returns biometrics data from all of the specified users' connected providers. - - Parameters: - - user_id: str. The Metriport user ID to create a session token for. - - - date: str. Day for which to pull the data. Formatted YYYY-MM-DD. - - For simplicity, all queries assume the UTC timezone for the - specified date starting at 00:00 to 23:59 - unless otherwise - specified by the timezoneId parameter. - - - timezone_id: str. Timezone ID to use for the specified date. If not specified, - the UTC timezone is used. For example this can be valid timezones - like `America/Los_Angeles` or `Europe/Kiev`. - - Valid timezones can be found at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. - - Support for this parameter is under development, and currently only supported for the Google Fit provider. - - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "biometrics"), - params=remove_none_from_dict({"userId": user_id, "date": date, "timezoneId": timezone_id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.List[Biometrics], _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_body_data(self, *, user_id: str, date: str, timezone_id: str) -> typing.List[Body]: - """ - Returns body data from all of the specified users' connected providers. - - Parameters: - - user_id: str. The Metriport user ID to create a session token for. - - - date: str. Day for which to pull the data. Formatted YYYY-MM-DD. - - For simplicity, all queries assume the UTC timezone for the - specified date starting at 00:00 to 23:59 - unless otherwise - specified by the timezoneId parameter. - - - timezone_id: str. Timezone ID to use for the specified date. If not specified, - the UTC timezone is used. For example this can be valid timezones - like `America/Los_Angeles` or `Europe/Kiev`. - - Valid timezones can be found at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. - - Support for this parameter is under development, and currently only supported for the Google Fit provider. - - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "body"), - params=remove_none_from_dict({"userId": user_id, "date": date, "timezoneId": timezone_id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.List[Body], _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_nutrition_data(self, *, user_id: str, date: str, timezone_id: str) -> typing.List[Nutrition]: - """ - Returns nutrition data from all of the specified users' connected providers. - - Parameters: - - user_id: str. The Metriport user ID to create a session token for. - - - date: str. Day for which to pull the data. Formatted YYYY-MM-DD. - - For simplicity, all queries assume the UTC timezone for the - specified date starting at 00:00 to 23:59 - unless otherwise - specified by the timezoneId parameter. - - - timezone_id: str. Timezone ID to use for the specified date. If not specified, - the UTC timezone is used. For example this can be valid timezones - like `America/Los_Angeles` or `Europe/Kiev`. - - Valid timezones can be found at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. - - Support for this parameter is under development, and currently only supported for the Google Fit provider. - - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "nutrition"), - params=remove_none_from_dict({"userId": user_id, "date": date, "timezoneId": timezone_id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.List[Nutrition], _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_sleep_data(self, *, user_id: str, date: str, timezone_id: str) -> typing.List[Sleep]: - """ - Returns sleep data from all of the specified users' connected providers. - - Parameters: - - user_id: str. The Metriport user ID to create a session token for. - - - date: str. Day for which to pull the data. Formatted YYYY-MM-DD. - - For simplicity, all queries assume the UTC timezone for the - specified date starting at 00:00 to 23:59 - unless otherwise - specified by the timezoneId parameter. - - - timezone_id: str. Timezone ID to use for the specified date. If not specified, - the UTC timezone is used. For example this can be valid timezones - like `America/Los_Angeles` or `Europe/Kiev`. - - Valid timezones can be found at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. - - Support for this parameter is under development, and currently only supported for the Google Fit provider. - - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "sleep"), - params=remove_none_from_dict({"userId": user_id, "date": date, "timezoneId": timezone_id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.List[Sleep], _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_user_data(self, *, user_id: str, date: str, timezone_id: str) -> typing.List[User]: - """ - Returns user info from all of the specified users' connected providers. - - Parameters: - - user_id: str. The Metriport user ID to create a session token for. - - - date: str. Day for which to pull the data. Formatted YYYY-MM-DD. - - For simplicity, all queries assume the UTC timezone for the - specified date starting at 00:00 to 23:59 - unless otherwise - specified by the timezoneId parameter. - - - timezone_id: str. Timezone ID to use for the specified date. If not specified, - the UTC timezone is used. For example this can be valid timezones - like `America/Los_Angeles` or `Europe/Kiev`. - - Valid timezones can be found at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. - - Support for this parameter is under development, and currently only supported for the Google Fit provider. - - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "user"), - params=remove_none_from_dict({"userId": user_id, "date": date, "timezoneId": timezone_id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.List[User], _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_connected_users(self) -> typing.List[ConnectedUserInfo]: - """ - Returns a list of users with their IDs and connected providers. - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "user"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.List[ConnectedUserInfo], _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/devices/resources/__init__.py b/src/metriport/resources/devices/resources/__init__.py deleted file mode 100644 index 1d79c85..0000000 --- a/src/metriport/resources/devices/resources/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from . import connect, users -from .users import ( - ConnectTokenResponse, - ConnectedProvidersResponse, - DeleteUserResponse, - MetriportUserIdResponse, - RevokeAccessToProviderResponse, -) - -__all__ = [ - "ConnectTokenResponse", - "ConnectedProvidersResponse", - "DeleteUserResponse", - "MetriportUserIdResponse", - "RevokeAccessToProviderResponse", - "connect", - "users", -] diff --git a/src/metriport/resources/devices/resources/connect/__init__.py b/src/metriport/resources/devices/resources/connect/__init__.py deleted file mode 100644 index f3ea265..0000000 --- a/src/metriport/resources/devices/resources/connect/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - diff --git a/src/metriport/resources/devices/resources/connect/client.py b/src/metriport/resources/devices/resources/connect/client.py deleted file mode 100644 index 2515ebc..0000000 --- a/src/metriport/resources/devices/resources/connect/client.py +++ /dev/null @@ -1,82 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import urllib.parse -from json.decoder import JSONDecodeError - -import typing_extensions - -from .....core.api_error import ApiError -from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from .....core.remove_none_from_dict import remove_none_from_dict - - -class ConnectClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - def connect_rpm_provider( - self, provider: typing_extensions.Literal["tenovi"], *, token: str, device_user_id: str, device_ids: str - ) -> None: - """ - Connects the user to remote patient monitoring (RPM) device(s) for the specified provider. - - Parameters: - - provider: typing_extensions.Literal["tenovi"]. An RPM device provider. Currently, `tenovi` is supported. - - - token: str. The user ID you identify this user with in your app. - - - device_user_id: str. The provider’s user ID for which the RPM device(s) are provisioned. - - - device_ids: str. A comma-separated string of the user’s devices IDs to connect to. For example: `1234-0001,5678-0002`. - - """ - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"connect/rpm/{provider}"), - params=remove_none_from_dict({"token": token, "deviceUserId": device_user_id, "deviceIds": device_ids}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return - 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 AsyncConnectClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - - async def connect_rpm_provider( - self, provider: typing_extensions.Literal["tenovi"], *, token: str, device_user_id: str, device_ids: str - ) -> None: - """ - Connects the user to remote patient monitoring (RPM) device(s) for the specified provider. - - Parameters: - - provider: typing_extensions.Literal["tenovi"]. An RPM device provider. Currently, `tenovi` is supported. - - - token: str. The user ID you identify this user with in your app. - - - device_user_id: str. The provider’s user ID for which the RPM device(s) are provisioned. - - - device_ids: str. A comma-separated string of the user’s devices IDs to connect to. For example: `1234-0001,5678-0002`. - - """ - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"connect/rpm/{provider}"), - params=remove_none_from_dict({"token": token, "deviceUserId": device_user_id, "deviceIds": device_ids}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return - 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/devices/resources/users/__init__.py b/src/metriport/resources/devices/resources/users/__init__.py deleted file mode 100644 index 396b485..0000000 --- a/src/metriport/resources/devices/resources/users/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from .types import ( - ConnectTokenResponse, - ConnectedProvidersResponse, - DeleteUserResponse, - MetriportUserIdResponse, - RevokeAccessToProviderResponse, -) - -__all__ = [ - "ConnectTokenResponse", - "ConnectedProvidersResponse", - "DeleteUserResponse", - "MetriportUserIdResponse", - "RevokeAccessToProviderResponse", -] diff --git a/src/metriport/resources/devices/resources/users/client.py b/src/metriport/resources/devices/resources/users/client.py deleted file mode 100644 index a6dd7b3..0000000 --- a/src/metriport/resources/devices/resources/users/client.py +++ /dev/null @@ -1,245 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import urllib.parse -from json.decoder import JSONDecodeError - -import pydantic - -from .....core.api_error import ApiError -from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper -from .....core.remove_none_from_dict import remove_none_from_dict -from .types.connect_token_response import ConnectTokenResponse -from .types.connected_providers_response import ConnectedProvidersResponse -from .types.delete_user_response import DeleteUserResponse -from .types.metriport_user_id_response import MetriportUserIdResponse -from .types.revoke_access_to_provider_response import RevokeAccessToProviderResponse - - -class UsersClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - def get_metriport_user_id(self, *, app_user_id: str) -> MetriportUserIdResponse: - """ - For your specified user ID, returns a Metriport user ID to be used in subsequent requests. - - Parameters: - - app_user_id: str. The user ID you identify this user with in your app. - """ - _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "user"), - params=remove_none_from_dict({"appUserId": app_user_id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(MetriportUserIdResponse, _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_connect_token(self, *, user_id: str) -> ConnectTokenResponse: - """ - Returns a token to be used in a Metriport Connect session. - - Parameters: - - user_id: str. The Metriport user ID to create a session token for. - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "user/connect/token"), - params=remove_none_from_dict({"userId": user_id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(ConnectTokenResponse, _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_connected_providers(self, user_id: str) -> ConnectedProvidersResponse: - """ - Returns the specified user's connected providers. - - Parameters: - - user_id: str. The Metriport user ID to create a session token for. - """ - _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"user/{user_id}/connected-providers"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(ConnectedProvidersResponse, _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 revoke_access_to_provider(self, user_id: str, *, provider: str) -> RevokeAccessToProviderResponse: - """ - Revokes the access token for a given provider. - - Parameters: - - user_id: str. The Metriport user ID to create a session token for. - - - provider: str. The provider you would like to revoke access to. - """ - _response = self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"user/{user_id}/revoke"), - params=remove_none_from_dict({"provider": provider}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(RevokeAccessToProviderResponse, _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 delete(self, user_id: str) -> DeleteUserResponse: - """ - Revokes access tokens for all providers and deletes the user. - - Parameters: - - user_id: str. The Metriport user ID to create a session token for. - """ - _response = self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"user/{user_id}"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(DeleteUserResponse, _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 AsyncUsersClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - - async def get_metriport_user_id(self, *, app_user_id: str) -> MetriportUserIdResponse: - """ - For your specified user ID, returns a Metriport user ID to be used in subsequent requests. - - Parameters: - - app_user_id: str. The user ID you identify this user with in your app. - """ - _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "user"), - params=remove_none_from_dict({"appUserId": app_user_id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(MetriportUserIdResponse, _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_connect_token(self, *, user_id: str) -> ConnectTokenResponse: - """ - Returns a token to be used in a Metriport Connect session. - - Parameters: - - user_id: str. The Metriport user ID to create a session token for. - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "user/connect/token"), - params=remove_none_from_dict({"userId": user_id}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(ConnectTokenResponse, _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_connected_providers(self, user_id: str) -> ConnectedProvidersResponse: - """ - Returns the specified user's connected providers. - - Parameters: - - user_id: str. The Metriport user ID to create a session token for. - """ - _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"user/{user_id}/connected-providers"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(ConnectedProvidersResponse, _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 revoke_access_to_provider(self, user_id: str, *, provider: str) -> RevokeAccessToProviderResponse: - """ - Revokes the access token for a given provider. - - Parameters: - - user_id: str. The Metriport user ID to create a session token for. - - - provider: str. The provider you would like to revoke access to. - """ - _response = await self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"user/{user_id}/revoke"), - params=remove_none_from_dict({"provider": provider}), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(RevokeAccessToProviderResponse, _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 delete(self, user_id: str) -> DeleteUserResponse: - """ - Revokes access tokens for all providers and deletes the user. - - Parameters: - - user_id: str. The Metriport user ID to create a session token for. - """ - _response = await self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"user/{user_id}"), - headers=self._client_wrapper.get_headers(), - timeout=60, - ) - if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(DeleteUserResponse, _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/devices/resources/users/types/__init__.py b/src/metriport/resources/devices/resources/users/types/__init__.py deleted file mode 100644 index 2f0958f..0000000 --- a/src/metriport/resources/devices/resources/users/types/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from .connect_token_response import ConnectTokenResponse -from .connected_providers_response import ConnectedProvidersResponse -from .delete_user_response import DeleteUserResponse -from .metriport_user_id_response import MetriportUserIdResponse -from .revoke_access_to_provider_response import RevokeAccessToProviderResponse - -__all__ = [ - "ConnectTokenResponse", - "ConnectedProvidersResponse", - "DeleteUserResponse", - "MetriportUserIdResponse", - "RevokeAccessToProviderResponse", -] diff --git a/src/metriport/resources/devices/resources/users/types/connect_token_response.py b/src/metriport/resources/devices/resources/users/types/connect_token_response.py deleted file mode 100644 index 87343ae..0000000 --- a/src/metriport/resources/devices/resources/users/types/connect_token_response.py +++ /dev/null @@ -1,33 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ......core.datetime_utils import serialize_datetime - - -class ConnectTokenResponse(pydantic.BaseModel): - token: str = pydantic.Field( - description=( - "The temporary token to allow the specified user to access \n" - "the Metriport Connect widget.\n" - "\n" - "The token will expire 10 minutes after it is created, and \n" - "can be reused for the duration of the session.\n" - ) - ) - - 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/devices/resources/users/types/connected_providers_response.py b/src/metriport/resources/devices/resources/users/types/connected_providers_response.py deleted file mode 100644 index bc989b9..0000000 --- a/src/metriport/resources/devices/resources/users/types/connected_providers_response.py +++ /dev/null @@ -1,26 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ......core.datetime_utils import serialize_datetime - - -class ConnectedProvidersResponse(pydantic.BaseModel): - connected_providers: typing.List[str] = pydantic.Field(alias="connectedProviders") - - 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/devices/resources/users/types/metriport_user_id_response.py b/src/metriport/resources/devices/resources/users/types/metriport_user_id_response.py deleted file mode 100644 index cacaefd..0000000 --- a/src/metriport/resources/devices/resources/users/types/metriport_user_id_response.py +++ /dev/null @@ -1,28 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ......core.datetime_utils import serialize_datetime - - -class MetriportUserIdResponse(pydantic.BaseModel): - user_id: str = pydantic.Field( - alias="userId", description="The Metriport user ID to be used in subsequent requests for this 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 - allow_population_by_field_name = True - json_encoders = {dt.datetime: serialize_datetime} diff --git a/src/metriport/resources/devices/types/__init__.py b/src/metriport/resources/devices/types/__init__.py deleted file mode 100644 index 6bb2209..0000000 --- a/src/metriport/resources/devices/types/__init__.py +++ /dev/null @@ -1,81 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from .activity import Activity -from .activity_durations import ActivityDurations -from .activity_log import ActivityLog -from .activity_movement import ActivityMovement -from .activity_summary import ActivitySummary -from .aminos import Aminos -from .biometrics import Biometrics -from .blood_oxygen import BloodOxygen -from .body import Body -from .connected_user_info import ConnectedUserInfo -from .duration import Duration -from .elevation import Elevation -from .energy_expenditure import EnergyExpenditure -from .food import Food -from .heart_rate import HeartRate -from .heart_rate_variability import HeartRateVariability -from .heart_rate_variability_measurement import HeartRateVariabilityMeasurement -from .lat_lon import LatLon -from .location import Location -from .macros import Macros -from .metadata import Metadata -from .metriport_data import MetriportData -from .micros import Micros -from .nutrition import Nutrition -from .nutrition_facts import NutritionFacts -from .provider_source import ProviderSource -from .respiration import Respiration -from .sample import Sample -from .sex import Sex -from .sleep import Sleep -from .sleep_biometrics import SleepBiometrics -from .sleep_durations import SleepDurations -from .source_info import SourceInfo -from .source_type import SourceType -from .speed import Speed -from .temperature import Temperature -from .temperature_measurement import TemperatureMeasurement -from .user import User - -__all__ = [ - "Activity", - "ActivityDurations", - "ActivityLog", - "ActivityMovement", - "ActivitySummary", - "Aminos", - "Biometrics", - "BloodOxygen", - "Body", - "ConnectedUserInfo", - "Duration", - "Elevation", - "EnergyExpenditure", - "Food", - "HeartRate", - "HeartRateVariability", - "HeartRateVariabilityMeasurement", - "LatLon", - "Location", - "Macros", - "Metadata", - "MetriportData", - "Micros", - "Nutrition", - "NutritionFacts", - "ProviderSource", - "Respiration", - "Sample", - "Sex", - "Sleep", - "SleepBiometrics", - "SleepDurations", - "SourceInfo", - "SourceType", - "Speed", - "Temperature", - "TemperatureMeasurement", - "User", -] diff --git a/src/metriport/resources/devices/types/activity.py b/src/metriport/resources/devices/types/activity.py deleted file mode 100644 index b8a239e..0000000 --- a/src/metriport/resources/devices/types/activity.py +++ /dev/null @@ -1,28 +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 .activity_log import ActivityLog -from .activity_summary import ActivitySummary -from .metriport_data import MetriportData - - -class Activity(MetriportData): - summary: typing.Optional[ActivitySummary] - activity_logs: typing.Optional[typing.List[ActivityLog]] - - 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/devices/types/activity_durations.py b/src/metriport/resources/devices/types/activity_durations.py deleted file mode 100644 index f0b6acf..0000000 --- a/src/metriport/resources/devices/types/activity_durations.py +++ /dev/null @@ -1,30 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ....core.datetime_utils import serialize_datetime -from .duration import Duration - - -class ActivityDurations(pydantic.BaseModel): - active_seconds: typing.Optional[int] - intensity: typing.Optional[Duration] = pydantic.Field( - description="Also referred to as metabolic-equivalent minutes" - ) - strain: typing.Optional[Duration] = pydantic.Field(description="Also referred to as stress") - - 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/devices/types/activity_log.py b/src/metriport/resources/devices/types/activity_log.py deleted file mode 100644 index 0fcaf3b..0000000 --- a/src/metriport/resources/devices/types/activity_log.py +++ /dev/null @@ -1,40 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ....core.datetime_utils import serialize_datetime -from .activity_durations import ActivityDurations -from .activity_movement import ActivityMovement -from .biometrics import Biometrics -from .energy_expenditure import EnergyExpenditure -from .location import Location -from .metadata import Metadata - - -class ActivityLog(pydantic.BaseModel): - metadata: Metadata - name: typing.Optional[str] - type: typing.Optional[str] - start_time: typing.Optional[str] - end_time: typing.Optional[str] - durations: typing.Optional[ActivityDurations] - energy_expenditure: typing.Optional[EnergyExpenditure] - movement: typing.Optional[ActivityMovement] - location: typing.Optional[Location] - biometrics: typing.Optional[Biometrics] - - 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/devices/types/activity_movement.py b/src/metriport/resources/devices/types/activity_movement.py deleted file mode 100644 index fd78b1b..0000000 --- a/src/metriport/resources/devices/types/activity_movement.py +++ /dev/null @@ -1,32 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ....core.datetime_utils import serialize_datetime -from .elevation import Elevation -from .speed import Speed - - -class ActivityMovement(pydantic.BaseModel): - steps_count: typing.Optional[int] - floors_count: typing.Optional[int] - elevation: typing.Optional[Elevation] - speed: typing.Optional[Speed] - avg_cadence: typing.Optional[int] - distance_meters: typing.Optional[int] - - 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/devices/types/activity_summary.py b/src/metriport/resources/devices/types/activity_summary.py deleted file mode 100644 index f32f5e7..0000000 --- a/src/metriport/resources/devices/types/activity_summary.py +++ /dev/null @@ -1,30 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ....core.datetime_utils import serialize_datetime -from .activity_durations import ActivityDurations -from .biometrics import Biometrics -from .energy_expenditure import EnergyExpenditure - - -class ActivitySummary(pydantic.BaseModel): - durations: typing.Optional[ActivityDurations] - energy_expenditure: typing.Optional[EnergyExpenditure] - biometrics: typing.Optional[Biometrics] - - 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/devices/types/aminos.py b/src/metriport/resources/devices/types/aminos.py deleted file mode 100644 index c7c8536..0000000 --- a/src/metriport/resources/devices/types/aminos.py +++ /dev/null @@ -1,44 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ....core.datetime_utils import serialize_datetime - - -class Aminos(pydantic.BaseModel): - alanine_g: typing.Optional[int] - arginine_g: typing.Optional[int] - asparagine_g: typing.Optional[int] - aspartic_acid_g: typing.Optional[int] - cysteine_g: typing.Optional[int] - glutamine_g: typing.Optional[int] - glutamic_acid_g: typing.Optional[int] - glycine_g: typing.Optional[int] - histidine_g: typing.Optional[int] - isoleucine_g: typing.Optional[int] - leucine_g: typing.Optional[int] - lysine_g: typing.Optional[int] - methionine_g: typing.Optional[int] - phenylalanine_g: typing.Optional[int] - proline_g: typing.Optional[int] - serine_g: typing.Optional[int] - threonine_g: typing.Optional[int] - tryptophan_g: typing.Optional[int] - tyrosine_g: typing.Optional[int] - valine_g: typing.Optional[int] - - 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/devices/types/biometrics.py b/src/metriport/resources/devices/types/biometrics.py deleted file mode 100644 index 5470334..0000000 --- a/src/metriport/resources/devices/types/biometrics.py +++ /dev/null @@ -1,30 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ....core.datetime_utils import serialize_datetime -from .heart_rate import HeartRate -from .heart_rate_variability import HeartRateVariability -from .respiration import Respiration - - -class Biometrics(pydantic.BaseModel): - heart_rate: typing.Optional[HeartRate] - hrv: typing.Optional[HeartRateVariability] - respiration: typing.Optional[Respiration] - - 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/devices/types/blood_oxygen.py b/src/metriport/resources/devices/types/blood_oxygen.py deleted file mode 100644 index faa1200..0000000 --- a/src/metriport/resources/devices/types/blood_oxygen.py +++ /dev/null @@ -1,28 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ....core.datetime_utils import serialize_datetime - - -class BloodOxygen(pydantic.BaseModel): - min_pct: typing.Optional[float] - max_pct: typing.Optional[float] - avg_pct: typing.Optional[float] - std_dev: typing.Optional[float] - - 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/devices/types/body.py b/src/metriport/resources/devices/types/body.py deleted file mode 100644 index 90db006..0000000 --- a/src/metriport/resources/devices/types/body.py +++ /dev/null @@ -1,33 +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 .metriport_data import MetriportData -from .sample import Sample - - -class Body(MetriportData): - body_fat_pct: typing.Optional[float] - height_cm: typing.Optional[float] - weight_kg: typing.Optional[float] - bone_mass_kg: typing.Optional[float] - muscle_mass_kg: typing.Optional[float] - lean_mass_kg: typing.Optional[float] - max_possible_heart_rate_bpm: typing.Optional[float] - weight_samples_kg: typing.Optional[typing.List[Sample]] - - 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/devices/types/connected_user_info.py b/src/metriport/resources/devices/types/connected_user_info.py deleted file mode 100644 index 224fe17..0000000 --- a/src/metriport/resources/devices/types/connected_user_info.py +++ /dev/null @@ -1,28 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ....core.datetime_utils import serialize_datetime - - -class ConnectedUserInfo(pydantic.BaseModel): - metriport_user_id: str = pydantic.Field(alias="metriportUserId") - app_user_id: str = pydantic.Field(alias="appUserId") - connected_providers: typing.Optional[typing.List[str]] = pydantic.Field(alias="connectedProviders") - - 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/devices/types/duration.py b/src/metriport/resources/devices/types/duration.py deleted file mode 100644 index d909403..0000000 --- a/src/metriport/resources/devices/types/duration.py +++ /dev/null @@ -1,29 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ....core.datetime_utils import serialize_datetime - - -class Duration(pydantic.BaseModel): - rest_seconds: typing.Optional[int] - very_low_seconds: typing.Optional[int] - low_seconds: typing.Optional[int] - med_seconds: typing.Optional[int] - high_seconds: typing.Optional[int] - - 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/devices/types/elevation.py b/src/metriport/resources/devices/types/elevation.py deleted file mode 100644 index 8bf83f2..0000000 --- a/src/metriport/resources/devices/types/elevation.py +++ /dev/null @@ -1,27 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ....core.datetime_utils import serialize_datetime - - -class Elevation(pydantic.BaseModel): - gain_meters: typing.Optional[int] - min_meters: typing.Optional[int] - max_meters: typing.Optional[int] - - 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/devices/types/energy_expenditure.py b/src/metriport/resources/devices/types/energy_expenditure.py deleted file mode 100644 index 7afe538..0000000 --- a/src/metriport/resources/devices/types/energy_expenditure.py +++ /dev/null @@ -1,28 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ....core.datetime_utils import serialize_datetime - - -class EnergyExpenditure(pydantic.BaseModel): - active_kcal: typing.Optional[int] - basal_metabolic_rate_kcal: typing.Optional[int] - total_watts: typing.Optional[int] - avg_watts: typing.Optional[int] - - 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/devices/types/food.py b/src/metriport/resources/devices/types/food.py deleted file mode 100644 index d26654d..0000000 --- a/src/metriport/resources/devices/types/food.py +++ /dev/null @@ -1,30 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ....core.datetime_utils import serialize_datetime -from .nutrition_facts import NutritionFacts - - -class Food(pydantic.BaseModel): - name: typing.Optional[str] - brand: typing.Optional[str] - amount: typing.Optional[float] - unit: typing.Optional[str] - nutrition_facts: typing.Optional[NutritionFacts] - - 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/devices/types/heart_rate.py b/src/metriport/resources/devices/types/heart_rate.py deleted file mode 100644 index 2a07148..0000000 --- a/src/metriport/resources/devices/types/heart_rate.py +++ /dev/null @@ -1,30 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ....core.datetime_utils import serialize_datetime -from .sample import Sample - - -class HeartRate(pydantic.BaseModel): - min_bpm: typing.Optional[int] - max_bpm: typing.Optional[int] - avg_bpm: typing.Optional[int] - resting_bpm: typing.Optional[int] - samples_bpm: typing.Optional[typing.List[Sample]] - - 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/devices/types/heart_rate_variability.py b/src/metriport/resources/devices/types/heart_rate_variability.py deleted file mode 100644 index 201807a..0000000 --- a/src/metriport/resources/devices/types/heart_rate_variability.py +++ /dev/null @@ -1,27 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ....core.datetime_utils import serialize_datetime -from .heart_rate_variability_measurement import HeartRateVariabilityMeasurement - - -class HeartRateVariability(pydantic.BaseModel): - rmssd: typing.Optional[HeartRateVariabilityMeasurement] - sdnn: typing.Optional[HeartRateVariabilityMeasurement] - - 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/devices/types/heart_rate_variability_measurement.py b/src/metriport/resources/devices/types/heart_rate_variability_measurement.py deleted file mode 100644 index 80ca6a1..0000000 --- a/src/metriport/resources/devices/types/heart_rate_variability_measurement.py +++ /dev/null @@ -1,27 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ....core.datetime_utils import serialize_datetime -from .sample import Sample - - -class HeartRateVariabilityMeasurement(pydantic.BaseModel): - avg_millis: typing.Optional[int] - samples_millis: typing.Optional[typing.List[Sample]] - - 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/devices/types/lat_lon.py b/src/metriport/resources/devices/types/lat_lon.py deleted file mode 100644 index 8b3e36d..0000000 --- a/src/metriport/resources/devices/types/lat_lon.py +++ /dev/null @@ -1,26 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ....core.datetime_utils import serialize_datetime - - -class LatLon(pydantic.BaseModel): - lat: float - lon: float - - 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/devices/types/location.py b/src/metriport/resources/devices/types/location.py deleted file mode 100644 index f27245f..0000000 --- a/src/metriport/resources/devices/types/location.py +++ /dev/null @@ -1,31 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ....core.datetime_utils import serialize_datetime -from .lat_lon import LatLon - - -class Location(pydantic.BaseModel): - start_lat_lon_deg: typing.Optional[LatLon] - end_lat_lon_deg: typing.Optional[LatLon] - polystring: typing.Optional[str] - city: typing.Optional[str] - country: typing.Optional[str] - region: typing.Optional[str] - - 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/devices/types/macros.py b/src/metriport/resources/devices/types/macros.py deleted file mode 100644 index fc6e0c9..0000000 --- a/src/metriport/resources/devices/types/macros.py +++ /dev/null @@ -1,35 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ....core.datetime_utils import serialize_datetime - - -class Macros(pydantic.BaseModel): - alcohol_g: typing.Optional[int] - carbs_g: typing.Optional[int] - cholesterol_mg: typing.Optional[int] - energy_kcal: typing.Optional[int] - fat_g: typing.Optional[int] - fiber_g: typing.Optional[int] - protein_g: typing.Optional[int] - sodium_mg: typing.Optional[int] - sugar_g: typing.Optional[int] - trans_fat_g: typing.Optional[int] - water_ml: typing.Optional[int] - - 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/devices/types/metadata.py b/src/metriport/resources/devices/types/metadata.py deleted file mode 100644 index 97383a5..0000000 --- a/src/metriport/resources/devices/types/metadata.py +++ /dev/null @@ -1,31 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ....core.datetime_utils import serialize_datetime -from .provider_source import ProviderSource -from .source_info import SourceInfo - - -class Metadata(pydantic.BaseModel): - date: str - hour: typing.Optional[str] - source: ProviderSource - data_source: typing.Optional[SourceInfo] - error: typing.Optional[str] - - 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/devices/types/metriport_data.py b/src/metriport/resources/devices/types/metriport_data.py deleted file mode 100644 index 5fac44c..0000000 --- a/src/metriport/resources/devices/types/metriport_data.py +++ /dev/null @@ -1,26 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ....core.datetime_utils import serialize_datetime -from .metadata import Metadata - - -class MetriportData(pydantic.BaseModel): - metadata: Metadata - - 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/devices/types/micros.py b/src/metriport/resources/devices/types/micros.py deleted file mode 100644 index 96187af..0000000 --- a/src/metriport/resources/devices/types/micros.py +++ /dev/null @@ -1,50 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ....core.datetime_utils import serialize_datetime - - -class Micros(pydantic.BaseModel): - biotin_mg: typing.Optional[int] - caffeine_mg: typing.Optional[int] - calcium_mg: typing.Optional[int] - copper_mg: typing.Optional[int] - folate_mg: typing.Optional[int] - folic_acid_mg: typing.Optional[int] - iodine_mg: typing.Optional[int] - iron_mg: typing.Optional[int] - magnesium_mg: typing.Optional[int] - manganese_mg: typing.Optional[int] - phosphorus_mg: typing.Optional[int] - potassium_mg: typing.Optional[int] - selenium_mg: typing.Optional[int] - vitamin_a_mg: typing.Optional[int] = pydantic.Field(alias="vitamin_A_mg") - vitamin_b_1_mg: typing.Optional[int] = pydantic.Field(alias="vitamin_B1_mg") - vitamin_b_2_mg: typing.Optional[int] = pydantic.Field(alias="vitamin_B2_mg") - vitamin_b_3_mg: typing.Optional[int] = pydantic.Field(alias="vitamin_B3_mg") - vitamin_b_5_mg: typing.Optional[int] = pydantic.Field(alias="vitamin_B5_mg") - vitamin_b_6_mg: typing.Optional[int] = pydantic.Field(alias="vitamin_B6_mg") - vitamin_b_12_mg: typing.Optional[int] = pydantic.Field(alias="vitamin_B12_mg") - vitamin_c_mg: typing.Optional[int] = pydantic.Field(alias="vitamin_C_mg") - vitamin_d_mg: typing.Optional[int] = pydantic.Field(alias="vitamin_D_mg") - vitamin_e_mg: typing.Optional[int] = pydantic.Field(alias="vitamin_E_mg") - vitamin_k_mg: typing.Optional[int] = pydantic.Field(alias="vitamin_K_mg") - zinc_mg: typing.Optional[int] - - 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/devices/types/nutrition.py b/src/metriport/resources/devices/types/nutrition.py deleted file mode 100644 index f6df0ab..0000000 --- a/src/metriport/resources/devices/types/nutrition.py +++ /dev/null @@ -1,28 +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 .food import Food -from .metriport_data import MetriportData -from .nutrition_facts import NutritionFacts - - -class Nutrition(MetriportData): - summary: typing.Optional[NutritionFacts] - foods: typing.Optional[typing.List[Food]] - - 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/devices/types/nutrition_facts.py b/src/metriport/resources/devices/types/nutrition_facts.py deleted file mode 100644 index 6f155b0..0000000 --- a/src/metriport/resources/devices/types/nutrition_facts.py +++ /dev/null @@ -1,30 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ....core.datetime_utils import serialize_datetime -from .aminos import Aminos -from .macros import Macros -from .micros import Micros - - -class NutritionFacts(pydantic.BaseModel): - macros: typing.Optional[Macros] - micros: typing.Optional[Micros] - aminos: typing.Optional[Aminos] - - 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/devices/types/provider_source.py b/src/metriport/resources/devices/types/provider_source.py deleted file mode 100644 index e0f209d..0000000 --- a/src/metriport/resources/devices/types/provider_source.py +++ /dev/null @@ -1,53 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import enum -import typing - -T_Result = typing.TypeVar("T_Result") - - -class ProviderSource(str, enum.Enum): - APPLE = "apple" - CRONOMETER = "cronometer" - DEXCOM = "dexcom" - FITBIT = "fitbit" - GARMIN = "garmin" - GOOGLE = "google" - OURA = "oura" - TENOVI = "tenovi" - WHOOP = "whoop" - WITHINGS = "withings" - - def visit( - self, - apple: typing.Callable[[], T_Result], - cronometer: typing.Callable[[], T_Result], - dexcom: typing.Callable[[], T_Result], - fitbit: typing.Callable[[], T_Result], - garmin: typing.Callable[[], T_Result], - google: typing.Callable[[], T_Result], - oura: typing.Callable[[], T_Result], - tenovi: typing.Callable[[], T_Result], - whoop: typing.Callable[[], T_Result], - withings: typing.Callable[[], T_Result], - ) -> T_Result: - if self is ProviderSource.APPLE: - return apple() - if self is ProviderSource.CRONOMETER: - return cronometer() - if self is ProviderSource.DEXCOM: - return dexcom() - if self is ProviderSource.FITBIT: - return fitbit() - if self is ProviderSource.GARMIN: - return garmin() - if self is ProviderSource.GOOGLE: - return google() - if self is ProviderSource.OURA: - return oura() - if self is ProviderSource.TENOVI: - return tenovi() - if self is ProviderSource.WHOOP: - return whoop() - if self is ProviderSource.WITHINGS: - return withings() diff --git a/src/metriport/resources/devices/types/respiration.py b/src/metriport/resources/devices/types/respiration.py deleted file mode 100644 index f12c74a..0000000 --- a/src/metriport/resources/devices/types/respiration.py +++ /dev/null @@ -1,33 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ....core.datetime_utils import serialize_datetime -from .blood_oxygen import BloodOxygen -from .sample import Sample - - -class Respiration(pydantic.BaseModel): - vo_2_max: typing.Optional[int] = pydantic.Field(alias="vo2_max") - spo_2: typing.Optional[BloodOxygen] = pydantic.Field(alias="spo2") - avg_breaths_per_minute: typing.Optional[int] - peak_flow_l_min: typing.Optional[int] = pydantic.Field(alias="peak_flow_L_min") - forced_volume_l: typing.Optional[int] = pydantic.Field(alias="forced_volume_L") - samples_breaths_per_minute: typing.Optional[typing.List[Sample]] - - 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/devices/types/sample.py b/src/metriport/resources/devices/types/sample.py deleted file mode 100644 index f716b08..0000000 --- a/src/metriport/resources/devices/types/sample.py +++ /dev/null @@ -1,29 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ....core.datetime_utils import serialize_datetime -from .source_info import SourceInfo - - -class Sample(pydantic.BaseModel): - time: str - value: int - std_dev: typing.Optional[float] - data_source: typing.Optional[SourceInfo] - - 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/devices/types/sex.py b/src/metriport/resources/devices/types/sex.py deleted file mode 100644 index da4a4d7..0000000 --- a/src/metriport/resources/devices/types/sex.py +++ /dev/null @@ -1,17 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import enum -import typing - -T_Result = typing.TypeVar("T_Result") - - -class Sex(str, enum.Enum): - MALE = "male" - FEMALE = "female" - - def visit(self, male: typing.Callable[[], T_Result], female: typing.Callable[[], T_Result]) -> T_Result: - if self is Sex.MALE: - return male() - if self is Sex.FEMALE: - return female() diff --git a/src/metriport/resources/devices/types/sleep.py b/src/metriport/resources/devices/types/sleep.py deleted file mode 100644 index b13fcd0..0000000 --- a/src/metriport/resources/devices/types/sleep.py +++ /dev/null @@ -1,31 +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 .metriport_data import MetriportData -from .sleep_biometrics import SleepBiometrics -from .sleep_durations import SleepDurations - - -class Sleep(MetriportData): - start_time: typing.Optional[str] - end_time: typing.Optional[str] - durations: typing.Optional[SleepDurations] - biometrics: typing.Optional[SleepBiometrics] - wakeup_frequency: typing.Optional[int] - - 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/devices/types/sleep_biometrics.py b/src/metriport/resources/devices/types/sleep_biometrics.py deleted file mode 100644 index 483564f..0000000 --- a/src/metriport/resources/devices/types/sleep_biometrics.py +++ /dev/null @@ -1,32 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ....core.datetime_utils import serialize_datetime -from .heart_rate import HeartRate -from .heart_rate_variability import HeartRateVariability -from .respiration import Respiration -from .temperature import Temperature - - -class SleepBiometrics(pydantic.BaseModel): - heart_rate: typing.Optional[HeartRate] - hrv: typing.Optional[HeartRateVariability] - respiration: typing.Optional[Respiration] - temperature: typing.Optional[Temperature] - - 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/devices/types/sleep_durations.py b/src/metriport/resources/devices/types/sleep_durations.py deleted file mode 100644 index 201847c..0000000 --- a/src/metriport/resources/devices/types/sleep_durations.py +++ /dev/null @@ -1,32 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ....core.datetime_utils import serialize_datetime - - -class SleepDurations(pydantic.BaseModel): - total_seconds: typing.Optional[int] - awake_seconds: typing.Optional[int] - deep_seconds: typing.Optional[int] - rem_seconds: typing.Optional[int] - light_seconds: typing.Optional[int] - in_bed_seconds: typing.Optional[int] - time_to_fall_asleep_seconds: typing.Optional[int] - no_data_seconds: typing.Optional[int] - - 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/devices/types/source_info.py b/src/metriport/resources/devices/types/source_info.py deleted file mode 100644 index 344075c..0000000 --- a/src/metriport/resources/devices/types/source_info.py +++ /dev/null @@ -1,29 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ....core.datetime_utils import serialize_datetime -from .source_type import SourceType - - -class SourceInfo(pydantic.BaseModel): - source_type: typing.Optional[SourceType] - id: typing.Optional[str] - name: typing.Optional[str] - type: typing.Optional[str] - - 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/devices/types/source_type.py b/src/metriport/resources/devices/types/source_type.py deleted file mode 100644 index 9202f05..0000000 --- a/src/metriport/resources/devices/types/source_type.py +++ /dev/null @@ -1,17 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import enum -import typing - -T_Result = typing.TypeVar("T_Result") - - -class SourceType(str, enum.Enum): - MANUAL = "MANUAL_ENTRY" - DEVICE = "DEVICE" - - def visit(self, manual: typing.Callable[[], T_Result], device: typing.Callable[[], T_Result]) -> T_Result: - if self is SourceType.MANUAL: - return manual() - if self is SourceType.DEVICE: - return device() diff --git a/src/metriport/resources/devices/types/speed.py b/src/metriport/resources/devices/types/speed.py deleted file mode 100644 index b2eaf5f..0000000 --- a/src/metriport/resources/devices/types/speed.py +++ /dev/null @@ -1,26 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ....core.datetime_utils import serialize_datetime - - -class Speed(pydantic.BaseModel): - max_km_h: typing.Optional[float] - avg_km_h: typing.Optional[float] - - 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/devices/types/temperature.py b/src/metriport/resources/devices/types/temperature.py deleted file mode 100644 index 19f90ed..0000000 --- a/src/metriport/resources/devices/types/temperature.py +++ /dev/null @@ -1,28 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ....core.datetime_utils import serialize_datetime -from .temperature_measurement import TemperatureMeasurement - - -class Temperature(pydantic.BaseModel): - core: typing.Optional[TemperatureMeasurement] - delta_celcius: typing.Optional[float] - skin: typing.Optional[TemperatureMeasurement] - - 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/devices/types/temperature_measurement.py b/src/metriport/resources/devices/types/temperature_measurement.py deleted file mode 100644 index c9b1d87..0000000 --- a/src/metriport/resources/devices/types/temperature_measurement.py +++ /dev/null @@ -1,27 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ....core.datetime_utils import serialize_datetime -from .sample import Sample - - -class TemperatureMeasurement(pydantic.BaseModel): - avg_celcius: typing.Optional[float] - samples_celcius: typing.Optional[typing.List[Sample]] - - 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/devices/types/user.py b/src/metriport/resources/devices/types/user.py deleted file mode 100644 index 97aa58e..0000000 --- a/src/metriport/resources/devices/types/user.py +++ /dev/null @@ -1,36 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import datetime as dt -import typing - -import pydantic - -from ....core.datetime_utils import serialize_datetime -from .metriport_data import MetriportData -from .sex import Sex - - -class User(MetriportData): - age: typing.Optional[int] - first_name: typing.Optional[str] - last_name: typing.Optional[str] - city: typing.Optional[str] - country: typing.Optional[str] - date_of_birth: typing.Optional[str] - email: typing.Optional[str] - region: typing.Optional[str] = pydantic.Field(description="can be state, province, etc") - sex: typing.Optional[Sex] - - 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/__init__.py b/src/metriport/resources/medical/__init__.py index 061c8b8..e1bbb70 100644 --- a/src/metriport/resources/medical/__init__.py +++ b/src/metriport/resources/medical/__init__.py @@ -3,7 +3,6 @@ from .resources import ( Addresses, BaseFacility, - BaseOrganization, BasePatient, CodeableConcept, Coding, @@ -21,17 +20,17 @@ Filter, GetConsolidatedQueryStatusResponse, ListDocumentsResponse, + ListFacilitiesResponse, + ListPatientsResponse, OrgType, Organization, + OrganizationCreate, Patient, PatientConsolidatedDataStatus, Period, PersonalIdentifier, PersonalIdentifier_DriversLicense, Progress, - ResourceTypeForConsolidation, - ResourcesSearchableByPatient, - ResourcesSearchableBySubject, StartConsolidatedQueryResponse, document, facility, @@ -43,7 +42,6 @@ __all__ = [ "Addresses", "BaseFacility", - "BaseOrganization", "BasePatient", "CodeableConcept", "Coding", @@ -61,17 +59,17 @@ "Filter", "GetConsolidatedQueryStatusResponse", "ListDocumentsResponse", + "ListFacilitiesResponse", + "ListPatientsResponse", "OrgType", "Organization", + "OrganizationCreate", "Patient", "PatientConsolidatedDataStatus", "Period", "PersonalIdentifier", "PersonalIdentifier_DriversLicense", "Progress", - "ResourceTypeForConsolidation", - "ResourcesSearchableByPatient", - "ResourcesSearchableBySubject", "StartConsolidatedQueryResponse", "document", "facility", diff --git a/src/metriport/resources/medical/resources/__init__.py b/src/metriport/resources/medical/resources/__init__.py index 000770b..e2481d8 100644 --- a/src/metriport/resources/medical/resources/__init__.py +++ b/src/metriport/resources/medical/resources/__init__.py @@ -12,18 +12,15 @@ ListDocumentsResponse, Progress, ) -from .facility import BaseFacility, Facility +from .facility import BaseFacility, Facility, ListFacilitiesResponse from .fhir import ( ConsolidatedCountResponse, Filter, GetConsolidatedQueryStatusResponse, PatientConsolidatedDataStatus, - ResourceTypeForConsolidation, - ResourcesSearchableByPatient, - ResourcesSearchableBySubject, StartConsolidatedQueryResponse, ) -from .organization import BaseOrganization, OrgType, Organization +from .organization import OrgType, Organization, OrganizationCreate from .patient import ( Addresses, BasePatient, @@ -31,6 +28,7 @@ Contacts, DriversLicense, FacilityId, + ListPatientsResponse, Patient, Period, PersonalIdentifier, @@ -40,7 +38,6 @@ __all__ = [ "Addresses", "BaseFacility", - "BaseOrganization", "BasePatient", "CodeableConcept", "Coding", @@ -58,17 +55,17 @@ "Filter", "GetConsolidatedQueryStatusResponse", "ListDocumentsResponse", + "ListFacilitiesResponse", + "ListPatientsResponse", "OrgType", "Organization", + "OrganizationCreate", "Patient", "PatientConsolidatedDataStatus", "Period", "PersonalIdentifier", "PersonalIdentifier_DriversLicense", "Progress", - "ResourceTypeForConsolidation", - "ResourcesSearchableByPatient", - "ResourcesSearchableBySubject", "StartConsolidatedQueryResponse", "document", "facility", diff --git a/src/metriport/resources/medical/resources/document/client.py b/src/metriport/resources/medical/resources/document/client.py index f5e72af..e53369c 100644 --- a/src/metriport/resources/medical/resources/document/client.py +++ b/src/metriport/resources/medical/resources/document/client.py @@ -4,8 +4,6 @@ import urllib.parse from json.decoder import JSONDecodeError -import pydantic - from .....core.api_error import ApiError from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper from .....core.remove_none_from_dict import remove_none_from_dict @@ -14,6 +12,11 @@ from .types.document_url import DocumentUrl from .types.list_documents_response import ListDocumentsResponse +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + class DocumentClient: def __init__(self, *, client_wrapper: SyncClientWrapper): @@ -22,19 +25,15 @@ def __init__(self, *, client_wrapper: SyncClientWrapper): def start_query(self, *, patient_id: str, facility_id: str) -> DocumentQuery: """ Triggers a document query for the specified patient across HIEs. - When executed, this endpoint triggers an asynchronous document query across HIEs. This is a two step process where the documents will first be downloaded from the respective HIE and, if they are C-CDA/XML, then converted to FHIR. - Each process (download, conversion) will contain its own `total` and `status` as well as the count for `successful` operations and `errors`. - When the asynchronous document query finishes, it stores new/updated document references for future requests and updates the status of download to `completed`. Meanwhile, in the background, files will be converted and the convert count will be incremented. Once all documents have been converted it too will be marked as `completed`. - If there's no document to be converted, the total will be set to zero and the status to `completed`. @@ -42,6 +41,16 @@ 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. + --- + from metriport.client import Metriport + + client = Metriport( + api_key="YOUR_API_KEY", + ) + client.medical.document.start_query( + patient_id="12345678", + facility_id="12345678", + ) """ _response = self._client_wrapper.httpx_client.request( "POST", @@ -67,6 +76,15 @@ def get_query_status(self, *, patient_id: str) -> DocumentQuery: Parameters: - patient_id: str. The ID of the Patient for which to list available Documents. + --- + from metriport.client import Metriport + + client = Metriport( + api_key="YOUR_API_KEY", + ) + client.medical.document.get_query_status( + patient_id="12345678", + ) """ _response = self._client_wrapper.httpx_client.request( "POST", @@ -95,7 +113,6 @@ def list( Lists all Documents that can be retrieved for a Patient. This endpoint returns the document references available at Metriport which are associated with the given Patient. - To start a new document query, see the [Start Document Query endpoint](/api-reference/medical/document/start-query). Parameters: @@ -106,6 +123,16 @@ def list( - 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", + ) """ _response = self._client_wrapper.httpx_client.request( "GET", @@ -136,7 +163,17 @@ def get_url(self, *, file_name: str, conversion_type: typing.Optional[Conversion - 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. + --- + from metriport.client import Metriport + from metriport.resources.medical import ConversionType + client = Metriport( + api_key="YOUR_API_KEY", + ) + client.medical.document.get_url( + file_name="x-ray", + conversion_type=ConversionType.PDF, + ) """ _response = self._client_wrapper.httpx_client.request( "GET", @@ -161,19 +198,15 @@ def __init__(self, *, client_wrapper: AsyncClientWrapper): async def start_query(self, *, patient_id: str, facility_id: str) -> DocumentQuery: """ Triggers a document query for the specified patient across HIEs. - When executed, this endpoint triggers an asynchronous document query across HIEs. This is a two step process where the documents will first be downloaded from the respective HIE and, if they are C-CDA/XML, then converted to FHIR. - Each process (download, conversion) will contain its own `total` and `status` as well as the count for `successful` operations and `errors`. - When the asynchronous document query finishes, it stores new/updated document references for future requests and updates the status of download to `completed`. Meanwhile, in the background, files will be converted and the convert count will be incremented. Once all documents have been converted it too will be marked as `completed`. - If there's no document to be converted, the total will be set to zero and the status to `completed`. @@ -181,6 +214,16 @@ 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. + --- + from metriport.client import AsyncMetriport + + client = AsyncMetriport( + api_key="YOUR_API_KEY", + ) + await client.medical.document.start_query( + patient_id="12345678", + facility_id="12345678", + ) """ _response = await self._client_wrapper.httpx_client.request( "POST", @@ -206,6 +249,15 @@ async def get_query_status(self, *, patient_id: str) -> DocumentQuery: Parameters: - patient_id: str. The ID of the Patient for which to list available Documents. + --- + from metriport.client import AsyncMetriport + + client = AsyncMetriport( + api_key="YOUR_API_KEY", + ) + await client.medical.document.get_query_status( + patient_id="12345678", + ) """ _response = await self._client_wrapper.httpx_client.request( "POST", @@ -234,7 +286,6 @@ async def list( Lists all Documents that can be retrieved for a Patient. This endpoint returns the document references available at Metriport which are associated with the given Patient. - To start a new document query, see the [Start Document Query endpoint](/api-reference/medical/document/start-query). Parameters: @@ -245,6 +296,16 @@ async def list( - 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", + ) """ _response = await self._client_wrapper.httpx_client.request( "GET", @@ -275,7 +336,17 @@ async def get_url(self, *, file_name: str, conversion_type: typing.Optional[Conv - 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. + --- + from metriport.client import AsyncMetriport + from metriport.resources.medical import ConversionType + client = AsyncMetriport( + api_key="YOUR_API_KEY", + ) + await client.medical.document.get_url( + file_name="x-ray", + conversion_type=ConversionType.PDF, + ) """ _response = await self._client_wrapper.httpx_client.request( "GET", diff --git a/src/metriport/resources/medical/resources/document/types/codeable_concept.py b/src/metriport/resources/medical/resources/document/types/codeable_concept.py index a5319ee..031e9d6 100644 --- a/src/metriport/resources/medical/resources/document/types/codeable_concept.py +++ b/src/metriport/resources/medical/resources/document/types/codeable_concept.py @@ -3,13 +3,31 @@ import datetime as dt import typing -import pydantic - from ......core.datetime_utils import serialize_datetime from .coding import Coding +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + class CodeableConcept(pydantic.BaseModel): + """ + from metriport.resources.medical import CodeableConcept, Coding + + CodeableConcept( + coding=[ + Coding( + system="http://snomed.info/sct", + code="62479008", + display="Diagnoses", + ) + ], + text="Diagnoses", + ) + """ + coding: typing.Optional[typing.List[Coding]] = pydantic.Field( description="Array containing the coding defined by a terminology system." ) diff --git a/src/metriport/resources/medical/resources/document/types/coding.py b/src/metriport/resources/medical/resources/document/types/coding.py index 9c6437c..e80f1c4 100644 --- a/src/metriport/resources/medical/resources/document/types/coding.py +++ b/src/metriport/resources/medical/resources/document/types/coding.py @@ -3,12 +3,25 @@ import datetime as dt import typing -import pydantic - from ......core.datetime_utils import serialize_datetime +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + class Coding(pydantic.BaseModel): + """ + from metriport.resources.medical import Coding + + Coding( + system="http://snomed.info/sct", + code="62479008", + display="Diagnoses", + ) + """ + 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.") 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 db42852..39ed2f6 100644 --- a/src/metriport/resources/medical/resources/document/types/document_query.py +++ b/src/metriport/resources/medical/resources/document/types/document_query.py @@ -3,13 +3,36 @@ import datetime as dt import typing -import pydantic - from ......core.datetime_utils import serialize_datetime from .progress import Progress +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + class DocumentQuery(pydantic.BaseModel): + """ + from metriport.resources.medical import ( + DocumentQuery, + DocumentQueryStatus, + Progress, + ) + + DocumentQuery( + download=Progress( + status=DocumentQueryStatus.COMPLETED, + total=100, + successful=98, + errors=2, + ), + convert=Progress( + status=DocumentQueryStatus.PROCESSING, + ), + ) + """ + download: typing.Optional[Progress] convert: typing.Optional[Progress] diff --git a/src/metriport/resources/medical/resources/document/types/document_reference.py b/src/metriport/resources/medical/resources/document/types/document_reference.py index 573fcdf..cfddecd 100644 --- a/src/metriport/resources/medical/resources/document/types/document_reference.py +++ b/src/metriport/resources/medical/resources/document/types/document_reference.py @@ -3,13 +3,48 @@ import datetime as dt import typing -import pydantic - 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.") diff --git a/src/metriport/resources/medical/resources/document/types/document_url.py b/src/metriport/resources/medical/resources/document/types/document_url.py index f3bb0b1..ae862c3 100644 --- a/src/metriport/resources/medical/resources/document/types/document_url.py +++ b/src/metriport/resources/medical/resources/document/types/document_url.py @@ -3,14 +3,23 @@ import datetime as dt import typing -import pydantic - from ......core.datetime_utils import serialize_datetime +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + class DocumentUrl(pydantic.BaseModel): """ A json object containing the URL will be returned. + --- + from metriport.resources.medical import DocumentUrl + + DocumentUrl( + url="abc123-def456", + ) """ url: typing.Optional[str] = pydantic.Field(description="The presigned URL.") 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 index cd15c54..157ade6 100644 --- a/src/metriport/resources/medical/resources/document/types/list_documents_response.py +++ b/src/metriport/resources/medical/resources/document/types/list_documents_response.py @@ -3,13 +3,53 @@ import datetime as dt import typing -import pydantic - 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: diff --git a/src/metriport/resources/medical/resources/document/types/progress.py b/src/metriport/resources/medical/resources/document/types/progress.py index 85bd6e5..3efc360 100644 --- a/src/metriport/resources/medical/resources/document/types/progress.py +++ b/src/metriport/resources/medical/resources/document/types/progress.py @@ -3,13 +3,24 @@ import datetime as dt import typing -import pydantic - from ......core.datetime_utils import serialize_datetime from .document_query_status import DocumentQueryStatus +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + class Progress(pydantic.BaseModel): + """ + from metriport.resources.medical import DocumentQueryStatus, Progress + + Progress( + status=DocumentQueryStatus.PROCESSING, + ) + """ + status: DocumentQueryStatus = pydantic.Field(description="The status of querying document references across HIEs.") total: typing.Optional[int] = pydantic.Field(description="The total number of documents to be queried.") successful: typing.Optional[int] = pydantic.Field(description="The number of documents successfully downloaded.") diff --git a/src/metriport/resources/medical/resources/facility/__init__.py b/src/metriport/resources/medical/resources/facility/__init__.py index 8bde733..47a3eae 100644 --- a/src/metriport/resources/medical/resources/facility/__init__.py +++ b/src/metriport/resources/medical/resources/facility/__init__.py @@ -1,5 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -from .types import BaseFacility, Facility +from .types import BaseFacility, Facility, ListFacilitiesResponse -__all__ = ["BaseFacility", "Facility"] +__all__ = ["BaseFacility", "Facility", "ListFacilitiesResponse"] diff --git a/src/metriport/resources/medical/resources/facility/client.py b/src/metriport/resources/medical/resources/facility/client.py index d20e381..6c43c60 100644 --- a/src/metriport/resources/medical/resources/facility/client.py +++ b/src/metriport/resources/medical/resources/facility/client.py @@ -4,13 +4,17 @@ import urllib.parse from json.decoder import JSONDecodeError -import pydantic - from .....core.api_error import ApiError from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper from .....core.jsonable_encoder import jsonable_encoder from .types.base_facility import BaseFacility from .types.facility import Facility +from .types.list_facilities_response import ListFacilitiesResponse + +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, ...) @@ -26,10 +30,34 @@ def create(self, *, request: BaseFacility) -> Facility: Parameters: - request: BaseFacility. + --- + from metriport import Address, UsState + from metriport.client import Metriport + from metriport.resources.medical import BaseFacility + + client = Metriport( + api_key="YOUR_API_KEY", + ) + client.medical.facility.create( + request=BaseFacility( + name="Care Facility, LLC", + npi="1234567891", + address=Address( + address_line_1="2261 Market Street", + address_line_2="#4818", + city="San Francisco", + state=UsState.CA, + zip="94114", + country="USA", + ), + tin="12-3456789", + active=True, + ), + ) """ _response = self._client_wrapper.httpx_client.request( "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "facility"), + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "medical/v1/facility"), json=jsonable_encoder(request), headers=self._client_wrapper.get_headers(), timeout=60, @@ -47,11 +75,21 @@ def get(self, id: str) -> Facility: Get a Facility in Metriport where your patients receive care. Parameters: - - id: str. The ID assigned to this Facility. This ID will be used to uniquely identify this Facility in medical documents. + - id: str. The ID assigned to this Facility. This ID will be used + to uniquely identify this Facility in medical documents. + --- + from metriport.client import Metriport + + client = Metriport( + api_key="YOUR_API_KEY", + ) + client.medical.facility.get( + id="2.16.840.1.113883.3.666.123", + ) """ _response = self._client_wrapper.httpx_client.request( "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"facility/{id}"), + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"medical/v1/facility/{id}"), headers=self._client_wrapper.get_headers(), timeout=60, ) @@ -71,10 +109,35 @@ def update(self, id: str, *, request: BaseFacility) -> Facility: - id: str. The ID of the Facility. - request: BaseFacility. + --- + from metriport import Address, UsState + from metriport.client import Metriport + from metriport.resources.medical import BaseFacility + + client = Metriport( + api_key="YOUR_API_KEY", + ) + client.medical.facility.update( + id="2.16.840.1.113883.3.666.123", + request=BaseFacility( + name="Care Facility, LLC", + npi="1234567891", + address=Address( + address_line_1="2261 Market Street", + address_line_2="#4818", + city="San Francisco", + state=UsState.CA, + zip="94114", + country="USA", + ), + tin="12-3456789", + active=True, + ), + ) """ _response = self._client_wrapper.httpx_client.request( "PUT", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"facility/{id}"), + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"medical/v1/facility/{id}"), json=jsonable_encoder(request), headers=self._client_wrapper.get_headers(), timeout=60, @@ -87,18 +150,26 @@ def update(self, id: str, *, request: BaseFacility) -> Facility: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - def list(self) -> typing.List[Facility]: + def list(self) -> ListFacilitiesResponse: """ Lists all of your Facilities. + + --- + from metriport.client import Metriport + + client = Metriport( + api_key="YOUR_API_KEY", + ) + client.medical.facility.list() """ _response = self._client_wrapper.httpx_client.request( "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "facility"), + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "medical/v1/facility"), headers=self._client_wrapper.get_headers(), timeout=60, ) if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.List[Facility], _response.json()) # type: ignore + return pydantic.parse_obj_as(ListFacilitiesResponse, _response.json()) # type: ignore try: _response_json = _response.json() except JSONDecodeError: @@ -116,10 +187,34 @@ async def create(self, *, request: BaseFacility) -> Facility: Parameters: - request: BaseFacility. + --- + from metriport import Address, UsState + from metriport.client import AsyncMetriport + from metriport.resources.medical import BaseFacility + + client = AsyncMetriport( + api_key="YOUR_API_KEY", + ) + await client.medical.facility.create( + request=BaseFacility( + name="Care Facility, LLC", + npi="1234567891", + address=Address( + address_line_1="2261 Market Street", + address_line_2="#4818", + city="San Francisco", + state=UsState.CA, + zip="94114", + country="USA", + ), + tin="12-3456789", + active=True, + ), + ) """ _response = await self._client_wrapper.httpx_client.request( "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "facility"), + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "medical/v1/facility"), json=jsonable_encoder(request), headers=self._client_wrapper.get_headers(), timeout=60, @@ -137,11 +232,21 @@ async def get(self, id: str) -> Facility: Get a Facility in Metriport where your patients receive care. Parameters: - - id: str. The ID assigned to this Facility. This ID will be used to uniquely identify this Facility in medical documents. + - id: str. The ID assigned to this Facility. This ID will be used + to uniquely identify this Facility in medical documents. + --- + from metriport.client import AsyncMetriport + + client = AsyncMetriport( + api_key="YOUR_API_KEY", + ) + await client.medical.facility.get( + id="2.16.840.1.113883.3.666.123", + ) """ _response = await self._client_wrapper.httpx_client.request( "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"facility/{id}"), + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"medical/v1/facility/{id}"), headers=self._client_wrapper.get_headers(), timeout=60, ) @@ -161,10 +266,35 @@ async def update(self, id: str, *, request: BaseFacility) -> Facility: - id: str. The ID of the Facility. - request: BaseFacility. + --- + from metriport import Address, UsState + from metriport.client import AsyncMetriport + from metriport.resources.medical import BaseFacility + + client = AsyncMetriport( + api_key="YOUR_API_KEY", + ) + await client.medical.facility.update( + id="2.16.840.1.113883.3.666.123", + request=BaseFacility( + name="Care Facility, LLC", + npi="1234567891", + address=Address( + address_line_1="2261 Market Street", + address_line_2="#4818", + city="San Francisco", + state=UsState.CA, + zip="94114", + country="USA", + ), + tin="12-3456789", + active=True, + ), + ) """ _response = await self._client_wrapper.httpx_client.request( "PUT", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"facility/{id}"), + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"medical/v1/facility/{id}"), json=jsonable_encoder(request), headers=self._client_wrapper.get_headers(), timeout=60, @@ -177,18 +307,26 @@ async def update(self, id: str, *, request: BaseFacility) -> Facility: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - async def list(self) -> typing.List[Facility]: + async def list(self) -> ListFacilitiesResponse: """ Lists all of your Facilities. + + --- + from metriport.client import AsyncMetriport + + client = AsyncMetriport( + api_key="YOUR_API_KEY", + ) + await client.medical.facility.list() """ _response = await self._client_wrapper.httpx_client.request( "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "facility"), + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "medical/v1/facility"), headers=self._client_wrapper.get_headers(), timeout=60, ) if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.List[Facility], _response.json()) # type: ignore + return pydantic.parse_obj_as(ListFacilitiesResponse, _response.json()) # type: ignore try: _response_json = _response.json() except JSONDecodeError: diff --git a/src/metriport/resources/medical/resources/facility/types/__init__.py b/src/metriport/resources/medical/resources/facility/types/__init__.py index 1efc4d9..879fc73 100644 --- a/src/metriport/resources/medical/resources/facility/types/__init__.py +++ b/src/metriport/resources/medical/resources/facility/types/__init__.py @@ -2,5 +2,6 @@ from .base_facility import BaseFacility from .facility import Facility +from .list_facilities_response import ListFacilitiesResponse -__all__ = ["BaseFacility", "Facility"] +__all__ = ["BaseFacility", "Facility", "ListFacilitiesResponse"] diff --git a/src/metriport/resources/medical/resources/facility/types/base_facility.py b/src/metriport/resources/medical/resources/facility/types/base_facility.py index f19d616..3bf3cd0 100644 --- a/src/metriport/resources/medical/resources/facility/types/base_facility.py +++ b/src/metriport/resources/medical/resources/facility/types/base_facility.py @@ -3,11 +3,14 @@ import datetime as dt import typing -import pydantic - from ......core.datetime_utils import serialize_datetime from .....commons.types.address import Address +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + class BaseFacility(pydantic.BaseModel): name: str = pydantic.Field( diff --git a/src/metriport/resources/medical/resources/facility/types/facility.py b/src/metriport/resources/medical/resources/facility/types/facility.py index f87e1f5..479aff7 100644 --- a/src/metriport/resources/medical/resources/facility/types/facility.py +++ b/src/metriport/resources/medical/resources/facility/types/facility.py @@ -3,15 +3,42 @@ import datetime as dt import typing -import pydantic - from ......core.datetime_utils import serialize_datetime from .base_facility import BaseFacility +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + class Facility(BaseFacility): + """ + from metriport import Address, UsState + from metriport.resources.medical import Facility + + Facility( + id="2.16.840.1.113883.3.666.123", + name="Care Facility, LLC", + npi="1234567891", + address=Address( + address_line_1="2261 Market Street", + address_line_2="#4818", + city="San Francisco", + state=UsState.CA, + zip="94114", + country="USA", + ), + tin="12-3456789", + active=True, + ) + """ + id: str = pydantic.Field( - description="The ID assigned to this Facility. This ID will be used to uniquely identify this Facility in medical documents." + description=( + "The ID assigned to this Facility. This ID will be used \n" + "to uniquely identify this Facility in medical documents.\n" + ) ) def json(self, **kwargs: typing.Any) -> str: diff --git a/src/metriport/resources/devices/resources/users/types/revoke_access_to_provider_response.py b/src/metriport/resources/medical/resources/facility/types/list_facilities_response.py similarity index 75% rename from src/metriport/resources/devices/resources/users/types/revoke_access_to_provider_response.py rename to src/metriport/resources/medical/resources/facility/types/list_facilities_response.py index 969a828..618e55f 100644 --- a/src/metriport/resources/devices/resources/users/types/revoke_access_to_provider_response.py +++ b/src/metriport/resources/medical/resources/facility/types/list_facilities_response.py @@ -3,13 +3,17 @@ import datetime as dt import typing -import pydantic - from ......core.datetime_utils import serialize_datetime +from .facility import Facility + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore -class RevokeAccessToProviderResponse(pydantic.BaseModel): - message: str = pydantic.Field(description="Feedback on successful token revocation.") +class ListFacilitiesResponse(pydantic.BaseModel): + facilities: typing.List[Facility] 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/fhir/__init__.py b/src/metriport/resources/medical/resources/fhir/__init__.py index 2777ee9..8691d78 100644 --- a/src/metriport/resources/medical/resources/fhir/__init__.py +++ b/src/metriport/resources/medical/resources/fhir/__init__.py @@ -5,9 +5,6 @@ Filter, GetConsolidatedQueryStatusResponse, PatientConsolidatedDataStatus, - ResourceTypeForConsolidation, - ResourcesSearchableByPatient, - ResourcesSearchableBySubject, StartConsolidatedQueryResponse, ) @@ -16,8 +13,5 @@ "Filter", "GetConsolidatedQueryStatusResponse", "PatientConsolidatedDataStatus", - "ResourceTypeForConsolidation", - "ResourcesSearchableByPatient", - "ResourcesSearchableBySubject", "StartConsolidatedQueryResponse", ] diff --git a/src/metriport/resources/medical/resources/fhir/client.py b/src/metriport/resources/medical/resources/fhir/client.py index ccdfd03..38af56b 100644 --- a/src/metriport/resources/medical/resources/fhir/client.py +++ b/src/metriport/resources/medical/resources/fhir/client.py @@ -4,8 +4,6 @@ import urllib.parse from json.decoder import JSONDecodeError -import pydantic - from .....core.api_error import ApiError from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper from .....core.remove_none_from_dict import remove_none_from_dict @@ -13,6 +11,11 @@ from .types.get_consolidated_query_status_response import GetConsolidatedQueryStatusResponse from .types.start_consolidated_query_response import StartConsolidatedQueryResponse +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + class FhirClient: def __init__(self, *, client_wrapper: SyncClientWrapper): @@ -42,11 +45,21 @@ def start_consolidated_query( - 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. + --- + from metriport.client import Metriport + client = Metriport( + api_key="YOUR_API_KEY", + ) + client.medical.fhir.start_consolidated_query( + id="12345678", + ) """ _response = self._client_wrapper.httpx_client.request( "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"patient/{id}/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}), headers=self._client_wrapper.get_headers(), timeout=60, @@ -65,10 +78,21 @@ def get_consolidated_query_status(self, id: str) -> GetConsolidatedQueryStatusRe Parameters: - id: str. The ID of the Patient + --- + from metriport.client import Metriport + + client = Metriport( + api_key="YOUR_API_KEY", + ) + client.medical.fhir.get_consolidated_query_status( + id="12345678", + ) """ _response = self._client_wrapper.httpx_client.request( "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"patient/{id}/consolidated/query"), + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"medical/v1/patient/{id}/consolidated/query" + ), headers=self._client_wrapper.get_headers(), timeout=60, ) @@ -108,7 +132,9 @@ def count_patient_data( """ _response = self._client_wrapper.httpx_client.request( "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"patient/{id}/consolidated/count"), + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"medical/v1/patient/{id}/consolidated/count" + ), params=remove_none_from_dict({"resources": resources, "dateFrom": date_from, "dateTo": date_to}), headers=self._client_wrapper.get_headers(), timeout=60, @@ -150,11 +176,21 @@ async def start_consolidated_query( - 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. + --- + from metriport.client import AsyncMetriport + client = AsyncMetriport( + api_key="YOUR_API_KEY", + ) + await client.medical.fhir.start_consolidated_query( + id="12345678", + ) """ _response = await self._client_wrapper.httpx_client.request( "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"patient/{id}/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}), headers=self._client_wrapper.get_headers(), timeout=60, @@ -173,10 +209,21 @@ async def get_consolidated_query_status(self, id: str) -> GetConsolidatedQuerySt Parameters: - id: str. The ID of the Patient + --- + from metriport.client import AsyncMetriport + + client = AsyncMetriport( + api_key="YOUR_API_KEY", + ) + await client.medical.fhir.get_consolidated_query_status( + id="12345678", + ) """ _response = await self._client_wrapper.httpx_client.request( "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"patient/{id}/consolidated/query"), + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"medical/v1/patient/{id}/consolidated/query" + ), headers=self._client_wrapper.get_headers(), timeout=60, ) @@ -216,7 +263,9 @@ async def count_patient_data( """ _response = await self._client_wrapper.httpx_client.request( "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"patient/{id}/consolidated/count"), + urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"medical/v1/patient/{id}/consolidated/count" + ), params=remove_none_from_dict({"resources": resources, "dateFrom": date_from, "dateTo": date_to}), headers=self._client_wrapper.get_headers(), timeout=60, diff --git a/src/metriport/resources/medical/resources/fhir/types/__init__.py b/src/metriport/resources/medical/resources/fhir/types/__init__.py index 4a250bd..09459bb 100644 --- a/src/metriport/resources/medical/resources/fhir/types/__init__.py +++ b/src/metriport/resources/medical/resources/fhir/types/__init__.py @@ -1,12 +1,9 @@ # This file was auto-generated by Fern from our API Definition. -from .resources_searchable_by_subject import ResourcesSearchableBySubject -from .resources_searchable_by_patient import ResourcesSearchableByPatient from .consolidated_count_response import ConsolidatedCountResponse from .filter import Filter from .get_consolidated_query_status_response import GetConsolidatedQueryStatusResponse from .patient_consolidated_data_status import PatientConsolidatedDataStatus -from .resource_type_for_consolidation import ResourceTypeForConsolidation from .start_consolidated_query_response import StartConsolidatedQueryResponse __all__ = [ @@ -14,8 +11,5 @@ "Filter", "GetConsolidatedQueryStatusResponse", "PatientConsolidatedDataStatus", - "ResourceTypeForConsolidation", - "ResourcesSearchableByPatient", - "ResourcesSearchableBySubject", "StartConsolidatedQueryResponse", ] 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 a95473f..40f87cd 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 @@ -3,11 +3,14 @@ import datetime as dt import typing -import pydantic - from ......core.datetime_utils import serialize_datetime from .filter import Filter +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + class ConsolidatedCountResponse(pydantic.BaseModel): total: int = pydantic.Field(description="The sum of all resource type count.") diff --git a/src/metriport/resources/medical/resources/fhir/types/filter.py b/src/metriport/resources/medical/resources/fhir/types/filter.py index c4aebb3..d4e72b5 100644 --- a/src/metriport/resources/medical/resources/fhir/types/filter.py +++ b/src/metriport/resources/medical/resources/fhir/types/filter.py @@ -3,10 +3,13 @@ import datetime as dt import typing -import pydantic - from ......core.datetime_utils import serialize_datetime +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + class Filter(pydantic.BaseModel): resources: str = pydantic.Field( 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 bd96b4c..8884a0d 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 @@ -3,13 +3,28 @@ import datetime as dt import typing -import pydantic - from ......core.datetime_utils import serialize_datetime from .patient_consolidated_data_status import PatientConsolidatedDataStatus +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + class GetConsolidatedQueryStatusResponse(pydantic.BaseModel): + """ + from metriport.resources.medical import ( + GetConsolidatedQueryStatusResponse, + PatientConsolidatedDataStatus, + ) + + GetConsolidatedQueryStatusResponse( + status=PatientConsolidatedDataStatus.COMPLETED, + message="Trigger a new query by POST /patient/:id/consolidated/query; data will be sent through Webhook", + ) + """ + status: PatientConsolidatedDataStatus message: typing.Optional[str] diff --git a/src/metriport/resources/medical/resources/fhir/types/resource_type_for_consolidation.py b/src/metriport/resources/medical/resources/fhir/types/resource_type_for_consolidation.py deleted file mode 100644 index ca197cb..0000000 --- a/src/metriport/resources/medical/resources/fhir/types/resource_type_for_consolidation.py +++ /dev/null @@ -1,8 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -from .resources_searchable_by_patient import ResourcesSearchableByPatient -from .resources_searchable_by_subject import ResourcesSearchableBySubject - -ResourceTypeForConsolidation = typing.Union[ResourcesSearchableByPatient, ResourcesSearchableBySubject] diff --git a/src/metriport/resources/medical/resources/fhir/types/resources_searchable_by_patient.py b/src/metriport/resources/medical/resources/fhir/types/resources_searchable_by_patient.py deleted file mode 100644 index f12bc8e..0000000 --- a/src/metriport/resources/medical/resources/fhir/types/resources_searchable_by_patient.py +++ /dev/null @@ -1,261 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import enum -import typing - -T_Result = typing.TypeVar("T_Result") - - -class ResourcesSearchableByPatient(str, enum.Enum): - ACCOUNT = "Account" - ALLERGY_INTOLERANCE = "AllergyIntolerance" - APPOINTMENT = "Appointment" - APPOINTMENT_RESPONSE = "AppointmentResponse" - AUDIT_EVENT = "AuditEvent" - BASIC = "Basic" - BODY_STRUCTURE = "BodyStructure" - CARE_PLAN = "CarePlan" - CARE_TEAM = "CareTeam" - CHARGE_ITEM = "ChargeItem" - CLAIM = "Claim" - CLAIM_RESPONSE = "ClaimResponse" - CLINICAL_IMPRESSION = "ClinicalImpression" - COMMUNICATION = "Communication" - COMMUNICATION_REQUEST = "CommunicationRequest" - COMPOSITION = "Composition" - CONDITION = "Condition" - CONSENT = "Consent" - CONTRACT = "Contract" - COVERAGE = "Coverage" - COVERAGE_ELIGIBILITY_REQUEST = "CoverageEligibilityRequest" - COVERAGE_ELIGIBILITY_RESPONSE = "CoverageEligibilityResponse" - DETECTED_ISSUE = "DetectedIssue" - DEVICE = "Device" - DEVICE_REQUEST = "DeviceRequest" - DEVICE_USE_STATEMENT = "DeviceUseStatement" - DIAGNOSTIC_REPORT = "DiagnosticReport" - DOCUMENT_MANIFEST = "DocumentManifest" - DOCUMENT_REFERENCE = "DocumentReference" - ENCOUNTER = "Encounter" - ENROLLMENT_REQUEST = "EnrollmentRequest" - EPISODE_OF_CARE = "EpisodeOfCare" - EXPLANATION_OF_BENEFIT = "ExplanationOfBenefit" - FAMILY_MEMBER_HISTORY = "FamilyMemberHistory" - FLAG = "Flag" - GOAL = "Goal" - GUIDANCE_RESPONSE = "GuidanceResponse" - IMAGING_STUDY = "ImagingStudy" - IMMUNIZATION = "Immunization" - IMMUNIZATION_EVALUATION = "ImmunizationEvaluation" - IMMUNIZATION_RECOMMENDATION = "ImmunizationRecommendation" - INVOICE = "Invoice" - LIST = "List" - MEASURE_REPORT = "MeasureReport" - MEDIA = "Media" - MEDICATION_ADMINISTRATION = "MedicationAdministration" - MEDICATION_DISPENSE = "MedicationDispense" - MEDICATION_REQUEST = "MedicationRequest" - MEDICATION_STATEMENT = "MedicationStatement" - MOLECULAR_SEQUENCE = "MolecularSequence" - NUTRITION_ORDER = "NutritionOrder" - OBSERVATION = "Observation" - PERSON = "Person" - PROCEDURE = "Procedure" - PROVENANCE = "Provenance" - QUESTIONNAIRE_RESPONSE = "QuestionnaireResponse" - RELATED_PERSON = "RelatedPerson" - REQUEST_GROUP = "RequestGroup" - RESEARCH_SUBJECT = "ResearchSubject" - RISK_ASSESSMENT = "RiskAssessment" - SERVICE_REQUEST = "ServiceRequest" - SPECIMEN = "Specimen" - - def visit( - self, - account: typing.Callable[[], T_Result], - allergy_intolerance: typing.Callable[[], T_Result], - appointment: typing.Callable[[], T_Result], - appointment_response: typing.Callable[[], T_Result], - audit_event: typing.Callable[[], T_Result], - basic: typing.Callable[[], T_Result], - body_structure: typing.Callable[[], T_Result], - care_plan: typing.Callable[[], T_Result], - care_team: typing.Callable[[], T_Result], - charge_item: typing.Callable[[], T_Result], - claim: typing.Callable[[], T_Result], - claim_response: typing.Callable[[], T_Result], - clinical_impression: typing.Callable[[], T_Result], - communication: typing.Callable[[], T_Result], - communication_request: typing.Callable[[], T_Result], - composition: typing.Callable[[], T_Result], - condition: typing.Callable[[], T_Result], - consent: typing.Callable[[], T_Result], - contract: typing.Callable[[], T_Result], - coverage: typing.Callable[[], T_Result], - coverage_eligibility_request: typing.Callable[[], T_Result], - coverage_eligibility_response: typing.Callable[[], T_Result], - detected_issue: typing.Callable[[], T_Result], - device: typing.Callable[[], T_Result], - device_request: typing.Callable[[], T_Result], - device_use_statement: typing.Callable[[], T_Result], - diagnostic_report: typing.Callable[[], T_Result], - document_manifest: typing.Callable[[], T_Result], - document_reference: typing.Callable[[], T_Result], - encounter: typing.Callable[[], T_Result], - enrollment_request: typing.Callable[[], T_Result], - episode_of_care: typing.Callable[[], T_Result], - explanation_of_benefit: typing.Callable[[], T_Result], - family_member_history: typing.Callable[[], T_Result], - flag: typing.Callable[[], T_Result], - goal: typing.Callable[[], T_Result], - guidance_response: typing.Callable[[], T_Result], - imaging_study: typing.Callable[[], T_Result], - immunization: typing.Callable[[], T_Result], - immunization_evaluation: typing.Callable[[], T_Result], - immunization_recommendation: typing.Callable[[], T_Result], - invoice: typing.Callable[[], T_Result], - list: typing.Callable[[], T_Result], - measure_report: typing.Callable[[], T_Result], - media: typing.Callable[[], T_Result], - medication_administration: typing.Callable[[], T_Result], - medication_dispense: typing.Callable[[], T_Result], - medication_request: typing.Callable[[], T_Result], - medication_statement: typing.Callable[[], T_Result], - molecular_sequence: typing.Callable[[], T_Result], - nutrition_order: typing.Callable[[], T_Result], - observation: typing.Callable[[], T_Result], - person: typing.Callable[[], T_Result], - procedure: typing.Callable[[], T_Result], - provenance: typing.Callable[[], T_Result], - questionnaire_response: typing.Callable[[], T_Result], - related_person: typing.Callable[[], T_Result], - request_group: typing.Callable[[], T_Result], - research_subject: typing.Callable[[], T_Result], - risk_assessment: typing.Callable[[], T_Result], - service_request: typing.Callable[[], T_Result], - specimen: typing.Callable[[], T_Result], - ) -> T_Result: - if self is ResourcesSearchableByPatient.ACCOUNT: - return account() - if self is ResourcesSearchableByPatient.ALLERGY_INTOLERANCE: - return allergy_intolerance() - if self is ResourcesSearchableByPatient.APPOINTMENT: - return appointment() - if self is ResourcesSearchableByPatient.APPOINTMENT_RESPONSE: - return appointment_response() - if self is ResourcesSearchableByPatient.AUDIT_EVENT: - return audit_event() - if self is ResourcesSearchableByPatient.BASIC: - return basic() - if self is ResourcesSearchableByPatient.BODY_STRUCTURE: - return body_structure() - if self is ResourcesSearchableByPatient.CARE_PLAN: - return care_plan() - if self is ResourcesSearchableByPatient.CARE_TEAM: - return care_team() - if self is ResourcesSearchableByPatient.CHARGE_ITEM: - return charge_item() - if self is ResourcesSearchableByPatient.CLAIM: - return claim() - if self is ResourcesSearchableByPatient.CLAIM_RESPONSE: - return claim_response() - if self is ResourcesSearchableByPatient.CLINICAL_IMPRESSION: - return clinical_impression() - if self is ResourcesSearchableByPatient.COMMUNICATION: - return communication() - if self is ResourcesSearchableByPatient.COMMUNICATION_REQUEST: - return communication_request() - if self is ResourcesSearchableByPatient.COMPOSITION: - return composition() - if self is ResourcesSearchableByPatient.CONDITION: - return condition() - if self is ResourcesSearchableByPatient.CONSENT: - return consent() - if self is ResourcesSearchableByPatient.CONTRACT: - return contract() - if self is ResourcesSearchableByPatient.COVERAGE: - return coverage() - if self is ResourcesSearchableByPatient.COVERAGE_ELIGIBILITY_REQUEST: - return coverage_eligibility_request() - if self is ResourcesSearchableByPatient.COVERAGE_ELIGIBILITY_RESPONSE: - return coverage_eligibility_response() - if self is ResourcesSearchableByPatient.DETECTED_ISSUE: - return detected_issue() - if self is ResourcesSearchableByPatient.DEVICE: - return device() - if self is ResourcesSearchableByPatient.DEVICE_REQUEST: - return device_request() - if self is ResourcesSearchableByPatient.DEVICE_USE_STATEMENT: - return device_use_statement() - if self is ResourcesSearchableByPatient.DIAGNOSTIC_REPORT: - return diagnostic_report() - if self is ResourcesSearchableByPatient.DOCUMENT_MANIFEST: - return document_manifest() - if self is ResourcesSearchableByPatient.DOCUMENT_REFERENCE: - return document_reference() - if self is ResourcesSearchableByPatient.ENCOUNTER: - return encounter() - if self is ResourcesSearchableByPatient.ENROLLMENT_REQUEST: - return enrollment_request() - if self is ResourcesSearchableByPatient.EPISODE_OF_CARE: - return episode_of_care() - if self is ResourcesSearchableByPatient.EXPLANATION_OF_BENEFIT: - return explanation_of_benefit() - if self is ResourcesSearchableByPatient.FAMILY_MEMBER_HISTORY: - return family_member_history() - if self is ResourcesSearchableByPatient.FLAG: - return flag() - if self is ResourcesSearchableByPatient.GOAL: - return goal() - if self is ResourcesSearchableByPatient.GUIDANCE_RESPONSE: - return guidance_response() - if self is ResourcesSearchableByPatient.IMAGING_STUDY: - return imaging_study() - if self is ResourcesSearchableByPatient.IMMUNIZATION: - return immunization() - if self is ResourcesSearchableByPatient.IMMUNIZATION_EVALUATION: - return immunization_evaluation() - if self is ResourcesSearchableByPatient.IMMUNIZATION_RECOMMENDATION: - return immunization_recommendation() - if self is ResourcesSearchableByPatient.INVOICE: - return invoice() - if self is ResourcesSearchableByPatient.LIST: - return list() - if self is ResourcesSearchableByPatient.MEASURE_REPORT: - return measure_report() - if self is ResourcesSearchableByPatient.MEDIA: - return media() - if self is ResourcesSearchableByPatient.MEDICATION_ADMINISTRATION: - return medication_administration() - if self is ResourcesSearchableByPatient.MEDICATION_DISPENSE: - return medication_dispense() - if self is ResourcesSearchableByPatient.MEDICATION_REQUEST: - return medication_request() - if self is ResourcesSearchableByPatient.MEDICATION_STATEMENT: - return medication_statement() - if self is ResourcesSearchableByPatient.MOLECULAR_SEQUENCE: - return molecular_sequence() - if self is ResourcesSearchableByPatient.NUTRITION_ORDER: - return nutrition_order() - if self is ResourcesSearchableByPatient.OBSERVATION: - return observation() - if self is ResourcesSearchableByPatient.PERSON: - return person() - if self is ResourcesSearchableByPatient.PROCEDURE: - return procedure() - if self is ResourcesSearchableByPatient.PROVENANCE: - return provenance() - if self is ResourcesSearchableByPatient.QUESTIONNAIRE_RESPONSE: - return questionnaire_response() - if self is ResourcesSearchableByPatient.RELATED_PERSON: - return related_person() - if self is ResourcesSearchableByPatient.REQUEST_GROUP: - return request_group() - if self is ResourcesSearchableByPatient.RESEARCH_SUBJECT: - return research_subject() - if self is ResourcesSearchableByPatient.RISK_ASSESSMENT: - return risk_assessment() - if self is ResourcesSearchableByPatient.SERVICE_REQUEST: - return service_request() - if self is ResourcesSearchableByPatient.SPECIMEN: - return specimen() diff --git a/src/metriport/resources/medical/resources/fhir/types/resources_searchable_by_subject.py b/src/metriport/resources/medical/resources/fhir/types/resources_searchable_by_subject.py deleted file mode 100644 index 4f791a0..0000000 --- a/src/metriport/resources/medical/resources/fhir/types/resources_searchable_by_subject.py +++ /dev/null @@ -1,17 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import enum -import typing - -T_Result = typing.TypeVar("T_Result") - - -class ResourcesSearchableBySubject(str, enum.Enum): - ADVERSE_EVENT = "AdverseEvent" - TASK = "Task" - - def visit(self, adverse_event: typing.Callable[[], T_Result], task: typing.Callable[[], T_Result]) -> T_Result: - if self is ResourcesSearchableBySubject.ADVERSE_EVENT: - return adverse_event() - if self is ResourcesSearchableBySubject.TASK: - return task() diff --git a/src/metriport/resources/medical/resources/fhir/types/start_consolidated_query_response.py b/src/metriport/resources/medical/resources/fhir/types/start_consolidated_query_response.py index 0a14a20..c6fc726 100644 --- a/src/metriport/resources/medical/resources/fhir/types/start_consolidated_query_response.py +++ b/src/metriport/resources/medical/resources/fhir/types/start_consolidated_query_response.py @@ -3,11 +3,14 @@ import datetime as dt import typing -import pydantic - from ......core.datetime_utils import serialize_datetime from .patient_consolidated_data_status import PatientConsolidatedDataStatus +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + class StartConsolidatedQueryResponse(pydantic.BaseModel): status: PatientConsolidatedDataStatus diff --git a/src/metriport/resources/medical/resources/organization/__init__.py b/src/metriport/resources/medical/resources/organization/__init__.py index d338135..122545f 100644 --- a/src/metriport/resources/medical/resources/organization/__init__.py +++ b/src/metriport/resources/medical/resources/organization/__init__.py @@ -1,5 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -from .types import BaseOrganization, OrgType, Organization +from .types import OrgType, Organization, OrganizationCreate -__all__ = ["BaseOrganization", "OrgType", "Organization"] +__all__ = ["OrgType", "Organization", "OrganizationCreate"] diff --git a/src/metriport/resources/medical/resources/organization/client.py b/src/metriport/resources/medical/resources/organization/client.py index e66d067..7a4556f 100644 --- a/src/metriport/resources/medical/resources/organization/client.py +++ b/src/metriport/resources/medical/resources/organization/client.py @@ -4,13 +4,19 @@ import urllib.parse from json.decoder import JSONDecodeError -import pydantic - from .....core.api_error import ApiError from .....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper from .....core.jsonable_encoder import jsonable_encoder -from .types.base_organization import BaseOrganization +from .....core.remove_none_from_dict import remove_none_from_dict +from ....commons.types.address import Address +from .types.org_type import OrgType from .types.organization import Organization +from .types.organization_create import OrganizationCreate + +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, ...) @@ -20,16 +26,38 @@ class OrganizationClient: def __init__(self, *, client_wrapper: SyncClientWrapper): self._client_wrapper = client_wrapper - def create(self, *, request: BaseOrganization) -> Organization: + def create(self, *, request: OrganizationCreate) -> Organization: """ Registers your Organization in Metriport. Parameters: - - request: BaseOrganization. + - request: OrganizationCreate. + --- + from metriport import Address, UsState + from metriport.client import Metriport + from metriport.resources.medical import OrganizationCreate, OrgType + + client = Metriport( + api_key="YOUR_API_KEY", + ) + client.medical.organization.create( + request=OrganizationCreate( + name="Metriport Inc.", + type=OrgType.AMBULATORY, + location=Address( + address_line_1="2261 Market Street", + address_line_2="#4818", + city="San Francisco", + state=UsState.CA, + zip="94114", + country="USA", + ), + ), + ) """ _response = self._client_wrapper.httpx_client.request( "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "organization"), + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "medical/v1/organization"), json=jsonable_encoder(request), headers=self._client_wrapper.get_headers(), timeout=60, @@ -45,10 +73,18 @@ def create(self, *, request: BaseOrganization) -> Organization: def get(self) -> Organization: """ Gets the Organization representing your legal corporate entity. + + --- + from metriport.client import Metriport + + client = Metriport( + api_key="YOUR_API_KEY", + ) + client.medical.organization.get() """ _response = self._client_wrapper.httpx_client.request( "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "organization"), + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "medical/v1/organization"), headers=self._client_wrapper.get_headers(), timeout=60, ) @@ -60,20 +96,51 @@ def get(self) -> Organization: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - def update(self, id: str, *, request: BaseOrganization) -> Organization: + def update( + self, id: str, *, name: str, type: OrgType, location: Address, e_tag: typing.Optional[str] = None + ) -> Organization: """ Updates your Organization's details. Parameters: - id: str. The ID of your organization. - - request: BaseOrganization. + - name: str. The name of your organization. + This is usually your legal corporate entity name - + for example `Metriport Inc.`. + + - type: OrgType. The type of your organization. + + - location: Address. + + - e_tag: typing.Optional[str]. + --- + from metriport import Address, UsState + from metriport.client import Metriport + from metriport.resources.medical import OrgType + + client = Metriport( + api_key="YOUR_API_KEY", + ) + client.medical.organization.update( + id="12345678", + name="Metriport Inc.", + type=OrgType.AMBULATORY, + location=Address( + address_line_1="2261 Market Street", + address_line_2="#4818", + city="San Francisco", + state=UsState.CA, + zip="94114", + country="USA", + ), + ) """ _response = self._client_wrapper.httpx_client.request( "PUT", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"organization/{id}"), - json=jsonable_encoder(request), - headers=self._client_wrapper.get_headers(), + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"medical/v1/organization/{id}"), + json=jsonable_encoder({"name": name, "type": type, "location": location}), + headers=remove_none_from_dict({**self._client_wrapper.get_headers(), "ETag": e_tag}), timeout=60, ) if 200 <= _response.status_code < 300: @@ -89,16 +156,38 @@ class AsyncOrganizationClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): self._client_wrapper = client_wrapper - async def create(self, *, request: BaseOrganization) -> Organization: + async def create(self, *, request: OrganizationCreate) -> Organization: """ Registers your Organization in Metriport. Parameters: - - request: BaseOrganization. + - request: OrganizationCreate. + --- + from metriport import Address, UsState + from metriport.client import AsyncMetriport + from metriport.resources.medical import OrganizationCreate, OrgType + + client = AsyncMetriport( + api_key="YOUR_API_KEY", + ) + await client.medical.organization.create( + request=OrganizationCreate( + name="Metriport Inc.", + type=OrgType.AMBULATORY, + location=Address( + address_line_1="2261 Market Street", + address_line_2="#4818", + city="San Francisco", + state=UsState.CA, + zip="94114", + country="USA", + ), + ), + ) """ _response = await self._client_wrapper.httpx_client.request( "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "organization"), + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "medical/v1/organization"), json=jsonable_encoder(request), headers=self._client_wrapper.get_headers(), timeout=60, @@ -114,10 +203,18 @@ async def create(self, *, request: BaseOrganization) -> Organization: async def get(self) -> Organization: """ Gets the Organization representing your legal corporate entity. + + --- + from metriport.client import AsyncMetriport + + client = AsyncMetriport( + api_key="YOUR_API_KEY", + ) + await client.medical.organization.get() """ _response = await self._client_wrapper.httpx_client.request( "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "organization"), + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "medical/v1/organization"), headers=self._client_wrapper.get_headers(), timeout=60, ) @@ -129,20 +226,51 @@ async def get(self) -> Organization: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - async def update(self, id: str, *, request: BaseOrganization) -> Organization: + async def update( + self, id: str, *, name: str, type: OrgType, location: Address, e_tag: typing.Optional[str] = None + ) -> Organization: """ Updates your Organization's details. Parameters: - id: str. The ID of your organization. - - request: BaseOrganization. + - name: str. The name of your organization. + This is usually your legal corporate entity name - + for example `Metriport Inc.`. + + - type: OrgType. The type of your organization. + + - location: Address. + + - e_tag: typing.Optional[str]. + --- + from metriport import Address, UsState + from metriport.client import AsyncMetriport + from metriport.resources.medical import OrgType + + client = AsyncMetriport( + api_key="YOUR_API_KEY", + ) + await client.medical.organization.update( + id="12345678", + name="Metriport Inc.", + type=OrgType.AMBULATORY, + location=Address( + address_line_1="2261 Market Street", + address_line_2="#4818", + city="San Francisco", + state=UsState.CA, + zip="94114", + country="USA", + ), + ) """ _response = await self._client_wrapper.httpx_client.request( "PUT", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"organization/{id}"), - json=jsonable_encoder(request), - headers=self._client_wrapper.get_headers(), + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"medical/v1/organization/{id}"), + json=jsonable_encoder({"name": name, "type": type, "location": location}), + headers=remove_none_from_dict({**self._client_wrapper.get_headers(), "ETag": e_tag}), timeout=60, ) if 200 <= _response.status_code < 300: diff --git a/src/metriport/resources/medical/resources/organization/types/__init__.py b/src/metriport/resources/medical/resources/organization/types/__init__.py index d342826..fbee9a1 100644 --- a/src/metriport/resources/medical/resources/organization/types/__init__.py +++ b/src/metriport/resources/medical/resources/organization/types/__init__.py @@ -1,7 +1,7 @@ # This file was auto-generated by Fern from our API Definition. -from .base_organization import BaseOrganization from .org_type import OrgType from .organization import Organization +from .organization_create import OrganizationCreate -__all__ = ["BaseOrganization", "OrgType", "Organization"] +__all__ = ["OrgType", "Organization", "OrganizationCreate"] diff --git a/src/metriport/resources/medical/resources/organization/types/organization.py b/src/metriport/resources/medical/resources/organization/types/organization.py index 486c09f..aa72525 100644 --- a/src/metriport/resources/medical/resources/organization/types/organization.py +++ b/src/metriport/resources/medical/resources/organization/types/organization.py @@ -3,20 +3,41 @@ import datetime as dt import typing -import pydantic - from ......core.datetime_utils import serialize_datetime -from .base_organization import BaseOrganization - +from .organization_create import OrganizationCreate + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + + +class Organization(OrganizationCreate): + """ + from metriport import Address, UsState + from metriport.resources.medical import Organization, OrgType + + Organization( + id="2.16.840.1.113883.3.666.123", + name="Metriport Inc.", + type=OrgType.AMBULATORY, + location=Address( + address_line_1="2261 Market Street", + address_line_2="#4818", + city="San Francisco", + state=UsState.CA, + zip="94114", + country="USA", + ), + ) + """ -class Organization(BaseOrganization): id: str = pydantic.Field( description=( "The ID assigned to your organization. \n" "This ID will be used to uniquely identify your organization in medical documents.\n" ) ) - e_tag: typing.Optional[str] = pydantic.Field(alias="eTag") 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/organization/types/base_organization.py b/src/metriport/resources/medical/resources/organization/types/organization_create.py similarity index 87% rename from src/metriport/resources/medical/resources/organization/types/base_organization.py rename to src/metriport/resources/medical/resources/organization/types/organization_create.py index ea7a417..da45ed7 100644 --- a/src/metriport/resources/medical/resources/organization/types/base_organization.py +++ b/src/metriport/resources/medical/resources/organization/types/organization_create.py @@ -3,14 +3,17 @@ import datetime as dt import typing -import pydantic - from ......core.datetime_utils import serialize_datetime from .....commons.types.address import Address from .org_type import OrgType +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + -class BaseOrganization(pydantic.BaseModel): +class OrganizationCreate(pydantic.BaseModel): name: str = pydantic.Field( description=( "The name of your organization. \n" diff --git a/src/metriport/resources/medical/resources/patient/__init__.py b/src/metriport/resources/medical/resources/patient/__init__.py index 2fbaa6b..aa91c2e 100644 --- a/src/metriport/resources/medical/resources/patient/__init__.py +++ b/src/metriport/resources/medical/resources/patient/__init__.py @@ -7,6 +7,7 @@ Contacts, DriversLicense, FacilityId, + ListPatientsResponse, Patient, Period, PersonalIdentifier, @@ -20,6 +21,7 @@ "Contacts", "DriversLicense", "FacilityId", + "ListPatientsResponse", "Patient", "Period", "PersonalIdentifier", diff --git a/src/metriport/resources/medical/resources/patient/client.py b/src/metriport/resources/medical/resources/patient/client.py index 2bb38a8..f12f071 100644 --- a/src/metriport/resources/medical/resources/patient/client.py +++ b/src/metriport/resources/medical/resources/patient/client.py @@ -4,15 +4,19 @@ import urllib.parse from json.decoder import JSONDecodeError -import pydantic - 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 .types.base_patient import BasePatient +from .types.list_patients_response import ListPatientsResponse from .types.patient import Patient +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, ...) @@ -24,7 +28,6 @@ def __init__(self, *, client_wrapper: SyncClientWrapper): def create(self, *, facility_id: str, request: BasePatient) -> Patient: """ Creates a Patient in Metriport for the specified Facility where the patient is receiving care. - The more demographic info you can provide about a Patient, the higher chances Metriport will be able to find a match. For example, nicknames, old addresses, multiple phone numbers, @@ -34,10 +37,37 @@ def create(self, *, facility_id: str, request: BasePatient) -> Patient: - facility_id: str. The ID of the Facility where the Patient is receiving care. - request: BasePatient. + --- + from metriport import UsState + from metriport.client import Metriport + from metriport.resources.medical import ( + BasePatient, + PersonalIdentifier_DriversLicense, + ) + + client = Metriport( + api_key="YOUR_API_KEY", + ) + client.medical.patient.create( + facility_id="2.16.840.1.113883.3.666.5.2004.4.2005", + request=BasePatient( + first_name="Karen", + last_name="Lynch", + dob="1963-12-30", + gender_at_birth="F", + personal_identifiers=[ + PersonalIdentifier_DriversLicense( + type="driversLicense", + state=UsState.CA, + value="51227265", + ) + ], + ), + ) """ _response = self._client_wrapper.httpx_client.request( "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "patient"), + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "medical/v1/patient"), params=remove_none_from_dict({"facilityId": facility_id}), json=jsonable_encoder(request), headers=self._client_wrapper.get_headers(), @@ -57,10 +87,19 @@ def get(self, id: str) -> Patient: Parameters: - id: str. The ID of the Patient. + --- + from metriport.client import Metriport + + client = Metriport( + api_key="YOUR_API_KEY", + ) + client.medical.patient.get( + id="2.16.840.1.113883.3.666.777", + ) """ _response = self._client_wrapper.httpx_client.request( "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"patient/{id}"), + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"medical/v1/patient/{id}"), headers=self._client_wrapper.get_headers(), timeout=60, ) @@ -85,7 +124,7 @@ def update(self, id: str, *, facility_id: str, request: BasePatient) -> Patient: """ _response = self._client_wrapper.httpx_client.request( "PUT", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"patient/{id}"), + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"medical/v1/patient/{id}"), params=remove_none_from_dict({"facilityId": facility_id}), json=jsonable_encoder(request), headers=self._client_wrapper.get_headers(), @@ -99,22 +138,22 @@ def update(self, id: str, *, facility_id: str, request: BasePatient) -> Patient: raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - def list(self, *, facility_id: str) -> typing.List[Patient]: + def list(self, *, facility_id: typing.Optional[str] = None) -> ListPatientsResponse: """ Lists all Patients receiving care at the specified Facility. Parameters: - - facility_id: str. The ID of the Facility where the patient is receiving care. + - facility_id: typing.Optional[str]. The ID of the Facility where the patient is receiving care. """ _response = self._client_wrapper.httpx_client.request( "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "patient"), + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "medical/v1/patient"), params=remove_none_from_dict({"facilityId": facility_id}), headers=self._client_wrapper.get_headers(), timeout=60, ) if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.List[Patient], _response.json()) # type: ignore + return pydantic.parse_obj_as(ListPatientsResponse, _response.json()) # type: ignore try: _response_json = _response.json() except JSONDecodeError: @@ -132,7 +171,7 @@ def delete(self, id: str, *, facility_id: typing.Optional[str] = None) -> None: """ _response = self._client_wrapper.httpx_client.request( "DELETE", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"patient/{id}"), + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"medical/v1/patient/{id}"), params=remove_none_from_dict({"facilityId": facility_id}), headers=self._client_wrapper.get_headers(), timeout=60, @@ -153,7 +192,6 @@ def __init__(self, *, client_wrapper: AsyncClientWrapper): async def create(self, *, facility_id: str, request: BasePatient) -> Patient: """ Creates a Patient in Metriport for the specified Facility where the patient is receiving care. - The more demographic info you can provide about a Patient, the higher chances Metriport will be able to find a match. For example, nicknames, old addresses, multiple phone numbers, @@ -163,10 +201,37 @@ async def create(self, *, facility_id: str, request: BasePatient) -> Patient: - facility_id: str. The ID of the Facility where the Patient is receiving care. - request: BasePatient. + --- + from metriport import UsState + from metriport.client import AsyncMetriport + from metriport.resources.medical import ( + BasePatient, + PersonalIdentifier_DriversLicense, + ) + + client = AsyncMetriport( + api_key="YOUR_API_KEY", + ) + await client.medical.patient.create( + facility_id="2.16.840.1.113883.3.666.5.2004.4.2005", + request=BasePatient( + first_name="Karen", + last_name="Lynch", + dob="1963-12-30", + gender_at_birth="F", + personal_identifiers=[ + PersonalIdentifier_DriversLicense( + type="driversLicense", + state=UsState.CA, + value="51227265", + ) + ], + ), + ) """ _response = await self._client_wrapper.httpx_client.request( "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "patient"), + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "medical/v1/patient"), params=remove_none_from_dict({"facilityId": facility_id}), json=jsonable_encoder(request), headers=self._client_wrapper.get_headers(), @@ -186,10 +251,19 @@ async def get(self, id: str) -> Patient: Parameters: - id: str. The ID of the Patient. + --- + from metriport.client import AsyncMetriport + + client = AsyncMetriport( + api_key="YOUR_API_KEY", + ) + await client.medical.patient.get( + id="2.16.840.1.113883.3.666.777", + ) """ _response = await self._client_wrapper.httpx_client.request( "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"patient/{id}"), + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"medical/v1/patient/{id}"), headers=self._client_wrapper.get_headers(), timeout=60, ) @@ -214,7 +288,7 @@ async def update(self, id: str, *, facility_id: str, request: BasePatient) -> Pa """ _response = await self._client_wrapper.httpx_client.request( "PUT", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"patient/{id}"), + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"medical/v1/patient/{id}"), params=remove_none_from_dict({"facilityId": facility_id}), json=jsonable_encoder(request), headers=self._client_wrapper.get_headers(), @@ -228,22 +302,22 @@ async def update(self, id: str, *, facility_id: str, request: BasePatient) -> Pa raise ApiError(status_code=_response.status_code, body=_response.text) raise ApiError(status_code=_response.status_code, body=_response_json) - async def list(self, *, facility_id: str) -> typing.List[Patient]: + async def list(self, *, facility_id: typing.Optional[str] = None) -> ListPatientsResponse: """ Lists all Patients receiving care at the specified Facility. Parameters: - - facility_id: str. The ID of the Facility where the patient is receiving care. + - facility_id: typing.Optional[str]. The ID of the Facility where the patient is receiving care. """ _response = await self._client_wrapper.httpx_client.request( "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "patient"), + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "medical/v1/patient"), params=remove_none_from_dict({"facilityId": facility_id}), headers=self._client_wrapper.get_headers(), timeout=60, ) if 200 <= _response.status_code < 300: - return pydantic.parse_obj_as(typing.List[Patient], _response.json()) # type: ignore + return pydantic.parse_obj_as(ListPatientsResponse, _response.json()) # type: ignore try: _response_json = _response.json() except JSONDecodeError: @@ -261,7 +335,7 @@ async def delete(self, id: str, *, facility_id: typing.Optional[str] = None) -> """ _response = await self._client_wrapper.httpx_client.request( "DELETE", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"patient/{id}"), + urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"medical/v1/patient/{id}"), params=remove_none_from_dict({"facilityId": facility_id}), headers=self._client_wrapper.get_headers(), timeout=60, diff --git a/src/metriport/resources/medical/resources/patient/types/__init__.py b/src/metriport/resources/medical/resources/patient/types/__init__.py index bd2c67a..3159dce 100644 --- a/src/metriport/resources/medical/resources/patient/types/__init__.py +++ b/src/metriport/resources/medical/resources/patient/types/__init__.py @@ -6,6 +6,7 @@ from .contacts import Contacts from .drivers_license import DriversLicense from .facility_id import FacilityId +from .list_patients_response import ListPatientsResponse from .patient import Patient from .period import Period from .personal_identifier import PersonalIdentifier, PersonalIdentifier_DriversLicense @@ -17,6 +18,7 @@ "Contacts", "DriversLicense", "FacilityId", + "ListPatientsResponse", "Patient", "Period", "PersonalIdentifier", 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 3e6f86e..0a4b9bb 100644 --- a/src/metriport/resources/medical/resources/patient/types/base_patient.py +++ b/src/metriport/resources/medical/resources/patient/types/base_patient.py @@ -3,13 +3,16 @@ import datetime as dt import typing -import pydantic - from ......core.datetime_utils import serialize_datetime from .addresses import Addresses from .contacts import Contacts from .personal_identifier import PersonalIdentifier +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + class BasePatient(pydantic.BaseModel): first_name: str = pydantic.Field( diff --git a/src/metriport/resources/medical/resources/patient/types/contact.py b/src/metriport/resources/medical/resources/patient/types/contact.py index 51a9938..60d0d7c 100644 --- a/src/metriport/resources/medical/resources/patient/types/contact.py +++ b/src/metriport/resources/medical/resources/patient/types/contact.py @@ -3,13 +3,29 @@ import datetime as dt import typing -import pydantic - from ......core.datetime_utils import serialize_datetime from .facility_id import FacilityId +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + class Contact(pydantic.BaseModel): + """ + from metriport.resources.medical import Contact + + 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", + ], + ) + """ + phone: typing.Optional[str] = pydantic.Field( description="The Patient's 10 digit phone number, formatted `1234567899`." ) 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 4a484e7..c1087ab 100644 --- a/src/metriport/resources/medical/resources/patient/types/drivers_license.py +++ b/src/metriport/resources/medical/resources/patient/types/drivers_license.py @@ -3,12 +3,15 @@ import datetime as dt import typing -import pydantic - from ......core.datetime_utils import serialize_datetime from .....commons.types.us_state import UsState from .period import Period +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + class DriversLicense(pydantic.BaseModel): state: UsState = pydantic.Field( diff --git a/src/metriport/resources/medical/resources/patient/types/facility_id.py b/src/metriport/resources/medical/resources/patient/types/facility_id.py index f75ceb5..f301144 100644 --- a/src/metriport/resources/medical/resources/patient/types/facility_id.py +++ b/src/metriport/resources/medical/resources/patient/types/facility_id.py @@ -1,3 +1,6 @@ # This file was auto-generated by Fern from our API Definition. +""" +"2.16.840.1.113883.3.666.5.2004.4.2005" +""" FacilityId = str diff --git a/src/metriport/resources/devices/resources/users/types/delete_user_response.py b/src/metriport/resources/medical/resources/patient/types/list_patients_response.py similarity index 75% rename from src/metriport/resources/devices/resources/users/types/delete_user_response.py rename to src/metriport/resources/medical/resources/patient/types/list_patients_response.py index b4e967d..8abfe44 100644 --- a/src/metriport/resources/devices/resources/users/types/delete_user_response.py +++ b/src/metriport/resources/medical/resources/patient/types/list_patients_response.py @@ -3,13 +3,17 @@ import datetime as dt import typing -import pydantic - from ......core.datetime_utils import serialize_datetime +from .patient import Patient + +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore -class DeleteUserResponse(pydantic.BaseModel): - message: str = pydantic.Field(description="Feedback on successful user deletion.") +class ListPatientsResponse(pydantic.BaseModel): + patients: typing.List[Patient] 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 cbe8013..a4bb856 100644 --- a/src/metriport/resources/medical/resources/patient/types/patient.py +++ b/src/metriport/resources/medical/resources/patient/types/patient.py @@ -3,15 +3,44 @@ import datetime as dt import typing -import pydantic - from ......core.datetime_utils import serialize_datetime from .base_patient import BasePatient +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + class Patient(BasePatient): + """ + from metriport import UsState + from metriport.resources.medical import ( + Patient, + PersonalIdentifier_DriversLicense, + ) + + Patient( + id="2.16.840.1.113883.3.666.777", + first_name="Karen", + last_name="Lynch", + dob="1963-12-30", + gender_at_birth="F", + personal_identifiers=[ + PersonalIdentifier_DriversLicense( + type="driversLicense", + state=UsState.CA, + value="51227265", + ) + ], + ) + """ + id: str = pydantic.Field( - description="The ID assigned to this Patient. This ID will be used to uniquely identify this Patient in medical documents." + description=( + "The ID assigned to this Patient. This ID will be used to uniquely \n" + "identify this Patient in medical documents.\n" + ) ) def json(self, **kwargs: typing.Any) -> str: diff --git a/src/metriport/resources/medical/resources/patient/types/period.py b/src/metriport/resources/medical/resources/patient/types/period.py index 3eacc4b..fa5f6c8 100644 --- a/src/metriport/resources/medical/resources/patient/types/period.py +++ b/src/metriport/resources/medical/resources/patient/types/period.py @@ -3,10 +3,13 @@ import datetime as dt import typing -import pydantic - from ......core.datetime_utils import serialize_datetime +try: + import pydantic.v1 as pydantic # type: ignore +except ImportError: + import pydantic # type: ignore + class Period(pydantic.BaseModel): start: typing.Optional[str] diff --git a/src/metriport/resources/medical/resources/patient/types/personal_identifier.py b/src/metriport/resources/medical/resources/patient/types/personal_identifier.py index 61059d0..c86e041 100644 --- a/src/metriport/resources/medical/resources/patient/types/personal_identifier.py +++ b/src/metriport/resources/medical/resources/patient/types/personal_identifier.py @@ -18,4 +18,14 @@ class Config: allow_population_by_field_name = True +""" +from metriport import UsState +from metriport.resources.medical import PersonalIdentifier_DriversLicense + +PersonalIdentifier_DriversLicense( + type="driversLicense", + state=UsState.CA, + value="51227265", +) +""" PersonalIdentifier = typing.Union[PersonalIdentifier_DriversLicense] From a8f0bca7c91bd753917f229964e1fe30331285f4 Mon Sep 17 00:00:00 2001 From: Rafael Leite <2132564+leite08@users.noreply.github.com> Date: Wed, 22 Nov 2023 15:09:47 -0600 Subject: [PATCH 2/5] Create CODEOWNERS --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..40ef6d3 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @metriport/devs From ebe1ee2fa29e45bf39dbc38735c32776dc6c19a3 Mon Sep 17 00:00:00 2001 From: Danny Sheridan <83524670+dannysheridan@users.noreply.github.com> Date: Sun, 26 Nov 2023 23:23:13 -0600 Subject: [PATCH 3/5] Update Fern badge URL in README.md --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 7f016ce..ff821e0 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 From 7680c8201f3f99b33c09aa8aaf6cdab6b8044cdf Mon Sep 17 00:00:00 2001 From: Rafael Leite <2132564+leite08@users.noreply.github.com> Date: Thu, 30 Nov 2023 12:34:05 -0600 Subject: [PATCH 4/5] Update CODEOWNERS --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 40ef6d3..914ca2e 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @metriport/devs +* @Goncharo @leite08 @Orta21 From 90c0d7f10c095addaf8ff7e57fa8bd3b33985163 Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Tue, 13 Feb 2024 19:01:00 +0000 Subject: [PATCH 5/5] Release 8.0.0 --- .github/CODEOWNERS | 1 - poetry.lock | 26 +- pyproject.toml | 2 +- src/metriport/__init__.py | 4 +- src/metriport/core/client_wrapper.py | 2 +- src/metriport/resources/__init__.py | 4 +- .../resources/commons/types/address.py | 2 +- src/metriport/resources/fhir/__init__.py | 183 +++++++++++ .../resources/fhir/types/__init__.py | 181 +++++++++++ src/metriport/resources/fhir/types/address.py | 72 +++++ .../resources/fhir/types/address_type.py | 29 ++ .../resources/fhir/types/address_use.py | 37 +++ src/metriport/resources/fhir/types/age.py | 61 ++++ .../resources/fhir/types/age_comparator.py | 33 ++ .../resources/fhir/types/annotation.py | 56 ++++ .../resources/fhir/types/attachment.py | 69 ++++ .../resources/fhir/types/base_64_binary.py | 3 + .../resources/fhir/types/base_resource.py | 58 ++++ src/metriport/resources/fhir/types/bundle.py | 78 +++++ .../resources/fhir/types/bundle_entry.py | 67 ++++ .../resources/fhir/types/bundle_link.py | 48 +++ .../resources/fhir/types/bundle_request.py | 68 ++++ .../fhir/types/bundle_request_method.py | 41 +++ .../resources/fhir/types/bundle_response.py | 60 ++++ .../resources/fhir/types/bundle_search.py | 51 +++ .../fhir/types/bundle_search_mode.py | 29 ++ .../resources/fhir/types/bundle_type.py | 53 +++ .../resources/fhir/types/canonical.py | 3 + src/metriport/resources/fhir/types/code.py | 3 + .../resources/fhir/types/codeable_concept.py | 51 +++ src/metriport/resources/fhir/types/coding.py | 63 ++++ .../resources/fhir/types/contact_detail.py | 49 +++ .../resources/fhir/types/contact_point.py | 59 ++++ .../fhir/types/contact_point_system.py | 45 +++ .../resources/fhir/types/contact_point_use.py | 37 +++ .../resources/fhir/types/contributor.py | 53 +++ .../resources/fhir/types/contributor_type.py | 33 ++ src/metriport/resources/fhir/types/count.py | 61 ++++ .../resources/fhir/types/count_comparator.py | 33 ++ .../resources/fhir/types/data_requirement.py | 85 +++++ .../types/data_requirement_code_filter.py | 65 ++++ .../types/data_requirement_date_filter.py | 70 ++++ .../fhir/types/data_requirement_sort.py | 56 ++++ .../types/data_requirement_sort_direction.py | 21 ++ .../resources/fhir/types/date_time.py | 3 + src/metriport/resources/fhir/types/decimal.py | 3 + .../resources/fhir/types/distance.py | 61 ++++ .../fhir/types/distance_comparator.py | 33 ++ .../fhir/types/document_reference.py | 92 ++++++ .../fhir/types/document_reference_content.py | 51 +++ .../fhir/types/document_reference_context.py | 69 ++++ .../types/document_reference_relates_to.py | 49 +++ .../document_reference_relates_to_code.py | 33 ++ .../fhir/types/document_reference_status.py | 29 ++ src/metriport/resources/fhir/types/dosage.py | 89 +++++ .../fhir/types/dosage_dose_and_rate.py | 69 ++++ .../resources/fhir/types/duration.py | 61 ++++ .../fhir/types/duration_comparator.py | 33 ++ .../resources/fhir/types/expression.py | 60 ++++ .../fhir/types/expression_language.py | 29 ++ .../resources/fhir/types/extension.py | 279 ++++++++++++++++ .../resources/fhir/types/human_name.py | 63 ++++ .../resources/fhir/types/human_name_use.py | 45 +++ src/metriport/resources/fhir/types/id.py | 3 + .../resources/fhir/types/identifier.py | 65 ++++ .../resources/fhir/types/identifier_use.py | 37 +++ src/metriport/resources/fhir/types/instant.py | 3 + .../resources/fhir/types/markdown.py | 3 + src/metriport/resources/fhir/types/meta.py | 80 +++++ src/metriport/resources/fhir/types/money.py | 48 +++ .../resources/fhir/types/narrative.py | 44 +++ .../resources/fhir/types/narrative_status.py | 33 ++ .../fhir/types/parameter_definition.py | 63 ++++ src/metriport/resources/fhir/types/period.py | 49 +++ .../resources/fhir/types/positive_int.py | 3 + .../resources/fhir/types/quantity.py | 61 ++++ .../fhir/types/quantity_comparator.py | 33 ++ src/metriport/resources/fhir/types/range.py | 47 +++ src/metriport/resources/fhir/types/ratio.py | 47 +++ .../resources/fhir/types/reference.py | 59 ++++ .../resources/fhir/types/related_artifact.py | 70 ++++ .../fhir/types/related_artifact_type.py | 49 +++ .../resources/fhir/types/sampled_data.py | 71 ++++ .../resources/fhir/types/signature.py | 72 +++++ src/metriport/resources/fhir/types/time.py | 3 + src/metriport/resources/fhir/types/timing.py | 61 ++++ .../resources/fhir/types/timing_repeat.py | 119 +++++++ .../fhir/types/timing_repeat_duration_unit.py | 45 +++ .../fhir/types/timing_repeat_period_unit.py | 45 +++ .../fhir/types/timing_repeat_when_item.py | 117 +++++++ .../fhir/types/trigger_definition.py | 72 +++++ .../fhir/types/trigger_definition_type.py | 49 +++ .../resources/fhir/types/unsigned_int.py | 3 + src/metriport/resources/fhir/types/uri.py | 3 + src/metriport/resources/fhir/types/url.py | 3 + .../resources/fhir/types/usage_context.py | 69 ++++ .../types/contacts.py => fhir/types/xhtml.py} | 4 +- src/metriport/resources/medical/__init__.py | 46 ++- .../resources/medical/resources/__init__.py | 49 ++- .../medical/resources/document/__init__.py | 14 +- .../medical/resources/document/client.py | 303 +++++++++++++++--- .../resources/document/types/__init__.py | 14 +- ...cept.py => bulk_get_document_url_query.py} | 30 +- .../document/types/document_query.py | 2 + .../document/types/document_reference.py | 78 ----- ...{coding.py => list_document_references.py} | 17 +- .../document/types/list_documents_response.py | 66 ---- .../types/upload_document_response.py | 41 +++ .../medical/resources/facility/client.py | 6 +- .../resources/facility/types/facility.py | 2 +- .../medical/resources/fhir/__init__.py | 2 + .../medical/resources/fhir/client.py | 164 ++++++++-- .../medical/resources/fhir/types/__init__.py | 2 + .../fhir/types/consolidated_bundle_upload.py | 62 ++++ .../fhir/types/consolidated_count_response.py | 2 +- .../medical/resources/fhir/types/filter.py | 10 +- .../get_consolidated_query_status_response.py | 2 +- .../organization/types/organization.py | 2 +- .../organization/types/organization_create.py | 4 +- .../medical/resources/patient/__init__.py | 10 +- .../medical/resources/patient/client.py | 127 +++++++- .../resources/patient/types/__init__.py | 10 +- .../resources/patient/types/addresses.py | 7 - .../resources/patient/types/base_patient.py | 19 +- .../resources/patient/types/contact.py | 9 - .../patient/types/drivers_license.py | 2 +- .../{period.py => medical_record_status.py} | 7 +- .../resources/patient/types/patient.py | 19 +- .../resources/patient/types/record_status.py | 30 ++ .../medical/resources/webhooks/__init__.py | 25 ++ .../resources/webhooks/types/__init__.py | 23 ++ .../types/consolidated_webhook_status.py | 17 + .../resources/webhooks/types/filters.py | 5 + .../webhooks/types/mapi_webhook_status.py | 25 ++ .../webhooks/types/payload_patient.py | 40 +++ .../types/webhook_document_data_payload.py | 38 +++ .../types/webhook_metadata_payload.py | 32 ++ ...bhook_patient_consolidated_data_payload.py | 31 ++ .../webhook_patient_document_data_payload.py | 33 ++ .../webhooks/types/webhook_patient_payload.py | 39 +++ 140 files changed, 5892 insertions(+), 363 deletions(-) delete mode 100644 .github/CODEOWNERS create mode 100644 src/metriport/resources/fhir/__init__.py create mode 100644 src/metriport/resources/fhir/types/__init__.py create mode 100644 src/metriport/resources/fhir/types/address.py create mode 100644 src/metriport/resources/fhir/types/address_type.py create mode 100644 src/metriport/resources/fhir/types/address_use.py create mode 100644 src/metriport/resources/fhir/types/age.py create mode 100644 src/metriport/resources/fhir/types/age_comparator.py create mode 100644 src/metriport/resources/fhir/types/annotation.py create mode 100644 src/metriport/resources/fhir/types/attachment.py create mode 100644 src/metriport/resources/fhir/types/base_64_binary.py create mode 100644 src/metriport/resources/fhir/types/base_resource.py create mode 100644 src/metriport/resources/fhir/types/bundle.py create mode 100644 src/metriport/resources/fhir/types/bundle_entry.py create mode 100644 src/metriport/resources/fhir/types/bundle_link.py create mode 100644 src/metriport/resources/fhir/types/bundle_request.py create mode 100644 src/metriport/resources/fhir/types/bundle_request_method.py create mode 100644 src/metriport/resources/fhir/types/bundle_response.py create mode 100644 src/metriport/resources/fhir/types/bundle_search.py create mode 100644 src/metriport/resources/fhir/types/bundle_search_mode.py create mode 100644 src/metriport/resources/fhir/types/bundle_type.py create mode 100644 src/metriport/resources/fhir/types/canonical.py create mode 100644 src/metriport/resources/fhir/types/code.py create mode 100644 src/metriport/resources/fhir/types/codeable_concept.py create mode 100644 src/metriport/resources/fhir/types/coding.py create mode 100644 src/metriport/resources/fhir/types/contact_detail.py create mode 100644 src/metriport/resources/fhir/types/contact_point.py create mode 100644 src/metriport/resources/fhir/types/contact_point_system.py create mode 100644 src/metriport/resources/fhir/types/contact_point_use.py create mode 100644 src/metriport/resources/fhir/types/contributor.py create mode 100644 src/metriport/resources/fhir/types/contributor_type.py create mode 100644 src/metriport/resources/fhir/types/count.py create mode 100644 src/metriport/resources/fhir/types/count_comparator.py create mode 100644 src/metriport/resources/fhir/types/data_requirement.py create mode 100644 src/metriport/resources/fhir/types/data_requirement_code_filter.py create mode 100644 src/metriport/resources/fhir/types/data_requirement_date_filter.py create mode 100644 src/metriport/resources/fhir/types/data_requirement_sort.py create mode 100644 src/metriport/resources/fhir/types/data_requirement_sort_direction.py create mode 100644 src/metriport/resources/fhir/types/date_time.py create mode 100644 src/metriport/resources/fhir/types/decimal.py create mode 100644 src/metriport/resources/fhir/types/distance.py create mode 100644 src/metriport/resources/fhir/types/distance_comparator.py create mode 100644 src/metriport/resources/fhir/types/document_reference.py create mode 100644 src/metriport/resources/fhir/types/document_reference_content.py create mode 100644 src/metriport/resources/fhir/types/document_reference_context.py create mode 100644 src/metriport/resources/fhir/types/document_reference_relates_to.py create mode 100644 src/metriport/resources/fhir/types/document_reference_relates_to_code.py create mode 100644 src/metriport/resources/fhir/types/document_reference_status.py create mode 100644 src/metriport/resources/fhir/types/dosage.py create mode 100644 src/metriport/resources/fhir/types/dosage_dose_and_rate.py create mode 100644 src/metriport/resources/fhir/types/duration.py create mode 100644 src/metriport/resources/fhir/types/duration_comparator.py create mode 100644 src/metriport/resources/fhir/types/expression.py create mode 100644 src/metriport/resources/fhir/types/expression_language.py create mode 100644 src/metriport/resources/fhir/types/extension.py create mode 100644 src/metriport/resources/fhir/types/human_name.py create mode 100644 src/metriport/resources/fhir/types/human_name_use.py create mode 100644 src/metriport/resources/fhir/types/id.py create mode 100644 src/metriport/resources/fhir/types/identifier.py create mode 100644 src/metriport/resources/fhir/types/identifier_use.py create mode 100644 src/metriport/resources/fhir/types/instant.py create mode 100644 src/metriport/resources/fhir/types/markdown.py create mode 100644 src/metriport/resources/fhir/types/meta.py create mode 100644 src/metriport/resources/fhir/types/money.py create mode 100644 src/metriport/resources/fhir/types/narrative.py create mode 100644 src/metriport/resources/fhir/types/narrative_status.py create mode 100644 src/metriport/resources/fhir/types/parameter_definition.py create mode 100644 src/metriport/resources/fhir/types/period.py create mode 100644 src/metriport/resources/fhir/types/positive_int.py create mode 100644 src/metriport/resources/fhir/types/quantity.py create mode 100644 src/metriport/resources/fhir/types/quantity_comparator.py create mode 100644 src/metriport/resources/fhir/types/range.py create mode 100644 src/metriport/resources/fhir/types/ratio.py create mode 100644 src/metriport/resources/fhir/types/reference.py create mode 100644 src/metriport/resources/fhir/types/related_artifact.py create mode 100644 src/metriport/resources/fhir/types/related_artifact_type.py create mode 100644 src/metriport/resources/fhir/types/sampled_data.py create mode 100644 src/metriport/resources/fhir/types/signature.py create mode 100644 src/metriport/resources/fhir/types/time.py create mode 100644 src/metriport/resources/fhir/types/timing.py create mode 100644 src/metriport/resources/fhir/types/timing_repeat.py create mode 100644 src/metriport/resources/fhir/types/timing_repeat_duration_unit.py create mode 100644 src/metriport/resources/fhir/types/timing_repeat_period_unit.py create mode 100644 src/metriport/resources/fhir/types/timing_repeat_when_item.py create mode 100644 src/metriport/resources/fhir/types/trigger_definition.py create mode 100644 src/metriport/resources/fhir/types/trigger_definition_type.py create mode 100644 src/metriport/resources/fhir/types/unsigned_int.py create mode 100644 src/metriport/resources/fhir/types/uri.py create mode 100644 src/metriport/resources/fhir/types/url.py create mode 100644 src/metriport/resources/fhir/types/usage_context.py rename src/metriport/resources/{medical/resources/patient/types/contacts.py => fhir/types/xhtml.py} (55%) rename src/metriport/resources/medical/resources/document/types/{codeable_concept.py => bulk_get_document_url_query.py} (57%) delete mode 100644 src/metriport/resources/medical/resources/document/types/document_reference.py rename src/metriport/resources/medical/resources/document/types/{coding.py => list_document_references.py} (61%) delete mode 100644 src/metriport/resources/medical/resources/document/types/list_documents_response.py create mode 100644 src/metriport/resources/medical/resources/document/types/upload_document_response.py create mode 100644 src/metriport/resources/medical/resources/fhir/types/consolidated_bundle_upload.py delete mode 100644 src/metriport/resources/medical/resources/patient/types/addresses.py rename src/metriport/resources/medical/resources/patient/types/{period.py => medical_record_status.py} (75%) create mode 100644 src/metriport/resources/medical/resources/patient/types/record_status.py create mode 100644 src/metriport/resources/medical/resources/webhooks/__init__.py create mode 100644 src/metriport/resources/medical/resources/webhooks/types/__init__.py create mode 100644 src/metriport/resources/medical/resources/webhooks/types/consolidated_webhook_status.py create mode 100644 src/metriport/resources/medical/resources/webhooks/types/filters.py create mode 100644 src/metriport/resources/medical/resources/webhooks/types/mapi_webhook_status.py create mode 100644 src/metriport/resources/medical/resources/webhooks/types/payload_patient.py create mode 100644 src/metriport/resources/medical/resources/webhooks/types/webhook_document_data_payload.py create mode 100644 src/metriport/resources/medical/resources/webhooks/types/webhook_metadata_payload.py create mode 100644 src/metriport/resources/medical/resources/webhooks/types/webhook_patient_consolidated_data_payload.py create mode 100644 src/metriport/resources/medical/resources/webhooks/types/webhook_patient_document_data_payload.py create mode 100644 src/metriport/resources/medical/resources/webhooks/types/webhook_patient_payload.py diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index 914ca2e..0000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1 +0,0 @@ -* @Goncharo @leite08 @Orta21 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..5d5ffea 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "metriport" -version = "8.0.0-alpha1" +version = "8.0.0" 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..2659227 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", } 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}