-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
253 egt05 qtcat@main #346
253 egt05 qtcat@main #346
Conversation
🧪 Code Coverage Summary
Results for commit: 9ba6e1b51364000d41e0fbd78c1f372d1e790dc8 Minimum allowed coverage is ♻️ This comment has been updated with latest results |
R/egt05_qtcat.R
Outdated
PARAMCD == "QT" | ||
) %>% | ||
mutate( | ||
AVALCAT1 = case_when( |
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.
please consider only derive the AVALCAT1 if there is no variable available? if it is already derived, then I think it is not necessary to derived it again here
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.
and unit should come from AVALU? although the chance that avalu is not "msec" is small
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.
@JiaLiu0001 is AVALU considered here? whether we should use AVALU as the unit, instead of "msec"?
R/egt05_qtcat.R
Outdated
#' | ||
#' @note | ||
#' * `adam_db` object must contain an `adeg` table with a `"PARAM"` column contains 'QT' as well as columns | ||
#' specified in `summaryvars` and `visitvar`. |
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.
please consider making the algorithm clear: visit var is needed in adeg, while summaryvars does not. it is derived in preprocess (at least for the default one)
R/egt05_qtcat.R
Outdated
egt05_qtcat_1_main <- function(adam_db, | ||
armvar = "ACTARM", | ||
summaryvars = c("Value at Visit" = "AVALCAT1", "Change from Baseline" = "CHGCAT1"), | ||
visitvar = "AVISIT", # or ATPTN |
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.
please remove the comment here
R/egt05_qtcat.R
Outdated
lbl_avisit, | ||
deco, | ||
...) { | ||
# TODE solve the problem of the overall column |
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.
please clean up comments here
"<Missing>" | ||
) | ||
) | ||
AVALCAT1 = factor(AVALCAT1), |
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.
this can lead to strange order factors
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.
Thank you @clarkliming factor updated
R/egt05_qtcat.R
Outdated
#' * `adam_db` object must contain an `adeg` table with a `"PARAM"` column contains 'QT' as well as column | ||
#' specified in `visitvar`. | ||
#' For `summaryvars`, if `AVALCAT1` and `CHGCAT1` columns are already existed in input data sets, no need to | ||
#' specify `AVAL` or `CHG`. If not, `AVAL` and `CHG` columns must be contained. |
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.
no matther if AVALCAT1
exist, we don't specify "AVAL" or "CHG" in data; we only re-derive the "AVALCAT1" if it does not exist in data right?
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.
sentence updated
R/egt05_qtcat.R
Outdated
@@ -86,7 +92,8 @@ egt05_qtcat_1_lyt <- function(armvar, | |||
vars = summaryvars, | |||
var_labels = summaryvars_lbls | |||
) %>% | |||
append_topleft(" Category") | |||
append_topleft("Analysis Visit") %>% |
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.
please use an argument instead of hard coding
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.
hard coding updated
I think it looks good now, but let's wait for @barnett11 for a final review |
R/egt05_qtcat.R
Outdated
#' | ||
egt05_qtcat_1_pre <- function(adam_db, paramcdvar = "QT", ...) { | ||
checkmate::assert_class(adam_db, "dm") | ||
unit <- adam_db$adeg %>% filter(PARAMCD == paramcdvar) %>% select(AVALU) %>% unique() |
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.
please follow style guide that after %>% always start a new line; in addition, we also need to check unit
is length 1 otherwise there will be issues in follow up code; in addition we can use pull instead of select to get the value
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.
@JiaLiu0001 how is this going?
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.
The update is not pushed yet. I'm wondering 'do we need different cut-offs for "QT", "QTCF", etc' like you mentioned in the above comment? If so, I prefer to update them in one push. @clarkliming
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.
let's update the formats and merge; for the testing part let's track in another issue and Tim will take over then
R/egt05_qtcat.R
Outdated
AVAL <= 450 ~ paste0("<=450 ", unit), | ||
AVAL <= 480 ~ paste0(">450 to <=480 ", unit), | ||
AVAL <= 500 ~ paste0(">480 to <= 500 ", unit), | ||
AVAL > 500 ~ paste0(">500 ", unit), |
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.
do we need different cut-offs for "QT", "QTCF", etc? @barnett11
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.
These thresholds should not be derived in the TLG code, they should come directly from AVALCAT1
and CHGCAT1
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.
ok @JiaLiu0001 maybe we just remove this preprocessing, and add AVALCAT1 and CHGCAT1 in data to make sure the example works
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.
Thanks @clarkliming
Pre-defines of AVALCAT1 and CHGCAT1 are removed, and warnings will return if AVALCAT1 and CHGCAT1 do not exist. However, I'm not sure how to update the data here to add AVALCAT1 and CHGCAT1 to the dataset. Could you please help with this?
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.
in get_syn_data function, add appropriate derivations of AVALCAT1 and CHGCAT1. In addition, we should give errors instead of warnings when the variables do not exist
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.
Hi @clarkliming I didn't find the function get_syn_data
in https://github.com/insightsengineering. Could you please point me to the function you mentioned?
DESCRIPTION
Outdated
@@ -54,7 +54,7 @@ Config/testthat/edition: 3 | |||
Encoding: UTF-8 | |||
LazyData: true | |||
Roxygen: list(markdown = TRUE) | |||
RoxygenNote: 7.2.3 | |||
RoxygenNote: 7.2.3.9000 |
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.
are you using a develop version of Roxygen?
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.
Yes, I'm. Looks like it should be switched to 7.2.3?
R/egt05_qtcat.R
Outdated
#' @param ... not used. | ||
#' | ||
#' @export | ||
egt05_qtcat_1_lyt <- function(armvar, |
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.
please double check if the arguments of egt05_qtcat_1_lyt
are also exposed in egt05_qtcat_1_main
R/egt05_qtcat.R
Outdated
) %>% | ||
mutate( | ||
AVALCAT1 = if ("AVALCAT1" %in% colnames(.)) factor(AVALCAT1) else | ||
stop("Please make sure 'AVALCAT1' is existed") |
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.
please use assert_colnames
to check if variables are valid
@JiaLiu0001 are you still working on this? |
add AVALCAT1 and CHGCAT1 into test data.
|
Also convert the variable to factor |
Hi @clarkliming Even though fct_explicit_na is replaced by explicit_na, still got Warning in CMD. Do you have any idea about it? |
it is in dunlin and I have open issues to address it |
R/utils.R
Outdated
# Add AVALCAT1 CHGCAT1 for adeg | ||
sd$adeg <- sd$adeg %>% | ||
mutate( | ||
AVALCAT1 = if ("AVALCAT1" %in% colnames(.)) { |
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.
- in synthetic_data, whether
AVALCAT1
exists has a clear answer, yes or no. No need to check if it exists. It is not user input. - For baseline visits, where
CHG
is NA, please do not derive values; Do not keep "NA msec" here - Please derive CHGCAT /AVALCAT only for QT (for now)
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.
Thank you @clarkliming, the utils is updated as your comments
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.
Thank you @clarkliming, the utils is updated as your comments
Hi @clarkliming Have this PR passed review?
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.
looks good to me; please resolve the conflict and merge.
After merged, you can open a new issue and tag Tim for a final review
Merge branch 'main' into 253_EGT05_QTCAT@main # Conflicts: # R/utils.R
close insightsengineering/chevron-tasks#50