Skip to content

954 create helper function to auto populate the saltfresh column in tada criteria and methodologies template for users - #1010

Open
hillarymarler wants to merge 14 commits into
developfrom
954-create-helper-function-to-auto-populate-the-saltfresh-column-in-tada-criteria-and-methodologies-template-for-users
Open

954 create helper function to auto populate the saltfresh column in tada criteria and methodologies template for users#1010
hillarymarler wants to merge 14 commits into
developfrom
954-create-helper-function-to-auto-populate-the-saltfresh-column-in-tada-criteria-and-methodologies-template-for-users

Conversation

@hillarymarler

@hillarymarler hillarymarler commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Closes #954

Adds TADA_SaltFreshIndicator which populates the TADA.SaltFreshIndicator column to support mod 2 workflow and provide salt/fresh info for criteria in Mod 3.

This function will be added to an expanded Mod 2 vignette update in the near future.

This PR adds:

  1. TADA_SaltFreshIndicator function
  2. tests for the new function2
  3. Csv files in extdata to support crosswalking of salt/fresh indicator to ATTAINS.WaterType and TADA.MonitoringLocationIdentifierTypeName

Reviewing the reference table I added to crosswalk to the saltfresh indicator by water type as well as the funciton itself would be helpful. I really was not sure what to to with estuaries - should they get their own indicator value?

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

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

@github-actions

Copy link
Copy Markdown
Contributor

Spelling check failed. Details:

Spelling check failed. Found 1 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
SaltFreshIndicator   TADA_SaltFreshIndicator.Rd:28

@github-actions

Copy link
Copy Markdown
Contributor

Spelling check failed. Details:

Spelling check failed. Found 1 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
SaltFreshIndicator   TADA_SaltFreshIndicator.Rd:28

…sh-column-in-tada-criteria-and-methodologies-template-for-users' of https://github.com/USEPA/EPATADA into 954-create-helper-function-to-auto-populate-the-saltfresh-column-in-tada-criteria-and-methodologies-template-for-users
@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

@wokenny13

Copy link
Copy Markdown
Collaborator

if ATTAINS.WaterType hasn't been assigned to a data frame yet, I noticed that if you accidentally made a typo ex I accidentally typed AU' instead of AU, the function will run with the default as ML. Should there be an error if the arg input is not one of AU or ML?

I notice also that when using location_col = "ML" the data frame grows a significant amount (ex. Data_Nutrients_UT would result in 6.6M rows). Is this expected? Are there one to many matches occuring in the WQPMonLocTypeToSaltFresh.csv?

…te-the-saltfresh-column-in-tada-criteria-and-methodologies-template-for-users
@hillarymarler

Copy link
Copy Markdown
Collaborator Author

if ATTAINS.WaterType hasn't been assigned to a data frame yet, I noticed that if you accidentally made a typo ex I accidentally typed AU' instead of AU, the function will run with the default as ML. Should there be an error if the arg input is not one of AU or ML?

I notice also that when using location_col = "ML" the data frame grows a significant amount (ex. Data_Nutrients_UT would result in 6.6M rows). Is this expected? Are there one to many matches occuring in the WQPMonLocTypeToSaltFresh.csv?

Thanks for these questions - will get back to you with a response (and likely some code fixes) later this week.

@hillarymarler

Copy link
Copy Markdown
Collaborator Author

@wokenny13 -I fixed the join bug that was creating extra rows in the resulting df.

@hillarymarler

Copy link
Copy Markdown
Collaborator Author

@wokenny13 - I added stops with messages if the user incorrectly enters params.

hillarymarler and others added 2 commits August 27, 2026 12:20
…te-the-saltfresh-column-in-tada-criteria-and-methodologies-template-for-users
…te-the-saltfresh-column-in-tada-criteria-and-methodologies-template-for-users
@wokenny13

Copy link
Copy Markdown
Collaborator

Would there be any value/ potential interest from users to provide their own custom reference table as an arg input for a user's own crosswalk table (rather than using the internal TADA tables) that would allow users to review this list, and make any edits as needed?

This could potentially be another function that creates a sort of own WQPMonLocTypeToSaltFresh/ATTAINSWaterTypeToSaltFresh ref output for users to only review the unique ATTAINS.WaterType or WQP MonitoringLocationIdentifier and the TADA default of Salt/Fresh from TADA, and then users can customize as desired.

Users would not need to go through this step and can use the default TADA internal Salt/Fresh table if desired. But if they do feel the need to customize they can do so. I was thinking this could help with any tricky classification of waters that could be either salt or fresh.

…te-the-saltfresh-column-in-tada-criteria-and-methodologies-template-for-users
@hillarymarler

Copy link
Copy Markdown
Collaborator Author

Would there be any value/ potential interest from users to provide their own custom reference table as an arg input for a user's own crosswalk table (rather than using the internal TADA tables) that would allow users to review this list, and make any edits as needed?

This could potentially be another function that creates a sort of own WQPMonLocTypeToSaltFresh/ATTAINSWaterTypeToSaltFresh ref output for users to only review the unique ATTAINS.WaterType or WQP MonitoringLocationIdentifier and the TADA default of Salt/Fresh from TADA, and then users can customize as desired.

Users would not need to go through this step and can use the default TADA internal Salt/Fresh table if desired. But if they do feel the need to customize they can do so. I was thinking this could help with any tricky classification of waters that could be either salt or fresh.

I like this idea! Yes it makes sense to me that users might want to provide their own crosswalk, particularly to deal with tricky water type like estuaries.

I will make some updates to:

  1. Facilitate users being able to see/review the default TADA salt/fresh crosswalk
  2. Allow users to supply their own crosswalk if they choose to edit the TADA defaults

@wokenny13 and @cristinamullin would your preference be that I do this additional work as part of this PR or a new one? The major pro to merging this first draft in before the update is that it would allow me to start working on adding this tab in the Shiny app.

@wokenny13

Copy link
Copy Markdown
Collaborator

I think as a separate PR is fine. Other than that suggestion, I think this PR is good to merge in.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create helper function to auto-populate the "SaltFresh" column in TADA Criteria and Methodologies template for users

3 participants