Appendix - Salmon Stock Assessment Data
Fisheries and Oceans Canada stock assessment data was accessed via the NuSEDS-New Salmon Escapement Database System through the Open Government Portal with results presented in Table 5.1 (Fisheries and Oceans Canada, n.d.). A brief memo on the data extraction process is available here.
library("ckanr")
# set up the connection to the data portal
ckanr_setup(url = "https://open.canada.ca/data/en")
nuseds <- rgovcan::govcan_search(keywords = c("Fraser NuSEDS"), records = 150, format_results = TRUE) |>
pull(resources) %>%
bind_rows()
# Load the most recent Nuseds - currently 20251103 (update Nov 2025)
url <- "https://api-proxy.edh-cde.dfo-mpo.gc.ca/catalogue/records/c48669a3-045b-400d-b730-48aafe8c5ee6/attachments/All%20Areas%20NuSEDS_20251103.zip"
# burn directly without bringing into memory
nuseds_all_20251103.csv
ckanr::ckan_fetch(url, store = "disk", path = "data/inputs_raw/nuseds_all_20251103.zip")
# ignore the huge file
usethis::use_git_ignore("data/inputs_raw/nuseds_all_20251103.csv")
#read it in
all_area_nuseds <- readr::read_csv('data/inputs_raw/nuseds_all_20251103.csv')
form_pscis_2025 <- read.csv("~/Projects/repo/fish_passage_template_reporting/data/backup/2025/sern_fraser_2024/form_pscis_2025.csv")
# Big study area so lets filter using the stream names from `form_pscis`
stream_names <- form_pscis_2025 |>
dplyr::pull(stream_name) |>
stringr::str_trim() |>
# Must be upper case to match those in Nuseds
stringr::str_to_upper() |>
unique()
# we also need to add in these waterbodies that we didn't explicitly sample but are that heavy hitters in the project area
major_streams <- "NECHAKO|CHILAKO|ENDAKO|FRANÇOIS LAKE|FRASER RIVER|MORKILL RIVER|WILLOW RIVER|TABOR RIVER|SALMON RIVER"
# Combine into one regex pattern
stream_names_regex <- c(stream_names, major_streams) |>
stringr::str_c(collapse = "|")
# Filter Nuseds to just include streams we visited
study_area_streams <- all_area_nuseds |>
dplyr::filter(stringr::str_detect(WATERBODY, stream_names_regex)) |>
# We have some duplicate streams so remove streams with SHORE in the name which are in the Sushwap area
# also remove big and little salmon rivers becasue not in study area
dplyr::filter(!stringr::str_detect(WATERBODY, "SHORE|BIG|LITTLE")) |>
janitor::clean_names() |>
dplyr::arrange(waterbody)
check_names <- study_area_streams |>
dplyr::distinct(waterbody)
## Burn to csv. Updated name so it's clear this contains only the study area streams.
study_area_streams |>
readr::write_csv('data/inputs_raw/study_area_NuSEDS.csv')