-
Notifications
You must be signed in to change notification settings - Fork 14
Expand mappings to container and citeproc JSON #215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ds mapping to citeproc JSON
…contributors to citeproc
…DataCite metadata" This reverts commit f68a72a.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR enhances the metadata handling capabilities of Bolognese by expanding container metadata generation from multiple sources and enriching citeproc JSON mappings. The key improvement is making container a dynamically generated field that intelligently prioritizes relatedItem "IsPublishedIn" metadata, falls back to legacy "SeriesInformation" descriptions, and uses provided container data as a last resort. The generate_container function is made public in the Utils module for use by external consumers like the lupo Doi model.
Key Changes:
- Introduced dynamic container generation with a three-tier fallback system (relatedItems → SeriesInformation → provided container)
- Added new citeproc JSON fields:
editor,available-date,number,chapter-number,edition, andpage-first - Refactored container generation from DataCite reader into a reusable Utils method
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/bolognese/utils.rb | Adds generate_container public method to dynamically build container metadata from relatedItems, SeriesInformation, or relatedIdentifiers |
| lib/bolognese/metadata.rb | Updates container getter to use dynamic generation with fallback to provided metadata |
| lib/bolognese/metadata_utils.rb | Extends citeproc_hsh with additional mappings for editor, available-date, number, chapter-number, edition, and page-first |
| lib/bolognese/datacite_utils.rb | Modifies SeriesInformation insertion logic to prevent duplication when source is already DataCite |
| lib/bolognese/readers/datacite_reader.rb | Removes deprecated set_container method now handled by generate_container |
| spec/metadata_spec.rb | Adds test coverage for container generation scenarios (syntax error: missing do keyword on line 166) |
| spec/writers/citeproc_writer_spec.rb | Updates test to verify editor mapping (minor spacing typo in comment) |
| spec/writers/citation_writer_spec.rb | Adds comprehensive citation format tests for full container metadata |
| spec/writers/ris_writer_spec.rb | Updates expectations to reflect container data in RIS output |
| spec/writers/datacite_writer_spec.rb | Updates contributor count expectation (from 2 to 4) |
| spec/readers/datacite_reader_spec.rb | Adds container expectations for relatedItems scenarios and updates DOI case normalization |
| spec/fixtures/*.json | New fixture files demonstrating different container metadata scenarios |
| spec/fixtures/datacite-example-full-v4.6.xml | Adds Editor contributors to test data |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Purpose
This PR improves citeproc JSON and citation writing by 1) expanding mappings from relatedItem metadata to
containerand 2) mapping additional metadata fields to citeproc JSON. It makescontainera dynamically generated field that maps from relatedItem "IsPublishedIn" metadata with legacy description "SeriesInformation" metadata as a fallback. Ifcontainermetadata is provided by a bolognese reader and acontainercannot be generated based on relatedItem and description metadata, then the readcontaineris used. Previously,containerwas primarily generated when reading from DataCite XML.The
generate_containerfunction is a public method in Utils such that it can be accessed and used by the lupo Doi model.closes: Add github issue that originated this PR
Approach
Open Questions and Pre-Merge TODOs
Learning
Types of changes
Bug fix (non-breaking change which fixes an issue)
New feature (non-breaking change which adds functionality)
Breaking change (fix or feature that would cause existing functionality to change)
Reviewer, please remember our guidelines: