Skip to content

fix: improve ORCID search and affiliation matching - #83

Open
beanbean9339 wants to merge 5 commits into
mainfrom
fix/issue-80-orcid-search
Open

beanbean9339 wants to merge 5 commits into
mainfrom
fix/issue-80-orcid-search

Conversation

@beanbean9339

Copy link
Copy Markdown
Collaborator

Summary

Closes #80.

Improves ORCID author search by removing affiliation from the search query and using it to rank matching candidates instead. This helps prevent valid ORCID records from being excluded when GitHub profile company values do not match ORCID affiliation names.

What changed

  • Search query: Search by given and family names without requiring an affiliation match.
  • Affiliation matching: Support multiple GitHub company values separated by commas, semicolons, or pipes, and match them against ORCID affiliations.
  • Candidate ranking: Prioritize candidates whose affiliations match the author's GitHub affiliation, while retaining non-matching candidates as fallbacks.
  • Search results: Request up to 20 results from the ORCID API, rank candidates by affiliation, and return the top 5.
  • Tests: Add coverage for query construction, multiple company values, and candidate ranking.

Testing

  • Verified that affiliation is not required in the ORCID search query.
  • Tested affiliation matching with multiple GitHub company values.
  • Tested that candidates with matching affiliations are ranked first, even when the GitHub company value does not exactly match the ORCID affiliation.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Affiliation matching can automatically assign an incorrect ORCID, and ranking overlooks matching organizations beyond a candidate’s first affiliation.

2 open issues
What changed in this PR

This PR addresses #80 by making OpenCite’s ORCID search less restrictive when GitHub company values differ from ORCID institution names.

Changes:

  • Searches by author name and uses affiliation for local ranking rather than query filtering.
  • Adds company-list matching and ranks up to 20 results before returning five candidates.
  • Adds tests for query construction, company-list matching, and candidate preference.
File Description
tests/​services/​orcidSearch.test.js Adds tests for name-only queries and affiliation-based ranking.
src/​services/​orcidSearch.js Updates query construction, affiliation parsing, and result ranking.

Review effort: Balanced

Comment thread src/services/orcidSearch.js Resolved
Comment thread src/services/orcidSearch.js Resolved
@beanbean9339 beanbean9339 added the bug Something isn't working label Nov 8, 2026
@beanbean9339
beanbean9339 requested a balanced review from Copilot November 8, 2026 21:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Candidate truncation and empty normalized affiliation matches can conceal name ambiguity and cause imports to automatically assign the wrong ORCID.

3 open issues
2 resolved since last review

Review effort: Balanced

Comment thread src/services/orcidSearch.js Resolved
Comment thread src/services/orcidSearch.js Resolved
Comment thread src/services/orcidSearch.js Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The employer-splitting heuristic can cause automatic selection of an unrelated person's ORCID, while the stricter matcher also rejects a valid institution-name variation.

No open issues 🎉

2 previously missed issues

In code that hasn't changed since last review

High severity Avoid matching ambiguous location suffixes as employers

src/​services/​orcidSearch.js:78

The comma heuristic merges Harvard University, Google, preventing either employer from matching, but splits Google, London, allowing London to match University College London. Among same-name candidates, that false match can automatically fill an unrelated person's ORCID. Handle mixed employer lists without treating ambiguous location suffixes as independent employers for automatic selection, and add regression cases for both examples alongside the campus safeguards.

Medium severity Allow leading “The” in institution name matches

src/​services/​orcidSearch.js:100

The stricter matcher now rejects the formatting-only difference between Ohio State University and The Ohio State University, because the is not an allowed extra word. This previously matched and now prevents the candidate from being prioritized or disambiguated among same-name records. Allow the article as an ignorable word so this common institution-name variation still matches without relaxing the campus safeguards.

3 resolved since last review

Review effort: Balanced

@egrace479

egrace479 commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

So, I used TreeOfLife-toolbox as a test since we didn't have ORCIDs listed in the Zenodo JSON (they are in the CFF, though) and looked at Matt : his ORCID lists Imageomics affiliation and he has Imageomics listed on GitHub, but he does't appear in the potential matches:
Screenshot 2026-11-09 at 1 48 14 PM

One more point of clarification. It does list him further down in the results (using middle initial) with his ORCID, presumably pulled from the CITATION.cff. We might consider some merging logic down the road, but from the perspective of this PR, I think it should be able to match the affiliation to find him, no?

Note: his is filled in manually, while the test I had done before used the @mention option to link
Screenshot 2026-11-09 at 1 51 14 PM
VS:
Screenshot 2026-11-09 at 1 51 29 PM

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: ORCID not searchable with Affiliation

3 participants