CalCOFI.io CalCOFI.io Workflows

Publish every dataset as download bundles

One zip per dataset per format (CSV, Excel where it fits, Parquet), each carrying its README, citation and licence; rebuilt only when a dataset changed; upload gated

Author

CalCOFI

Published

2026-11-26

1 Overview

Researchers asked for a Download button that gives them a file they can open: CSV first, Excel where a table is small enough, the technical formats further down, and the citation and licence travelling inside every download. A dataset page already offers the release Parquet and a CF netCDF, and ERDDAP refuses a whole-table CSV, so none of those is that file. This notebook makes it, for every dataset in the promoted release, generic over dataset_key like publish_to-netcdf.qmd and publish_to-edi.qmd.

One zip per format, named so it is recognisable in Downloads: calcofi_{dataset_key}_{since}_{format}.zip (calcofi_bottle_v2026.11.14_csv.zip, calcofi_swfsc_ichthyo_v2026.11.14_xlsx.zip; the calcofi_ prefix is not doubled), where since is the release in which the package’s content last changed (never merely the release being published). Each unzips to one folder of the same name holding:

file what
README.md what the dataset is, who collected it, the release and its date, every file and its rows, how the tables join, what was left out and where to get it, the Explorer for a subset, the dataset’s page, register-your-use and stay-informed
CITATION.md, CITATION.bib the provider’s citation where there is one (said plainly where there is not), always the release’s with its DOI
LICENSE.txt the legal code for a recognised licence id; the provider’s terms URL for custom; a plain “no licence has been established” and whom to ask otherwise
columns.csv every column: table, type, units, meaning, from the release’s own metadata.json
the tables .csv, one .xlsx workbook (a README sheet first), or .parquet

Which tables, cut how (calcofi4db::bundle_plan(), one rule each, tested): the record’s own tables[] plus the shared tables a download needs to be used alone, sample, cruise, taxon and measurement_type; a table with a dataset_key keeps this dataset’s rows, sample also keeps the samples the dataset’s rows sit on (a derived product’s observations sit on the bottle or CTD casts) and their parents, a shared vocabulary keeps the rows reached through its key, and the full-resolution supplementals (obs_ctd_full, obs_mets_full: hundreds of millions of rows partitioned by cruise) are left out and named in the README. obs is read through the catalog’s own view over obs_bio and obs_env.

A row reads without a join (calcofi4db::bundle_build_tables()): beside sample_key the station the provider recorded (site_key) and its CalCOFI line and station, which a field scientist asked for; beside taxon_key the scientific_name and common_name; beside measurement_type its units. Geometry and H3 cell-id columns are left out (latitude and longitude stay; a 64-bit cell id does not survive a spreadsheet).

Excel only where it fits (calcofi4db::bundle_format_decision()): a workbook is made when every table fits an Excel sheet: at most 1,048,575 rows of data below the header row (BUNDLE_XLSX_MAX_ROWS, Excel’s own 1,048,576-row limit; no lower cap, by the owner’s decision of 2026-11-16); otherwise the manifest says why in plain words, and a CSV too long for a spreadsheet says so in its README.

Content-addressed, the release tables’ scheme (R/release.R in calcofi4db: one object per distinct content, content_hash its identity, since the release that first carried it, upload or exists, nothing deleted). Every release re-renders every publisher; for each dataset the identity is decided before anything is written: publish_fingerprint()’s content_hash over the row signatures of exactly the tables the package holds (the release’s own order-independent signatures, so a vocabulary row another dataset added changes nothing here), the metadata its documents carry (the dataset record minus what a release re-measures, the column and table descriptions) and the pinned CC_PUBLISH_FORMAT[["zip"]]; never the code and never the release version. A content the previous manifest already lists exists: nothing is built or uploaded and only the manifest’s checked_version moves. A new content is built at {dataset_key}/{content_hash[1:24]}/ and named for its since, so its README and citation name the release it was built from (whose DOI holds exactly these data) and say the data are identical in every later release that lists it. data_hash (the data alone) is recorded beside content_hash, so a package rebuilt for a metadata change reads as “same data, new file”. The zips are byte-reproducible (bundle_zip(): fixed member order, timestamp, mode and time zone; the workbook’s timestamp fixed too).

Upload gated, and the website’s contract. Everything is written under cc_stage_path("publish", "zip"); nothing leaves the machine unless CALCOFI_PUBLISH_ZIP=true (and never in a staging run). The upload puts each new zip at gs://calcofi-db/publish/zip/{dataset_key}/{hash24}/{file}, this release’s manifest at publish/zip/releases/{version}/manifest.json (the chain of them is the history) and the current one at gs://calcofi-db/publish/zip/manifest.json, which calcofi.io reads at build time, and which release_database.qmd passes to build_dataset_catalog(bundles = ) so the next release’s datasets.json carries a kind = "bundle" distribution per file (the newest built, as the netCDF manifests do).

2 Setup

Code
librarian::shelf(DBI, duckdb, dplyr, glue, jsonlite, digest, readr, tibble, knitr, here, quiet = TRUE)
here <- here::here
options(readr.show_col_types = FALSE)
# the engine package from its sibling checkout, as every publisher loads it; CALCOFI4DB_DIR points a
# worktree's render at that worktree's calcofi4db
PKG_DIR <- Sys.getenv("CALCOFI4DB_DIR", here("../calcofi4db"))
devtools::load_all(PKG_DIR)
stopifnot("calcofi4db >= 4.40.0 (bundle_plan) is required" = exists("bundle_plan"))

# the promoted release by default; a STAGING run (CALCOFI_RELEASE_PREFIX=ducklake-staging/releases)
# reads the staging release, writes under data/zip-staging/ and uploads nothing
RELEASE_PREFIX <- Sys.getenv("CALCOFI_RELEASE_PREFIX", "ducklake/releases")
STAGING        <- grepl("staging", RELEASE_PREFIX, fixed = TRUE)

# comma-separated dataset_keys to restrict a run while iterating; empty = every public dataset
ONLY <- Filter(nzchar, trimws(strsplit(Sys.getenv("CALCOFI_DATASETS", ""), ",")[[1]]))

# a PREVIEW run (the preview-release skill): a held dataset's zips for its private preview, read from
# its candidate release in the private bucket (CALCOFI_RELEASE_BUCKET=calcofi-preview,
# CALCOFI_RELEASE_PREFIX=ducklake-preview-<short>/releases, CALCOFI_DATASETS=<key>) with the caller's
# gcloud token, built whatever the record's visibility (a held record is `internal`), written under
# the stage root only (never data/zip/, the public manifest in git) and, with CALCOFI_PUBLISH_ZIP=true,
# uploaded beside the candidate at gs://calcofi-preview/<root>/publish/zip/, which the preview's data
# route serves. Nothing of it can reach calcofi-db: every path below is the candidate root's.
RELEASE_BUCKET <- Sys.getenv("CALCOFI_RELEASE_BUCKET", "calcofi-db")
PREVIEW        <- !identical(RELEASE_BUCKET, "calcofi-db")
PREVIEW_ROOT   <- sub("/releases$", "", RELEASE_PREFIX)
if (PREVIEW) stopifnot(
  "a preview zip run reads the private preview bucket only" =
    identical(RELEASE_BUCKET, Sys.getenv("CALCOFI_PREVIEW_BUCKET", "calcofi-preview")) &&
    !RELEASE_BUCKET %in% c("calcofi-db", "calcofi-files-public"),
  "a preview zip run names its candidate root (CALCOFI_RELEASE_PREFIX=ducklake-preview-<short>/releases)" =
    grepl("^ducklake-preview[a-z0-9-]*/releases$", RELEASE_PREFIX),
  "a preview zip run names the held dataset(s) it builds (CALCOFI_DATASETS)" = length(ONLY) > 0)
