Function: getOpenAlexIDs() ​
getOpenAlexIDs(
orcid,events):OpenAlexID[]
Defined in: packages/validate-openalex/src/events/getter.ts:78
Extract OpenAlex IDs for an author identified by an ORCID from a set of events.
This function:
- Filters
eventsfor acceptedauthoraffiliation entries whoseidmatches the providedorcidand collects theirfromvalues intoaffiliations. - Filters
eventsfor acceptedauthordisplay name alternatives entries whoseidmatches the providedorcidand collects theirfromvalues intodisplay_name_alternatives. - Computes the intersection of those two collections.
- If the intersection is non-empty, returns the result deduplicated and sorted via
uniqueSorted. Otherwise, returns an empty array.
Notes:
- Matching uses strict equality for
id,entity,field, andstatus(case-sensitive). - Relies on the
IEventshape to containid,entity,field,status, andfromproperties. uniqueSortedis used to deduplicate and sort the intersection before returning.
Parameters ​
orcid ​
The ORCID identifier for the author to look up.
events ​
IEvent[]
An array of events to search through.
Returns ​
An array of OpenAlex IDs (strings) that appear both as accepted affiliations and as accepted display name alternatives for the given author ORCID. Returns [] if none found.
Example ​
ts
// returns ['A1', 'A2'] if both appear in accepted affiliation and display_name_alternatives events
getOpenAlexIDs('0000-0001-2345-6789', events);