A wrapper for the drchrono API
Project description
drchrono-wrapper
Requirements
- checkout the requirements.txt file
- min. python version: 3.10 because of switch statement utilization that is only available starting with python 3.10
API token requirement
- please visit for more information on how to generate: https://app.drchrono.com/api-docs/#section/Authorization
- first load in the package and set the API token:
from drchrono.drc import drc
- load in API token from .env:
drc_client = drc(api_key=os.getenv('DRCHRONO_API_TOKEN'))
- type in API token manually (not recommended):
drc_client = drc(api_key=123321asddsa321123)
Endpoints currently covered:
-
Fake data generation:
- Admin:
- Users
- Doctors
- Clinical:
- Patients
- Appointments
- Admin:
-
Real data pulls:
- Admin:
- Users
- Doctors
- Clinical:
- Patients
- Appointments
- Medications
- Documents
- Admin:
Basic examples:
Getting real data:
- Get all patients:
patient_all = drc_client.patients().patientlist
- If you want additional metadata, like custom demographics, add on verbose_true=True
patient_all = drc_client.patients().patientlist(verbose_true=True)
- Get a single patient:
patient_single = drc_client.patients().patient_single(patient_id='200110461')
- Get a list of all doctors:
doctor_list = drc_client.doctors().doctorlist
- Get a list of all appointments (requires a specific start date):
appointments = drc_client.appointments().appointment_list(appointment_startdate='2019-01-01')
- Pushing a existing pdf into a patient record as a document:
- Load the file:
files = {'document': open('src/new_test_myfile.pdf', 'rb')}
- Send the data over:
drc_client.documents().create_document(date='2017-01-01', description='testdocumentnov21_ANOTHER ONE' doctor=os.getenv('DRCHRONO_DOCTOR_ID'), patient=os.getenv('DRCHRONO_PATIENT_ID'), metatags='["fake-pdf", "document"]', document=files)
- Load the file:
Generating fake dataset:
- Fake dataset with linked patients and appointments; fake users and doctors;
f_users, f_doctors, f_patients, f_appointments = drc.faker().generate(20, 40, 150, 500)
Package admin:
- Note to self, to create new version:
- update setup.py version number
- re-run
python setup.py sdist
to create new distribution - upload to pypi with
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.
Source Distribution
drchrono-0.0.11.tar.gz
(16.2 kB
view details)
File details
Details for the file drchrono-0.0.11.tar.gz
.
File metadata
- Download URL: drchrono-0.0.11.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.10.1 urllib3/1.26.9 tqdm/4.45.0 importlib-metadata/4.8.3 keyring/21.2.0 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b39d52e1cb458f9d4c13cd3c3a17e7093f54cd1f736c3bdaa947fe3524b5221e |
|
MD5 | 816d6048792aae7e3e2ad28330536e51 |
|
BLAKE2b-256 | 06727d555d86e4454f30db534c1b0c2412a6dfc9f463b550d4b6f9eed51400ad |