diff --git a/DESCRIPTION b/DESCRIPTION index b2c8c4d1..00b447c9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: safetyGraphics Title: Create Interactive Graphics Related to Clinical Trial Safety -Version: 0.8.0 +Version: 0.9.0 Authors@R: c( person("Jeremy", "Wildfire", email = "jeremy_wildfire@rhoworld.com", role = c("cre","aut")), person("Becca", "Krouse", role="aut"), diff --git a/NAMESPACE b/NAMESPACE index 0f3115f1..cb58fb76 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -15,6 +15,7 @@ import(htmlwidgets) import(rmarkdown) import(shinyjs) importFrom(dplyr,"filter") +importFrom(dplyr,filter) importFrom(magrittr,"%>%") importFrom(purrr,keep) importFrom(purrr,map) @@ -22,6 +23,7 @@ importFrom(purrr,map_chr) importFrom(purrr,map_dbl) importFrom(purrr,map_lgl) importFrom(rlang,.data) +importFrom(rlang,parse_expr) importFrom(shiny,runApp) importFrom(stringr,str_detect) importFrom(stringr,str_split) diff --git a/R/checkField.R b/R/checkField.R index ec6c48d6..5afb45c2 100644 --- a/R/checkField.R +++ b/R/checkField.R @@ -13,11 +13,11 @@ #' @examples #' testSettings<-generateSettings(standard="AdAM") #' fields<-list("measure_values","TB") -#' safetyGraphics:::checkFieldSettings(fieldKey=fields,settings=testSettings, data=adlbc) +#' safetyGraphics:::checkField(fieldKey=fields,settings=testSettings, data=adlbc) #' #' @keywords internal -checkFieldSettings <- function(fieldKey, settings, data){ +checkField <- function(fieldKey, settings, data){ stopifnot(typeof(fieldKey)=="list", typeof(settings)=="list") # Check to see that the field data specified in the seetings is found in the data @@ -29,12 +29,22 @@ checkFieldSettings <- function(fieldKey, settings, data){ fieldCheck$value <- getSettingValue(key=fieldCheck$key,settings=settings) #get the name of the column containing the field - columnTextKey<-getSettingsMetadata(cols="field_column_key",text_keys=fieldCheck$text_key) + lastKey <- fieldCheck$key[[length(fieldCheck$key)]] + + #use the parent metadata entry if the item is a vector + if(is.numeric(lastKey)){ + sub_key <- fieldKey[-length(fieldKey)] + sub_text_key <- paste(unlist(sub_key), collapse='--') + columnTextKey <-getSettingsMetadata(cols="field_column_key",text_keys=sub_text_key) + }else{ + columnTextKey <-getSettingsMetadata(cols="field_column_key",text_keys=fieldCheck$text_key) + } + columnKey<-textKeysToList(columnTextKey)[[1]] columnName<-getSettingValue(key=columnKey,settings=settings) if(length(fieldCheck$value)>0){ - fieldCheck$valid <- hasField(fieldValue=fieldCheck$value, columnName=columnName,data=data) + fieldCheck$valid <- hasField(fieldValue=fieldCheck$value, columnName=columnName,data=data) }else{ fieldCheck$value <- "--No Value Given--" fieldCheck$valid <- TRUE #null values are ok diff --git a/R/checkFieldSettings.R b/R/checkFieldSettings.R deleted file mode 100644 index ececcecc..00000000 --- a/R/checkFieldSettings.R +++ /dev/null @@ -1,48 +0,0 @@ -#' Check that a setting parameter has a matching data field -#' -#' Checks that a single parameter from the settings list matches a field value in a specified data set -#' -#' This function compares settings with field values as part of the \code{validateSettings()} function. More specifically, the function checks whether the \code{fieldKey} in a \code{settings} object matches a column/field combination in \code{"data"}. The function makes 2 major assumptions about the structure of the settings object. First, it assumes that the first value in fieldKey is "settingName_values" and there is a corresponding "settingName_col" setting that defines the column to search for field-level data. Second, it expects that the value specified by key/settings is a list, and that each value in the list is a field of the variable above. -#' -#' @param fieldKey a list (like those provided by \code{getSettingKeys())} defining the position of parameter in the settings object. -#' @param settings The settings list used to generate a chart like \code{eDISH()} -#' @param data A data frame to check for the specified field -#' @return A list containing the results of the check following the format specified in \code{validateSettings()[["checkList"]]} -#' -#' -#' @examples -#' testSettings<-generateSettings(standard="AdAM") -#' fields<-list("measure_values","TB") -#' safetyGraphics:::checkField(fieldKey=fields,settings=testSettings, data=adlbc) -#' -#' @importFrom stringr str_split -#' @importFrom magrittr "%>%" -#' @importFrom purrr map -#' @keywords internal - -checkField<- function(fieldKey, settings, data){ - stopifnot(typeof(fieldKey)=="list", typeof(settings)=="list") - - # Check to see that the field data specified in the seetings is found in the data - fieldCheck <- list() - fieldCheck$key<-fieldKey - fieldCheck$text_key<- paste( unlist(fieldKey), collapse='--') - fieldCheck$type <- "field" - fieldCheck$description <- "field value from setting found in data" - fieldCheck$value <- getSettingValue(key=fieldCheck$key,settings=settings) - - #get the name of the column containing the field - columnTextKey<-getSettingsMetadata(cols="field_column_key",text_keys=fieldCheck$text_key) - columnKey<-textKeysToList(columnTextKey)[[1]] - columnName<-getSettingValue(key=columnKey,settings=settings) - - if(length(fieldCheck$value)>0){ - fieldCheck$valid <- hasField(fieldValue=fieldCheck$value, columnName=columnName,data=data) - }else{ - fieldCheck$value <- "--No Value Given--" - fieldCheck$valid <- TRUE #null values are ok - } - fieldCheck$message <- ifelse(!fieldCheck$valid, paste0("Value of ",fieldCheck$value, " for '",fieldCheck$text_key,"' not found in ",columnName),"") - - return(fieldCheck) -} diff --git a/R/safetyGraphicsApp.R b/R/safetyGraphicsApp.R index d9ea71c0..4b29d35b 100644 --- a/R/safetyGraphicsApp.R +++ b/R/safetyGraphicsApp.R @@ -1,5 +1,7 @@ #' Run the interactive safety graphics builder #' +#' @param maxFileSize maximum file size in MB allowed for file upload. +#' #' @importFrom shiny runApp #' @import shinyjs #' @import dplyr @@ -10,7 +12,10 @@ #' #' @export #' -safetyGraphicsApp <- function() { +safetyGraphicsApp <- function(maxFileSize = 20) { + #increase maximum file upload limit + options(shiny.maxRequestSize=(maxFileSize*1024^2)) + path <- system.file("eDISH_app", package = "safetyGraphics") shiny::runApp(path, launch.browser = TRUE) } diff --git a/R/trimData.R b/R/trimData.R new file mode 100644 index 00000000..f50fe288 --- /dev/null +++ b/R/trimData.R @@ -0,0 +1,80 @@ +#' Removes unnecessary rows and columns +#' +#' Removes unnecessary rows and columns from data based on current settings +#' +#' @param data a data frame to trim +#' @param settings the settings list used to determine which rows and columns to drop +#' @param chart the chart being created +#' @return A dataframe with unnecessary columns and rows removed +#' +#' @examples +#' testSettings <- generateSettings(standard="adam") +#' trimmed<-safetyGraphics:::trimData(data=adlbc, settings=testSettings) +#' +#' @importFrom dplyr filter +#' @importFrom purrr map +#' @importFrom rlang parse_expr .data +#' +#' @keywords internal + + +trimData <- function(data, settings, chart="edish"){ + + ## Remove columns not in settings ## + col_names <- colnames(data) + + allKeys <- getSettingsMetadata(charts=chart, filter_expr = .data$column_mapping, cols = c("text_key","setting_type")) + dataKeys <- allKeys %>% filter(.data$setting_type !="vector") %>% pull(.data$text_key) %>% textKeysToList() + + # Add items in vectors to list individually + dataVectorKeys <- allKeys %>% filter(.data$setting_type =="vector") %>% pull(.data$text_key) %>% textKeysToList() + for(key in dataVectorKeys){ + current<-getSettingValue(key, settings=settings) + if (length(current) > 0 ) { + for (i in 1:length(current)){ + newKey <- key + newKey[[1+length(newKey)]]<-i + sub <- current[[i]] + if(typeof(sub)=="list"){ + newKey[[1+length(newKey)]]<-"value_col" + } + dataKeys[[1+length(dataKeys)]]<-newKey + } + } + } + + settings_values <- map(dataKeys, function(x) {return(getSettingValue(x, settings))}) + + common_cols <- intersect(col_names,settings_values) + + data_subset <- select(data, unlist(common_cols)) + + ## Remove rows if baseline or analysisFlag is specified ## + + if(!is.null(settings[['baseline']][['value_col']]) | !is.null(settings[['analysisFlag']][['value_col']])) { + + # Create Baseline String + baseline_string <- ifelse(!is.null(settings[['baseline']][['value_col']]), + paste(settings[['baseline']][['value_col']], "%in% settings[['baseline']][['values']]"), + "") + + # Create AnalysisFlag String + analysis_string <- ifelse(!is.null(settings[['analysisFlag']][['value_col']]), + paste(settings[['analysisFlag']][['value_col']], "%in% settings[['analysisFlag']][['values']]"), + "") + + # Include OR operator if both are specified + operator <- ifelse(!is.null(settings[['baseline']][['value_col']]) & !is.null(settings[['analysisFlag']][['value_col']]), + "|","") + + # Create filter string and make it an expression + filter_string <- paste(baseline_string, operator, analysis_string) + filter_expression <- parse_expr(filter_string) + + #Filter on baseline and analysisFlag + data_subset <- filter(data_subset, !!filter_expression) + + } + + return(data_subset) +} diff --git a/R/validateSettings.R b/R/validateSettings.R index fd5af710..59b982e5 100644 --- a/R/validateSettings.R +++ b/R/validateSettings.R @@ -39,24 +39,53 @@ validateSettings <- function(data, settings, chart="eDish"){ - + settingStatus<-list() - + # Check that all required parameters are not null requiredChecks <- getRequiredSettings(chart = chart) %>% purrr::map(checkRequired, settings = settings) - + #Check that non-null setting columns are found in the data - dataKeys <- getSettingsMetadata(charts=chart, filter_expr = .data$column_mapping, cols = "text_key")%>%textKeysToList() + allKeys <- getSettingsMetadata(charts=chart, filter_expr = .data$column_mapping, cols = c("text_key","setting_type")) + dataKeys <- allKeys %>% filter(.data$setting_type !="vector") %>% pull(.data$text_key) %>% textKeysToList() + + # Add items in vectors to list individually + dataVectorKeys <- allKeys %>% filter(.data$setting_type =="vector") %>% pull(.data$text_key) %>% textKeysToList() + for(key in dataVectorKeys){ + current<-getSettingValue(key, settings=settings) + if (length(current) > 0 ) { + for (i in 1:length(current)){ + newKey <- key + newKey[[1+length(newKey)]]<-i + sub <- current[[i]] + if(typeof(sub)=="list"){ + newKey[[1+length(newKey)]]<-"value_col" + } + dataKeys[[1+length(dataKeys)]]<-newKey + } + } + } + columnChecks <- dataKeys %>% purrr::map(checkColumn, settings=settings, data=data) #Check that non-null field/column combinations are found in the data - fieldKeys <- getSettingsMetadata(charts=chart, filter_expr = .data$field_mapping)%>% - filter(.data$setting_type!="vector")%>% #TODO: check the vectorized fields as well. Not sure a big deal now, since none are required ... - select(.data$text_key)%>% - unlist()%>% - textKeysToList() + allKeys <- getSettingsMetadata(charts=chart, filter_expr = .data$field_mapping, cols = c("text_key","setting_type")) + fieldKeys <- allKeys %>% filter(.data$setting_type!="vector")%>% pull(.data$text_key)%>%textKeysToList() + + #Add items in vectors to list individually + fieldVectorKeys <- allKeys %>% filter(.data$setting_type=="vector")%>% pull(.data$text_key)%>%textKeysToList() + for(key in fieldVectorKeys){ + current<-getSettingValue(key, settings=settings) + if (length(current) > 0 ) { + for (i in 1:length(current)){ + newKey <- key + newKey[[1+length(newKey)]]<-i + fieldKeys[[1+length(fieldKeys)]]<-newKey + } + } + } fieldChecks <- fieldKeys %>% purrr::map(checkField, settings=settings, data=data ) - + #Check that settings for mapping numeric data are associated with numeric columns numericKeys <- getSettingsMetadata(charts=chart, filter_expr=.data$column_type=="numeric", cols="text_key")%>%textKeysToList() numericChecks <- numericKeys %>% purrr::map(checkNumeric, settings=settings, data=data ) @@ -76,10 +105,10 @@ validateSettings <- function(data, settings, chart="eDish"){ #valid=true if all checks pass, false otherwise settingStatus$valid <- settingStatus$checks%>%select(.data$valid)%>%unlist%>%all - + #create summary string failCount <- nrow(settingStatus$checks%>%filter(!.data$valid)) checkCount <- nrow(settingStatus$checks) settingStatus$status <- paste0(failCount," of ",checkCount," checks failed.") return (settingStatus) -} +} \ No newline at end of file diff --git a/inst/eDISH_app/modules/dataUpload/dataUpload.R b/inst/eDISH_app/modules/dataUpload/dataUpload.R index ed090d86..57f4de9c 100644 --- a/inst/eDISH_app/modules/dataUpload/dataUpload.R +++ b/inst/eDISH_app/modules/dataUpload/dataUpload.R @@ -2,7 +2,6 @@ dataUpload <- function(input, output, session){ ns <- session$ns - # initiate reactive values - list of uploaded data files # standard to imitate output of detectStandard.R dd <- reactiveValues(data = list("Example data" = adlbc), current = 1, standard = list(list("standard" = "ADaM", "details" = list("ADaM"=list("match"="Full"))))) diff --git a/inst/eDISH_app/modules/renderChart/eDishReport/eDishReport.Rmd b/inst/eDISH_app/modules/renderChart/eDishReport/eDishReport.Rmd index 7ebfcedf..f3202e56 100644 --- a/inst/eDISH_app/modules/renderChart/eDishReport/eDishReport.Rmd +++ b/inst/eDISH_app/modules/renderChart/eDishReport/eDishReport.Rmd @@ -33,9 +33,11 @@ safetyGraphics is an open source project built using standard web technology and #### Code to Reproduce Chart -Use the script below to (1) load your data and (2) render the chart. Make sure to update the first line to point at your data. +Use the script below to (1) load the safetyGraphics package, (2) load your data and (3) render the chart. Make sure to update the second line to point at your data. ```{r, comment=NA, echo=FALSE} +lib_code <- quote(library(safetyGraphics)) +lib_code writeLines("path <- 'path_to_data'") ### <-- Update this! writeLines("my_data <- read.csv(file.path(path, 'data.csv'))") diff --git a/inst/eDISH_app/modules/renderChart/renderEDishChart.R b/inst/eDISH_app/modules/renderChart/renderEDishChart.R index e0b1fd03..15470cca 100644 --- a/inst/eDISH_app/modules/renderChart/renderEDishChart.R +++ b/inst/eDISH_app/modules/renderChart/renderEDishChart.R @@ -8,7 +8,8 @@ renderEDishChart <- function(input, output, session, data, settings, valid){ req(settings()) if (valid()==TRUE){ - eDISH(data = data(), settings = settings()) + trimmed_data <- safetyGraphics:::trimData(data = data(), settings = settings()) + eDISH(data = trimmed_data, settings = settings()) } else{ return() } diff --git a/inst/eDISH_app/modules/renderSettings/renderSettings.R b/inst/eDISH_app/modules/renderSettings/renderSettings.R index 3c6aa6d9..41e62c3f 100644 --- a/inst/eDISH_app/modules/renderSettings/renderSettings.R +++ b/inst/eDISH_app/modules/renderSettings/renderSettings.R @@ -213,7 +213,7 @@ renderSettings <- function(input, output, session, data, settings, status){ } if (! is.null(input$`analysisFlag--values`)){ - if (! input$`analysisFlag--values`==""){ + if (! input$`analysisFlag--values`[1]==""){ settings$analysisFlag <- list(value_col = input$`analysisFlag--value_col`, values = input$`analysisFlag--values`) } diff --git a/inst/eDISH_app/tests/defaultPath-expected/002.json b/inst/eDISH_app/tests/defaultPath-expected/002.json index 536a9bb0..df17ccdc 100644 --- a/inst/eDISH_app/tests/defaultPath-expected/002.json +++ b/inst/eDISH_app/tests/defaultPath-expected/002.json @@ -1,276 +1,313 @@ { "export": { "datatab-status": { - "checkList": [ - { - "key": [ + "checks": { + "key": [ + [ "id_col" ], - "text_key": "id_col", - "check": "value for specified key found in settings?", - "value": "USUBJID", - "valid": true, - "message": "" - }, - { - "key": [ + [ "value_col" ], - "text_key": "value_col", - "check": "value for specified key found in settings?", - "value": "AVAL", - "valid": true, - "message": "" - }, - { - "key": [ + [ "measure_col" ], - "text_key": "measure_col", - "check": "value for specified key found in settings?", - "value": "PARAM", - "valid": true, - "message": "" - }, - { - "key": [ + [ "normal_col_low" ], - "text_key": "normal_col_low", - "check": "value for specified key found in settings?", - "value": "A1LO", - "valid": true, - "message": "" - }, - { - "key": [ + [ "normal_col_high" ], - "text_key": "normal_col_high", - "check": "value for specified key found in settings?", - "value": "A1HI", - "valid": true, - "message": "" - }, - { - "key": [ + [ "studyday_col" ], - "text_key": "studyday_col", - "check": "value for specified key found in settings?", - "value": "ADY", - "valid": true, - "message": "" - }, - { - "key": [ + [ + "measure_values", + "ALT" + ], + [ + "measure_values", + "AST" + ], + [ + "measure_values", + "TB" + ], + [ + "measure_values", + "ALP" + ], + [ "id_col" ], - "text_key": "id_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "USUBJID", - "valid": true, - "message": "" - }, - { - "key": [ + [ "value_col" ], - "text_key": "value_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "AVAL", - "valid": true, - "message": "" - }, - { - "key": [ + [ "measure_col" ], - "text_key": "measure_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "PARAM", - "valid": true, - "message": "" - }, - { - "key": [ + [ "normal_col_low" ], - "text_key": "normal_col_low", - "check": "'_col' parameter from setting setting found in data?", - "value": "A1LO", - "valid": true, - "message": "" - }, - { - "key": [ + [ "normal_col_high" ], - "text_key": "normal_col_high", - "check": "'_col' parameter from setting setting found in data?", - "value": "A1HI", - "valid": true, - "message": "" - }, - { - "key": [ + [ "studyday_col" ], - "text_key": "studyday_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "ADY", - "valid": true, - "message": "" - }, - { - "key": [ + [ "visit_col" ], - "text_key": "visit_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "VISIT", - "valid": true, - "message": "" - }, - { - "key": [ + [ "visitn_col" ], - "text_key": "visitn_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "VISITNUM", - "valid": true, - "message": "" - }, - { - "key": [ + [ + "filters" + ], + [ "group_cols" ], - "text_key": "group_cols", - "check": "'_col' parameter from setting setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "baseline", "value_col" ], - "text_key": "baseline--value_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "analysisFlag", "value_col" ], - "text_key": "analysisFlag--value_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "measure_values", "ALT" ], - "text_key": "measure_values--ALT", - "check": "'_values' field from setting found in data?", - "value": "Alanine Aminotransferase (U/L)", - "valid": true, - "message": "" - }, - { - "key": [ + [ "measure_values", "AST" ], - "text_key": "measure_values--AST", - "check": "'_values' field from setting found in data?", - "value": "Aspartate Aminotransferase (U/L)", - "valid": true, - "message": "" - }, - { - "key": [ + [ "measure_values", "TB" ], - "text_key": "measure_values--TB", - "check": "'_values' field from setting found in data?", - "value": "Bilirubin (umol/L)", - "valid": true, - "message": "" - }, - { - "key": [ + [ "measure_values", "ALP" ], - "text_key": "measure_values--ALP", - "check": "'_values' field from setting found in data?", - "value": "Alkaline Phosphatase (U/L)", - "valid": true, - "message": "" - }, - { - "key": [ + [ "value_col" ], - "text_key": "value_col", - "check": "specified column is numeric?", - "value": "AVAL", - "valid": true, - "message": "9 of 10288 values were not numeric. Records with non-numeric values may not appear in the graphic." - }, - { - "key": [ + [ "normal_col_low" ], - "text_key": "normal_col_low", - "check": "specified column is numeric?", - "value": "A1LO", - "valid": true, - "message": "0 of 10288 values were not numeric." - }, - { - "key": [ + [ "normal_col_high" ], - "text_key": "normal_col_high", - "check": "specified column is numeric?", - "value": "A1HI", - "valid": true, - "message": "0 of 10288 values were not numeric." - }, - { - "key": [ + [ "studyday_col" ], - "text_key": "studyday_col", - "check": "specified column is numeric?", - "value": "ADY", - "valid": true, - "message": "0 of 10288 values were not numeric." - }, - { - "key": [ + [ "visitn_col" - ], - "text_key": "visitn_col", - "check": "specified column is numeric?", - "value": "VISITNUM", - "valid": true, - "message": "0 of 10288 values were not numeric." - } - ], + ] + ], + "text_key": [ + "id_col", + "value_col", + "measure_col", + "normal_col_low", + "normal_col_high", + "studyday_col", + "measure_values--ALT", + "measure_values--AST", + "measure_values--TB", + "measure_values--ALP", + "id_col", + "value_col", + "measure_col", + "normal_col_low", + "normal_col_high", + "studyday_col", + "visit_col", + "visitn_col", + "filters", + "group_cols", + "baseline--value_col", + "analysisFlag--value_col", + "measure_values--ALT", + "measure_values--AST", + "measure_values--TB", + "measure_values--ALP", + "value_col", + "normal_col_low", + "normal_col_high", + "studyday_col", + "visitn_col" + ], + "type": [ + "required", + "required", + "required", + "required", + "required", + "required", + "required", + "required", + "required", + "required", + "column", + "column", + "column", + "column", + "column", + "column", + "column", + "column", + "column", + "column", + "column", + "column", + "field", + "field", + "field", + "field", + "numeric", + "numeric", + "numeric", + "numeric", + "numeric" + ], + "description": [ + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "field value from setting found in data", + "field value from setting found in data", + "field value from setting found in data", + "field value from setting found in data", + "specified column is numeric?", + "specified column is numeric?", + "specified column is numeric?", + "specified column is numeric?", + "specified column is numeric?" + ], + "value": [ + "USUBJID", + "AVAL", + "PARAM", + "A1LO", + "A1HI", + "ADY", + "Alanine Aminotransferase (U/L)", + "Aspartate Aminotransferase (U/L)", + "Bilirubin (umol/L)", + "Alkaline Phosphatase (U/L)", + "USUBJID", + "AVAL", + "PARAM", + "A1LO", + "A1HI", + "ADY", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "Alanine Aminotransferase (U/L)", + "Aspartate Aminotransferase (U/L)", + "Bilirubin (umol/L)", + "Alkaline Phosphatase (U/L)", + "AVAL", + "A1LO", + "A1HI", + "ADY", + "--No Value Given--" + ], + "valid": [ + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true + ], + "message": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "9 of 10288 values were not numeric. Records with non-numeric values may not appear in the graphic.", + "0 of 10288 values were not numeric.", + "0 of 10288 values were not numeric.", + "0 of 10288 values were not numeric.", + "" + ] + }, "valid": true, - "status": "0 of 26 checks failed." + "status": "0 of 31 checks failed." }, "settingsUI-status_df": { "text_key": [ @@ -280,12 +317,16 @@ "normal_col_low", "normal_col_high", "studyday_col", - "visit_col", - "visitn_col", "measure_values--ALT", "measure_values--AST", "measure_values--TB", - "measure_values--ALP" + "measure_values--ALP", + "visit_col", + "visitn_col", + "filters", + "group_cols", + "baseline--value_col", + "analysisFlag--value_col" ], "message_long": [ "", @@ -295,7 +336,11 @@ "0 of 10288 values were not numeric.", "0 of 10288 values were not numeric.", "", - "0 of 10288 values were not numeric.", + "", + "", + "", + "", + "", "", "", "", @@ -313,6 +358,10 @@ "OK", "OK", "OK", + "OK", + "OK", + "OK", + "OK", "OK" ], "num_fail": [ @@ -327,6 +376,10 @@ 0, 0, 0, + 0, + 0, + 0, + 0, 0 ] } diff --git a/inst/eDISH_app/tests/defaultPath-expected/002.png b/inst/eDISH_app/tests/defaultPath-expected/002.png index 72f793b8..236766f0 100644 Binary files a/inst/eDISH_app/tests/defaultPath-expected/002.png and b/inst/eDISH_app/tests/defaultPath-expected/002.png differ diff --git a/inst/eDISH_app/tests/fullSDTM-expected/003.json b/inst/eDISH_app/tests/fullSDTM-expected/003.json index 3a896aae..bd844f9b 100644 --- a/inst/eDISH_app/tests/fullSDTM-expected/003.json +++ b/inst/eDISH_app/tests/fullSDTM-expected/003.json @@ -1,276 +1,313 @@ { "export": { "datatab-status": { - "checkList": [ - { - "key": [ + "checks": { + "key": [ + [ "id_col" ], - "text_key": "id_col", - "check": "value for specified key found in settings?", - "value": "USUBJID", - "valid": true, - "message": "" - }, - { - "key": [ + [ "value_col" ], - "text_key": "value_col", - "check": "value for specified key found in settings?", - "value": "STRESN", - "valid": true, - "message": "" - }, - { - "key": [ + [ "measure_col" ], - "text_key": "measure_col", - "check": "value for specified key found in settings?", - "value": "TEST", - "valid": true, - "message": "" - }, - { - "key": [ + [ "normal_col_low" ], - "text_key": "normal_col_low", - "check": "value for specified key found in settings?", - "value": "STNRLO", - "valid": true, - "message": "" - }, - { - "key": [ + [ "normal_col_high" ], - "text_key": "normal_col_high", - "check": "value for specified key found in settings?", - "value": "STNRHI", - "valid": true, - "message": "" - }, - { - "key": [ + [ "studyday_col" ], - "text_key": "studyday_col", - "check": "value for specified key found in settings?", - "value": "DY", - "valid": true, - "message": "" - }, - { - "key": [ + [ + "measure_values", + "ALT" + ], + [ + "measure_values", + "AST" + ], + [ + "measure_values", + "TB" + ], + [ + "measure_values", + "ALP" + ], + [ "id_col" ], - "text_key": "id_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "USUBJID", - "valid": true, - "message": "" - }, - { - "key": [ + [ "value_col" ], - "text_key": "value_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "STRESN", - "valid": true, - "message": "" - }, - { - "key": [ + [ "measure_col" ], - "text_key": "measure_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "TEST", - "valid": true, - "message": "" - }, - { - "key": [ + [ "normal_col_low" ], - "text_key": "normal_col_low", - "check": "'_col' parameter from setting setting found in data?", - "value": "STNRLO", - "valid": true, - "message": "" - }, - { - "key": [ + [ "normal_col_high" ], - "text_key": "normal_col_high", - "check": "'_col' parameter from setting setting found in data?", - "value": "STNRHI", - "valid": true, - "message": "" - }, - { - "key": [ + [ "studyday_col" ], - "text_key": "studyday_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "DY", - "valid": true, - "message": "" - }, - { - "key": [ + [ "visit_col" ], - "text_key": "visit_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "VISIT", - "valid": true, - "message": "" - }, - { - "key": [ + [ "visitn_col" ], - "text_key": "visitn_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "VISITNUM", - "valid": true, - "message": "" - }, - { - "key": [ + [ + "filters" + ], + [ "group_cols" ], - "text_key": "group_cols", - "check": "'_col' parameter from setting setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "baseline", "value_col" ], - "text_key": "baseline--value_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "analysisFlag", "value_col" ], - "text_key": "analysisFlag--value_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "measure_values", "ALT" ], - "text_key": "measure_values--ALT", - "check": "'_values' field from setting found in data?", - "value": "Aminotransferase, alanine (ALT)", - "valid": true, - "message": "" - }, - { - "key": [ + [ "measure_values", "AST" ], - "text_key": "measure_values--AST", - "check": "'_values' field from setting found in data?", - "value": "Aminotransferase, aspartate (AST)", - "valid": true, - "message": "" - }, - { - "key": [ + [ "measure_values", "TB" ], - "text_key": "measure_values--TB", - "check": "'_values' field from setting found in data?", - "value": "Total Bilirubin", - "valid": true, - "message": "" - }, - { - "key": [ + [ "measure_values", "ALP" ], - "text_key": "measure_values--ALP", - "check": "'_values' field from setting found in data?", - "value": "Alkaline phosphatase (ALP)", - "valid": true, - "message": "" - }, - { - "key": [ + [ "value_col" ], - "text_key": "value_col", - "check": "specified column is numeric?", - "value": "STRESN", - "valid": true, - "message": "2592 of 24669 values were not numeric. Records with non-numeric values may not appear in the graphic." - }, - { - "key": [ + [ "normal_col_low" ], - "text_key": "normal_col_low", - "check": "specified column is numeric?", - "value": "STNRLO", - "valid": true, - "message": "15 of 24669 values were not numeric. Records with non-numeric values may not appear in the graphic." - }, - { - "key": [ + [ "normal_col_high" ], - "text_key": "normal_col_high", - "check": "specified column is numeric?", - "value": "STNRHI", - "valid": true, - "message": "15 of 24669 values were not numeric. Records with non-numeric values may not appear in the graphic." - }, - { - "key": [ + [ "studyday_col" ], - "text_key": "studyday_col", - "check": "specified column is numeric?", - "value": "DY", - "valid": true, - "message": "15 of 24669 values were not numeric. Records with non-numeric values may not appear in the graphic." - }, - { - "key": [ + [ "visitn_col" - ], - "text_key": "visitn_col", - "check": "specified column is numeric?", - "value": "VISITNUM", - "valid": true, - "message": "15 of 24669 values were not numeric. Records with non-numeric values may not appear in the graphic." - } - ], + ] + ], + "text_key": [ + "id_col", + "value_col", + "measure_col", + "normal_col_low", + "normal_col_high", + "studyday_col", + "measure_values--ALT", + "measure_values--AST", + "measure_values--TB", + "measure_values--ALP", + "id_col", + "value_col", + "measure_col", + "normal_col_low", + "normal_col_high", + "studyday_col", + "visit_col", + "visitn_col", + "filters", + "group_cols", + "baseline--value_col", + "analysisFlag--value_col", + "measure_values--ALT", + "measure_values--AST", + "measure_values--TB", + "measure_values--ALP", + "value_col", + "normal_col_low", + "normal_col_high", + "studyday_col", + "visitn_col" + ], + "type": [ + "required", + "required", + "required", + "required", + "required", + "required", + "required", + "required", + "required", + "required", + "column", + "column", + "column", + "column", + "column", + "column", + "column", + "column", + "column", + "column", + "column", + "column", + "field", + "field", + "field", + "field", + "numeric", + "numeric", + "numeric", + "numeric", + "numeric" + ], + "description": [ + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "field value from setting found in data", + "field value from setting found in data", + "field value from setting found in data", + "field value from setting found in data", + "specified column is numeric?", + "specified column is numeric?", + "specified column is numeric?", + "specified column is numeric?", + "specified column is numeric?" + ], + "value": [ + "USUBJID", + "STRESN", + "TEST", + "STNRLO", + "STNRHI", + "DY", + "Aminotransferase, alanine (ALT)", + "Aminotransferase, aspartate (AST)", + "Total Bilirubin", + "Alkaline phosphatase (ALP)", + "USUBJID", + "STRESN", + "TEST", + "STNRLO", + "STNRHI", + "DY", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "Aminotransferase, alanine (ALT)", + "Aminotransferase, aspartate (AST)", + "Total Bilirubin", + "Alkaline phosphatase (ALP)", + "STRESN", + "STNRLO", + "STNRHI", + "DY", + "--No Value Given--" + ], + "valid": [ + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true + ], + "message": [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "2592 of 24669 values were not numeric. Records with non-numeric values may not appear in the graphic.", + "15 of 24669 values were not numeric. Records with non-numeric values may not appear in the graphic.", + "15 of 24669 values were not numeric. Records with non-numeric values may not appear in the graphic.", + "15 of 24669 values were not numeric. Records with non-numeric values may not appear in the graphic.", + "" + ] + }, "valid": true, - "status": "0 of 26 checks failed." + "status": "0 of 31 checks failed." }, "settingsUI-status_df": { "text_key": [ @@ -280,12 +317,16 @@ "normal_col_low", "normal_col_high", "studyday_col", - "visit_col", - "visitn_col", "measure_values--ALT", "measure_values--AST", "measure_values--TB", - "measure_values--ALP" + "measure_values--ALP", + "visit_col", + "visitn_col", + "filters", + "group_cols", + "baseline--value_col", + "analysisFlag--value_col" ], "message_long": [ "", @@ -295,7 +336,11 @@ "15 of 24669 values were not numeric. Records with non-numeric values may not appear in the graphic.", "15 of 24669 values were not numeric. Records with non-numeric values may not appear in the graphic.", "", - "15 of 24669 values were not numeric. Records with non-numeric values may not appear in the graphic.", + "", + "", + "", + "", + "", "", "", "", @@ -313,6 +358,10 @@ "OK", "OK", "OK", + "OK", + "OK", + "OK", + "OK", "OK" ], "num_fail": [ @@ -327,6 +376,10 @@ 0, 0, 0, + 0, + 0, + 0, + 0, 0 ] } diff --git a/inst/eDISH_app/tests/fullSDTM-expected/003.png b/inst/eDISH_app/tests/fullSDTM-expected/003.png index 6716c14c..a4bb7b86 100644 Binary files a/inst/eDISH_app/tests/fullSDTM-expected/003.png and b/inst/eDISH_app/tests/fullSDTM-expected/003.png differ diff --git a/inst/eDISH_app/tests/noStandard-expected/003.json b/inst/eDISH_app/tests/noStandard-expected/003.json index 0c92d1aa..cdbede1b 100644 --- a/inst/eDISH_app/tests/noStandard-expected/003.json +++ b/inst/eDISH_app/tests/noStandard-expected/003.json @@ -1,276 +1,313 @@ { "export": { "datatab-status": { - "checkList": [ - { - "key": [ + "checks": { + "key": [ + [ "id_col" ], - "text_key": "id_col", - "check": "value for specified key found in settings?", - "value": "--No Value Given--", - "valid": false, - "message": "id_col not specified in settings." - }, - { - "key": [ + [ "value_col" ], - "text_key": "value_col", - "check": "value for specified key found in settings?", - "value": "--No Value Given--", - "valid": false, - "message": "value_col not specified in settings." - }, - { - "key": [ + [ "measure_col" ], - "text_key": "measure_col", - "check": "value for specified key found in settings?", - "value": "--No Value Given--", - "valid": false, - "message": "measure_col not specified in settings." - }, - { - "key": [ + [ "normal_col_low" ], - "text_key": "normal_col_low", - "check": "value for specified key found in settings?", - "value": "--No Value Given--", - "valid": false, - "message": "normal_col_low not specified in settings." - }, - { - "key": [ + [ "normal_col_high" ], - "text_key": "normal_col_high", - "check": "value for specified key found in settings?", - "value": "--No Value Given--", - "valid": false, - "message": "normal_col_high not specified in settings." - }, - { - "key": [ + [ "studyday_col" ], - "text_key": "studyday_col", - "check": "value for specified key found in settings?", - "value": "--No Value Given--", - "valid": false, - "message": "studyday_col not specified in settings." - }, - { - "key": [ + [ + "measure_values", + "ALT" + ], + [ + "measure_values", + "AST" + ], + [ + "measure_values", + "TB" + ], + [ + "measure_values", + "ALP" + ], + [ "id_col" ], - "text_key": "id_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "value_col" ], - "text_key": "value_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "measure_col" ], - "text_key": "measure_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "normal_col_low" ], - "text_key": "normal_col_low", - "check": "'_col' parameter from setting setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "normal_col_high" ], - "text_key": "normal_col_high", - "check": "'_col' parameter from setting setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "studyday_col" ], - "text_key": "studyday_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "visit_col" ], - "text_key": "visit_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "visitn_col" ], - "text_key": "visitn_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ + "filters" + ], + [ "group_cols" ], - "text_key": "group_cols", - "check": "'_col' parameter from setting setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "baseline", "value_col" ], - "text_key": "baseline--value_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "analysisFlag", "value_col" ], - "text_key": "analysisFlag--value_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "measure_values", "ALT" ], - "text_key": "measure_values--ALT", - "check": "'_values' field from setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "measure_values", "AST" ], - "text_key": "measure_values--AST", - "check": "'_values' field from setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "measure_values", "TB" ], - "text_key": "measure_values--TB", - "check": "'_values' field from setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "measure_values", "ALP" ], - "text_key": "measure_values--ALP", - "check": "'_values' field from setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "value_col" ], - "text_key": "value_col", - "check": "specified column is numeric?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "normal_col_low" ], - "text_key": "normal_col_low", - "check": "specified column is numeric?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "normal_col_high" ], - "text_key": "normal_col_high", - "check": "specified column is numeric?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "studyday_col" ], - "text_key": "studyday_col", - "check": "specified column is numeric?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "visitn_col" - ], - "text_key": "visitn_col", - "check": "specified column is numeric?", - "value": "--No Value Given--", - "valid": true, - "message": "" - } - ], + ] + ], + "text_key": [ + "id_col", + "value_col", + "measure_col", + "normal_col_low", + "normal_col_high", + "studyday_col", + "measure_values--ALT", + "measure_values--AST", + "measure_values--TB", + "measure_values--ALP", + "id_col", + "value_col", + "measure_col", + "normal_col_low", + "normal_col_high", + "studyday_col", + "visit_col", + "visitn_col", + "filters", + "group_cols", + "baseline--value_col", + "analysisFlag--value_col", + "measure_values--ALT", + "measure_values--AST", + "measure_values--TB", + "measure_values--ALP", + "value_col", + "normal_col_low", + "normal_col_high", + "studyday_col", + "visitn_col" + ], + "type": [ + "required", + "required", + "required", + "required", + "required", + "required", + "required", + "required", + "required", + "required", + "column", + "column", + "column", + "column", + "column", + "column", + "column", + "column", + "column", + "column", + "column", + "column", + "field", + "field", + "field", + "field", + "numeric", + "numeric", + "numeric", + "numeric", + "numeric" + ], + "description": [ + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "field value from setting found in data", + "field value from setting found in data", + "field value from setting found in data", + "field value from setting found in data", + "specified column is numeric?", + "specified column is numeric?", + "specified column is numeric?", + "specified column is numeric?", + "specified column is numeric?" + ], + "value": [ + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--" + ], + "valid": [ + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true + ], + "message": [ + "id_col not specified in settings.", + "value_col not specified in settings.", + "measure_col not specified in settings.", + "normal_col_low not specified in settings.", + "normal_col_high not specified in settings.", + "studyday_col not specified in settings.", + "measure_values--ALT not specified in settings.", + "measure_values--AST not specified in settings.", + "measure_values--TB not specified in settings.", + "measure_values--ALP not specified in settings.", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + }, "valid": false, - "status": "6 of 26 checks failed." + "status": "10 of 31 checks failed." }, "settingsUI-status_df": { "text_key": [ @@ -280,9 +317,16 @@ "normal_col_low", "normal_col_high", "studyday_col", + "measure_values--ALT", + "measure_values--AST", + "measure_values--TB", + "measure_values--ALP", "visit_col", "visitn_col", - "measure_values" + "filters", + "group_cols", + "baseline--value_col", + "analysisFlag--value_col" ], "message_long": [ "id_col not specified in settings.", @@ -291,9 +335,16 @@ "normal_col_low not specified in settings.", "normal_col_high not specified in settings.", "studyday_col not specified in settings.", + "measure_values--ALT not specified in settings.", + "measure_values--AST not specified in settings.", + "measure_values--TB not specified in settings.", + "measure_values--ALP not specified in settings.", + "", "", "", - "No list of values found in settings." + "", + "", + "" ], "message_short": [ "1 failed check.", @@ -302,9 +353,16 @@ "1 failed check.", "1 failed check.", "1 failed check.", + "1 failed check.", + "1 failed check.", + "1 failed check.", + "1 failed check.", + "OK", + "OK", "OK", "OK", - "1 failed check." + "OK", + "OK" ], "num_fail": [ 1, @@ -313,9 +371,16 @@ 1, 1, 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, 0, 0, - 1 + 0 ] } } diff --git a/inst/eDISH_app/tests/noStandard-expected/003.png b/inst/eDISH_app/tests/noStandard-expected/003.png index f80c43ad..efd59ed9 100644 Binary files a/inst/eDISH_app/tests/noStandard-expected/003.png and b/inst/eDISH_app/tests/noStandard-expected/003.png differ diff --git a/inst/eDISH_app/tests/partialSDTM-expected/003.json b/inst/eDISH_app/tests/partialSDTM-expected/003.json index d3e19a03..7b652083 100644 --- a/inst/eDISH_app/tests/partialSDTM-expected/003.json +++ b/inst/eDISH_app/tests/partialSDTM-expected/003.json @@ -1,276 +1,313 @@ { "export": { "datatab-status": { - "checkList": [ - { - "key": [ + "checks": { + "key": [ + [ "id_col" ], - "text_key": "id_col", - "check": "value for specified key found in settings?", - "value": "--No Value Given--", - "valid": false, - "message": "id_col not specified in settings." - }, - { - "key": [ + [ "value_col" ], - "text_key": "value_col", - "check": "value for specified key found in settings?", - "value": "STRESN", - "valid": true, - "message": "" - }, - { - "key": [ + [ "measure_col" ], - "text_key": "measure_col", - "check": "value for specified key found in settings?", - "value": "TEST", - "valid": true, - "message": "" - }, - { - "key": [ + [ "normal_col_low" ], - "text_key": "normal_col_low", - "check": "value for specified key found in settings?", - "value": "STNRLO", - "valid": true, - "message": "" - }, - { - "key": [ + [ "normal_col_high" ], - "text_key": "normal_col_high", - "check": "value for specified key found in settings?", - "value": "STNRHI", - "valid": true, - "message": "" - }, - { - "key": [ + [ "studyday_col" ], - "text_key": "studyday_col", - "check": "value for specified key found in settings?", - "value": "DY", - "valid": true, - "message": "" - }, - { - "key": [ + [ + "measure_values", + "ALT" + ], + [ + "measure_values", + "AST" + ], + [ + "measure_values", + "TB" + ], + [ + "measure_values", + "ALP" + ], + [ "id_col" ], - "text_key": "id_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "value_col" ], - "text_key": "value_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "STRESN", - "valid": true, - "message": "" - }, - { - "key": [ + [ "measure_col" ], - "text_key": "measure_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "TEST", - "valid": true, - "message": "" - }, - { - "key": [ + [ "normal_col_low" ], - "text_key": "normal_col_low", - "check": "'_col' parameter from setting setting found in data?", - "value": "STNRLO", - "valid": true, - "message": "" - }, - { - "key": [ + [ "normal_col_high" ], - "text_key": "normal_col_high", - "check": "'_col' parameter from setting setting found in data?", - "value": "STNRHI", - "valid": true, - "message": "" - }, - { - "key": [ + [ "studyday_col" ], - "text_key": "studyday_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "DY", - "valid": true, - "message": "" - }, - { - "key": [ + [ "visit_col" ], - "text_key": "visit_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "visitn_col" ], - "text_key": "visitn_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ + "filters" + ], + [ "group_cols" ], - "text_key": "group_cols", - "check": "'_col' parameter from setting setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "baseline", "value_col" ], - "text_key": "baseline--value_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "analysisFlag", "value_col" ], - "text_key": "analysisFlag--value_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "measure_values", "ALT" ], - "text_key": "measure_values--ALT", - "check": "'_values' field from setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "measure_values", "AST" ], - "text_key": "measure_values--AST", - "check": "'_values' field from setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "measure_values", "TB" ], - "text_key": "measure_values--TB", - "check": "'_values' field from setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "measure_values", "ALP" ], - "text_key": "measure_values--ALP", - "check": "'_values' field from setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "value_col" ], - "text_key": "value_col", - "check": "specified column is numeric?", - "value": "STRESN", - "valid": true, - "message": "2592 of 24669 values were not numeric. Records with non-numeric values may not appear in the graphic." - }, - { - "key": [ + [ "normal_col_low" ], - "text_key": "normal_col_low", - "check": "specified column is numeric?", - "value": "STNRLO", - "valid": true, - "message": "15 of 24669 values were not numeric. Records with non-numeric values may not appear in the graphic." - }, - { - "key": [ + [ "normal_col_high" ], - "text_key": "normal_col_high", - "check": "specified column is numeric?", - "value": "STNRHI", - "valid": true, - "message": "15 of 24669 values were not numeric. Records with non-numeric values may not appear in the graphic." - }, - { - "key": [ + [ "studyday_col" ], - "text_key": "studyday_col", - "check": "specified column is numeric?", - "value": "DY", - "valid": true, - "message": "15 of 24669 values were not numeric. Records with non-numeric values may not appear in the graphic." - }, - { - "key": [ + [ "visitn_col" - ], - "text_key": "visitn_col", - "check": "specified column is numeric?", - "value": "--No Value Given--", - "valid": true, - "message": "" - } - ], + ] + ], + "text_key": [ + "id_col", + "value_col", + "measure_col", + "normal_col_low", + "normal_col_high", + "studyday_col", + "measure_values--ALT", + "measure_values--AST", + "measure_values--TB", + "measure_values--ALP", + "id_col", + "value_col", + "measure_col", + "normal_col_low", + "normal_col_high", + "studyday_col", + "visit_col", + "visitn_col", + "filters", + "group_cols", + "baseline--value_col", + "analysisFlag--value_col", + "measure_values--ALT", + "measure_values--AST", + "measure_values--TB", + "measure_values--ALP", + "value_col", + "normal_col_low", + "normal_col_high", + "studyday_col", + "visitn_col" + ], + "type": [ + "required", + "required", + "required", + "required", + "required", + "required", + "required", + "required", + "required", + "required", + "column", + "column", + "column", + "column", + "column", + "column", + "column", + "column", + "column", + "column", + "column", + "column", + "field", + "field", + "field", + "field", + "numeric", + "numeric", + "numeric", + "numeric", + "numeric" + ], + "description": [ + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "field value from setting found in data", + "field value from setting found in data", + "field value from setting found in data", + "field value from setting found in data", + "specified column is numeric?", + "specified column is numeric?", + "specified column is numeric?", + "specified column is numeric?", + "specified column is numeric?" + ], + "value": [ + "--No Value Given--", + "STRESN", + "TEST", + "STNRLO", + "STNRHI", + "DY", + "Aminotransferase, alanine (ALT)", + "Aminotransferase, aspartate (AST)", + "Total Bilirubin", + "Alkaline phosphatase (ALP)", + "--No Value Given--", + "STRESN", + "TEST", + "STNRLO", + "STNRHI", + "DY", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "Aminotransferase, alanine (ALT)", + "Aminotransferase, aspartate (AST)", + "Total Bilirubin", + "Alkaline phosphatase (ALP)", + "STRESN", + "STNRLO", + "STNRHI", + "DY", + "--No Value Given--" + ], + "valid": [ + false, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true + ], + "message": [ + "id_col not specified in settings.", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "2592 of 24669 values were not numeric. Records with non-numeric values may not appear in the graphic.", + "15 of 24669 values were not numeric. Records with non-numeric values may not appear in the graphic.", + "15 of 24669 values were not numeric. Records with non-numeric values may not appear in the graphic.", + "15 of 24669 values were not numeric. Records with non-numeric values may not appear in the graphic.", + "" + ] + }, "valid": false, - "status": "1 of 26 checks failed." + "status": "1 of 31 checks failed." }, "settingsUI-status_df": { "text_key": [ @@ -280,12 +317,16 @@ "normal_col_low", "normal_col_high", "studyday_col", - "visit_col", - "visitn_col", "measure_values--ALT", "measure_values--AST", "measure_values--TB", - "measure_values--ALP" + "measure_values--ALP", + "visit_col", + "visitn_col", + "filters", + "group_cols", + "baseline--value_col", + "analysisFlag--value_col" ], "message_long": [ "id_col not specified in settings.", @@ -299,6 +340,10 @@ "", "", "", + "", + "", + "", + "", "" ], "message_short": [ @@ -313,6 +358,10 @@ "OK", "OK", "OK", + "OK", + "OK", + "OK", + "OK", "OK" ], "num_fail": [ @@ -327,6 +376,10 @@ 0, 0, 0, + 0, + 0, + 0, + 0, 0 ] } diff --git a/inst/eDISH_app/tests/partialSDTM-expected/003.png b/inst/eDISH_app/tests/partialSDTM-expected/003.png index bb10bca5..dcf9ca44 100644 Binary files a/inst/eDISH_app/tests/partialSDTM-expected/003.png and b/inst/eDISH_app/tests/partialSDTM-expected/003.png differ diff --git a/inst/eDISH_app/tests/partialSDTM-expected/004.png b/inst/eDISH_app/tests/partialSDTM-expected/004.png index 77907bae..bb5732df 100644 Binary files a/inst/eDISH_app/tests/partialSDTM-expected/004.png and b/inst/eDISH_app/tests/partialSDTM-expected/004.png differ diff --git a/inst/eDISH_app/tests/partialSDTM-expected/005.json b/inst/eDISH_app/tests/partialSDTM-expected/005.json index f6f3aa21..256070f0 100644 --- a/inst/eDISH_app/tests/partialSDTM-expected/005.json +++ b/inst/eDISH_app/tests/partialSDTM-expected/005.json @@ -1,276 +1,313 @@ { "export": { "datatab-status": { - "checkList": [ - { - "key": [ + "checks": { + "key": [ + [ "id_col" ], - "text_key": "id_col", - "check": "value for specified key found in settings?", - "value": "--No Value Given--", - "valid": false, - "message": "id_col not specified in settings." - }, - { - "key": [ + [ "value_col" ], - "text_key": "value_col", - "check": "value for specified key found in settings?", - "value": "STRESN", - "valid": true, - "message": "" - }, - { - "key": [ + [ "measure_col" ], - "text_key": "measure_col", - "check": "value for specified key found in settings?", - "value": "TEST", - "valid": true, - "message": "" - }, - { - "key": [ + [ "normal_col_low" ], - "text_key": "normal_col_low", - "check": "value for specified key found in settings?", - "value": "STNRLO", - "valid": true, - "message": "" - }, - { - "key": [ + [ "normal_col_high" ], - "text_key": "normal_col_high", - "check": "value for specified key found in settings?", - "value": "STNRHI", - "valid": true, - "message": "" - }, - { - "key": [ + [ "studyday_col" ], - "text_key": "studyday_col", - "check": "value for specified key found in settings?", - "value": "DY", - "valid": true, - "message": "" - }, - { - "key": [ + [ + "measure_values", + "ALT" + ], + [ + "measure_values", + "AST" + ], + [ + "measure_values", + "TB" + ], + [ + "measure_values", + "ALP" + ], + [ "id_col" ], - "text_key": "id_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "value_col" ], - "text_key": "value_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "STRESN", - "valid": true, - "message": "" - }, - { - "key": [ + [ "measure_col" ], - "text_key": "measure_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "TEST", - "valid": true, - "message": "" - }, - { - "key": [ + [ "normal_col_low" ], - "text_key": "normal_col_low", - "check": "'_col' parameter from setting setting found in data?", - "value": "STNRLO", - "valid": true, - "message": "" - }, - { - "key": [ + [ "normal_col_high" ], - "text_key": "normal_col_high", - "check": "'_col' parameter from setting setting found in data?", - "value": "STNRHI", - "valid": true, - "message": "" - }, - { - "key": [ + [ "studyday_col" ], - "text_key": "studyday_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "DY", - "valid": true, - "message": "" - }, - { - "key": [ + [ "visit_col" ], - "text_key": "visit_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "visitn_col" ], - "text_key": "visitn_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ + "filters" + ], + [ "group_cols" ], - "text_key": "group_cols", - "check": "'_col' parameter from setting setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "baseline", "value_col" ], - "text_key": "baseline--value_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "analysisFlag", "value_col" ], - "text_key": "analysisFlag--value_col", - "check": "'_col' parameter from setting setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "measure_values", "ALT" ], - "text_key": "measure_values--ALT", - "check": "'_values' field from setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "measure_values", "AST" ], - "text_key": "measure_values--AST", - "check": "'_values' field from setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "measure_values", "TB" ], - "text_key": "measure_values--TB", - "check": "'_values' field from setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "measure_values", "ALP" ], - "text_key": "measure_values--ALP", - "check": "'_values' field from setting found in data?", - "value": "--No Value Given--", - "valid": true, - "message": "" - }, - { - "key": [ + [ "value_col" ], - "text_key": "value_col", - "check": "specified column is numeric?", - "value": "STRESN", - "valid": true, - "message": "2592 of 24669 values were not numeric. Records with non-numeric values may not appear in the graphic." - }, - { - "key": [ + [ "normal_col_low" ], - "text_key": "normal_col_low", - "check": "specified column is numeric?", - "value": "STNRLO", - "valid": true, - "message": "15 of 24669 values were not numeric. Records with non-numeric values may not appear in the graphic." - }, - { - "key": [ + [ "normal_col_high" ], - "text_key": "normal_col_high", - "check": "specified column is numeric?", - "value": "STNRHI", - "valid": true, - "message": "15 of 24669 values were not numeric. Records with non-numeric values may not appear in the graphic." - }, - { - "key": [ + [ "studyday_col" ], - "text_key": "studyday_col", - "check": "specified column is numeric?", - "value": "DY", - "valid": true, - "message": "15 of 24669 values were not numeric. Records with non-numeric values may not appear in the graphic." - }, - { - "key": [ + [ "visitn_col" - ], - "text_key": "visitn_col", - "check": "specified column is numeric?", - "value": "--No Value Given--", - "valid": true, - "message": "" - } - ], + ] + ], + "text_key": [ + "id_col", + "value_col", + "measure_col", + "normal_col_low", + "normal_col_high", + "studyday_col", + "measure_values--ALT", + "measure_values--AST", + "measure_values--TB", + "measure_values--ALP", + "id_col", + "value_col", + "measure_col", + "normal_col_low", + "normal_col_high", + "studyday_col", + "visit_col", + "visitn_col", + "filters", + "group_cols", + "baseline--value_col", + "analysisFlag--value_col", + "measure_values--ALT", + "measure_values--AST", + "measure_values--TB", + "measure_values--ALP", + "value_col", + "normal_col_low", + "normal_col_high", + "studyday_col", + "visitn_col" + ], + "type": [ + "required", + "required", + "required", + "required", + "required", + "required", + "required", + "required", + "required", + "required", + "column", + "column", + "column", + "column", + "column", + "column", + "column", + "column", + "column", + "column", + "column", + "column", + "field", + "field", + "field", + "field", + "numeric", + "numeric", + "numeric", + "numeric", + "numeric" + ], + "description": [ + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "value for specified key found in settings?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "column parameter from setting setting found in data?", + "field value from setting found in data", + "field value from setting found in data", + "field value from setting found in data", + "field value from setting found in data", + "specified column is numeric?", + "specified column is numeric?", + "specified column is numeric?", + "specified column is numeric?", + "specified column is numeric?" + ], + "value": [ + "--No Value Given--", + "STRESN", + "TEST", + "STNRLO", + "STNRHI", + "DY", + "Aminotransferase, alanine (ALT)", + "Aminotransferase, aspartate (AST)", + "Total Bilirubin", + "Alkaline phosphatase (ALP)", + "--No Value Given--", + "STRESN", + "TEST", + "STNRLO", + "STNRHI", + "DY", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "--No Value Given--", + "Aminotransferase, alanine (ALT)", + "Aminotransferase, aspartate (AST)", + "Total Bilirubin", + "Alkaline phosphatase (ALP)", + "STRESN", + "STNRLO", + "STNRHI", + "DY", + "--No Value Given--" + ], + "valid": [ + false, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true, + true + ], + "message": [ + "id_col not specified in settings.", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "2592 of 24669 values were not numeric. Records with non-numeric values may not appear in the graphic.", + "15 of 24669 values were not numeric. Records with non-numeric values may not appear in the graphic.", + "15 of 24669 values were not numeric. Records with non-numeric values may not appear in the graphic.", + "15 of 24669 values were not numeric. Records with non-numeric values may not appear in the graphic.", + "" + ] + }, "valid": false, - "status": "1 of 26 checks failed." + "status": "1 of 31 checks failed." }, "settingsUI-status_df": { "text_key": [ @@ -280,12 +317,16 @@ "normal_col_low", "normal_col_high", "studyday_col", - "visit_col", - "visitn_col", "measure_values--ALT", "measure_values--AST", "measure_values--TB", - "measure_values--ALP" + "measure_values--ALP", + "visit_col", + "visitn_col", + "filters", + "group_cols", + "baseline--value_col", + "analysisFlag--value_col" ], "message_long": [ "", @@ -299,6 +340,10 @@ "", "", "", + "", + "", + "", + "", "" ], "message_short": [ @@ -313,6 +358,10 @@ "OK", "OK", "OK", + "OK", + "OK", + "OK", + "OK", "OK" ], "num_fail": [ @@ -327,6 +376,10 @@ 0, 0, 0, + 0, + 0, + 0, + 0, 0 ] } diff --git a/inst/eDISH_app/tests/partialSDTM-expected/005.png b/inst/eDISH_app/tests/partialSDTM-expected/005.png index ad6a8178..23874c10 100644 Binary files a/inst/eDISH_app/tests/partialSDTM-expected/005.png and b/inst/eDISH_app/tests/partialSDTM-expected/005.png differ diff --git a/man/checkField.Rd b/man/checkField.Rd index 253849d8..3d856609 100644 --- a/man/checkField.Rd +++ b/man/checkField.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/checkFieldSettings.R +% Please edit documentation in R/checkField.R \name{checkField} \alias{checkField} \title{Check that a setting parameter has a matching data field} diff --git a/man/checkFieldSettings.Rd b/man/checkFieldSettings.Rd deleted file mode 100644 index e8c48684..00000000 --- a/man/checkFieldSettings.Rd +++ /dev/null @@ -1,31 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/checkField.R -\name{checkFieldSettings} -\alias{checkFieldSettings} -\title{Check that a setting parameter has a matching data field} -\usage{ -checkFieldSettings(fieldKey, settings, data) -} -\arguments{ -\item{fieldKey}{a list (like those provided by \code{getSettingKeys())} defining the position of parameter in the settings object.} - -\item{settings}{The settings list used to generate a chart like \code{eDISH()}} - -\item{data}{A data frame to check for the specified field} -} -\value{ -A list containing the results of the check following the format specified in \code{validateSettings()[["checkList"]]} -} -\description{ -Checks that a single parameter from the settings list matches a field value in a specified data set -} -\details{ -This function compares settings with field values as part of the \code{validateSettings()} function. More specifically, the function checks whether the \code{fieldKey} in a \code{settings} object matches a column/field combination in \code{"data"}. The function makes 2 major assumptions about the structure of the settings object. First, it assumes that the first value in fieldKey is "settingName_values" and there is a corresponding "settingName_col" setting that defines the column to search for field-level data. Second, it expects that the value specified by key/settings is a list, and that each value in the list is a field of the variable above. -} -\examples{ -testSettings<-generateSettings(standard="AdAM") -fields<-list("measure_values","TB") -safetyGraphics:::checkFieldSettings(fieldKey=fields,settings=testSettings, data=adlbc) - -} -\keyword{internal} diff --git a/man/safetyGraphicsApp.Rd b/man/safetyGraphicsApp.Rd index e0296c05..6f75fba1 100644 --- a/man/safetyGraphicsApp.Rd +++ b/man/safetyGraphicsApp.Rd @@ -4,7 +4,10 @@ \alias{safetyGraphicsApp} \title{Run the interactive safety graphics builder} \usage{ -safetyGraphicsApp() +safetyGraphicsApp(maxFileSize = 20) +} +\arguments{ +\item{maxFileSize}{maximum file size in MB allowed for file upload.} } \description{ Run the interactive safety graphics builder diff --git a/man/trimData.Rd b/man/trimData.Rd new file mode 100644 index 00000000..c0f8223a --- /dev/null +++ b/man/trimData.Rd @@ -0,0 +1,27 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/trimData.R +\name{trimData} +\alias{trimData} +\title{Removes unnecessary rows and columns} +\usage{ +trimData(data, settings, chart = "edish") +} +\arguments{ +\item{data}{a data frame to trim} + +\item{settings}{the settings list used to determine which rows and columns to drop} + +\item{chart}{the chart being created} +} +\value{ +A dataframe with unnecessary columns and rows removed +} +\description{ +Removes unnecessary rows and columns from data based on current settings +} +\examples{ +testSettings <- generateSettings(standard="adam") +trimmed<-safetyGraphics:::trimData(data=adlbc, settings=testSettings) + +} +\keyword{internal} diff --git a/tests/testthat/test_trimData.R b/tests/testthat/test_trimData.R new file mode 100644 index 00000000..aab56744 --- /dev/null +++ b/tests/testthat/test_trimData.R @@ -0,0 +1,38 @@ +context("Tests for the trimData() function") +library(safetyGraphics) + +settings <-generateSettings(standard="AdAM") + +baseline_settings <- settings +baseline_settings[['baseline']][['value_col']] <- 'ADY' +baseline_settings[['baseline']][['values']] <- list("-7","15") + +analysisFlag_settings <- settings +analysisFlag_settings[['analysisFlag']][['value_col']] <- 'TRTA' +analysisFlag_settings[['analysisFlag']][['values']] <- list("Placebo","Xanomeline High Dose") + +filter_settings <- settings +filter_settings[['filters']]<-list("SEX", "AGEGR1") + +both_settings <- baseline_settings +both_settings[['analysisFlag']][['value_col']] <- 'TRTA' +both_settings[['analysisFlag']][['values']] <- list("Placebo","Xanomeline High Dose") + +test_that("columns are removed",{ + # simple test case works + expect_length(trimData(adlbc, settings), 6) + expect_length(trimData(adlbc, baseline_settings), 6) + expect_length(trimData(adlbc, analysisFlag_settings), 7) + expect_length(trimData(adlbc, both_settings), 7) + expect_length(trimData(adlbc, filter_settings), 8) + +}) + +test_that("rows are removed",{ + # simple test case works + expect_equal(nrow(trimData(adlbc, settings)), 10288) # none removed + expect_equal(nrow(trimData(adlbc, baseline_settings)), 714) + expect_equal(nrow(trimData(adlbc, analysisFlag_settings)), 7148) + expect_equal(nrow(trimData(adlbc, both_settings)), 7378) +}) + diff --git a/tests/testthat/test_validateSettings.R b/tests/testthat/test_validateSettings.R index 4f795d1f..1d5d6b00 100644 --- a/tests/testthat/test_validateSettings.R +++ b/tests/testthat/test_validateSettings.R @@ -48,14 +48,18 @@ test_that("field checks fail when expected",{ expect_equal(nrow(failedChecks), 1) expect_equal(failedChecks[1,"description"]%>%as.character,"field value from setting found in data") expect_equal(failedChecks[1,'text_key']%>%as.character,"measure_values--ALP") + - # TODO: support vectorized fields/columns #170 - # a vector of values are each checked independently. - # invalidFieldSettings$baseline[["values"]] <- c("not a filter",test2="still not a filter") - # fieldFailed2<-validateSettings(data=adlbc,settings=invalidFieldSettings) - # failedChecks2 = fieldFailed2[["checkList"]]%>%keep(~!.x[["valid"]]) - # expect_false(fieldFailed[["valid"]]) - # expect_length(failedChecks2, 3) + # a vector of values are each checked independently. + invalidFieldSettings <- validSettings + invalidFieldSettings$baseline[["value_col"]]<- "PARAM" + invalidFieldSettings$baseline[["values"]] <- list("not a filter","still not a filter") + + expect_false(safetyGraphics:::checkField(list("baseline","values",1), settings=invalidFieldSettings, data=adlbc )$valid) + + fieldFailed2<-validateSettings(data=adlbc,settings=invalidFieldSettings) + expect_false(fieldFailed2[["valid"]]) + expect_equal(fieldFailed2$checks%>%filter(!valid)%>%nrow,2) #2 fields fail }) test_that("required setting checks fail when expected",{ @@ -105,3 +109,17 @@ test_that("numeric column checks pass when more than half of the values are nume expect_equal(partialNumericCheck[1,"message"]%>%as.character,"2 of 10288 values were not numeric. Records with non-numeric values may not appear in the graphic.") }) + +test_that("validateSettings works with filters and group_cols ",{ + groupFilterSettings <- validSettings + groupFilterSettings$filters <- list() + groupFilterSettings$filters[[1]] <- list(value_col = "RACE", + label = "RACE") + groupFilterSettings$group_cols <- list() + groupFilterSettings$group_cols[[1]] <- list(value_col = "SEX", + label = "SEX") + Passed<-validateSettings(data=adlbc,settings=groupFilterSettings) + expect_true(Passed[["valid"]]) +}) + +