aidbox-python-sdk 0.1.13__tar.gz → 0.1.15__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. {aidbox_python_sdk-0.1.13/aidbox_python_sdk.egg-info → aidbox_python_sdk-0.1.15}/PKG-INFO +3 -2
  2. {aidbox_python_sdk-0.1.13 → aidbox_python_sdk-0.1.15}/aidbox_python_sdk/__init__.py +1 -1
  3. {aidbox_python_sdk-0.1.13 → aidbox_python_sdk-0.1.15}/aidbox_python_sdk/db.py +1 -1
  4. {aidbox_python_sdk-0.1.13 → aidbox_python_sdk-0.1.15}/aidbox_python_sdk/sdk.py +4 -0
  5. {aidbox_python_sdk-0.1.13 → aidbox_python_sdk-0.1.15}/aidbox_python_sdk/types.py +6 -1
  6. {aidbox_python_sdk-0.1.13 → aidbox_python_sdk-0.1.15/aidbox_python_sdk.egg-info}/PKG-INFO +3 -2
  7. {aidbox_python_sdk-0.1.13 → aidbox_python_sdk-0.1.15}/tests/test_sdk.py +28 -0
  8. {aidbox_python_sdk-0.1.13 → aidbox_python_sdk-0.1.15}/LICENSE.md +0 -0
  9. {aidbox_python_sdk-0.1.13 → aidbox_python_sdk-0.1.15}/MANIFEST.in +0 -0
  10. {aidbox_python_sdk-0.1.13 → aidbox_python_sdk-0.1.15}/README.md +0 -0
  11. {aidbox_python_sdk-0.1.13 → aidbox_python_sdk-0.1.15}/aidbox_python_sdk/aidboxpy.py +0 -0
  12. {aidbox_python_sdk-0.1.13 → aidbox_python_sdk-0.1.15}/aidbox_python_sdk/app_keys.py +0 -0
  13. {aidbox_python_sdk-0.1.13 → aidbox_python_sdk-0.1.15}/aidbox_python_sdk/db_migrations.py +0 -0
  14. {aidbox_python_sdk-0.1.13 → aidbox_python_sdk-0.1.15}/aidbox_python_sdk/exceptions.py +0 -0
  15. {aidbox_python_sdk-0.1.13 → aidbox_python_sdk-0.1.15}/aidbox_python_sdk/handlers.py +0 -0
  16. {aidbox_python_sdk-0.1.13 → aidbox_python_sdk-0.1.15}/aidbox_python_sdk/main.py +0 -0
  17. {aidbox_python_sdk-0.1.13 → aidbox_python_sdk-0.1.15}/aidbox_python_sdk/py.typed +0 -0
  18. {aidbox_python_sdk-0.1.13 → aidbox_python_sdk-0.1.15}/aidbox_python_sdk/pytest_plugin.py +0 -0
  19. {aidbox_python_sdk-0.1.13 → aidbox_python_sdk-0.1.15}/aidbox_python_sdk/settings.py +0 -0
  20. {aidbox_python_sdk-0.1.13 → aidbox_python_sdk-0.1.15}/aidbox_python_sdk.egg-info/SOURCES.txt +0 -0
  21. {aidbox_python_sdk-0.1.13 → aidbox_python_sdk-0.1.15}/aidbox_python_sdk.egg-info/dependency_links.txt +0 -0
  22. {aidbox_python_sdk-0.1.13 → aidbox_python_sdk-0.1.15}/aidbox_python_sdk.egg-info/not-zip-safe +0 -0
  23. {aidbox_python_sdk-0.1.13 → aidbox_python_sdk-0.1.15}/aidbox_python_sdk.egg-info/requires.txt +0 -0
  24. {aidbox_python_sdk-0.1.13 → aidbox_python_sdk-0.1.15}/aidbox_python_sdk.egg-info/top_level.txt +0 -0
  25. {aidbox_python_sdk-0.1.13 → aidbox_python_sdk-0.1.15}/pyproject.toml +0 -0
  26. {aidbox_python_sdk-0.1.13 → aidbox_python_sdk-0.1.15}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: aidbox-python-sdk
3
- Version: 0.1.13
3
+ Version: 0.1.15
4
4
  Summary: Aidbox SDK for python
5
5
  Author-email: "beda.software" <aidbox-python-sdk@beda.software>
6
6
  License: MIT License
@@ -58,6 +58,7 @@ Requires-Dist: black; extra == "dev"
58
58
  Requires-Dist: autohooks; extra == "dev"
59
59
  Requires-Dist: autohooks-plugin-ruff; extra == "dev"
60
60
  Requires-Dist: autohooks-plugin-black; extra == "dev"
61
+ Dynamic: license-file
61
62
 
62
63
  [![build status](https://github.com/Aidbox/aidbox-python-sdk/actions/workflows/build.yaml/badge.svg)](https://github.com/Aidbox/aidbox-python-sdk/actions/workflows/build.yaml)
63
64
  [![pypi](https://img.shields.io/pypi/v/aidbox-python-sdk.svg)](https://pypi.org/project/aidbox-python-sdk/)
@@ -1,5 +1,5 @@
1
1
  __title__ = "aidbox-python-sdk"
2
- __version__ = "0.1.13"
2
+ __version__ = "0.1.15"
3
3
  __author__ = "beda.software"
4
4
  __license__ = "None"
5
5
  __copyright__ = "Copyright 2024 beda.software"
@@ -140,7 +140,7 @@ class DBProxy:
140
140
  query_url = f"{self._settings.APP_INIT_URL}/Entity?type=resource&_elements=id&_count=999"
141
141
  async with self._client.get(query_url, raise_for_status=True) as resp:
142
142
  json_resp = await resp.json()
143
- return [entry["resource"]["id"] for entry in json_resp["entry"]]
143
+ return [entry["resource"]["id"] for entry in json_resp.get("entry", [])]
144
144
 
145
145
  async def _init_table_cache(self):
146
146
  table_names = await self._get_all_entities_name()
@@ -1,11 +1,13 @@
1
1
  import asyncio
2
2
  import logging
3
+ from typing import Optional
3
4
 
4
5
  import jsonschema
5
6
  from fhirpy.base.exceptions import OperationOutcome
6
7
 
7
8
  from .aidboxpy import AsyncAidboxClient
8
9
  from .db_migrations import sdk_migrations
10
+ from .types import Compliance
9
11
 
10
12
  logger = logging.getLogger("aidbox_sdk")
11
13
 
@@ -151,6 +153,7 @@ class SDK:
151
153
  access_policy=None,
152
154
  request_schema=None,
153
155
  timeout=None,
156
+ compliance: Optional[Compliance] = None,
154
157
  ):
155
158
  if public and access_policy is not None:
156
159
  raise ValueError("Operation might be public or have access policy, not both")
@@ -184,6 +187,7 @@ class SDK:
184
187
  "method": method,
185
188
  "path": path,
186
189
  **({"timeout": timeout} if timeout else {}),
190
+ **(compliance if compliance else {}),
187
191
  }
188
192
  self._operation_handlers[operation_id] = wrapped_func
189
193
  if public is True:
@@ -1,8 +1,13 @@
1
- from typing import Any
1
+ from typing import Any, List
2
2
 
3
3
  from aiohttp import web
4
4
  from typing_extensions import TypedDict
5
5
 
6
+ class Compliance(TypedDict, total=True):
7
+ fhirUrl: str
8
+ fhirCode: str
9
+ fhirResource: List[str]
10
+
6
11
  SDKOperationRequest = TypedDict(
7
12
  "SDKOperationRequest",
8
13
  {"app": web.Application, "params": dict, "route-params": dict, "headers": dict, "resource": Any},
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: aidbox-python-sdk
3
- Version: 0.1.13
3
+ Version: 0.1.15
4
4
  Summary: Aidbox SDK for python
5
5
  Author-email: "beda.software" <aidbox-python-sdk@beda.software>
6
6
  License: MIT License
@@ -58,6 +58,7 @@ Requires-Dist: black; extra == "dev"
58
58
  Requires-Dist: autohooks; extra == "dev"
59
59
  Requires-Dist: autohooks-plugin-ruff; extra == "dev"
60
60
  Requires-Dist: autohooks-plugin-black; extra == "dev"
61
+ Dynamic: license-file
61
62
 
62
63
  [![build status](https://github.com/Aidbox/aidbox-python-sdk/actions/workflows/build.yaml/badge.svg)](https://github.com/Aidbox/aidbox-python-sdk/actions/workflows/build.yaml)
63
64
  [![pypi](https://img.shields.io/pypi/v/aidbox-python-sdk.svg)](https://pypi.org/project/aidbox-python-sdk/)
@@ -3,10 +3,38 @@ import logging
3
3
  from unittest import mock
4
4
 
5
5
  import pytest
6
+ from fhirpathpy import evaluate
6
7
 
7
8
  import main
8
9
 
9
10
 
11
+ @pytest.mark.asyncio
12
+ @pytest.mark.parametrize(
13
+ ("expression", "expected"),
14
+ [
15
+ (
16
+ "CapabilityStatement.rest.operation.where(definition='http://test.com').count()",
17
+ 1,
18
+ ),
19
+ (
20
+ "CapabilityStatement.rest.operation.where(definition='http://test.com').first().name",
21
+ "observation-custom-op",
22
+ ),
23
+ (
24
+ "CapabilityStatement.rest.resource.where(type='Observation').operation.where(definition='http://test.com').count()",
25
+ 1,
26
+ ),
27
+ (
28
+ "CapabilityStatement.rest.resource.where(type='Observation').operation.where(definition='http://test.com').first().name",
29
+ "observation-custom-op",
30
+ ),
31
+ ],
32
+ )
33
+ async def test_operation_with_compliance_params(aidbox_client, expression, expected):
34
+ response = await aidbox_client.execute("fhir/metadata", method="GET")
35
+ assert evaluate(response, expression, {})[0] == expected
36
+
37
+
10
38
  @pytest.mark.asyncio()
11
39
  async def test_health_check(client):
12
40
  resp = await client.get("/health")