Skip to content

Store origin URI when exchanging#1342

Open
fbacall wants to merge 7 commits into
masterfrom
multi-provider-ingestion
Open

Store origin URI when exchanging#1342
fbacall wants to merge 7 commits into
masterfrom
multi-provider-ingestion

Conversation

@fbacall

@fbacall fbacall commented Jul 23, 2026

Copy link
Copy Markdown
Member

Summary of changes

  • Adds an origin_uri to events and materials, which should point back to the URI of the resource on the original instance it was exchanged from.
  • Displays notice and link back to origin instance when viewing an event/material.
  • Adds a <description> to the OAI-PMH identify response to indicate that this is a TeSS instance.
  • Populates origin_uri when ingesting via OAI-PMH from a TeSS instance.
  • Changed OAI-PMH tests to use mocked HTTP responses vs. mocked client.

Motivation and context

Needed a way to credit origin instance for exchanged content, since metadata may be stale/incomplete.

Screenshots

image 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.

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

Adds first-class “origin instance” attribution for exchanged Events/Materials by persisting an origin_uri, surfacing it in the UI, and enriching OAI-PMH identify/ingestion so TeSS instances can be detected and credited.

Changes:

  • Adds origin_uri to events and materials, displays “Original entry” UI, and shows an exchange icon in listings.
  • Extends OAI-PMH provider Identify response to mark the instance as TeSS, and updates the OAI-PMH ingestor to populate origin_uri when ingesting from a TeSS instance.
  • Refactors OAI-PMH tests to use WebMock/VCR-recorded HTTP responses instead of a mocked OAI client.

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/vcr_cassettes/ingestors/tess_oai_pmh_listrecords.yml Adds recorded TeSS ListRecords response fixture for replayable ingestion testing.
test/vcr_cassettes/ingestors/tess_oai_pmh_identify.yml Adds recorded TeSS Identify response fixture including the TeSS marker description.
test/unit/ingestors/oai_pmh_ingestor_test.rb Switches OAI-PMH tests to HTTP stubs/VCR and adds coverage for origin_uri population.
test/controllers/materials_controller_test.rb Verifies origin-info link is conditionally displayed on material show page.
test/controllers/events_controller_test.rb Verifies origin-info link is conditionally displayed on event show page.
lib/ingestors/oai_pmh_ingestor.rb Detects TeSS instances via Identify and injects origin_uri during RDF ingestion.
lib/ingestors/material_ingestion.rb Simplifies material ingestion param extraction.
lib/ingestors/event_ingestion.rb Simplifies event ingestion param extraction.
db/schema.rb Updates schema to include origin_uri columns.
db/migrate/20260710154329_add_origin_uri_to_tables.rb Adds origin_uri columns to materials and events.
config/locales/en.yml Adds i18n strings for origin attribution UI.
config/initializers/oai_provider.rb Adds TeSS marker Identify description and customizes OAI identifiers to include route keys.
app/views/materials/show.html.erb Renders shared origin-info block on material pages.
app/views/materials/_material.html.erb Displays exchange icon for exchanged materials in lists/cards.
app/views/events/show.html.erb Renders shared origin-info block on event pages.
app/views/events/_event.html.erb Displays exchange icon for exchanged events in lists/cards.
app/views/common/_origin_info.erb New shared sidebar block that links to the origin instance entry.
app/models/application_record.rb Adds a default oai_identifier used by OAI-PMH provider identifier rendering.
app/helpers/application_helper.rb Adds exchanged icon type and helper to render the exchange icon.
app/controllers/materials_controller.rb Permits origin_uri in strong params for materials.
app/controllers/events_controller.rb Permits origin_uri in strong params for events.
app/assets/stylesheets/application.scss Styles the exchange icon.

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

Comment thread lib/ingestors/oai_pmh_ingestor.rb Outdated
Comment on lines +94 to +95
origin_uri = metadata_tag.at_xpath('//rdf:RDF/*/@rdf:about', 'rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#')&.to_s
extra_metadata[:origin_uri] = origin_uri
Comment thread app/helpers/application_helper.rb
@@ -0,0 +1,12 @@
<% unless resource.origin_uri.blank? %>

@eilmiv eilmiv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks great.

sample_id 'materials/142' # so that example id is oai:domain:materials/142
extra_description %(
<description>
<tess-instance xmlns="http://tess.elixir-europe.org/xmlns" />

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
<tess-instance xmlns="http://tess.elixir-europe.org/xmlns" />
<tess-instance xmlns="http://tesshub.org/xmlns" />

Of course, it does not matter, but given that this domain exists I think it is cooler in this case.

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