Skip to content

[DDST-342, FDSF4-18] include title in field mapping#19

Closed
JojoVes wants to merge 1 commit into
mainfrom
map-node-title
Closed

[DDST-342, FDSF4-18] include title in field mapping#19
JojoVes wants to merge 1 commit into
mainfrom
map-node-title

Conversation

@JojoVes

@JojoVes JojoVes commented Aug 28, 2025

Copy link
Copy Markdown
Contributor

particularly important for nodes that don't have field_title populated.

It seems this change was intended a while ago, but got lost in the shuffle, so including some related ticket IDs in the PR and putting this together now in hopes of getting this addressed sooner than later.

Summary by CodeRabbit

  • New Features
    • OAI-PMH exports now include item titles in the primary title element for both QDC and DGI metadata formats, ensuring titles appear as expected in harvested records.
    • Improves consistency and interoperability with downstream systems and indexes that rely on the main title field.
    • No other behaviors changed; existing mappings and output remain the same aside from the added title exposure.

particularly important for nodes that don't have field_title populated.
@JojoVes JojoVes added the minor Added functionality that is backwards compatible. label Aug 28, 2025
@coderabbitai

coderabbitai Bot commented Aug 28, 2025

Copy link
Copy Markdown

Walkthrough

Adds 'title' => self::TITLE_ELEMENT_MAIN to FIELD_MAPPING in DgiStandard and QDC. This maps the source field "title" to the main title element in their respective OAI outputs. No other logic or control flow changes.

Changes

Cohort / File(s) Change Summary
OAI metadata title mapping
src/Plugin/OaiMetadataMap/DgiStandard.php, src/Plugin/OaiMetadataMap/QDC.php
Inserted 'title' => self::TITLE_ELEMENT_MAIN at the start of protected const FIELD_MAPPING, mapping the source "title" field to the main title element in OAI records. No other mappings or logic modified.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Client
  participant OAI as OAI Provider
  participant Map as MetadataMap (DgiStandard/QDC)
  participant FM as FieldMapping
  participant XML as OAI XML Builder

  Client->>OAI: Request record
  OAI->>Map: Build metadata
  Map->>FM: Resolve field mappings
  rect rgba(200, 245, 200, 0.3)
    note right of FM: New mapping
    FM-->>Map: Map 'title' -> TITLE_ELEMENT_MAIN
  end
  Map->>XML: AddValues for title (main element)
  alt DgiStandard
    XML-->>OAI: dcterms:title populated
  else QDC
    XML-->>OAI: dc:title populated
  end
  OAI-->>Client: OAI record (with main title)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I nibble code like clover leaves,
A title sprouts where mapping weaves.
dc or dcterms, neat and bright,
Main-title blooms in morning light.
Thump of joy—two files align,
Harvest sings: “The title’s mine!” 🥕✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • JIRA integration encountered authorization issues. Please disconnect and reconnect the integration in the CodeRabbit UI.
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch map-node-title

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbit in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbit in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbit gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbit read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbit help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbit ignore or @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbit summary or @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbit or @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/Plugin/OaiMetadataMap/DgiStandard.php (1)

54-55: Typo in element name breaks mapping

'dcterms:contributer' is invalid; should be 'dcterms:contributor'. This will produce incorrect XML.

-    'field_organizations' => 'dcterms:contributer',
+    'field_organizations' => 'dcterms:contributor',
🧹 Nitpick comments (1)
src/Plugin/OaiMetadataMap/DgiStandard.php (1)

576-582: Rename $optons → $options for clarity

Minor rename for readability and to match common convention.

-  protected function addPersistentUrl(ContentEntityInterface $entity, $dest, $alias) {
-    $optons = [
+  protected function addPersistentUrl(ContentEntityInterface $entity, $dest, $alias) {
+    $options = [
       'absolute' => TRUE,
       'alias' => $alias,
     ];
-    $this->elements[$dest][] = $entity->toUrl('canonical', $optons)->toString();
+    $this->elements[$dest][] = $entity->toUrl('canonical', $options)->toString();
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 6a1ab35 and 30da676.

📒 Files selected for processing (2)
  • src/Plugin/OaiMetadataMap/DgiStandard.php (1 hunks)
  • src/Plugin/OaiMetadataMap/QDC.php (1 hunks)
🔇 Additional comments (3)
src/Plugin/OaiMetadataMap/QDC.php (1)

68-70: Add 'title' mapping (QDC) — LGTM

Correctly maps base "title" to dc:title; namespace is declared in METADATA_WRAPPER.

src/Plugin/OaiMetadataMap/DgiStandard.php (2)

39-41: Add 'title' mapping (DgiStandard) — LGTM

Correctly maps base "title" to dcterms:title.


395-426: Skip base “title” when title paragraphs exist
Pre-calculate whether any static::TITLE_PARAGRAPH_FIELDS are non-empty and viewable, and if so, continue past the base ‘title’ field to avoid emitting duplicate main titles. Please verify using an entity with both a base title and title paragraphs.

@JojoVes JojoVes removed the minor Added functionality that is backwards compatible. label Aug 28, 2025
@JojoVes
JojoVes marked this pull request as draft August 28, 2025 18:33
@jordandukart

Copy link
Copy Markdown
Contributor

Going to close this in favor of another PR to come to retain the backwards compat behavior.

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.

2 participants