Note: I have no relationship to companies that make or distribute the ROTEM sigma.
These R scripts can be used to store ROTEM sigma data for research purposes and audit.
The ROTEM sigma exported text files do not import into R in usable format - each ROTEM channel gets placed on its own line, so an individual patient will have multiple lines per individual test. In addition, each test has its own start time making grouping of tests dififcult.
This script takes the exported TXT files from the ROTEM sigma (https://werfen.com/au/en/haemostasis-diagnostics/rotem-sigma) and tidies them. The output is consistent with Tidyverse principles of one row per patient/test and one cell per variable (see https://en.wikipedia.org/wiki/Tidyverse). It also has a script to upload to a REDCap project.
It is assumed that the patient's ID is in the ROTEM 'Patient ID' column
- STEP 1: Import the txt files. You will need to enter the path to the text files in the file.path command. A unique ID is created from the MRN and the start date and time of the fibtem channel. The MRN is kept in a separate column. The uni_id is needed as a unique record_id is required for REDCap, as the MRN (which can be repeated if there is more than one ROTEM per patient) won't suffice as a record_id for grouping purposes. The uni_id identifies the record as an individual ROTEM cartridge with multiple channels, and the MRN can be used to identify the patient.
- STEP 2: PIVOT the ROTEM results wide. This creates a column for each of the ROTEM measurements for each test. If the test was stopped before the measurement was completed, NA's are entered (for example, ROTEM stopped at 30mins, EXTEM C ML60 will be NA).
- STEP 3: Add a label if HEPTEM was not invalid (eg a HEPTEM was run) as this is likely a cardiac surgery case. This field may or may not be useful as vascular patients given heparin may also have HEPTEM ROTEMs performed.
- STEP 4: Upload to REDCap. You will need your own REDCap project but you should use the data dictionary provided here. The data dictionary in this repository will be needed to map the R project fields with the REDCap project, otherwise the upload will fail.
- STEP 5: Upload the image files if you have exported them.
Note: for steps 1 and 5, you need to enter the path of the exported ROTEM .txt and image files.
- For line 17: To enter the file.path correctly enter the folders and then the filename like ("C:", "ROTEM" , "Backups" , "filename.txt")
- For lines 125, 132, 140: To enter the file.path correctly enter the folders but NOT the filename ("C:", "ROTEM" , "Backups")
The final data frame consists of the following columns. Note: ct = clotting time, cft = clot formation time, ml = maximum lysis, li = lysis. the sample_id column is a field on the ROTEM sigma that could be used to identify a sampe for a study, for example listing blood products given.
uni_id |
---|
patient_id |
sample_id |
patient_name |
lot_1 |
rotem_start_time |
rotem_run_time |
start_time_fibtem_c |
start_time_extem_c |
start_time_intem_c |
start_time_heptem_c |
start_time_aptem_c |
run_time_fibtem_c |
run_time_extem_c |
run_time_intem_c |
run_time_heptem_c |
run_time_aptem_c |
ct_fibtem_c |
ct_extem_c |
ct_intem_c |
ct_heptem_c |
ct_aptem_c |
a5_fibtem_c |
a5_extem_c |
a5_intem_c |
a5_heptem_c |
a5_aptem_c |
a10_fibtem_c |
a10_extem_c |
a10_intem_c |
a10_heptem_c |
a10_aptem_c |
a20_fibtem_c |
a20_extem_c |
a20_intem_c |
a20_heptem_c |
a20_aptem_c |
a30_fibtem_c |
a30_extem_c |
a30_intem_c |
a30_heptem_c |
a30_aptem_c |
cft_fibtem_c |
cft_extem_c |
cft_intem_c |
cft_heptem_c |
cft_aptem_c |
mcf_fibtem_c |
mcf_extem_c |
mcf_intem_c |
mcf_heptem_c |
mcf_aptem_c |
li30_fibtem_c |
li30_extem_c |
li30_intem_c |
li30_heptem_c |
li30_aptem_c |
li45_fibtem_c |
li45_extem_c |
li45_intem_c |
li45_heptem_c |
li45_aptem_c |
li60_fibtem_c |
li60_extem_c |
li60_intem_c |
li60_heptem_c |
li60_aptem_c |
ml_fibtem_c |
ml_extem_c |
ml_intem_c |
ml_heptem_c |
ml_aptem_c |
possible_cardiac |
fibtem_image |
aptem_image |
intem_image |
heptem_image |
extem_image |