Skip to content

feat: ORCID deposition for codecheckers + CODECHECK form in reviewer tab (#16)#126

Open
subhanLabs wants to merge 3 commits into
mainfrom
feature/orcid-deposit
Open

feat: ORCID deposition for codecheckers + CODECHECK form in reviewer tab (#16)#126
subhanLabs wants to merge 3 commits into
mainfrom
feature/orcid-deposit

Conversation

@subhanLabs
Copy link
Copy Markdown
Member

@subhanLabs subhanLabs commented Jun 1, 2026

Summary

This PR implements two major features for the CODECHECK plugin:

  1. ORCID Deposition — allows codecheckers to authorise the journal to deposit their CODECHECK peer-review activity to their ORCID profile via the ORCID Member API.
  2. CODECHECK form in reviewer tab — injects a collapsible CODECHECK documentation section into the reviewer's Download & Review tab (tab 3).

Changes

New Classes

  • classes/Orcid/OrcidApiClient.php — low-level ORCID API HTTP client
  • classes/Orcid/OrcidAuthHandler.php — handles OAuth 2.0 authorisation flow (startAuth/callback)
  • classes/Orcid/OrcidDepositService.php — builds and deposits peer-review records to ORCID
  • classes/Orcid/OrcidTokenDAO.php — manages token storage in codecheck_orcid_tokens table
  • classes/Orcid/PeerReviewPayloadBuilder.php — constructs ORCID peer-review XML payload
  • classes/Log/CodecheckLogger.php — structured logger with debug/info/error levels

Modified Files

  • CodecheckPlugin.php — ORCID hooks, reviewer data injection, publish handler
  • api/v1/CodecheckApiHandler.php — added orcid-status and orcid-deposit endpoints, reviewer role
  • api/v1/JsonResponse.php — made constructor args optional, added response() convenience method
  • classes/Constants.php — added all ORCID and GitHub constants
  • classes/migration/CodecheckSchemaMigration.php — added codecheck_orcid_tokens table
  • locale/en/locale.po — added ORCID and missing locale keys
  • registry/uiLocaleKeysBackend.json — added ORCID locale keys
  • resources/js/main.js — ORCID section in workflow, reviewer form injection via MutationObserver
  • resources/js/Components/CodecheckOrcidSection.vue — Vue component for ORCID authorisation and deposit UI

How it works

ORCID OAuth flow

  1. Editor opens the CODECHECK tab in the editorial workflow
  2. Each codechecker sees an "Authorise ORCID" button
  3. Clicking redirects to ORCID sandbox/production for consent
  4. On callback, token is stored in codecheck_orcid_tokens
  5. On publication (or manually), deposit is triggered automatically

Reviewer form

  1. When reviewer opens tab 3 (Download & Review), a MutationObserver detects the tab content loading
  2. A collapsible "CODECHECK Documentation" section is injected below the review form
  3. It mounts CodecheckMetadataForm and optionally CodecheckOrcidSection if ORCID is enabled

Notes

  • ORCID settings (client ID, secret, API type) will appear in the settings page once the settings form PR is merged
  • Sandbox API is used by default during development
  • All raw error_log() calls replaced with CodecheckLogger (debug/info/error levels)

Closes #16

…tab (#16)

- Full OAuth 2.0 flow for codechecker ORCID authorisation
- ORCID Member API peer-review deposition on publish and manually
- CODECHECK metadata form injected into reviewer tab 3 (Download & Review)
- ORCID section shown in editor workflow CODECHECK tab
- codecheck_orcid_tokens DB table for token/deposit tracking
- Reviewer role added to API handler
- All settings read from plugin configuration
@nuest
Copy link
Copy Markdown
Member

nuest commented Jun 1, 2026

Thanks!

Can you please clarify re. "Editor opens the CODECHECK tab in the editorial workflow" > the codechecker needs to be the one that opens the tab and initiates the authentication with ORCID, right?

It would be great, because this is a crucial feature, if you could add a couple of screenshots or maybe even a screencast to document the completed functionality.

Copy link
Copy Markdown
Member

@nuest nuest left a comment

Choose a reason for hiding this comment

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

General comments first, detailed line-by-line review later.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does this mean we store the token forever and can edit the profile with that token?

Is there a way for a codechecker to stop allowing us to add data to their profile?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Token storage:
Yes we store the token, but the scope is limited to /activities/update, we can only add/update peer-review records, nothing else on their profile.

Revoking access:
The codechecker must authorise themselves, we match their ORCID ID against the authenticated token, so no one else can authorise on their behalf. To stop allowing deposits, they can revoke access directly from their ORCID account under "Trusted organizations" which immediately invalidates our stored token.

Comment thread classes/Orcid/OrcidApiClient.php
Comment thread classes/Orcid/OrcidApiClient.php
'review-group-id' => $groupId,
'review-identifiers' => $this->buildReviewIdentifiers($certificateDoi),
'convening-organization' => $this->buildConveningOrganization($journal),
'subject-type' => 'journal-article',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What subject types does the ORCID API know? Could there be the need here to switch to something else, like a preprint?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The ORCID peer-review API supports these subject types: book, book-chapter, book-review, dataset, edited-book, encyclopedia-entry, journal-article, journal-issue, magazine-article, manual, newsletter-article, newspaper-article, online-resource, other, preprint, report, research-tool, supervised-student-publication, test, translation, website, working-paper.

You raise a valid point, if the submission is a preprint rather than a published journal article, preprint would be more accurate.

We could either hardcode journal-article since CODECHECK is journal-focused, or make the subject type configurable or derived from the submission type. What would you recommend, should we keep it fixed or add flexibility here?


$payload = [
'reviewer-role' => 'reviewer',
'review-type' => 'review',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What review types does the ORCID API know?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The ORCID peer-review API does not have a codechecker role. The available roles are chair, editor, member, organizer, reviewer, reviewer-external, and senior-editor. We used reviewer as the closest match, Happy to change this if you have a preference.

Comment thread resources/js/Components/CodecheckOrcidSection.vue Outdated
Comment thread changes.diff Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should this file be actually added here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good catch, that file was accidentally included. I have removed it.

Comment thread CodecheckPlugin.php
/**
* Triggered when an editor publishes an article.
*/
public function onPublicationPublish(string $hookName, array $args): bool
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This ssems to require that the ORCID credentials must be provided by codecheckers before the publication.

_Is it also possible that a CODECHECK goes to the OJS backend after the article is published and then triggers the deposition?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, absolutely. The automatic deposition on publication is just a convenience, if the codechecker has not authorised before publication, or if the deposit fails, editors can still trigger it manually at any time using the "Deposit to ORCID" button in the CODECHECK workflow tab. The button remains available after publication so codecheckers can authorise and deposit retroactively.

Comment thread CodecheckPlugin.php
$depositService = new OrcidDepositService($this);
$results = $depositService->depositForSubmission($submission->getId());
foreach ($results as $result) {
if ($result['status'] === 'success') {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please make a proposal how to include user facing messaging about the results and failures here.

If that means we need a database table to capture the deposition state, then that is fine.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I already store the deposition state in the codecheck_orcid_tokens table, each row has a deposit_status column (pending, success, failed), a put_code for successful deposits, and an error_message for failures.

The results are surfaced to editors in the CODECHECK workflow tab via the ORCID Deposition section, which shows each codechecker's current status badge (NOT AUTHORISED / PENDING / DEPOSITED / FAILED) and displays the error message inline when a deposit fails. This is loaded via the orcid-status API endpoint on every page load so the state is always current.

Comment thread CodecheckPlugin.php
- Fix ORCID iD mismatch check to validate against all codecheckers
- Remove city as required field, only name and country needed
- Bundle ORCID icon locally instead of loading from orcid.org
- Restrict auth button to reviewer form, editors see status only
- Add Test ORCID Setup button in plugin settings
- Add ORCID settings section to settings form and template
@subhanLabs subhanLabs requested a review from nuest June 8, 2026 04:15
@nuest
Copy link
Copy Markdown
Member

nuest commented Jun 8, 2026

@subhanLabs For the sake of documentation, can you please update local docs or the README file which field mentioned in https://support.orcid.org/hc/en-us/articles/360006971333-Peer-Reviews your code sets, and what values are put in there? Thanks!

@nuest
Copy link
Copy Markdown
Member

nuest commented Jun 8, 2026

@subhanLabs For the sake of documentation, please post a screenshot of the ORCID Deposition section here.

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.

Codechecking activity is deposited in ORCID profile

2 participants