Conversation
The OpenAIRE API can return {"name": None} for authors. Using
.get("name", "") only provides a default when the key is missing,
not when the value is None. Changed to use `or ""` to handle both cases.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The search_dois() method is decorated with @connect_to_db which injects the db argument automatically. Calling it with self.search_dois(db) from validate_dois() (also decorated) caused the db to be passed twice. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes two runtime errors encountered during DOI ingestion: handling None author name fields from the OpenAIRE API and avoiding a double db injection when validating DOIs.
Changes:
- Updated
parse_authorinparser.pyto safely handleNonevalues fornameandsurnamefrom OpenAIRE metadata without raisingAttributeError. - Updated
validate_doisindoi.pyto call the decoratedsearch_doiswithout explicitly passing thedbargument, preventing aTypeErrorfrom double-injecting the database driver.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/research_index_backend/parser.py |
Adjusts author name parsing to coerce None name/surname values to empty strings before title-casing, preventing ingestion failures when OpenAIRE returns null for these fields. |
src/research_index_backend/doi.py |
Fixes the internal call from validate_dois to search_dois to rely solely on the @connect_to_db decorator, resolving the double-db injection error during DOI validation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
willu47
approved these changes
Feb 9, 2026
Contributor
willu47
left a comment
There was a problem hiding this comment.
I've tested that the code works locally and confirm that it does.
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
AttributeErrorwhen OpenAIRE API returnsNonefor author name/surname fieldsTypeErrorfrom doubledbinjection when callingsearch_dois()fromvalidate_dois()Problem
When processing longer DOI lists, two bugs prevented successful ingestion:
parser.py: The OpenAIRE API can return
{"name": None}for authors. Using.get("name", "")only provides a default when the key is missing, not when the value isNone, causingAttributeError: 'NoneType' object has no attribute 'title'.doi.py: Both
validate_dois()andsearch_dois()are decorated with@connect_to_db. Callingself.search_dois(db)passeddbexplicitly while the decorator also injected it, causingTypeError: search_dois() takes 2 positional arguments but 3 were given.Fix
metadata.get("name", "")to(metadata.get("name") or "")to handleNonevaluesself.search_dois(db)toself.search_dois()since the decorator handlesdbinjectionTest plan
list_of_doi.csvfrom CCG) that previously failed.