Skip to content
Merged
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
"description": "Customizations for PC",
"type": "drupal-module",
"license": "GPL-3.0-only",
"require": {}
"require": {
"discoverygarden/dgi_standard_oai": "^1.4",
"drupal/rest_oai_pmh": "^2"
}
}
4 changes: 4 additions & 0 deletions pcdora.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ type: module
description: 'Providence College Customizations'
core_version_requirement: ^8 || ^9 || ^10
package: 'discoverygarden'
dependencies:
- drupal:migrate
- dgi_standard_oai:dgi_standard_oai
- rest_oai_pmh:rest_oai_pmh
66 changes: 66 additions & 0 deletions src/Plugin/OaiMetadataMap/PcStandard.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php

namespace Drupal\pcdora\Plugin\OaiMetadataMap;

use Drupal\dgi_standard_oai\Plugin\OaiMetadataMap\DgiStandard;

/**
* OAI implementation for the PC metadata profile.
*
* @OaiMetadataMap(
* id = "pc_standard_oai",
* label = @Translation("DPLAVA (PC)"),
* metadata_format = "mdRecord",
* template = {
* "type" = "module",
* "name" = "rest_oai_pmh",
* "directory" = "templates",
* "file" = "oai-default"
* }
* )
*/
Comment on lines +7 to +21
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

Verify the metadata format and template configuration.

The metadata_format is set to "mdRecord", which is non-standard for OAI-PMH (typical formats include "oai_dc", "oai_marc", etc.). Additionally, verify that the template file "oai-default" exists in the rest_oai_pmh module at the specified location.

Run the following script to verify the template reference:


🏁 Script executed:

#!/bin/bash
# Description: Verify the template file exists in rest_oai_pmh module

# Search for the template file
fd -t f "oai-default" --full-path --exec echo "Found: {}"

# Search for rest_oai_pmh module usage
rg -n "rest_oai_pmh" --type=php -C2

Length of output: 354



🏁 Script executed:

#!/bin/bash
# Search for template files with common extensions
echo "=== Searching for template files with common extensions ==="
fd -t f "oai" --exec file {} \; | grep -i "template\|text"

# Search for any files named "oai-default" with any extension
echo -e "\n=== Searching for oai-default with any extension ==="
fd "oai-default" -t f

# Search for rest_oai_pmh module/directory
echo -e "\n=== Searching for rest_oai_pmh directory or module ==="
fd "rest_oai_pmh" -t d

# Look at similar OaiMetadataMap plugins for comparison
echo -e "\n=== Checking other OaiMetadataMap plugins ==="
fd -t f ".*Standard\.php$" -path "*/OaiMetadataMap/*"

Length of output: 385



🏁 Script executed:

#!/bin/bash
# Find all OaiMetadataMap plugin files
echo "=== All OaiMetadataMap plugin files ==="
fd -t f -path "*/OaiMetadataMap/*.php"

# Check if there's a modules or contrib directory
echo -e "\n=== Checking for external modules directories ==="
fd -t d "modules\|contrib" -d 2

# Look for any configuration files that might reference rest_oai_pmh
echo -e "\n=== References to rest_oai_pmh in entire codebase ==="
rg "rest_oai_pmh" -n

# Check for template directories
echo -e "\n=== Template directories in repo ==="
fd -t d "templates"

Length of output: 427



🏁 Script executed:

#!/bin/bash
# Find all OaiMetadataMap plugin files (corrected syntax)
echo "=== All OaiMetadataMap plugin files ==="
find src -type f -name "*.php" -path "*/OaiMetadataMap/*" 2>/dev/null

# Show content of OaiMetadataMap directory
echo -e "\n=== Contents of OaiMetadataMap directory ==="
find src -type f -path "*/OaiMetadataMap/*" 2>/dev/null | head -20

# Check directory structure around PcStandard.php
echo -e "\n=== Directory structure of OaiMetadataMap ==="
find src/Plugin/OaiMetadataMap -type f 2>/dev/null || echo "Directory not found"

# Look at the actual class definition in PcStandard.php
echo -e "\n=== Full PcStandard.php file ==="
cat src/Plugin/OaiMetadataMap/PcStandard.php

Length of output: 2296



🏁 Script executed:

#!/bin/bash
# Find DgiStandard class (parent class)
echo "=== Searching for DgiStandard class ==="
find . -type f -name "*.php" -exec grep -l "class DgiStandard" {} \;

# Check for dgi_standard_oai module
echo -e "\n=== Searching for dgi_standard_oai module ==="
find . -type d -name "dgi_standard_oai"

# Look for composer.json to see dependencies
echo -e "\n=== Checking for composer.json ==="
find . -maxdepth 2 -name "composer.json" -exec cat {} \;

# Search for .info.yml files (Drupal module definitions)
echo -e "\n=== Drupal module files (.info.yml) ==="
find . -name "*.info.yml" | head -10

Length of output: 345



🏁 Script executed:

#!/bin/bash
# Check the module info file for dependencies
echo "=== pcdora.info.yml content ==="
cat ./pcdora.info.yml

Length of output: 177


</web_search>


🌐 Web query:

OAI-PMH metadata formats standard mdRecord

💡 Result:

Short answer: mdRecord is not part of the OAI‑PMH protocol standard — it’s an implementation‑specific metadataPrefix used by some repositories (e.g., Islandora/related projects) to expose a repository’s native/richer metadata. OAI‑PMH itself requires only oai_dc (Dublin Core) and allows repositories to define additional metadata formats identified by a metadataPrefix and a metadata schema. See the OAI‑PMH spec for how metadataPrefix/metadataSchema are defined and returned via ListMetadataFormats, and an example of mdRecord usage in Islandora/Islandora‑derived docs. [1][2][3]

