Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@
^CRAN-RELEASE$
^customSettings$
^\.github$
^app\.R$
^rsconnect$
^LICENSE\.md$

2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: safetyGraphics
Title: Interactive Graphics for Monitoring Clinical Trial Safety
Version: 2.0.1
Version: 2.1.0
Authors@R: c(
person("Jeremy", "Wildfire", email = "jwildfire@gmail.com", role = c("cre","aut")),
person("Becca", "Krouse", role="aut"),
Expand Down
3 changes: 3 additions & 0 deletions R/_disable_autoload.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Disabling shiny autoload

# See ?shiny::loadSupport for more information
19 changes: 8 additions & 11 deletions R/makeChartConfig.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,14 @@ makeChartConfig <- function(dirs, packages="safetyCharts", packageLocation="conf
if(!is.null(packages)){
for(package in packages){
packageFound<-FALSE
for(lib in .libPaths()){

packageDir<-paste(lib,package,packageLocation, sep="/")
if(file.exists(packageDir)) {
loaded <- do.call(require,list(package))
if(!loaded) do.call(library,list(package)) #Attach the library to the search list if it is installed
message("- Found the {",package,"} package and added ", packageDir," to list of chart locations.")
packageFound<-TRUE
dirs<-c(dirs, packageDir)
break
}
packageDir <- system.file(packageLocation, package = package)
if(file.exists(packageDir)) {
loaded <- do.call(require,list(package))
if(!loaded) do.call(library,list(package)) #Attach the library to the search list if it is installed
message("- Found the {",package,"} package and added ", packageDir," to list of chart locations.")
packageFound<-TRUE
dirs<-c(dirs, packageDir)
break
}
if(!packageFound){
message("{",package, "} package not found or '",packageLocation,"' folder does not exist, please install package and confirm that specified folder is found.")
Expand Down
14 changes: 5 additions & 9 deletions R/mod_safetyGraphicsUI.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,12 @@
#' @export

safetyGraphicsUI <- function(id, meta, domainData, mapping, standards){
#read css from pacakge
ns<-NS(id)
app_css <- NULL
for(lib in .libPaths()){
if(is.null(app_css)){
css_path <- paste(lib,'safetyGraphics', 'www','index.css', sep="/")
if(file.exists(css_path)) app_css <- HTML(readLines(css_path))
}
}


#read css from package
css_path <- system.file("www","index.css", package = "safetyGraphics")
app_css <- HTML(readLines(css_path))

#script to append population badge nav bar
participant_badge<-tags$script(
HTML(
Expand Down
10 changes: 8 additions & 2 deletions R/safetyGraphicsApp.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#' @param autoMapping boolean indicating whether the app should attempt to automatically detect data standards and generate mappings for the data provided. Values specified in the `mapping` parameter overwrite automatically generated mappings when both are found. Defaults to true.
#' @param filterDomain domain used for the data/filter tab. Demographics ("`dm`") is used by default. Using a domain that is not one record per participant is not recommended.
#' @param chartSettingsPaths path(s) where customization functions are saved relative to your working directory. All charts can have initialization (e.g. myChart_Init.R) and static charts can have charting functions (e.g. myGraphic_Chart.R). All R files in this folder are sourced and files with the correct naming convention are linked to the chart. See the Custom Charts vignette for more details.
#' @param runNow Should the shiny app object created be run directly? Helpful when writing functions to dispatch to shinyapps, rsconnect, or shinyproxy.
#'
#' @import shiny
#' @import safetyData
Expand All @@ -24,7 +25,8 @@ safetyGraphicsApp <- function(
mapping=NULL,
autoMapping=TRUE,
filterDomain="dm",
chartSettingsPaths = NULL
chartSettingsPaths = NULL,
runNow = TRUE
){
message("Initializing safetyGraphicsApp")
config <- app_startup(domainData, meta, charts, mapping, autoMapping, filterDomain, chartSettingsPaths)
Expand All @@ -43,5 +45,9 @@ safetyGraphicsApp <- function(
)
}
)
runApp(app, launch.browser = TRUE)

if(runNow)
runApp(app)
else
app
}
10 changes: 2 additions & 8 deletions R/safetyGraphicsInit.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,8 @@ safetyGraphicsInit <- function(charts=makeChartConfig(), delayTime=1000, maxFile
}
}


app_css <- NULL
for(lib in .libPaths()){
if(is.null(app_css)){
css_path <- paste(lib,'safetyGraphics', 'www','index.css', sep="/")
if(file.exists(css_path)) app_css <- HTML(readLines(css_path))
}
}
css_path <- system.file("www","index.css", package = "safetyGraphics")
app_css <- HTML(readLines(css_path))

ui<-fluidPage(
useShinyjs(),
Expand Down
5 changes: 5 additions & 0 deletions inst/deploy/app.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Launch the ShinyApp (Do not remove this comment)
# To deploy, run: rsconnect::deployApp()
# Or use the blue button on top of this file
library(safetyGraphics) # or use devtools::install_github() to load dev version
safetyGraphics::safetyGraphicsApp(runNow = FALSE) # add parameters here (if any)
5 changes: 4 additions & 1 deletion man/safetyGraphicsApp.Rd

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