diff --git a/R/forecast_output_validator.R b/R/forecast_output_validator.R index d4b091e..84b2f1a 100644 --- a/R/forecast_output_validator.R +++ b/R/forecast_output_validator.R @@ -4,7 +4,17 @@ #' @export forecast_output_validator <- function(forecast_file){ + + config <- yaml::read_yaml("https://raw.githubusercontent.com/eco4cast/neon4cast-ci/main/challenge_configuration.yaml") + + allowed_combinations <- NULL + for(i in 1:length(config$variable_groups)){ + curr_tibble <- data.frame(variable = unlist(config$variable_groups[i][[1]]$variable), + duration = unlist(config$variable_groups[i][[1]]$duration)) + + allowed_combinations <- rbind(allowed_combinations, curr_tibble) + } file_in <- forecast_file @@ -30,7 +40,18 @@ forecast_output_validator <- function(forecast_file){ usethis::ui_warn("missing the variable and prediction columns") valid <- FALSE } - + + unique_variables <- unique(out$variable) + + for(i in 1:length(unique_variables)){ + if (unique_variables[i] %in% allowed_combinations$variable) { + usethis::ui_done(paste0(unique_variables[i], " is a valid variable name")) + } + else { + usethis::ui_warn(paste0(unique_variables[i], " is not a valid variable name")) + } + } + if(lexists(out, "ensemble")){ usethis::ui_warn("ensemble dimension should be named parameter") valid <- FALSE