Skip to content
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

128 aet02 template #204

Merged
merged 31 commits into from
Jul 6, 2022
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
350ee0a
For the breakdown of `OTHER`, the percentages are based on `N`.
Meixh2021 Jun 1, 2022
c8da140
For the breakdown of `OTHER`, the percentages are based on `N`.
Meixh2021 Jun 1, 2022
e7715f4
160 Replace `asserthat` with `checkmate` (#188)
BFalquet May 31, 2022
d70d353
[skip actions] Bump version to 0.1.0.9011
crazycatandy May 31, 2022
5cfb9f5
modify subtitle (#192)
BFalquet Jun 6, 2022
4c2c896
[skip actions] Bump version to 0.1.0.9012
crazycatandy Jun 6, 2022
00c0cff
suppress notes (#191)
BFalquet Jun 9, 2022
f95fc3b
[skip actions] Bump version to 0.1.0.9013
BFalquet Jun 9, 2022
1dfcf1f
193 combine filter and mutate preprocessing function (#194)
BFalquet Jun 9, 2022
365b3ad
[skip actions] Bump version to 0.1.0.9014
wangh107 Jun 9, 2022
0550748
#128 AET02 template issue
Meixh2021 Jun 21, 2022
359f0a6
#128 AET02 template issue
Meixh2021 Jun 21, 2022
dedac77
#128 AET02 template issues
Meixh2021 Jun 21, 2022
0580f88
#128 AET02 template issue
Meixh2021 Jun 21, 2022
d4ff115
#128 AET02 template issue
Meixh2021 Jun 21, 2022
d14d776
Force the table label on the topleft
Meixh2021 Jun 23, 2022
32dca25
Merge branch 'main' into 128_aet02_template
Meixh2021 Jun 23, 2022
612a4e5
#128 AET02 template issue
Meixh2021 Jun 23, 2022
a3c369d
Update dtht01_1.Rd
Meixh2021 Jun 23, 2022
f119039
#128 AET02 template issue
Meixh2021 Jun 23, 2022
4b3ae7c
Update R/aet02.R
Meixh2021 Jun 24, 2022
84f4e81
Update R/dtht01.R
Meixh2021 Jun 24, 2022
9c2380b
Update R/dtht01.R
Meixh2021 Jun 24, 2022
66b4e6c
Update R/dtht01.R
Meixh2021 Jun 24, 2022
130780f
Update R/dtht01.R
Meixh2021 Jun 24, 2022
985a7c2
#128 AET02 template issue
Meixh2021 Jun 24, 2022
8fa8917
#128 AET02 template issue
Meixh2021 Jun 24, 2022
7795cf9
#128 AET02 template issue
Meixh2021 Jun 24, 2022
f0659ec
#128 AET02 template issue
Meixh2021 Jun 24, 2022
d8b984e
Missing values process in `AEBODSYS`, `AEHLT` and `AEDECOD` in `aet02…
Meixh2021 Jun 28, 2022
94f15f6
Resume DTHT01
Meixh2021 Jun 29, 2022
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
48 changes: 15 additions & 33 deletions R/aet02.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@
#' aet02_1(adam_db = list(adsl = db$adsl, adae = db$adae)) %>% head()
#'
#' aet02_1(db, lbl_overall = "All Patients") %>% head()
#'
#' db_m <- db %>%
#' dm_zoom_to(adae) %>%
#' mutate(AEBODSYS = formatters::with_label(AEBODSYS, "Medra System Organ Class")) %>%
#' dm_update_zoomed()
#'
#' aet02_1(db_m) %>% head()
aet02_1 <- function(adam_db,
armvar = .study$actualarm,
lbl_overall = .study$lbl_overall,
Expand All @@ -55,8 +48,6 @@ aet02_1 <- function(adam_db,
lyt <- aet02_1_lyt(
armvar = armvar,
lbl_overall = lbl_overall,
lbl_aebodsys = var_labels_for(dbsel$adae, "AEBODSYS"),
lbl_aedecod = var_labels_for(dbsel$adae, "AEDECOD"),
deco = deco
)

Expand All @@ -69,7 +60,7 @@ aet02_1 <- function(adam_db,
tbl_sorted <- tbl %>%
sort_at_path(
path = c("AEBODSYS"),
scorefun = cont_n_onecol(ncol(tbl))
scorefun = cont_n_allcols
) %>%
sort_at_path(
path = c("AEBODSYS", "*", "AEDECOD"),
Expand All @@ -95,8 +86,8 @@ aet02_1 <- function(adam_db,
#' )
aet02_1_lyt <- function(armvar = .study$actualarm,
lbl_overall = .study$lbl_overall,
lbl_aebodsys = "Body System or Organ Class",
lbl_aedecod = "Dictionary-Derived Term",
lbl_aebodsys = "MedDRA System Organ Class",
lbl_aedecod = "MedDRA Preferred Term",
deco = std_deco("AET02"),
.study = list(
actualarm = "ACTARM",
Expand Down Expand Up @@ -154,7 +145,8 @@ aet02_1_pre <- function(adam_db) {
adam_db %>%
dm_zoom_to("adae") %>%
filter(.data$ANL01FL == "Y") %>%
dm_update_zoomed()
dm_update_zoomed() %>%
dm_explicit_na(na_level = "No Coding available")
}

# Version2 ----
Expand Down Expand Up @@ -188,13 +180,6 @@ aet02_1_pre <- function(adam_db) {
#'
#' # Additional Examples
#' aet02_2(db, lbl_overall = "All Patients") %>% head()
#'
#' db_m <- db %>%
#' dm_zoom_to(adae) %>%
#' mutate(AEBODSYS = formatters::with_label(AEBODSYS, "MedDRA System Organ Class")) %>%
#' dm_update_zoomed()
#'
#' aet02_2(db_m) %>% head()
aet02_2 <- function(adam_db,
armvar = .study$actualarm,
lbl_overall = .study$lbl_overall,
Expand All @@ -205,18 +190,14 @@ aet02_2 <- function(adam_db,
lbl_overall = NULL
)) {
dbsel <- get_db_data(adam_db, "adsl", "adae")
adae <- dbsel$adae

lyt <- aet02_2_lyt(
armvar = armvar,
lbl_overall = lbl_overall,
lbl_aebodsys = var_labels_for(adae, "AEBODSYS"),
lbl_aehlt = var_labels_for(adae, "AEHLT"),
lbl_aedecod = var_labels_for(adae, "AEDECOD"),
deco = deco
)

tbl <- build_table(lyt, adae, alt_counts_df = dbsel$adsl)
tbl <- build_table(lyt, dbsel$adae, alt_counts_df = dbsel$adsl)

if (prune_0) {
tbl <- prune_table(tbl)
Expand Down Expand Up @@ -260,9 +241,9 @@ aet02_2 <- function(adam_db,
#' )
aet02_2_lyt <- function(armvar = .study$actualarm,
lbl_overall = .study$lbl_overall,
lbl_aebodsys = "AEBODSYS",
lbl_aehlt = "AEHLT",
lbl_aedecod = "AEDECOD",
lbl_aebodsys = "MedDRA System Organ Class",
lbl_aehlt = "MedDRA High-Level Term",
lbl_aedecod = "MedDRA Preferred Term",
deco = std_deco("AET02"),
.study = list(
actualarm = "ACTARM",
Expand Down Expand Up @@ -336,7 +317,8 @@ aet02_2_pre <- function(adam_db) {
adam_db %>%
dm_zoom_to("adae") %>%
filter(.data$ANL01FL == "Y") %>%
dm_update_zoomed()
dm_update_zoomed() %>%
dm_explicit_na(na_level = "No Coding available")
}

# Version 3 ----
Expand Down Expand Up @@ -380,7 +362,6 @@ aet02_3 <- function(adam_db,
lyt <- aet02_3_lyt(
armvar = armvar,
lbl_overall = lbl_overall,
lbl_aedecod = var_labels_for(adam_db$adae, "AEDECOD"),
deco = deco
)

Expand Down Expand Up @@ -416,7 +397,7 @@ aet02_3 <- function(adam_db,
#' )
aet02_3_lyt <- function(armvar = .study$actualarm,
lbl_overall = .study$lbl_overall,
lbl_aedecod = "AEDECOD",
lbl_aedecod = "MedDRA Preferred Term",
deco = std_deco("AET02"),
.study = list(
actualarm = "ACTARM",
Expand All @@ -431,7 +412,7 @@ aet02_3_lyt <- function(armvar = .study$actualarm,
.stats = c("unique", "nonunique"),
.labels = c(
unique = "Total number of patients with at least one adverse event",
nonunique = "Overall total number of events"
nonunique = "Total number of events"
)
) %>%
count_occurrences(vars = "AEDECOD", .indent_mods = -2L) %>%
Expand All @@ -453,5 +434,6 @@ aet02_3_pre <- function(adam_db) {
adam_db %>%
dm_zoom_to("adae") %>%
filter(.data$ANL01FL == "Y") %>%
dm_update_zoomed()
dm_update_zoomed() %>%
dm_explicit_na(na_level = "No Coding available")
}
41 changes: 35 additions & 6 deletions R/dtht01.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#' * Numbers represent absolute numbers of subjects and fraction of `N`, or absolute numbers when specified.
#' * Remove zero-count rows unless overridden with `prune_0 = FALSE`.
#' * Does not include a total column by default.
#' * For the breakdown of `OTHER`, the percentages are based on `N`.
#'
#' @export
#'
Expand All @@ -27,9 +28,9 @@
#' dtht01_1_pre()
#'
#' dtht01_1(adam_db = db)
#' dtht01_1(adam_db = db, other_category = FALSE)
#' dtht01_1(adam_db = db, other_category = TRUE)
#' dtht01_1(adam_db = db, time_since_last_dose = TRUE)
#' dtht01_1(adam_db = db, time_since_last_dose = TRUE, other_category = FALSE)
#' dtht01_1(adam_db = db, time_since_last_dose = TRUE, other_category = TRUE)
dtht01_1 <- function(adam_db,
armvar = .study$actualarm,
time_since_last_dose = FALSE,
Expand Down Expand Up @@ -114,7 +115,11 @@ dtht01_1_lyt <- function(armvar = .study$actualarm,
.labels = c(count_fraction = "Total number of deaths"),
.formats = c(count_fraction = "xx (xx.x%)")
) %>%
summarize_vars(vars = c("DTHCAT"), var_labels = c("Primary cause of death"))
summarize_vars(
vars = c("DTHCAT"),
var_labels = c("Primary cause of death"),
denom = "N_col"
)

if (other_category) {
tab <-
Expand All @@ -128,7 +133,8 @@ dtht01_1_lyt <- function(armvar = .study$actualarm,
"DTHCAUS",
nested = TRUE,
.stats = "count_fraction",
.indent_mods = c("count_fraction" = 4L)
.indent_mods = c("count_fraction" = 4L),
denom = "N_col"
)
}
tab
Expand Down Expand Up @@ -159,15 +165,38 @@ dtht01_1_opt_lyt <- function(armvar = .study$actualarm,
summarize_vars(
vars = "LDDTHGR1",
var_labels = "Days from last drug administration",
show_labels = "visible"
show_labels = "visible",
denom = "N_col"
) %>%
split_rows_by(
"LDDTHGR1",
split_fun = remove_split_levels("<Missing>"),
split_label = "Primary cause by days from last study drug administration",
label_pos = "visible"
) %>%
summarize_vars("DTHCAT")
summarize_vars("DTHCAT", denom = "N_col")
}

#' @describeIn dtht01_1 `dtht01_1` Preprocessing
#'
#' @inheritParams gen_args
#'
#' @export
#'
#' @examples
#' syn_test_data() %>%
#' dtht01_1_pre()
dtht01_1_pre <- function(adam_db) {
checkmate::assert_class(adam_db, "dm")

death_fact <- levels(adam_db$adsl$DTHCAT)
death_fact <- setdiff(death_fact, "OTHER")
death_fact <- c(death_fact, "OTHER")

adam_db %>%
dm_zoom_to("adsl") %>%
mutate(DTHCAT = fct_relevel(.data$DTHCAT, death_fact)) %>%
dm_update_zoomed()
}

#' @describeIn dtht01_1 `dtht01_1` Preprocessing
Expand Down
11 changes: 2 additions & 9 deletions man/aet02_1.Rd

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

13 changes: 3 additions & 10 deletions man/aet02_2.Rd

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

2 changes: 1 addition & 1 deletion man/aet02_3.Rd

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

11 changes: 9 additions & 2 deletions man/dtht01_1.Rd

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