Skip to content

1056 incorporate cst pollutant and uses crosswalk functions - #1070

Draft
wokenny13 wants to merge 84 commits into
developfrom
1056-incorporate-cst-pollutant-and-uses-crosswalk-functions
Draft

wokenny13 wants to merge 84 commits into
developfrom
1056-incorporate-cst-pollutant-and-uses-crosswalk-functions

Conversation

@wokenny13

@wokenny13 wokenny13 commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Pull Request Checklist (convert PR to draft if in progress)

  1. Renamed function to TADA_CrosswalkWQPATTAINSParam (previously TADA_AssignParametersForAnalysis)
  2. Created TADA_CrosswalkCSTWQPATTAINSParam and TADA_CrosswalkCSTATTAINSUse
  3. Separated excel chunk in parameters crosswalk to an internal function called .TADAExcelParameterCrosswalk
  4. Updated r documentation examples in these workflow functions
  5. Renamed function to TADA_CreateParamUseRef (previously TADA_AssignUsesForAnalysis)
  6. Refactored TADA_MLSummaryRef and TADA_DefineCriteriaMethodology functions

Future Issues that still need to addressed (will be done as a separate PR in future):

  1. Still need to reincorporate option to include epa304a standards in TADA_DefineCriteriaMethodology (will do as a separate PR)
  2. Review all excel function generations for this workflow, make more concise and separate it into a different function
  3. Harmonizing synonyms in the Criteria table to match those in the WQP data

Example Workflow:

#' # First, generate and fill out a parameter crosswalk (see TADA_CrosswalkCSTWQPATTAINSParam()):
#' paramRef_UT <- TADA_CrosswalkCSTWQPATTAINSParam(
#' Data_Nutrients_UT,
#' org_id = "UTAHDWQ",
#' auto_assign = "All",
#' excel = FALSE)
#'
#' # modify the parameter crosswalk
#' 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)"
#' ))
#'
#' # provide the modified/saved parameter crosswalk as a user supplied one
#' paramRef_UT3 <- TADA_CrosswalkCSTWQPATTAINSParam(
#' Data_Nutrients_UT,
#' paramRef = paramRef_UT2,
#' org_id = "UTAHDWQ",
#' excel = FALSE
#' )
#'
#' # Recommended step: Modify the ATTAINS.UseName to CST.UseName crosswalk.
#' usesRef_UT <- TADA_CrosswalkCSTATTAINSUses(org_id = "UTAHDWQ", paramRef = paramRef_UT2)
#'
#' modified.useRef_UT <- dplyr::filter(
#' usesRef_UT,
#' USE_CLASS_NAME_LOCATION_ETC == "AQUATIC WILDLIFE; CLASSES 3A, 3B, 3C, 3D" &
#' (ATTAINS.UseName == "AQUATIC WILDLIFE (COLD WATER)" |
#' ATTAINS.UseName == "AQUATIC WILDLIFE (WARM WATER)") |
#' (USE_CLASS_NAME_LOCATION_ETC == "DOMESTIC SOURCE, CLASS 1C" &
#' ATTAINS.UseName == "DOMESTIC SOURCE"))
#'
#' # Next, enter the crosswalk generated above as the paramRef function input
#' # for TADA_CrosswalkCSTATTAINSUses():
#' paramUsesRef_UT <- TADA_CreateParamUseRef(
#' org_id = "UTAHDWQ",
#' Data_Nutrients_UT,
#' usesRef = modified.useRef_UT,
#' paramRef = paramRef_UT2,
#' excel = FALSE
#' )
#'
#' # Now, run TADA_MLSummary()
#' MLSummaryRef_UT <- TADA_MLSummary(
#' Data_Nutrients_UT,
#' org_id = c("UTAHDWQ"),
#' AU_UsesRef = NULL, AUMLRef = NULL,
#' paramUseRef = paramUsesRef_UT,
#' excel = FALSE
#' )
#' # Create The criteria and methods table from the MLSummaryRef (see TADA_DefineCriteriaMethodology for alternative methods for generating criteria tables.
#' #CriteriaMethods_UT <- TADA_DefineCriteriaMethodology(Data_Nutrients_UT, org_id = "UTAHDWQ", MLSummaryRef = MLSummaryRef_UT)

