Skip to content

revisit decouple scda #124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ SECURITY.md
^LICENSE\.md$
coverage.*
^\.pre-commit-config\.yaml$
data-raw/data.R
16 changes: 8 additions & 8 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#' @description Random adverse events
#' @docType data
#'
#' @usage data(rADAE)
#' @usage rADAE
#'
#' @keywords datasets internal
#'
Expand All @@ -16,7 +16,7 @@
#' @description Random Concomitant Medications
#' @docType data
#'
#' @usage data(rADCM)
#' @usage rADCM
#'
#' @keywords datasets internal
#'
Expand All @@ -29,7 +29,7 @@
#' @description Random Exposure
#' @docType data
#'
#' @usage data(rADEX)
#' @usage rADEX
#'
#' @keywords datasets internal
#'
Expand All @@ -42,7 +42,7 @@
#' @description Random lab analysis
#' @docType data
#'
#' @usage data(rADLB)
#' @usage rADLB
#'
#' @keywords datasets internal
#'
Expand All @@ -55,7 +55,7 @@
#' @description Random response
#' @docType data
#'
#' @usage data(rADRS)
#' @usage rADRS
#'
#' @keywords datasets internal
#'
Expand All @@ -70,7 +70,7 @@
#'
#' @keywords datasets internal
#'
#' @usage data(rADSL)
#' @usage rADSL
#'
#' @source internal
#' @name rADSL
Expand All @@ -83,7 +83,7 @@
#'
#' @keywords datasets internal
#'
#' @usage data(rADTR)
#' @usage rADTR
#'
#' @source internal
#' @name rADTR
Expand All @@ -96,7 +96,7 @@
#'
#' @keywords datasets internal
#'
#' @usage data(rADTTE)
#' @usage rADTTE
#'
#' @source internal
#' @name rADTTE
Expand Down
8 changes: 4 additions & 4 deletions R/g_ae_sub.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
#'
#' @examples
#' library(grid)
#' ADAE <- rADAE
#' ADSL <- rADSL
#' ADAE <- osprey::rADAE
#' ADSL <- osprey::rADSL
#'
#' id <- ADAE$USUBJID
#' arm <- ADAE$ACTARMCD
Expand Down Expand Up @@ -89,8 +89,8 @@
#' # Example 3: preprocess data to only include treatment and control arm patients
#' trt <- "ARM A"
#' ref <- "ARM C"
#' ADAE <- rADAE
#' ADSL <- rADSL %>% filter(ACTARMCD %in% c(trt, ref))
#' ADAE <- osprey::rADAE
#' ADSL <- osprey::rADSL %>% filter(ACTARMCD %in% c(trt, ref))
#' id <- ADAE$USUBJID
#' arm <- ADAE$ACTARMCD
#' arm_sl <- as.character(ADSL$ACTARMCD)
Expand Down
4 changes: 2 additions & 2 deletions R/g_butterfly.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@
#' library(dplyr)
#' library(nestcolor)
#'
#' ADSL <- rADSL %>%
#' ADSL <- osprey::rADSL %>%
#' select(USUBJID, STUDYID, SEX, ARM, RACE) %>%
#' dplyr::filter(SEX %in% c("F", "M"))
#' ADAE <- rADAE %>% select(USUBJID, STUDYID, AEBODSYS, AETOXGR)
#' ADAE <- osprey::rADAE %>% select(USUBJID, STUDYID, AEBODSYS, AETOXGR)
#'
#' ANL <- left_join(ADAE, ADSL, by = c("STUDYID", "USUBJID"))
#' ANL <- ANL %>%
Expand Down
6 changes: 3 additions & 3 deletions R/g_events_term_id.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
#' library(grid)
#' library(nestcolor)
#'
#' ADSL <- rADSL
#' ADAE <- rADAE
#' ADSL <- osprey::rADSL
#' ADAE <- osprey::rADAE
#'
#' # add additional dummy causality flags
#' ADAE <- ADAE %>%
Expand Down Expand Up @@ -409,7 +409,7 @@ g_events_term_id <- function(term,
#' @examples
#' library(dplyr)
#'
#' ADAE <- rADAE
#' ADAE <- osprey::rADAE
#'
#' # add additional dummy causality flags
#' ADAE <- ADAE %>%
Expand Down
8 changes: 4 additions & 4 deletions R/g_heat_bygrade.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
#' @examples
#' library(dplyr)
#'
#' ADSL <- rADSL %>% slice(1:30)
#' ADEX <- rADEX %>% filter(USUBJID %in% ADSL$USUBJID)
#' ADAE <- rADAE %>% filter(USUBJID %in% ADSL$USUBJID)
#' ADCM <- rADCM %>% filter(USUBJID %in% ADSL$USUBJID)
#' ADSL <- osprey::rADSL %>% slice(1:30)
#' ADEX <- osprey::rADEX %>% filter(USUBJID %in% ADSL$USUBJID)
#' ADAE <- osprey::rADAE %>% filter(USUBJID %in% ADSL$USUBJID)
#' ADCM <- osprey::rADCM %>% filter(USUBJID %in% ADSL$USUBJID)
#' # function to derive AVISIT from ADEX
#' add_visit <- function(data_need_visit) {
#' visit_dates <- ADEX %>%
Expand Down
4 changes: 2 additions & 2 deletions R/g_hy_law.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
#' library(nestcolor)
#'
#' # Note: CRP is being used in place of Bilirubin here because this is the only available data
#' adsl <- rADSL
#' adlb <- rADLB %>% mutate(ANRHI = 50)
#' adsl <- osprey::rADSL
#' adlb <- osprey::rADLB %>% mutate(ANRHI = 50)
#'
#' # Example 1, - Hy's law template (3 and 2 X ULN)
#' g_hy_law(
Expand Down
24 changes: 12 additions & 12 deletions R/g_patient_profile.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
#' library(dplyr)
#'
#' # ADSL
#' ADSL <- rADSL %>%
#' ADSL <- osprey::rADSL %>%
#' filter(USUBJID == rADSL$USUBJID[1]) %>%
#' mutate(
#' TRTSDT = as.Date(TRTSDTM),
Expand All @@ -82,7 +82,7 @@
#'
#'
#' # Example 1 Exposure "ADEX"
#' ADEX <- rADEX %>%
#' ADEX <- osprey::rADEX %>%
#' select(USUBJID, STUDYID, ASTDTM, PARCAT2, AVAL, AVALU, PARAMCD)
#' ADEX <- left_join(ADSL, ADEX, by = c("USUBJID", "STUDYID"))
#' ADEX <- ADEX %>%
Expand Down Expand Up @@ -136,7 +136,7 @@
#' # If AENDY and ASTDY occur on the same day only AENDY will be shown.
#'
#' # Adverse Event ADAE
#' ADAE <- rADAE %>%
#' ADAE <- osprey::rADAE %>%
#' select(USUBJID, STUDYID, AESOC, AEDECOD, AESER, AETOXGR, AEREL, ASTDY, AENDY)
#' ADAE <- left_join(ADSL, ADAE, by = c("USUBJID", "STUDYID"))
#'
Expand Down Expand Up @@ -172,7 +172,7 @@
#' p2
#'
#' # Example 3 Tumor Response "ADRS"
#' ADRS <- rADRS %>%
#' ADRS <- osprey::rADRS %>%
#' select(USUBJID, STUDYID, PARAMCD, PARAM, AVALC, AVAL, ADY, ADTM)
#' ADRS <- left_join(ADSL, ADRS, by = c("USUBJID", "STUDYID"))
#' p3 <- patient_domain_profile(
Expand Down Expand Up @@ -211,7 +211,7 @@
#' p3
#'
#' # Example 4 Concomitant Med "ADCM"
#' ADCM <- rADCM %>%
#' ADCM <- osprey::rADCM %>%
#' select(USUBJID, STUDYID, ASTDTM, AENDTM, CMDECOD, ASTDY, AENDY)
#' ADCM <- left_join(ADSL, ADCM, by = c("USUBJID", "STUDYID"))
#' p4 <- patient_domain_profile(
Expand All @@ -234,7 +234,7 @@
#' p4
#'
#' # Example 5 Laboratory "ADLB"
#' ADLB <- rADLB %>%
#' ADLB <- osprey::rADLB %>%
#' select(
#' USUBJID, STUDYID, LBSEQ, PARAMCD, BASETYPE,
#' ADTM, ADY, ATPTN, AVISITN, LBTESTCD, ANRIND
Expand Down Expand Up @@ -612,7 +612,7 @@ patient_domain_profile <- function(domain = NULL,
#' library(dplyr)
#' library(nestcolor)
#' # ADSL
#' ADSL <- rADSL %>%
#' ADSL <- osprey::rADSL %>%
#' filter(USUBJID == rADSL$USUBJID[1]) %>%
#' mutate(
#' TRTSDT = as.Date(TRTSDTM),
Expand All @@ -623,7 +623,7 @@ patient_domain_profile <- function(domain = NULL,
#'
#'
#' # ADEX
#' ADEX <- rADEX %>%
#' ADEX <- osprey::rADEX %>%
#' select(USUBJID, STUDYID, ASTDTM, PARCAT2, AVAL, AVALU, PARAMCD)
#' ADEX <- left_join(ADSL, ADEX, by = c("USUBJID", "STUDYID"))
#'
Expand All @@ -642,22 +642,22 @@ patient_domain_profile <- function(domain = NULL,
#' ))
#'
#' # ADAE
#' ADAE <- rADAE %>%
#' ADAE <- osprey::rADAE %>%
#' select(USUBJID, STUDYID, AESOC, AEDECOD, AESER, AETOXGR, AEREL, ASTDY, AENDY)
#' ADAE <- left_join(ADSL, ADAE, by = c("USUBJID", "STUDYID"))
#'
#' # ADRS
#' ADRS <- rADRS %>%
#' ADRS <- osprey::rADRS %>%
#' select(USUBJID, STUDYID, PARAMCD, PARAM, AVALC, AVAL, ADY, ADTM)
#' ADRS <- left_join(ADSL, ADRS, by = c("USUBJID", "STUDYID"))
#'
#' # ADCM
#' ADCM <- rADCM %>%
#' ADCM <- osprey::rADCM %>%
#' select(USUBJID, STUDYID, ASTDTM, AENDTM, CMDECOD, ASTDY, AENDY)
#' ADCM <- left_join(ADSL, ADCM, by = c("USUBJID", "STUDYID"))
#'
#' # ADLB
#' ADLB <- rADLB %>%
#' ADLB <- osprey::rADLB %>%
#' select(
#' USUBJID, STUDYID, LBSEQ, PARAMCD, BASETYPE, ADTM,
#' ADY, ATPTN, AVISITN, LBTESTCD, ANRIND
Expand Down
4 changes: 2 additions & 2 deletions R/g_spiderplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
#' library(dplyr)
#' library(nestcolor)
#'
#' ADTR <- rADTR %>% select(STUDYID, USUBJID, ADY, AVISIT, CHG, PCHG, PARAMCD)
#' ADSL <- rADSL %>% select(STUDYID, USUBJID, RACE, SEX, ARM)
#' ADTR <- osprey::rADTR %>% select(STUDYID, USUBJID, ADY, AVISIT, CHG, PCHG, PARAMCD)
#' ADSL <- osprey::rADSL %>% select(STUDYID, USUBJID, RACE, SEX, ARM)
#' ANL <- left_join(ADTR, ADSL, by = c("STUDYID", "USUBJID"))
#' ANL <- ANL %>%
#' dplyr::filter(PARAMCD == "SLDINV" & AVISIT != "POST-BASELINE MINIMUM") %>%
Expand Down
4 changes: 2 additions & 2 deletions R/g_spiderplot_simple.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#' library(dplyr)
#' library(nestcolor)
#'
#' ADSL <- rADSL[1:15, ]
#' ADTR <- rADTR
#' ADSL <- osprey::rADSL[1:15, ]
#' ADTR <- osprey::rADTR
#' ANL <- left_join(ADSL, ADTR)
#'
#' ANL %>%
Expand Down
6 changes: 3 additions & 3 deletions R/g_swimlane.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#' library(dplyr)
#' library(nestcolor)
#'
#' ADSL <- rADSL[1:20, ]
#' ADSL <- osprey::rADSL[1:20, ]
#' ADRS <- filter(rADRS, PARAMCD == "OVRINV")
#' ANL <- left_join(ADSL, ADRS, by = c("STUDYID", "USUBJID"), multiple = "all")
#' anno_txt <- ADSL[, c("ARMCD", "SEX")]
Expand All @@ -56,8 +56,8 @@
#' library(dplyr)
#' library(nestcolor)
#'
#' ADSL <- rADSL[1:20, ]
#' ADRS <- rADRS
#' ADSL <- osprey::rADSL[1:20, ]
#' ADRS <- osprey::rADRS
#'
#' anno_txt_vars <- c("ARMCD", "SEX", "COUNTRY")
#' anno_txt <- ADSL[, anno_txt_vars]
Expand Down
6 changes: 3 additions & 3 deletions R/g_waterfall.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@
#' )
#'
#' # Example 1
#' ADSL <- rADSL[1:15, ]
#' ADRS <- rADRS %>%
#' ADSL <- osprey::rADSL[1:15, ]
#' ADRS <- osprey::rADRS %>%
#' filter(USUBJID %in% ADSL$USUBJID)
#' ADTR <- rADTR %>%
#' ADTR <- osprey::rADTR %>%
#' filter(USUBJID %in% ADSL$USUBJID) %>%
#' select(USUBJID, PCHG) %>%
#' group_by(USUBJID) %>%
Expand Down
4 changes: 2 additions & 2 deletions R/stream_filter.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
#' @author Iain Bennett
#' @export
#' @examples
#' ADSL <- rADSL
#' ADTTE <- rADTTE
#' ADSL <- osprey::rADSL
#' ADTTE <- osprey::rADTTE
#' filters <- as.data.frame(rbind(
#' c(ID = "IT", FLTTARGET = "SLREF", FLTWHERE = "where 1 eq 1"),
#' c(ID = "BIO", FLTTARGET = "SLREF", FLTWHERE = "where BMRKR1 ge 4.3"),
Expand Down
25 changes: 25 additions & 0 deletions data-raw/data.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## code to prepare `data` for testing examples
library(scda)
rADAE <- synthetic_cdisc_data("latest")$adae # nolint
usethis::use_data(rADAE)

rADCM <- synthetic_cdisc_data("latest")$adcm # nolint
usethis::use_data(rADCM)

rADEX <- synthetic_cdisc_data("latest")$adex # nolint
usethis::use_data(rADEX)

rADLB <- synthetic_cdisc_data("latest")$adlb # nolint
usethis::use_data(rADLB)

rADRS <- synthetic_cdisc_data("latest")$adrs # nolint
usethis::use_data(rADRS)

rADSL <- synthetic_cdisc_data("latest")$adsl # nolint
usethis::use_data(rADSL)

rADTR <- synthetic_cdisc_data("latest")$adtr # nolint
usethis::use_data(rADTR)

rADTTE <- synthetic_cdisc_data("latest")$adtte # nolint
usethis::use_data(rADTTE)
2 changes: 1 addition & 1 deletion man/create_flag_vars.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions man/g_ae_sub.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/g_butterfly.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading