Skip to content

Commit 51cadd1

Browse files
authored
Merge pull request #65 from Biogen-Inc/non_pilot_tests
Non pilot tests
2 parents e635d06 + 57b6f14 commit 51cadd1

11 files changed

+38
-36
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: tidyCDISC
22
Title: tidyCDISC: Quick Exploratory Data Analyses on ADaM-ish Datasets
3-
Version: 0.0.1
3+
Version: 0.0.2
44
Authors@R: as.person(c(
55
"Aaron Clark <[email protected]> [aut, cre]",
66
"Maya Gans <[email protected]> [aut]",

NEWS.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
# tidyCDISC 0.0.2
2+
3+
This release (PR #65) performs a lot of functions, testing on many non-pilot ADSL files to ensure app's robustness beyond just the CDISC pilot data:
4+
5+
* closes #64: Agg class objects lost droppability when only ADSL uploaded
6+
* get's rid of annoying font awesome message about verifying an icon exists
7+
* updates gt code that was deprecated
8+
* Made sure 'PARAM' exists in the data when trying to label a block
9+
* got rid of unnecessary argument in col_for_list() and col_for_list_expr()
10+
* added some code that helped the FREQ block produce the correct results when ran locally (via a reproducibility script)
11+
* a little code clean up for readability
12+
113
# tidyCDISC 0.0.1
214

315
This release adds meat to the previous skeleton version of `tidyCDISC`. The initial development release was intended to be a "bare bones" platform that could serve as a foundation to build a great clinical data exploratory tool. Version `0.0.1` enriches the user experience by adding useful & commonly needed features for analysis. For more on this release, see [the announcement](https://biogen-inc.github.io/tidyCDISC/articles/Blog.html#announcing-tidycdisc-0-0-1-1) on our blog.

R/mod_dataComply_fct_helpers.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,8 @@ gather_reqs <- function(input, output, session,
273273
gt(rowname_col = "type_col" , groupname_col = "df") %>%
274274
cols_label(not_exist_disp = "Doesn't Exist", missing_disp = "Missing Data") %>%
275275
text_transform(
276-
locations = list(cells_body(columns = vars(not_exist_disp), rows = not_exist_disp == "X"),
277-
cells_body(columns = vars(missing_disp), rows = missing_disp == "X")),
276+
locations = list(cells_body(columns = c(not_exist_disp), rows = not_exist_disp == "X"),
277+
cells_body(columns = c(missing_disp), rows = missing_disp == "X")),
278278
fn = function(X) local_image(filename = "inst/app/www/red_x.png", height = 15)
279279
) %>%
280280
tab_header(

R/mod_popExp_ui.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ mod_popExp_ui <- function(id, label = "Population Explorer"){
3333
div(id = "pop_cic_adv_filtering", class="filter-accordion",
3434
checkboxInput(ns("adv_filtering"),
3535
div(class="filter-container", span("Filter Data ", style="float:left;"),
36-
span(icon("chevron-down w3-tiny"), style="float:right;")),
36+
span(icon("chevron-down w3-tiny", verify_fa = FALSE), style="float:right;")),
3737
value = F)
3838
),
3939
conditionalPanel(condition = "input.adv_filtering == true", ns = ns,

R/mod_tableGen.R

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -204,18 +204,13 @@ mod_tableGen_server <- function(input, output, session, datafile = reactive(NULL
204204
# this allows our dropdown to be in chronological order
205205
avisit_words <- reactive({
206206
req(datafile())
207-
# req(any(purrr::map_lgl(datafile(), ~"AVISIT" %in% colnames(.x))))
208207

209208
if(any(purrr::map_lgl(datafile(), ~"AVISIT" %in% colnames(.x)))){
210-
# if("AVISIT" %in% colnames(BDS())){
211209
purrr::map(BDS(), function(x) x %>% dplyr::select(AVISIT)) %>%
212210
dplyr::bind_rows() %>%
213211
dplyr::pull(AVISIT)
214-
# }else {
215-
# c("fake_weeky","dummy_weeky")
216-
# }
217212
} else {
218-
c("fake_weeky","dummy_weeky")
213+
NULL #c("fake_weeky","dummy_weeky") # DON'T use this comment part. It's handled in AVISIT()
219214
}
220215

221216
})
@@ -225,13 +220,9 @@ mod_tableGen_server <- function(input, output, session, datafile = reactive(NULL
225220
req(any(purrr::map_lgl(datafile(), ~"AVISIT" %in% colnames(.x))))
226221

227222
if(any(purrr::map_lgl(datafile(), ~"AVISIT" %in% colnames(.x)))){
228-
# if("AVISITN" %in% colnames(BDS())){
229223
purrr::map(BDS(), function(x) x %>% dplyr::select(AVISITN)) %>%
230224
dplyr::bind_rows() %>%
231225
dplyr::pull(AVISITN)
232-
# } else {
233-
# 1:2
234-
# }
235226
} else {
236227
1:2
237228
}
@@ -251,7 +242,6 @@ mod_tableGen_server <- function(input, output, session, datafile = reactive(NULL
251242
pull(AVISIT) %>%
252243
unique()
253244
}
254-
# print(avisit_words[avisit_words != ""])
255245
avisit_words[avisit_words != ""]
256246
})
257247

@@ -359,7 +349,7 @@ mod_tableGen_server <- function(input, output, session, datafile = reactive(NULL
359349
purrr::map2(blockData$block, blockData$dataset, function(var, dat) {
360350
if(!is.null(attr(data_to_use_str(dat)[[var]], 'label'))){
361351
attr(data_to_use_str(dat)[[var]], 'label')
362-
} else if("PARAMCD" %in% colnames(data_to_use_str(dat))){
352+
} else if(all(c("PARAM","PARAMCD") %in% colnames(data_to_use_str(dat)))){
363353
data_to_use_str(dat) %>%
364354
filter(PARAMCD == var) %>%
365355
distinct(PARAM) %>%
@@ -488,7 +478,7 @@ mod_tableGen_server <- function(input, output, session, datafile = reactive(NULL
488478
,gsub("<br/>", "\n ", pre_filter_msgs())))
489479
}
490480

491-
purrr::pmap(list(blocks_and_functions()$agg,
481+
d <- purrr::pmap(list(blocks_and_functions()$agg,
492482
blocks_and_functions()$S3,
493483
blocks_and_functions()$dropdown,
494484
blocks_and_functions()$dataset),
@@ -506,43 +496,40 @@ mod_tableGen_server <- function(input, output, session, datafile = reactive(NULL
506496
pattern = '\\b'%s+%pretty_blocks$Pattern%s+%'\\b',
507497
replacement = pretty_blocks$Replacement,
508498
vectorize_all = FALSE))
499+
return(d)
509500
})
510501

511502
output$for_gt_table <- renderTable({ for_gt() })
512503

513504
# remove the first two columns from the row names to use since
514505
# these are used for grouping in gt. Make sure Total is at the end
515506
row_names_n <- reactive({
516-
test <- names(for_gt())[-c(1:2)]
517-
test[grepl("\\.\\.\\.", test)] <- "Missing"
518-
test <- test[test != "Total"]
519-
append(test, "Total")
507+
some_names <- names(for_gt())[-c(1:2)]
508+
some_names[grepl("\\.\\.\\.", some_names)] <- "Missing"
509+
some_names_no_tot <- some_names[some_names != "Total"]
510+
append(some_names_no_tot, "Total")
520511
})
521512

522513
# create the labels for each column using the total function
523514
# so the columns are now NAME N= X
524-
col_for_list <- function(nm, x) {
515+
col_for_list <- function(nm) {
525516
if (is.numeric(use_data_reactive()[[input$COLUMN]])) {
526517
stop("Need categorical column for grouping")
527518
}
528519
nm = md(glue::glue("**{row_names_n()}** <br> N={total()}"))
529520
}
530521

531-
532-
533-
534-
535522
# create gt table
536523
gt_table <- reactive({
537524
for_gt() %>%
538525
# gt(rowname_col = "Variable", groupname_col = "ID") %>%
539526
gt(groupname_col = "ID") %>%
540-
fmt_markdown(columns = vars(Variable),
527+
fmt_markdown(columns = c(Variable),
541528
rows = stringr::str_detect(Variable,'&nbsp;') |
542529
stringr::str_detect(Variable,'<b>') |
543530
stringr::str_detect(Variable,'</b>')) %>%
544531
tab_options(table.width = px(700)) %>%
545-
cols_label(.list = imap(for_gt()[-c(1:2)], ~col_for_list(.y, .x))) %>%
532+
cols_label(.list = purrr::imap(for_gt()[-c(1:2)], ~col_for_list(.x))) %>%
546533
tab_header(
547534
title = md(input$table_title),
548535
subtitle = md(subtitle_html())
@@ -859,12 +846,12 @@ mod_tableGen_server <- function(input, output, session, datafile = reactive(NULL
859846
library(gt)
860847
tg_table %>%
861848
gt(groupname_col = 'ID') %>%
862-
fmt_markdown(columns = vars(Variable),
849+
fmt_markdown(columns = c(Variable),
863850
rows = stringr::str_detect(Variable,'&nbsp;') |
864851
stringr::str_detect(Variable,'<b>') |
865852
stringr::str_detect(Variable,'</b>')) %>%
866853
tab_options(table.width = px(700)) %>%
867-
cols_label(.list = imap(tg_table[-c(1:2)], ~ tidyCDISC::col_for_list_expr(.y, .x))) %>%
854+
cols_label(.list = imap(tg_table[-c(1:2)], ~ tidyCDISC::col_for_list_expr(.x))) %>%
868855
tab_header(
869856
title = md('{input$table_title}'),
870857
subtitle = md(\"{subtitle_html()}\")

R/mod_tableGen_fct_blocks.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ rowPallete <- function(data) {
3838
~div(class="accordion-container",
3939
div(class="accordion",
4040
h6(.x, style="display:inline-block;"),
41-
tags$button(icon("chevron-down w3-tiny", class="rotate"))),
41+
tags$button(icon("chevron-down w3-tiny", verify_fa = FALSE, class="rotate"))),
4242
div(class="accordion-panel",
4343
div(
4444
tags$ul(rowBlock(.y,.x), class = 'all_blocks', class = .x)

R/mod_tableGen_fct_freq.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ app_freq.ADAE <- app_freq.ADSL <- function(column, group = NULL, data, totals) {
132132
prop = ifelse(n_tot == 0, 0, n / n_tot),
133133
v = paste0(n, ' (', sprintf("%.1f", round(prop*100, 1)), ')')) %>%
134134
select(-n, -prop) %>%
135+
mutate(!!group := ifelse(!!group == '', '_missing_', !!group)) %>%
135136
tidyr::pivot_wider(!!column, names_from = !!group, values_from = v)
136137

137138
cbind(groups, total$x)

R/mod_tableGen_fct_meanSummary.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ mean_summary <- function(.data, to_count) {
2424
`Min | Max` = paste0(round(min(na.omit(!!to_count)), 2), " | ",
2525
round(max(na.omit(!!to_count)), 2))
2626
)
27-
}
27+
}

R/mod_tableGen_fct_methods.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ app_methods <- function(agg, column, week, group, data, totals) {
3131
){
3232
stop(glue::glue("{column} variable doesn't exist in data, please remove or replace that variable from drop zone."))
3333
}
34+
35+
3436
if (agg == "MEAN") {
3537
app_mean(column, week, group, data)
3638
} else if (agg == "FREQ") {

R/utils_helpers.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#' @keywords tabGen_repro
1111
#'
1212
# get column names with N
13-
col_for_list_expr <- function(nm, x) {
13+
col_for_list_expr <- function(nm) {
1414
nm = md(glue::glue("**{row_names_n}** <br> N={total}"))
1515
}
1616

man/col_for_list_expr.Rd

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)