BASE_HTTPS <- glue("https://storage.googleapis.com/{RELEASE_BUCKET}")
# the private bucket answers only an authenticated read; the public one is read as before
GCS_TOKEN  <- if (PREVIEW) system2("gcloud", c("auth", "print-access-token"), stdout = TRUE)[1] else ""
gcs_handle <- function() {
  h <- curl::new_handle()
  if (nzchar(GCS_TOKEN)) curl::handle_setheaders(h, Authorization = paste("Bearer", GCS_TOKEN))
  h
}
get_text <- function(u) {
  if (!PREVIEW) return(paste(readLines(u, warn = FALSE), collapse = "\n"))
  r <- curl::curl_fetch_memory(u, handle = gcs_handle())
  if (r$status_code != 200) stop(glue("{u}: HTTP {r$status_code}"), call. = FALSE)
  rawToChar(r$content)
}

RELEASE_VERSION <- Sys.getenv("CALCOFI_RELEASE_VERSION", "")
if (!nzchar(RELEASE_VERSION))
  RELEASE_VERSION <- trimws(strsplit(get_text(glue("{BASE_HTTPS}/{RELEASE_PREFIX}/latest.txt")), "\n")[[1]][1])
Sys.setenv(CALCOFI_RELEASE_VERSION = RELEASE_VERSION)   # calcofi4r::cc_catalog() resolves the same one

PUBLISH    <- identical(Sys.getenv("CALCOFI_PUBLISH_ZIP"), "true") && !STAGING   # opt-in upload
NO_PUBLISH <- !PUBLISH

# bulk under the stage root, never in the git tree; the small manifests beside the notebook (a
# preview run keeps its manifests under the stage root too: data/zip/ is the public one)
STAGE_DIR <- if (PREVIEW) cc_stage_path("publish", "zip-preview", PREVIEW_ROOT, create = TRUE) else
  cc_stage_path("publish", if (STAGING) "zip-staging" else "zip", create = TRUE)
OBJ_CACHE <- cc_stage_path("publish", "objects", create = TRUE)   # release objects, content-addressed
OUT_DIR   <- if (PREVIEW) STAGE_DIR else here(if (STAGING) "data/zip-staging" else "data/zip")
dir.create(OUT_DIR, recursive = TRUE, showWarnings = FALSE)
ZIP_GCS   <- if (PREVIEW) glue("gs://{RELEASE_BUCKET}/{PREVIEW_ROOT}/publish/zip") else "gs://calcofi-db/publish/zip"
# where the manifest says each zip is: the public bucket's, or the candidate root's (the preview's
# site build rewrites that to its data route)
BUNDLE_BASE <- if (PREVIEW) glue("https://storage.googleapis.com/{RELEASE_BUCKET}/{PREVIEW_ROOT}/publish/zip") else CC_BUNDLE_BASE_URL
if (PREVIEW) stopifnot("a preview run's zips stay in the preview bucket" =
  startsWith(ZIP_GCS, glue("gs://{RELEASE_BUCKET}/ducklake-preview")) && !grepl("calcofi-db", ZIP_GCS, fixed = TRUE))
# the code the bundles are a function of: a change here rebuilds them
LIC_DIR    <- file.path(PKG_DIR, "inst", "licenses")
CODE_FILES <- c(here("publish_to-zip.qmd"), file.path(PKG_DIR, "R", "bundle.R"),
                sort(list.files(LIC_DIR, full.names = TRUE)))

