aidbox-python-sdk 0.1.16__tar.gz → 0.1.18__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.16/aidbox_python_sdk.egg-info → aidbox_python_sdk-0.1.18}/PKG-INFO +6 -6
  2. {aidbox_python_sdk-0.1.16 → aidbox_python_sdk-0.1.18}/aidbox_python_sdk/__init__.py +1 -1
  3. {aidbox_python_sdk-0.1.16 → aidbox_python_sdk-0.1.18}/aidbox_python_sdk/db.py +12 -2
  4. {aidbox_python_sdk-0.1.16 → aidbox_python_sdk-0.1.18}/aidbox_python_sdk/pytest_plugin.py +8 -9
  5. {aidbox_python_sdk-0.1.16 → aidbox_python_sdk-0.1.18/aidbox_python_sdk.egg-info}/PKG-INFO +6 -6
  6. {aidbox_python_sdk-0.1.16 → aidbox_python_sdk-0.1.18}/aidbox_python_sdk.egg-info/requires.txt +5 -5
  7. {aidbox_python_sdk-0.1.16 → aidbox_python_sdk-0.1.18}/pyproject.toml +7 -6
  8. {aidbox_python_sdk-0.1.16 → aidbox_python_sdk-0.1.18}/LICENSE.md +0 -0
  9. {aidbox_python_sdk-0.1.16 → aidbox_python_sdk-0.1.18}/MANIFEST.in +0 -0
  10. {aidbox_python_sdk-0.1.16 → aidbox_python_sdk-0.1.18}/README.md +0 -0
  11. {aidbox_python_sdk-0.1.16 → aidbox_python_sdk-0.1.18}/aidbox_python_sdk/aidboxpy.py +0 -0
  12. {aidbox_python_sdk-0.1.16 → aidbox_python_sdk-0.1.18}/aidbox_python_sdk/app_keys.py +0 -0
  13. {aidbox_python_sdk-0.1.16 → aidbox_python_sdk-0.1.18}/aidbox_python_sdk/db_migrations.py +0 -0
  14. {aidbox_python_sdk-0.1.16 → aidbox_python_sdk-0.1.18}/aidbox_python_sdk/exceptions.py +0 -0
  15. {aidbox_python_sdk-0.1.16 → aidbox_python_sdk-0.1.18}/aidbox_python_sdk/handlers.py +0 -0
  16. {aidbox_python_sdk-0.1.16 → aidbox_python_sdk-0.1.18}/aidbox_python_sdk/main.py +0 -0
  17. {aidbox_python_sdk-0.1.16 → aidbox_python_sdk-0.1.18}/aidbox_python_sdk/py.typed +0 -0
  18. {aidbox_python_sdk-0.1.16 → aidbox_python_sdk-0.1.18}/aidbox_python_sdk/sdk.py +0 -0
  19. {aidbox_python_sdk-0.1.16 → aidbox_python_sdk-0.1.18}/aidbox_python_sdk/settings.py +0 -0
  20. {aidbox_python_sdk-0.1.16 → aidbox_python_sdk-0.1.18}/aidbox_python_sdk/types.py +0 -0
  21. {aidbox_python_sdk-0.1.16 → aidbox_python_sdk-0.1.18}/aidbox_python_sdk.egg-info/SOURCES.txt +0 -0
  22. {aidbox_python_sdk-0.1.16 → aidbox_python_sdk-0.1.18}/aidbox_python_sdk.egg-info/dependency_links.txt +0 -0
  23. {aidbox_python_sdk-0.1.16 → aidbox_python_sdk-0.1.18}/aidbox_python_sdk.egg-info/not-zip-safe +0 -0
  24. {aidbox_python_sdk-0.1.16 → aidbox_python_sdk-0.1.18}/aidbox_python_sdk.egg-info/top_level.txt +0 -0
  25. {aidbox_python_sdk-0.1.16 → aidbox_python_sdk-0.1.18}/setup.cfg +0 -0
  26. {aidbox_python_sdk-0.1.16 → aidbox_python_sdk-0.1.18}/tests/test_sdk.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aidbox-python-sdk
3
- Version: 0.1.16
3
+ Version: 0.1.18
4
4
  Summary: Aidbox SDK for python
5
5
  Author-email: "beda.software" <aidbox-python-sdk@beda.software>
6
6
  License: MIT License
@@ -44,15 +44,15 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
44
44
  Requires-Python: >=3.8
45
45
  Description-Content-Type: text/markdown
46
46
  License-File: LICENSE.md
47
- Requires-Dist: aiohttp>=3.6.2
47
+ Requires-Dist: aiohttp>=3.11.0
48
48
  Requires-Dist: SQLAlchemy>=1.3.10
49
49
  Requires-Dist: fhirpy>=1.3.0
50
50
  Requires-Dist: jsonschema>=4.4.0
51
51
  Provides-Extra: test
52
- Requires-Dist: pytest~=6.0.0; extra == "test"
53
- Requires-Dist: pytest-asyncio~=0.20.0; extra == "test"
54
- Requires-Dist: pytest-aiohttp~=1.0.4; extra == "test"
55
- Requires-Dist: pytest-cov~=4.0.0; extra == "test"
52
+ Requires-Dist: pytest~=8.4.1; extra == "test"
53
+ Requires-Dist: pytest-asyncio~=1.1.0; extra == "test"
54
+ Requires-Dist: pytest-aiohttp~=1.1.0; extra == "test"
55
+ Requires-Dist: pytest-cov~=6.2.1; extra == "test"
56
56
  Provides-Extra: dev
57
57
  Requires-Dist: black; extra == "dev"
58
58
  Requires-Dist: autohooks; extra == "dev"
@@ -1,5 +1,5 @@
1
1
  __title__ = "aidbox-python-sdk"
2
- __version__ = "0.1.16"
2
+ __version__ = "0.1.18"
3
3
  __author__ = "beda.software"
4
4
  __license__ = "None"
5
5
  __copyright__ = "Copyright 2024 beda.software"
@@ -136,11 +136,21 @@ class DBProxy:
136
136
  return await self.raw_sql(query, execute=execute)
137
137
 
138
138
  async def _get_all_entities_name(self):
139
- # TODO: refactor using StructureDefintion
139
+ result = None
140
+
141
+ #Support legacy instalations with entity attribute data structure
140
142
  query_url = f"{self._settings.APP_INIT_URL}/Entity?type=resource&_elements=id&_count=999"
141
143
  async with self._client.get(query_url) as resp:
142
144
  json_resp = await resp.json()
143
- return [entry["resource"]["id"] for entry in json_resp.get("entry", [])]
145
+ result = [entry["resource"]["id"] for entry in json_resp.get("entry", [])]
146
+
147
+ if result is None or len(result) == 0:
148
+ # Load resource type from fhir schema
149
+ query_url = f"{self._settings.APP_INIT_URL}/$resource-types"
150
+ async with self._client.get(query_url) as resp:
151
+ json_resp = await resp.json()
152
+ result = list(json_resp.keys())
153
+ return result or []
144
154
 
145
155
  async def _init_table_cache(self):
146
156
  table_names = await self._get_all_entities_name()
@@ -2,7 +2,6 @@ import os
2
2
  from typing import cast
3
3
 
4
4
  import pytest
5
- import pytest_asyncio
6
5
  from aiohttp import BasicAuth, ClientSession, web
7
6
  from yarl import URL
8
7
 
@@ -19,10 +18,10 @@ async def start_app(aiohttp_client):
19
18
  return app
20
19
 
21
20
 
22
- @pytest.fixture()
23
- def client(event_loop, aiohttp_client):
21
+ @pytest.fixture
22
+ async def client(aiohttp_client):
24
23
  """Instance of app's server and client"""
25
- return event_loop.run_until_complete(start_app(aiohttp_client))
24
+ return await start_app(aiohttp_client)
26
25
 
27
26
 
28
27
  class AidboxSession(ClientSession):
@@ -40,7 +39,7 @@ class AidboxSession(ClientSession):
40
39
  return await super()._request(method, url, *args, **kwargs)
41
40
 
42
41
 
43
- @pytest_asyncio.fixture
42
+ @pytest.fixture
44
43
  async def aidbox(client):
45
44
  """HTTP client for making requests to Aidbox"""
46
45
  app = cast(web.Application, client.server.app)
@@ -53,7 +52,7 @@ async def aidbox(client):
53
52
  await session.close()
54
53
 
55
54
 
56
- @pytest_asyncio.fixture
55
+ @pytest.fixture
57
56
  async def safe_db(aidbox, client, sdk):
58
57
  resp = await aidbox.post(
59
58
  "/$psql",
@@ -75,16 +74,16 @@ async def safe_db(aidbox, client, sdk):
75
74
  )
76
75
 
77
76
 
78
- @pytest.fixture()
77
+ @pytest.fixture
79
78
  def sdk(client):
80
79
  return cast(web.Application, client.server.app)[ak.sdk]
81
80
 
82
81
 
83
- @pytest.fixture()
82
+ @pytest.fixture
84
83
  def aidbox_client(client):
85
84
  return cast(web.Application, client.server.app)[ak.client]
86
85
 
87
86
 
88
- @pytest.fixture()
87
+ @pytest.fixture
89
88
  def aidbox_db(client):
90
89
  return cast(web.Application, client.server.app)[ak.db]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aidbox-python-sdk
3
- Version: 0.1.16
3
+ Version: 0.1.18
4
4
  Summary: Aidbox SDK for python
5
5
  Author-email: "beda.software" <aidbox-python-sdk@beda.software>
6
6
  License: MIT License
@@ -44,15 +44,15 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
44
44
  Requires-Python: >=3.8
45
45
  Description-Content-Type: text/markdown
46
46
  License-File: LICENSE.md
47
- Requires-Dist: aiohttp>=3.6.2
47
+ Requires-Dist: aiohttp>=3.11.0
48
48
  Requires-Dist: SQLAlchemy>=1.3.10
49
49
  Requires-Dist: fhirpy>=1.3.0
50
50
  Requires-Dist: jsonschema>=4.4.0
51
51
  Provides-Extra: test
52
- Requires-Dist: pytest~=6.0.0; extra == "test"
53
- Requires-Dist: pytest-asyncio~=0.20.0; extra == "test"
54
- Requires-Dist: pytest-aiohttp~=1.0.4; extra == "test"
55
- Requires-Dist: pytest-cov~=4.0.0; extra == "test"
52
+ Requires-Dist: pytest~=8.4.1; extra == "test"
53
+ Requires-Dist: pytest-asyncio~=1.1.0; extra == "test"
54
+ Requires-Dist: pytest-aiohttp~=1.1.0; extra == "test"
55
+ Requires-Dist: pytest-cov~=6.2.1; extra == "test"
56
56
  Provides-Extra: dev
57
57
  Requires-Dist: black; extra == "dev"
58
58
  Requires-Dist: autohooks; extra == "dev"
@@ -1,4 +1,4 @@
1
- aiohttp>=3.6.2
1
+ aiohttp>=3.11.0
2
2
  SQLAlchemy>=1.3.10
3
3
  fhirpy>=1.3.0
4
4
  jsonschema>=4.4.0
@@ -10,7 +10,7 @@ autohooks-plugin-ruff
10
10
  autohooks-plugin-black
11
11
 
12
12
  [test]
13
- pytest~=6.0.0
14
- pytest-asyncio~=0.20.0
15
- pytest-aiohttp~=1.0.4
16
- pytest-cov~=4.0.0
13
+ pytest~=8.4.1
14
+ pytest-asyncio~=1.1.0
15
+ pytest-aiohttp~=1.1.0
16
+ pytest-cov~=6.2.1
@@ -1,9 +1,10 @@
1
1
  [tool.pytest.ini_options]
2
- minversion = "6.0"
2
+ minversion = "8.4"
3
3
  addopts = "-ra -q --color=yes"
4
4
  testpaths = ["tests"]
5
5
  log_cli = true
6
6
  log_cli_level = "INFO"
7
+ asyncio_mode = "auto"
7
8
 
8
9
  [tool.autohooks]
9
10
  mode = "pipenv"
@@ -63,7 +64,7 @@ authors = [
63
64
  { name = "beda.software", email = "aidbox-python-sdk@beda.software" },
64
65
  ]
65
66
  dependencies = [
66
- "aiohttp>=3.6.2",
67
+ "aiohttp>=3.11.0",
67
68
  "SQLAlchemy>=1.3.10",
68
69
  "fhirpy>=1.3.0",
69
70
  "jsonschema>=4.4.0",
@@ -86,10 +87,10 @@ requires-python = ">=3.8"
86
87
 
87
88
  [project.optional-dependencies]
88
89
  test = [
89
- "pytest~=6.0.0",
90
- "pytest-asyncio~=0.20.0",
91
- "pytest-aiohttp~=1.0.4",
92
- "pytest-cov~=4.0.0"
90
+ "pytest~=8.4.1",
91
+ "pytest-asyncio~=1.1.0",
92
+ "pytest-aiohttp~=1.1.0",
93
+ "pytest-cov~=6.2.1"
93
94
  ]
94
95
  dev = [
95
96
  "black",