Skip to content

Commit

Permalink
override an arxiv with real doi if it has one
Browse files Browse the repository at this point in the history
  • Loading branch information
mskarlin committed Oct 23, 2024
1 parent d2282a8 commit d88c838
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions paperqa/clients/semantic_scholar.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,11 @@ async def parse_s2_to_doc_details(
if "data" in paper_data:
paper_data = paper_data["data"][0]

if "ArXiv" in paper_data["externalIds"]:
doi = "10.48550/arXiv." + paper_data["externalIds"]["ArXiv"]
elif "DOI" in paper_data["externalIds"]:
# DOI check goes 1st to override an ArXiV DOI
if "DOI" in paper_data["externalIds"]:
doi = paper_data["externalIds"]["DOI"]
elif "ArXiv" in paper_data["externalIds"]:
doi = "10.48550/arXiv." + paper_data["externalIds"]["ArXiv"]
else:
raise DOINotFoundError(f"Could not find DOI for {paper_data}.")

Expand Down

0 comments on commit d88c838

Please sign in to comment.