Skip to contents

Assessment criteria and methodologies used to evaluate water quality vary across the country. TADA users can fill out this template to define the specific criteria and methodologies for each parameter and use combination they are interested in analyzing. This table can be filled out manually, auto-populated with uses and parameters from ATTAINS and the input WQP dataframe, or developed with TADA helper functions (recommended).It is recommended to run these three TADA helper functions, TADA_CreateParamRef(), TADA_CreateUseParamRef, and TADA_CreateMLSummaryRef, in that order to generate the Criteria and Methodology table specific for your organization.

Usage

TADA_DefineCriteriaMethodology(
  .data,
  MLSummaryRef = NULL,
  org_id = NULL,
  criteriaMethods = NULL,
  auto_assign = FALSE,
  AUMLRef = NULL,
  useAURef = NULL,
  epa304a = FALSE,
  displayUniqueId = FALSE,
  excel = TRUE,
  overwrite = FALSE
)

Arguments

.data

A TADA dataframe. The user should run all desired data cleaning, processing, harmonization, filtering, and handling of censored data functions prior to running this function.

MLSummaryRef

An optional data frame which contains the completed spatial crosswalk to assign any unique spatial criteria to a parameter, use, waterbody or monitoring site/assessment unit. For any unique groupings of sites, this input is recommended.

org_id

The ATTAINS organization identifier must be supplied by the user. A list of organization identifiers can be found by downloading the ATTAINS Domains Excel file: https://www.epa.gov/system/files/other-files/2025-02/domains_2025-02-25.xlsx. organization identifiers are listed in the "OrgName" tab. The "code" column contains the organization identifiers that should be used for this param. If a user does not provide an org_id argument, the function attempts to identify which organization identifier(s) to include based on the unique ATTAINS organization identifiers found in the dataframe.

criteriaMethods

An optional data frame which contains the completed criteria and methodology table. This will be a user supplied table and any inputs in this table will be prioritized. Additional rows for any parameter(s) and use(s) combinations that are not found in the user supplied table will be included in the output. These rows will need the criteria and methodology inputs filled out accordingly.

auto_assign

Boolean argument with two possible values: TRUE and FALSE. The default value is FALSE. If TRUE, a draft criteria and methods table is generated using default function inputs for TADA_CreateParamRef(), TADA_CreateUseParamRef, and TADA_CreateMLSummaryRef. .data and org_id are required inputs for this function if auto_assign = TRUE. It is also recommended to set excel = TRUE when auto_assign = TRUE. The criteria and methodology template should be reviewed carefully and edits can be made manually in Excel. When your review is complete, read the file back into R and re-run this function, TADA_DefineCriteriaMethodology, again. This time, use the criteriaMethods function input to specify the criteria and methodology table that has already been filled out.

AUMLRef

An optional data frame input. This data frame should contain a completed crosswalk of WQP Monitoring Locations associated with each ATTAINS Assessment Unit. Users will need to ensure this crosswalk contains the appropriate column names in order to run this function. See module 2 vignette and sample output of TADA_CreateATTAINSAUMLCrosswalk().

useAURef

An optional data frame input. If provided, this data frame should contain a completed crosswalk of use names associated with each assessment unit. Users will need to ensure this crosswalk contains the appropriate column names in order to run the function.

epa304a

A Boolean value to return epa304a recommended standards for any WQP/TADA/ATTAINS parameter if one is found. Default is FALSE.

displayUniqueId

A Boolean value. If TRUE, this will print all unique TADA.ComparableDataIdentifier in the criteria and methods table output. This is useful in the alternative options to generate the criteria and methods table without the reference tables.

excel

A Boolean value that returns an excel spreadsheet if excel = TRUE. This spreadsheet is created in the user's downloads folder path. If you have any trouble locating the file, please type the following into your R console to locate it: file.path(Sys.getenv("USERPROFILE"), "Downloads"). The file will be named "myfileRef.xlsx". The excel spreadsheet will highlight the cells in which users should input information.

overwrite

A Boolean value that ensures the function will not overwrite the user supplied crosswalk entered into this function. This helps prevent users from overwriting their progress.

Value

A data frame with the criteria and methodology table in TADA format.

Details

This criteria and methodology table will be in a TADA compatible format and contain a list of allowable values within each column to define the full criteria, or magnitude only, values associated with an ATTAINS parameter name and use name. For each criteria/magnitude value, users will need to ensure they properly define any additional methods that reflects their water quality criteria and methodologies for a parameter and use. For example, if there are separate criteria and methods for acute versus chronic, rivers versus estuary, different seasons, etc., then a user will need to create additional rows to reflect this. Additional columns are included in this output to capture data sufficiency considerations such as minimum sample sizes, assessment period dates, and seasonality components.

Examples

if (FALSE) { # \dontrun{
# First, generate and fill out a parameter crosswalk (see TADA_CreateParamRef()):
paramRef_UT <- TADA_CreateParamRef(Data_Nutrients_UT, org_id = "UTAHDWQ", excel = FALSE)
paramRef_UT2 <- dplyr::mutate(paramRef_UT, ATTAINS.ParameterName = dplyr::case_when(
  grepl("AMMONIA", TADA.ComparableDataIdentifier) ~ "AMMONIA, TOTAL",
  grepl("NITRATE", TADA.ComparableDataIdentifier) ~ "NITRATE",
  grepl("NITROGEN", TADA.ComparableDataIdentifier) ~ "NITRATE/NITRITE (NITRITE + NITRATE AS N)"
))
paramRef_UT3 <- TADA_CreateParamRef(
  Data_Nutrients_UT,
  paramRef = paramRef_UT2, org_id = "UTAHDWQ", excel = FALSE
)

# Next, enter the crosswalk generated above as the paramRef function input
# for TADA_CreateUseParamRef():
UseParamRef_UT <- TADA_CreateUseParamRef(
  Data_Nutrients_UT,
  paramRef = paramRef_UT3, org_id = c("UTAHDWQ"), excel = FALSE
)

# Now, run TADA_CreateMLSummaryRef()
MLSummaryRef_UT <- TADA_CreateMLSummaryRef(
  Data_Nutrients_UT,
  org_id = c("UTAHDWQ"),
  useAURef = NULL, AUMLRef = NULL,
  useParamRef = UseParamRef_UT,
  excel = FALSE
)

DefineCriteriaMethodology_UT <- TADA_DefineCriteriaMethodology(
  Data_Nutrients_UT,
  MLSummaryRef = MLSummaryRef_UT,
  displayUniqueId = TRUE,
  excel = FALSE
)
} # }