Skip to content

Conversation

@codycooperross
Copy link
Contributor

@codycooperross codycooperross commented Nov 21, 2025

Purpose

This PR improves citeproc JSON and citation writing by 1) expanding mappings from relatedItem metadata to container and 2) mapping additional metadata fields to citeproc JSON. It makes container a dynamically generated field that maps from relatedItem "IsPublishedIn" metadata with legacy description "SeriesInformation" metadata as a fallback. If container metadata is provided by a bolognese reader and a container cannot be generated based on relatedItem and description metadata, then the read container is used. Previously, container was primarily generated when reading from DataCite XML.

The generate_container function 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:

  • Be humble in the language and feedback you give, ask don't tell.
  • Consider using positive language as opposed to neutral when offering feedback. This is to avoid the negative bias that can occur with neutral language appearing negative.
  • Offer suggestions on how to improve code e.g. simplification or expanding clarity.
  • Ensure you give reasons for the changes you are proposing.

@codycooperross codycooperross changed the title Container Expand mappings to container and citeproc JSON to improve citations Nov 21, 2025
@codycooperross codycooperross changed the title Expand mappings to container and citeproc JSON to improve citations Expand mappings to container and citeproc JSON Nov 21, 2025
Copy link

Copilot AI left a 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, and page-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.

@codycooperross codycooperross requested a review from a team November 21, 2025 16:28
@codycooperross codycooperross merged commit fca96fd into master Nov 24, 2025
5 checks passed
@codycooperross codycooperross deleted the container branch November 24, 2025 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants