aidbox-python-sdk 0.1.19__tar.gz → 0.1.21__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.19/aidbox_python_sdk.egg-info → aidbox_python_sdk-0.1.21}/PKG-INFO +1 -1
  2. {aidbox_python_sdk-0.1.19 → aidbox_python_sdk-0.1.21}/aidbox_python_sdk/__init__.py +1 -1
  3. {aidbox_python_sdk-0.1.19 → aidbox_python_sdk-0.1.21}/aidbox_python_sdk/aidboxpy.py +11 -5
  4. {aidbox_python_sdk-0.1.19 → aidbox_python_sdk-0.1.21}/aidbox_python_sdk/db_migrations.py +1 -1
  5. {aidbox_python_sdk-0.1.19 → aidbox_python_sdk-0.1.21/aidbox_python_sdk.egg-info}/PKG-INFO +1 -1
  6. {aidbox_python_sdk-0.1.19 → aidbox_python_sdk-0.1.21}/tests/test_sdk.py +60 -0
  7. {aidbox_python_sdk-0.1.19 → aidbox_python_sdk-0.1.21}/LICENSE.md +0 -0
  8. {aidbox_python_sdk-0.1.19 → aidbox_python_sdk-0.1.21}/MANIFEST.in +0 -0
  9. {aidbox_python_sdk-0.1.19 → aidbox_python_sdk-0.1.21}/README.md +0 -0
  10. {aidbox_python_sdk-0.1.19 → aidbox_python_sdk-0.1.21}/aidbox_python_sdk/app_keys.py +0 -0
  11. {aidbox_python_sdk-0.1.19 → aidbox_python_sdk-0.1.21}/aidbox_python_sdk/db.py +0 -0
  12. {aidbox_python_sdk-0.1.19 → aidbox_python_sdk-0.1.21}/aidbox_python_sdk/exceptions.py +0 -0
  13. {aidbox_python_sdk-0.1.19 → aidbox_python_sdk-0.1.21}/aidbox_python_sdk/handlers.py +0 -0
  14. {aidbox_python_sdk-0.1.19 → aidbox_python_sdk-0.1.21}/aidbox_python_sdk/main.py +0 -0
  15. {aidbox_python_sdk-0.1.19 → aidbox_python_sdk-0.1.21}/aidbox_python_sdk/py.typed +0 -0
  16. {aidbox_python_sdk-0.1.19 → aidbox_python_sdk-0.1.21}/aidbox_python_sdk/pytest_plugin.py +0 -0
  17. {aidbox_python_sdk-0.1.19 → aidbox_python_sdk-0.1.21}/aidbox_python_sdk/sdk.py +0 -0
  18. {aidbox_python_sdk-0.1.19 → aidbox_python_sdk-0.1.21}/aidbox_python_sdk/settings.py +0 -0
  19. {aidbox_python_sdk-0.1.19 → aidbox_python_sdk-0.1.21}/aidbox_python_sdk/types.py +0 -0
  20. {aidbox_python_sdk-0.1.19 → aidbox_python_sdk-0.1.21}/aidbox_python_sdk.egg-info/SOURCES.txt +0 -0
  21. {aidbox_python_sdk-0.1.19 → aidbox_python_sdk-0.1.21}/aidbox_python_sdk.egg-info/dependency_links.txt +0 -0
  22. {aidbox_python_sdk-0.1.19 → aidbox_python_sdk-0.1.21}/aidbox_python_sdk.egg-info/not-zip-safe +0 -0
  23. {aidbox_python_sdk-0.1.19 → aidbox_python_sdk-0.1.21}/aidbox_python_sdk.egg-info/requires.txt +0 -0
  24. {aidbox_python_sdk-0.1.19 → aidbox_python_sdk-0.1.21}/aidbox_python_sdk.egg-info/top_level.txt +0 -0
  25. {aidbox_python_sdk-0.1.19 → aidbox_python_sdk-0.1.21}/pyproject.toml +0 -0
  26. {aidbox_python_sdk-0.1.19 → aidbox_python_sdk-0.1.21}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aidbox-python-sdk
3
- Version: 0.1.19
3
+ Version: 0.1.21
4
4
  Summary: Aidbox SDK for python
5
5
  Author-email: "beda.software" <aidbox-python-sdk@beda.software>
6
6
  License: MIT License
@@ -1,5 +1,5 @@
1
1
  __title__ = "aidbox-python-sdk"
2
- __version__ = "0.1.19"
2
+ __version__ = "0.1.21"
3
3
  __author__ = "beda.software"
4
4
  __license__ = "None"
5
5
  __copyright__ = "Copyright 2024 beda.software"
@@ -109,9 +109,12 @@ class AsyncAidboxReference(BaseAidboxReference, AsyncReference):
109
109
 
110
110
 
111
111
  class SyncAidboxClient(SyncClient):
112
- searchset_class = SyncAidboxSearchSet
113
- resource_class = SyncAidboxResource
114
-
112
+ def resource(self, resource_type, **kwargs):
113
+ return SyncAidboxResource(self, resource_type, **kwargs)
114
+
115
+ def resources(self, resource_type):
116
+ return SyncAidboxSearchSet(self, resource_type)
117
+
115
118
  def reference(self, resource_type=None, id=None, reference=None, **kwargs): # noqa: A002
116
119
  resource_type = kwargs.pop("resourceType", resource_type)
117
120
  if reference:
@@ -124,8 +127,11 @@ class SyncAidboxClient(SyncClient):
124
127
 
125
128
 
126
129
  class AsyncAidboxClient(AsyncClient):
127
- searchset_class = AsyncAidboxSearchSet
128
- resource_class = AsyncAidboxResource
130
+ def resource(self, resource_type, **kwargs):
131
+ return AsyncAidboxResource(self, resource_type, **kwargs)
132
+
133
+ def resources(self, resource_type):
134
+ return AsyncAidboxSearchSet(self, resource_type)
129
135
 
130
136
  def reference(self, resource_type=None, id=None, reference=None, **kwargs): # noqa: A002
131
137
  resource_type = kwargs.pop("resourceType", resource_type)
@@ -27,7 +27,7 @@ BEGIN
27
27
  FOR e IN (
28
28
  SELECT table_name
29
29
  FROM information_schema.columns
30
- WHERE column_name = 'txid' AND table_schema = 'public' AND table_name NOT LIKE '%_history'
30
+ WHERE column_name = 'txid' AND table_schema = 'public' AND table_name NOT LIKE '%\\_history' ESCAPE '\\'
31
31
  ) LOOP
32
32
  EXECUTE 'DELETE FROM "' || e.table_name || '" WHERE txid > ' || $1 ;
33
33
  END LOOP;
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aidbox-python-sdk
3
- Version: 0.1.19
3
+ Version: 0.1.21
4
4
  Summary: Aidbox SDK for python
5
5
  Author-email: "beda.software" <aidbox-python-sdk@beda.software>
6
6
  License: MIT License
@@ -118,3 +118,63 @@ async def test_database_isolation__2(aidbox_client, safe_db):
118
118
 
119
119
  patients = await aidbox_client.resources("Patient").fetch_all()
120
120
  assert len(patients) == 4
121
+
122
+
123
+ @pytest.mark.asyncio()
124
+ async def test_database_isolation_with_history_in_name__1(aidbox_client, safe_db):
125
+ resources = await aidbox_client.resources("FamilyMemberHistory").fetch_all()
126
+ assert len(resources) == 0
127
+
128
+ resource = aidbox_client.resource(
129
+ "FamilyMemberHistory",
130
+ status="completed",
131
+ patient={
132
+ "identifier": {"system": "http://example.org/test-patients", "value": "test-patient-1"}
133
+ },
134
+ relationship={
135
+ "coding": [
136
+ {"system": "http://terminology.hl7.org/CodeSystem/v3-RoleCode", "code": "FTH"}
137
+ ]
138
+ },
139
+ )
140
+ await resource.save()
141
+
142
+ resources = await aidbox_client.resources("FamilyMemberHistory").fetch_all()
143
+ assert len(resources) == 1
144
+
145
+
146
+ @pytest.mark.asyncio()
147
+ async def test_database_isolation_with_history_in_name__2(aidbox_client, safe_db):
148
+ resources = await aidbox_client.resources("FamilyMemberHistory").fetch_all()
149
+ assert len(resources) == 0
150
+
151
+ resource1 = aidbox_client.resource(
152
+ "FamilyMemberHistory",
153
+ status="completed",
154
+ patient={
155
+ "identifier": {"system": "http://example.org/test-patients", "value": "test-patient-1"}
156
+ },
157
+ relationship={
158
+ "coding": [
159
+ {"system": "http://terminology.hl7.org/CodeSystem/v3-RoleCode", "code": "FTH"}
160
+ ]
161
+ },
162
+ )
163
+ await resource1.save()
164
+
165
+ resource2 = aidbox_client.resource(
166
+ "FamilyMemberHistory",
167
+ status="completed",
168
+ patient={
169
+ "identifier": {"system": "http://example.org/test-patients", "value": "test-patient-2"}
170
+ },
171
+ relationship={
172
+ "coding": [
173
+ {"system": "http://terminology.hl7.org/CodeSystem/v3-RoleCode", "code": "MTH"}
174
+ ]
175
+ },
176
+ )
177
+ await resource2.save()
178
+
179
+ resources = await aidbox_client.resources("FamilyMemberHistory").fetch_all()
180
+ assert len(resources) == 2