diff --git a/README.md b/README.md
index b926488..454a6c2 100644
--- a/README.md
+++ b/README.md
@@ -46,6 +46,16 @@ version, license, authors, grants, and DOI/references when available.
4. Validate metadata before export.
5. Download generated metadata files (or ZIP export).
+ORCID suggestions display the name and public affiliations returned by ORCID
+to help distinguish people with similar names. Selecting a suggestion fills
+only the ORCID field; existing names and affiliations are left unchanged.
+OpenCite ranks up to 1,000 name matches by affiliation before showing five
+suggestions. If more matches exist, it asks for manual review instead of
+automatically assigning an ORCID.
+Use **Enable ORCID lookup for imports and suggestions** to disable automatic
+and manual lookups. Turning it off cancels pending lookups but does not remove
+ORCIDs already entered.
+
Most users should use the deployed application. Local setup is primarily for
contributors and development/testing workflows.
diff --git a/src/App.jsx b/src/App.jsx
index 0710dfa..8756ecb 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -5,7 +5,7 @@ import { normalizeMetadata } from './metadata/normalizeMetadata.js';
import { getDefaultReleaseTag } from './metadata/releaseTag.js';
import { updateMetadataField } from './metadata/updateMetadataField.js';
import { importGithubMetadata } from './services/githubImporter.js';
-import { pickPreferredOrcidCandidate, searchOrcidCandidates } from './services/orcidSearch.js';
+import { createOrcidLookupController } from './services/orcidSearch.js';
import { toCitationCff } from './services/citation.js';
import { validateCitationCffText } from './services/citationValidation.js';
import { toZenodoJson } from './services/zenodo.js';
@@ -92,6 +92,7 @@ const PIPELINE_STEPS = [
];
const WARNING_MESSAGE_MAX_LENGTH = 180;
+const INCOMPLETE_ORCID_SEARCH = 'Not all ORCID results could be checked. Refine the name and review suggestions manually.';
function truncateMessage(message, maxLength = WARNING_MESSAGE_MAX_LENGTH) {
const normalized = String(message ?? '').replace(/\s+/g, ' ').trim();
@@ -409,6 +410,7 @@ export default function App() {
const [previewType, setPreviewType] = useState('citation');
const [copyState, setCopyState] = useState('idle');
const [orcidSuggestions, setOrcidSuggestions] = useState({});
+ const [orcidLookupEnabled, setOrcidLookupEnabled] = useState(true);
const [exportNotice, setExportNotice] = useState({ kind: '', message: '', details: [] });
const [touchedFields, setTouchedFields] = useState({});
const [hasImportedMetadata, setHasImportedMetadata] = useState(false);
@@ -425,6 +427,10 @@ export default function App() {
return window.matchMedia?.('(prefers-color-scheme: light)').matches ? 'light' : 'dark';
});
const importRequestIdRef = useRef(0);
+ const orcidLookupRef = useRef(null);
+ if (!orcidLookupRef.current) {
+ orcidLookupRef.current = createOrcidLookupController();
+ }
useEffect(() => {
document.documentElement.setAttribute('data-theme', theme);
@@ -682,11 +688,17 @@ export default function App() {
}
async function resolveOrcidSuggestionsForAuthors(nextForm) {
+ const lookup = orcidLookupRef.current;
+ const generation = lookup.generation;
const authors = Array.isArray(nextForm.authors) ? nextForm.authors : [];
const nextAuthors = [...authors];
const nextSuggestions = {};
for (let index = 0; index < authors.length; index += 1) {
+ if (!lookup.enabled || lookup.generation !== generation) {
+ return { form: nextForm, suggestions: {} };
+ }
+
const author = authors[index];
if (String(author?.orcid ?? '').trim()) {
continue;
@@ -697,9 +709,10 @@ export default function App() {
}
try {
- const suggestions = await searchOrcidCandidates(author);
- const preferred = pickPreferredOrcidCandidate(author, suggestions);
-
+ const { suggestions, preferred, incomplete } = await lookup.search(author);
+ if (!lookup.enabled || lookup.generation !== generation) {
+ return { form: nextForm, suggestions: {} };
+ }
if (preferred) {
nextAuthors[index] = {
...nextAuthors[index],
@@ -708,14 +721,17 @@ export default function App() {
continue;
}
- if (suggestions.length > 0) {
+ if (suggestions.length > 0 || incomplete) {
nextSuggestions[index] = {
loading: false,
suggestions,
- error: '',
+ error: incomplete ? INCOMPLETE_ORCID_SEARCH : '',
};
}
} catch (error) {
+ if (!lookup.enabled || lookup.generation !== generation) {
+ return { form: nextForm, suggestions: {} };
+ }
nextSuggestions[index] = {
loading: false,
suggestions: [],
@@ -766,10 +782,13 @@ export default function App() {
let nextSuggestions = {};
const importedMeaningfulMetadata = hasMeaningfulMetadataValues(nextForm);
- if (result.errors.length === 0 && importedMeaningfulMetadata) {
+ if (result.errors.length === 0 && importedMeaningfulMetadata && orcidLookupRef.current.enabled) {
+ const generation = orcidLookupRef.current.generation;
const resolved = await resolveOrcidSuggestionsForAuthors(nextForm);
- nextForm = resolved.form;
- nextSuggestions = resolved.suggestions;
+ if (orcidLookupRef.current.enabled && orcidLookupRef.current.generation === generation) {
+ nextForm = resolved.form;
+ nextSuggestions = resolved.suggestions;
+ }
}
if (importRequestIdRef.current !== requestId) {
@@ -825,6 +844,12 @@ export default function App() {
}
async function suggestOrcid(index) {
+ const lookup = orcidLookupRef.current;
+ if (!lookup.enabled) {
+ return;
+ }
+
+ const generation = lookup.generation;
const author = form.authors[index] ?? {};
setOrcidSuggestions((current) => ({
@@ -833,16 +858,24 @@ export default function App() {
}));
try {
- const suggestions = await searchOrcidCandidates(author);
+ const { suggestions, incomplete } = await lookup.search(author);
+ if (!lookup.enabled || lookup.generation !== generation) {
+ return;
+ }
setOrcidSuggestions((current) => ({
...current,
[index]: {
loading: false,
suggestions,
- error: suggestions.length > 0 ? '' : 'No ORCID candidates found.',
+ error: incomplete
+ ? INCOMPLETE_ORCID_SEARCH
+ : suggestions.length > 0 ? '' : 'No ORCID candidates found.',
},
}));
} catch (error) {
+ if (!lookup.enabled || lookup.generation !== generation) {
+ return;
+ }
setOrcidSuggestions((current) => ({
...current,
[index]: {
@@ -854,6 +887,15 @@ export default function App() {
}
}
+ function changeOrcidLookup(event) {
+ const enabled = event.target.checked;
+ orcidLookupRef.current.setEnabled(enabled);
+ setOrcidLookupEnabled(enabled);
+ if (!enabled) {
+ setOrcidSuggestions({});
+ }
+ }
+
function applySuggestedOrcid(index, candidate) {
setForm((current) => ({
...current,
@@ -1402,6 +1444,8 @@ export default function App() {
touchedFields={touchedFields}
importedMetadataAvailable={hasImportedMetadata}
orcidSuggestions={orcidSuggestions}
+ orcidLookupEnabled={orcidLookupEnabled}
+ changeOrcidLookup={changeOrcidLookup}
updateField={updateField}
appendGrantSuggestion={appendGrantSuggestion}
appendAllGrantSuggestions={appendAllGrantSuggestions}
diff --git a/src/components/MetadataForm.jsx b/src/components/MetadataForm.jsx
index d4a7ef9..de7281e 100644
--- a/src/components/MetadataForm.jsx
+++ b/src/components/MetadataForm.jsx
@@ -10,6 +10,8 @@ export function MetadataForm({
touchedFields = {},
importedMetadataAvailable = false,
orcidSuggestions = {},
+ orcidLookupEnabled,
+ changeOrcidLookup,
updateField,
appendGrantSuggestion,
appendAllGrantSuggestions,
@@ -82,6 +84,10 @@ export function MetadataForm({
Author list and ORCID
Add authors in publication order, then enrich with ORCID and affiliation.
+