Skip to contents

For each format bundle_format_decision() offers, a folder named like the zip (bundle_file_name() without .zip) holding the tables and README.md, CITATION.md, CITATION.bib, LICENSE.txt and columns.csv, zipped with bundle_zip() (fixed order and timestamps, so unchanged content gives the same sha256) and then removed. CSV and Parquet come straight from the tables in con (COPY … TO); the Parquet uses the release's pinned writer settings on one thread; the Excel workbook is written with writexl (a README sheet first, a columns sheet last) and its internal timestamp fixed.

Usage

write_bundle(
  con,
  record,
  release,
  tables,
  plan,
  out_dir,
  meta_columns = list(),
  meta_tables = list(),
  xlsx_max_rows = BUNDLE_XLSX_MAX_ROWS,
  max_bytes = BUNDLE_MAX_ZIP_BYTES,
  prefix = "bundle_",
  licenses_dir = system.file("licenses", package = "calcofi4db")
)

Arguments

con

the connection bundle_build_tables() wrote into

record

one dataset record from datasets.json

release

a list: version, release_date, citation, doi, concept_doi

tables

the data frame from bundle_build_tables()

plan

the data frame from bundle_plan()

out_dir

where the zips are written (created)

meta_columns, meta_tables

metadata.json's columns and tables blocks

xlsx_max_rows

passed to bundle_format_decision()

max_bytes

the largest zip allowed

prefix

the prefix bundle_build_tables() used

licenses_dir

passed to bundle_license()

Value

A data frame, one row per bundle_formats(): format, written, file, path, bytes, sha256, excel_openable, reason, note.

Details

A zip over max_bytes stops the build with its size: a file too large for a browser download is a decision for a person, never dropped silently.