Earlier 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")

Arguments

dataset_ids

Datasets to convert; by default every dataset in path_data

path_data

Folder holding the datasets

Value

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)

Details

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.

Examples

if (FALSE) { # \dontrun{
# From the root of a database repository
result <- metadata_convert_sources()
result[!is.na(result$issues), ]
} # }