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

Manipulating FHIR data leveraging MongoDB as storage layer

Project description

fhirstore

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

Installation

pip install fhirstore

Usage

from pymongo import MongoClient
from fhirstore import FHIRStore

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

# Dropping collections
store.reset()

# Parse json schema and create collections
store.bootstrap(depth=5)
# OR
# Get existing collections from the database
store.resume(depth=5)

# Create resources
store.create({
    "resourceType": "Patient",
    "id": "pat1",
    "gender": "male"
})

# Read resources
patient = store.read("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
python main.py

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

Test can be run using :

python -m pytest

Make sure dev dependencies are installed.

Publish

First, you need to have twine installedd

pip install --user --upgrade twine

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

python setup.py 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