From ab068e040118e00dea562d87a475159824d77a47 Mon Sep 17 00:00:00 2001 From: Aleksei Zakharov Date: Wed, 26 Nov 2025 23:15:41 -0300 Subject: [PATCH] update example project --- example/backend/env_tests/aidbox | 2 +- example/backend/poetry.lock | 12 ++--- example/backend/pyproject.toml | 2 +- example/backend/tests/test_db_isolation.py | 58 ++++++++++++++++++++++ 4 files changed, 66 insertions(+), 8 deletions(-) diff --git a/example/backend/env_tests/aidbox b/example/backend/env_tests/aidbox index b6f9094..d27e024 100644 --- a/example/backend/env_tests/aidbox +++ b/example/backend/env_tests/aidbox @@ -12,7 +12,7 @@ PGUSER=postgres PGPASSWORD=postgres BOX_PROJECT_GIT_TARGET__PATH=/aidbox-project -AIDBOX_ZEN_PATHS=path:package-zip:/aidbox-project/zen-package.zip +AIDBOX_ZEN_PATHS=path:package-dir:/aidbox-project AIDBOX_ZEN_ENTRYPOINT=main/box AIDBOX_DEV_MODE=true AIDBOX_ZEN_DEV_MODE=true diff --git a/example/backend/poetry.lock b/example/backend/poetry.lock index 8f87080..c141621 100644 --- a/example/backend/poetry.lock +++ b/example/backend/poetry.lock @@ -1,15 +1,15 @@ -# This file is automatically @generated by Poetry 2.1.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 2.2.1 and should not be changed by hand. [[package]] name = "aidbox-python-sdk" -version = "0.1.17" +version = "0.1.21" description = "Aidbox SDK for python" optional = false python-versions = ">=3.8" groups = ["main"] files = [ - {file = "aidbox_python_sdk-0.1.17-py3-none-any.whl", hash = "sha256:0f6c9966688417f98a216c67531c22a90188c78e1ca6246840d5ec93f10bf8a6"}, - {file = "aidbox_python_sdk-0.1.17.tar.gz", hash = "sha256:a272f1084dbd3a6f75e63a74190bc7b68033430da2fb59bd764dda4080cc924d"}, + {file = "aidbox_python_sdk-0.1.21-py3-none-any.whl", hash = "sha256:efeacbb853d4979220586216a60400049c0eed2eb4b2b73538a8708689ab3677"}, + {file = "aidbox_python_sdk-0.1.21.tar.gz", hash = "sha256:75a89f486c890286fd53dfe7dbb5a774157d109113bc655cb2667516f4130872"}, ] [package.dependencies] @@ -723,7 +723,7 @@ description = "Lightweight in-process concurrent programming" optional = false python-versions = ">=3.7" groups = ["main"] -markers = "python_version < \"3.13\" and (platform_machine == \"aarch64\" or platform_machine == \"ppc64le\" or platform_machine == \"x86_64\" or platform_machine == \"amd64\" or platform_machine == \"AMD64\" or platform_machine == \"win32\" or platform_machine == \"WIN32\")" +markers = "python_version == \"3.12\" and (platform_machine == \"aarch64\" or platform_machine == \"ppc64le\" or platform_machine == \"x86_64\" or platform_machine == \"amd64\" or platform_machine == \"AMD64\" or platform_machine == \"win32\" or platform_machine == \"WIN32\")" files = [ {file = "greenlet-3.1.1-cp310-cp310-macosx_11_0_universal2.whl", hash = "sha256:0bbae94a29c9e5c7e4a2b7f0aae5c17e8e90acbfd3bf6270eeba60c39fce3563"}, {file = "greenlet-3.1.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0fde093fb93f35ca72a556cf72c92ea3ebfda3d79fc35bb19fbe685853869a83"}, @@ -2318,4 +2318,4 @@ propcache = ">=0.2.0" [metadata] lock-version = "2.1" python-versions = "^3.12" -content-hash = "016f6ff34cf02e40f6d553037f0af7f4c8f71a857f1cf20954ac9efbb17fd71c" +content-hash = "aec25bde5e2d9188a5b2af9206412d46d99c5aeffabe70acfbca750741fb1248" diff --git a/example/backend/pyproject.toml b/example/backend/pyproject.toml index be963bb..565ee4e 100644 --- a/example/backend/pyproject.toml +++ b/example/backend/pyproject.toml @@ -8,7 +8,7 @@ package-mode = false [tool.poetry.dependencies] python = "^3.12" -aidbox-python-sdk = "^0.1.17" +aidbox-python-sdk = "^0.1.21" gunicorn = "^23.0.0" fhirpy = "^2.0.15" fhirpy-types-r4b = "^0.1.1" diff --git a/example/backend/tests/test_db_isolation.py b/example/backend/tests/test_db_isolation.py index 5f49628..7e52ab6 100644 --- a/example/backend/tests/test_db_isolation.py +++ b/example/backend/tests/test_db_isolation.py @@ -23,3 +23,61 @@ async def test_database_isolation__2(fhir_client: AsyncFHIRClient, safe_db: Safe patients = await fhir_client.resources(r4b.Patient).fetch_all() assert len(patients) == 2 # noqa: PLR2004 + + +async def test_database_isolation_with_history_in_name__1(aidbox_client, safe_db): + resources = await aidbox_client.resources("FamilyMemberHistory").fetch_all() + assert len(resources) == 0 + + resource = aidbox_client.resource( + "FamilyMemberHistory", + status="completed", + patient={ + "identifier": {"system": "http://example.org/test-patients", "value": "test-patient-1"} + }, + relationship={ + "coding": [ + {"system": "http://terminology.hl7.org/CodeSystem/v3-RoleCode", "code": "FTH"} + ] + }, + ) + await resource.save() + + resources = await aidbox_client.resources("FamilyMemberHistory").fetch_all() + assert len(resources) == 1 + + +async def test_database_isolation_with_history_in_name__2(aidbox_client, safe_db): + resources = await aidbox_client.resources("FamilyMemberHistory").fetch_all() + assert len(resources) == 0 + + resource1 = aidbox_client.resource( + "FamilyMemberHistory", + status="completed", + patient={ + "identifier": {"system": "http://example.org/test-patients", "value": "test-patient-1"} + }, + relationship={ + "coding": [ + {"system": "http://terminology.hl7.org/CodeSystem/v3-RoleCode", "code": "FTH"} + ] + }, + ) + await resource1.save() + + resource2 = aidbox_client.resource( + "FamilyMemberHistory", + status="completed", + patient={ + "identifier": {"system": "http://example.org/test-patients", "value": "test-patient-2"} + }, + relationship={ + "coding": [ + {"system": "http://terminology.hl7.org/CodeSystem/v3-RoleCode", "code": "MTH"} + ] + }, + ) + await resource2.save() + + resources = await aidbox_client.resources("FamilyMemberHistory").fetch_all() + assert len(resources) == 2