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
46 changes: 46 additions & 0 deletions .github/workflows/R-CMD-check-main.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:
- main

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", "--ignore-vignettes"), build_args = c("--no-build-vignettes"), 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
2 changes: 1 addition & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Check
env:
_R_CHECK_CRAN_INCOMING_: false
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran", "--ignore-vignettes"), build_args = c("--no-build-vignettes"), error_on = "warning", check_dir = "check")
shell: Rscript {0}
- name: Show testthat output
if: always()
Expand Down
64 changes: 28 additions & 36 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -8,50 +8,42 @@ Authors@R: c(
person("Xiao","Ni", role = "aut"),
person("James","Buchanan", role="aut"),
person("Susan","Duke", role="aut"))
Maintainer: Jeremy Wildfire <jeremy_wildfire@gmail.com>
Maintainer: Jeremy Wildfire <jwildfire@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
Depends: R (>= 3.5)
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.1.1
RoxygenNote: 7.1.2
Suggests:
fs,
ggplot2,
knitr,
plotly,
rmarkdown,
markdown,
rstudioapi,
rprojroot,
shinydashboard,
shinyFiles,
shinytest,
testthat,
usethis
ggplot2 (>= 3.3.0),
knitr (>= 1.34),
rmarkdown (>= 2.10),
shinydashboard (>= 0.7.1),
shinytest (>= 1.5.0),
testthat (>= 3.0.4),
usethis (>= 2.0.1),
listviewer (>= 3.0.0),
shinybusy (>= 0.2.2),
shinyWidgets (>= 0.6.1)
Imports:
dplyr,
DT,
datamods,
htmlwidgets,
jsonlite,
listviewer,
magrittr,
pharmaRTF,
purrr,
rclipboard,
rlang,
safetyData,
safetyCharts,
shiny,
shinyjs,
shinyWidgets,
sortable,
stringr,
yaml,
shinybusy
Remotes: safetyGraphics/safetyCharts
dplyr (>= 1.0.0),
DT (>= 0.19),
datamods (>= 1.1.5),
htmlwidgets (>= 1.5.0),
jsonlite (>= 1.7.0),
magrittr (>= 2.0.0),
purrr (>= 0.3.0),
rclipboard (>= 0.1.3),
rlang (>= 0.4.11),
safetyData (>= 1.0.0),
safetyCharts (>= 0.2),
shiny (>= 1.6.0),
shinyjs (>= 2.0.0),
sortable (>= 0.4.4),
stringr (>= 1.4.0),
yaml (>= 2.2.1)
VignetteBuilder: knitr
Roxygen: list(markdown = TRUE)
6 changes: 0 additions & 6 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,12 @@ import(safetyData)
import(shiny)
import(yaml)
importFrom(DT,renderDT)
importFrom(listviewer,jsonedit)
importFrom(listviewer,jsoneditOutput)
importFrom(listviewer,renderJsonedit)
importFrom(purrr,keep)
importFrom(purrr,map)
importFrom(purrr,map2)
importFrom(rlang,.data)
importFrom(shiny,dataTableOutput)
importFrom(shiny,renderDataTable)
importFrom(shinyWidgets,progressBar)
importFrom(shinyWidgets,updateProgressBar)
importFrom(shinybusy,add_busy_spinner)
importFrom(shinyjs,addClass)
importFrom(shinyjs,delay)
importFrom(shinyjs,disable)
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ The first production release of safetyGraphics includes many improvements includ

Initial CRAN release for safetyGraphics. The safetyGraphics package provides 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.

