Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0993583
remove travis CI integration
jwildfire Dec 15, 2020
99995fe
basic gh actions setup for dev branch. fix #462
jwildfire Dec 15, 2020
fe6911c
Merge branch 'dev' into gh-actions
jwildfire Jan 21, 2021
cc1edab
fixing checks - update dependencies
jwildfire Jan 21, 2021
6ae1a0d
fixing checks - remove non-ascii char
jwildfire Jan 21, 2021
ac618a7
merge dev
jwildfire Feb 4, 2021
1579200
resolve description conflict
jwildfire Feb 4, 2021
7c1fb0c
add missing comma
jwildfire Feb 4, 2021
d59fa30
passify tests
jwildfire Feb 4, 2021
8796c80
clean up internal dependencies to clear warnings
jwildfire Feb 4, 2021
36f420e
more documentation tweaks. remove chart dataframe
jwildfire Feb 4, 2021
c63ad72
document all parameters
jwildfire Feb 4, 2021
a08171d
fix variable scope throughout
jwildfire Feb 4, 2021
551a13f
reduce dependencies. fix #488
jwildfire Feb 4, 2021
7fcd687
update workflow to install phantomjs
jwildfire Feb 4, 2021
d29fd31
update dependencies in test apps
jwildfire Feb 4, 2021
ea42af9
remove devtools reference
jwildfire Feb 4, 2021
9154efe
show full test log
jwildfire Feb 4, 2021
f8184a2
show full test log
jwildfire Feb 4, 2021
8657818
attempt to skip in gh actions
jwildfire Feb 4, 2021
2ba81e1
try different workflow ...
jwildfire Feb 4, 2021
14aa46f
try different workflow ...
jwildfire Feb 4, 2021
d207a18
re-run check action
jwildfire Feb 5, 2021
0f432ee
try adding sys.sleep()
jwildfire Feb 5, 2021
6d59bc7
skip widget tests
jwildfire Feb 5, 2021
5ed98ca
update contact info. fix #452
jwildfire Feb 10, 2021
5b06bbc
update contact info. fix #452
jwildfire Feb 10, 2021
0976312
update contact info. fix #452
jwildfire Feb 10, 2021
d6f7e4a
fix description (again)
jwildfire Feb 10, 2021
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
2 changes: 1 addition & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
^data-raw$
^.*\.Rproj$
^\.Rproj\.user$
^\.travis\.yml$
^packrat/
^\.Rprofile$
^cran-comments.md$
Expand All @@ -14,3 +13,4 @@
^doc$
^CRAN-RELEASE$
^customSettings$
^\.github$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
46 changes: 46 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Run R CMD Check on PR to dev

on:
pull_request:
branches:
- dev

name: R-CMD-check

jobs:
R-CMD-check:
runs-on: macOS-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-r@v1
- name: Install dependencies
run: |
install.packages(c("remotes", "rcmdcheck"))
remotes::install_deps(dependencies = TRUE)
shell: Rscript {0}
- name: Find PhantomJS path
id: phantomjs
run: |
echo "::set-output name=path::$(Rscript -e 'cat(shinytest:::phantom_paths()[[1]])')"
- name: Cache PhantomJS
uses: actions/cache@v2
with:
path: ${{ steps.phantomjs.outputs.path }}
key: ${{ matrix.config.os }}-phantomjs
restore-keys: ${{ matrix.config.os }}-phantomjs
- name: Install PhantomJS
shell: Rscript {0}
run: |
options(install.packages.check.source = "no")
if (!shinytest::dependenciesInstalled()) shinytest::installDependencies()
- name: Check
env:
_R_CHECK_CRAN_INCOMING_: false
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
shell: Rscript {0}
- name: Show testthat output
if: always()
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash
7 changes: 0 additions & 7 deletions .travis.yml

This file was deleted.

