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 DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,13 @@ Imports:
magrittr,
purrr,
rlang,
safetyData,
safetyCharts,
shiny,
shinyjs,
shinyWidgets,
stringr,
yaml
Remotes: safetyGraphics/safetyCharts
VignetteBuilder: knitr
Roxygen: list(markdown = TRUE)
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export(settingsMappingUI)
import(datamods)
import(dplyr)
import(listviewer)
import(safetyData)
import(shiny)
import(yaml)
importFrom(DT,renderDT)
Expand Down
8 changes: 0 additions & 8 deletions R/aes.R

This file was deleted.

6 changes: 3 additions & 3 deletions R/app_init_addin.R
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ app_init_addin <- function(){

safetyGraphicsApp1 <- function(
domainData=list(
labs=safetyGraphics::labs,
aes=safetyGraphics::aes,
dm=safetyGraphics::dm
labs=safetyData::adam_adlbc,
aes=safetyData::adam_adae,
dm=safetyData::adam_adsl
),
meta = safetyGraphics::meta,
charts=NULL,
Expand Down
4 changes: 2 additions & 2 deletions R/detectStandard.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#'
#' @return A data frame describing the detected standard for each \code{"text_key"} in the provided metadata. Columns are \code{"domain"}, \code{"text_key"}, \code{"column"} and \code{"standard"}.
#' @examples
#' detectStandard(data=safetyGraphics::aes) #aes domain evaluated by default
#' detectStandard(data=safetyGraphics::labs,domain="labs" )
#' detectStandard(data=safetyData::adam_adae) #aes domain evaluated by default
#' detectStandard(data=safetyData::adam_adlbc,domain="labs" )
#'
#' @importFrom stringr str_detect
#'
Expand Down
8 changes: 0 additions & 8 deletions R/dm.R

This file was deleted.

17 changes: 15 additions & 2 deletions R/evaluateStandard.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,21 @@
#' @return a list describing to what degree the data set matches the data standard. The "match" property describes compliance with the standard as "full", "partial" or "none". The "checks" property is a list of the data elements expected for the standard and whether they are "valid" in the given data set. "total_checks", "valid_checks" and "invalid_checks" provide counts of the specified checks. "match_percent" is calculated as valid_checks/total_checks. "mapping" is a data frame describing the detected standard for each \code{"text_key"} in the provided metadata. Columns are \code{"text_key"}, \code{"current"} containing the name of the matched column or field value in the data and \code{"match"} a boolean indicating whether the data matches the standard.
#'
#' @examples
#' evaluateStandard(data=labs, meta=meta, domain="labs", standard="adam") # Match is TRUE
#' evaluateStandard(data=labs, meta=meta, domain="labs", standard="sdtm") # Match is FALSE
#' # Match is TRUE
#' evaluateStandard(
#' data=safetyData::adam_adlbc,
#' meta=meta,
#' domain="labs",
#' standard="adam"
#' )
#'
#' # Match is FALSE
#' evaluateStandard(
#' data=safetyData::adam_adlbc,
#' meta=meta,
#' domain="labs",
#' standard="sdtm"
#' )
#'
#' @import dplyr
#' @importFrom purrr map
Expand Down
4 changes: 2 additions & 2 deletions R/hasColumn.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#' @return logical scalar. TRUE if the column is found. FALSE otherwise
#'
#' @examples
#' safetyGraphics:::hasColumn(columnName="PARAM",data=labs) #TRUE
#' safetyGraphics:::hasColumn(columnName="Not_a_column",data=labs) #FALSE
#' safetyGraphics:::hasColumn(columnName="PARAM",data=safetyData::adam_adlbc) #TRUE
#' safetyGraphics:::hasColumn(columnName="Not_a_column",data=safetyData::adam_adlbc) #FALSE
#'
#' @keywords internal

Expand Down
15 changes: 13 additions & 2 deletions R/hasField.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,19 @@
#' @return logical scalar. TRUE if field_value is found. FALSE otherwise
#'
#' @examples
#' safetyGraphics:::hasField(fieldValue="Bilirubin (umol/L)",columnName="PARAM",data=labs) #TRUE
#' safetyGraphics:::hasField(fieldValue="Not_a_real_value",columnName="",data=labs) #FALSE
#' #TRUE
#' safetyGraphics:::hasField(
#' fieldValue="Bilirubin (umol/L)",
#' columnName="PARAM",
#' data=safetyData::adam_adlbc
#' )
#'
#' #FALSE
#' safetyGraphics:::hasField(
#' fieldValue="Not_a_real_value",
#' columnName="",
#' data=safetyData::adam_adlbc
#' )
#'
#' @keywords internal

Expand Down
55 changes: 0 additions & 55 deletions R/labs.R

This file was deleted.

21 changes: 18 additions & 3 deletions R/makeChartConfig.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,28 @@ makeChartConfig <- function(dirs, sourceFiles=TRUE){
chart$order
) %>% as.numeric

#charts should be available to export unless the are modules or chart$export is set to false
chart$export <- ifelse(
is.null(chart$export),
TRUE,
chart$export
)

return(chart)
})

