library("reprex")
library("evaluator")
library("readr")
wd = "~/Documents/Code/Evaluator"
setwd(wd)
# create Excel templates in base directory
create_templates(base_directory = wd)
#> # A tibble: 5 x 2
#> filename copied
#> <chr> <lgl>
#> 1 domains.csv FALSE
#> 2 qualitative_mappings.csv FALSE
#> 3 risk_tolerances.csv FALSE
#> 4 run_analysis.R FALSE
#> 5 survey.xlsx FALSE
## Modify/customize input spreadsheet manually before completing next steps
## If you have a different domain structure (e.g. ISO2700x, NIST CSF, or COBIT), you will need to edit the inputs/domains.csv file to include the domain names and the domain IDs,
### and a shorthand abbreviation for the domain (such as POL for the Policy domain).
# read domains from CSV files
domains = read_csv("./inputs/domains.csv")
#> Parsed with column specification:
#> cols(
#> domain_id = col_character(),
#> domain = col_character()
#> )
# read the import spreadsheet and generate CSV files from it
import_spreadsheet("./inputs/survey.xlsx", domains, output_dir = "./inputs")
#> # A tibble: 2 x 11
#> filename size isdir mode mtime ctime
#> <chr> <dbl> <lgl> <oct> <dttm> <dttm>
#> 1 ./input… 8017 FALSE 644 2020-04-16 17:36:59 2020-04-16 17:36:59
#> 2 ./input… 10352 FALSE 644 2020-04-16 17:36:59 2020-04-16 17:36:59
#> # … with 5 more variables: atime <dttm>, uid <int>, gid <int>, uname <chr>,
#> # grname <chr>
# but ... does not update risk_tolerances.csv or domains.csv (maybe customize)
# read in the FAIR parameters from CSV files, then validate
qualitative_scenarios <- readr::read_csv("./inputs/qualitative_scenarios.csv")
#> Parsed with column specification:
#> cols(
#> scenario_id = col_character(),
#> scenario = col_character(),
#> tcomm = col_character(),
#> tef = col_character(),
#> tc = col_character(),
#> lm = col_character(),
#> domain_id = col_character(),
#> controls = col_character()
#> )
mappings <- readr::read_csv("./inputs/qualitative_mappings.csv")
#> Parsed with column specification:
#> cols(
#> type = col_character(),
#> label = col_character(),
#> l = col_double(),
#> ml = col_double(),
#> h = col_double(),
#> conf = col_double()
#> )
capabilities <- readr::read_csv("./inputs/capabilities.csv")
#> Parsed with column specification:
#> cols(
#> capability_id = col_character(),
#> domain_id = col_character(),
#> capability = col_character(),
#> diff = col_character()
#> )
validate_scenarios(qualitative_scenarios, capabilities, domains, mappings)
# Encode scenarios, coverting qualitative (ordinal) variables to quantitative
quantitative_scenarios <- encode_scenarios(qualitative_scenarios,
capabilities, mappings)
## QUESTION -- where are the parameters/rules for converting qualitative FAIR to quant?
# Run the simulation
simulation_results <- run_simulations(quantitative_scenarios,
iterations = 100L)
#> Error: All scenarios must be tidyrisk_scenario objects
# Error: All scenarios must be tidyrisk_scenario objects
# saveRDS(simulation_results, file = "./results/simulation_results.rds")
Created on 2020-04-16 by the reprex package (v0.3.0)