-
Notifications
You must be signed in to change notification settings - Fork 5
/
flowchart.qmd
97 lines (82 loc) · 3.38 KB
/
flowchart.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
---
title: "Licorice trial consort diagram"
editor: visual
format:
gfm: default
html:
code-fold: true
docx:
echo: false
pdf:
echo: false
execute:
warning: false
editor_options:
chunk_output_type: console
---
# The Licorice Gargle Dataset
These are data from a study by Ruetzler et al. 'A Randomized, Double-Blind Comparison of Licorice Versus Sugar-Water Gargle for Prevention of Postoperative Sore Throat and Postextubation Coughing'. Anesth Analg 2013; 117: 614 -- 21.
Postoperative sore throat is a common and annoying complication of endotracheal intubation. This study tested the hypothesis that gargling with licorice solution immediately before induction of anesthesia prevents sore throat and postextubation coughing in patients intubated with double-lumen tubes.
# Data cleaning
Data dictionary: https://higgi13425.github.io/medicaldata/reference/licorice_gargle.html
The publicly available dataset only includes final analysis-ready/complete patients. To demonstrate the making of a consort diagram we've randomly created three new variables of exclusions:
- eligibility
- age \> 70 years
- BMI outwith 18.5 - 30
- intervention
- did not receive intervention
- withdrew consent
- lost to follow up
- died
- refused assessment
```{r}
library(tidyverse)
library(consort)
library(medicaldata)
licodata = medicaldata::licorice_gargle %>%
rowid_to_column("patient_id") %>%
# make treatment var from 0,1 to factor
mutate(randomisation = treat %>%
factor() %>%
fct_recode("Sugar" = "0",
"Licorice" = "1")) %>%
# assess eligigibility
mutate(eligibility = case_when(preOp_age > 70 ~ "Age 70+",
! between(preOp_calcBMI, 18.5, 30) ~ "BMI not 18.5 - 30",
.default = NA),
# randomly generate intervention failed and lost to follow up variables
intervention = sample(c("Did not receive intervention", "Withdrew consent",NA),
size = 235,
replace = TRUE,
prob = c(0.1, 0.1, 0.9)),
followup = sample(c("Died", "Refused Assessment", NA),
size = 235,
replace = TRUE,
prob = c(0.1, 0.2, 0.7))) %>%
mutate(randomisation = if_else(is.na(eligibility), randomisation, NA)) %>%
mutate(intervention = if_else(is.na(eligibility), intervention, NA)) %>%
mutate(followup = if_else(is.na(intervention), followup, NA))
```
# CONSORT (Consolidated Standards of Reporting Trials) diagram
```{r}
p_cons = consort_plot(licodata,
order = list(patient_id = "Population",
eligibility = "Excluded",
randomisation = "Randomised",
intervention = "Excluded",
patient_id = "Received treatment",
followup = "Lost to follow-up",
patient_id = "Final analysis"),
side_box = c("eligibility", "intervention", "followup"),
allocation = "randomisation",
cex = 0.8,
text_width = 30)
p_cons
```
## Exporting
```{r}
plot(p_cons, grViz = TRUE) |>
DiagrammeRsvg::export_svg() |>
charToRaw() |>
rsvg::rsvg_pdf("consort_diagram.pdf")
```