Skip to contents

The per-ingest (Phase 3) entry point: after an ingest has built its per-dataset tables, emit_core_tables() projects that dataset into the shared core family — sample (via build_sample_reference(), which auto-detects the dataset's event tables present in con), plus its obs occurrence headline, obs_attribute sub-occurrence detail, and sample_measurement effort — using the same validated projection the release assembly uses. Idempotent per connection for a single dataset's tables. Arms for pic_zooplankton (no measurements) and calcofi_phytoplankton (region-pooled, no grid_key) contribute sample only.

Usage

emit_core_tables(con, dataset_key, sample = TRUE)

Arguments

con

a DuckDB connection holding this dataset's per-dataset tables

dataset_key

provider_dataset (e.g. "swfsc_ichthyo", "calcofi_bottle")

sample

logical; also (re)build sample from the present event tables (default TRUE)

Value

(invisibly) a named list of row counts for the core tables written

Details

The bio arms resolve taxon_key through dataset_taxon, which is built centrally by the release assembly (build_dataset_taxon()) rather than by each ingest. When that table is absent — the normal case inside an ingest — an empty stub is created so the projection still runs with taxon_key NULL and the release fills it in; without the stub the arm's LEFT JOIN raises a catalog error.