Cds ingestor#1345
Open
kennethrioja wants to merge 3 commits into
Open
Conversation
…an assertion to avoid an info msg
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new ingestion source for CERN CDS Videos (https://videos.cern.ch/) so TeSS can ingest CDS video records and search results (useful for HEPTraining).
Changes:
- Introduces
Ingestors::CdsVideosIngestorto ingest a single record URL or a paginated search query. - Registers the new ingestor in
IngestorFactory. - Adds unit tests and a fixture payload covering record ingestion and paginated search ingestion.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
lib/ingestors/cds_videos_ingestor.rb |
New ingestor implementation for CDS Videos record/search ingestion. |
lib/ingestors/ingestor_factory.rb |
Registers the CDS Videos ingestor so it’s selectable by method key. |
test/unit/ingestors/cds_videos_ingestor_test.rb |
Unit tests for URL conversion, pagination, and record-to-material mapping. |
test/fixtures/files/ingestion/cdsvideos/cds.ingestor.json |
Fixture CDS record response used by unit tests. |
Comments suppressed due to low confidence (2)
lib/ingestors/cds_videos_ingestor.rb:24
@verboseis assigned but never read, which makes the method harder to scan and suggests dead code. If this isn’t used elsewhere, it should be removed.
@verbose = false
test/unit/ingestors/cds_videos_ingestor_test.rb:81
- This test definition is missing the usual two-space indentation, which makes the file inconsistent with the surrounding tests and can trip style checks.
test 'should read search source with pagination across multiple pages' do
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+83
to
+99
| metadata = data['metadata']&.transform_keys! { |k| k == '_cds' ? 'cds' : k } | ||
|
|
||
| material = OpenStruct.new | ||
| material.title = metadata.dig('title', 'title').titleize | ||
| material.url = "#{CDS_VIDEOS_RECORD_URL}#{data['id']}" | ||
| material.description = get_description(metadata) | ||
| material.keywords = metadata['keywords'][0..9]&.map { |k| k['name'] }&.join(', ') || '' | ||
| material.licence = metadata.dig('copyright', 'holder') == 'CERN' ? 'other-at' : 'notspecified' | ||
| material.status = 'Active' | ||
| material.contact = get_contact(metadata) | ||
| material.version = metadata['report_number'][0] | ||
| material.date_created = metadata['date'] | ||
| material.date_published = metadata['publication_date'] | ||
| material.authors = get_authors(metadata) | ||
| material.contributors = get_contributors(metadata) | ||
| material.resource_type = "#{metadata['type'].titleize} – #{metadata['category'].titleize}" | ||
| material |
Comment on lines
+2
to
+4
| require 'json' | ||
| require 'httparty' | ||
| require 'nokogiri' |
Comment on lines
+55
to
+58
| assert_equal 'Video – Lectures', sample.resource_type | ||
|
|
||
| expected_keywords = 'Ulrich Dorda, Beam cooling, high-intensity beams, beam quality, hadron beams, cooling techniques, beam emittance, stochastic cooling, electron cooling, ionization cooling' | ||
| assert_equal expected_keywords, sample.keywords |
Comment on lines
+7
to
+9
| @ingestor = Ingestors::CdsVideosIngestor.new | ||
| @user = users(:regular_user) | ||
| @content_provider = content_providers(:portal_provider) |
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
Screenshots
N/A
Checklist