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

Manipulating FHIR data leveraging MongoDB as storage layer

Project description


Python library to manipulate fhir resources leveraging mongoDB as storage layer.


pip install fhirstore


from pymongo import MongoClient
from fhirstore import FHIRStore

client = MongoClient()
store = FHIRStore(client, "<my_database>")

# Dropping collections

# Parse json schema and create collections
# OR
# Get existing collections from the database

# Create resources
    "resourceType": "Patient",
    "id": "pat1",
    "gender": "male"

# Read resources
patient ="Patient", "pat1")

# Update resources
updated_patient = store.update("Patient", "pat1", {"gender": "other"})

# Delete resources
deleted_patient_id = store.delete("Patient", "pat1")

Bootstrap the database

  1. Start the database
  2. Drop and re-create all collections based on the provided schema
docker-compose up -d

Development setup

  1. Create a virtual environment and enter it
  2. Install python dependncies
virtualenv . 
. ./bin/activate
pip install -r requirements.txt
pip install -r requirements-dev.txt


Test can be run using :

python -m pytest

Make sure dev dependencies are installed.


First, you need to have twine installedd

pip install --user --upgrade twine

Make sure you have bumped the version number in, then run the following:

python sdist bdist_wheel
python -m twine upload dist/*

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 fhirstore, version 0.0.6
Filename, size File type Python version Upload date Hashes
Filename, size fhirstore-0.0.6-py3-none-any.whl (304.0 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size fhirstore-0.0.6.tar.gz (294.9 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