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

Initial kmg01_1 #484

Merged
merged 37 commits into from
Apr 24, 2023
Merged

Initial kmg01_1 #484

merged 37 commits into from
Apr 24, 2023

Conversation

Teninq
Copy link
Contributor

@Teninq Teninq commented Apr 13, 2023

close insightsengineering/chevron-tasks#66

@github-actions
Copy link
Contributor

github-actions bot commented Apr 13, 2023

Unit Tests Summary

    1 files    33 suites   1m 38s ⏱️
178 tests 128 ✔️   50 💤 0
348 runs  234 ✔️ 114 💤 0

Results for commit d85e3de.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 13, 2023

🧪 $Test coverage: 97.13%$

Code Coverage Summary

Filename                     Stmts    Miss  Cover    Missing
-------------------------  -------  ------  -------  --------------------------------------------------------------
R/ael01_nollt.R                 26       2  92.31%   82-91
R/aet01_aesi.R                 185       7  96.22%   40, 42-46, 278
R/aet01.R                      342       5  98.54%   41, 253, 328, 334, 562
R/aet02.R                      235       1  99.57%   494
R/aet03.R                       83       0  100.00%
R/aet04.R                      106       2  98.11%   169, 186
R/aet10.R                       50       1  98.00%   102
R/assertions.R                  71       5  92.96%   178-182
R/checks.R                      20       0  100.00%
R/chevron_tlg-S4class.R         21       0  100.00%
R/chevron_tlg-S4methods.R      136      12  91.18%   410-482
R/cmt01a.R                     186       0  100.00%
R/cmt02_pt.R                    49       0  100.00%
R/dmt01.R                       30       0  100.00%
R/dst01.R                      290       0  100.00%
R/dtht01.R                      98       0  100.00%
R/egt01.R                       45       0  100.00%
R/egt02.R                       56       0  100.00%
R/egt03.R                      132       3  97.73%   118, 164, 322
R/egt05_qtcat.R                 57       0  100.00%
R/ext01.R                       71       4  94.37%   230-231, 235-236
R/kmg01.R                       37       7  81.08%   58-66, 106
R/lbt01.R                       94       0  100.00%
R/lbt04.R                       49       0  100.00%
R/lbt05.R                       68       5  92.65%   148-153
R/lbt07.R                       90       1  98.89%   171
R/lbt14.R                      188      24  87.23%   54, 56, 108-109, 111-117, 144, 257, 259, 311-312, 314-320, 347
R/mht01.R                       69       2  97.10%   33-34
R/mng01.R                       95      12  87.37%   114, 118-121, 130-138, 180
R/pdt01.R                       57       0  100.00%
R/pdt02.R                       65       0  100.00%
R/utils.R                       73       0  100.00%
R/vst01.R                       47       0  100.00%
R/vst02.R                       92       2  97.83%   109, 240
TOTAL                         3313      95  97.13%

Diff against main

Filename          Stmts    Miss  Cover
--------------  -------  ------  -------
R/assertions.R       +7      +5  -7.04%
R/kmg01.R           +37      +7  +81.08%
TOTAL               +44     +12  -0.33%

Results for commit: fb170f91f624b1490f18f691ebdea3a16fa47c87

Minimum allowed coverage is 80%

♻️ This comment has been updated with latest results

@Teninq
Copy link
Contributor Author

Teninq commented Apr 14, 2023

Create template from issue: 373

R/kmg01.R Outdated
...) {
anl <- adam_db[[dataset]]
checkmate::assert_true(length(unique(anl$PARAMCD)) == 1)
checkmate::assert_character(x_name)
Copy link
Contributor

Choose a reason for hiding this comment

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

use assert_string

R/kmg01.R Outdated
}

gkm_plot <- if (!show_statis) {
g_km(
Copy link
Contributor

Choose a reason for hiding this comment

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

these two parts can be put together

R/kmg01.R Outdated
checkmate::assert_class(adam_db, "dm")
assert_colnames(adam_db[[dataset]], c("PARAMCD", "CNSR"))

adam_db <- adam_db %>%
Copy link
Contributor

Choose a reason for hiding this comment

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

use list of data frames

R/kmg01.R Outdated
#' @examples
#' library(dplyr)
#'
#' col <- c(
Copy link
Contributor

Choose a reason for hiding this comment

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

to make it consistent with the argument passing from citril, we have to make it either a named list or unnamed character

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed with list()

R/kmg01.R Outdated
col <- line_col
}

gkm_plot <- g_km(
Copy link
Contributor

Choose a reason for hiding this comment

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

no need to assign it to gkm_plot as it is returned directly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

R/utils.R Outdated
@@ -266,3 +266,16 @@ gg_list <- function(...) {
class = c("gg_list", "list")
)
}

#' Check to have only one PARAMCD in the analysis dataset
Copy link
Contributor

Choose a reason for hiding this comment

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

this assertion check put in assertions.R

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved

R/utils.R Outdated
@@ -266,3 +266,16 @@ gg_list <- function(...) {
class = c("gg_list", "list")
)
}

#' Check to have only one PARAMCD in the analysis dataset
#' @param param_val unique value of PARAMCD
Copy link
Contributor

Choose a reason for hiding this comment

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

add type hint of the param_val (character)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added

R/utils.R Outdated
if (length(param_val) > 1) {
stop(paste0(
"More than one parameters:",
paste(param_val, collapse = ", "),
Copy link
Contributor

@clarkliming clarkliming Apr 21, 2023

Choose a reason for hiding this comment

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

use toString(param_val)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

R/utils.R Outdated
#' @param param_val unique value of PARAMCD
#' @export
assert_only_one_paramcd <- function(param_val) {
if (length(param_val) > 1) {
Copy link
Contributor

Choose a reason for hiding this comment

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

check for input values

R/utils.R Outdated
stop(paste0(
"More than one parameters:",
paste(param_val, collapse = ", "),
", Only one suppose to have."
Copy link
Contributor

Choose a reason for hiding this comment

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

after "," should not use up case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

checkmate::assert_character(line_col, null.ok = TRUE)

assert_colnames(adam_db[[dataset]], "AVAL")
variables <- list(tte = "AVAL", is_event = "is_event", arm = arm_var)
Copy link
Contributor

Choose a reason for hiding this comment

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

this is not suitable to have "AVAL" and "is_event" fixed here. I would rather expose these two arguments. And, should not we use CNSR here (0 for event and 1 for censor)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Keep it for now

Copy link
Contributor

Choose a reason for hiding this comment

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

but we should check if is_event exists in data

Copy link
Contributor

Choose a reason for hiding this comment

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

and also arm_var

R/assertions.R Outdated


#' Check to have only one PARAMCD in the analysis dataset
#' @param param_val (`character`) value of PARAMCD
Copy link
Contributor

Choose a reason for hiding this comment

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

since we don't require it to be a character (as factor also works), remove the type hint or at least check if it is character or factor, and correct the type hint

Copy link
Contributor

@clarkliming clarkliming left a comment

Choose a reason for hiding this comment

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

looks good, thank you

@Teninq Teninq merged commit e7780b7 into main Apr 24, 2023
@Teninq Teninq deleted the 373_kmg01_template branch April 24, 2023 05:47
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.

2 participants