Skip to content

Commit

Permalink
chore: using the proper join_keys subset
Browse files Browse the repository at this point in the history
Not needed for getters but it's nice to use the same getters too
  • Loading branch information
vedhav committed Nov 17, 2023
1 parent e697644 commit d754da3
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 15 deletions.
2 changes: 1 addition & 1 deletion R/tm_outliers.R
Original file line number Diff line number Diff line change
Expand Up @@ -476,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::join_keys(data)[[dataname_first]][[dataname_first]])
join_keys = as.character(teal.data::join_keys(data)[dataname_first, dataname_first])
)
)
)
Expand Down
4 changes: 2 additions & 2 deletions R/tm_variable_browser.R
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,7 @@ render_tab_header <- function(dataset_name, output, data) {
df <- data[[dataset_name]]()
join_keys <- join_keys(data)
if (!is.null(join_keys)) {
key <- join_keys(data)[[dataset_name]][[dataset_name]]
key <- join_keys(data)[dataset_name, dataset_name]
} else {
key <- NULL
}
Expand Down Expand Up @@ -1224,7 +1224,7 @@ render_tab_table <- function(dataset_name, parent_dataname, output, data, input,

join_keys <- join_keys(data)
if (!is.null(join_keys)) {
icons[intersect(join_keys[[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
8 changes: 6 additions & 2 deletions vignettes/using-association-plot.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,12 @@ data <- within(data, {
})
datanames <- c("ADSL", "ADSL2", "ADRS", "ADTTE", "ADLB")
datanames(data) <- datanames
join_keys(data) <- default_cdisc_join_keys[datanames]
join_keys(data)[["ADSL2"]][["ADSL2"]] <- c("STUDYID", "USUBJID")
jk <- default_cdisc_join_keys[datanames]
jk_adsl2 <- jk
names(jk_adsl2)[names(jk_adsl2) == "ADSL"] <- "ADSL2"
jk <- c(jk, jk_adsl2)
jk["ADSL2", "ADSL"] <- c("USUBJID", "STUDYID")
# nolint end
app <- teal::init(
Expand Down
7 changes: 5 additions & 2 deletions vignettes/using-bivariate-plot.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,11 @@ data <- within(data, {
})
datanames <- c("ADSL", "ADSL2", "ADRS", "ADTTE", "ADLB")
datanames(data) <- datanames
join_keys(data) <- default_cdisc_join_keys[datanames]
join_keys(data)[["ADSL2"]][["ADSL2"]] <- c("STUDYID", "USUBJID")
jk <- default_cdisc_join_keys[datanames]
jk_adsl2 <- jk
names(jk_adsl2)[names(jk_adsl2) == "ADSL"] <- "ADSL2"
jk <- c(jk, jk_adsl2)
jk["ADSL2", "ADSL"] <- c("USUBJID", "STUDYID")
# nolint end
```

Expand Down
7 changes: 5 additions & 2 deletions vignettes/using-regression-plots.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,11 @@ data <- within(data, {
})
datanames <- c("ADSL", "ADSL2", "ADRS", "ADTTE", "ADLB")
datanames(data) <- datanames
join_keys(data) <- default_cdisc_join_keys[datanames]
join_keys(data)[["ADSL2"]][["ADSL2"]] <- c("STUDYID", "USUBJID")
jk <- default_cdisc_join_keys[datanames]
jk_adsl2 <- jk
names(jk_adsl2)[names(jk_adsl2) == "ADSL"] <- "ADSL2"
jk <- c(jk, jk_adsl2)
jk["ADSL2", "ADSL"] <- c("USUBJID", "STUDYID")
# nolint end
```

Expand Down
7 changes: 5 additions & 2 deletions vignettes/using-response-plot.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,11 @@ data <- within(data, {
})
datanames <- c("ADSL", "ADSL2", "ADRS", "ADTTE", "ADLB")
datanames(data) <- datanames
join_keys(data) <- default_cdisc_join_keys[datanames]
join_keys(data)[["ADSL2"]][["ADSL2"]] <- c("STUDYID", "USUBJID")
jk <- default_cdisc_join_keys[datanames]
jk_adsl2 <- jk
names(jk_adsl2)[names(jk_adsl2) == "ADSL"] <- "ADSL2"
jk <- c(jk, jk_adsl2)
jk["ADSL2", "ADSL"] <- c("USUBJID", "STUDYID")
# nolint end
```

Expand Down
7 changes: 5 additions & 2 deletions vignettes/using-scatterplot-matrix.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,11 @@ data <- within(data, {
})
datanames <- c("ADSL", "ADSL2", "ADRS", "ADTTE", "ADLB")
datanames(data) <- datanames
join_keys(data) <- default_cdisc_join_keys[datanames]
join_keys(data)[["ADSL2"]][["ADSL2"]] <- c("STUDYID", "USUBJID")
jk <- default_cdisc_join_keys[datanames]
jk_adsl2 <- jk
names(jk_adsl2)[names(jk_adsl2) == "ADSL"] <- "ADSL2"
jk <- c(jk, jk_adsl2)
jk["ADSL2", "ADSL"] <- c("USUBJID", "STUDYID")
# nolint end
```

Expand Down
7 changes: 5 additions & 2 deletions vignettes/using-scatterplot.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,11 @@ data <- within(data, {
})
datanames <- c("ADSL", "ADSL2", "ADRS", "ADTTE", "ADLB")
datanames(data) <- datanames
join_keys(data) <- default_cdisc_join_keys[datanames]
join_keys(data)[["ADSL2"]][["ADSL2"]] <- c("STUDYID", "USUBJID")
jk <- default_cdisc_join_keys[datanames]
jk_adsl2 <- jk
names(jk_adsl2)[names(jk_adsl2) == "ADSL"] <- "ADSL2"
jk <- c(jk, jk_adsl2)
jk["ADSL2", "ADSL"] <- c("USUBJID", "STUDYID")
# nolint end
```

Expand Down

0 comments on commit d754da3

Please sign in to comment.