-
Notifications
You must be signed in to change notification settings - Fork 14
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
feat: fetch published doi if preprint #6311
Conversation
- default to preprint if published doi cannot be fetched - remove unused backend.common.providers.crossref_provider - change crossref unit tests to use correct crossref provider
Deployment Summary
|
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #6311 +/- ##
==========================================
+ Coverage 92.42% 92.51% +0.08%
==========================================
Files 179 179
Lines 14702 14783 +81
==========================================
+ Hits 13588 13676 +88
+ Misses 1114 1107 -7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
try: | ||
published_doi = doi_response_message["relation"]["is-preprint-of"] | ||
# the new DOI to query for ... | ||
if published_doi[0]["id-type"] == "doi": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if they ever actually put anything other than a DOI, but since the API returns a list here, we should iterate and look for an entry with id-type 'doi' rather than just checking the first entry
try: | ||
published_doi = doi_response_message["relation"]["is-preprint-of"] | ||
# the new DOI to query for ... | ||
if published_doi[0]["id-type"] == "doi": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if they ever actually put anything other than a DOI, but since the API returns a list here, we should iterate and look for an entry with id-type 'doi' rather than just checking the first entry
published_doi = doi_response_message["relation"]["is-preprint-of"] | ||
# the new DOI to query for ... | ||
if published_doi[0]["id-type"] == "doi": | ||
return self.fetch_metadata(published_doi[0]["id"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that the CrossRef API returns DOIs as strings with the /'s escaped (i.e. "10.3389\/fcvm.2020.00052" from https://api.crossref.org/works/10.1101/2019.12.31.892166). I think we'd need to strip these esc characters if they exist (unless urlparse and/or requests.get already implicitly account for that)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed; the single \
in the context of \/
gets removed once you load from json into dict.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curl https://api.crossref.org/works/10.1101/2019.12.31.892166 | jq '.message.DOI'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approving pending an rdev test confirming functionality
This PR has not seen any activity in the past 2 weeks; if nobody comments or reviews it in the next 3 days, this PR will be closed. |
Reason for Change
Changes
Testing steps
Checklist 🛎️
Notes for Reviewer