Skip to content

Commit

Permalink
chore: make join_key related changes to the modules
Browse files Browse the repository at this point in the history
  • Loading branch information
vedhav committed Nov 8, 2023
1 parent b5a6470 commit 15b6756
Show file tree
Hide file tree
Showing 38 changed files with 63 additions and 81 deletions.
7 changes: 3 additions & 4 deletions R/tm_a_pca.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#' })
#' datanames <- c("ADSL")
#' datanames(data) <- datanames
#' data@join_keys <- cdisc_join_keys(!!!datanames)
#' join_keys(data) <- cdisc_join_keys(!!!datanames)
#' app <- teal::init(
#' data = data,
#' modules = teal::modules(
Expand All @@ -57,7 +57,6 @@
#' if (interactive()) {
#' shinyApp(app$ui, app$server)
#' }
#'
tm_a_pca <- function(label = "Principal Component Analysis",
dat,
plot_height = c(600, 200, 2000),
Expand Down Expand Up @@ -258,7 +257,7 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
response[[i]]$select$choices <- var_labels(data[[response[[i]]$dataname]]())
response[[i]]$select$choices <- setdiff(
response[[i]]$select$choices,
unlist(teal.data::get_join_keys(data)$get(response[[i]]$dataname))
unlist(join_keys(data)[[response[[i]]$dataname]])
)
}

Expand Down Expand Up @@ -324,7 +323,7 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
anl_merged_input <- teal.transform::merge_expression_srv(
selector_list = selector_list,
datasets = data,
join_keys = teal.data::get_join_keys(data)
join_keys = join_keys(data)
)

