-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
643 AEL02 [Spec Added] #655
Open
BFalquet
wants to merge
48
commits into
main
Choose a base branch
from
643-ael02-spec-added@main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
869d5e4
ael02 prototype
7b2b2c7
add test snapshots
cf2f415
remove note
0107ea2
prototype cml02a_gl
4129d6e
increase test coverage
997dfb1
increase coverage
b5ee067
change title of test
f97a095
dsl1 and dsl2
4f007cc
styler
b06f3be
fix note
41207e8
ael03 and ael04
a4dd74e
dml01
72ce45b
linter
312f3b4
document
5142122
change argument
ff28482
dml02
ac59228
pdl01
d3209fb
update pkgdown
1f560a9
document
2ba35ab
adding missing value handling
572e79e
across oll key_cols
5f2d0f0
use render safe
06b9942
sorting date as first column
5873f39
limings suggestion
2b230f6
Merge branch '642-cml02a_gl-spec-added@main' into 643-ael02-spec-adde…
5287ec1
explicit parameter value for listings
f22ff47
add null report
a426a39
correct argument default and tests
e5501c4
Merge branch 'main' into 643-ael02-spec-added@main
BFalquet 34fb219
update syn_data
ad9e4c9
utility function for ID
982d7e6
add date format
b57f962
use execute_with_args
a08dbbc
remove unused tests
60cdde0
simplify arguments
71fd248
remove default format from arguments
2efc471
Merge branch 'main' into 643-ael02-spec-added@main
cd9fe3e
fix tests
a54c145
correct documentation
918d258
add TRTDURD in syn_data
d799532
update dsl02 snapshot
453db79
update pkgdown
628972e
Merge remote-tracking branch 'origin/main' into 643-ael02-spec-added@…
d4d2f76
update linter
658dd60
Merge branch 'main' into 643-ael02-spec-added@main
BFalquet ae3bf05
update patient label
9f0d388
adapt dml02
9c0f8c3
update dml0x listings
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
linters: linters_with_defaults( | ||
line_length_linter = line_length_linter(120), | ||
cyclocomp_linter = NULL, | ||
object_usage_linter = NULL | ||
object_usage_linter = NULL, | ||
indentation_linter = NULL | ||
) |
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
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,83 @@ | ||
# ael02_main ---- | ||
|
||
#' @describeIn ael02 Main TLG function | ||
#' | ||
#' @inheritParams gen_args | ||
#' @param dataset (`string`) the name of a table in the `adam_db` object. | ||
#' | ||
#' @export | ||
#' | ||
ael02_main <- function(adam_db, | ||
dataset = "adae", | ||
arm_var = "ACTARM", | ||
key_cols = c("ID", "ASR", arm_var), | ||
disp_cols = c( | ||
"AEDECOD", "TRTSDTM", "ASTDY", "ADURN", "AESER", | ||
"ASEV", "AREL", "AEOUT", "AECONTRT", "AEACN" | ||
), | ||
...) { | ||
assert_all_tablenames(adam_db, dataset) | ||
assert_valid_variable(adam_db[[dataset]], c(arm_var, key_cols, disp_cols), label = paste0("adam_db$", dataset)) | ||
|
||
execute_with_args( | ||
as_listing, | ||
df = adam_db[[dataset]], | ||
key_cols = key_cols, | ||
disp_cols = disp_cols, | ||
..., | ||
default_formatting = listing_format_chevron(), | ||
unique_rows = TRUE | ||
) | ||
} | ||
|
||
#' @describeIn ael02 Preprocessing | ||
#' | ||
#' @inheritParams ael02_main | ||
#' | ||
#' @export | ||
#' | ||
ael02_pre <- function(adam_db, | ||
dataset = "adae", | ||
arm_var = "ACTARM", | ||
...) { | ||
adam_db[[dataset]] <- adam_db[[dataset]] %>% | ||
filter(.data$ANL01FL == "Y") %>% | ||
mutate( | ||
across( | ||
all_of(c(arm_var, "AEDECOD", "ASEV", "AEOUT", "AEACN")), | ||
~ reformat(.x, missing_rule) | ||
) | ||
) %>% | ||
mutate( | ||
!!arm_var := with_label(.data[[arm_var]], "Treatment"), | ||
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" | ||
), | ||
AEDECOD = with_label(reformat(.data$AEDECOD, nocoding), "Adverse\nEvent MedDRA\nPreferred Term"), | ||
ASTDY = with_label(.data$ASTDY, "Study\nDay of\nOnset"), | ||
ADURN = with_label(.data$ADURN, "AE\nDuration\nin Days"), | ||
AESER = with_label(reformat(.data$AESER, yes_no_rule), "Serious"), | ||
ASEV = with_label(.data$ASEV, "Most\nExtreme\nIntensity"), | ||
AREL = with_label(reformat(.data$AREL, yes_no_rule), "Caused by\nStudy\nDrug"), | ||
AEOUT = with_label(as.numeric(reformat(.data$AEOUT, outcome_rule)), "Outcome\n(1)"), | ||
AECONTRT = with_label(reformat(.data$AECONTRT, yes_no_rule), "Treatment\nfor AE"), | ||
AEACN = with_label(as.numeric(reformat(.data$AEACN, dose_change_rule)), "Action\nTaken\n(2)") | ||
) | ||
|
||
adam_db | ||
} | ||
|
||
#' `AEL02` Listing 1 (Default) Listing of Adverse Events. | ||
#' | ||
#' @include chevron_tlg-S4class.R | ||
#' @export | ||
#' | ||
#' @examples | ||
#' res <- run(ael02, syn_data) | ||
ael02 <- chevron_l( | ||
main = ael02_main, | ||
preprocess = ael02_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 |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# ael03_main ---- | ||
|
||
#' @describeIn ael03 Main TLG function | ||
#' | ||
#' @inheritParams gen_args | ||
#' @param dataset (`string`) the name of a table in the `adam_db` object. | ||
#' | ||
#' @export | ||
#' | ||
ael03_main <- function(adam_db, | ||
dataset = "adae", | ||
arm_var = "ACTARM", | ||
key_cols = c("ID", "ASR", arm_var), | ||
disp_cols = c( | ||
"AEDECOD", "TRTSDTM", "ASTDY", "ADURN", "ASEV", | ||
"AREL", "AEOUT", "AECONTRT", "AEACN", "SERREAS" | ||
), | ||
...) { | ||
assert_all_tablenames(adam_db, dataset) | ||
assert_valid_variable(adam_db[[dataset]], c(arm_var, key_cols, disp_cols), label = paste0("adam_db$", dataset)) | ||
|
||
execute_with_args( | ||
as_listing, | ||
df = adam_db[[dataset]], | ||
key_cols = key_cols, | ||
disp_cols = disp_cols, | ||
..., | ||
default_formatting = listing_format_chevron(), | ||
unique_rows = TRUE | ||
) | ||
} | ||
|
||
#' @describeIn ael03 Preprocessing | ||
#' | ||
#' @inheritParams ael03_main | ||
#' | ||
#' @export | ||
#' | ||
ael03_pre <- function(adam_db, | ||
dataset = "adae", | ||
arm_var = "ACTARM", | ||
...) { | ||
adam_db[[dataset]] <- adam_db[[dataset]] %>% | ||
filter(.data$ANL01FL == "Y") %>% | ||
filter(.data$AESER == "Y") %>% | ||
mutate( | ||
across( | ||
all_of(c(arm_var, "AEDECOD", "ASEV", "AEOUT", "AEACN")), | ||
~ reformat(.x, missing_rule) | ||
) | ||
) %>% | ||
mutate( | ||
!!arm_var := with_label(.data[[arm_var]], "Treatment"), | ||
ID = create_id_listings(.data$SITEID, .data$SUBJID), | ||
AEDECOD = with_label(reformat(.data$AEDECOD, nocoding), "Adverse\nEvent MedDRA\nPreferred Term"), | ||
ASR = with_label(paste(.data$AGE, .data$SEX, .data$RACE, sep = "/"), "Age/Sex/Race"), | ||
# Datetime of First Exposure to Treatment | ||
TRTSDTM = with_label(.data$TRTSDTM, "Date of\nFirst Study\nDrug\nAdministration"), | ||
ASTDY = with_label(.data$ASTDY, "Study\nDay of\nOnset"), | ||
ADURN = with_label(.data$AENDY - .data$ASTDY + 1, "AE\nDuration\nin Days"), | ||
AESER = with_label(.data$AESER, "Serious"), | ||
ASEV = with_label(.data$ASEV, "Most\nExtreme\nIntensity"), | ||
AREL = with_label(reformat(.data$AREL, yes_no_rule), "Caused by\nStudy\nDrug"), # Analysis Causality | ||
AEOUT = with_label(as.numeric(reformat(.data$AEOUT, outcome_rule)), "Outcome\n(1)"), | ||
AECONTRT = with_label(reformat(.data$AECONTRT, yes_no_rule), "Treatment\nfor AE"), | ||
AEACN = with_label(as.numeric(reformat(.data$AEACN, dose_change_rule)), "Action\nTaken\n(2)"), | ||
# New derived column | ||
SERREAS = with_label(case_when( | ||
AESDTH == "Y" ~ "1", | ||
AESLIFE == "Y" ~ "2", | ||
AESHOSP == "Y" ~ "3", | ||
AESDISAB == "Y" ~ "4", | ||
AESCONG == "Y" ~ "5", | ||
AESMIE == "Y" ~ "6", | ||
TRUE ~ " " | ||
), "Reason\nClassified\nas Serious\n(3)"), | ||
) | ||
|
||
adam_db | ||
} | ||
|
||
#' `AEL03` Listing 1 (Default) Listing of Serious Adverse Events. | ||
#' | ||
#' @include chevron_tlg-S4class.R | ||
#' @export | ||
#' | ||
#' @examples | ||
#' res <- run(ael03, syn_data) | ||
ael03 <- chevron_l( | ||
main = ael03_main, | ||
preprocess = ael03_pre | ||
) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems that all the listing functions should have the same
main
function?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apart from the default arguments, it seems that all the main functions are identical