If you need details for a particular repository:

  • Call ?verb=ListMetadataFormats on that repository’s baseURL to see whether it supports metadataPrefix=mdRecord and the schemaLocation it uses. The response will include the metadataPrefix, metadataNamespace/metadataSchema (or schemaLocation) you must use. [2]

Sources

  • OAI‑PMH v2.0 specification (metadataPrefix / ListMetadataFormats). [1]
  • Example: Islandora / Arca documentation showing metadataPrefix "mdRecord" (repository‑specific). [2]
  • Omeka / general OAI‑PMH docs showing repositories publish custom metadataPrefix values. [3]

References

  1. Open Archives Initiative Protocol for Metadata Harvesting (OAI‑PMH) v2.0 — metadataPrefix & ListMetadataFormats. [openarchives.org].
  2. OAI‑PMH harvesting — Islandora/Arca docs (example using metadataPrefix "mdRecord").
  3. Omeka S / OAI‑PMH documentation (examples of custom metadataPrefix values).

Add required module dependencies to pcdora.info.yml.

The code references external modules (dgi_standard_oai for the DgiStandard parent class and rest_oai_pmh for the template configuration) but these are not declared as dependencies in pcdora.info.yml. This will cause the module to fail at runtime when attempting to instantiate the class or load the template. Both modules must be explicitly declared in the module's info file.

Additionally, while metadata_format = "mdRecord" is not a standard OAI-PMH format (which typically use formats like "oai_dc" or "oai_marc"), it is a valid implementation-specific metadataPrefix used in projects like Islandora. Verify this is intentional for your use case.

🤖 Prompt for AI Agents
In src/Plugin/OaiMetadataMap/PcStandard.php around lines 7 to 21, the plugin
references external modules (dgi_standard_oai for the DgiStandard parent class
and rest_oai_pmh for the template) that are not declared as dependencies; update
pcdora.info.yml to add both dgi_standard_oai and rest_oai_pmh to the
dependencies list so Drupal installs/loads them before this module, and confirm
that metadata_format = "mdRecord" is intentional for your deployment (change to
a standard OAI-PMH metadataPrefix like oai_dc if that was a mistake).

class PcStandard extends DgiStandard {


/**
* Mapping of paragraph fields to maps of subfields to element names.
*
* @var string[][]
*/
protected const PARAGRAPH_MAPPING = [
'field_faceted_subject' => [
'field_topic_general_subdivision_' => 'dcterms:subject',
'field_temporal_chronological_sub' => 'dcterms:temporal',
'field_geographic_geographic_subd' => 'dcterms:spatial',
],
'field_hierarchical_geographic_su' => [
'field_continent' => 'dcterms:spatial',
'field_country' => 'dcterms:spatial',
'field_region' => 'dcterms:spatial',
'field_state' => 'dcterms:spatial',
'field_territory' => 'dcterms:spatial',
'field_county' => 'dcterms:spatial',
'field_city' => 'dcterms:spatial',
'field_city_section' => 'dcterms:spatial',
'field_island' => 'dcterms:spatial',
'field_area' => 'dcterms:spatial',
'field_extraterrestrial_area' => 'dcterms:spatial',
],
'field_origin_information' => [
'field_date_created' => 'dcterms:created',
'field_date_issued' => 'dcterms:issued',
'field_date_note' => 'dcterms:date',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mapping overriden to include field_date_note

'field_date_captured' => 'dcterms:date',
'field_date_valid' => 'dcterms:date',
'field_date_modified' => 'dcterms:date',
'field_copyright_date' => 'dcterms:date',
'field_publisher' => 'dcterms:publisher',
'field_other_date' => 'dcterms:date',
],
'field_related_item' => [
'field_title' => 'dcterms:relation',
'field_url' => 'dcterms:relation',
],
];

}
48 changes: 48 additions & 0 deletions src/Plugin/dgi_migrate_alter/spreadsheet/DssiNodeAlter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

namespace Drupal\pcdora\Plugin\dgi_migrate_alter\spreadsheet;

use Drupal\dgi_migrate_alter\Plugin\MigrationAlterBase;
use Drupal\dgi_migrate_alter\Plugin\MigrationAlterInterface;

/**
* Alter for dssi_node migration.
*
* @MigrationAlter(
* id = "pcdora_dssi_node_alter",
* label = @Translation("DSSI Node Migration Alteration"),
* description = @Translation("Alters the DSSI Node migration."),
* migration_id = "dssi_node"
* )
*/
class DssiNodeAlter extends MigrationAlterBase implements MigrationAlterInterface {

/**
* {@inheritdoc}
*/
public function alter(array &$migration): void {
$process =& $migration['process'];

$process['field_origin_information'][1]['keys'] = [
'event_type',
'place',
'date_created',
'date_issued',
'date_captured',
'date_valid',
'date_modified',
'other_date',
'copyright_date',
'publisher',
'edition',
'issuance',
'frequency',
'date_note',
];

// Using frequency as a template.
$process['field_origin_information'][2]['values']['field_date_note'] = $process['field_origin_information'][2]['values']['field_frequency'];
$process['field_origin_information'][2]['values']['field_date_note'][0]['source'] = 'parent_value/date_note';
}

}