-
Notifications
You must be signed in to change notification settings - Fork 64
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
2481 bug the result of derive param tte depends on the sort order of the input #2569
base: main
Are you sure you want to change the base?
Changes from 6 commits
8e23388
cd52801
2727736
9e86217
d97377c
fa49a51
01e8f5a
53457c2
020c9d7
dccdbe1
8006891
4c95243
087c0f3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -322,8 +322,11 @@ derive_param_tte <- function(dataset = NULL, | |
censor_conditions, | ||
create_datetime = FALSE, | ||
set_values_to, | ||
subject_keys = get_admiral_option("subject_keys")) { | ||
# checking and quoting # | ||
subject_keys = get_admiral_option("subject_keys"), | ||
check_type = "warning") { | ||
# Match check_type to valid admiral options | ||
check_type <- rlang::arg_match(check_type, c("warning", "message", "error", "none")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use the admiraldev assertions ( |
||
# checking and quoting # | ||
assert_data_frame(dataset, optional = TRUE) | ||
assert_vars(by_vars, optional = TRUE) | ||
start_date <- assert_symbol(enexpr(start_date)) | ||
|
@@ -375,6 +378,7 @@ derive_param_tte <- function(dataset = NULL, | |
} | ||
|
||
tmp_event <- get_new_tmp_var(dataset) | ||
|
||
# determine events # | ||
event_data <- filter_date_sources( | ||
sources = event_conditions, | ||
|
@@ -386,6 +390,11 @@ derive_param_tte <- function(dataset = NULL, | |
) %>% | ||
mutate(!!tmp_event := 1L) | ||
|
||
#check for duplicates in event_data | ||
signal_duplicate_records(dataset = event_data, | ||
by_vars = expr_c(by_vars, subject_keys), | ||
cnd_type = check_type) | ||
|
||
# determine censoring observations # | ||
censor_data <- filter_date_sources( | ||
sources = censor_conditions, | ||
|
@@ -397,6 +406,11 @@ derive_param_tte <- function(dataset = NULL, | |
) %>% | ||
mutate(!!tmp_event := 0L) | ||
|
||
#check for duplicates in censor_data | ||
signal_duplicate_records(dataset = censor_data, | ||
by_vars = expr_c(by_vars, subject_keys), | ||
cnd_type = check_type) | ||
|
||
# determine variable to add from ADSL # | ||
if (create_datetime) { | ||
date_var <- sym("ADTM") | ||
|
@@ -463,7 +477,7 @@ derive_param_tte <- function(dataset = NULL, | |
} | ||
} | ||
|
||
# add new parameter to input dataset # | ||
# add new parameter to input dataset # | ||
bind_rows(dataset, new_param) | ||
} | ||
|
||
|
@@ -793,7 +807,8 @@ tte_source <- function(dataset_name, | |
filter = NULL, | ||
date, | ||
censor = 0, | ||
set_values_to = NULL) { | ||
set_values_to = NULL, | ||
order = order) { | ||
out <- list( | ||
dataset_name = assert_character_scalar(dataset_name), | ||
filter = assert_filter_cond(enexpr(filter), optional = TRUE), | ||
|
@@ -803,7 +818,8 @@ tte_source <- function(dataset_name, | |
set_values_to, | ||
named = TRUE, | ||
optional = TRUE | ||
) | ||
), | ||
order = order | ||
) | ||
class(out) <- c("tte_source", "source", "list") | ||
out | ||
|
@@ -844,13 +860,15 @@ tte_source <- function(dataset_name, | |
event_source <- function(dataset_name, | ||
filter = NULL, | ||
date, | ||
set_values_to = NULL) { | ||
set_values_to = NULL, | ||
order = NULL) { | ||
out <- tte_source( | ||
dataset_name = assert_character_scalar(dataset_name), | ||
filter = !!enexpr(filter), | ||
date = !!assert_expr(enexpr(date)), | ||
censor = 0, | ||
set_values_to = set_values_to | ||
set_values_to = set_values_to, | ||
order = order | ||
) | ||
class(out) <- c("event_source", class(out)) | ||
out | ||
|
@@ -891,13 +909,15 @@ censor_source <- function(dataset_name, | |
filter = NULL, | ||
date, | ||
censor = 1, | ||
set_values_to = NULL) { | ||
set_values_to = NULL, | ||
order = NULL) { | ||
out <- tte_source( | ||
dataset_name = assert_character_scalar(dataset_name), | ||
filter = !!enexpr(filter), | ||
date = !!assert_expr(enexpr(date)), | ||
censor = assert_integer_scalar(censor, subset = "positive"), | ||
set_values_to = set_values_to | ||
set_values_to = set_values_to, | ||
order = order | ||
) | ||
class(out) <- c("censor_source", class(out)) | ||
out | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
How come this argument got dropped?
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.
I am not sure. Let me add it back in. I did a fresh pull before working on this again but I likely made a mistake
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.
Its still there on my end. I'll push this again.
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.
Reviewing to see if I made any other mistakes.