Skip to contents

editDataPackageMetadata() opens a form in the web browser to fill in (or correct) the metadata of an MR1 data package, as an alternative to editing the YAML file in a text editor. The form shows what is still missing or wrong while you type (the same checks as checkDataPackageMetadata()), and saves the metadata as YAML file, ready for createDataPackage(). Metadata with problems can be saved too, to continue later.

The form runs on your own computer: nothing is sent over the internet. It needs the package shiny; if it is not installed, you are asked whether to install it.

The form starts from:

  • the metadata in filePath, if that file exists;

  • otherwise, the values derived from dbExtract (see createDataPackageMetadataTemplate()), if given;

  • otherwise, an empty form with the default licence, version and keywords.

Related identifiers cannot be edited in the form; those in the file (or the default link to birdscanR) are kept.

Usage

editDataPackageMetadata(
  filePath,
  dbExtract = NULL,
  countryCode = NULL,
  launch.browser = TRUE
)

Arguments

filePath

Path of the YAML file with the metadata. If it exists, its metadata are loaded into the form; saving overwrites it.

dbExtract

optional. Named list with the database tables extracted by extractDbData(), used to fill in the form if filePath does not exist.

countryCode

optional. Two-letter ISO country code of the site (e.g. "CH"), used for the campaign ID together with dbExtract.

launch.browser

logical. Open the form in the web browser (default), or, if FALSE, only print its address. In RStudio, you can also use launch.browser = rstudioapi::viewer to open it in the viewer pane.

Value

The path of the saved YAML file, invisibly, when the form is closed with "Save and close"; NULL if it is closed without saving.

Author

Birgen Haest

Examples

if (FALSE) { # \dontrun{
# Fill in the metadata of a campaign in a form
# ===========================================================================
dbData = readRDS(system.file("extdata",
  "CH_Sempach_2024_SEP24_25_DataExtract.rds",
  package = "birdscanR"
))
metadataFile = editDataPackageMetadata(
  filePath    = "CH_Sempach_2024_metadata.yaml",
  dbExtract   = dbData,
  countryCode = "CH"
)
} # }