Oai pmh events - #1352
Open
eilmiv wants to merge 5 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
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_dcandEvent#to_rdfserialization methods and corresponding model tests. - Replace the single-model OAI provider wrapper with a new
MultiModelprovider 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.
| 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 on lines
+511
to
+514
| def to_rdf | ||
| jsonld_str = to_bioschemas[0].to_json | ||
|
|
||
| graph = RDF::Graph.new |
…sources with same date in oai-pmh endpoint Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of changes
Motivation and context
Closes #1351
Screenshots
Events can be found alongside materials in the OAI-PMH results:

Checklist