phenostore-sdk-python 0.1.1__py3-none-any.whl
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.
- phenostore/__init__.py +26 -0
- phenostore/_auth.py +94 -0
- phenostore/client.py +276 -0
- phenostore/errors.py +93 -0
- phenostore/gen/__init__.py +8 -0
- phenostore/gen/api/__init__.py +1 -0
- phenostore/gen/api/bulk/__init__.py +1 -0
- phenostore/gen/api/bulk/get_bulk_status.py +194 -0
- phenostore/gen/api/bulk/submit_bulk.py +223 -0
- phenostore/gen/api/fhir/__init__.py +1 -0
- phenostore/gen/api/fhir/conditional_delete_resource.py +277 -0
- phenostore/gen/api/fhir/create_resource.py +257 -0
- phenostore/gen/api/fhir/delete_resource.py +212 -0
- phenostore/gen/api/fhir/get_docref.py +281 -0
- phenostore/gen/api/fhir/get_metadata.py +185 -0
- phenostore/gen/api/fhir/get_resource_history.py +240 -0
- phenostore/gen/api/fhir/get_smart_configuration.py +169 -0
- phenostore/gen/api/fhir/patch_resource.py +282 -0
- phenostore/gen/api/fhir/post_docref.py +200 -0
- phenostore/gen/api/fhir/process_bundle.py +201 -0
- phenostore/gen/api/fhir/read_resource.py +214 -0
- phenostore/gen/api/fhir/read_resource_version.py +228 -0
- phenostore/gen/api/fhir/search_resources.py +390 -0
- phenostore/gen/api/fhir/search_resources_post.py +228 -0
- phenostore/gen/api/fhir/update_resource.py +281 -0
- phenostore/gen/api/fhir/validate_resource.py +217 -0
- phenostore/gen/api/o_auth/__init__.py +1 -0
- phenostore/gen/api/o_auth/issue_token.py +186 -0
- phenostore/gen/api/system/__init__.py +1 -0
- phenostore/gen/api/system/get_health.py +128 -0
- phenostore/gen/client.py +280 -0
- phenostore/gen/errors.py +16 -0
- phenostore/gen/models/__init__.py +71 -0
- phenostore/gen/models/bulk_operation_accepted.py +79 -0
- phenostore/gen/models/bulk_operation_accepted_status.py +8 -0
- phenostore/gen/models/bulk_operation_status.py +122 -0
- phenostore/gen/models/bulk_operation_status_code.py +11 -0
- phenostore/gen/models/bundle.py +132 -0
- phenostore/gen/models/bundle_entry.py +128 -0
- phenostore/gen/models/bundle_entry_request.py +70 -0
- phenostore/gen/models/bundle_entry_response.py +97 -0
- phenostore/gen/models/bundle_entry_search.py +69 -0
- phenostore/gen/models/bundle_entry_search_mode.py +9 -0
- phenostore/gen/models/bundle_link.py +69 -0
- phenostore/gen/models/bundle_resource_type.py +8 -0
- phenostore/gen/models/bundle_type.py +11 -0
- phenostore/gen/models/fhir_resource.py +47 -0
- phenostore/gen/models/health_response.py +63 -0
- phenostore/gen/models/health_response_status.py +8 -0
- phenostore/gen/models/issue_severity.py +11 -0
- phenostore/gen/models/issue_token_body.py +91 -0
- phenostore/gen/models/issue_token_body_grant_type.py +8 -0
- phenostore/gen/models/json_patch_item.py +90 -0
- phenostore/gen/models/json_patch_op.py +13 -0
- phenostore/gen/models/o_auth_error.py +69 -0
- phenostore/gen/models/operation_outcome.py +85 -0
- phenostore/gen/models/operation_outcome_issue.py +92 -0
- phenostore/gen/models/operation_outcome_resource_type.py +8 -0
- phenostore/gen/models/post_docref_body.py +124 -0
- phenostore/gen/models/resource_type.py +47 -0
- phenostore/gen/models/search_resources_post_body.py +155 -0
- phenostore/gen/models/search_summary_mode.py +12 -0
- phenostore/gen/models/search_total_mode.py +10 -0
- phenostore/gen/models/smart_configuration.py +111 -0
- phenostore/gen/models/token_response.py +87 -0
- phenostore/gen/models/token_response_token_type.py +8 -0
- phenostore/gen/types.py +54 -0
- phenostore/py.typed +0 -0
- phenostore_sdk_python-0.1.1.dist-info/METADATA +196 -0
- phenostore_sdk_python-0.1.1.dist-info/RECORD +72 -0
- phenostore_sdk_python-0.1.1.dist-info/WHEEL +4 -0
- phenostore_sdk_python-0.1.1.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ... import errors
|
|
8
|
+
from ...client import AuthenticatedClient, Client
|
|
9
|
+
from ...models.bundle import Bundle
|
|
10
|
+
from ...models.operation_outcome import OperationOutcome
|
|
11
|
+
from ...models.resource_type import ResourceType
|
|
12
|
+
from ...models.search_summary_mode import SearchSummaryMode
|
|
13
|
+
from ...models.search_total_mode import SearchTotalMode
|
|
14
|
+
from ...types import UNSET, Response, Unset
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _get_kwargs(
|
|
18
|
+
tenant_id: str,
|
|
19
|
+
store_id: str,
|
|
20
|
+
resource_type: ResourceType,
|
|
21
|
+
*,
|
|
22
|
+
field_count: int | Unset = 20,
|
|
23
|
+
field_offset: int | Unset = 0,
|
|
24
|
+
field_cursor: str | Unset = UNSET,
|
|
25
|
+
field_total: SearchTotalMode | Unset = UNSET,
|
|
26
|
+
field_summary: SearchSummaryMode | Unset = UNSET,
|
|
27
|
+
field_elements: str | Unset = UNSET,
|
|
28
|
+
field_sort: str | Unset = UNSET,
|
|
29
|
+
field_include: list[str] | Unset = UNSET,
|
|
30
|
+
field_revinclude: list[str] | Unset = UNSET,
|
|
31
|
+
) -> dict[str, Any]:
|
|
32
|
+
|
|
33
|
+
params: dict[str, Any] = {}
|
|
34
|
+
|
|
35
|
+
params["_count"] = field_count
|
|
36
|
+
|
|
37
|
+
params["_offset"] = field_offset
|
|
38
|
+
|
|
39
|
+
params["_cursor"] = field_cursor
|
|
40
|
+
|
|
41
|
+
json_field_total: str | Unset = UNSET
|
|
42
|
+
if not isinstance(field_total, Unset):
|
|
43
|
+
json_field_total = field_total.value
|
|
44
|
+
|
|
45
|
+
params["_total"] = json_field_total
|
|
46
|
+
|
|
47
|
+
json_field_summary: str | Unset = UNSET
|
|
48
|
+
if not isinstance(field_summary, Unset):
|
|
49
|
+
json_field_summary = field_summary.value
|
|
50
|
+
|
|
51
|
+
params["_summary"] = json_field_summary
|
|
52
|
+
|
|
53
|
+
params["_elements"] = field_elements
|
|
54
|
+
|
|
55
|
+
params["_sort"] = field_sort
|
|
56
|
+
|
|
57
|
+
json_field_include: list[str] | Unset = UNSET
|
|
58
|
+
if not isinstance(field_include, Unset):
|
|
59
|
+
json_field_include = field_include
|
|
60
|
+
|
|
61
|
+
params["_include"] = json_field_include
|
|
62
|
+
|
|
63
|
+
json_field_revinclude: list[str] | Unset = UNSET
|
|
64
|
+
if not isinstance(field_revinclude, Unset):
|
|
65
|
+
json_field_revinclude = field_revinclude
|
|
66
|
+
|
|
67
|
+
params["_revinclude"] = json_field_revinclude
|
|
68
|
+
|
|
69
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
70
|
+
|
|
71
|
+
_kwargs: dict[str, Any] = {
|
|
72
|
+
"method": "get",
|
|
73
|
+
"url": "/v1/tenants/{tenant_id}/stores/{store_id}/{resource_type}".format(
|
|
74
|
+
tenant_id=quote(str(tenant_id), safe=""),
|
|
75
|
+
store_id=quote(str(store_id), safe=""),
|
|
76
|
+
resource_type=quote(str(resource_type), safe=""),
|
|
77
|
+
),
|
|
78
|
+
"params": params,
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return _kwargs
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def _parse_response(
|
|
85
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
86
|
+
) -> Bundle | OperationOutcome | None:
|
|
87
|
+
if response.status_code == 200:
|
|
88
|
+
response_200 = Bundle.from_dict(response.json())
|
|
89
|
+
|
|
90
|
+
return response_200
|
|
91
|
+
|
|
92
|
+
if response.status_code == 400:
|
|
93
|
+
response_400 = OperationOutcome.from_dict(response.json())
|
|
94
|
+
|
|
95
|
+
return response_400
|
|
96
|
+
|
|
97
|
+
if response.status_code == 403:
|
|
98
|
+
response_403 = OperationOutcome.from_dict(response.json())
|
|
99
|
+
|
|
100
|
+
return response_403
|
|
101
|
+
|
|
102
|
+
if client.raise_on_unexpected_status:
|
|
103
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
104
|
+
else:
|
|
105
|
+
return None
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def _build_response(
|
|
109
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
110
|
+
) -> Response[Bundle | OperationOutcome]:
|
|
111
|
+
return Response(
|
|
112
|
+
status_code=HTTPStatus(response.status_code),
|
|
113
|
+
content=response.content,
|
|
114
|
+
headers=response.headers,
|
|
115
|
+
parsed=_parse_response(client=client, response=response),
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def sync_detailed(
|
|
120
|
+
tenant_id: str,
|
|
121
|
+
store_id: str,
|
|
122
|
+
resource_type: ResourceType,
|
|
123
|
+
*,
|
|
124
|
+
client: AuthenticatedClient | Client,
|
|
125
|
+
field_count: int | Unset = 20,
|
|
126
|
+
field_offset: int | Unset = 0,
|
|
127
|
+
field_cursor: str | Unset = UNSET,
|
|
128
|
+
field_total: SearchTotalMode | Unset = UNSET,
|
|
129
|
+
field_summary: SearchSummaryMode | Unset = UNSET,
|
|
130
|
+
field_elements: str | Unset = UNSET,
|
|
131
|
+
field_sort: str | Unset = UNSET,
|
|
132
|
+
field_include: list[str] | Unset = UNSET,
|
|
133
|
+
field_revinclude: list[str] | Unset = UNSET,
|
|
134
|
+
) -> Response[Bundle | OperationOutcome]:
|
|
135
|
+
"""Search for FHIR resources
|
|
136
|
+
|
|
137
|
+
Searches for resources of the given type. Supports standard FHIR search
|
|
138
|
+
parameters, pagination, sorting, _include/_revinclude, and response shaping.
|
|
139
|
+
Arbitrary FHIR search parameters beyond the named ones below are also accepted,
|
|
140
|
+
including the `:exact` and `:contains` (string) and `:missing` (any type)
|
|
141
|
+
modifiers and chained references (e.g. `subject:Patient.name=Smith`).
|
|
142
|
+
Unrecognized `_`-prefixed control parameters are ignored.
|
|
143
|
+
|
|
144
|
+
Args:
|
|
145
|
+
tenant_id (str):
|
|
146
|
+
store_id (str):
|
|
147
|
+
resource_type (ResourceType): FHIR resource type
|
|
148
|
+
field_count (int | Unset): Default: 20.
|
|
149
|
+
field_offset (int | Unset): Default: 0.
|
|
150
|
+
field_cursor (str | Unset):
|
|
151
|
+
field_total (SearchTotalMode | Unset): FHIR `_total` mode controlling whether a result
|
|
152
|
+
total is returned. These are the three values defined by FHIR R4. `estimate` is accepted
|
|
153
|
+
but currently behaves like `none` (no total is emitted).
|
|
154
|
+
field_summary (SearchSummaryMode | Unset): Search response summary mode
|
|
155
|
+
field_elements (str | Unset):
|
|
156
|
+
field_sort (str | Unset):
|
|
157
|
+
field_include (list[str] | Unset):
|
|
158
|
+
field_revinclude (list[str] | Unset):
|
|
159
|
+
|
|
160
|
+
Raises:
|
|
161
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
162
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
163
|
+
|
|
164
|
+
Returns:
|
|
165
|
+
Response[Bundle | OperationOutcome]
|
|
166
|
+
"""
|
|
167
|
+
|
|
168
|
+
kwargs = _get_kwargs(
|
|
169
|
+
tenant_id=tenant_id,
|
|
170
|
+
store_id=store_id,
|
|
171
|
+
resource_type=resource_type,
|
|
172
|
+
field_count=field_count,
|
|
173
|
+
field_offset=field_offset,
|
|
174
|
+
field_cursor=field_cursor,
|
|
175
|
+
field_total=field_total,
|
|
176
|
+
field_summary=field_summary,
|
|
177
|
+
field_elements=field_elements,
|
|
178
|
+
field_sort=field_sort,
|
|
179
|
+
field_include=field_include,
|
|
180
|
+
field_revinclude=field_revinclude,
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
response = client.get_httpx_client().request(
|
|
184
|
+
**kwargs,
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
return _build_response(client=client, response=response)
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def sync(
|
|
191
|
+
tenant_id: str,
|
|
192
|
+
store_id: str,
|
|
193
|
+
resource_type: ResourceType,
|
|
194
|
+
*,
|
|
195
|
+
client: AuthenticatedClient | Client,
|
|
196
|
+
field_count: int | Unset = 20,
|
|
197
|
+
field_offset: int | Unset = 0,
|
|
198
|
+
field_cursor: str | Unset = UNSET,
|
|
199
|
+
field_total: SearchTotalMode | Unset = UNSET,
|
|
200
|
+
field_summary: SearchSummaryMode | Unset = UNSET,
|
|
201
|
+
field_elements: str | Unset = UNSET,
|
|
202
|
+
field_sort: str | Unset = UNSET,
|
|
203
|
+
field_include: list[str] | Unset = UNSET,
|
|
204
|
+
field_revinclude: list[str] | Unset = UNSET,
|
|
205
|
+
) -> Bundle | OperationOutcome | None:
|
|
206
|
+
"""Search for FHIR resources
|
|
207
|
+
|
|
208
|
+
Searches for resources of the given type. Supports standard FHIR search
|
|
209
|
+
parameters, pagination, sorting, _include/_revinclude, and response shaping.
|
|
210
|
+
Arbitrary FHIR search parameters beyond the named ones below are also accepted,
|
|
211
|
+
including the `:exact` and `:contains` (string) and `:missing` (any type)
|
|
212
|
+
modifiers and chained references (e.g. `subject:Patient.name=Smith`).
|
|
213
|
+
Unrecognized `_`-prefixed control parameters are ignored.
|
|
214
|
+
|
|
215
|
+
Args:
|
|
216
|
+
tenant_id (str):
|
|
217
|
+
store_id (str):
|
|
218
|
+
resource_type (ResourceType): FHIR resource type
|
|
219
|
+
field_count (int | Unset): Default: 20.
|
|
220
|
+
field_offset (int | Unset): Default: 0.
|
|
221
|
+
field_cursor (str | Unset):
|
|
222
|
+
field_total (SearchTotalMode | Unset): FHIR `_total` mode controlling whether a result
|
|
223
|
+
total is returned. These are the three values defined by FHIR R4. `estimate` is accepted
|
|
224
|
+
but currently behaves like `none` (no total is emitted).
|
|
225
|
+
field_summary (SearchSummaryMode | Unset): Search response summary mode
|
|
226
|
+
field_elements (str | Unset):
|
|
227
|
+
field_sort (str | Unset):
|
|
228
|
+
field_include (list[str] | Unset):
|
|
229
|
+
field_revinclude (list[str] | Unset):
|
|
230
|
+
|
|
231
|
+
Raises:
|
|
232
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
233
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
234
|
+
|
|
235
|
+
Returns:
|
|
236
|
+
Bundle | OperationOutcome
|
|
237
|
+
"""
|
|
238
|
+
|
|
239
|
+
return sync_detailed(
|
|
240
|
+
tenant_id=tenant_id,
|
|
241
|
+
store_id=store_id,
|
|
242
|
+
resource_type=resource_type,
|
|
243
|
+
client=client,
|
|
244
|
+
field_count=field_count,
|
|
245
|
+
field_offset=field_offset,
|
|
246
|
+
field_cursor=field_cursor,
|
|
247
|
+
field_total=field_total,
|
|
248
|
+
field_summary=field_summary,
|
|
249
|
+
field_elements=field_elements,
|
|
250
|
+
field_sort=field_sort,
|
|
251
|
+
field_include=field_include,
|
|
252
|
+
field_revinclude=field_revinclude,
|
|
253
|
+
).parsed
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
async def asyncio_detailed(
|
|
257
|
+
tenant_id: str,
|
|
258
|
+
store_id: str,
|
|
259
|
+
resource_type: ResourceType,
|
|
260
|
+
*,
|
|
261
|
+
client: AuthenticatedClient | Client,
|
|
262
|
+
field_count: int | Unset = 20,
|
|
263
|
+
field_offset: int | Unset = 0,
|
|
264
|
+
field_cursor: str | Unset = UNSET,
|
|
265
|
+
field_total: SearchTotalMode | Unset = UNSET,
|
|
266
|
+
field_summary: SearchSummaryMode | Unset = UNSET,
|
|
267
|
+
field_elements: str | Unset = UNSET,
|
|
268
|
+
field_sort: str | Unset = UNSET,
|
|
269
|
+
field_include: list[str] | Unset = UNSET,
|
|
270
|
+
field_revinclude: list[str] | Unset = UNSET,
|
|
271
|
+
) -> Response[Bundle | OperationOutcome]:
|
|
272
|
+
"""Search for FHIR resources
|
|
273
|
+
|
|
274
|
+
Searches for resources of the given type. Supports standard FHIR search
|
|
275
|
+
parameters, pagination, sorting, _include/_revinclude, and response shaping.
|
|
276
|
+
Arbitrary FHIR search parameters beyond the named ones below are also accepted,
|
|
277
|
+
including the `:exact` and `:contains` (string) and `:missing` (any type)
|
|
278
|
+
modifiers and chained references (e.g. `subject:Patient.name=Smith`).
|
|
279
|
+
Unrecognized `_`-prefixed control parameters are ignored.
|
|
280
|
+
|
|
281
|
+
Args:
|
|
282
|
+
tenant_id (str):
|
|
283
|
+
store_id (str):
|
|
284
|
+
resource_type (ResourceType): FHIR resource type
|
|
285
|
+
field_count (int | Unset): Default: 20.
|
|
286
|
+
field_offset (int | Unset): Default: 0.
|
|
287
|
+
field_cursor (str | Unset):
|
|
288
|
+
field_total (SearchTotalMode | Unset): FHIR `_total` mode controlling whether a result
|
|
289
|
+
total is returned. These are the three values defined by FHIR R4. `estimate` is accepted
|
|
290
|
+
but currently behaves like `none` (no total is emitted).
|
|
291
|
+
field_summary (SearchSummaryMode | Unset): Search response summary mode
|
|
292
|
+
field_elements (str | Unset):
|
|
293
|
+
field_sort (str | Unset):
|
|
294
|
+
field_include (list[str] | Unset):
|
|
295
|
+
field_revinclude (list[str] | Unset):
|
|
296
|
+
|
|
297
|
+
Raises:
|
|
298
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
299
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
300
|
+
|
|
301
|
+
Returns:
|
|
302
|
+
Response[Bundle | OperationOutcome]
|
|
303
|
+
"""
|
|
304
|
+
|
|
305
|
+
kwargs = _get_kwargs(
|
|
306
|
+
tenant_id=tenant_id,
|
|
307
|
+
store_id=store_id,
|
|
308
|
+
resource_type=resource_type,
|
|
309
|
+
field_count=field_count,
|
|
310
|
+
field_offset=field_offset,
|
|
311
|
+
field_cursor=field_cursor,
|
|
312
|
+
field_total=field_total,
|
|
313
|
+
field_summary=field_summary,
|
|
314
|
+
field_elements=field_elements,
|
|
315
|
+
field_sort=field_sort,
|
|
316
|
+
field_include=field_include,
|
|
317
|
+
field_revinclude=field_revinclude,
|
|
318
|
+
)
|
|
319
|
+
|
|
320
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
321
|
+
|
|
322
|
+
return _build_response(client=client, response=response)
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
async def asyncio(
|
|
326
|
+
tenant_id: str,
|
|
327
|
+
store_id: str,
|
|
328
|
+
resource_type: ResourceType,
|
|
329
|
+
*,
|
|
330
|
+
client: AuthenticatedClient | Client,
|
|
331
|
+
field_count: int | Unset = 20,
|
|
332
|
+
field_offset: int | Unset = 0,
|
|
333
|
+
field_cursor: str | Unset = UNSET,
|
|
334
|
+
field_total: SearchTotalMode | Unset = UNSET,
|
|
335
|
+
field_summary: SearchSummaryMode | Unset = UNSET,
|
|
336
|
+
field_elements: str | Unset = UNSET,
|
|
337
|
+
field_sort: str | Unset = UNSET,
|
|
338
|
+
field_include: list[str] | Unset = UNSET,
|
|
339
|
+
field_revinclude: list[str] | Unset = UNSET,
|
|
340
|
+
) -> Bundle | OperationOutcome | None:
|
|
341
|
+
"""Search for FHIR resources
|
|
342
|
+
|
|
343
|
+
Searches for resources of the given type. Supports standard FHIR search
|
|
344
|
+
parameters, pagination, sorting, _include/_revinclude, and response shaping.
|
|
345
|
+
Arbitrary FHIR search parameters beyond the named ones below are also accepted,
|
|
346
|
+
including the `:exact` and `:contains` (string) and `:missing` (any type)
|
|
347
|
+
modifiers and chained references (e.g. `subject:Patient.name=Smith`).
|
|
348
|
+
Unrecognized `_`-prefixed control parameters are ignored.
|
|
349
|
+
|
|
350
|
+
Args:
|
|
351
|
+
tenant_id (str):
|
|
352
|
+
store_id (str):
|
|
353
|
+
resource_type (ResourceType): FHIR resource type
|
|
354
|
+
field_count (int | Unset): Default: 20.
|
|
355
|
+
field_offset (int | Unset): Default: 0.
|
|
356
|
+
field_cursor (str | Unset):
|
|
357
|
+
field_total (SearchTotalMode | Unset): FHIR `_total` mode controlling whether a result
|
|
358
|
+
total is returned. These are the three values defined by FHIR R4. `estimate` is accepted
|
|
359
|
+
but currently behaves like `none` (no total is emitted).
|
|
360
|
+
field_summary (SearchSummaryMode | Unset): Search response summary mode
|
|
361
|
+
field_elements (str | Unset):
|
|
362
|
+
field_sort (str | Unset):
|
|
363
|
+
field_include (list[str] | Unset):
|
|
364
|
+
field_revinclude (list[str] | Unset):
|
|
365
|
+
|
|
366
|
+
Raises:
|
|
367
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
368
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
369
|
+
|
|
370
|
+
Returns:
|
|
371
|
+
Bundle | OperationOutcome
|
|
372
|
+
"""
|
|
373
|
+
|
|
374
|
+
return (
|
|
375
|
+
await asyncio_detailed(
|
|
376
|
+
tenant_id=tenant_id,
|
|
377
|
+
store_id=store_id,
|
|
378
|
+
resource_type=resource_type,
|
|
379
|
+
client=client,
|
|
380
|
+
field_count=field_count,
|
|
381
|
+
field_offset=field_offset,
|
|
382
|
+
field_cursor=field_cursor,
|
|
383
|
+
field_total=field_total,
|
|
384
|
+
field_summary=field_summary,
|
|
385
|
+
field_elements=field_elements,
|
|
386
|
+
field_sort=field_sort,
|
|
387
|
+
field_include=field_include,
|
|
388
|
+
field_revinclude=field_revinclude,
|
|
389
|
+
)
|
|
390
|
+
).parsed
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ... import errors
|
|
8
|
+
from ...client import AuthenticatedClient, Client
|
|
9
|
+
from ...models.bundle import Bundle
|
|
10
|
+
from ...models.operation_outcome import OperationOutcome
|
|
11
|
+
from ...models.resource_type import ResourceType
|
|
12
|
+
from ...models.search_resources_post_body import SearchResourcesPostBody
|
|
13
|
+
from ...types import UNSET, Response, Unset
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _get_kwargs(
|
|
17
|
+
tenant_id: str,
|
|
18
|
+
store_id: str,
|
|
19
|
+
resource_type: ResourceType,
|
|
20
|
+
*,
|
|
21
|
+
body: SearchResourcesPostBody | Unset = UNSET,
|
|
22
|
+
) -> dict[str, Any]:
|
|
23
|
+
headers: dict[str, Any] = {}
|
|
24
|
+
|
|
25
|
+
_kwargs: dict[str, Any] = {
|
|
26
|
+
"method": "post",
|
|
27
|
+
"url": "/v1/tenants/{tenant_id}/stores/{store_id}/{resource_type}/_search".format(
|
|
28
|
+
tenant_id=quote(str(tenant_id), safe=""),
|
|
29
|
+
store_id=quote(str(store_id), safe=""),
|
|
30
|
+
resource_type=quote(str(resource_type), safe=""),
|
|
31
|
+
),
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if not isinstance(body, Unset):
|
|
35
|
+
_kwargs["data"] = body.to_dict()
|
|
36
|
+
headers["Content-Type"] = "application/x-www-form-urlencoded"
|
|
37
|
+
|
|
38
|
+
_kwargs["headers"] = headers
|
|
39
|
+
return _kwargs
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def _parse_response(
|
|
43
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
44
|
+
) -> Bundle | OperationOutcome | None:
|
|
45
|
+
if response.status_code == 200:
|
|
46
|
+
response_200 = Bundle.from_dict(response.json())
|
|
47
|
+
|
|
48
|
+
return response_200
|
|
49
|
+
|
|
50
|
+
if response.status_code == 400:
|
|
51
|
+
response_400 = OperationOutcome.from_dict(response.json())
|
|
52
|
+
|
|
53
|
+
return response_400
|
|
54
|
+
|
|
55
|
+
if response.status_code == 403:
|
|
56
|
+
response_403 = OperationOutcome.from_dict(response.json())
|
|
57
|
+
|
|
58
|
+
return response_403
|
|
59
|
+
|
|
60
|
+
if client.raise_on_unexpected_status:
|
|
61
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
62
|
+
else:
|
|
63
|
+
return None
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def _build_response(
|
|
67
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
68
|
+
) -> Response[Bundle | OperationOutcome]:
|
|
69
|
+
return Response(
|
|
70
|
+
status_code=HTTPStatus(response.status_code),
|
|
71
|
+
content=response.content,
|
|
72
|
+
headers=response.headers,
|
|
73
|
+
parsed=_parse_response(client=client, response=response),
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def sync_detailed(
|
|
78
|
+
tenant_id: str,
|
|
79
|
+
store_id: str,
|
|
80
|
+
resource_type: ResourceType,
|
|
81
|
+
*,
|
|
82
|
+
client: AuthenticatedClient | Client,
|
|
83
|
+
body: SearchResourcesPostBody | Unset = UNSET,
|
|
84
|
+
) -> Response[Bundle | OperationOutcome]:
|
|
85
|
+
"""Search for FHIR resources (POST)
|
|
86
|
+
|
|
87
|
+
Same as GET search but parameters are sent via form-encoded POST body.
|
|
88
|
+
URL query parameters and form body parameters are merged.
|
|
89
|
+
|
|
90
|
+
Args:
|
|
91
|
+
tenant_id (str):
|
|
92
|
+
store_id (str):
|
|
93
|
+
resource_type (ResourceType): FHIR resource type
|
|
94
|
+
body (SearchResourcesPostBody | Unset):
|
|
95
|
+
|
|
96
|
+
Raises:
|
|
97
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
98
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
99
|
+
|
|
100
|
+
Returns:
|
|
101
|
+
Response[Bundle | OperationOutcome]
|
|
102
|
+
"""
|
|
103
|
+
|
|
104
|
+
kwargs = _get_kwargs(
|
|
105
|
+
tenant_id=tenant_id,
|
|
106
|
+
store_id=store_id,
|
|
107
|
+
resource_type=resource_type,
|
|
108
|
+
body=body,
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
response = client.get_httpx_client().request(
|
|
112
|
+
**kwargs,
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
return _build_response(client=client, response=response)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def sync(
|
|
119
|
+
tenant_id: str,
|
|
120
|
+
store_id: str,
|
|
121
|
+
resource_type: ResourceType,
|
|
122
|
+
*,
|
|
123
|
+
client: AuthenticatedClient | Client,
|
|
124
|
+
body: SearchResourcesPostBody | Unset = UNSET,
|
|
125
|
+
) -> Bundle | OperationOutcome | None:
|
|
126
|
+
"""Search for FHIR resources (POST)
|
|
127
|
+
|
|
128
|
+
Same as GET search but parameters are sent via form-encoded POST body.
|
|
129
|
+
URL query parameters and form body parameters are merged.
|
|
130
|
+
|
|
131
|
+
Args:
|
|
132
|
+
tenant_id (str):
|
|
133
|
+
store_id (str):
|
|
134
|
+
resource_type (ResourceType): FHIR resource type
|
|
135
|
+
body (SearchResourcesPostBody | Unset):
|
|
136
|
+
|
|
137
|
+
Raises:
|
|
138
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
139
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
140
|
+
|
|
141
|
+
Returns:
|
|
142
|
+
Bundle | OperationOutcome
|
|
143
|
+
"""
|
|
144
|
+
|
|
145
|
+
return sync_detailed(
|
|
146
|
+
tenant_id=tenant_id,
|
|
147
|
+
store_id=store_id,
|
|
148
|
+
resource_type=resource_type,
|
|
149
|
+
client=client,
|
|
150
|
+
body=body,
|
|
151
|
+
).parsed
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
async def asyncio_detailed(
|
|
155
|
+
tenant_id: str,
|
|
156
|
+
store_id: str,
|
|
157
|
+
resource_type: ResourceType,
|
|
158
|
+
*,
|
|
159
|
+
client: AuthenticatedClient | Client,
|
|
160
|
+
body: SearchResourcesPostBody | Unset = UNSET,
|
|
161
|
+
) -> Response[Bundle | OperationOutcome]:
|
|
162
|
+
"""Search for FHIR resources (POST)
|
|
163
|
+
|
|
164
|
+
Same as GET search but parameters are sent via form-encoded POST body.
|
|
165
|
+
URL query parameters and form body parameters are merged.
|
|
166
|
+
|
|
167
|
+
Args:
|
|
168
|
+
tenant_id (str):
|
|
169
|
+
store_id (str):
|
|
170
|
+
resource_type (ResourceType): FHIR resource type
|
|
171
|
+
body (SearchResourcesPostBody | Unset):
|
|
172
|
+
|
|
173
|
+
Raises:
|
|
174
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
175
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
176
|
+
|
|
177
|
+
Returns:
|
|
178
|
+
Response[Bundle | OperationOutcome]
|
|
179
|
+
"""
|
|
180
|
+
|
|
181
|
+
kwargs = _get_kwargs(
|
|
182
|
+
tenant_id=tenant_id,
|
|
183
|
+
store_id=store_id,
|
|
184
|
+
resource_type=resource_type,
|
|
185
|
+
body=body,
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
189
|
+
|
|
190
|
+
return _build_response(client=client, response=response)
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
async def asyncio(
|
|
194
|
+
tenant_id: str,
|
|
195
|
+
store_id: str,
|
|
196
|
+
resource_type: ResourceType,
|
|
197
|
+
*,
|
|
198
|
+
client: AuthenticatedClient | Client,
|
|
199
|
+
body: SearchResourcesPostBody | Unset = UNSET,
|
|
200
|
+
) -> Bundle | OperationOutcome | None:
|
|
201
|
+
"""Search for FHIR resources (POST)
|
|
202
|
+
|
|
203
|
+
Same as GET search but parameters are sent via form-encoded POST body.
|
|
204
|
+
URL query parameters and form body parameters are merged.
|
|
205
|
+
|
|
206
|
+
Args:
|
|
207
|
+
tenant_id (str):
|
|
208
|
+
store_id (str):
|
|
209
|
+
resource_type (ResourceType): FHIR resource type
|
|
210
|
+
body (SearchResourcesPostBody | Unset):
|
|
211
|
+
|
|
212
|
+
Raises:
|
|
213
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
214
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
215
|
+
|
|
216
|
+
Returns:
|
|
217
|
+
Bundle | OperationOutcome
|
|
218
|
+
"""
|
|
219
|
+
|
|
220
|
+
return (
|
|
221
|
+
await asyncio_detailed(
|
|
222
|
+
tenant_id=tenant_id,
|
|
223
|
+
store_id=store_id,
|
|
224
|
+
resource_type=resource_type,
|
|
225
|
+
client=client,
|
|
226
|
+
body=body,
|
|
227
|
+
)
|
|
228
|
+
).parsed
|