Skip to content

Add AOI resolver and frs_params() for habitat model pipeline#42

Merged
NewGraphEnvironment merged 3 commits intomainfrom
34-aoi-resolver
Mar 16, 2026
Merged

Add AOI resolver and frs_params() for habitat model pipeline#42
NewGraphEnvironment merged 3 commits intomainfrom
34-aoi-resolver

Conversation

@NewGraphEnvironment
Copy link
Copy Markdown
Owner

Summary

  • Add .frs_resolve_aoi() internal helper — normalizes character codes, sf polygons, table+id lookups, and blk+measure delineation to SQL predicates. Network-agnostic via options(fresh.partition_table, fresh.partition_col).
  • Add .frs_db_available() for integration tests to skip gracefully without DB tunnel.
  • Add frs_params() — loads species habitat thresholds from bcfishpass pg table, custom table, or local CSV. Returns named list with ranges sub-lists ready for frs_classify().

52 unit + integration tests. Integration tests hit real DB when tunnel is up, skip otherwise.

Closes #34
Relates to #37

Relates to NewGraphEnvironment/sred-2025-2026#18

Test plan

  • 322 tests pass (full suite)
  • Integration tests verified against db_newgraph (BULK WSG, assessment watershed 1387, blk+measure delineation)
  • CSV round-trip tested with bundled inst/testdata/test_params.csv
  • SQL injection escaping verified for character and string id inputs
  • Security review: all user inputs validated or escaped before SQL interpolation

🤖 Generated with Claude Code

NewGraphEnvironment and others added 3 commits March 16, 2026 07:39
Network-agnostic AOI resolver normalizes character codes, sf polygons,
table+id lookups, and blk+measure delineation to SQL predicates.
Partition table/column configurable via options() — defaults to FWA
watershed groups, works with any partition scheme.

.frs_db_available() enables integration tests to skip gracefully
when no DB tunnel is available.

27 unit + integration tests.

Relates to #34

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Reads species thresholds from bcfishpass pg table, custom table, or
local CSV. Returns named list keyed by species code with ranges
sub-lists ready for frs_classify(). CSV path enables rapid scenario
iteration without DB changes.

25 unit + integration tests. Bundled test CSV in inst/testdata/.

Relates to #37

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@NewGraphEnvironment NewGraphEnvironment merged commit 9c327fb into main Mar 16, 2026
1 check passed
@NewGraphEnvironment NewGraphEnvironment deleted the 34-aoi-resolver branch March 16, 2026 14:57
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.

Add .frs_resolve_aoi() internal helper for network-agnostic AOI resolution

1 participant