Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

FHIR client for python

Project description

Build Status codecov pypi


FHIR client for python. This package provides an API for CRUD operations over FHIR resources


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



  • .save() - creates or updates resource instance
  • .delete() - deletes resource instance
  • .to_reference(**kwargs) - returns FHIRReference for this resource



  • .to_resource(nocache=False) - returns FHIRResource for this reference



  • .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 raises FHIRResourceNotFound


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 ='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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for fhirpy, version 0.2.1
Filename, size File type Python version Upload date Hashes
Filename, size fhirpy-0.2.1-py3-none-any.whl (182.7 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size fhirpy-0.2.1.tar.gz (171.6 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page