
Build ISO 19139 or HNAP-aware metadata XML for DFO Enterprise Data Hub export
edh_build_iso19139_xml.RdGenerates metadata XML from dataset_meta for DFO Enterprise Data Hub /
GeoNetwork workflows. The default "dfo_edh_hnap" profile now emits the
more practical North American Profile / EDH-oriented structure with
deterministic file identifiers, maintenance/status, legal constraints,
optional distribution info, reference system support, bilingual locale
scaffolding, and richer contact metadata when available. The legacy
"iso19139" profile remains available as a compact fallback export.
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,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 astitle_franddescription_fr.- output_path
Optional file path to write XML.
- file_identifier
Optional metadata file identifier. For the default
profile = "dfo_edh_hnap", non-UUID identifiers are converted to a deterministic UUID-like value and the originaldataset_idis preserved ingmd:dataSetURI/ citation identifiers. Forprofile = "iso19139", this defaults todataset_id.- language
ISO 639-2/T language code for the primary metadata language (default:
"eng").- date_stamp
Metadata date stamp (default:
Sys.Date()). Whendataset_meta$modifiedis present, that value is preferred.- profile
Metadata export profile.
"dfo_edh_hnap"(the default) returns the richer HNAP/EDH-oriented structure;"iso19139"keeps the original lightweight fallback export.
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_iso19139_xml(dataset_meta, output_path = out)
out_iso <- tempfile(fileext = ".xml")
edh_build_iso19139_xml(
dataset_meta,
output_path = out_iso,
profile = "iso19139"
)
#> Error in edh_build_iso19139_xml(dataset_meta, output_path = out_iso, profile = "iso19139"): unused argument (profile = "iso19139")