anl_merged_q <- reactive({
Expand Down
4 changes: 2 additions & 2 deletions R/tm_a_regression.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#' })
#' datanames <- c("ADSL")
#' datanames(data) <- datanames
#' data@join_keys <- cdisc_join_keys(!!!datanames)
#' join_keys(data) <- cdisc_join_keys(!!!datanames)
#'
#' app <- teal::init(
#' data = data,
Expand Down Expand Up @@ -295,7 +295,7 @@ srv_a_regression <- function(id,
anl_merged_input <- teal.transform::merge_expression_srv(
selector_list = selector_list,
datasets = data,
join_keys = teal.data::get_join_keys(data)
join_keys = join_keys(data)
)

regression_var <- reactive({
Expand Down
2 changes: 1 addition & 1 deletion R/tm_data_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#' })
#' datanames <- c("ADSL")
#' datanames(data) <- datanames
#' data@join_keys <- cdisc_join_keys(!!!datanames)
#' join_keys(data) <- cdisc_join_keys(!!!datanames)
#'
#' app <- teal::init(
#' data = data,
Expand Down
2 changes: 1 addition & 1 deletion R/tm_front_page.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#' })
#' datanames <- c("ADSL")
#' datanames(data) <- datanames
#' data@join_keys <- cdisc_join_keys(!!!datanames)
#' join_keys(data) <- cdisc_join_keys(!!!datanames)
#'
#' table_1 <- data.frame(Info = c("A", "B"), Text = c("A", "B"))
#' table_2 <- data.frame(`Column 1` = c("C", "D"), `Column 2` = c(5.5, 6.6), `Column 3` = c("A", "B"))
Expand Down
4 changes: 2 additions & 2 deletions R/tm_g_association.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#' })
#' datanames <- c("ADSL")
#' datanames(data) <- datanames
#' data@join_keys <- cdisc_join_keys(!!!datanames)
#' join_keys(data) <- cdisc_join_keys(!!!datanames)
#'
#' app <- teal::init(
#' data = data,
Expand Down Expand Up @@ -251,7 +251,7 @@ srv_tm_g_association <- function(id,
anl_merged_input <- teal.transform::merge_expression_srv(
datasets = data,
selector_list = selector_list,
join_keys = teal.data::get_join_keys(data)
join_keys = join_keys(data)
)

anl_merged_q <- reactive({
Expand Down
4 changes: 2 additions & 2 deletions R/tm_g_bivariate.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
#' })
#' datanames <- c("ADSL")
#' datanames(data) <- datanames
#' data@join_keys <- cdisc_join_keys(!!!datanames)
#' join_keys(data) <- cdisc_join_keys(!!!datanames)
#'
#' app <- teal::init(
#' data = data,
Expand Down Expand Up @@ -441,7 +441,7 @@ srv_g_bivariate <- function(id,
anl_merged_input <- teal.transform::merge_expression_srv(
selector_list = selector_list,
datasets = data,
join_keys = teal.data::get_join_keys(data)
join_keys = join_keys(data)
)

anl_merged_q <- reactive({
Expand Down
4 changes: 2 additions & 2 deletions R/tm_g_distribution.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
#' })
#' datanames <- c("ADSL")
#' datanames(data) <- datanames
#' data@join_keys <- cdisc_join_keys(!!!datanames)
#' join_keys(data) <- cdisc_join_keys(!!!datanames)
#'
#' vars1 <- choices_selected(
#' variable_choices(data[["ADSL"]], c("ARM", "COUNTRY", "SEX")),
Expand Down Expand Up @@ -447,7 +447,7 @@ srv_distribution <- function(id,
anl_merged_input <- teal.transform::merge_expression_srv(
selector_list = selector_list,
datasets = data,
join_keys = teal.data::get_join_keys(data)
join_keys = join_keys(data)
)

anl_merged_q <- reactive({
Expand Down
4 changes: 2 additions & 2 deletions R/tm_g_response.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#' })
#' datanames <- c("ADSL")
#' datanames(data) <- datanames
#' data@join_keys <- cdisc_join_keys(!!!datanames)
#' join_keys(data) <- cdisc_join_keys(!!!datanames)
#'
#' app <- teal::init(
#' data = teal.data::cdisc_data(
Expand Down Expand Up @@ -278,7 +278,7 @@ srv_g_response <- function(id,
anl_merged_input <- teal.transform::merge_expression_srv(
selector_list = selector_list,
datasets = data,
join_keys = teal.data::get_join_keys(data)
join_keys = join_keys(data)
)

anl_merged_q <- reactive({
Expand Down
4 changes: 2 additions & 2 deletions R/tm_g_scatterplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#' })
#' datanames <- c("ADSL")
#' datanames(data) <- datanames
#' data@join_keys <- cdisc_join_keys(!!!datanames)
#' join_keys(data) <- cdisc_join_keys(!!!datanames)
#'
#' app <- teal::init(
#' data = data,
Expand Down Expand Up @@ -471,7 +471,7 @@ srv_g_scatterplot <- function(id,
anl_merged_input <- teal.transform::merge_expression_srv(
selector_list = selector_list,
datasets = data,
join_keys = teal.data::get_join_keys(data),
join_keys = join_keys(data),
merge_function = "dplyr::inner_join"
)

Expand Down
4 changes: 2 additions & 2 deletions R/tm_g_scatterplotmatrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#' })
#' datanames <- c("ADSL", "ADRS")
#' datanames(data) <- datanames
#' data@join_keys <- cdisc_join_keys(!!!datanames)
#' join_keys(data) <- cdisc_join_keys(!!!datanames)
#'
#' app <- teal::init(
#' data = data,
Expand Down Expand Up @@ -180,7 +180,7 @@ srv_g_scatterplotmatrix <- function(id, data, reporter, filter_panel_api, variab

anl_merged_input <- teal.transform::merge_expression_srv(
datasets = data,
join_keys = teal.data::get_join_keys(data),
join_keys = join_keys(data),
selector_list = selector_list
)

Expand Down
6 changes: 3 additions & 3 deletions R/tm_missing_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#' })
#' datanames <- c("ADSL", "ADRS")
#' datanames(data) <- datanames
#' data@join_keys <- cdisc_join_keys(!!!datanames)
#' join_keys(data) <- cdisc_join_keys(!!!datanames)
#'
#' app <- teal::init(
#' data = data,
Expand Down Expand Up @@ -356,7 +356,7 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par
moduleServer(id, function(input, output, session) {
prev_group_by_var <- reactiveVal("")
data_r <- data[[dataname]]
data_keys <- reactive(teal.data::get_join_keys(data)$get(dataname)[[dataname]])
data_keys <- reactive(unlist(join_keys(data)[[dataname]]))

iv_r <- reactive({
iv <- shinyvalidate::InputValidator$new()
Expand Down Expand Up @@ -395,7 +395,7 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par

data_parent_keys <- reactive({
if (length(parent_dataname) > 0 && parent_dataname %in% names(data)) {
keys <- teal.data::get_join_keys(data)$get(dataname)
keys <- teal.data::join_keys(data)[[dataname]]
if (parent_dataname %in% names(keys)) {
keys[[parent_dataname]]
} else {
Expand Down
7 changes: 3 additions & 4 deletions R/tm_outliers.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#' })
#' datanames <- c("ADSL")
#' datanames(data) <- datanames
#' data@join_keys <- cdisc_join_keys(!!!datanames)
#' join_keys(data) <- cdisc_join_keys(!!!datanames)
#'
#' fact_vars_adsl <- names(Filter(isTRUE, sapply(data[["ADSL"]], is.factor)))
#' vars <- choices_selected(variable_choices(data[["ADSL"]], fact_vars_adsl))
Expand Down Expand Up @@ -66,7 +66,6 @@
#' if (interactive()) {
#' shinyApp(app$ui, app$server)
#' }
#'
tm_outliers <- function(label = "Outliers Module",
outlier_var,
categorical_var = NULL,
Expand Down Expand Up @@ -294,7 +293,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var,
anl_merged_input <- teal.transform::merge_expression_srv(
selector_list = reactive_select_input,
datasets = data,
join_keys = teal.data::get_join_keys(data),
join_keys = join_keys(data),
merge_function = "dplyr::inner_join"
)

Expand Down Expand Up @@ -477,7 +476,7 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var,
},
env = list(
dataname = as.name(dataname_first),
join_keys = as.character(teal.data::get_join_keys(data)$get(dataname_first)[[dataname_first]])
join_keys = as.character(join_keys(data)[[dataname_first]][[dataname_first]])
)
)
)
Expand Down
5 changes: 2 additions & 3 deletions R/tm_t_crosstable.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#' })
#' datanames <- c("ADSL")
#' datanames(data) <- datanames
#' data@join_keys <- cdisc_join_keys(!!!datanames)
#' join_keys(data) <- cdisc_join_keys(!!!datanames)
#'
#' app <- teal::init(
#' data = teal.data::cdisc_data(
Expand Down Expand Up @@ -75,7 +75,6 @@
#' if (interactive()) {
#' shinyApp(app$ui, app$server)
#' }
#'
tm_t_crosstable <- function(label = "Cross Table",
x,
y,
Expand Down Expand Up @@ -219,7 +218,7 @@ srv_t_crosstable <- function(id, data, reporter, filter_panel_api, label, x, y,

anl_merged_input <- teal.transform::merge_expression_srv(
datasets = data,
join_keys = teal.data::get_join_keys(data),
join_keys = join_keys(data),
selector_list = selector_list,
merge_function = merge_function
)
Expand Down
10 changes: 5 additions & 5 deletions R/tm_variable_browser.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#' })
#' datanames <- c("ADSL", "ADTTE")
#' datanames(data) <- datanames
#' data@join_keys <- cdisc_join_keys(!!!datanames)
#' join_keys(data) <- cdisc_join_keys(!!!datanames)
#'
#' app <- teal::init(
#' data = data,
Expand Down Expand Up @@ -1149,9 +1149,9 @@ render_tab_header <- function(dataset_name, output, data) {
dataset_ui_id <- paste0("dataset_summary_", dataset_name)
output[[dataset_ui_id]] <- renderText({
df <- data[[dataset_name]]()
join_keys <- teal.data::get_join_keys(data)
join_keys <- join_keys(data)
if (!is.null(join_keys)) {
key <- teal.data::get_join_keys(data)$get(dataset_name)[[dataset_name]]
key <- join_keys(data)[[dataset_name]][[dataset_name]]
} else {
key <- NULL
}
Expand Down Expand Up @@ -1222,9 +1222,9 @@ render_tab_table <- function(dataset_name, parent_dataname, output, data, input,
# get icons proper for the data types
icons <- stats::setNames(teal.slice:::variable_types(df), colnames(df))

join_keys <- teal.data::get_join_keys(data)
join_keys <- join_keys(data)
if (!is.null(join_keys)) {
icons[intersect(join_keys$get(dataset_name)[[dataset_name]], colnames(df))] <- "primary_key"
icons[intersect(join_keys[[dataset_name]][[dataset_name]], colnames(df))] <- "primary_key"
}
icons <- variable_type_icons(icons)

Expand Down
3 changes: 1 addition & 2 deletions man/tm_a_pca.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/tm_a_regression.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/tm_data_table.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/tm_front_page.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/tm_g_association.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/tm_g_bivariate.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/tm_g_distribution.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/tm_g_response.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/tm_g_scatterplot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/tm_g_scatterplotmatrix.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 15b6756

Please sign in to comment.