-
Notifications
You must be signed in to change notification settings - Fork 63
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
Add Plaudit endorsements for articles with a DOI #197
base: develop
Are you sure you want to change the base?
Conversation
I think the build failure is not caused by the code in this PR, but if it is, let me know and I'll take another look. |
Conflicts fixed, CLA signed, and it looks like the build failures have been resolved too. Let me know if there are any issues with this PR or the suggested functionality. |
1ee154b
to
2119d50
Compare
Resolved conflict again and updated to |
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.
We can't accept plaudit.js as-is, because it loads code (1,900 lines worth!) that's not under arXiv's control. Since this script executes in the context of our web page, there's simply too much opportunity for mischief, which is why we want labs code to be entirely under our control.
Even if you were to submit endorsements.js
here, instead of loading it from your site, it's probably too big for us to review.
I therefore suggest that you look at an alternative, modelled on the way many other Labs partners have done their integrations. First, query your site for a small data (not code) result that indicates whether you have anything to see about the current article. Iff there's indeed something about the article (a "plaudit"?), then simply provide a link to your own website where the user can see the page for that article in all of its glory.
@cbf66 That's fair. I can work on an alternative that only displays the endorsements, but ideally, arXiv users can also submit new endorsements. We're working with SciELO on an API endpoint that allows them to submit endorsements from their side, and could repurpose that for arXiv as well. However, because that would rely on arXiv authenticating the user, that would require a server-side call with an arXiv-specific API token. Is that something you would be open to? If not, I'd still be happy to work on an integration that merely displays endorsements, if that is of interest to arXiv? |
@Vinnl I think "an integration that merely displays endorsements" is a good short-term goal. We're working on a major revamp of arXiv as we move to the cloud. I'm not interested in adding code for us to hold 3rd party auth tokens and make calls out. Because the better workflow would come when we're both authenticating against the same source ... in the not too distant future. |
Sounds good to me! Let me find some time to work on that and get back to you. |
Well, that took longer than I hoped... The good news is that it now depends on a single API request to the established CrossRef Event Data API, which publishes all endorsement data made in Plaudit, and thus loads no code that's not under arXiv's control. This did come at the cost of losing some functionality: the names of endorsers are no longer shown, so people will have to visit the endorsement page on the Plaudit website to view those and add their own. From my point of view that is fine for this Labs experiment, but let me know what you think. |
: articleTitleElementContent; | ||
|
||
const endorsementsResponse = await fetch( | ||
`https://api.eventdata.crossref.org/v1/events?mailto=arxiv_integration@plaudit.pub&obj-id=${encodeURIComponent(`https://doi.org/${articleDoi}`)}&source=plaudit` |
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.
Wanted to call this out: the public endorsement data is now fetched from CrossRef's Event Data API, which accepts an email address to contact when something goes wrong. I currently set that to arxiv_integration@plaudit.pub
, but let me know if you'd prefer that to be an email address under arXiv's control (and if so, which?).
For now, this merely displays a count of existing endorsements, rather than fetching the actual names of the endorsers from ORCID, to keep the implementation fully client-side and avoid having to authenticate against the ORCID Public API.
This PR accompanies my email proposing integrating Plaudit as an arXiv Labs project. I realise that I did not create an issue first, but I did not spend too much time on this and will not be insulted if this PR is closed or needs to be redone from scratch :)
Plaudit is an endorsement system already used by e.g. the Open Science Framework. It highlights endorsements of a work in the context of that work, and allows academics to add their own endorsements. It is an open source project, and all endorsement data is available as Open Data via CrossRef Event Data.
This PR adds a fifth tab to the arXiv Labs Panel that allows people to enable the Plaudit widget. It will only be shown for articles that have a DOI. To see what the Plaudit widget looks like in a production environment, see e.g. https://psyarxiv.com/5tcwd/
This is what it looks like on arXiv:
To try this out with a Plaudit sandbox, replace
with
in
browse/static/js/plaudit.js
. (Note that the review environment will shut down if it does not receive requests. To wake it up, visit https://arxiv-review.plaudit.pub/.)The embed will only be allowed on
https://arxiv.org
andhttps://beta.arxiv.org
.Let me know what you think.