Skip to content

Commit dedf4d6

Browse files
langbartclaude
andauthored
Remove the dead, duplicate-keyed fetch_assets() (#20)
fetch_assets() built its result with `sites =` twice: the second entry fetched the `forms` table but stored it under `sites`. R keeps both entries and `$` returns the first, so `$forms` was unreachable and `$sites` silently resolved to landing_sites. The function has no callers — in coasts or in any downstream pipeline. ingest_assets() is the live producer of the assets snapshot and has a correct `forms =` entry. Mozambique and Kenya each carry their own local fetch_assets() with a single `sites`, so nothing resolves to this one. Delete it rather than fix the key: an exported, broken near-namesake of the function actually in use is a trap for the next caller. fetch_asset() (singular), which ingest_assets() calls nine times, is untouched. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent f33ca3b commit dedf4d6

3 files changed

Lines changed: 0 additions & 92 deletions

File tree

‎NAMESPACE‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ export(export_pds_spatial)
4343
export(export_portal)
4444
export(expr)
4545
export(fetch_asset)
46-
export(fetch_assets)
4746
export(fetch_track_for_prediction)
4847
export(generate_app_usage_report)
4948
export(generate_fleet_analysis)

‎R/airtable.R‎

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -668,64 +668,3 @@ fetch_asset <- function(
668668
janitor::clean_names() |>
669669
dplyr::select(dplyr::all_of(select_cols))
670670
}
671-
672-
#' Fetch Multiple Asset Tables from Airtable
673-
#'
674-
#' @description
675-
#' Fetches taxa, gear, vessels, and landing sites data from Airtable.
676-
#' Returns distinct records for each table.
677-
#'
678-
#' @param conf Configuration object from read_config().
679-
#'
680-
#' @return A named list containing four data frames:
681-
#' \itemize{
682-
#' \item \code{taxa}: Contains survey_label, alpha3_code, and scientific_name columns
683-
#' \item \code{gear}: Contains survey_label and standard_name columns
684-
#' \item \code{vessels}: Contains survey_label and standard_name columns
685-
#' \item \code{sites}: Contains site and site_code columns
686-
#' }
687-
#'
688-
#' @details
689-
#' Each table is fetched separately using `fetch_asset()` and filtered to return
690-
#' only distinct rows to avoid duplicates in the mapping tables.
691-
#'
692-
#' @keywords preprocessing helper
693-
#' @export
694-
fetch_assets <- function(conf = NULL) {
695-
assets_list <-
696-
list(
697-
taxa = fetch_asset(
698-
table_name = "taxa",
699-
select_cols = c(
700-
"form_id",
701-
"survey_label",
702-
"alpha3_code",
703-
"scientific_name",
704-
"english_name"
705-
),
706-
conf = conf
707-
),
708-
gear = fetch_asset(
709-
table_name = "gears",
710-
select_cols = c("form_id", "survey_label", "standard_name"),
711-
conf = conf
712-
),
713-
vessels = fetch_asset(
714-
table_name = "vessels",
715-
select_cols = c("form_id", "survey_label", "standard_name"),
716-
conf = conf
717-
),
718-
sites = fetch_asset(
719-
table_name = "landing_sites",
720-
select_cols = c("form_id", "site", "site_code"),
721-
conf = conf
722-
),
723-
sites = fetch_asset(
724-
table_name = "forms",
725-
select_cols = c("form_id", "form_name", "site_code"),
726-
conf = conf
727-
)
728-
)
729-
730-
purrr::map(assets_list, ~ dplyr::distinct(.x))
731-
}

‎man/fetch_assets.Rd‎

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)