Skip to content

medizininformatik-initiative/calm-qe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CALM-QE

This repository is developed to create "Study Data" for CALM-QE Project.

The purpose of this set of scripts is to identify a cohort of patients whose diagnoses are associated with Asthma or Chronic Obstructive Pulmonary Disease (COPD) from a given FHIR server. The scripts extract the relevant patient population (the “cohort”) based on these conditions.

In addition, they retrieve comprehensive clinical data for each patient in the cohort to support further analysis. This includes secondary conditions, observations, and associated medication records.

To run this project, it is necessary to cover the following requirements:

  • Connection to a FHIR Server
  • Python 3.12
  • Docker (optional)

The installation can be orchestrated directly by copying this repository locally and following the Set up instructions, or run it directly with Docker.

Set up


1. Install requirements

Install all the required packages:

pip install -r requirements.txt

2. Configure FHIR Server Connection

Before running the scripts, ensure that FHIR server configurations are added in data_extraction/Constants.py file. You should update the following fields:

  • USER_NAME = os.getenv("USER_NAME", "PUT YOUR USERNAME HERE")
  • USER_PASSWORD = os.getenv("USER_PASSWORD", "PUT YOUR PASSWORD HERE")
  • SERVER_NAME = os.getenv("SERVER_NAME", "PUT YOUR FHIR SERVER NAME HERE")
  • PROTOCOL = os.getenv("PROTOCOL", "PUT YOUR PROTOCOL TYPE HERE")

For instance: USER_NAME = os.getenv("USER_NAME", "user1") USER_PASSWORD = os.getenv("USER_PASSWORD", "pass123") SERVER_NAME = os.getenv("SERVER_NAME", "server.fhir.diz.uni.de/fhir") PROTOCOL = os.getenv("PROTOCOL", "https")

Creation of Cohort Patients List and Extraction of the Resources from Cohort Patients


This script identifies patients diagnosed with "Asthma" or "COPD".

ExtractCohortwithResourcesExecute.py reads from the input_files folder asthma_copd_codes.json automatically. This JSON file includes all the ICD-10 codes available related to "Asthma" and "COPD". Modifications to this code list are possible based on unique needs when required. The usage of this file is determined in Constants.py.

The script outputs all the patients' IDs and corresponding diagnoses in patients_diagnosed_asthma_copd.json.

After the first part is complete, the analysis continues with the fetching, extraction, and counting of secondary Conditions, Observations, and Medication.

The script generates separate JSON files for each resource type (e.g., Conditions, Observations, Medications) per patient.

After compiling the script, a metadata.json is generated as part of the outcomes to provide a general and quantitative overview of the items generated.

Usage:
python .\data_extraction\ExtractResourcesForCohortExecute.py

Run Using Docker (OPTIONAL)


Instead of setting up and running the scripts manually, you can run the scripts in a container environment. First, define the necessary credentials to connect to a FHIR Server in dockerfile as follows:

  • USER_NAME = "Your User Name"
  • USER_PASSWORD = "Your Password"
  • SERVER_NAME = "Your Fhir Server Base URL"
  • PROTOCOL = "Your protocol type, e.g. https or http"

After making sure Docker is installed, you can run the following commands.

docker build -t fhir-cohort-resources-extraction .

docker run --name calm-qe fhir-cohort-resources-extraction

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages