Package: py-mimic-fhir
py-mimic-fhirThe py-mimic-fhir package is used to provide functions to convert MIMIC to FHIR. This package is dependent on:MIMIC-IVdatabase installedMIMIC-FHIRSQL scriptsrunenvironment variables set with.envpy_mimic_fhir modesThere 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 coreexport- 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 Postgresterminology- 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 serverA couple example calls:Validation call:py_mimic_fhir validate --num_patients 5Validation call with export:py_mimic_fhir validate --num_patients 5 --exportRe-validate failed bundles:py_mimic_fhir validate --rerunValidate in parallel:py_mimic_fhir validate --num_patients=40 --cores=4Export all:py_mimic_fhir exportExport limited amount:py_mimic_fhir export --export_limit 1Export 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_patientTerminology generation call:py_mimic_fhir terminology --version 0.4 --status completeTerminology post call:py_mimic_fhir terminology --postTerminology generate and post call:py_mimic_fhir terminology --generate_and_post --version 0.4py_mimic_fhir environment variablesAlong with the main arguments that the user enters, there are expected environment variables. The user should export all environment variables found in their.envto the bash usingsource .env. The variables pulled into py_mimic_fhir are:ArgumentEnvironment variableNotes--sqluserSQLUSERThe SQL database username--sqlpassSQLPASSThe SQL database password--dbname_mimicDBNAME_MIMICThe name of the mimic database locally--hostDBHOSTWhere the database is hosted (typically localhost)--portPGPORTWhich port the database is located on--fhir_serverFHIR_SERVERThe fhir server, in our case HAPI--output_pathMIMIC_JSON_PATHThe output path for exported resources--log_pathMIMIC_FHIR_LOG_PATHThe path to the log files--dbname_hapiDBNAME_HAPIThe name of the hapi database locally--terminology_pathMIMIC_TERMINOLOGY_PATHThe directory to output terminology to--err_pathMIMIC_FHIR_LOG_PATHThe directory for logs to be stored--gcp_projectGCP_PROJECTThe GCP Project name--gcp_topicGCP_TOPICThe GCP topic name to submit bundles to--gcp_locationGCP_LOCATIONThe GCP location of services--gcp_bucketGCP_BUCKETThe Google Cloud Storage bucket where bundle errors can be logged--gcp_datasetGCP_DATASETGoogle Healthcare API dataset--gcp_fhirstoreGCP_FHIRSTOREGoogle Healthcare API FHIR store--gcp_export_folderGCP_EXPORT_FOLDERGoogle Cloud Storage folder to export resources to--validatorFHIR_VALIDATORFHIR Validator being used. One of HAPI, GCP, or JAVA--db_modeBD_MODEDatabase mode, either Postgres or BigQuery