Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle single DOI invalid in OpenAlex #78

Merged
merged 1 commit into from
Jul 9, 2024
Merged

Handle single DOI invalid in OpenAlex #78

merged 1 commit into from
Jul 9, 2024

Conversation

lwrubel
Copy link
Collaborator

@lwrubel lwrubel commented Jul 9, 2024

OpenAlex handles DOIs with commas in a way that wasn't expected and may return an empty list before erroring on the second half.

@@ -100,7 +100,8 @@ def publications_from_dois(dois: list):
pubs = Works().filter(doi=doi).get()
if len(pubs) > 1:
logging.warn(f"Found multiple publications for DOI {doi}")
yield normalize_publication(pubs[0])
if pubs:
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be an else?

Copy link
Contributor

@edsu edsu Jul 9, 2024

Choose a reason for hiding this comment

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

Actually I understand now. But maybe it would read a bit better as if len(pubs) > 0 ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Made that change

@lwrubel lwrubel force-pushed the openalex-bugfix branch from e441c80 to 61afdcd Compare July 9, 2024 17:18
@lwrubel lwrubel merged commit 2dfbc57 into main Jul 9, 2024
1 check passed
@lwrubel lwrubel deleted the openalex-bugfix branch July 9, 2024 17:35
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.

2 participants