names(charts) <- yaml_files %>% file_path_sans_ext %>% basename
charts <- charts[order(purrr::map_dbl(charts, function(chart) chart$order))]
charts <- charts[order(purrr::map_dbl(charts, function(chart) chart$order))]

# Drop charts where order is negative
drops <- charts[purrr::map_lgl(charts, function(chart) chart$order < 0)]
if(length(drops)>0){
message("Dropped ", length(drops), " charts: ",paste(names(drops),collapse=", "))
message("To display these charts, set the `order` parameter in the chart object or yaml file to a positive number.")
charts <- charts[purrr::map_lgl(charts, function(chart) chart$order >= 0)]
}

message("Found ", length(yaml_files), " config files: ",paste(names(charts),collapse=", "))
message("Loaded ", length(charts), " charts: ",paste(names(charts),collapse=", "))

# Bind workflow functions to chart object
all_functions <- as.character(utils::lsf.str(".GlobalEnv"))
Expand Down
5 changes: 2 additions & 3 deletions R/mod_reportsTab.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ reportsTab <- function(input, output, session, charts, data, mapping){
# create checkbox for selecting charts of interest
output$checkboxes <- renderUI({
# no support for modules or broken widgets yet
noExport <- c("aeTimelines","hepexplorer","safetyShiftPlot","tplyr_shift")
chart_type <- charts %>% map(., ~.$type) %>% unlist
chart_name <- charts %>% map(., ~.$name) %>% unlist
charts_keep <- ((! chart_type == "module") & (! chart_name %in% noExport))
chart_export <- charts %>% map(., ~.$export) %>% unlist
charts_keep <- ((! chart_type == "module") & (chart_export))

charts_labels <- charts %>% map(., ~ .$label) %>% unlist
charts_vec <- names(charts)[charts_keep]
Expand Down
9 changes: 5 additions & 4 deletions R/safetyGraphicsApp.R
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
#' Run the interactive safety graphics app
#'
#' @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 domainData named list of data.frames to be loaded in to the app. Sample AdAM data from the safetyData package used by default
#' @param charts data.frame of charts to be used in 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 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.
#'
#' @import shiny
#' @import safetyData
#'
#' @export

safetyGraphicsApp <- function(
domainData=list(
labs=safetyGraphics::labs,
aes=safetyGraphics::aes,
dm=safetyGraphics::dm
labs=safetyData::adam_adlbc,
aes=safetyData::adam_adae,
dm=safetyData::adam_adsl
),
meta = safetyGraphics::meta,
charts=NULL,
Expand Down
9 changes: 0 additions & 9 deletions data-raw/README.md

This file was deleted.

Loading