39 changes: 18 additions & 21 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ Authors@R: c(
person("Xiao","Ni", role = "aut"),
person("James","Buchanan", role="aut"),
person("Susan","Duke", role="aut"),
person("Interactive Safety Graphics Working Group", role = "aut"),
person("Rho Inc.", role = "cph"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we need to list the copyright holder from the LICENSE if its not going to be the maintainers. CRAN will reject a package if the copyright holder isn't noted in the description

Copy link
Contributor Author

@jwildfire jwildfire Feb 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the heads up, @elimillera. I filed #497 to deal with this before release.

Maintainer: Jeremy Wildfire <jeremy_wildfire@rhoworld.com>
person("Interactive Safety Graphics Working Group", role = "aut"))
Maintainer: Jeremy Wildfire <jeremy_wildfire@gmail.com>
Description: A framework for evaluation of clinical trial safety. Users can interactively explore their data using the 'Shiny' application or create standalone 'htmlwidget' charts. Interactive charts are built using 'd3.js' and 'webcharts.js' 'JavaScript' libraries.
URL: https://github.com/SafetyGraphics/safetyGraphics
BugReports: https://github.com/SafetyGraphics/safetyGraphics/issues
Expand All @@ -20,32 +19,30 @@ Encoding: UTF-8
LazyData: true
RoxygenNote: 7.1.1
Suggests:
testthat,
shinytest,
knitr,
fs,
ggplot2,
plotly
knitr,
plotly,
rstudioapi,
rprojroot,
shinydashboard,
shinyFiles,
shinytest,
testthat,
usethis
Imports:
dplyr,
DT,
esquisse,
htmlwidgets,
purrr,
stringr,
jsonlite,
listviewer,
purrr,
rlang,
shiny,
magrittr,
DT,
shinyjs,
rmarkdown,
rlang,
tibble,
utils,
haven,
shinyWidgets,
tidyr,
shinybusy,
listviewer,
shinyFiles,
rprojroot
stringr,
yaml
VignetteBuilder: knitr
Roxygen: list(markdown = TRUE)
23 changes: 1 addition & 22 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

export(add_chart)
export(app_server)
export(app_startup)
export(app_ui)
export(chart_template)
export(chartsNav)
Expand Down Expand Up @@ -37,46 +38,24 @@ export(settingsData)
export(settingsDataUI)
export(settingsMapping)
export(settingsMappingUI)
import(clisymbols)
import(dplyr)
import(esquisse)
import(listviewer)
import(magrittr)
import(shiny)
import(shinyFiles)
import(tools)
import(yaml)
importFrom(DT,DTOutput)
importFrom(DT,renderDT)
importFrom(fs,dir_copy)
importFrom(fs,file_create)
importFrom(fs,file_exists)
importFrom(fs,path)
importFrom(fs,path_abs)
importFrom(haven,read_sas)
importFrom(listviewer,jsonedit)
importFrom(listviewer,jsoneditOutput)
importFrom(listviewer,renderJsonedit)
importFrom(magrittr,"%>%")
importFrom(purrr,keep)
importFrom(purrr,map)
importFrom(purrr,transpose)
importFrom(rlang,.data)
importFrom(rprojroot,find_root)
importFrom(rprojroot,is_rstudio_project)
importFrom(rstudioapi,isAvailable)
importFrom(rstudioapi,openProject)
importFrom(shiny,dataTableOutput)
importFrom(shiny,renderDataTable)
importFrom(shinyWidgets,materialSwitch)
importFrom(shinyWidgets,progressBar)
importFrom(shinyWidgets,updateProgressBar)
importFrom(shinyjs,html)
importFrom(shinyjs,useShinyjs)
importFrom(stringr,str_detect)
importFrom(stringr,str_split)
importFrom(stringr,str_to_upper)
importFrom(tidyr,gather)
importFrom(usethis,create_project)
importFrom(utils,globalVariables)
importFrom(yaml,write_yaml)
23 changes: 18 additions & 5 deletions R/add_chart.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,18 @@
#' @param type Type of chart: `plot`, `module`, or `htmlwidget`. Default is `plot` (static)
#' @param domain associated data domain, for example `aes`, `labs`, or `multiple`
#' @param package optional, R package that this chart is associated with.
#' @param chart_template chart template function
#' @param workflow list of workflow functions appropriate for chart YAML
#' @param open boolean
#' @param ... additional parameters for chart_template
#'
#' @seealso [chart_template()]
#'
#' @importFrom rprojroot find_root is_rstudio_project
#' @importFrom fs path file_create file_exists
#' @importFrom yaml write_yaml
#'
#' @export

add_chart <- function(
path,
name = "newplot",
label = "New Static Plot",
type = "plot",
Expand All @@ -41,9 +43,20 @@ add_chart <- function(
...
){

proj_root <- rprojroot::find_root(rprojroot::is_rstudio_project)
if (!requireNamespace("rprojroot", quietly = TRUE)) {
stop("Package \"rprojroot\" needed for this function to work. Please install it.",
call. = FALSE)
}

path <- file.path(proj_root, "config")
if (!requireNamespace("fs", quietly = TRUE)) {
stop("Package \"fs\" needed for this function to work. Please install it.",
call. = FALSE)
}
proj_root <- rprojroot::find_root(rprojroot::is_rstudio_project)
if(missing(path)){
path <- file.path(proj_root, "config")
}


yaml_where <- file.path(
path, paste0(name, ".yaml")
Expand Down
5 changes: 0 additions & 5 deletions R/aes.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
#' A dataset containing anonymized AE data from a clinical trial in the CDISC ADaM format. The structure is 1 record per measure per adverse event. See a full description of the ADaM data standard \href{https://www.cdisc.org/standards/foundational/adam/adam-implementation-guide-v11}{here}.
#'
#' @format A data frame with 10288 rows and 46 variables.
#' \describe{
#' \item{STUDYID}{Study Identifier}
#' \item{SUBJID}{Subject Identifier for the Study}
#' \item{USUBJID}{Unique Subject Identifier}
#' }
#' @source \url{https://github.com/RhoInc/data-library}
#'
"aes"
15 changes: 8 additions & 7 deletions R/app_init_addin.R
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#' RStudio Add-in for constructing lean ADLB and ADAE data
#'
#'
#' @import shiny
#' @import shinyFiles
#' @import listviewer
#'


app_init_addin <- function(){

if (!requireNamespace("shinyFiles", quietly = TRUE)) {
stop("Package \"shinyFiles\" needed for this function to work. Please install it.",
call. = FALSE)
}


ui <- bootstrapPage(

Expand Down Expand Up @@ -133,11 +134,11 @@ app_init_addin <- function(){
chartSettingsPaths = NULL
){

config <- safetyGraphics:::app_startup(domainData, meta, charts, mapping, chartSettingsPaths)
config <- safetyGraphics::app_startup(domainData, meta, charts, mapping, chartSettingsPaths)

app <- shinyApp(
ui = app_ui(config$meta, config$domainData, config$mapping, config$standards),
server = app_server(input, output, session, config$meta, config$mapping, config$domainData, config$charts)
server = app_server(config$meta, config$mapping, config$domainData, config$charts)
)
}

Expand Down Expand Up @@ -187,7 +188,7 @@ app_init_addin <- function(){
tblMeta <- function(charts){

bbb <- purrr::map(charts, ~{
bb <- as_tibble(t(tibble(.x)))
bb <- dplyr::as_tibble(t(dplyr::tibble(.x)))
names(bb) <- names(.x)
bb
})
Expand Down
24 changes: 14 additions & 10 deletions R/app_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@
#'
#' This function returns a server function suitable for use in shiny::runApp()
#'
#' @param input app input
#' @param output app output
#' @param session app session

#' @param meta data frame containing the metadata for use in the app. See the preloaded file (\code{?safetyGraphics::meta}) for more data specifications and details. Defaults to \code{safetyGraphics::meta}.
#' @param domainData named list of data.frames to be loaded in to the app.
#' @param chartsList list of charts to include in the app
#' @param mapping current mapping
#' @param charts list of charts to include in the app
#'
#' @import shiny
#' @import dplyr
#' @importFrom purrr map
#' @importFrom shinyjs html
#'
#' @export
app_server <- function(input, output, session, meta, mapping, domainData, charts){
app_server <- function(meta, mapping, domainData, charts){
server <- function(input, output, session) {
#Initialize modules

Expand All @@ -19,8 +23,8 @@ app_server <- function(input, output, session, meta, mapping, domainData, charts
current_mapping<-callModule(mappingTab, "mapping", meta, domainData)

id_col <- reactive({
dm<-current_mapping()%>%filter(domain=="dm")
id<-dm %>%filter(text_key=="id_col")%>%pull(current)
dm<-current_mapping()%>%filter(.data$domain=="dm")
id<-dm %>%filter(.data$text_key=="id_col")%>%pull(.data$current)
return(id)
})

Expand All @@ -32,17 +36,17 @@ app_server <- function(input, output, session, meta, mapping, domainData, charts
id_col=id_col
)

callModule(settingsData, "dataSettings", domains = domainData, filtered=filtered_data)
callModule(settingsData, "dataSettings", domains = domainData)
callModule(settingsMapping, "metaSettings", metaIn=meta, mapping=current_mapping)
callModule(settingsCharts, "chartSettings",charts = charts)
callModule(homeTab, "home")

#Initialize Chart UI - Adds subtabs to chart menu - this initializes initializes chart UIs
charts %>% map(chartsNav)
charts %>% purrr::map(chartsNav)

#Initialize Chart Servers
validDomains <- tolower(names(mapping))
charts %>% map(
charts %>% purrr::map(
~callModule(
module=chartsTab,
id=.x$name,
Expand Down
7 changes: 7 additions & 0 deletions R/app_startup.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
#'
#' Prepare inputs for safetyGraphics app - run before app is initialized. See ?safetyGraphicsApp for parameter definitions
#'
#' @param domainData named list of domain level data
#' @param meta list of configuration metadata
#' @param charts list of charts
#' @param mapping initial data mapping
#' @param chartSettingsPaths character vector with paths to chart setting yaml files
#'
#' @return List of elements for used to initialize the shiny app with the following parameters
#' \itemize{
#' \item{"meta"}{ List of configuration metadata }
Expand All @@ -11,6 +17,7 @@
#' \item{"standards"}{ List of domain level data standards }
#' }
#'
#' @export
app_startup<-function(domainData=NULL, meta=NULL, charts=NULL, mapping=NULL, chartSettingsPaths=NULL){
# Process charts metadata
if(is.null(charts)){
Expand Down
6 changes: 4 additions & 2 deletions R/app_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
#' @param domainData named list of data.frames to be loaded in to the app.
#' @param mapping data.frame specifying the initial values for each data mapping. If no mapping is provided, the app will attempt to generate one via \code{detectStandard()}
#' @param standards a list of information regarding data standards. Each list item should use the format returned by safetyGraphics::detectStandard.
#'
#'
#' @importFrom shinyjs useShinyjs
#'
#' @export

app_ui <- function(meta, domainData, mapping, standards){
Expand All @@ -21,7 +23,7 @@ app_ui <- function(meta, domainData, mapping, standards){

#app UI using calls to modules
ui<-tagList(
useShinyjs(),
shinyjs::useShinyjs(),
tags$head(
tags$style(app_css),
tags$link(
Expand Down
Loading