Skip to contents

Generates HNAP-aware metadata XML from dataset_meta for DFO Enterprise Data Hub / GeoNetwork workflows.

Usage

edh_build_hnap_xml(
  dataset_meta,
  output_path = NULL,
  file_identifier = NULL,
  language = "eng",
  date_stamp = Sys.Date()
)

Arguments

dataset_meta

Data frame/tibble with exactly one row of dataset-level metadata. Required columns: dataset_id, title, description. Common optional columns include: creator, contact_name, contact_email, contact_org, contact_position, license, source_citation, temporal_start, temporal_end, spatial_extent, update_frequency, topic_categories, keywords, keyword_type, keyword_thesaurus_title, keyword_thesaurus_date, keyword_thesaurus_date_type, security_classification, created, modified, provenance_note, status, distribution_url, download_url, reference_system, bbox_west, bbox_east, bbox_south, bbox_north, plus optional French-localized fields such as title_fr, description_fr, and keyword_thesaurus_title_fr.

output_path

Optional file path to write XML. Parent directories are created automatically when needed.

file_identifier

Optional metadata file identifier. Non-UUID identifiers are converted to a deterministic UUID-like value and the original dataset_id is preserved in gmd:dataSetURI / citation identifiers.

language

ISO 639-2/T language code for the primary metadata language (default: "eng").

date_stamp

Metadata date stamp (default: Sys.Date()). When dataset_meta$modified is present, that value is preferred.

Value

Invisible list with elements xml (string) and path.

Details

The produced XML should still be validated and enriched against your local EDH profile before production upload.

Examples

dataset_meta <- tibble::tibble(
  dataset_id = "fraser-coho-2024",
  title = "Fraser River Coho Escapement Data",
  description = "Sample escapement monitoring data for coho salmon in PFMA 29",
  contact_name = "Your Name",
  contact_email = "your.email@dfo-mpo.gc.ca",
  topic_categories = "biota;oceans",
  keywords = "coho;escapement;Fraser River",
  temporal_start = "2001",
  temporal_end = "2024"
)

out <- tempfile(fileext = ".xml")
edh_build_hnap_xml(dataset_meta, output_path = out)