Skip to content

Commit

Permalink
autostyle
Browse files Browse the repository at this point in the history
  • Loading branch information
cristinamullin committed Oct 25, 2023
1 parent ab6838a commit b00c5b2
Showing 27 changed files with 1,233 additions and 1,092 deletions.
37 changes: 18 additions & 19 deletions R/app_config.R
Original file line number Diff line number Diff line change
@@ -1,41 +1,40 @@
#'
#' NOTE: If you manually change your package name in the DESCRIPTION,
#' don't forget to change it here too, and in the config file.
#'
#' NOTE: If you manually change your package name in the DESCRIPTION,
#' don't forget to change it here too, and in the config file.
#' For a safer name change mechanism, use the `golem::set_golem_name()` function.
#'
#' @param ... character vectors, specifying subdirectory and file(s)
#' within your package. The default, none, returns the root of the app.
#'
#'
#' @param ... character vectors, specifying subdirectory and file(s)
#' within your package. The default, none, returns the root of the app.
#'
#' @noRd
app_sys <- function(...){
app_sys <- function(...) {
system.file(..., package = "TADAShiny")
}


#' Read App Config
#'
#' @param value Value to retrieve from the config file.
#' @param config GOLEM_CONFIG_ACTIVE value. If unset, R_CONFIG_ACTIVE.
#'
#' @param value Value to retrieve from the config file.
#' @param config GOLEM_CONFIG_ACTIVE value. If unset, R_CONFIG_ACTIVE.
#' If unset, "default".
#' @param use_parent Logical, scan the parent directory for config file.
#'
#'
#' @noRd
get_golem_config <- function(
value,
value,
config = Sys.getenv(
"GOLEM_CONFIG_ACTIVE",
Sys.getenv(
"R_CONFIG_ACTIVE",
"default"
)
),
use_parent = TRUE
){
),
use_parent = TRUE) {
config::get(
value = value,
config = config,
value = value,
config = config,
# Modify this if your config file is somewhere else:
file = app_sys("golem-config.yml"),
file = app_sys("golem-config.yml"),
use_parent = use_parent
)
}
48 changes: 23 additions & 25 deletions R/app_server.R
Original file line number Diff line number Diff line change
@@ -7,11 +7,11 @@

# Below increases the max data upload size from the Shiny default of 5MB per file
# to 30MB for file
options(shiny.maxRequestSize=30*1024^2)
options(shiny.maxRequestSize = 30 * 1024^2)

app_server <- function(input, output, session) {
# Your application server logic
tadat = shiny::reactiveValues() # create a list object that holds reactive values passed between modules
tadat <- shiny::reactiveValues() # create a list object that holds reactive values passed between modules
mod_filtering_server("filtering_1", tadat)
mod_query_data_server("query_data_1", tadat) # server call to the module servers with the name of the module and any dependencies (this one uses the tadat reactive values object)
mod_data_flagging_server("data_flagging_1", tadat)
@@ -22,7 +22,7 @@ app_server <- function(input, output, session) {
mod_review_data_server("review_data_1", tadat)
mod_figures_server("figures_1", tadat)
mod_TADA_summary_server("TADA_summary_1", tadat)

# this ensures all tabs except Upload are disabled upon app start
shinyjs::disable(selector = '.nav li a[data-value="Overview"]')
shinyjs::disable(selector = '.nav li a[data-value="Flag"]')
@@ -31,42 +31,40 @@ app_server <- function(input, output, session) {
shinyjs::disable(selector = '.nav li a[data-value="Harmonize"]')
shinyjs::disable(selector = '.nav li a[data-value="Figures"]')
shinyjs::disable(selector = '.nav li a[data-value="Review"]')

# switch to overview tab when tadat$new changes and provide user with window letting them know how many records were automatically flagged for removal upon upload
# move this to query_data?
shiny::observeEvent(tadat$new,{
shiny::showModal(shiny::modalDialog(
title = "Data Loaded",
"Your data were successfully loaded into the app and are displayed on the Overview tab. See summary information about your dataset in the gray box at the bottom of the app."
))
shiny::updateTabsetPanel(session=session, inputId="tabbar", selected="Overview")
tadat$new = NULL
shiny::observeEvent(tadat$new, {
shiny::showModal(shiny::modalDialog(
title = "Data Loaded",
"Your data were successfully loaded into the app and are displayed on the Overview tab. See summary information about your dataset in the gray box at the bottom of the app."
))
shiny::updateTabsetPanel(session = session, inputId = "tabbar", selected = "Overview")
tadat$new <- NULL
})

# update the master 'Remove' column anytime data is added to the 'remove' table
shiny::observeEvent(tadat$removals,{
if(dim(tadat$removals)[2]>0){
tadat$raw$TADA.Remove = apply(tadat$removals, 1, any)
shiny::observeEvent(tadat$removals, {
if (dim(tadat$removals)[2] > 0) {
tadat$raw$TADA.Remove <- apply(tadat$removals, 1, any)
}
})
# this observes when the user switches tabs and adds the current tab they're on as a column to their dataset.

# this observes when the user switches tabs and adds the current tab they're on as a column to their dataset.
shiny::observe({
shiny::req(tadat$raw)
tadat$raw$TADAShiny.tab = input$tabbar
tadat$tab = input$tabbar
tadat$raw$TADAShiny.tab <- input$tabbar
tadat$tab <- input$tabbar
})

# switch to tab user left off on when tadat$reup changes, which only happens when someone uploads a workbook with the column "Removed" in it
shiny::observeEvent(tadat$reup,{
shiny::observeEvent(tadat$reup, {
shiny::showModal(shiny::modalDialog(
title = "Data Loaded",
"Your working dataset has been uploaded and the app switched to the tab where you left off."
))
# the switch tab command
shiny::updateTabsetPanel(session=session, inputId="tabbar", selected=unique(tadat$raw$tab))
tadat$reup = NULL
shiny::updateTabsetPanel(session = session, inputId = "tabbar", selected = unique(tadat$raw$tab))
tadat$reup <- NULL
})


}
68 changes: 41 additions & 27 deletions R/app_ui.R
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ app_ui <- function(request) {
golem_add_external_resources(),
# Your application UI logic
shiny::fluidPage(
tags$html(class = "no-js", lang="en"),
tags$html(class = "no-js", lang = "en"),
HTML("<div id='eq-disclaimer-banner' class='padding-1 text-center text-white bg-secondary-dark'><strong>EPA development environment:</strong> The
content on this page is not production ready. This site is being used
for <strong>development</strong> and/or <strong>testing</strong> purposes
@@ -33,33 +33,47 @@ app_ui <- function(request) {
htmltools::br(),
shiny::tabsetPanel( # create a navbar page with tabs at the top
id = "tabbar",
shiny::tabPanel("1. Load", value = "Load",# each tabPanel represents a tab page at the top of the navbar
htmltools::br(),
mod_query_data_ui("query_data_1")), #,
shiny::tabPanel("2. Overview", value = "Overview",
htmltools::br(),
mod_overview_ui("overview_1")),
shiny::tabPanel("3. Flag", value = "Flag",
htmltools::br(),
mod_data_flagging_ui("data_flagging_1")),

shiny::tabPanel("4. Filter", value ="Filter",
htmltools::br(),
mod_filtering_ui("filtering_1")),
shiny::tabPanel("1. Load",
value = "Load", # each tabPanel represents a tab page at the top of the navbar
htmltools::br(),
mod_query_data_ui("query_data_1")
), # ,
shiny::tabPanel("2. Overview",
value = "Overview",
htmltools::br(),
mod_overview_ui("overview_1")
),
shiny::tabPanel("3. Flag",
value = "Flag",
htmltools::br(),
mod_data_flagging_ui("data_flagging_1")
),
shiny::tabPanel("4. Filter",
value = "Filter",
htmltools::br(),
mod_filtering_ui("filtering_1")
),
# shiny::tabPanel("Harmonize"),
shiny::tabPanel("5. Censored Data", value = "Censored",
htmltools::br(),
mod_censored_data_ui("censored_data_1")),
shiny::tabPanel("6. Harmonize and Calculate", value = "Harmonize",
htmltools::br(),
mod_harmonize_np_ui("harmonize_np_1")),
shiny::tabPanel("7. Explore", value = "Figures",
htmltools::br(),
mod_figures_ui("figures_1")),
shiny::tabPanel("8. Review", value = "Review",
htmltools::br(),
mod_review_data_ui("review_data_1"))

shiny::tabPanel("5. Censored Data",
value = "Censored",
htmltools::br(),
mod_censored_data_ui("censored_data_1")
),
shiny::tabPanel("6. Harmonize and Calculate",
value = "Harmonize",
htmltools::br(),
mod_harmonize_np_ui("harmonize_np_1")
),
shiny::tabPanel("7. Explore",
value = "Figures",
htmltools::br(),
mod_figures_ui("figures_1")
),
shiny::tabPanel("8. Review",
value = "Review",
htmltools::br(),
mod_review_data_ui("review_data_1")
)
),
htmltools::hr(),
mod_TADA_summary_ui("TADA_summary_1"),
2 changes: 1 addition & 1 deletion R/fct_helpers.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' helpers
#' helpers
#'
#' @description A fct function
#'
2 changes: 1 addition & 1 deletion R/golem_utils_ui.R
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
#' @examples
#' list_to_li(c("a", "b"))
#' @importFrom shiny tags tagAppendAttributes tagList
#'
#'

list_to_li <- function(list, class = NULL) {
if (is.null(class)) {
Loading

0 comments on commit b00c5b2

Please sign in to comment.