diff --git a/DESCRIPTION b/DESCRIPTION index ff1fdd2c..921faf09 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -46,8 +46,6 @@ Suggests: scda.2021 (>= 0.1.3), teal.data (>= 0.1.1), testthat (>= 2.0) -VignetteBuilder: - knitr Remotes: insightsengineering/osprey@*release, insightsengineering/scda.2021@*release, diff --git a/R/tm_g_ae_oview.R b/R/tm_g_ae_oview.R index e3666b83..f830f0df 100644 --- a/R/tm_g_ae_oview.R +++ b/R/tm_g_ae_oview.R @@ -16,8 +16,9 @@ #' library(scda) #' library(nestcolor) #' -#' ADSL <- synthetic_cdisc_data("latest")$adsl -#' ADAE <- synthetic_cdisc_data("latest")$adae +#' latest_data <- synthetic_cdisc_data("latest") +#' ADSL <- latest_data$adsl +#' ADAE <- latest_data$adae #' #' # Add additional dummy causality flags. #' add_event_flags <- function(dat) { diff --git a/R/tm_g_heat_bygrade.R b/R/tm_g_heat_bygrade.R index 459f40ef..0884b3b1 100644 --- a/R/tm_g_heat_bygrade.R +++ b/R/tm_g_heat_bygrade.R @@ -34,10 +34,11 @@ #' library(scda) #' library(dplyr) #' library(nestcolor) -#' ADSL <- synthetic_cdisc_data("latest")$adsl %>% slice(1:30) -#' ADEX <- synthetic_cdisc_data("latest")$adex %>% filter(USUBJID %in% ADSL$USUBJID) -#' ADAE <- synthetic_cdisc_data("latest")$adae %>% filter(USUBJID %in% ADSL$USUBJID) -#' ADCM <- synthetic_cdisc_data("latest")$adcm %>% filter(USUBJID %in% ADSL$USUBJID) +#' latest_data <- synthetic_cdisc_data("latest") +#' ADSL <- latest_data$adsl %>% slice(1:30) +#' ADEX <- latest_data$adex %>% filter(USUBJID %in% ADSL$USUBJID) +#' ADAE <- latest_data$adae %>% filter(USUBJID %in% ADSL$USUBJID) +#' ADCM <- latest_data$adcm %>% filter(USUBJID %in% ADSL$USUBJID) #' #' # This preprocess is only to force legacy standard on ADCM #' ADCM <- ADCM %>% @@ -76,10 +77,11 @@ #' cdisc_dataset("ADAE", ADAE), #' cdisc_dataset("ADCM", ADCM, keys = c("STUDYID", "USUBJID", "ASTDTM", "CMSEQ", "CMDECOD")), #' code = " -#' ADSL <- synthetic_cdisc_data(\"latest\")$adsl %>% slice(1:30) -#' ADEX <- synthetic_cdisc_data(\"latest\")$adex %>% filter(USUBJID %in% ADSL$USUBJID) -#' ADAE <- synthetic_cdisc_data(\"latest\")$adae %>% filter(USUBJID %in% ADSL$USUBJID) -#' ADCM <- synthetic_cdisc_data(\"latest\")$adcm %>% filter(USUBJID %in% ADSL$USUBJID) +#' latest_data <- synthetic_cdisc_data('latest') +#' ADSL <- latest_data$adsl %>% slice(1:30) +#' ADEX <- latest_data$adex %>% filter(USUBJID %in% ADSL$USUBJID) +#' ADAE <- latest_data$adae %>% filter(USUBJID %in% ADSL$USUBJID) +#' ADCM <- latest_data$adcm %>% filter(USUBJID %in% ADSL$USUBJID) #' ADCM <- ADCM %>% select(-starts_with(\"ATC\")) %>% unique() #' ADEX <- ADEX %>% #' filter(PARCAT1 == 'INDIVIDUAL') %>% @@ -324,7 +326,7 @@ srv_g_heatmap_bygrade <- function(id, observeEvent(input$plot_cm, { ADCM <- datasets$get_data(cm_dataname, filtered = TRUE) # nolint ADCM_label <- formatters::var_labels(datasets$get_data(cm_dataname, filtered = FALSE), fill = FALSE) # nolint - formatters::var_labels(ADCM) <- ADCM_label + formatters::var_labels(ADCM) <- ADCM_label # nolint choices <- levels(ADCM[[input$conmed_var]]) updateSelectInput( @@ -347,11 +349,11 @@ srv_g_heatmap_bygrade <- function(id, ADAE <- datasets$get_data(ae_dataname, filtered = TRUE) # nolint # assign labels back to the data - formatters::var_labels(ADSL) <- + formatters::var_labels(ADSL) <- # nolint formatters::var_labels(datasets$get_data(sl_dataname, filtered = FALSE), fill = FALSE) - formatters::var_labels(ADEX) <- + formatters::var_labels(ADEX) <- # nolint formatters::var_labels(datasets$get_data(ex_dataname, filtered = FALSE), fill = FALSE) - formatters::var_labels(ADAE) <- + formatters::var_labels(ADAE) <- # nolint formatters::var_labels(datasets$get_data(ae_dataname, filtered = FALSE), fill = FALSE) validate(need(nrow(ADSL) > 0, "Please select at least one subject")) @@ -379,7 +381,7 @@ srv_g_heatmap_bygrade <- function(id, if (input$plot_cm) { ADCM <- datasets$get_data(cm_dataname, filtered = TRUE) # nolint ADCM_label <- formatters::var_labels(datasets$get_data(cm_dataname, filtered = FALSE), fill = FALSE) # nolint - formatters::var_labels(ADCM) <- ADCM_label + formatters::var_labels(ADCM) <- ADCM_label # nolint validate( need( input$conmed_var %in% names(ADCM), diff --git a/R/tm_g_patient_profile.R b/R/tm_g_patient_profile.R index d575acf0..7fbce9e5 100644 --- a/R/tm_g_patient_profile.R +++ b/R/tm_g_patient_profile.R @@ -84,13 +84,15 @@ #' library(scda) #' library(nestcolor) #' -#' ADSL <- synthetic_cdisc_data("latest")$adsl -#' ADAE <- synthetic_cdisc_data("latest")$adae %>% +#' latest_data <- synthetic_cdisc_data("latest") +#' +#' ADSL <- latest_data$adsl +#' ADAE <- latest_data$adae %>% #' mutate( #' ASTDT = as.Date(ASTDTM), #' AENDT = as.Date(AENDTM) #' ) -#' ADCM <- synthetic_cdisc_data("latest")$adcm %>% +#' ADCM <- latest_data$adcm %>% #' mutate( #' ASTDT = as.Date(ASTDTM), #' AENDT = as.Date(AENDTM) @@ -101,14 +103,14 @@ #' select(-starts_with("ATC")) %>% #' unique() #' -#' ADRS <- synthetic_cdisc_data("latest")$adrs %>% +#' ADRS <- latest_data$adrs %>% #' mutate(ADT = as.Date(ADTM)) -#' ADEX <- synthetic_cdisc_data("latest")$adex %>% +#' ADEX <- latest_data$adex %>% #' mutate( #' ASTDT = as.Date(ASTDTM), #' AENDT = as.Date(AENDTM) #' ) -#' ADLB <- synthetic_cdisc_data("latest")$adlb %>% +#' ADLB <- latest_data$adlb %>% #' mutate( #' ADT = as.Date(ADTM), #' LBSTRESN = as.numeric(LBSTRESC) @@ -145,7 +147,7 @@ #' mutate(ASTDT = as.Date(ASTDTM), #' AENDT = as.Date(AENDTM))" #' ), -#' check = TRUE +#' check = FALSE # set FALSE here to keep run time of example short, should be set to TRUE #' ), #' modules = modules( #' tm_g_patient_profile( @@ -564,7 +566,7 @@ srv_g_patient_profile <- function(id, ADAE <- NULL # nolint } else { ADAE <- datasets$get_data(ae_dataname, filtered = TRUE) # nolint - formatters::var_labels(ADAE) <- formatters::var_labels( + formatters::var_labels(ADAE) <- formatters::var_labels( # nolint datasets$get_data(ae_dataname, filtered = FALSE), fill = FALSE ) @@ -654,7 +656,7 @@ srv_g_patient_profile <- function(id, expression = bquote({ ADSL <- ADSL %>% # nolint group_by(.data$USUBJID) - ADSL$max_date <- pmax( + ADSL$max_date <- pmax( # nolint as.Date(ADSL$LSTALVDT), as.Date(ADSL$DTHDT), na.rm = TRUE @@ -745,7 +747,7 @@ srv_g_patient_profile <- function(id, as.character(eval(parse(text = .(sl_start_date), keep.source = FALSE))), 1, 10 )))) %>% select(c(.(adae_vars), ASTDY, AENDY)) - formatters::var_labels(ADAE)[.(ae_line_col_var)] <- + formatters::var_labels(ADAE)[.(ae_line_col_var)] <- # nolint formatters::var_labels(ADAE, fill = FALSE)[.(ae_line_col_var)] }) ) diff --git a/README.md b/README.md index 0d01d0bc..a64b8d2d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # teal.osprey -The teal.osprey package provides community contributed `teal` modules of the analysis functions from the [osprey](https://insightsengineering.github.io/osprey) R package. +The teal.osprey package provides community contributed `teal` modules of the analysis functions from the [osprey](https://insightsengineering.github.io/osprey/) R package. This enables `teal` app developers to easily create applications making use of the `osprey` analysis functions. ## Installation @@ -15,7 +15,7 @@ remotes::install_github("insightsengineering/teal.osprey@*release") A stable release of all `NEST` packages from June 2022 is also available [here](https://github.com/insightsengineering/depository#readme). -In order to run many of the examples you will also need to install the [`scda`](https://insightsengineering.github.io/scda) package. +In order to run many of the examples you will also need to install the [`scda`](https://insightsengineering.github.io/scda/) package. ## Stargazers and Forkers diff --git a/man/tm_g_ae_oview.Rd b/man/tm_g_ae_oview.Rd index 65ad9295..99ea24bf 100644 --- a/man/tm_g_ae_oview.Rd +++ b/man/tm_g_ae_oview.Rd @@ -52,8 +52,9 @@ Display the AE overview plot as a shiny module library(scda) library(nestcolor) -ADSL <- synthetic_cdisc_data("latest")$adsl -ADAE <- synthetic_cdisc_data("latest")$adae +latest_data <- synthetic_cdisc_data("latest") +ADSL <- latest_data$adsl +ADAE <- latest_data$adae # Add additional dummy causality flags. add_event_flags <- function(dat) { diff --git a/man/tm_g_heat_bygrade.Rd b/man/tm_g_heat_bygrade.Rd index ab24b662..4e6dbde6 100644 --- a/man/tm_g_heat_bygrade.Rd +++ b/man/tm_g_heat_bygrade.Rd @@ -77,10 +77,11 @@ Display the heatmap by grade as a shiny module library(scda) library(dplyr) library(nestcolor) -ADSL <- synthetic_cdisc_data("latest")$adsl \%>\% slice(1:30) -ADEX <- synthetic_cdisc_data("latest")$adex \%>\% filter(USUBJID \%in\% ADSL$USUBJID) -ADAE <- synthetic_cdisc_data("latest")$adae \%>\% filter(USUBJID \%in\% ADSL$USUBJID) -ADCM <- synthetic_cdisc_data("latest")$adcm \%>\% filter(USUBJID \%in\% ADSL$USUBJID) +latest_data <- synthetic_cdisc_data("latest") +ADSL <- latest_data$adsl \%>\% slice(1:30) +ADEX <- latest_data$adex \%>\% filter(USUBJID \%in\% ADSL$USUBJID) +ADAE <- latest_data$adae \%>\% filter(USUBJID \%in\% ADSL$USUBJID) +ADCM <- latest_data$adcm \%>\% filter(USUBJID \%in\% ADSL$USUBJID) # This preprocess is only to force legacy standard on ADCM ADCM <- ADCM \%>\% @@ -119,10 +120,11 @@ app <- init( cdisc_dataset("ADAE", ADAE), cdisc_dataset("ADCM", ADCM, keys = c("STUDYID", "USUBJID", "ASTDTM", "CMSEQ", "CMDECOD")), code = " - ADSL <- synthetic_cdisc_data(\"latest\")$adsl \%>\% slice(1:30) - ADEX <- synthetic_cdisc_data(\"latest\")$adex \%>\% filter(USUBJID \%in\% ADSL$USUBJID) - ADAE <- synthetic_cdisc_data(\"latest\")$adae \%>\% filter(USUBJID \%in\% ADSL$USUBJID) - ADCM <- synthetic_cdisc_data(\"latest\")$adcm \%>\% filter(USUBJID \%in\% ADSL$USUBJID) + latest_data <- synthetic_cdisc_data('latest') + ADSL <- latest_data$adsl \%>\% slice(1:30) + ADEX <- latest_data$adex \%>\% filter(USUBJID \%in\% ADSL$USUBJID) + ADAE <- latest_data$adae \%>\% filter(USUBJID \%in\% ADSL$USUBJID) + ADCM <- latest_data$adcm \%>\% filter(USUBJID \%in\% ADSL$USUBJID) ADCM <- ADCM \%>\% select(-starts_with(\"ATC\")) \%>\% unique() ADEX <- ADEX \%>\% filter(PARCAT1 == 'INDIVIDUAL') \%>\% diff --git a/man/tm_g_patient_profile.Rd b/man/tm_g_patient_profile.Rd index 4ec771d0..136b5ccf 100644 --- a/man/tm_g_patient_profile.Rd +++ b/man/tm_g_patient_profile.Rd @@ -146,13 +146,15 @@ the start date library(scda) library(nestcolor) -ADSL <- synthetic_cdisc_data("latest")$adsl -ADAE <- synthetic_cdisc_data("latest")$adae \%>\% +latest_data <- synthetic_cdisc_data("latest") + +ADSL <- latest_data$adsl +ADAE <- latest_data$adae \%>\% mutate( ASTDT = as.Date(ASTDTM), AENDT = as.Date(AENDTM) ) -ADCM <- synthetic_cdisc_data("latest")$adcm \%>\% +ADCM <- latest_data$adcm \%>\% mutate( ASTDT = as.Date(ASTDTM), AENDT = as.Date(AENDTM) @@ -163,14 +165,14 @@ ADCM <- ADCM \%>\% select(-starts_with("ATC")) \%>\% unique() -ADRS <- synthetic_cdisc_data("latest")$adrs \%>\% +ADRS <- latest_data$adrs \%>\% mutate(ADT = as.Date(ADTM)) -ADEX <- synthetic_cdisc_data("latest")$adex \%>\% +ADEX <- latest_data$adex \%>\% mutate( ASTDT = as.Date(ASTDTM), AENDT = as.Date(AENDTM) ) -ADLB <- synthetic_cdisc_data("latest")$adlb \%>\% +ADLB <- latest_data$adlb \%>\% mutate( ADT = as.Date(ADTM), LBSTRESN = as.numeric(LBSTRESC) @@ -207,7 +209,7 @@ x <- init( mutate(ASTDT = as.Date(ASTDTM), AENDT = as.Date(AENDTM))" ), - check = TRUE + check = FALSE # set FALSE here to keep run time of example short, should be set to TRUE ), modules = modules( tm_g_patient_profile(