Skip to content

960 function to create gis file new point aus for submission to attains - #1005

Open
hillarymarler wants to merge 36 commits into
developfrom
960-function-to-create-gis-file-new-point-aus-for-submission-to-attains
Open

960 function to create gis file new point aus for submission to attains#1005
hillarymarler wants to merge 36 commits into
developfrom
960-function-to-create-gis-file-new-point-aus-for-submission-to-attains

Conversation

@hillarymarler

@hillarymarler hillarymarler commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

closes #960

Added a new function TADA_CreatePointAUGeometry and some helper functions. Made some minor changes to TADA_CrosswalkATTAINSWaterTypes and TADA_CreatePointAUs to facilitate the addition of TADA_CreatePointAUGeometry to the workflow. These new functions will be demonstrated n a future, updated mod 2 workflow vignette.

Next steps will be to create functions to generate the ATTAINS batch upload csvs for Assessment Units and Assessment Units with Monitoring Locations (this can be built off of TADA_CreateATTAINSAUMLCrosswalk).

It would be great to get #964 merged first. Then I can double check that the addition of org_id as a param for TADA_CrosswalkATTAINSWaterTypes does not have any impact on these changes. I do not expect it to.

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

@hillarymarler

Copy link
Copy Markdown
Collaborator Author

I am setting this as draft until #964 is merged as there is a test failure here I expect will be resolved by change sin #964.

@hillarymarler
hillarymarler marked this pull request as draft August 7, 2026 14:53
@hillarymarler
hillarymarler marked this pull request as ready for review August 10, 2026 21:14
@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

coverage-report

File Coverage Missing
All files 67%
R/ATTAINSCrosswalks.R 51% 32-876 1101-1105 1110-1115 1120-1123 1128-1159 1165-1168 1174-1177 1191-1194 1205-1220 1266-1269 1513-1514 1521-1522 1527-1528 1555-1562 1693 2016-2019 2024 2053-2057 2069-2072 2080 2089-2096 2111-2120 2125-2133 2139-2162 2182-2197 2202-2205 2210-2241 2254-2257 2329-2333 2428-2437 2653-2654 2723 2894-2900 3120-3698 3876-3879 3887-3892 3898-3918 3926-3930 3943-3947 3978-4087 4139-4294 4299-4302 4363-4364 4400 4476-4482 4921 4976-4978 4982-4984 5020-5065 5122-5124
R/GeospatialFunctions.R 43% 73-77 207-211 287-289 317-319 343-345 503 582-587 591 599-784 827-828 835-840 844 852-1022 1164-1170 1177-1451 1555-1558 1563-1586 1631-1634 1701-1709 1713-1722 1833-1836 1881-1885 1938-1969 2197-2207 2254-2264 2294-2304 2311-2342 2408 2412 2416 2438-2486 2568-2656 2661-2696 2804-2833 2960 2981-3589 3695 3731-3744
R/GeospatialUtilities.R 73% 108 132 189 194 199 295-304 309-357 362-386 475 504-515 522-533 572-582 654-657 663-692 697 706-708 715-729 752-755 806 813-818 883-889 896 924-939 1053-1059 1117 1287 1321-1330 1347-1350 1463-1465 1470-1477 1523-1525 1570-1572 1622-1624 1676-1681 1764-1773 1833-1835 1871 1930-1951 1963-1966 1977
R/Utilities.R 69% 544 662-663 667 672-674 769 898-909 1053-1055 1123-1124 1178-1182 1292-1293 1297-1298 1308-1312 1317-1322 1364-1518 1612 1669 1677 1738 1746-1766 1792-1793 1802-1816 1840-1843 1907-1908 1925-1927 1932 1935-1937 2021-2099 2130-2132 2168-2336 2363-2367 2376-2380 2597 2650 2656-2659 2663 2674 2693-2694 2696-2711 2713 2715 2721 2724-2726 2728 2733 2748 2754 2762 2767 2775-2780 2809 2819-2821 2842-2846 2856-2858 2861-2866 2870-2875 2883 2893-2894 2905 2921 2953-2987 3102 3111 3150-3154

Minimum allowed coverage is 20%

Generated by 🐒 cobertura-action against 9922ead

@hillarymarler

Copy link
Copy Markdown
Collaborator Author

