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

Limit the response size for ORCID lookup #80

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion rialto_airflow/harvest/openalex.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ def dois_from_orcid(orcid: str, limit=None):

# get all the works for the openalex author id
work_count = 0
for page in Works().filter(author={"id": author_id}).paginate(per_page=200):
for page in (
Works().filter(author={"id": author_id}).select(["doi"]).paginate(per_page=200)
):
for pub in page:
if pub.get("doi"):
work_count += 1
Expand Down
6 changes: 6 additions & 0 deletions test/harvest/test_openalex.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,9 @@ def test_pyalex_urlencoding():
)
== 2
), "we handle url URL encoding DOIs until pyalex does"


def test_pyalex_varnish_bug():
# it seems like this author has a few records that are so big they blow out
# OpenAlex's Varnish index. See https://groups.google.com/u/1/g/openalex-community/c/hl09WRF3Naw
assert len(list(openalex.dois_from_orcid("0000-0003-3859-2905"))) > 270
Loading