GithubHelp home page GithubHelp logo

mattdotmiller / tidy_rotem_exports Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 54 KB

This script takes the exported .txt files and images from the ROTEM sigma and tidies them. Also has a script to upload to a REDCap project

License: GNU General Public License v3.0

R 100.00%
r rotem viscoelastic

tidy_rotem_exports's Introduction

Tidy ROTEM sigma exports

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

tidy_rotem_exports's People

Contributors

mattdotmiller avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.