This is ready for review - I know everyone is busy so I tagged a few TADA team members as potential reviewers. I'd appreciate a review or two from whoever has time to get to it. This function was primarily designed to facilitate downloading of new point AU geometry to submit to ATTAINS.

I verified with @jesseboormanpadgett that currently a shp file is the preferred format for upload to ATTAINS.

@jbousquin

Copy link
Copy Markdown
Collaborator

Nice PR! Was glad to see some tests included.

I'm seeing six functions across 3 R files. Could you provide a quick roadmap type summary of what calls what for what situation?

ATTAINSCrosswalks:
TADA_CrosswalkATTAINSWaterTypes()
TADA_ReviewATTAINSWaterTypes()
TADA_CreatePointAUs()

Geospatial functions:
TADA_CreatePointAUGeometry()

Geospatial utilities:
save_sf_as_shp()
fill_missing_assessment_unit_id()

I think that'll help inform/check function:

  • names (convey purpose, consistent, & concise)
  • location (maintainer finds them where they would expect)
  • scope (i.e., is this specific internal or useful as something more general)

@hillarymarler

Copy link
Copy Markdown
Collaborator Author

Nice PR! Was glad to see some tests included.

I'm seeing six functions across 3 R files. Could you provide a quick roadmap type summary of what calls what for what situation?

ATTAINSCrosswalks: TADA_CrosswalkATTAINSWaterTypes() TADA_ReviewATTAINSWaterTypes() TADA_CreatePointAUs()

  1. TADA_CrosswalkATTAINSWaterTypes() - Adds or updates ATTAINS.WaterType using by using an internal ref file which crosswalks ATTAINS.WaterType with TADA.MonitoringLocationTypeName. By default, only missing ATTAINS.WaterType values are populated.

  2. TADA_ReviewATTAINSWaterTypes() - Validates ATTAINS.WaterType against allowable ATTAINS domain values and can either flag invalid values or update them using the crosswalk.
    #'

  3. TADA_CreatePointAUs() - Builds a crosswalk between WQP Monitoring Locations and ATTAINS Assessment Units. Missing or blank ATTAINS.AssessmentUnitIdentifier values are filled from TADA.MonitoringLocationIdentifier, optionally prefixed with auid_prefix. Existing non-missing, non-blank AUIDs are left unchanged. Optionally, this function can also return either a df or a shp file containing the point or multipoint geometry and its corresponding assessment unit identifier (via TADA_CreatePointAUGeometry).

Geospatial functions: TADA_CreatePointAUGeometry()

  1. TADA_CreatePointAUGeometry() - Creates point or multipoint geometry for ATTAINS Assessment Units using ATTAINS.AssessmentUnitIdentifier when available, otherwise TADA.MonitoringLocationIdentifier. This can be run by itself or (optionally) as part of TADA_CreatePointAUs).

Geospatial utilities: save_sf_as_shp() fill_missing_assessment_unit_id()

  1. save_sf_as_shp() - Helper function to save sf object as shp file for batch upload to ATTAINS.
  2. fill_missing_assessment_unit_id() - Helper function to fill in missing assessment unit identifiers with TADA.MonitoringLocationIdentifier. Adds a prefix to the new assessment unit id if user enters an auid_prefix.

I think that'll help inform/check function:

  • names (convey purpose, consistent, & concise)
  • location (maintainer finds them where they would expect)
  • scope (i.e., is this specific internal or useful as something more general)

So one example of use in a workflow might be:

  1. Crosswalk ATTAINS Water Types to WQP locations (TADA_CrosswalkATTAINSWaterTypes) to fill in any missing water types

  2. Review ATTAINS Water Types assignments and flag or correct any invalid ATTAINS Water Types. Invalid entries may be a result of users saving ATTAINS Water Type outside of ATTAINS and importing for their assessments. (TADA_ReviewATTAINSWaterTypes)..

  3. Create new point assessment units with identifiers based on the TADA.MonitoringLocationIdentifier and an optional user entered auid_prefix (TADA_CreatePointAUs). Optionally, an sf object and/or shp file containing the point/multipoint geometry for ATTAINS batch upload can be created (TADA_CreatePointAUGeometry run during TADA_CreatePointAUs).

Please let me know if you need any additional info!

@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
shp   TADA_CreatePointAUs.Rd:68

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.

function to create GIS file (new point AUs) for submission to ATTAINS

2 participants