diff --git a/main/404.html b/main/404.html index dbb943f4..8e108036 100644 --- a/main/404.html +++ b/main/404.html @@ -32,7 +32,7 @@ autoslider.core - 0.0.1.9019 + 0.0.1.9020 @@ -41,6 +41,18 @@
AutoslideR
+zhus31
)tutorial.Rmd
autoslideR
for SREP
+renv::restore(repos = c(CRAN = "http://cran.rstudio.com", RSPM = "https://rspm.roche.com/Non-Validated/latest"))
+from you console to construct the environment, e.g. installing the
+required packages.IMmotion010
then run
+run_slide.R
. The folder contains the following
+objects:.
+├── atezo.pptx
+├── filters.yml
+├── metadata.yml
+├── programs
+│ ├── immotion010_data_process.R
+│ └── run_slides.R
+└── spec.yml
+atezo.pptx
: The slide theme template. You can replace
+this file by your own template. The slide master of the theme template
+should contains the basic layouts: “Title and Content” and “Two
+Content”. For further details, refer to the PD
+Connect post How to create a PowerPoint theme for autoslideR
+deck.
+filters.yml
: To define and store filters.spec.yml
: To define the content (TLG) on each slide.
+Each program corresponds to a TLG. The order of the program in
+spec.yml
determines the order of the contents in the final
+slide deck. User can also specify the title, footnote, filter (using
+suffix), and argument values to be passed to the program.metadata.yml
: Study related metadata information,
+including entimice data paths, lopo paths, TA and study number,
+etc.programs
: This folder hosts your R scripts for the
+automatic slide generation. We recommend to have two separate workflows:
+one for data pre-processing, the other for executing
+spec.yml
to generate slides.autoslideR
step by step guide
+In the showcase below, we use the datasets from IMmotion010.
+
+rm(list = ls())
+library("rsvg")
+library("nestcolor")
+library("autoslideR")
+library("dplyr")
+library("rice")
+entiPath <- "root/clinical_studies/RO5541267/CDT30114/WO39210/data_analysis/CSRPrimary/prod/outdata_vad/"
+vad_list <- c("adsl", "adae")
+data_o <- rice_read(setNames(paste0(entiPath, vad_list, ".sas7bdat"), vad_list))
+rice_session_close()
+# add fake data for trt discontinuation (for showcase trt disposition table only)
+set.seed(123)
+data_o$adsl <- data_o$adsl %>%
+ mutate(
+ EOTSTT = sample(c("COMPLETED", "DISCONTINUED", "ONGOING"), 778, # The study has 778 patients in total
+ replace = TRUE, prob = c(0.5, 0.3, 0.2)
+ ),
+ DCSREAS = ifelse(EOTSTT == "DISCONTINUED", DCSREAS, NA)
+ )
+
+ADSL <- data_o$adsl
+ADAE <- data_o$adae
t_dm_slide
demographic table
+adsl
: ADSL dataset, dataframe.arm
: Arm variable, character. "TRT01P"
by
+default.vars
: A vector of characters, names of variables to be
+summarized in the table.stats
: A vector of characters, statistics to be
+calculated for the variables in argument vars
. Common ones
+are "n"
, "median"
, "mean_sd"
,
+"range"
, "count_fraction"
. The default is
+c("median", "range", "count_fraction")
. Please see
+.stats
from tern::analyze_vars()
+for more details.adsl
dataset has following variables:USUBJID
: Character.STUDYID
: Character.arm
and vars
+exist in adsl
dataset.arm
variable in the
+adsl
should have no NAs or no strings with whitespaces
+only.
+# process data
+ADSL_m <- ADSL %>%
+ mutate_at(
+ c("TRT01A", "SEX"),
+ ~ sas_na(as.character(.))
+ ) %>%
+ mutate(
+ TRT01A = factor(TRT01A, levels = c("PLACEBO", "ATEZOLIZUMAB")),
+ SEX = factor(SEX, levels = c("M", "F"), labels = c("Male", "Female"))
+ ) %>%
+ var_relabel(
+ AAGE = "Age",
+ SEX = "Sex"
+ )
+
+t_dm_slide(ADSL_m,
+ vars = c("AAGE", "SEX"),
+ arm = "TRT01P",
+ stats = c("median", "range", "count_fraction")
+) %>% slides_preview()
t_ds_trt_slide
treatment disposition table
+adsl
: ADSL dataset, dataframe.arm
: Arm variable, character. "TRT01A"
by
+default.colcount
: Whether to add col counts, logical.
+"FALSE"
by default.drug_names
: A character vector, name of the drugs to be
+displayed in the header, e.g.:
+c("Drug X", "Placebo", "Combination")
.drug_vars
: A character vector, corresponding values of
+each drug in the arm
variable, e.g.:
+c("A: Drug X", "B: Placebo", "C: Combination")
.drug_sdt
: A character vector, names of variables that
+represent the start day of each drug, which can be different for
+different drugs.drug_discfl
: A character vector, names of variables
+that represent the treatment discontinuation flag of each drug. Each
+variable has only "Y"
/"N"
.drug_discst
: A character vector, names of variables
+that represent the treatment discontinuation status of each drug.
+Example values are "COMPLETED"
,
+"DISCONTINUED"
, "ONGOING"
.drug_discrs
: A character vector, names of variables
+that represent the treatment discontinuation reason of each drug.The variables in arguments arm
,
+drug_vars
, drug_sdt
, drug_discfl
,
+drug_discst
, drug_discrs
exist in
+adsl
dataset.
The length of drug_vars
, drug_sdt
,
+drug_discfl
, drug_discst
,
+drug_discrs
should be the same.
In the targeted population, the arm
variable in
+adsl
dataset should have no NA
s or no strings
+with white spaces only.
Although not required, a good practice is to convert all +character variables to use into factors.
+# process data
+ADSL_m <- ADSL %>%
+ mutate_at(
+ c("TRT01A", "EOTSTT", "DCSREAS"),
+ ~ sas_na(as.character(.))
+ ) %>%
+ mutate(
+ TRT01A = factor(TRT01A, levels = c("PLACEBO", "ATEZOLIZUMAB")),
+ EOSSTT = as.factor(toupper(EOTSTT)),
+ DTRTFL = as.factor(case_when(
+ EOTSTT == "DISCONTINUED" ~ "Y",
+ TRUE ~ "N"
+ ))
+ )
+
+t_ds_trt_slide(ADSL_m,
+ arm = "TRT01A",
+ drug_vars = c("ATEZOLIZUMAB", "PLACEBO"),
+ drug_names = c("Atezolizumab", "Placebo"),
+ drug_sdt = c("TRTSDT", "TRTSDT"),
+ drug_discfl = c("DTRTFL", "DTRTFL"),
+ drug_discst = c("EOTSTT", "EOTSTT"),
+ drug_discrs = c("DCSREAS", "DCSREAS"),
+) %>% slides_preview()
t_ae_summary_slide
summary of safety
+adsl
: ADSL dataset, dataframe.adae
: ADAE dataset, dataframe.arm
: Arm variable, character. "TRT01A"
by
+default.dose_adjust_flags
: A vector of characters, names of
+logic variables that indicate if AEs lead to any dose adjustment, such
+as a drug discontinuation, dose interruption and reduction. The logic
+variable only has TRUE/FALSE. Default is
+NA
.dose_adjust_labels
: A vector of characters, labels to
+be displayed in the table for the logic variables in
+dose_adjust_labels
, e.g.: AE leading to drug
+discontinuation from drug X. Default is NA
.gr34_highest_grade_only
: Logical value. Default is
+TRUE, such that only patients with the highest AE grade as 3 or 4 are
+included in the counts of the "Grade 3-4 AE"
and
+"Treatment-related Grade 3-4 AE"
; set it to
+FALSE
if you want to include patients with the highest AE
+grade as 5 in the counts.USUBJID
: Character.STUDYID
: Character.AEDECOD
: Character.AEBODSYS
: Character.ATOXGR
: Numeric, 1, 2, 3, 4 and 5.AESER
: Character, 'Y'
and
+'N'
.AEREL
: Character, 'Y'
and
+'N'
.SAFFL
: Character, 'Y'
and
+'N'
.ANL01FL
: Character, 'Y'
and
+'N'
.TRTEMFL
: Character, 'Y'
and
+'N'
.arm
variable: Character.dose_adjust_flags
variable: logical, TRUE
+and FALSE
.dose_adjust_flags
is equal to the length
+of dose_adjust_labels
.arm
variable in the
+adsl and adae should 1) have no NA
s or no strings with
+whitespaces only; 2) have the same treatment arm levels.
+# process data
+ADAE_m <- ADAE %>%
+ mutate(
+ TRT01A = sas_na(factor(TRT01A,
+ levels = c("PLACEBO", "ATEZOLIZUMAB")
+ )),
+ withdraw_flg = ifelse(AEACN == "DRUG WITHDRAWN", TRUE,
+ FALSE
+ ),
+ interrup_flg = ifelse(AEACN == "DRUG INTERRUPTED", TRUE,
+ FALSE
+ )
+ )
+
+t_ae_summ_slide(
+ adsl = ADSL_m, adae = ADAE_m,
+ arm = "TRT01A",
+ dose_adjust_flags = c("withdraw_flg", "interrup_flg"),
+ dose_adjust_labels = c("DRUG WITHDRAWN", "DRUG INTERRUPTED"),
+ gr34_highest_grade_only = TRUE
+) %>% slides_preview()
t_ae_pt_slide
summary of AEs
+adsl
: ADSL dataset, dataframe.adae
: ADAE dataset, dataframe.arm
: Arm variable, character. “TRT01A” by
+default.cutoff
: Cutoff threshold, numeric.adae
dataset has following variables:USUBJID
: Character.STUDYID
: Character.AEDECOD
: Character.AEBODSYS
: Character.ATOXGR
: Numeric, 1, 2, 3, 4 and 5.ANL01FL
: Character, "Y"
and
+"N"
.RACE
: do we need to keep them in the
+code
+COUNTRY
: do we need to keep them in the
+code
+arm
variable: Character.arm
variable in
+adsl
and adae
should
+ADAE_m <- ADAE %>%
+ mutate(TRT01A = sas_na(factor(TRT01A,
+ levels = c("PLACEBO", "ATEZOLIZUMAB")
+ )))
+t_ae_pt_slide(
+ adsl = ADSL_m,
+ adae = ADAE_m,
+ arm = "TRT01A"
+) %>% slides_preview()
The following code specify the output slide format and file paths +mentioned in the above section.
+
+# load filters
+filters::load_filters(file.path("IMmotion010", "filters.yml"), overwrite = TRUE)
+
+# create a table format with white background and grey header
+imc_format <- function(ft, ...) {
+ ft %>% autoslider_format(
+ odd_header = "grey",
+ odd_body = "white",
+ even_body = "white",
+ ...
+ )
+}
+
+# set up the spec file, slide theme template and output file
+spec_file <- file.path("IMmotion010", "spec.yml")
+deck_template <- file.path("IMmotion010", "atezo.pptx")
+outfile <- file.path("IMmotion010", "IMmotion010_demo.pptx")
All examples below are referring to the above section, and we apply
+the “SE
” filter to all following output
t_dm_slide
demographic table
+- program: t_dm_slide
+ titles: Demographics and Baseline Characteristics
+ footnotes: ''
+ paper: L6
+ suffix: SE
+ args:
+ arm: "TRT01P"
+ vars: ["AAGE", "SEX"]
+ stats: ["median", "range", "count_fraction"]
User can specify the variables to be summarized using
+vars
. In this example, we summarize age, sex. For
+continuous variables, summary statistics are median and range; for
+character/factor variables, summary statistic is count (percent).
+# process data
+ADSL_m <- ADSL %>%
+ mutate_at(
+ c("TRT01A", "SEX"),
+ ~ sas_na(as.character(.))
+ ) %>%
+ mutate(
+ TRT01A = factor(TRT01A, levels = c("PLACEBO", "ATEZOLIZUMAB")),
+ SEX = factor(SEX, levels = c("M", "F"), labels = c("Male", "Female"))
+ ) %>%
+ var_relabel(
+ AAGE = "Age",
+ SEX = "Sex"
+ )
+
+# execute spec to generate slide
+study_spec <- spec_file %>% read_spec()
+outputs <- study_spec %>%
+ filter_spec(., program %in% c("t_dm_slide")) %>%
+ generate_outputs(datasets = list(adsl = ADSL_m)) %>%
+ decorate_outputs(version_label = NULL) %>%
+ generate_slides(outfile = outfile, template = deck_template, table_format = imc_format)
t_ds_trt_slide
treatment disposition table
+- program: t_ds_trt_slide
+ titles: Disposition
+ footnotes: ''
+ paper: L6
+ suffix: SE
+ args:
+ arm: "TRT01A"
+ colcount: FALSE
+ drug_vars: ["ATEZOLIZUMAB", "PLACEBO"]
+ drug_names: ["Atezolizumab", "Placebo"]
+ drug_sdt: ["TRTSDT", "TRTSDT"]
+ drug_discfl: ["DTRTFL", "DTRTFL"]
+ drug_discst: ["EOTSTT", "EOTSTT"]
+ drug_discrs: ["DCSREAS", "DCSREAS"]
+# process data
+ADSL_m <- ADSL %>%
+ mutate_at(
+ c("TRT01A", "EOTSTT", "DCSREAS"),
+ ~ sas_na(as.character(.))
+ ) %>%
+ mutate(
+ TRT01A = factor(TRT01A, levels = c("PLACEBO", "ATEZOLIZUMAB")),
+ EOSSTT = as.factor(toupper(EOTSTT)),
+ DTRTFL = as.factor(case_when(
+ EOTSTT == "DISCONTINUED" ~ "Y",
+ TRUE ~ "N"
+ ))
+ )
+
+# execute spec to generate slide
+study_spec <- spec_file %>% read_spec()
+outputs <- study_spec %>%
+ filter_spec(., program %in% c("t_ds_trt_slide")) %>%
+ generate_outputs(datasets = list(adsl = ADSL_m)) %>%
+ decorate_outputs(version_label = NULL) %>%
+ generate_slides(outfile = outfile, template = deck_template, table_format = imc_format)
t_ae_summary_slide
summary of safety
+
+ADAE_m <- ADAE %>%
+ mutate(
+ TRT01A = sas_na(factor(TRT01A,
+ levels = c("PLACEBO", "ATEZOLIZUMAB")
+ )),
+ withdraw_flg = ifelse(AEACN == "DRUG WITHDRAWN", TRUE,
+ FALSE
+ ),
+ interrup_flg = ifelse(AEACN == "DRUG INTERRUPTED", TRUE,
+ FALSE
+ )
+ )
+# execute spec to generate slide
+study_spec <- spec_file %>% read_spec()
+outputs <- study_spec %>%
+ filter_spec(., program %in% c("t_ae_summ_slide")) %>%
+ generate_outputs(datasets = list(adsl = ADSL_m, adae = ADAE_m)) %>%
+ decorate_outputs(version_label = NULL) %>%
+ generate_slides(outfile = outfile, template = deck_template, table_format = imc_format)
t_ae_pt_slide
summary of AEs
+- program: t_ae_pt_slide
+ titles: Most common AEs (Experienced in at least 10% patients overall)
+ footnotes: ''
+ paper: L6
+ suffix: SE
+ args:
+ arm: "TRT01A"
+ cutoff: 10
Note: This is an example spec for the table “most common AEs
+(Experienced in at least 10% patients overall)”. User can change the
+cutoff value as needed. t_ae_pt_slide
serves as the
+backbone for many other AE tables. User can simply apply a different
+filter, or a combination of filters, to produce other AE tables. For
+example, user can use filter SE_REL
to produce related AE
+tables, SE_SER
for serious AE tables,
+SE_SER_REL
for related serious AE tables. User can also
+define their own filters in filter.yml
based on
+study-specific need. Below is another example spec for the table
+“Related G3-5 AEs (Experienced in at least 1% patients overall)”
- program: t_ae_pt_slide
+ titles: Related G3-5 AEs (Experienced in at least 1% patients overall)
+ footnotes: ''
+ paper: L6
+ suffix: SE_REL_G35
+ args:
+ arm: "TRT01A"
+ cutoff: 1
where the filter entries were defined as
+ +
+ADAE_m <- ADAE %>%
+ mutate(TRT01A = sas_na(factor(TRT01A,
+ levels = c("PLACEBO", "ATEZOLIZUMAB")
+ )))
+# execute spec to generate slide
+study_spec <- spec_file %>% read_spec()
+outputs <- study_spec %>%
+ filter_spec(., program %in% c("t_ae_pt_slide")) %>%
+ generate_outputs(datasets = list(adsl = ADSL_m, adae = ADAE_m)) %>%
+ decorate_outputs(version_label = NULL) %>%
+ generate_slides(outfile = outfile, template = deck_template, table_format = imc_format)
Zhu J, Wang H, Zhao Y, Ci B, Li L, Duan X, Thoma S, Almond M, Lv C (2024). autoslider.core: Slides automation with R. -R package version 0.0.1.9019, https://dss-rac.pages.roche.com/autoslideR/. +R package version 0.0.1.9020, https://dss-rac.pages.roche.com/autoslideR/.
@Manual{, title = {autoslider.core: Slides automation with R}, author = {Joe Zhu and Heng Wang and Yinqi Zhao and Bo Ci and Liming Li and Xiaoli Duan and Stefan Pascal Thoma and Miles Almond and Chenkai Lv}, year = {2024}, - note = {R package version 0.0.1.9019}, + note = {R package version 0.0.1.9020}, url = {https://dss-rac.pages.roche.com/autoslideR/}, }diff --git a/main/index.html b/main/index.html index 081ba775..da07007a 100644 --- a/main/index.html +++ b/main/index.html @@ -33,7 +33,7 @@ autoslider.core - 0.0.1.9019 + 0.0.1.9020 @@ -42,6 +42,18 @@
A: Drug X | B: Placebo | C: Combination | All Patients | |
---|---|---|---|---|
(N=134) | (N=134) | (N=132) | (N=400) | |
Sex | ||||
F | 79 (59%) | 82 (61.2%) | 70 (53%) | 231 (57.8%) |
M | 55 (41%) | 52 (38.8%) | 62 (47%) | 169 (42.2%) |
Age | ||||
Median | 33.00 | 35.00 | 35.00 | 34.00 |
Min - Max | 21.0 - 50.0 | 21.0 - 62.0 | 20.0 - 69.0 | 20.0 - 69.0 |
A: Drug X | B: Placebo | C: Combination | All Patients | |
---|---|---|---|---|
(N=134) | (N=134) | (N=132) | (N=400) | |
Sex | ||||
F | 79 (59%) | 82 (61.2%) | 70 (53%) | 231 (57.8%) |
M | 55 (41%) | 52 (38.8%) | 62 (47%) | 169 (42.2%) |
Age | ||||
Median | 33.00 | 35.00 | 35.00 | 34.00 |
Min - Max | 21.0 - 50.0 | 21.0 - 62.0 | 20.0 - 69.0 | 20.0 - 69.0 |