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
- Start the database
- Drop and re-create all collections based on the provided schema
docker-compose up -d
python main.py
Development setup
- Create a virtual environment and enter it
- 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
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
fhirstore-0.0.6.tar.gz
(294.9 kB
view hashes)
Built Distribution
fhirstore-0.0.6-py3-none-any.whl
(304.0 kB
view hashes)
Close
Hashes for fhirstore-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10de6cd2a80e5666a601cbcfbd12ab388a28aa0056684630c1c73e072238aec8 |
|
MD5 | 8b4c6c1fe2a3757ee8120a872dd29c22 |
|
BLAKE2b-256 | f935ad2331c11743d21e144ec951200d47afeb8a08e06827ec999bc5730dcdaf |