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

94 refactor #95

Merged
merged 26 commits into from
Nov 29, 2021
Merged

94 refactor #95

merged 26 commits into from
Nov 29, 2021

Conversation

waddella
Copy link
Contributor

Please have a look at aet02.R

@github-actions
Copy link
Contributor

github-actions bot commented Nov 18, 2021

File Coverage Missing
All files 0%
R/aet02.R 0% 61-441
R/aet03.R 0% 49-154
R/aet04.R 0% 59-168
R/assertthat.R 0% 3
R/dmt01.R 0% 54-117
R/dst01.R 0% 6-559
R/ext01.R 0% 47-194
R/gen_args.R 0% 44
R/lbt01.R 0% 50-121
R/standard_data_manipulation.R 0% 31-201
R/utils.R 0% 13-384

Minimum allowed coverage is 80%

Generated by 🐒 cobertura-action against d2f647e

Copy link
Contributor Author

@waddella waddella left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BFalquet & @wangh107 please have a look and let's discuss these changes. I have added some review comments to clarify the changes

#'
#' aet02_1(adsl, adae)
#' aet02_1(adsl, adae, lbl_overall = "All Patients")
#' db <- syn_test_data() %>%
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the syn_test_data makes the examples easier, we should add the preprocessing that is needed for other examples as well

#' aet02_1(adsl, adae)
#' db <- db %>%
#' (std_filter("aet02_1"))() %>%
#' (std_mutate("aet02_1"))()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

standard filter and mutation

#'
#' aet02_1(db_m) %>% head()
#'
aet02_1 <- function(adam_db,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now functions require an adam_db argument which is either a named list or a dm object

R/aet02.R Outdated
@@ -41,28 +58,20 @@ aet02_1 <- function(adsl, adae,
lbl_overall = ""
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think this should be NA or NULL

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NULL seems to be good

lbl_AEBODSYS = "AEBODSYS",
lbl_AEDECOD = "AEDECOD",
lbl_AEBODSYS = "Body System or Organ Class",
lbl_AEDECOD = "Dictionary-Derived Term",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be taken from the standards, i.e. check on bee with

library(rgdsr)
rgdsr::adamv_var_info("AEBODSYS")

lbl_AEDECOD = lbl_AEDECOD,
lbl_AEBODSYS = var_labels_for(adae, "AEBODSYS"),
lbl_AEHLT = var_labels_for(adae, "AEHLT"),
lbl_AEDECOD = var_labels_for(adae, "AEDECOD"),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as these labels are nowhere else used

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we keep these parameters in the layout function? Is it because we expect users can use the layout function if the main template function doesn't meet the need?

@@ -0,0 +1,11 @@

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please have a look at this code

R/dmt01.R Outdated
@@ -38,7 +43,7 @@
#' summaryvars = c("AGE", "RACE", "SEX"),
#' summaryvars_lbls = c("Age (yr)", "Race", "Sex"))
#'
dmt01_1 <- function(ad_bl,
dmt01_1 <- function(data, dataname = "adsl",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be discussed this afternoon

Suggested change
dmt01_1 <- function(data, dataname = "adsl",
dmt01_1 <- function(adam_db, dataname = "adsl",

Copy link
Contributor

@wangh107 wangh107 Nov 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how baseline information from dataset adsub is addressed in adam_db? In study level preprocessing, or in chevron?

"aet02_1", "filter_adae_anl01fl", NA, c("adsl", "adae"),
"aet02_2", "filter_adae_anl01fl", NA, c("adsl", "adae"),
"aet02_3", "filter_adae_anl01fl", NA, c("adsl", "adae")
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

every new chevron function needs an entry here

Comment on lines +256 to +270
ifelse_layout <- function(lyt, test, fun_lyt_yes = identity, fun_lyt_no = identity) {

assert_that(length(test) == 1, is.logical(test))

if (test)
fun_lyt_yes(lyt)
else
fun_lyt_no(lyt)
}

lyt_fun <- function(fun, ...) {
function(lyt) {
fun(lyt, ...)
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ifelse_layout <- function(lyt, test, fun_lyt_yes = identity, fun_lyt_no = identity) {
assert_that(length(test) == 1, is.logical(test))
if (test)
fun_lyt_yes(lyt)
else
fun_lyt_no(lyt)
}
lyt_fun <- function(fun, ...) {
function(lyt) {
fun(lyt, ...)
}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not needed anymore

R/utils.R Outdated
Comment on lines 331 to 333
db_m <- db %>%
dm_zoom_to(adae) %>%
mutate(ANL01FL = 'Y') %>%
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this code in syn_test_data?

db <- new_dm(sd) %>%
dm_add_pk(adsl, c("USUBJID", "STUDYID")) %>%
dm_add_fk(adae, c("USUBJID", "STUDYID"), ref_table = "adsl") %>%
dm_add_pk(adae, "AESEQ")
Copy link
Contributor

@wangh107 wangh107 Nov 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it be dm_add_pk(adae, c("STUDYID", "USUBJID", "AESEQ")?

@BFalquet BFalquet marked this pull request as ready for review November 29, 2021 10:23
@BFalquet BFalquet merged commit b8a0c97 into main Nov 29, 2021
@BFalquet BFalquet deleted the 94_refactor branch November 29, 2021 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants