Skip to content

Oai pmh events - #1352

Open
eilmiv wants to merge 5 commits into
ElixirTeSS:masterfrom
pan-training:oai_pmh_events
Open

Oai pmh events#1352
eilmiv wants to merge 5 commits into
ElixirTeSS:masterfrom
pan-training:oai_pmh_events

Conversation

@eilmiv

@eilmiv eilmiv commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Summary of changes

  • Add Dublin Core serialization for events
  • Merge events and materials in OAI-PMH results
  • Expose OAI-PMH sets for just materials or events

Motivation and context

Closes #1351

Screenshots

Events can be found alongside materials in the OAI-PMH results:
image

Checklist

  • I have read and followed the CONTRIBUTING guide.
  • I confirm that I have the authority necessary to make this contribution on behalf of its copyright owner and agree to license it to the TeSS codebase under the BSD license.

@eilmiv
eilmiv marked this pull request as ready for review July 29, 2026 07:06
@fbacall
fbacall requested a review from Copilot July 29, 2026 10:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 extends the OAI-PMH endpoint to expose Event records alongside Material records, including Dublin Core and RDF serializations and set filtering to allow clients to harvest only events or only materials.

Changes:

  • Add Event#to_oai_dc and Event#to_rdf serialization methods and corresponding model tests.
  • Replace the single-model OAI provider wrapper with a new MultiModel provider model to merge Materials + Events and expose OAI sets.
  • Expand OAI controller integration tests to cover event records, sets, and resumption token paging behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
test/models/event_test.rb Adds unit tests validating Event OAI-DC + RDF serialization.
test/controllers/oai_controller_test.rb Adds integration tests for events in OAI responses, ListSets, and paging/resumption tokens.
config/initializers/oai_provider.rb Introduces MultiModel to merge multiple AR scopes into one OAI-PMH model and expose sets.
app/models/event.rb Implements to_oai_dc and to_rdf serialization for events.
app/controllers/oai_controller.rb Switches OAI endpoint to use MultiModel over both visible Materials and Events.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread config/initializers/oai_provider.rb Outdated
Comment thread config/initializers/oai_provider.rb Outdated
scopes = scopes.select { |scope| scope.model.model_name.route_key == options[:set] } if options[:set]
scopes = scopes.map { |scope| scope.where("#{timestamp_field} >= ?", options[:from]) } if options[:from]
scopes = scopes.map { |scope| scope.where("#{timestamp_field} < ?", options[:until] + 1.second) } if options[:until]
enumerators = scopes.map { |scope| scope.order(timestamp_field => :asc, id: :asc).to_enum }
Comment thread app/models/event.rb
Comment on lines +511 to +514
def to_rdf
jsonld_str = to_bioschemas[0].to_json

graph = RDF::Graph.new
Comment thread config/initializers/oai_provider.rb
…sources with same date in oai-pmh endpoint

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

Expose events via OAI-PMH endpoint

2 participants