FHIR client for python
Project description
fhir-py
FHIR client for python. This package provides an API for CRUD operations over FHIR resources
API
Import library:
from fhirpy import FHIRClient
To create FHIR instance use:
FHIRClient(url, authorization='', fhir_version='4.0.0', without_cache=False)
Returns an instance of the connection to the server which provides:
- .reference(resource_type, id, reference, **kwargs) - returns
FHIRReference
to the resource - .resource(resource_type, **kwargs) - returns
FHIRResource
which described below - .resources(resource_type) - returns
FHIRSearchSet
FHIRResource
provides:
- .save() - creates or updates resource instance
- .delete() - deletes resource instance
- .to_reference(**kwargs) - returns
FHIRReference
for this resource
FHIRReference
provides:
- .to_resource(nocache=False) - returns
FHIRResource
for this reference
FHIRSearchSet
provides:
- .search(param=value)
- .limit(count)
- .page(page)
- .sort(*args)
- .elements(*args, exclude=False)
- .include(resource_type, attr)
- .fetch() - makes query to the server and returns a list of
FHIRResource
- .fetch_all() - makes query to the server and returns a full list of
FHIRResource
- .first() - returns
FHIRResource
or None - .get(id=id) - returns
FHIRResource
or raisesFHIRResourceNotFound
Usage
Create an instance
client = FHIRClient(url='http://path-to-fhir-server', authorization='Bearer TOKEN')
Fetch list of resource's instances
resources = client.resources('Patient') # Return lazy search set
resources = resources.search(name='John').limit(10).page(2).sort('name')
resources.fetch() # Returns list of FHIRResource
Get the particular instance of resource
res = client.resources('Patient').get(id='ID')
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
fhirpy-0.2.1.tar.gz
(171.6 kB
view hashes)
Built Distribution
fhirpy-0.2.1-py3-none-any.whl
(182.7 kB
view hashes)