Builds the metadata of a new Zenodo version of a database from the metadata block of its config/metadata.yml, as copied into the built database, so the deposit no longer has to be typed into Zenodo's web form. Pass the result to zenodo_deposit().

zenodo_metadata(
  database,
  metadata = database$metadata,
  description_file = zenodo_default_description()
)

Arguments

database

A built database, such as austraits. Its data collectors, assistants and metadata are used.

metadata

The metadata block of config/metadata.yml. Defaults to the copy in database, which is the metadata the release was built with.

description_file

Markdown file holding the deposit's description, or NULL to use the description field. Defaults to config/zenodo_description.md when that file exists.

Value

A list in the format of the metadata of Zenodo's deposition API, for zenodo_deposit().

Where each field comes from

  • title, version, language and the licence come from the fields of the same name. references may hold one reference or a list; Markdown emphasis (*) is removed, as Zenodo shows it as typed. publication_date is converted to YYYY-MM-DD; it must parse, so set it before the release build.

  • The description is config/zenodo_description.md when that file exists, otherwise the description field. It is Markdown, rendered to HTML, and {{version}}, {{doi}}, {{publication_date}} and {{publication_year}} in it are replaced by those fields.

  • creators come from creators, as last_name, given_name, ORCID and affiliation.

  • contributors are, in this order:

    1. project_contributors: people credited on the deposit who are not data collectors of any dataset, such as project staff and curators. Each has the fields of a creator plus role, a DataCite contributor type such as ProjectMember (the default), DataManager or DataCurator. Those with role DataCollector are listed among the data collectors.

    2. every data collector of every dataset (the database's contributors table), as DataCollector, one entry per person, in alphabetical order of surname then given names (with the assistants below);

    3. every dataset's assistants, as DataCollector, unless already listed as a data collector. These are free text in a dataset's metadata.yml, so they carry a name only;

    4. the licence's rights_holder, as RightsHolder.

    A person is listed once per role. Entries are merged if they have the same ORCID or, when one lacks it, the same surname and compatible given names (each equal, or an initial of the other: "Peter J." with "P." but not with "Paul"); never two different ORCIDs. The merged entry has the name written most often (then the longest), the ORCID and the most frequent affiliation. Placeholders such as unknown, none and .na count as empty, and an ORCID that is not valid is left out with a warning.

    zenodo_deposit() then fills an ORCID or affiliation a person lacks from the previous version, where the same person has one there.

  • related_identifiers come from related_identifiers. The relation (in relation_type or relation) must be one Zenodo accepts, such as isCompiledBy or isDescribedBy; case is corrected. An entry naming the deposit's own concept DOI (doi) is left out, because Zenodo links the versions of a record itself, and so is a repeat of an identifier with the same relation (such as the traits.build repository the build adds).

  • locations come from geo_location$geo_location_place.

  • grants come from funding_reference, but only for entries that give a funder_identifier (the funder's ROR id, such as 038sjwq14 for the ARDC, or Crossref Funder DOI): Zenodo accepts only awards in its own vocabulary, identified as <funder>::<award_number>. Without any, the grants are left out, and zenodo_deposit() keeps those of the previous version.

Keywords, subjects, communities and notes are not set here, so a new version keeps the previous version's.

Examples

if (FALSE) { # \dontrun{
metadata <- zenodo_metadata(austraits)
str(metadata, max.level = 1)
} # }