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

try to harmonize the templates #496

Merged
merged 75 commits into from
May 17, 2023
Merged
Changes from 1 commit
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
fa8b1dc
update gitignore
Apr 24, 2023
9380c68
Merge branch 'main' into 476_harmonize_templates@main
Apr 26, 2023
bd9f0c6
attemp to unify
Apr 26, 2023
b29e359
first attempt to harmonize the template
May 5, 2023
1c2dcd5
minor update
May 5, 2023
2121783
styling
May 5, 2023
45b335d
update the preprocess to make it simpler
May 5, 2023
5f439d8
export formatters::with_label to make it simpler
May 5, 2023
faf58e8
minor update
May 5, 2023
f0ca344
update aet02 and reexport reformat
May 6, 2023
c4a297d
add more utility functions
May 6, 2023
5a83b69
update styles
May 6, 2023
a91d363
Merge branch 'main' into 476_harmonize_templates@main
May 6, 2023
59c0fe2
update all ae templates
May 8, 2023
29f75ce
update snapshot
May 8, 2023
4f77481
update snapshots
May 8, 2023
7cce311
fix formating of DCSREAS
May 8, 2023
ffce2ee
update dmt01
May 9, 2023
edc0d47
update checks in main
May 10, 2023
eca6a00
update tests and code
May 10, 2023
4d55102
update vst02 and cmt01a
May 10, 2023
3be8acd
update layout function docs
May 10, 2023
2d14293
Merge branch '476_harmonize_templates@main' of github.com:insightseng…
May 10, 2023
dc83150
correct documentation
May 10, 2023
97c14b5
update docs
May 10, 2023
97b4152
Merge branch '476_harmonize_templates@main' of github.com:insightseng…
May 10, 2023
823d963
update roxygen
May 10, 2023
6f0a0e3
update vst02 and cmt01a
May 10, 2023
7747b2e
add a bunch of assertions
May 10, 2023
43039fb
fix check issues
May 10, 2023
1380119
fix check issues
May 11, 2023
73d6d19
update aet01
May 11, 2023
b761d7b
update code styles
May 11, 2023
be67df8
fix issue
May 11, 2023
98152c1
not use adam_db
May 11, 2023
caf981a
update tests
May 11, 2023
ebb0e26
Merge branch 'main' into 476_harmonize_templates@main
May 11, 2023
b76a76d
update coxt02
May 11, 2023
99673d1
update tests
May 11, 2023
dfa67e3
style update and pkgdown
May 11, 2023
60ed5f1
update sorting of cmt01a
May 11, 2023
ae30831
update dtht01
May 12, 2023
fb2b8f6
fix check issues
May 13, 2023
d292568
update spelling
May 13, 2023
edf54b2
update pkgdown
May 13, 2023
f910d06
unify cmt01a and cmt02_pt
May 13, 2023
d361d79
fix issue
May 13, 2023
fcb3d4f
fix issue
May 13, 2023
8967b46
minor update
May 15, 2023
dad28f5
organize code
May 15, 2023
ec20069
Merge branch 'main' into 476_harmonize_templates@main
May 15, 2023
edecec1
update rspt01
May 15, 2023
fa6942f
update spelling
May 15, 2023
ca3f515
fix issue of empty string
May 15, 2023
c91a5fc
Update template@476 harmonize templates (#499)
BFalquet May 15, 2023
206e3c5
update tests and documentation
May 15, 2023
d30fbdc
clean up
May 16, 2023
7b06084
remove pdf
May 16, 2023
5c65695
move layouts to internal
May 16, 2023
85558da
update aet01_aesi snapshots
May 16, 2023
44d9195
update snapshots
May 16, 2023
38cc050
fix warnings (#501)
BFalquet May 16, 2023
f74401a
Merge branch '476_harmonize_templates@main' of github.com:insightseng…
May 16, 2023
11da514
update page size for pdf01
May 16, 2023
c5e489c
update vst01, add formatters namespace, update tests
May 16, 2023
0bfaa75
remove vdiffr
May 16, 2023
94a0659
fix documentation
May 16, 2023
ab2045c
fix failing test
May 16, 2023
63b2296
handle missing levels in lbt04
May 16, 2023
9096763
upgrade lbt04 assertion
May 16, 2023
b028906
correct assertion
May 16, 2023
c01e124
update pdt01 snapshot
May 16, 2023
463a24a
fix issue
May 16, 2023
4956406
update minor check
May 16, 2023
523fe1f
update kmg01
May 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix issue
Liming Li committed May 16, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 463a24a5454a6f5883b672fed0430a0f07d0e536
16 changes: 10 additions & 6 deletions R/assertions.R
Original file line number Diff line number Diff line change
@@ -305,9 +305,11 @@ assert_valid_variable <- function(df, vars, label = deparse(substitute(df)), typ
assert_valid_type <- function(x, types, label = deparse(substitute(x))) {
if (!any(vapply(types, is, object = x, FUN.VALUE = TRUE))) {
abort(
quote_str(label),
" is not of type ",
toString(types)
paste0(
quote_str(label),
" is not of type ",
toString(types)
)
)
}
}
@@ -326,9 +328,11 @@ assert_valid_var_pair <- function(df1, df2, var, lab1 = deparse(substitute(df1))
lvl_y <- lvls(df2[[var]])
if (!identical(lvl_x, lvl_y)) {
abort(
quote_str(lab1), " and ",
quote_str(lab2), " should contain the same levels in variable ",
quote_str(var), "!"
paste0(
quote_str(lab1), " and ",
quote_str(lab2), " should contain the same levels in variable ",
quote_str(var), "!"
)
)
}
}
7 changes: 6 additions & 1 deletion R/dst01.R
Original file line number Diff line number Diff line change
@@ -47,7 +47,12 @@ dst01_main <- function(adam_db,
types = list(c("character", "factor")), na_ok = TRUE
)
assert_valid_variable(
adam_db$adsl, c(study_status_var, trt_status_var),
adam_db$adsl, study_status_var,
types = list(c("character", "factor")), na_ok = TRUE,
empty_ok = FALSE, min_chars = 1L
)
assert_valid_variable(
adam_db$adsl, trt_status_var,
types = list(c("character", "factor")), na_ok = TRUE,
empty_ok = TRUE, min_chars = 0L
)
7 changes: 6 additions & 1 deletion R/dtht01.R
Original file line number Diff line number Diff line change
@@ -34,9 +34,14 @@ dtht01_main <- function(adam_db,
assert_valid_variable(adam_db$adsl, c("USUBJID", arm_var), types = list("character", "factor"))
assert_valid_variable(
adam_db$adsl,
c("DTHFL", "DTHCAT", other_var, dose_death_var),
"DTHFL",
types = list("character", "factor"), na_ok = TRUE, min_chars = 0L
)
assert_valid_variable(
adam_db$adsl,
c("DTHCAT", other_var, dose_death_var),
types = list("character", "factor"), na_ok = TRUE, min_chars = 1L
)
if (other_category) {
death_cause <- lvls(adam_db$adsl$DTHCAT)
if (length(death_cause) == 0L) {
21 changes: 21 additions & 0 deletions tests/testthat/_snaps/chevron_tlg-methods.md
Original file line number Diff line number Diff line change
@@ -127,3 +127,24 @@
BLACK OR AFRICAN AMERICAN 31 (23.1%) 28 (20.9%) 32 (24.2%) 91 (22.8%)
WHITE 27 (20.1%) 27 (20.1%) 21 (15.9%) 75 (18.8%)

# script_funs works as expected in interactive mode

Code
res
Output
[1] "# Edit Preprocessing Function."
[2] "pre_fun <- function(adam_db, ...) {"
[3] " atoxgr_lvls <- c(\"1\", \"2\", \"3\", \"4\", \"5\")"
[4] " adam_db$adae <- adam_db$adae %>%"
[5] " filter(.data$ANL01FL == \"Y\") %>%"
[6] " mutate("
[7] " AEBODSYS = reformat(.data$AEBODSYS, nocoding),"
[8] " AEDECOD = reformat(.data$AEDECOD, nocoding),"
[9] " ATOXGR = factor(.data$ATOXGR, levels = atoxgr_lvls)"
[10] " )"
[11] " adam_db"
[12] "}"
[13] ""
[14] "# Create TLG"
[15] "tlg_output <- rlang::exec(.fn = pre_fun, adam_db = data, !!!args_ls) %>% \nrlang::exec(.fn = run, object = aet04, !!!args_ls, auto_pre = FALSE)"