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
File details
Details for the file helix_fhir_client_sdk-3.0.18.tar.gz
.
File metadata
- Download URL: helix_fhir_client_sdk-3.0.18.tar.gz
- Upload date:
- Size: 95.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1cb89ed7e35239a6b6a2ac250e83ce338d48eac5f444811e3b95e93170e4bd7d |
|
MD5 | 2816c75a401b7419f6ac17f037e92939 |
|
BLAKE2b-256 | 5b68950d77830d9cc1c9e561c0a41e26592bcbd3269cadc807205448c2b5fadc |
File details
Details for the file helix.fhir.client.sdk-3.0.18-py3-none-any.whl
.
File metadata
- Download URL: helix.fhir.client.sdk-3.0.18-py3-none-any.whl
- Upload date:
- Size: 180.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8163185cf5350522e512315c8f79895c3f307fa7717bdc677542cf6081b70346 |
|
MD5 | 4b579e59cc9d26915b6b6013262ad49c |
|
BLAKE2b-256 | 2d3f1879ac949524fe8dcd9971420b1b5dcb08146bdb9175ed4bd3ff775e4b6e |