helix.fhir.client.sdk
Project description
from typing_extensions import Optionalfrom helix_fhir_client_sdk.responses.fhir_get_response import FhirGetResponsefrom build.lib.helix_fhir_client_sdk.responses.fhir_get_response import FhirGetResponsefrom helix_fhir_client_sdk.responses.fhir_get_response import FhirGetResponse
helix.fhir.client.sdk
Fluent API to call the FHIR server that handles:
- Authentication to FHIR server
- Renewing access token when they expire
- Retry when there are transient errors
- Un-bundling the resources received from FHIR server
- Paging
- Streaming
- Logging
- Simulating a $graph call when the server does not support it
Usage
pip install helix.fhir.client.sdk
Documentation
https://icanbwell.github.io/helix.fhir.client.sdk/
Test Project using this
https://github.com/icanbwell/fhir-server-performance
Python Version Support
- 1.x supports python 3.7+
- 2.x supports python 3.10+
- 3.x supports python 3.12+
Asynchronous Support
When communicating with FHIR servers, a lot of time is spent waiting for the server to respond.
This is a good use case for using asynchronous programming.
This SDK supports asynchronous programming using the async
and await
keywords.
The return types are Python AsyncGenerators. Python makes it very easy to work with AsyncGenerators.
For example, if the SDK provides a function like this:
async def get_resources(self) -> AsyncGenerator[FhirGetResponse, None]:
...
You can iterate over the results as they become available:
response: Optional[FhirGetResponse]
async for response in client.get_resources():
print(response.resource)
Or you can get a list of responses (which will return AFTER all the responses are received:
responses: List[FhirGetResponse] = [response async for response in client.get_resources()]
Or you can aggregate the responses into one response (which will return AFTER all the responses are received:
response: Optional[FhirGetResponse] = await FhirGetResponse.from_async_generator(client.get_resources())
Data Streaming
For FHIR servers that support data streaming (e.g., b.well FHIR server), you can just set the use_data_streaming
parameter to stream the data as it i received.
The data will be streamed in AsyncGenerators as described above.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for helix_fhir_client_sdk-3.0.15.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29fda197a29ae5e8b833b5cca6e6049a83e9687f8b768d33a0f16a70e5fdc542 |
|
MD5 | 79d4bc7038a2f5e25cc372e1291037a4 |
|
BLAKE2b-256 | 5022aa9efdf69e3f2e8838deba166019146f2d7b952b868a1f237ea029754b3e |
Hashes for helix.fhir.client.sdk-3.0.15-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ddaf5977f8171a32f5324f82d65b7f834ede8342477fbdaf60e12c44c9d2f441 |
|
MD5 | 85117be275703fac11c7fcbe7f17995b |
|
BLAKE2b-256 | c50c82f4d4f81e8a0bc3f1e63cccbef03011c2f88da017e71b38d519f5cdf941 |