## The Toolbox Ecosystem

The Toolbox is a collection of multiple interdependent R scripts and data files, organized in folders and sub-folders, used in calculating Ocean Health Index (OHI) scores. We call it the Toolbox because it consists of a set of discrete, partitioned tools. And we sometimes we refer to the integration of all these as an “ecosystem” since it’s the way the pieces fit together that allows the interesting things to happen, i.e. the score calculation from multiple data layers.

ohicore is one of three primary components and is the backbone software package of the Toolbox. The other two overarching components are the assessment repository (or “repo”) itself, and the data preparation. In regional OHI assessments (OHI+), data preparation is done in a subfolder within the assessment repository, and for global assessments, it is in a separate repo. ohicore contains functions to create the ‘conf’ and ‘layers’ objects, check layers, calculate trends, resilience, pressure, and status, and finally to calculate and check the scores.

Bottom line: ohicore is an R package that contains all the core operations for the data preparation and models for your assessment, and it will calculate OHI scores once the Toolbox is configured.

## Contents of an OHI Repo

An OHI repository or “repo” will contain the following:

The “layers” and “conf” subfolders:

• The “layers” folder contains the csv files that ohicore::Layers and ohicore::CheckLayers take as input
• The “conf” (short for “configuration”) folder contains a config.R script, functions.R, goals.csv, pressures and resilience matrices in csv file format, and a few other things.
• The purpose of the other files in the “conf” folder is to feed the Toolbox information on the relative weighting/importance of goals or allow adjustments to goal calculation models by regional assessments.

## Configuring the Toolbox

Configuring the Toolbox involves running the ohicore functions: Conf(), CheckLayers() and Layers(). In the process of configuring the Toolbox, the layers and conf objects are created. These are in effect lists (a special type of R object) of the prepared input data (layers), and everything else (conf) which includes all the information from the following files: config.R, functions.R, goals.csv, pressures_matrix.csv, resilience_matrix.csv, resilience_weights.csv. These two objects are created so that automated checks can be run to confirm that everything is properly prepared and accounted for, and in a consistent format that the ohicore score calculation functions can accept as input.

Configuration must be done each time models are edited or additional data is added to the data layers, prior to (re)calculating scores; i.e. if you have made changes to functions.R, goals.csv, or other files that become part of the layers or conf objects.

## Ensure Files are Properly Configured

# set working directory to the scenario folder (that contains the conf folder)
setwd('eez')

ohicore::CheckLayers('layers.csv', 'layers', flds_id = conf$config$layers_id_fields)
layers$data$scenario_year <- scenario_years