Skip to content

Configurable column names via options() for spyda compatibility #44

@NewGraphEnvironment

Description

@NewGraphEnvironment

Problem

Column names like blue_line_key, downstream_route_measure, upstream_route_measure are hardcoded throughout fresh. This ties fresh to FWA naming conventions. When spyda (#41) builds networks from other sources (LiDAR, other jurisdictions), those networks will use different column names for the same concepts.

Proposed Solution

Use options() with FWA defaults — set once per session, used everywhere. Consistent with the existing fresh.partition_table and fresh.partition_col pattern in .frs_resolve_aoi().

options(
  fresh.stream_table = "whse_basemapping.fwa_stream_networks_sp",
  fresh.blk_col = "blue_line_key",
  fresh.wscode_col = "wscode_ltree",
  fresh.localcode_col = "localcode_ltree",
  fresh.measure_ds_col = "downstream_route_measure",
  fresh.measure_us_col = "upstream_route_measure",
  fresh.segment_id_col = "linear_feature_id"
)

Internal helper to read these:

.frs_col <- function(name) {
  getOption(paste0("fresh.", name), default = .frs_defaults[[name]])
}

Scope

Cross-cutting — touches every function that generates SQL with column names:

  • frs_network*, frs_point_snap, frs_point_locate
  • frs_break*, frs_classify, frs_aggregate
  • frs_stream_fetch, frs_lake_fetch, frs_wetland_fetch
  • frs_fish_obs, frs_fish_habitat
  • Internal helpers (.frs_stream_guards, .frs_build_where, etc.)

Approach

Single PR after the habitat model functions (#36, #38, #39, #40) are complete. Do not mix with feature work.

Relates to #41

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions