A package to help convert MIMIC-IV to FHIR
Project description
py-mimic-fhir
The py-mimic-fhir package is used to provide functions to convert MIMIC to FHIR. This package is dependent on:
- MIMIC-IV database installed
- MIMIC-FHIR SQL scripts run
- environment variables set with .env
py_mimic_fhir modes
There are three modes:
validate- Allows the user to validate N patients--num_patientsspecifies number of patients to validate.--exportallows user to export resources after validation completes.--export_limitspecifies the limit of resources exported. If not specified will export all resources.--rerunflag to rerun failed bundles--coresallows the user to specify how many cores to use in parallel processing, default to single core
export- Allows the user to export resources to file.--export_limitspecifies the limit of resources exported. If not specified will export all resources.--patient_bundleflag to export patient-everything bundles from GCP--num_patientsspecifies the number of patients to export patient-everything bundles--countspecifies number of resources allowed per page of patient-everything request--resource_typesspecifies resource types to be included in patient-everything bundles. Comma separated list--ndjson_by_patientflag to export NDJSON by patient for Postgres
terminology- Generate CodeSystems and ValueSets for the latest MIMIC version--versionspecifies the version of the terminology. This should be synced up with the MIMIC-IV version--statusspecifies the status either as draft or complete. Defaults to draft--postwill post terminology stored in the terminology folder to the specified FHIR server--generate_and_postwill generate all the terminology and post immediately to the FHIR server
A couple example calls:
- Validation call:
py_mimic_fhir validate --num_patients 5 - Validation call with export:
py_mimic_fhir validate --num_patients 5 --export - Re-validate failed bundles:
py_mimic_fhir validate --rerun - Validate in parallel:
py_mimic_fhir validate --num_patients=40 --cores=4 - Export all:
py_mimic_fhir export - Export limited amount:
py_mimic_fhir export --export_limit 1 - Export patient-everything:
py_mimic_fhir export --patient_bundle --num_patients=100 --resource_types='Patient,Encounter,Condition' - Export ndjson by patient:
py_mimic_fhir export --ndjson_by_patient - Terminology generation call:
py_mimic_fhir terminology --version 0.4 --status complete - Terminology post call:
py_mimic_fhir terminology --post - Terminology generate and post call:
py_mimic_fhir terminology --generate_and_post --version 0.4
py_mimic_fhir environment variables
Along with the main arguments that the user enters, there are expected environment variables. The user should export all environment variables found in their .env to the bash using source .env. The variables pulled into py_mimic_fhir are:
| Argument | Environment variable | Notes |
|---|---|---|
| --sqluser | SQLUSER | The SQL database username |
| --sqlpass | SQLPASS | The SQL database password |
| --dbname_mimic | DBNAME_MIMIC | The name of the mimic database locally |
| --host | DBHOST | Where the database is hosted (typically localhost) |
| --port | PGPORT | Which port the database is located on |
| --fhir_server | FHIR_SERVER | The fhir server, in our case HAPI |
| --output_path | MIMIC_JSON_PATH | The output path for exported resources |
| --log_path | MIMIC_FHIR_LOG_PATH | The path to the log files |
| --dbname_hapi | DBNAME_HAPI | The name of the hapi database locally |
| --terminology_path | MIMIC_TERMINOLOGY_PATH | The directory to output terminology to |
| --err_path | MIMIC_FHIR_LOG_PATH | The directory for logs to be stored |
| --gcp_project | GCP_PROJECT | The GCP Project name |
| --gcp_topic | GCP_TOPIC | The GCP topic name to submit bundles to |
| --gcp_location | GCP_LOCATION | The GCP location of services |
| --gcp_bucket | GCP_BUCKET | The Google Cloud Storage bucket where bundle errors can be logged |
| --gcp_dataset | GCP_DATASET | Google Healthcare API dataset |
| --gcp_fhirstore | GCP_FHIRSTORE | Google Healthcare API FHIR store |
| --gcp_export_folder | GCP_EXPORT_FOLDER | Google Cloud Storage folder to export resources to |
| --validator | FHIR_VALIDATOR | FHIR Validator being used. One of HAPI, GCP, or JAVA |
| --db_mode | BD_MODE | Database mode, either Postgres or BigQuery |
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
py-mimic-fhir-1.0.0.tar.gz
(26.3 kB
view details)
File details
Details for the file py-mimic-fhir-1.0.0.tar.gz.
File metadata
- Download URL: py-mimic-fhir-1.0.0.tar.gz
- Upload date:
- Size: 26.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b8bc08dde7a591d8b02e426ab54a5b6dfe4d72c257c8615c7f23cb8e4ad86f6
|
|
| MD5 |
6db22cb9ed8c4d4cbfa9e68e6bb062fb
|
|
| BLAKE2b-256 |
dff60a4286b5289fc64b96decbaa6375ec3a27563cae43cbd5b6407515bcbe0c
|