Required

  • Update your branch from the latest develop and resolve any merge conflicts

  • Run devtools::test(), devtools::check(), and devtools::document() locally; ensure tests pass and fix any errors, warnings, or notes. Add new dependencies to DESCRIPTION and document appropriately

  • Add/update vignettes for corresponding changes in functionality, list these under articles in _pkgdown.yml, and ensure added/updated vignettes run and build with proper formatting locally

  • Request review from at least one developer team member (convert PR to ready for review if it was designated as in progress)

Best practices

  • Include a summary of the changes made and relevant context/motivation

  • Link issues to auto-close on merge (use Development sidebar or include "Closes #" in the PR)

  • Refresh inline/block comments for clarity

  • Update roxygen docs and include examples; review help pages

  • Add/update tests in tests/testthat; review the bot's coverage report from test-coverage and confirm all changes are covered

Conditional

  • If there is a bot spelling comment, run spelling::spell_check_package() locally and fix any misspellings; add approved project terms to WORDLIST with spelling::update_wordlist()

  • If tests fail suggesting internal reference files need a refresh, run .TADA_UpdateRefFiles() and .TADA_UpdateExampleData() locally via MaintenanceScheduled.R or trigger the Component File Update GitHub Action

  • If new example data files were added, document them in ExampleData.R and include them in MaintenanceScheduled.R for regular refresh

  • If columns were added/updated, update RequiredCols.R

  • If changes affect other package or the shiny app functions, update those impacted functions accordingly

…e-tadausesaliasrefcsv-and-start-to-review-matches-approved-or-rejected
…esaliasmethod-column-to-the-tadausesaliasrefcsv-and-start-to-review-matches-approved-or-rejected
…nly if they exist in the CST.

This correctly filters by only exisiting uses for a pollutant name for an org in the final output. users will need to determine the appropriate ATTAINS.UseName to CST.UseName crosswalk from this filtered list.
Focus on just ATTAINS.UseName to CST.UseName crosswalk
… CST values still if a CST.PollutantName is found
@wokenny13 wokenny13 linked an issue Oct 30, 2026 that may be closed by this pull request
@github-actions

Copy link
Copy Markdown
Contributor

Spelling check failed. Details:

Spelling check failed. Found 7 potential misspelling(s). Note: Run spelling::spell_check_package() locally and fix any misspellings; add approved project terms to WORDLIST with spelling::update_wordlist().

  WORD                          FOUND IN
CreateParamUseRef             TADA_MLSummary.Rd:92
CrosswalkCSTWQPATTAINSParam   TADA_CreateParamUseRef.Rd:104
CrosswalkWQPATTAINSParam      TADA_CreateParamUseRef.Rd:103
dropdown                      dot-TADA_ExcelParameterCrosswalk.Rd:52,69
dropdowns                     dot-TADA_ExcelParameterCrosswalk.Rd:46
paramUseRef                   TADA_CreateParamUseRef.Rd:112
prefilled                     TADA_DefineCriteriaMethodology.Rd:68

@wokenny13

Copy link
Copy Markdown
Collaborator Author

There are many references to function name changes that would need to be done. Before I proceed making all these name changes in the package, @hillarymarler are we comfortable changing TADA_ParametersForAnalysis to TADA_CrosswalkWQPATTAINSParam and changing TADA_UsesForAnalysis to TADA_CrosswalkCSTATTAINSUse?

@wokenny13 wokenny13 linked an issue Nov 2, 2026 that may be closed by this pull request
@wokenny13
wokenny13 marked this pull request as ready for review November 12, 2026 21:05
@github-actions

Copy link
Copy Markdown
Contributor

Spelling check failed. Details:

Spelling check failed. Found 4 potential misspelling(s). Note: Run spelling::spell_check_package() locally and fix any misspellings; add approved project terms to WORDLIST with spelling::update_wordlist().

  WORD                          FOUND IN
CreateParamUseRef             TADA_MLSummary.Rd:92
CrosswalkCSTWQPATTAINSParam   TADA_CreateParamUseRef.Rd:104
CrosswalkWQPATTAINSParam      TADA_CreateParamUseRef.Rd:103
paramUseRef                   TADA_CreateParamUseRef.Rd:112

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

Spelling check failed. Details:

