source: blocks of metadata.yml files to the current shapeR/setup.R
metadata_convert_sources.RdEarlier versions of traits.build wrote a dataset's own reference as
primary, the studies a compilation's observations were taken from as
original_source or original, and each further reference as its own
numbered entry (secondary_01, original_01, ...). traits.build now reads
a single dataset reference and two lists, source and secondary, one
- key: item per reference (see util_flatten_sources()), and stops on a
file in an older shape. This converts every shape earlier versions wrote.
metadata_convert_sources(dataset_ids = NULL, path_data = "data")Invisibly, a tibble with one row per dataset: dataset_id,
converted (whether its metadata.yml was rewritten) and issues (what
needs a person, or NA)
The files are edited as text, so nothing outside the source: block
changes and every line of every reference is kept byte for byte: only the
entry headings are renamed and moved. Each converted file is checked: it
must hold exactly the references it did, of the same types in the same
order, and read without error.
Some things need a person rather than a script, and are reported but not
changed: a dataset reference whose key is not the dataset_id, and
source_id values that name neither the dataset_id nor a source
reference. Run dataset_test() after converting to see these in full.
if (FALSE) { # \dontrun{
# From the root of a database repository
result <- metadata_convert_sources()
result[!is.na(result$issues), ]
} # }