cat(glue("release prefix : {RELEASE_BUCKET}/{RELEASE_PREFIX}{if (STAGING) ' (STAGING)' else if (PREVIEW) ' (PREVIEW: a held dataset, never public)' else ''}"), "\n")
release prefix : calcofi-db/ducklake/releases 
Code
cat(glue("release        : {RELEASE_VERSION}"), "\n")
release        : v2026.11.26 
Code
cat(glue("calcofi4db     : {PKG_DIR} ({as.character(utils::packageVersion('calcofi4db'))})"), "\n")
calcofi4db     : /Users/bbest/Github/CalCOFI/workflows/../calcofi4db (4.43.0) 
Code
cat(glue("stage (zips)   : {STAGE_DIR}"), "\n")
stage (zips)   : /Users/bbest/_big/calcofi/publish/zip 
Code
cat(glue("manifests      : {OUT_DIR}"), "\n")
manifests      : /Users/bbest/Github/CalCOFI/workflows/data/zip 
Code
cat(glue("CALCOFI_PUBLISH_ZIP : {PUBLISH} (upload to {ZIP_GCS}/ only when true)"), "\n")
CALCOFI_PUBLISH_ZIP : TRUE (upload to gs://calcofi-db/publish/zip/ only when true) 
Code
if (length(ONLY)) cat(glue("restricted to  : {paste(ONLY, collapse = ', ')}"), "\n")
Code
rel_url  <- function(f) glue("{BASE_HTTPS}/{RELEASE_PREFIX}/{RELEASE_VERSION}/{f}")
read_j   <- function(u) jsonlite::fromJSON(if (PREVIEW) get_text(u) else u, simplifyVector = FALSE)
# a preview's catalog is in the private bucket, which cc_catalog() cannot read unauthenticated
catalog  <- if (PREVIEW) read_j(rel_url("catalog.json")) else calcofi4r::cc_catalog(RELEASE_VERSION)
ds_json  <- read_j(rel_url("datasets.json"))
meta     <- read_j(rel_url("metadata.json"))
release  <- list(version = RELEASE_VERSION, release_date = catalog$release_date %||% NA,
                 citation = catalog$citation %||% NA, doi = catalog$doi %||% NA,
                 concept_doi = catalog$concept_doi %||% NA)
records  <- setNames(ds_json$datasets, vapply(ds_json$datasets, `[[`, "", "dataset_key"))
public   <- names(records)[vapply(records, function(r) identical(r$visibility %||% "public", "public"), TRUE)]
# a preview builds the held dataset(s) it names, whose record is not public by definition
keys     <- if (PREVIEW) intersect(names(records), ONLY) else if (length(ONLY)) intersect(public, ONLY) else public
if (PREVIEW) stopifnot("every dataset a preview names is in its candidate release" = length(keys) == length(ONLY))
if (length(ONLY) && length(setdiff(ONLY, public)))
  cat(glue("NOTE requested but not a public dataset of {RELEASE_VERSION}: {paste(setdiff(ONLY, public), collapse = ', ')}"), "\n")
cat(glue("{length(keys)} dataset(s) of {length(records)} in the release; ",
         "{length(ds_json$holdings %||% list())} holding(s) have no release data and get no bundle"), "\n")
20 dataset(s) of 20 in the release; 9 holding(s) have no release data and get no bundle 

A held dataset’s preview (the preview-release skill): with CALCOFI_RELEASE_BUCKET=calcofi-preview, CALCOFI_RELEASE_PREFIX=ducklake-preview-<short>/releases and CALCOFI_DATASETS=<key> the notebook reads that candidate release from the private bucket (the caller’s gcloud token), builds the named dataset whatever its record’s visibility, keeps every manifest under the stage root (never data/zip/, the public one) and uploads only to gs://calcofi-preview/<root>/publish/zip/, where the preview’s data route serves it; the preview’s site build reads that manifest. Such a render shows a held dataset’s numbers: it is never committed.

3 Read the release

Every table a bundle reads is resolved through the catalog (calcofi4r::cc_release_sources(), never a hand-built path) and its objects copied once into a content-addressed cache under the stage root, so twenty datasets do not read the same sample object over HTTPS twenty times, and an object unchanged since the previous release is never fetched again. obs is the catalog’s own view over obs_bio and obs_env (calcofi4r::cc_view_sql()).

Code
con <- get_duckdb_con()
for (s in c("SET enable_progress_bar = false", "SET preserve_insertion_order = true"))
  dbExecute(con, s)

cat_tables <- catalog$tables
cat_entry  <- function(tb) Find(function(t) identical(t$name, tb), cat_tables)
views      <- calcofi4r::cc_catalog_views(catalog)
supp       <- vapply(Filter(function(t) isTRUE(t$supplemental), cat_tables), `[[`, "", "name")
supp_rows  <- vapply(supp, function(tb) as.numeric(cat_entry(tb)$rows %||% NA), 1)

# every table some bundle may read: the records' tables plus the companions, minus supplementals
want <- setdiff(unique(c(unlist(lapply(records[keys], `[[`, "tables")), "sample", "cruise", "taxon",
                         "measurement_type")), supp)
fetch_local <- function(src) {
  paths <- file.path(OBJ_CACHE, src$local_paths)
  for (i in seq_along(paths)) {
    if (file.exists(paths[i])) next
    dir.create(dirname(paths[i]), recursive = TRUE, showWarnings = FALSE)
    part <- paste0(paths[i], ".part")
    curl::curl_download(src$urls[i], part, quiet = TRUE, handle = gcs_handle())
    file.rename(part, paths[i])
  }
  paths
}
rp <- function(tb) {
  src <- calcofi4r::cc_release_sources(catalog, tb, base_https = BASE_HTTPS)
  calcofi4r::cc_read_parquet_sql(src, paths = fetch_local(src))
}
t0 <- Sys.time()
from_sql <- setNames(vapply(want, function(tb) {
  if (tb %in% names(views)) paste0("(", calcofi4r::cc_view_sql(catalog, tb, rp), ")") else
  if (!is.null(cat_entry(tb))) rp(tb) else NA_character_
}, ""), want)
from_sql <- from_sql[!is.na(from_sql)]
table_columns <- lapply(from_sql, function(f) dbGetQuery(con, glue("DESCRIBE SELECT * FROM {f}"))$column_name)
cat(glue("{length(from_sql)} tables resolved and cached in {round(difftime(Sys.time(), t0, units = 'secs'))} s ",
         "({round(sum(file.size(list.files(OBJ_CACHE, recursive = TRUE, full.names = TRUE))) / 1e6)} MB in the object cache)"), "\n")
15 tables resolved and cached in 0 s (4808 MB in the object cache) 

4 The plan: every dataset, before anything is written

Code
plans <- lapply(setNames(keys, keys), function(k)
  bundle_plan(records[[k]], table_columns, supplemental = supp, supplemental_rows = supp_rows))
plan_tbl <- bind_rows(lapply(names(plans), function(k) plans[[k]] |> mutate(dataset_key = k, .before = 1)))
write_csv(plan_tbl, file.path(OUT_DIR, "plan.csv"), na = "")
kable(plan_tbl |> filter(!included | source == "record") |> select(dataset_key, table, rule, link, reason),
      caption = glue("tables each dataset names (companions sample/cruise/taxon/measurement_type are added where reached); {RELEASE_VERSION}"))
tables each dataset names (companions sample/cruise/taxon/measurement_type are added where reached); v2026.11.26
dataset_key table rule link reason
calcofi_2022-edna obs dataset_key NA this dataset’s rows
calcofi_2022-edna sample dataset_key_or_referenced NA this dataset’s samples and the samples its rows point at
calcofi_2022-edna dataset_taxon dataset_key NA this dataset’s rows
calcofi_2022-edna sample_measurement dataset_key NA this dataset’s rows
calcofi_2022-edna taxon linked taxon_key the rows this dataset reaches through taxon_key
calcofi_2022-edna measurement_type linked measurement_type the rows this dataset reaches through measurement_type
calcofi_bottle obs dataset_key NA this dataset’s rows
calcofi_bottle sample dataset_key_or_referenced NA this dataset’s samples and the samples its rows point at
calcofi_bottle sample_measurement dataset_key NA this dataset’s rows
calcofi_bottle measurement_type linked measurement_type the rows this dataset reaches through measurement_type
calcofi_bottle-derived obs dataset_key NA this dataset’s rows
calcofi_bottle-derived sample_measurement dataset_key NA this dataset’s rows
calcofi_bottle-derived measurement_type linked measurement_type the rows this dataset reaches through measurement_type
calcofi_ctd-cast obs dataset_key NA this dataset’s rows
calcofi_ctd-cast sample dataset_key_or_referenced NA this dataset’s samples and the samples its rows point at
calcofi_ctd-cast measurement_type linked measurement_type the rows this dataset reaches through measurement_type
calcofi_ctd-cast obs_ctd_full excluded NA full-resolution supplemental table (286,046,006 rows, partitioned by cruise, not by dataset): too large for a download; the observations at the release’s grain are in obs
calcofi_ctd-derived obs dataset_key NA this dataset’s rows
calcofi_ctd-derived sample_measurement dataset_key NA this dataset’s rows
calcofi_ctd-derived measurement_type linked measurement_type the rows this dataset reaches through measurement_type
calcofi_dic obs dataset_key NA this dataset’s rows
calcofi_dic sample dataset_key_or_referenced NA this dataset’s samples and the samples its rows point at
calcofi_dic measurement_type linked measurement_type the rows this dataset reaches through measurement_type
calcofi_mets obs dataset_key NA this dataset’s rows
calcofi_mets sample dataset_key_or_referenced NA this dataset’s samples and the samples its rows point at
calcofi_mets measurement_type linked measurement_type the rows this dataset reaches through measurement_type
calcofi_mets obs_mets_full excluded NA full-resolution supplemental table (19,926,523 rows, partitioned by cruise, not by dataset): too large for a download; the observations at the release’s grain are in obs
calcofi_phyllosoma obs dataset_key NA this dataset’s rows
calcofi_phyllosoma sample dataset_key_or_referenced NA this dataset’s samples and the samples its rows point at
calcofi_phyllosoma dataset_taxon dataset_key NA this dataset’s rows
calcofi_phyllosoma obs_attribute dataset_key NA this dataset’s rows
calcofi_phyllosoma taxon linked taxon_key the rows this dataset reaches through taxon_key
calcofi_phyllosoma measurement_type linked measurement_type the rows this dataset reaches through measurement_type
calcofi_phytoplankton obs dataset_key NA this dataset’s rows
calcofi_phytoplankton sample dataset_key_or_referenced NA this dataset’s samples and the samples its rows point at
calcofi_phytoplankton dataset_taxon dataset_key NA this dataset’s rows
calcofi_phytoplankton taxon linked taxon_key the rows this dataset reaches through taxon_key
calcofi_phytoplankton taxon_group linked taxon_key the rows this dataset reaches through taxon_key
calcofi_phytoplankton measurement_type linked measurement_type the rows this dataset reaches through measurement_type
calcofi_phytoplankton region whole NA small shared table, carried whole
cce-lter_euphausiids obs dataset_key NA this dataset’s rows
cce-lter_euphausiids sample dataset_key_or_referenced NA this dataset’s samples and the samples its rows point at
cce-lter_euphausiids dataset_taxon dataset_key NA this dataset’s rows
cce-lter_euphausiids taxon linked taxon_key the rows this dataset reaches through taxon_key
cce-lter_euphausiids measurement_type linked measurement_type the rows this dataset reaches through measurement_type
cce-lter_iron obs dataset_key NA this dataset’s rows
cce-lter_iron sample dataset_key_or_referenced NA this dataset’s samples and the samples its rows point at
cce-lter_iron measurement_type linked measurement_type the rows this dataset reaches through measurement_type
cce-lter_picoplankton-bacteria obs dataset_key NA this dataset’s rows
cce-lter_picoplankton-bacteria sample dataset_key_or_referenced NA this dataset’s samples and the samples its rows point at
cce-lter_picoplankton-bacteria dataset_taxon dataset_key NA this dataset’s rows
cce-lter_picoplankton-bacteria taxon linked taxon_key the rows this dataset reaches through taxon_key
cce-lter_picoplankton-bacteria measurement_type linked measurement_type the rows this dataset reaches through measurement_type
cce-lter_zoodb obs dataset_key NA this dataset’s rows
cce-lter_zoodb sample dataset_key_or_referenced NA this dataset’s samples and the samples its rows point at
cce-lter_zoodb dataset_taxon dataset_key NA this dataset’s rows
cce-lter_zoodb taxon linked taxon_key the rows this dataset reaches through taxon_key
cce-lter_zoodb measurement_type linked measurement_type the rows this dataset reaches through measurement_type
cce-lter_zooscan obs dataset_key NA this dataset’s rows
cce-lter_zooscan sample dataset_key_or_referenced NA this dataset’s samples and the samples its rows point at
cce-lter_zooscan dataset_taxon dataset_key NA this dataset’s rows
cce-lter_zooscan taxon linked taxon_key the rows this dataset reaches through taxon_key
cce-lter_zooscan measurement_type linked measurement_type the rows this dataset reaches through measurement_type
cdfw_dungeness-crab obs dataset_key NA this dataset’s rows
cdfw_dungeness-crab sample dataset_key_or_referenced NA this dataset’s samples and the samples its rows point at
cdfw_dungeness-crab dataset_taxon dataset_key NA this dataset’s rows
cdfw_dungeness-crab obs_attribute dataset_key NA this dataset’s rows
cdfw_dungeness-crab sample_measurement dataset_key NA this dataset’s rows
cdfw_dungeness-crab taxon linked taxon_key the rows this dataset reaches through taxon_key
farallon_bird-mammal obs dataset_key NA this dataset’s rows
farallon_bird-mammal sample dataset_key_or_referenced NA this dataset’s samples and the samples its rows point at
farallon_bird-mammal dataset_taxon dataset_key NA this dataset’s rows
farallon_bird-mammal obs_attribute dataset_key NA this dataset’s rows
farallon_bird-mammal taxon linked taxon_key the rows this dataset reaches through taxon_key
farallon_bird-mammal taxon_group linked taxon_key the rows this dataset reaches through taxon_key
sio_mesopelagic-fish obs dataset_key NA this dataset’s rows
sio_mesopelagic-fish sample dataset_key_or_referenced NA this dataset’s samples and the samples its rows point at
sio_mesopelagic-fish dataset_taxon dataset_key NA this dataset’s rows
sio_mesopelagic-fish taxon linked taxon_key the rows this dataset reaches through taxon_key
sio_mesopelagic-fish measurement_type linked measurement_type the rows this dataset reaches through measurement_type
sio_pic-zooplankton sample dataset_key_or_referenced NA this dataset’s samples and the samples its rows point at
swfsc_cufes obs dataset_key NA this dataset’s rows
swfsc_cufes sample dataset_key_or_referenced NA this dataset’s samples and the samples its rows point at
swfsc_cufes dataset_taxon dataset_key NA this dataset’s rows
swfsc_cufes taxon linked taxon_key the rows this dataset reaches through taxon_key
swfsc_cufes measurement_type linked measurement_type the rows this dataset reaches through measurement_type
swfsc_ichthyo obs dataset_key NA this dataset’s rows
swfsc_ichthyo sample dataset_key_or_referenced NA this dataset’s samples and the samples its rows point at
swfsc_ichthyo dataset_taxon dataset_key NA this dataset’s rows
swfsc_ichthyo obs_attribute dataset_key NA this dataset’s rows
swfsc_ichthyo sample_measurement dataset_key NA this dataset’s rows
swfsc_ichthyo fish linked sample_key the rows this dataset reaches through sample_key
swfsc_ichthyo ichthyo_net linked sample_key the rows this dataset reaches through sample_key
swfsc_ichthyo taxon linked taxon_key the rows this dataset reaches through taxon_key
swfsc_ichthyo cruise linked cruise_key the rows this dataset reaches through cruise_key
swfsc_ichthyo grid linked grid_key the rows this dataset reaches through grid_key
swfsc_ichthyo ship linked ship_key the rows this dataset reaches through ship_key
swfsc_ichthyo lookup whole NA small shared table, carried whole

5 Build, or reuse what did not change

Code
# the previous manifest: this machine's last run, else what the bucket serves (a staging run
# never reads the bucket's). A schema-1.0 entry has no content_hash, so every dataset it lists
# is new content to this scheme once.
read_prior <- function() {
  p <- file.path(OUT_DIR, "manifest.json")
  m <- if (file.exists(p)) tryCatch(jsonlite::fromJSON(p, simplifyVector = FALSE), error = function(e) NULL) else
    if (!STAGING && !PREVIEW) fetch_bundle_manifest()
  setNames(m$datasets %||% list(), vapply(m$datasets %||% list(), `[[`, "", "dataset_key"))
}
prior_all  <- read_prior()
code_parts <- publish_code_parts(CODE_FILES)
cols_meta  <- meta$columns %||% list()
tbls_meta  <- meta$tables %||% list()
entries <- list(); runs <- list()

for (k in keys) {
  t0   <- Sys.time()
  rec  <- records[[k]]
  plan <- plans[[k]]
  built <- bundle_build_tables(con, plan, k, from_sql)
  # the identity, decided BEFORE anything is written: the bundle's own rows (the release's
  # row signatures), the metadata its documents carry and the pinned format, never the code
  # or the release version (calcofi4db::publish_fingerprint(), the release tables' scheme)
  fp <- publish_fingerprint(
    data     = bundle_table_signatures(con, built$table),
    metadata = list(
      record  = publish_record_digest(rec),   # minus what a release re-measures
      columns = cols_meta[sub("\\..*$", "", names(cols_meta)) %in% built$table],
      tables  = tbls_meta[intersect(built$table, names(tbls_meta))],
      plan    = plan[, c("table", "included", "rule", "link", "reason")],
      built   = built[, c("table", "dropped", "added")]),
    code     = code_parts,
    format   = CC_PUBLISH_FORMAT[["zip"]])
  prior <- prior_all[[k]]
  same  <- identical(prior$content_hash %||% "", fp$content_hash)
  if (same) {
    # exists: the object (and its since) is the previous one; only the manifest's release moves
    e <- prior
    e$checked_version <- RELEASE_VERSION
    action <- "exists"
    cat(glue("- `{k}`: content {substr(fp$content_hash, 1, 12)} unchanged since {e$since %||% e$version} — ",
             "nothing written"), "\n")
  } else {
    obj_dir <- file.path(STAGE_DIR, k, substr(fp$content_hash, 1, 24))   # publish/zip/{key}/{hash24}/
    w <- write_bundle(con, rec, release, built, plan, obj_dir,
                      meta_columns = cols_meta, meta_tables = tbls_meta, licenses_dir = LIC_DIR)
    lic <- bundle_license(rec, LIC_DIR); cit <- bundle_citation(rec, release)
    e <- bundle_manifest_entry(rec, RELEASE_VERSION, release$release_date, RELEASE_VERSION, fp, built, plan, w,
                               license_kind = lic$kind, has_provider_citation = cit$has_provider_citation,
                               base_url = BUNDLE_BASE)
    action <- "upload"
    why <- if (is.null(prior)) "no previous package" else if (is.null(prior$content_hash))
      "first content-addressed build" else if (identical(prior$data_hash %||% "", fp$data_hash))
      "same data, its metadata or format changed" else "the data changed"
    cat(glue("- `{k}`: new content {substr(fp$content_hash, 1, 12)} ({why}); ",
             "{paste(sprintf('%s %s MB', w$format[w$written], format(round(w$bytes[w$written] / 1e6, 1), nsmall = 1)), collapse = ', ')}"), "\n")
  }
  for (tb in built$table) dbExecute(con, glue('DROP TABLE IF EXISTS "bundle_{tb}"'))
  entries[[k]] <- e
  runs[[k]] <- tibble(dataset_key = k, action = action,
                      changed = if (same) "" else paste(changed_inputs(fp, list(parts = as.list(unlist(prior$input_fingerprint$parts)))), collapse = ","),
                      secs = round(as.numeric(difftime(Sys.time(), t0, units = "secs"))))
}
  • calcofi_2022-edna: content 8ca7d86c1302 unchanged since v2026.11.26 — nothing written
  • calcofi_bottle: content d85c6b09030f unchanged since v2026.11.26 — nothing written
  • calcofi_bottle-derived: content 5540298c0b02 unchanged since v2026.11.26 — nothing written
  • calcofi_ctd-cast: content 8553e7eacc5e unchanged since v2026.11.26 — nothing written
  • calcofi_ctd-derived: content fcc1b358a422 unchanged since v2026.11.26 — nothing written
  • calcofi_dic: content 3255f44d53cd unchanged since v2026.11.26 — nothing written
  • calcofi_mets: content 5723b8ff98f9 unchanged since v2026.11.26 — nothing written
  • calcofi_phyllosoma: content 982fa2ba8227 unchanged since v2026.11.26 — nothing written
  • calcofi_phytoplankton: content 54dcd1ea58b2 unchanged since v2026.11.26 — nothing written
  • cce-lter_euphausiids: content cf4e8e6bdaeb unchanged since v2026.11.26 — nothing written
  • cce-lter_iron: content a2ee37f1e5c0 unchanged since v2026.11.26 — nothing written
  • cce-lter_picoplankton-bacteria: content 3e3fe72803ad unchanged since v2026.11.26 — nothing written
  • cce-lter_zoodb: content 32f73bab464c unchanged since v2026.11.26 — nothing written
  • cce-lter_zooscan: content aecf647ea3e3 unchanged since v2026.11.26 — nothing written
  • cdfw_dungeness-crab: content 21decc0718ab unchanged since v2026.11.26 — nothing written
  • farallon_bird-mammal: content a39c13c411be unchanged since v2026.11.26 — nothing written
  • sio_mesopelagic-fish: content 380d0635fd57 unchanged since v2026.11.26 — nothing written
  • sio_pic-zooplankton: content 3aabab5cbf55 unchanged since v2026.11.26 — nothing written
  • swfsc_cufes: content afaf57739189 unchanged since v2026.11.26 — nothing written
  • swfsc_ichthyo: content 8019426406d5 unchanged since v2026.11.26 — nothing written

6 The manifest: what the website reads

data/zip/manifest.json (and the same file beside the zips) is the contract with calcofi.io (schema 1.1): one entry per dataset with its since (also version, for a 1.0 reader), the release it was last confirmed against (checked_version), its content_hash and data_hash, the licence kind, whether the provider gave a citation, every table’s rows, what was left out, and per format either the file (url, bytes, sha256, excel_openable) or, for a format not offered, the reason in plain words. It carries no clock time, so an unchanged run rewrites it byte for byte. manifest.csv is the same per dataset × format, with whether the bucket already holds those bytes.

Code
manifest <- list(schema_version = "1.1", generated_by = "publish_to-zip.qmd",
                 release = RELEASE_VERSION, base_url = BUNDLE_BASE,
                 datasets = unname(entries[sort(names(entries))]))
man_json <- jsonlite::toJSON(manifest, auto_unbox = TRUE, pretty = TRUE, null = "null", na = "null", digits = NA)
writeLines(man_json, file.path(OUT_DIR, "manifest.json"))
writeLines(man_json, file.path(STAGE_DIR, "manifest.json"))
# this release's manifest is kept beside the others: the chain of them is each package's history,
# as the chain of catalog.json is each release table's
dir.create(file.path(STAGE_DIR, "releases", RELEASE_VERSION), recursive = TRUE, showWarnings = FALSE)
writeLines(man_json, file.path(STAGE_DIR, "releases", RELEASE_VERSION, "manifest.json"))

# what the bucket holds now, for the upload status
remote <- if (STAGING) NULL else if (PREVIEW)
  tryCatch(read_j(glue("https://storage.googleapis.com/{sub('^gs://', '', ZIP_GCS)}/manifest.json")), error = function(e) NULL) else
  fetch_bundle_manifest()
remote_of <- function(k, f) {
  e <- Filter(function(x) identical(x$dataset_key, k), remote$datasets %||% list())
  if (!length(e)) return(list(sha256 = NA_character_, version = NA_character_))
  b <- Filter(function(x) identical(x$format, f), e[[1]]$bundles %||% list())
  list(sha256 = if (length(b)) b[[1]]$sha256 %||% NA_character_ else NA_character_, version = e[[1]]$version)
}
man_tbl <- bind_rows(lapply(entries, function(e) bind_rows(lapply(e$bundles, function(b) {
  r <- remote_of(e$dataset_key, b$format)
  main <- if (length(e$tables)) e$tables[[1]] else list(table = NA, rows = NA)
  tibble(dataset_key = e$dataset_key, format = b$format, written = isTRUE(b$written),
         version = e$version, checked_version = e$checked_version,
         action = runs[[e$dataset_key]]$action, main_table = main$table, main_rows = main$rows,
         file = b$file %||% NA_character_, path = b$path %||% NA_character_,
         bytes = b$bytes %||% NA_real_, sha256 = b$sha256 %||% NA_character_,
         excel_openable = isTRUE(b$excel_openable), reason = b$reason %||% "",
         license_kind = e$license_kind, uploaded_hash = r$sha256, uploaded_version = r$version)
})))) |>
  mutate(publish_upload_status(ifelse(written, sha256, NA_character_), uploaded_hash, uploaded_version))
write_csv(man_tbl, file.path(OUT_DIR, "manifest.csv"), na = "")
kable(man_tbl |> mutate(MB = round(bytes / 1e6, 1)) |>
        select(dataset_key, format, written, MB, main_table, main_rows, excel_openable, version, action, upload_status),
      caption = glue("data/zip/manifest.csv — {sum(man_tbl$written)} zip(s) for {length(entries)} dataset(s)"))
data/zip/manifest.csv — 56 zip(s) for 20 dataset(s)
dataset_key format written MB main_table main_rows excel_openable version action upload_status
calcofi_2022-edna csv TRUE 0.0 obs 148 TRUE v2026.11.26 exists current
calcofi_2022-edna xlsx TRUE 0.1 obs 148 TRUE v2026.11.26 exists current
calcofi_2022-edna parquet TRUE 0.0 obs 148 FALSE v2026.11.26 exists current
calcofi_bottle csv TRUE 121.5 obs 11135334 FALSE v2026.11.26 exists current
calcofi_bottle xlsx FALSE NA obs 11135334 FALSE v2026.11.26 exists not built
calcofi_bottle parquet TRUE 46.5 obs 11135334 FALSE v2026.11.26 exists current
calcofi_bottle-derived csv TRUE 43.1 obs 1683308 FALSE v2026.11.26 exists current
calcofi_bottle-derived xlsx FALSE NA obs 1683308 FALSE v2026.11.26 exists not built
calcofi_bottle-derived parquet TRUE 23.0 obs 1683308 FALSE v2026.11.26 exists current
calcofi_ctd-cast csv TRUE 194.7 obs 19064356 FALSE v2026.11.26 exists current
calcofi_ctd-cast xlsx FALSE NA obs 19064356 FALSE v2026.11.26 exists not built
calcofi_ctd-cast parquet TRUE 83.2 obs 19064356 FALSE v2026.11.26 exists current
calcofi_ctd-derived csv TRUE 38.8 obs 2026530 FALSE v2026.11.26 exists current
calcofi_ctd-derived xlsx FALSE NA obs 2026530 FALSE v2026.11.26 exists not built
calcofi_ctd-derived parquet TRUE 23.5 obs 2026530 FALSE v2026.11.26 exists current
calcofi_dic csv TRUE 0.4 obs 16389 TRUE v2026.11.26 exists current
calcofi_dic xlsx TRUE 1.4 obs 16389 TRUE v2026.11.26 exists current
calcofi_dic parquet TRUE 0.4 obs 16389 FALSE v2026.11.26 exists current
calcofi_mets csv TRUE 13.0 obs 511395 TRUE v2026.11.26 exists current
calcofi_mets xlsx TRUE 36.4 obs 511395 TRUE v2026.11.26 exists current
calcofi_mets parquet TRUE 11.0 obs 511395 FALSE v2026.11.26 exists current
calcofi_phyllosoma csv TRUE 0.1 obs 1859 TRUE v2026.11.26 exists current
calcofi_phyllosoma xlsx TRUE 0.3 obs 1859 TRUE v2026.11.26 exists current
calcofi_phyllosoma parquet TRUE 0.1 obs 1859 FALSE v2026.11.26 exists current
calcofi_phytoplankton csv TRUE 2.2 obs 155553 TRUE v2026.11.26 exists current
calcofi_phytoplankton xlsx TRUE 9.0 obs 155553 TRUE v2026.11.26 exists current
calcofi_phytoplankton parquet TRUE 0.2 obs 155553 FALSE v2026.11.26 exists current
cce-lter_euphausiids csv TRUE 1.5 obs 100505 TRUE v2026.11.26 exists current
cce-lter_euphausiids xlsx TRUE 7.4 obs 100505 TRUE v2026.11.26 exists current
cce-lter_euphausiids parquet TRUE 0.8 obs 100505 FALSE v2026.11.26 exists current
cce-lter_iron csv TRUE 0.0 obs 170 TRUE v2026.11.26 exists current
cce-lter_iron xlsx TRUE 0.0 obs 170 TRUE v2026.11.26 exists current
cce-lter_iron parquet TRUE 0.0 obs 170 FALSE v2026.11.26 exists current
cce-lter_picoplankton-bacteria csv TRUE 1.2 obs 60802 TRUE v2026.11.26 exists current
cce-lter_picoplankton-bacteria xlsx TRUE 4.9 obs 60802 TRUE v2026.11.26 exists current
cce-lter_picoplankton-bacteria parquet TRUE 0.5 obs 60802 FALSE v2026.11.26 exists current
cce-lter_zoodb csv TRUE 0.3 obs 30948 TRUE v2026.11.26 exists current
cce-lter_zoodb xlsx TRUE 1.5 obs 30948 TRUE v2026.11.26 exists current
cce-lter_zoodb parquet TRUE 0.1 obs 30948 FALSE v2026.11.26 exists current
cce-lter_zooscan csv TRUE 1.4 obs 126692 TRUE v2026.11.26 exists current
cce-lter_zooscan xlsx TRUE 9.5 obs 126692 TRUE v2026.11.26 exists current
cce-lter_zooscan parquet TRUE 0.5 obs 126692 FALSE v2026.11.26 exists current
cdfw_dungeness-crab csv TRUE 0.1 obs 1456 TRUE v2026.11.26 exists current
cdfw_dungeness-crab xlsx TRUE 0.2 obs 1456 TRUE v2026.11.26 exists current
cdfw_dungeness-crab parquet TRUE 0.1 obs 1456 FALSE v2026.11.26 exists current
farallon_bird-mammal csv TRUE 3.2 obs 69661 TRUE v2026.11.26 exists current
farallon_bird-mammal xlsx TRUE 12.0 obs 69661 TRUE v2026.11.26 exists current
farallon_bird-mammal parquet TRUE 1.8 obs 69661 FALSE v2026.11.26 exists current
sio_mesopelagic-fish csv TRUE 0.0 obs 1393 TRUE v2026.11.26 exists current
sio_mesopelagic-fish xlsx TRUE 0.1 obs 1393 TRUE v2026.11.26 exists current
sio_mesopelagic-fish parquet TRUE 0.0 obs 1393 FALSE v2026.11.26 exists current
sio_pic-zooplankton csv TRUE 2.4 sample 82343 TRUE v2026.11.26 exists current
sio_pic-zooplankton xlsx TRUE 6.3 sample 82343 TRUE v2026.11.26 exists current
sio_pic-zooplankton parquet TRUE 1.2 sample 82343 FALSE v2026.11.26 exists current
swfsc_cufes csv TRUE 7.6 obs 550162 TRUE v2026.11.26 exists current
swfsc_cufes xlsx TRUE 37.5 obs 550162 TRUE v2026.11.26 exists current
swfsc_cufes parquet TRUE 3.2 obs 550162 FALSE v2026.11.26 exists current
swfsc_ichthyo csv TRUE 29.2 obs 487616 TRUE v2026.11.26 exists current
swfsc_ichthyo xlsx TRUE 105.0 obs 487616 TRUE v2026.11.26 exists current
swfsc_ichthyo parquet TRUE 13.1 obs 487616 FALSE v2026.11.26 exists current
Code
sk <- man_tbl |> filter(!written)
if (nrow(sk)) kable(sk |> select(dataset_key, format, reason), caption = "formats not offered, and why") else
  cat("every format was offered for every dataset\n")
formats not offered, and why
dataset_key format reason
calcofi_bottle xlsx Not offered as an Excel workbook: its largest table, obs, has 11,135,334 rows, more than an Excel sheet holds (1,048,576 rows including the header row). Use the CSV download, or take a subset from the Explorer.
calcofi_bottle-derived xlsx Not offered as an Excel workbook: its largest table, obs, has 1,683,308 rows, more than an Excel sheet holds (1,048,576 rows including the header row). Use the CSV download, or take a subset from the Explorer.
calcofi_ctd-cast xlsx Not offered as an Excel workbook: its largest table, obs, has 19,064,356 rows, more than an Excel sheet holds (1,048,576 rows including the header row). Use the CSV download, or take a subset from the Explorer.
calcofi_ctd-derived xlsx Not offered as an Excel workbook: its largest table, obs, has 2,026,530 rows, more than an Excel sheet holds (1,048,576 rows including the header row). Use the CSV download, or take a subset from the Explorer.

7 Check the zips

For every bundle built in this run: each zip opens, holds one folder named like it with the five documents and one data file per table, and the observations it carries are the count the release’s own record measured for the dataset (coverage.n_obs), an independent tally.

Code
chk <- bind_rows(lapply(entries, function(e) {
  k <- e$dataset_key
  if (runs[[k]]$action != "upload") return(NULL)
  n_obs <- records[[k]]$coverage$n_obs %||% NA
  bind_rows(lapply(Filter(function(b) isTRUE(b$written), e$bundles), function(b) {
    zl <- zip::zip_list(file.path(STAGE_DIR, sub("^publish/zip/", "", b$path)))
    stem <- sub("\\.zip$", "", b$file)
    docs <- paste0(stem, "/", c("README.md", "CITATION.md", "CITATION.bib", "LICENSE.txt", "columns.csv"))
    data_files <- if (b$format == "xlsx") paste0(stem, "/", stem, ".xlsx") else
      paste0(stem, "/", vapply(e$tables, `[[`, "", "table"), ".", b$format)
    obs_rows <- b$rows$obs %||% 0
    tibble(dataset_key = k, format = b$format, members = nrow(zl),
           docs_ok = all(docs %in% zl$filename), data_ok = all(data_files %in% zl$filename),
           one_folder = all(startsWith(zl$filename, paste0(stem, "/"))),
           obs_rows = obs_rows, record_n_obs = n_obs,
           obs_ok = is.na(n_obs) || identical(as.numeric(obs_rows), as.numeric(n_obs)))
  }))
}))
if (nrow(chk)) {
  kable(chk, caption = "structure of every zip built in this run")
  bad <- chk |> filter(!docs_ok | !data_ok | !one_folder | !obs_ok)
  stopifnot("every bundle must hold its documents, its tables and the release's observation count" = nrow(bad) == 0)
} else cat("no bundle was built in this run (every dataset reused)\n")
no bundle was built in this run (every dataset reused)

8 Upload (gated)

Only new content is uploaded, each zip to its own content-addressed path gs://calcofi-db/publish/zip/{dataset_key}/{hash24}/{file} (an object that already exists is never written again), then this release’s manifest and manifest.json. Nothing is deleted: a package a newer content replaced stays at its path, and the release manifests that listed it say when it was current.

Code
# every current object is offered: put_gcs_file() compares md5s, so one already in the bucket
# costs a HEAD and is never re-uploaded, while one this machine built in a dry run still goes up
# (the decision is against what is published, as freeze_plan()'s is against the last catalog)
up <- man_tbl |> filter(written)
for (i in seq_len(nrow(up))) {
  b <- Filter(function(x) identical(x$format, up$format[i]), entries[[up$dataset_key[i]]]$bundles)[[1]]
  put_gcs_file(file.path(STAGE_DIR, sub("^publish/zip/", "", b$path)), glue("{ZIP_GCS}/{sub('^publish/zip/', '', b$path)}"),
               content_type = "application/zip")
  cat(glue("uploaded {b$path}"), "\n")
}
uploaded publish/zip/calcofi_2022-edna/8ca7d86c13020933a4938141/calcofi_2022-edna_v2026.11.26_csv.zip 
uploaded publish/zip/calcofi_2022-edna/8ca7d86c13020933a4938141/calcofi_2022-edna_v2026.11.26_xlsx.zip 
uploaded publish/zip/calcofi_2022-edna/8ca7d86c13020933a4938141/calcofi_2022-edna_v2026.11.26_parquet.zip 
uploaded publish/zip/calcofi_bottle/d85c6b09030f93b78b21748c/calcofi_bottle_v2026.11.26_csv.zip 
uploaded publish/zip/calcofi_bottle/d85c6b09030f93b78b21748c/calcofi_bottle_v2026.11.26_parquet.zip 
uploaded publish/zip/calcofi_bottle-derived/5540298c0b02de98289ba883/calcofi_bottle-derived_v2026.11.26_csv.zip 
uploaded publish/zip/calcofi_bottle-derived/5540298c0b02de98289ba883/calcofi_bottle-derived_v2026.11.26_parquet.zip 
uploaded publish/zip/calcofi_ctd-cast/8553e7eacc5ea1bcac4da4b9/calcofi_ctd-cast_v2026.11.26_csv.zip 
uploaded publish/zip/calcofi_ctd-cast/8553e7eacc5ea1bcac4da4b9/calcofi_ctd-cast_v2026.11.26_parquet.zip 
uploaded publish/zip/calcofi_ctd-derived/fcc1b358a422aae8a3e7617b/calcofi_ctd-derived_v2026.11.26_csv.zip 
uploaded publish/zip/calcofi_ctd-derived/fcc1b358a422aae8a3e7617b/calcofi_ctd-derived_v2026.11.26_parquet.zip 
uploaded publish/zip/calcofi_dic/3255f44d53cdaf8bd0d4a688/calcofi_dic_v2026.11.26_csv.zip 
uploaded publish/zip/calcofi_dic/3255f44d53cdaf8bd0d4a688/calcofi_dic_v2026.11.26_xlsx.zip 
uploaded publish/zip/calcofi_dic/3255f44d53cdaf8bd0d4a688/calcofi_dic_v2026.11.26_parquet.zip 
uploaded publish/zip/calcofi_mets/5723b8ff98f92e47ee9b3721/calcofi_mets_v2026.11.26_csv.zip 
uploaded publish/zip/calcofi_mets/5723b8ff98f92e47ee9b3721/calcofi_mets_v2026.11.26_xlsx.zip 
uploaded publish/zip/calcofi_mets/5723b8ff98f92e47ee9b3721/calcofi_mets_v2026.11.26_parquet.zip 
uploaded publish/zip/calcofi_phyllosoma/982fa2ba8227c6c61a326440/calcofi_phyllosoma_v2026.11.26_csv.zip 
uploaded publish/zip/calcofi_phyllosoma/982fa2ba8227c6c61a326440/calcofi_phyllosoma_v2026.11.26_xlsx.zip 
uploaded publish/zip/calcofi_phyllosoma/982fa2ba8227c6c61a326440/calcofi_phyllosoma_v2026.11.26_parquet.zip 
uploaded publish/zip/calcofi_phytoplankton/54dcd1ea58b246824b1d97c5/calcofi_phytoplankton_v2026.11.26_csv.zip 
uploaded publish/zip/calcofi_phytoplankton/54dcd1ea58b246824b1d97c5/calcofi_phytoplankton_v2026.11.26_xlsx.zip 
uploaded publish/zip/calcofi_phytoplankton/54dcd1ea58b246824b1d97c5/calcofi_phytoplankton_v2026.11.26_parquet.zip 
uploaded publish/zip/cce-lter_euphausiids/cf4e8e6bdaebf1ba120da529/calcofi_cce-lter_euphausiids_v2026.11.26_csv.zip 
uploaded publish/zip/cce-lter_euphausiids/cf4e8e6bdaebf1ba120da529/calcofi_cce-lter_euphausiids_v2026.11.26_xlsx.zip 
uploaded publish/zip/cce-lter_euphausiids/cf4e8e6bdaebf1ba120da529/calcofi_cce-lter_euphausiids_v2026.11.26_parquet.zip 
uploaded publish/zip/cce-lter_iron/a2ee37f1e5c0d977da84a2d5/calcofi_cce-lter_iron_v2026.11.26_csv.zip 
uploaded publish/zip/cce-lter_iron/a2ee37f1e5c0d977da84a2d5/calcofi_cce-lter_iron_v2026.11.26_xlsx.zip 
uploaded publish/zip/cce-lter_iron/a2ee37f1e5c0d977da84a2d5/calcofi_cce-lter_iron_v2026.11.26_parquet.zip 
uploaded publish/zip/cce-lter_picoplankton-bacteria/3e3fe72803adfa90dc2ab618/calcofi_cce-lter_picoplankton-bacteria_v2026.11.26_csv.zip 
uploaded publish/zip/cce-lter_picoplankton-bacteria/3e3fe72803adfa90dc2ab618/calcofi_cce-lter_picoplankton-bacteria_v2026.11.26_xlsx.zip 
uploaded publish/zip/cce-lter_picoplankton-bacteria/3e3fe72803adfa90dc2ab618/calcofi_cce-lter_picoplankton-bacteria_v2026.11.26_parquet.zip 
uploaded publish/zip/cce-lter_zoodb/32f73bab464cbe43ff3ddee0/calcofi_cce-lter_zoodb_v2026.11.26_csv.zip 
uploaded publish/zip/cce-lter_zoodb/32f73bab464cbe43ff3ddee0/calcofi_cce-lter_zoodb_v2026.11.26_xlsx.zip 
uploaded publish/zip/cce-lter_zoodb/32f73bab464cbe43ff3ddee0/calcofi_cce-lter_zoodb_v2026.11.26_parquet.zip 
uploaded publish/zip/cce-lter_zooscan/aecf647ea3e371feb2676de9/calcofi_cce-lter_zooscan_v2026.11.26_csv.zip 
uploaded publish/zip/cce-lter_zooscan/aecf647ea3e371feb2676de9/calcofi_cce-lter_zooscan_v2026.11.26_xlsx.zip 
uploaded publish/zip/cce-lter_zooscan/aecf647ea3e371feb2676de9/calcofi_cce-lter_zooscan_v2026.11.26_parquet.zip 
uploaded publish/zip/cdfw_dungeness-crab/21decc0718abc3d8179dec27/calcofi_cdfw_dungeness-crab_v2026.11.26_csv.zip 
uploaded publish/zip/cdfw_dungeness-crab/21decc0718abc3d8179dec27/calcofi_cdfw_dungeness-crab_v2026.11.26_xlsx.zip 
uploaded publish/zip/cdfw_dungeness-crab/21decc0718abc3d8179dec27/calcofi_cdfw_dungeness-crab_v2026.11.26_parquet.zip 
uploaded publish/zip/farallon_bird-mammal/a39c13c411be23a310ef266f/calcofi_farallon_bird-mammal_v2026.11.26_csv.zip 
uploaded publish/zip/farallon_bird-mammal/a39c13c411be23a310ef266f/calcofi_farallon_bird-mammal_v2026.11.26_xlsx.zip 
uploaded publish/zip/farallon_bird-mammal/a39c13c411be23a310ef266f/calcofi_farallon_bird-mammal_v2026.11.26_parquet.zip 
uploaded publish/zip/sio_mesopelagic-fish/380d0635fd577bf50274b0ef/calcofi_sio_mesopelagic-fish_v2026.11.26_csv.zip 
uploaded publish/zip/sio_mesopelagic-fish/380d0635fd577bf50274b0ef/calcofi_sio_mesopelagic-fish_v2026.11.26_xlsx.zip 
uploaded publish/zip/sio_mesopelagic-fish/380d0635fd577bf50274b0ef/calcofi_sio_mesopelagic-fish_v2026.11.26_parquet.zip 
uploaded publish/zip/sio_pic-zooplankton/3aabab5cbf55ce9f684d7a3d/calcofi_sio_pic-zooplankton_v2026.11.26_csv.zip 
uploaded publish/zip/sio_pic-zooplankton/3aabab5cbf55ce9f684d7a3d/calcofi_sio_pic-zooplankton_v2026.11.26_xlsx.zip 
uploaded publish/zip/sio_pic-zooplankton/3aabab5cbf55ce9f684d7a3d/calcofi_sio_pic-zooplankton_v2026.11.26_parquet.zip 
uploaded publish/zip/swfsc_cufes/afaf5773918983ba4d91be44/calcofi_swfsc_cufes_v2026.11.26_csv.zip 
uploaded publish/zip/swfsc_cufes/afaf5773918983ba4d91be44/calcofi_swfsc_cufes_v2026.11.26_xlsx.zip 
uploaded publish/zip/swfsc_cufes/afaf5773918983ba4d91be44/calcofi_swfsc_cufes_v2026.11.26_parquet.zip 
uploaded publish/zip/swfsc_ichthyo/8019426406d547b8d97793e5/calcofi_swfsc_ichthyo_v2026.11.26_csv.zip 
uploaded publish/zip/swfsc_ichthyo/8019426406d547b8d97793e5/calcofi_swfsc_ichthyo_v2026.11.26_xlsx.zip 
uploaded publish/zip/swfsc_ichthyo/8019426406d547b8d97793e5/calcofi_swfsc_ichthyo_v2026.11.26_parquet.zip 
Code
put_gcs_file(file.path(STAGE_DIR, "releases", RELEASE_VERSION, "manifest.json"),
             glue("{ZIP_GCS}/releases/{RELEASE_VERSION}/manifest.json"), content_type = "application/json")
put_gcs_file(file.path(STAGE_DIR, "manifest.json"), glue("{ZIP_GCS}/manifest.json"), content_type = "application/json")
Code
due <- man_tbl |> filter(written, action == "upload")
cat(glue("CALCOFI_PUBLISH_ZIP is not `true`{if (STAGING) ' (and this is a staging run)' else ''}: nothing uploaded.\n",
         "{nrow(due)} zip(s) ({round(sum(due$bytes) / 1e6)} MB) differ from what {ZIP_GCS}/ holds; ",
         "they are staged at {STAGE_DIR}/.\n"))
Code
kable(bind_rows(runs), caption = "per dataset: reuse or build, what changed, seconds")
per dataset: reuse or build, what changed, seconds
dataset_key action changed secs
calcofi_2022-edna exists 0
calcofi_bottle exists 3
calcofi_bottle-derived exists 1
calcofi_ctd-cast exists 4
calcofi_ctd-derived exists 1
calcofi_dic exists 0
calcofi_mets exists 0
calcofi_phyllosoma exists 0
calcofi_phytoplankton exists 0
cce-lter_euphausiids exists 0
cce-lter_iron exists 0
cce-lter_picoplankton-bacteria exists 0
cce-lter_zoodb exists 0
cce-lter_zooscan exists 0
cdfw_dungeness-crab exists 0
farallon_bird-mammal exists 0
sio_mesopelagic-fish exists 0
sio_pic-zooplankton exists 0
swfsc_cufes exists 0
swfsc_ichthyo exists 1
Code
dbDisconnect(con, shutdown = TRUE)