Skip to content

awconway/hfnosedrct

Repository files navigation

High flow nasal oxygen during sedation in the cardiac catheterisation laboratory: A randomized controlled trial

This repository hosts raw data and code required to completely reproduce the statistical analyses. All code is in R. The drake package was used to manage the workflow.

Reproducible analysis with Docker

The statistical anlyses requires various packages to be installed, and may not work properly if package versions have changed. Therefore, a Docker image is provided to run the code reproducibly.

Run Docker locally

If you already have docker installed

  • Run the following in a terminal (substituting in a user name and password):
docker run -d -p 8787:8787 -e USER=<user> -e PASSWORD=<password> awconway/hfnosedrct
  • Open a web browser and go to: localhost:8787
  • Enter your username and password to enter an RStudio session.
  • Create a new project from version control (File > New project > Version Control > Git > https://github.com/awconway/hfnosedrct.git )
  • In the hfnosedrct project directory open the file plan.R and run the code to reproduce the analysis.

You will see the targets being built by drake, and the final manuscript should be compiled at the end as index.html in the manuscript directory. It may take about 20-30 minutes for all the models to be fit and output produced. A network diagram of all the output will be shown.

Run Docker on a Cloud

Instead of installing docker on your system you can run it on a remote server, such as Digital Ocean. This link provides you with $100 free credit to use for a 60-day period. After signing up, follow these steps to run this project on a Digital Ocean droplet:

  • Create a DigitalOcean droplet. Choose a server with Docker installed from the Marketplace menu and choose a size for your server (number of CPUs and amount of RAM). The statistical analyses used Bayesian modelling so it would be best to choose a server with at least 16GB RAM.

  • Select User data from the Select additional options section and enter the text as displayed below (substituting in a username and password).

#cloud-config
runcmd:
  - docker run -d -p 8787:8787 -e USER=<user> -e PASSWORD=<password> awconway/hfnosedrct
  • Create the droplet.

  • Wait a few minutes for the docker image to load into the server then open a web browser and type in the ip address of the droplet you just created followed by the port 8787 (e.g. ipaddress:8787).

  • Enter your username and password to enter an RStudio session.

  • Create a new project from version control (File > New project > Version Control > Git > https://github.com/awconway/hfnosedrct.git )

  • Run this line of code in the console to reproduce the analysis:

drake::r_make()

You will see the targets being built by drake, and the final manuscript should be compiled at the end as index.docx in the manuscript folder It may take about 20-30 minutes for all the models to be fit and output produced.

  • Destroy the DigitalOcean droplet when finished inspecting the analyses.