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,281 @@
|
|
|
1
|
+
import datetime
|
|
2
|
+
from http import HTTPStatus
|
|
3
|
+
from typing import Any
|
|
4
|
+
from urllib.parse import quote
|
|
5
|
+
|
|
6
|
+
import httpx
|
|
7
|
+
|
|
8
|
+
from ... import errors
|
|
9
|
+
from ...client import AuthenticatedClient, Client
|
|
10
|
+
from ...models.bundle import Bundle
|
|
11
|
+
from ...models.operation_outcome import OperationOutcome
|
|
12
|
+
from ...models.search_total_mode import SearchTotalMode
|
|
13
|
+
from ...types import UNSET, Response, Unset
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _get_kwargs(
|
|
17
|
+
tenant_id: str,
|
|
18
|
+
store_id: str,
|
|
19
|
+
*,
|
|
20
|
+
patient: str,
|
|
21
|
+
start: datetime.date | Unset = UNSET,
|
|
22
|
+
end: datetime.date | Unset = UNSET,
|
|
23
|
+
type_: str | Unset = UNSET,
|
|
24
|
+
field_total: SearchTotalMode | Unset = UNSET,
|
|
25
|
+
) -> dict[str, Any]:
|
|
26
|
+
|
|
27
|
+
params: dict[str, Any] = {}
|
|
28
|
+
|
|
29
|
+
params["patient"] = patient
|
|
30
|
+
|
|
31
|
+
json_start: str | Unset = UNSET
|
|
32
|
+
if not isinstance(start, Unset):
|
|
33
|
+
json_start = start.isoformat()
|
|
34
|
+
params["start"] = json_start
|
|
35
|
+
|
|
36
|
+
json_end: str | Unset = UNSET
|
|
37
|
+
if not isinstance(end, Unset):
|
|
38
|
+
json_end = end.isoformat()
|
|
39
|
+
params["end"] = json_end
|
|
40
|
+
|
|
41
|
+
params["type"] = type_
|
|
42
|
+
|
|
43
|
+
json_field_total: str | Unset = UNSET
|
|
44
|
+
if not isinstance(field_total, Unset):
|
|
45
|
+
json_field_total = field_total.value
|
|
46
|
+
|
|
47
|
+
params["_total"] = json_field_total
|
|
48
|
+
|
|
49
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
50
|
+
|
|
51
|
+
_kwargs: dict[str, Any] = {
|
|
52
|
+
"method": "get",
|
|
53
|
+
"url": "/v1/tenants/{tenant_id}/stores/{store_id}/DocumentReference/$docref".format(
|
|
54
|
+
tenant_id=quote(str(tenant_id), safe=""),
|
|
55
|
+
store_id=quote(str(store_id), safe=""),
|
|
56
|
+
),
|
|
57
|
+
"params": params,
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return _kwargs
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _parse_response(
|
|
64
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
65
|
+
) -> Bundle | OperationOutcome | None:
|
|
66
|
+
if response.status_code == 200:
|
|
67
|
+
response_200 = Bundle.from_dict(response.json())
|
|
68
|
+
|
|
69
|
+
return response_200
|
|
70
|
+
|
|
71
|
+
if response.status_code == 400:
|
|
72
|
+
response_400 = OperationOutcome.from_dict(response.json())
|
|
73
|
+
|
|
74
|
+
return response_400
|
|
75
|
+
|
|
76
|
+
if response.status_code == 403:
|
|
77
|
+
response_403 = OperationOutcome.from_dict(response.json())
|
|
78
|
+
|
|
79
|
+
return response_403
|
|
80
|
+
|
|
81
|
+
if client.raise_on_unexpected_status:
|
|
82
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
83
|
+
else:
|
|
84
|
+
return None
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def _build_response(
|
|
88
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
89
|
+
) -> Response[Bundle | OperationOutcome]:
|
|
90
|
+
return Response(
|
|
91
|
+
status_code=HTTPStatus(response.status_code),
|
|
92
|
+
content=response.content,
|
|
93
|
+
headers=response.headers,
|
|
94
|
+
parsed=_parse_response(client=client, response=response),
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def sync_detailed(
|
|
99
|
+
tenant_id: str,
|
|
100
|
+
store_id: str,
|
|
101
|
+
*,
|
|
102
|
+
client: AuthenticatedClient | Client,
|
|
103
|
+
patient: str,
|
|
104
|
+
start: datetime.date | Unset = UNSET,
|
|
105
|
+
end: datetime.date | Unset = UNSET,
|
|
106
|
+
type_: str | Unset = UNSET,
|
|
107
|
+
field_total: SearchTotalMode | Unset = UNSET,
|
|
108
|
+
) -> Response[Bundle | OperationOutcome]:
|
|
109
|
+
"""US Core $docref operation (GET)
|
|
110
|
+
|
|
111
|
+
Args:
|
|
112
|
+
tenant_id (str):
|
|
113
|
+
store_id (str):
|
|
114
|
+
patient (str):
|
|
115
|
+
start (datetime.date | Unset):
|
|
116
|
+
end (datetime.date | Unset):
|
|
117
|
+
type_ (str | Unset):
|
|
118
|
+
field_total (SearchTotalMode | Unset): FHIR `_total` mode controlling whether a result
|
|
119
|
+
total is returned. These are the three values defined by FHIR R4. `estimate` is accepted
|
|
120
|
+
but currently behaves like `none` (no total is emitted).
|
|
121
|
+
|
|
122
|
+
Raises:
|
|
123
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
124
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
125
|
+
|
|
126
|
+
Returns:
|
|
127
|
+
Response[Bundle | OperationOutcome]
|
|
128
|
+
"""
|
|
129
|
+
|
|
130
|
+
kwargs = _get_kwargs(
|
|
131
|
+
tenant_id=tenant_id,
|
|
132
|
+
store_id=store_id,
|
|
133
|
+
patient=patient,
|
|
134
|
+
start=start,
|
|
135
|
+
end=end,
|
|
136
|
+
type_=type_,
|
|
137
|
+
field_total=field_total,
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
response = client.get_httpx_client().request(
|
|
141
|
+
**kwargs,
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
return _build_response(client=client, response=response)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def sync(
|
|
148
|
+
tenant_id: str,
|
|
149
|
+
store_id: str,
|
|
150
|
+
*,
|
|
151
|
+
client: AuthenticatedClient | Client,
|
|
152
|
+
patient: str,
|
|
153
|
+
start: datetime.date | Unset = UNSET,
|
|
154
|
+
end: datetime.date | Unset = UNSET,
|
|
155
|
+
type_: str | Unset = UNSET,
|
|
156
|
+
field_total: SearchTotalMode | Unset = UNSET,
|
|
157
|
+
) -> Bundle | OperationOutcome | None:
|
|
158
|
+
"""US Core $docref operation (GET)
|
|
159
|
+
|
|
160
|
+
Args:
|
|
161
|
+
tenant_id (str):
|
|
162
|
+
store_id (str):
|
|
163
|
+
patient (str):
|
|
164
|
+
start (datetime.date | Unset):
|
|
165
|
+
end (datetime.date | Unset):
|
|
166
|
+
type_ (str | Unset):
|
|
167
|
+
field_total (SearchTotalMode | Unset): FHIR `_total` mode controlling whether a result
|
|
168
|
+
total is returned. These are the three values defined by FHIR R4. `estimate` is accepted
|
|
169
|
+
but currently behaves like `none` (no total is emitted).
|
|
170
|
+
|
|
171
|
+
Raises:
|
|
172
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
173
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
174
|
+
|
|
175
|
+
Returns:
|
|
176
|
+
Bundle | OperationOutcome
|
|
177
|
+
"""
|
|
178
|
+
|
|
179
|
+
return sync_detailed(
|
|
180
|
+
tenant_id=tenant_id,
|
|
181
|
+
store_id=store_id,
|
|
182
|
+
client=client,
|
|
183
|
+
patient=patient,
|
|
184
|
+
start=start,
|
|
185
|
+
end=end,
|
|
186
|
+
type_=type_,
|
|
187
|
+
field_total=field_total,
|
|
188
|
+
).parsed
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
async def asyncio_detailed(
|
|
192
|
+
tenant_id: str,
|
|
193
|
+
store_id: str,
|
|
194
|
+
*,
|
|
195
|
+
client: AuthenticatedClient | Client,
|
|
196
|
+
patient: str,
|
|
197
|
+
start: datetime.date | Unset = UNSET,
|
|
198
|
+
end: datetime.date | Unset = UNSET,
|
|
199
|
+
type_: str | Unset = UNSET,
|
|
200
|
+
field_total: SearchTotalMode | Unset = UNSET,
|
|
201
|
+
) -> Response[Bundle | OperationOutcome]:
|
|
202
|
+
"""US Core $docref operation (GET)
|
|
203
|
+
|
|
204
|
+
Args:
|
|
205
|
+
tenant_id (str):
|
|
206
|
+
store_id (str):
|
|
207
|
+
patient (str):
|
|
208
|
+
start (datetime.date | Unset):
|
|
209
|
+
end (datetime.date | Unset):
|
|
210
|
+
type_ (str | Unset):
|
|
211
|
+
field_total (SearchTotalMode | Unset): FHIR `_total` mode controlling whether a result
|
|
212
|
+
total is returned. These are the three values defined by FHIR R4. `estimate` is accepted
|
|
213
|
+
but currently behaves like `none` (no total is emitted).
|
|
214
|
+
|
|
215
|
+
Raises:
|
|
216
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
217
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
218
|
+
|
|
219
|
+
Returns:
|
|
220
|
+
Response[Bundle | OperationOutcome]
|
|
221
|
+
"""
|
|
222
|
+
|
|
223
|
+
kwargs = _get_kwargs(
|
|
224
|
+
tenant_id=tenant_id,
|
|
225
|
+
store_id=store_id,
|
|
226
|
+
patient=patient,
|
|
227
|
+
start=start,
|
|
228
|
+
end=end,
|
|
229
|
+
type_=type_,
|
|
230
|
+
field_total=field_total,
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
234
|
+
|
|
235
|
+
return _build_response(client=client, response=response)
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
async def asyncio(
|
|
239
|
+
tenant_id: str,
|
|
240
|
+
store_id: str,
|
|
241
|
+
*,
|
|
242
|
+
client: AuthenticatedClient | Client,
|
|
243
|
+
patient: str,
|
|
244
|
+
start: datetime.date | Unset = UNSET,
|
|
245
|
+
end: datetime.date | Unset = UNSET,
|
|
246
|
+
type_: str | Unset = UNSET,
|
|
247
|
+
field_total: SearchTotalMode | Unset = UNSET,
|
|
248
|
+
) -> Bundle | OperationOutcome | None:
|
|
249
|
+
"""US Core $docref operation (GET)
|
|
250
|
+
|
|
251
|
+
Args:
|
|
252
|
+
tenant_id (str):
|
|
253
|
+
store_id (str):
|
|
254
|
+
patient (str):
|
|
255
|
+
start (datetime.date | Unset):
|
|
256
|
+
end (datetime.date | Unset):
|
|
257
|
+
type_ (str | Unset):
|
|
258
|
+
field_total (SearchTotalMode | Unset): FHIR `_total` mode controlling whether a result
|
|
259
|
+
total is returned. These are the three values defined by FHIR R4. `estimate` is accepted
|
|
260
|
+
but currently behaves like `none` (no total is emitted).
|
|
261
|
+
|
|
262
|
+
Raises:
|
|
263
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
264
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
265
|
+
|
|
266
|
+
Returns:
|
|
267
|
+
Bundle | OperationOutcome
|
|
268
|
+
"""
|
|
269
|
+
|
|
270
|
+
return (
|
|
271
|
+
await asyncio_detailed(
|
|
272
|
+
tenant_id=tenant_id,
|
|
273
|
+
store_id=store_id,
|
|
274
|
+
client=client,
|
|
275
|
+
patient=patient,
|
|
276
|
+
start=start,
|
|
277
|
+
end=end,
|
|
278
|
+
type_=type_,
|
|
279
|
+
field_total=field_total,
|
|
280
|
+
)
|
|
281
|
+
).parsed
|
|
@@ -0,0 +1,185 @@
|
|
|
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.fhir_resource import FhirResource
|
|
10
|
+
from ...types import Response
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _get_kwargs(
|
|
14
|
+
tenant_id: str,
|
|
15
|
+
store_id: str,
|
|
16
|
+
) -> dict[str, Any]:
|
|
17
|
+
|
|
18
|
+
_kwargs: dict[str, Any] = {
|
|
19
|
+
"method": "get",
|
|
20
|
+
"url": "/v1/tenants/{tenant_id}/stores/{store_id}/metadata".format(
|
|
21
|
+
tenant_id=quote(str(tenant_id), safe=""),
|
|
22
|
+
store_id=quote(str(store_id), safe=""),
|
|
23
|
+
),
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return _kwargs
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _parse_response(
|
|
30
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
31
|
+
) -> FhirResource | None:
|
|
32
|
+
if response.status_code == 200:
|
|
33
|
+
response_200 = FhirResource.from_dict(response.json())
|
|
34
|
+
|
|
35
|
+
return response_200
|
|
36
|
+
|
|
37
|
+
if client.raise_on_unexpected_status:
|
|
38
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
39
|
+
else:
|
|
40
|
+
return None
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _build_response(
|
|
44
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
45
|
+
) -> Response[FhirResource]:
|
|
46
|
+
return Response(
|
|
47
|
+
status_code=HTTPStatus(response.status_code),
|
|
48
|
+
content=response.content,
|
|
49
|
+
headers=response.headers,
|
|
50
|
+
parsed=_parse_response(client=client, response=response),
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def sync_detailed(
|
|
55
|
+
tenant_id: str,
|
|
56
|
+
store_id: str,
|
|
57
|
+
*,
|
|
58
|
+
client: AuthenticatedClient | Client,
|
|
59
|
+
) -> Response[FhirResource]:
|
|
60
|
+
"""FHIR CapabilityStatement
|
|
61
|
+
|
|
62
|
+
Returns the server's FHIR R4 CapabilityStatement, including supported resource and
|
|
63
|
+
system interactions, search parameters, versioning behavior, and SMART on FHIR
|
|
64
|
+
authentication requirements.
|
|
65
|
+
|
|
66
|
+
Args:
|
|
67
|
+
tenant_id (str):
|
|
68
|
+
store_id (str):
|
|
69
|
+
|
|
70
|
+
Raises:
|
|
71
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
72
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
73
|
+
|
|
74
|
+
Returns:
|
|
75
|
+
Response[FhirResource]
|
|
76
|
+
"""
|
|
77
|
+
|
|
78
|
+
kwargs = _get_kwargs(
|
|
79
|
+
tenant_id=tenant_id,
|
|
80
|
+
store_id=store_id,
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
response = client.get_httpx_client().request(
|
|
84
|
+
**kwargs,
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
return _build_response(client=client, response=response)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def sync(
|
|
91
|
+
tenant_id: str,
|
|
92
|
+
store_id: str,
|
|
93
|
+
*,
|
|
94
|
+
client: AuthenticatedClient | Client,
|
|
95
|
+
) -> FhirResource | None:
|
|
96
|
+
"""FHIR CapabilityStatement
|
|
97
|
+
|
|
98
|
+
Returns the server's FHIR R4 CapabilityStatement, including supported resource and
|
|
99
|
+
system interactions, search parameters, versioning behavior, and SMART on FHIR
|
|
100
|
+
authentication requirements.
|
|
101
|
+
|
|
102
|
+
Args:
|
|
103
|
+
tenant_id (str):
|
|
104
|
+
store_id (str):
|
|
105
|
+
|
|
106
|
+
Raises:
|
|
107
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
108
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
109
|
+
|
|
110
|
+
Returns:
|
|
111
|
+
FhirResource
|
|
112
|
+
"""
|
|
113
|
+
|
|
114
|
+
return sync_detailed(
|
|
115
|
+
tenant_id=tenant_id,
|
|
116
|
+
store_id=store_id,
|
|
117
|
+
client=client,
|
|
118
|
+
).parsed
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
async def asyncio_detailed(
|
|
122
|
+
tenant_id: str,
|
|
123
|
+
store_id: str,
|
|
124
|
+
*,
|
|
125
|
+
client: AuthenticatedClient | Client,
|
|
126
|
+
) -> Response[FhirResource]:
|
|
127
|
+
"""FHIR CapabilityStatement
|
|
128
|
+
|
|
129
|
+
Returns the server's FHIR R4 CapabilityStatement, including supported resource and
|
|
130
|
+
system interactions, search parameters, versioning behavior, and SMART on FHIR
|
|
131
|
+
authentication requirements.
|
|
132
|
+
|
|
133
|
+
Args:
|
|
134
|
+
tenant_id (str):
|
|
135
|
+
store_id (str):
|
|
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
|
+
Response[FhirResource]
|
|
143
|
+
"""
|
|
144
|
+
|
|
145
|
+
kwargs = _get_kwargs(
|
|
146
|
+
tenant_id=tenant_id,
|
|
147
|
+
store_id=store_id,
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
151
|
+
|
|
152
|
+
return _build_response(client=client, response=response)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
async def asyncio(
|
|
156
|
+
tenant_id: str,
|
|
157
|
+
store_id: str,
|
|
158
|
+
*,
|
|
159
|
+
client: AuthenticatedClient | Client,
|
|
160
|
+
) -> FhirResource | None:
|
|
161
|
+
"""FHIR CapabilityStatement
|
|
162
|
+
|
|
163
|
+
Returns the server's FHIR R4 CapabilityStatement, including supported resource and
|
|
164
|
+
system interactions, search parameters, versioning behavior, and SMART on FHIR
|
|
165
|
+
authentication requirements.
|
|
166
|
+
|
|
167
|
+
Args:
|
|
168
|
+
tenant_id (str):
|
|
169
|
+
store_id (str):
|
|
170
|
+
|
|
171
|
+
Raises:
|
|
172
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
173
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
174
|
+
|
|
175
|
+
Returns:
|
|
176
|
+
FhirResource
|
|
177
|
+
"""
|
|
178
|
+
|
|
179
|
+
return (
|
|
180
|
+
await asyncio_detailed(
|
|
181
|
+
tenant_id=tenant_id,
|
|
182
|
+
store_id=store_id,
|
|
183
|
+
client=client,
|
|
184
|
+
)
|
|
185
|
+
).parsed
|
|
@@ -0,0 +1,240 @@
|
|
|
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 ...types import UNSET, Response, Unset
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _get_kwargs(
|
|
16
|
+
tenant_id: str,
|
|
17
|
+
store_id: str,
|
|
18
|
+
resource_type: ResourceType,
|
|
19
|
+
id: str,
|
|
20
|
+
*,
|
|
21
|
+
field_count: int | Unset = 20,
|
|
22
|
+
field_offset: int | Unset = 0,
|
|
23
|
+
) -> dict[str, Any]:
|
|
24
|
+
|
|
25
|
+
params: dict[str, Any] = {}
|
|
26
|
+
|
|
27
|
+
params["_count"] = field_count
|
|
28
|
+
|
|
29
|
+
params["_offset"] = field_offset
|
|
30
|
+
|
|
31
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
32
|
+
|
|
33
|
+
_kwargs: dict[str, Any] = {
|
|
34
|
+
"method": "get",
|
|
35
|
+
"url": "/v1/tenants/{tenant_id}/stores/{store_id}/{resource_type}/{id}/_history".format(
|
|
36
|
+
tenant_id=quote(str(tenant_id), safe=""),
|
|
37
|
+
store_id=quote(str(store_id), safe=""),
|
|
38
|
+
resource_type=quote(str(resource_type), safe=""),
|
|
39
|
+
id=quote(str(id), safe=""),
|
|
40
|
+
),
|
|
41
|
+
"params": params,
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return _kwargs
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def _parse_response(
|
|
48
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
49
|
+
) -> Bundle | OperationOutcome | None:
|
|
50
|
+
if response.status_code == 200:
|
|
51
|
+
response_200 = Bundle.from_dict(response.json())
|
|
52
|
+
|
|
53
|
+
return response_200
|
|
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
|
+
id: str,
|
|
82
|
+
*,
|
|
83
|
+
client: AuthenticatedClient | Client,
|
|
84
|
+
field_count: int | Unset = 20,
|
|
85
|
+
field_offset: int | Unset = 0,
|
|
86
|
+
) -> Response[Bundle | OperationOutcome]:
|
|
87
|
+
"""Get resource instance history
|
|
88
|
+
|
|
89
|
+
Args:
|
|
90
|
+
tenant_id (str):
|
|
91
|
+
store_id (str):
|
|
92
|
+
resource_type (ResourceType): FHIR resource type
|
|
93
|
+
id (str):
|
|
94
|
+
field_count (int | Unset): Default: 20.
|
|
95
|
+
field_offset (int | Unset): Default: 0.
|
|
96
|
+
|
|
97
|
+
Raises:
|
|
98
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
99
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
100
|
+
|
|
101
|
+
Returns:
|
|
102
|
+
Response[Bundle | OperationOutcome]
|
|
103
|
+
"""
|
|
104
|
+
|
|
105
|
+
kwargs = _get_kwargs(
|
|
106
|
+
tenant_id=tenant_id,
|
|
107
|
+
store_id=store_id,
|
|
108
|
+
resource_type=resource_type,
|
|
109
|
+
id=id,
|
|
110
|
+
field_count=field_count,
|
|
111
|
+
field_offset=field_offset,
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
response = client.get_httpx_client().request(
|
|
115
|
+
**kwargs,
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
return _build_response(client=client, response=response)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def sync(
|
|
122
|
+
tenant_id: str,
|
|
123
|
+
store_id: str,
|
|
124
|
+
resource_type: ResourceType,
|
|
125
|
+
id: str,
|
|
126
|
+
*,
|
|
127
|
+
client: AuthenticatedClient | Client,
|
|
128
|
+
field_count: int | Unset = 20,
|
|
129
|
+
field_offset: int | Unset = 0,
|
|
130
|
+
) -> Bundle | OperationOutcome | None:
|
|
131
|
+
"""Get resource instance history
|
|
132
|
+
|
|
133
|
+
Args:
|
|
134
|
+
tenant_id (str):
|
|
135
|
+
store_id (str):
|
|
136
|
+
resource_type (ResourceType): FHIR resource type
|
|
137
|
+
id (str):
|
|
138
|
+
field_count (int | Unset): Default: 20.
|
|
139
|
+
field_offset (int | Unset): Default: 0.
|
|
140
|
+
|
|
141
|
+
Raises:
|
|
142
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
143
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
144
|
+
|
|
145
|
+
Returns:
|
|
146
|
+
Bundle | OperationOutcome
|
|
147
|
+
"""
|
|
148
|
+
|
|
149
|
+
return sync_detailed(
|
|
150
|
+
tenant_id=tenant_id,
|
|
151
|
+
store_id=store_id,
|
|
152
|
+
resource_type=resource_type,
|
|
153
|
+
id=id,
|
|
154
|
+
client=client,
|
|
155
|
+
field_count=field_count,
|
|
156
|
+
field_offset=field_offset,
|
|
157
|
+
).parsed
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
async def asyncio_detailed(
|
|
161
|
+
tenant_id: str,
|
|
162
|
+
store_id: str,
|
|
163
|
+
resource_type: ResourceType,
|
|
164
|
+
id: str,
|
|
165
|
+
*,
|
|
166
|
+
client: AuthenticatedClient | Client,
|
|
167
|
+
field_count: int | Unset = 20,
|
|
168
|
+
field_offset: int | Unset = 0,
|
|
169
|
+
) -> Response[Bundle | OperationOutcome]:
|
|
170
|
+
"""Get resource instance history
|
|
171
|
+
|
|
172
|
+
Args:
|
|
173
|
+
tenant_id (str):
|
|
174
|
+
store_id (str):
|
|
175
|
+
resource_type (ResourceType): FHIR resource type
|
|
176
|
+
id (str):
|
|
177
|
+
field_count (int | Unset): Default: 20.
|
|
178
|
+
field_offset (int | Unset): Default: 0.
|
|
179
|
+
|
|
180
|
+
Raises:
|
|
181
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
182
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
183
|
+
|
|
184
|
+
Returns:
|
|
185
|
+
Response[Bundle | OperationOutcome]
|
|
186
|
+
"""
|
|
187
|
+
|
|
188
|
+
kwargs = _get_kwargs(
|
|
189
|
+
tenant_id=tenant_id,
|
|
190
|
+
store_id=store_id,
|
|
191
|
+
resource_type=resource_type,
|
|
192
|
+
id=id,
|
|
193
|
+
field_count=field_count,
|
|
194
|
+
field_offset=field_offset,
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
198
|
+
|
|
199
|
+
return _build_response(client=client, response=response)
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
async def asyncio(
|
|
203
|
+
tenant_id: str,
|
|
204
|
+
store_id: str,
|
|
205
|
+
resource_type: ResourceType,
|
|
206
|
+
id: str,
|
|
207
|
+
*,
|
|
208
|
+
client: AuthenticatedClient | Client,
|
|
209
|
+
field_count: int | Unset = 20,
|
|
210
|
+
field_offset: int | Unset = 0,
|
|
211
|
+
) -> Bundle | OperationOutcome | None:
|
|
212
|
+
"""Get resource instance history
|
|
213
|
+
|
|
214
|
+
Args:
|
|
215
|
+
tenant_id (str):
|
|
216
|
+
store_id (str):
|
|
217
|
+
resource_type (ResourceType): FHIR resource type
|
|
218
|
+
id (str):
|
|
219
|
+
field_count (int | Unset): Default: 20.
|
|
220
|
+
field_offset (int | Unset): Default: 0.
|
|
221
|
+
|
|
222
|
+
Raises:
|
|
223
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
224
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
225
|
+
|
|
226
|
+
Returns:
|
|
227
|
+
Bundle | OperationOutcome
|
|
228
|
+
"""
|
|
229
|
+
|
|
230
|
+
return (
|
|
231
|
+
await asyncio_detailed(
|
|
232
|
+
tenant_id=tenant_id,
|
|
233
|
+
store_id=store_id,
|
|
234
|
+
resource_type=resource_type,
|
|
235
|
+
id=id,
|
|
236
|
+
client=client,
|
|
237
|
+
field_count=field_count,
|
|
238
|
+
field_offset=field_offset,
|
|
239
|
+
)
|
|
240
|
+
).parsed
|