See the [GitHub release tracker](https://github.com/ASA-DIA-InteractiveSafetyGraphics/safetyGraphics/releases) for additional release documentation and links to issues.
See the [GitHub release tracker](https://github.com/safetyGraphics/safetyGraphics/releases) for additional release documentation and links to issues.
2 changes: 1 addition & 1 deletion R/app_startup.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#' @param mapping list specifying the initial mapping values for each data mapping for each domain (e.g. list(aes= list(id_col='USUBJID', seq_col='AESEQ')).
#' @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 itialization (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 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.
#'
#'
#' @return List of elements for used to initialize the shiny app with the following parameters
Expand Down
2 changes: 1 addition & 1 deletion R/makeChartExport.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#' Creates R code that allows chart to be exported
#'
#' @param chart chart object like the one generated by makeChartConfig().
#' @param mapping mapping object like the one generatedf by makeMapping().
#' @param mapping mapping object like the one generated by makeMapping().
#'
#' @import purrr
#' @importFrom yaml as.yaml
Expand Down
27 changes: 15 additions & 12 deletions R/mod_filterTab.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@

filterTabUI <- function(id){
ns <- NS(id)

if(isNamespaceLoaded("shinyWidgets")){
countObj<- shinyWidgets::progressBar(
id = ns("pbar"), value = 100,
total = 100, display_pct = TRUE
)
}

filter_ui<-list(
h1(paste("Participant Selector")),
span("This page dynamically filters participants across all data domains. Only the selected participants are included in charts."),
Expand All @@ -20,10 +26,7 @@ filterTabUI <- function(id){
),
column(
width = 9,
progressBar(
id = ns("pbar"), value = 100,
total = 100, display_pct = TRUE
),
countObj,
DT::dataTableOutput(outputId = ns("table")),
tags$p("Code dplyr:"),
verbatimTextOutput(outputId = ns("code_dplyr")),
Expand Down Expand Up @@ -52,7 +55,6 @@ filterTabUI <- function(id){
#' @return filtered data set
#'
#' @import datamods
#' @importFrom shinyWidgets progressBar updateProgressBar
#' @importFrom shinyjs show hide
#' @importFrom shiny renderDataTable
#'
Expand All @@ -68,7 +70,6 @@ filterTab <- function(input, output, session, domainData, filterDomain, current_
req(filterCheck())
shinyjs::show(selector = paste0(".navbar li a[data-value=",tabID,"]"))
shinyjs::show(selector = paste0(".navbar #population-header"))

domainData[[filterDomain]]
})

Expand All @@ -86,11 +87,13 @@ filterTab <- function(input, output, session, domainData, filterDomain, current_
)

observeEvent(res_filter$filtered(), {
updateProgressBar(
session = session,
id = "pbar",
value = nrow(res_filter$filtered()), total = nrow(raw())
)
if(isNamespaceLoaded("shinyWidgets")){
shinyWidgets::updateProgressBar(
session = session,
id = "pbar",
value = nrow(res_filter$filtered()), total = nrow(raw())
)
}

shinyjs::html(
"header-count",
Expand Down
2 changes: 1 addition & 1 deletion R/mod_filterTabChecks.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#' @param filterDomain domain to use for filtering (typically "dm")
#' @param current_mapping current data mapping (REACTIVE)
#'
#' @return reactive that returns a boolean indicating whether the checks passed and filtering can be initiailized
#' @return reactive that returns a boolean indicating whether the checks passed and filtering can be initialized
#'
#' @export

Expand Down
6 changes: 3 additions & 3 deletions R/mod_homeTab.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ homeTab <- function(input, output, session){

<h3><i> Using the app</i></h3>
<p>
Detailed instructions about using the app can be found in our <a target="_blank" href="https://cran.r-project.org/web/packages/safetyGraphics/vignettes/shinyUserGuide.html">vignette</a>.
Detailed instructions about using the app can be found in our <a target="_blank" href="https://github.com/SafetyGraphics/safetyGraphics/wiki/Intro">vignette</a>.
In short, the user will initialize the app with their data, adjust settings as needed, and view the interactive charts.
Finally, the user may export a self-contained, fully reproducible snapshot of the charts that can be easily shared with others.
</p>

<h3><i> Charts </i></h3>
<p>
The app is built to support a wide variety of chart types including static plots (e.g. from <a target="_blank" href="https://cran.r-project.org/web/packages/ggplot2/index.html">{ggplot2}</a>), shiny modules, <a target="_blank" href="https://cran.r-project.org/web/packages/htmlwidgets/index.html">{htmlwidgets}</a> and even static outputs like RTFs.
Several pre-configured charts are included in the companion <a target="_blank" href="https://www.github.com/safetyGraphics/safetyCharts">{safetyCharts}</a> R Package, and are available by default in the app.
Other charts can be added using the process descibed in <a target="_blank" href="https://cran.r-project.org/web/packages/safetyGraphics/vignettes/shinyUserGuide.html">this vignette</a>.
Several pre-configured charts are included in the companion <a target="_blank" href="https://github.com/safetyGraphics/safetyCharts">{safetyCharts}</a> R Package, and are available by default in the app.
Other charts can be added using the process descibed in <a target="_blank" href="https://github.com/SafetyGraphics/safetyGraphics/wiki/ChartConfiguration">this vignette</a>.
</p>

<p>
Expand Down
10 changes: 7 additions & 3 deletions R/mod_safetyGraphicsUI.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#' @param standards a list of information regarding data standards. Each list item should use the format returned by safetyGraphics::detectStandard.
#'
#' @importFrom shinyjs useShinyjs
#' @importFrom shinybusy add_busy_spinner
#'
#' @export

Expand All @@ -30,11 +29,16 @@ safetyGraphicsUI <- function(id, meta, domainData, mapping, standards){
header.append('<div id=\"population-header\" class=\"badge\" title=\"Selected Participants\" ><span id=\"header-count\"></span>/<span id=\"header-total\"></span></div>');"
)
)

if(isNamespaceLoaded("shinybusy")){
spinner<-shinybusy::add_busy_spinner(spin = "atom", position="bottom-right")
}else{
spinner<-NULL
}

#app UI using calls to modules
ui<-tagList(
shinyjs::useShinyjs(),
add_busy_spinner(spin = "atom", position="bottom-right"),
spinner,
tags$head(
tags$style(app_css),
tags$link(
Expand Down
30 changes: 19 additions & 11 deletions R/mod_settingsCharts.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,31 @@
#'
#' @param id module id
#'
#' @importFrom listviewer jsoneditOutput
#' @export

settingsChartsUI <- function(id){
ns <- NS(id)
if(isNamespaceLoaded("listviewer")){
tabs<-tabsetPanel(
tabPanel("List Explorer", listviewer::jsoneditOutput(ns("chartObj"), height = "800px")),
tabPanel("Verbatim", verbatimTextOutput(ns("chartList"))),
tabPanel("YAML", verbatimTextOutput(ns("chartYAML")))
)
}else{
tabs<- tabsetPanel(
tabPanel("Verbatim", verbatimTextOutput(ns("chartList"))),
tabPanel("YAML", verbatimTextOutput(ns("chartYAML")))
)
}

list(
br(),
p(
icon("info-circle"),
"Full details regarding the charts are shown below. Charts specifications are saved in an R list, and can be exported for re-use on the settings/code tab. ",
class="info"
),
tabsetPanel(
tabPanel("jsonedit View", listviewer::jsoneditOutput(ns("chartObj"), height = "800px") ),
tabPanel("Verbatim", verbatimTextOutput(ns("chartList"))),
tabPanel("YAML", verbatimTextOutput(ns("chartYAML")))
)
tabs
)
}

Expand All @@ -29,17 +37,17 @@ settingsChartsUI <- function(id){
#' @param session Shiny session object
#' @param charts list data frame summarizing the charts
#'
#' @importFrom listviewer renderJsonedit jsonedit
#' @import dplyr
#'
#' @export

settingsCharts <- function(input, output, session, charts){
ns <- session$ns

output$chartObj <- listviewer::renderJsonedit({
listviewer::jsonedit(charts)
})
if(isNamespaceLoaded("listviewer")){
output$chartObj <- listviewer::renderJsonedit({
listviewer::jsonedit(charts)
})
}

output$chartList <- renderPrint({
print(charts)
Expand Down
2 changes: 1 addition & 1 deletion R/prepareChart.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' Prepare a chart object for safetyGraphcis
#' Prepare a chart object for safetyGraphics
#'
#' Sets default values and binds needed functions to a chart object based on chart type.
#'
Expand Down
2 changes: 1 addition & 1 deletion R/safetyGraphics.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#'
#' Learn more on
#' \href{https://CRAN.R-project.org/package=safetyGraphics}{CRAN}
#' or \href{https://github.com/ASA-DIA-InteractiveSafetyGraphics/safetyGraphics}{GitHub}
#' or \href{https://github.com/SafetyGraphics/safetyGraphics}{GitHub}
#'
#' @docType package
#' @name SafetyGraphics
Expand Down
2 changes: 1 addition & 1 deletion R/safetyGraphicsApp.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#' @param mapping list specifying the initial mapping values for each data mapping for each domain (e.g. list(aes= list(id_col='USUBJID', seq_col='AESEQ')).
#' @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 itialization (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 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.
#'
#' @import shiny
#' @import safetyData
Expand Down
Loading