Last updated: 15 November, 2019

This is an example workflow from metabase to EML document. This guide assumes you have an installed and populated instance of LTER-core-metabase, plus log-in credentials for an user with at least read or SELECT access to this database. See the LTER-core-metabase Github repository for information on installation and population. If you would like to test drive MetaEgress, use the database dump specifically made for this purpose; see this document.

Preparation

Necessary components

(aside from well populated metabase)

  • An abstract document in pandoc-compatible format. The file name should be exactly as specified in metabase DataSet.Abstract.
  • A method document in pandoc-compatible format. The file name should be exactly as specified in metabase DataSetMethods.methodDocument.
  • Data files for all listed entities. File names should be exactly as listed in metabase DataSetEntities.FileName.

Note on document formats

MetaEgress uses the function set_TextType from the EML R package to wrap documents in XML tags. See set_TextType documentation to learn more about compatible formats: ?EML::set_TextType.

Set up a local project folder

Put data files and other documents (e.g. abstract, methods, boilerplate, license) in a folder.

Recommended approach for local files: Create a R script in this folder and run MetaEgress from this script.

For remotely hosted data: TODO

Remotely hosted data

TODO

Create entities

Note that even if the function runs successfully, many warnings will be generated. Use warnings() to see them. Most of the time the warnings will concern custom units and can safely be ignored.

Validate and write to file

First validate EML document using the function eml_validate from EML R package. The input could be an EML list object or output from create_entity, or a XML file.

Desired outcome is TRUE:

[1] TRUE attr(,“errors”) character(0)

Should eml_validate return FALSE, examine the list object returned by create_EML. Error messages generated by eml_validate could be quite cryptic and might not point to the real problem.

Then serialize or write to XML file using the function write_eml from the EML R package.

EML::write_eml(EML, file = "EML.xml")

Troubleshoot invalid EML

TODO