Spelling check failed. Found 4 potential misspelling(s). Note: Run spelling::spell_check_package() locally and fix any misspellings; add approved project terms to WORDLIST with spelling::update_wordlist().

  WORD                          FOUND IN
CreateParamUseRef             TADA_MLSummary.Rd:92
CrosswalkCSTWQPATTAINSParam   TADA_CreateParamUseRef.Rd:104
CrosswalkWQPATTAINSParam      TADA_CreateParamUseRef.Rd:103
paramUseRef                   TADA_CreateParamUseRef.Rd:112

@github-actions

Copy link
Copy Markdown
Contributor

Spelling check failed. Details:

Spelling check failed. Found 4 potential misspelling(s). Note: Run spelling::spell_check_package() locally and fix any misspellings; add approved project terms to WORDLIST with spelling::update_wordlist().

  WORD                          FOUND IN
CreateParamUseRef             TADA_MLSummary.Rd:92
CrosswalkCSTWQPATTAINSParam   TADA_CreateParamUseRef.Rd:104
CrosswalkWQPATTAINSParam      TADA_CreateParamUseRef.Rd:103
paramUseRef                   TADA_CreateParamUseRef.Rd:112

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

Spelling check failed. Details:

Spelling check failed. Found 4 potential misspelling(s). Note: Run spelling::spell_check_package() locally and fix any misspellings; add approved project terms to WORDLIST with spelling::update_wordlist().

  WORD                          FOUND IN
CreateParamUseRef             TADA_MLSummary.Rd:92
CrosswalkCSTWQPATTAINSParam   TADA_CreateParamUseRef.Rd:104
CrosswalkWQPATTAINSParam      TADA_CreateParamUseRef.Rd:103
paramUseRef                   TADA_CreateParamUseRef.Rd:112

@github-actions

Copy link
Copy Markdown
Contributor

Spelling check failed. Details:

Spelling check failed. Found 4 potential misspelling(s). Note: Run spelling::spell_check_package() locally and fix any misspellings; add approved project terms to WORDLIST with spelling::update_wordlist().

  WORD                          FOUND IN
CreateParamUseRef             TADA_MLSummary.Rd:92
CrosswalkCSTWQPATTAINSParam   TADA_CreateParamUseRef.Rd:104
CrosswalkWQPATTAINSParam      TADA_CreateParamUseRef.Rd:103
paramUseRef                   TADA_CreateParamUseRef.Rd:112

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

Spelling check failed. Details:

Spelling check failed. Found 4 potential misspelling(s). Note: Run spelling::spell_check_package() locally and fix any misspellings; add approved project terms to WORDLIST with spelling::update_wordlist().

  WORD                          FOUND IN
CreateParamUseRef             TADA_MLSummary.Rd:92
CrosswalkCSTWQPATTAINSParam   TADA_CreateParamUseRef.Rd:104
CrosswalkWQPATTAINSParam      TADA_CreateParamUseRef.Rd:103
paramUseRef                   TADA_CreateParamUseRef.Rd:112

@wokenny13
wokenny13 marked this pull request as draft November 16, 2026 23:17
@github-actions

Copy link
Copy Markdown
Contributor

Spelling check failed. Details:

Spelling check failed. Found 4 potential misspelling(s). Note: Run spelling::spell_check_package() locally and fix any misspellings; add approved project terms to WORDLIST with spelling::update_wordlist().

  WORD                          FOUND IN
CreateParamUseRef             TADA_MLSummary.Rd:92
CrosswalkCSTWQPATTAINSParam   TADA_CreateParamUseRef.Rd:88
CrosswalkWQPATTAINSParam      TADA_CreateParamUseRef.Rd:87
paramUseRef                   TADA_CreateParamUseRef.Rd:96

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

Spelling check failed. Details:

Spelling check failed. Found 4 potential misspelling(s). Note: Run spelling::spell_check_package() locally and fix any misspellings; add approved project terms to WORDLIST with spelling::update_wordlist().

  WORD                          FOUND IN
CreateParamUseRef             TADA_MLSummary.Rd:92
CrosswalkCSTWQPATTAINSParam   TADA_CreateParamUseRef.Rd:88
CrosswalkWQPATTAINSParam      TADA_CreateParamUseRef.Rd:87
paramUseRef                   TADA_CreateParamUseRef.Rd:96

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant