-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
300 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,6 +80,7 @@ Collate: | |
'ael01_nollt.R' | ||
'ael02.R' | ||
'ael03.R' | ||
'ael04.R' | ||
'aet01.R' | ||
'aet01_aesi.R' | ||
'aet02.R' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# ael04_main ---- | ||
|
||
#' @describeIn ael04 Main TLG function | ||
#' | ||
#' @inheritParams gen_args | ||
#' @returns the main function returns an `rlistings` or a `list` object. | ||
#' @export | ||
#' | ||
ael04_main <- modify_default_args( | ||
std_listing, | ||
dataset = "adsl", | ||
key_cols = "ID", | ||
disp_cols = c("ASR", "TRTSDTM", "EOSDY", "DTHADY", "DTHCAUS", "ADTHAUT"), | ||
split_into_pages_by_var = "ACTARM" | ||
) | ||
|
||
|
||
#' @describeIn ael04 Preprocessing | ||
#' | ||
#' @inheritParams ael04_main | ||
#' @inheritParams gen_args | ||
#' | ||
#' @export | ||
#' | ||
ael04_pre <- function(adam_db, | ||
dataset = "adsl", | ||
split_into_pages_by_var = "ACTARM", | ||
...) { | ||
adam_db[[dataset]] <- adam_db[[dataset]] %>% | ||
filter(!is.na(.data$DTHADY)) %>% | ||
mutate( | ||
across( | ||
all_of(c(split_into_pages_by_var, "DTHCAUS", "ADTHAUT")), | ||
~ reformat(.x, missing_rule) | ||
) | ||
) %>% | ||
mutate( | ||
ID = create_id_listings(.data$SITEID, .data$SUBJID), | ||
ASR = with_label(paste(.data$AGE, .data$SEX, .data$RACE, sep = "/"), "Age/Sex/Race"), | ||
TRTSDTM = with_label( | ||
.data$TRTSDTM, | ||
"Date of\nFirst Study\nDrug\nAdministration" | ||
), | ||
!!split_into_pages_by_var := with_label(.data[[split_into_pages_by_var]], "Treatment"), | ||
EOSDY = with_label(.data$EOSDY, "Day of Last\nStudy Drug\nAdministration"), | ||
DTHADY = with_label(.data$DTHADY, "Day of\nDeath"), | ||
DTHCAUS = with_label(.data$DTHCAUS, "Cause of Death"), | ||
ADTHAUT = with_label(.data$ADTHAUT, "Autopsy\nPerformed?") | ||
) | ||
|
||
adam_db | ||
} | ||
|
||
#' `AEL04` Listing 1 (Default) Listing of Patient Deaths. | ||
#' | ||
#' @include chevron_tlg-S4class.R | ||
#' @export | ||
#' | ||
#' @examples | ||
#' res <- run(ael04, syn_data) | ||
ael04 <- chevron_l( | ||
main = ael04_main, | ||
preprocess = ael04_pre | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,7 @@ reference: | |
- ael01_nollt | ||
- ael02 | ||
- ael03 | ||
- ael04 | ||
- aet01 | ||
- aet01_aesi | ||
- aet02 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
# ael04 works with adsl dataset | ||
|
||
Code | ||
cat(export_as_txt(res, lpp = 100, cpp = 110)) | ||
Output | ||
ACTARM: C: Combination | ||
—————————————————————————————————————————————————————————————————————————————————————————————————— | ||
Date of | ||
First Study Day of Last | ||
Drug Study Drug Day of | ||
Center/Patients ID Age/Sex/Race Administration Administration Death Cause of Death | ||
—————————————————————————————————————————————————————————————————————————————————————————————————— | ||
BRA-11/9 40/M/ASIAN 25MAR2019 1056 1091 DISEASE PROGRESSION | ||
CHN-15/201 49/M/ASIAN 05MAR2019 1082 1084 ADVERSE EVENT | ||
CHN-15/245 34/F/WHITE 29MAR2019 1057 1056 DISEASE PROGRESSION | ||
\s\nACTARM: C: Combination | ||
——————————————————————————————— | ||
Autopsy | ||
Center/Patients ID Performed? | ||
——————————————————————————————— | ||
BRA-11/9 Yes | ||
CHN-15/201 Yes | ||
CHN-15/245 Yes | ||
\s\nACTARM: B: Placebo | ||
————————————————————————————————————————————————————————————————————————————————————————————————————————————— | ||
Date of | ||
First Study Day of Last | ||
Drug Study Drug Day of Autopsy | ||
Center/Patients ID Age/Sex/Race Administration Administration Death Cause of Death Performed? | ||
————————————————————————————————————————————————————————————————————————————————————————————————————————————— | ||
CAN-1/341 43/F/ASIAN 23MAY2019 998 1013 SUICIDE Yes | ||
CHN-1/307 24/M/ASIAN 11MAR2019 1076 1121 LOST TO FOLLOW UP <Missing> | ||
CHN-13/240 42/M/ASIAN 08APR2019 1044 1086 ADVERSE EVENT Yes | ||
CHN-7/126 27/M/WHITE 02MAY2019 1025 1066 ADVERSE EVENT Yes | ||
\s\nACTARM: A: Drug X | ||
—————————————————————————————————————————————————————————————————————————————————————————————————— | ||
Date of | ||
First Study Day of Last | ||
Drug Study Drug Day of | ||
Center/Patients ID Age/Sex/Race Administration Administration Death Cause of Death | ||
—————————————————————————————————————————————————————————————————————————————————————————————————— | ||
CHN-3/128 32/M/ASIAN 24FEB2019 1084 1105 ADVERSE EVENT | ||
RUS-1/52 40/F/ASIAN 18MAR2019 1064 1069 DISEASE PROGRESSION | ||
\s\nACTARM: A: Drug X | ||
——————————————————————————————— | ||
Autopsy | ||
Center/Patients ID Performed? | ||
——————————————————————————————— | ||
CHN-3/128 Yes | ||
RUS-1/52 Yes | ||
|
||
# ael04 can handle all missing values | ||
|
||
Code | ||
cat(export_as_txt(res, lpp = 100, cpp = 110)) | ||
Output | ||
ACTARM: <Missing> | ||
—————————————————————————————————————————————————————————————————————————————————————————————————————————— | ||
Date of | ||
First Study Day of Last | ||
Drug Study Drug Day of Autopsy | ||
Center/Patients ID Age/Sex/Race Administration Administration Death Cause of Death Performed? | ||
—————————————————————————————————————————————————————————————————————————————————————————————————————————— | ||
BRA-11/9 40/M/ASIAN 25MAR2019 1056 1091 <Missing> Yes | ||
CAN-1/341 43/F/ASIAN 23MAY2019 998 1013 <Missing> Yes | ||
CHN-1/307 24/M/ASIAN 11MAR2019 1076 1121 <Missing> <Missing> | ||
CHN-13/240 42/M/ASIAN 08APR2019 1044 1086 <Missing> Yes | ||
CHN-15/201 49/M/ASIAN 05MAR2019 1082 1084 <Missing> Yes | ||
CHN-15/245 34/F/WHITE 29MAR2019 1057 1056 <Missing> Yes | ||
CHN-3/128 32/M/ASIAN 24FEB2019 1084 1105 <Missing> Yes | ||
CHN-7/126 27/M/WHITE 02MAY2019 1025 1066 <Missing> Yes | ||
RUS-1/52 40/F/ASIAN 18MAR2019 1064 1069 <Missing> Yes | ||
|
||
# ael04 functions work as expected | ||
|
||
Code | ||
cat(export_as_txt(res, lpp = 100, cpp = 110)) | ||
Output | ||
ACTARM: C: Combination | ||
—————————————————————————————————————————————————————————————————————————————————————————————————— | ||
Date of | ||
First Study Day of Last | ||
Drug Study Drug Day of | ||
Center/Patients ID Age/Sex/Race Administration Administration Death Cause of Death | ||
—————————————————————————————————————————————————————————————————————————————————————————————————— | ||
BRA-11/9 40/M/ASIAN 25MAR2019 1056 1091 DISEASE PROGRESSION | ||
CHN-15/201 49/M/ASIAN 05MAR2019 1082 1084 ADVERSE EVENT | ||
CHN-15/245 34/F/WHITE 29MAR2019 1057 1056 DISEASE PROGRESSION | ||
\s\nACTARM: C: Combination | ||
——————————————————————————————— | ||
Autopsy | ||
Center/Patients ID Performed? | ||
——————————————————————————————— | ||
BRA-11/9 Yes | ||
CHN-15/201 Yes | ||
CHN-15/245 Yes | ||
\s\nACTARM: B: Placebo | ||
————————————————————————————————————————————————————————————————————————————————————————————————————————————— | ||
Date of | ||
First Study Day of Last | ||
Drug Study Drug Day of Autopsy | ||
Center/Patients ID Age/Sex/Race Administration Administration Death Cause of Death Performed? | ||
————————————————————————————————————————————————————————————————————————————————————————————————————————————— | ||
CAN-1/341 43/F/ASIAN 23MAY2019 998 1013 SUICIDE Yes | ||
CHN-1/307 24/M/ASIAN 11MAR2019 1076 1121 LOST TO FOLLOW UP <Missing> | ||
CHN-13/240 42/M/ASIAN 08APR2019 1044 1086 ADVERSE EVENT Yes | ||
CHN-7/126 27/M/WHITE 02MAY2019 1025 1066 ADVERSE EVENT Yes | ||
\s\nACTARM: A: Drug X | ||
—————————————————————————————————————————————————————————————————————————————————————————————————— | ||
Date of | ||
First Study Day of Last | ||
Drug Study Drug Day of | ||
Center/Patients ID Age/Sex/Race Administration Administration Death Cause of Death | ||
—————————————————————————————————————————————————————————————————————————————————————————————————— | ||
CHN-3/128 32/M/ASIAN 24FEB2019 1084 1105 ADVERSE EVENT | ||
RUS-1/52 40/F/ASIAN 18MAR2019 1064 1069 DISEASE PROGRESSION | ||
\s\nACTARM: A: Drug X | ||
——————————————————————————————— | ||
Autopsy | ||
Center/Patients ID Performed? | ||
——————————————————————————————— | ||
CHN-3/128 Yes | ||
RUS-1/52 Yes | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# ael04 ---- | ||
|
||
test_that("ael04 works with adsl dataset", { | ||
expect_silent( | ||
res <- run(ael04, syn_data, dataset = "adsl") | ||
) | ||
expect_snapshot(cat(export_as_txt(res, lpp = 100, cpp = 110))) | ||
}) | ||
|
||
test_that("ael04 can handle all missing values", { | ||
proc_data <- syn_data | ||
proc_data$adsl <- proc_data$adsl %>% | ||
mutate( | ||
ACTARM = NA_character_, | ||
DTHCAUS = NA_character_ | ||
) | ||
|
||
expect_silent(res <- run(ael04, proc_data)) | ||
expect_snapshot(cat(export_as_txt(res, lpp = 100, cpp = 110))) | ||
}) | ||
|
||
# ael04 functions ---- | ||
|
||
test_that("ael04 functions work as expected", { | ||
expect_silent(res <- ael04_pre(syn_data) %>% ael04_main()) | ||
expect_snapshot(cat(export_as_txt(res, lpp = 100, cpp = 110))) | ||
}) |