fix(gbif-eml): populate metadata.dates.creation for iso19139 export - #362
Merged
Merged
Conversation
The ISO19139 template requires record['metadata']['dates']['creation'] with no fallback, but GBIF_EMLOutputSchema.import_() never set it, only identification.dates.publication. This caused a hard UndefinedError when rendering ISO19139 XML from GBIF-EML-imported MCF. Backfill metadata.dates.creation from the same publication date already extracted for identification.dates.publication.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
The ISO19139 template (
pygeometa/schemas/iso19139/main.j2:31) requiresrecord['metadata']['dates']['creation']with no fallback:GBIF_EMLOutputSchema.import_()never populated this field — it only setidentification.dates.publication. Any MCF produced from GBIF-EML and rendered to ISO19139 hard-fails with:Fix
Backfill
metadata.dates.creationfrom the same publication date already extracted foridentification.dates.publication.Testing
tests/run_tests.py::PygeometaTest::test_import_metadatastill passestests/run_tests.pysuite passes (28/28)ISO19139OutputSchema().write()succeeds againsttests/eml.xmlandmetadata.dates.creationresolves to2022-07-01