Skip to content

Organizations

client.organizations queries /v4/organizations and returns Organization records. It supports the shared operations (get, exists, search, iterate, collect, first, count, batch_get) plus find_variants for name variants and the aggregation helper facets.

from bibliofabric.openaire import OpenAireClient, OrganizationsFilters

client = OpenAireClient()

Later blocks reuse this client. In your own scripts, open it with async with OpenAireClient() as client: so that the HTTP session closes.

page = await client.organizations.search(
    OrganizationsFilters(country="NL"), query="university of twente", page_size=3
)
print(page.total, "matches")
for org in page.results:
    print(" ", org.id, "|", org.legal_name)
17 matches
  openorgs____::5051dc5a570e109474ca2f2d846ebe37 | Max Planck University of Twente Center for Complex Fluid Dynamics
  pending_org_::4c6217fc9cb67f8707ccde16bff51df3 | University of Twente Science and Technology
  pending_org_::c8efe66c0a3877f92e66c5c69e2d7fa6 | University of Twente / Robotics and Mechatronics Lab

The keyword search matches name fragments, so variants and merged records come before the canonical University of Twente record (openorgs____::604881198363fedbb5d5478f465305f2). pending_org_:: records are kept on purpose. They carry organization-project links that the canonical merged record lost. Decide yourself whether to keep them when you process results.

Get one organization

org = await client.organizations.get("openorgs____::604881198363fedbb5d5478f465305f2")
print(
    org.legal_name,
    "|",
    org.legal_short_name,
    "|",
    org.country.code,
    "|",
    org.website_url,
)
University of Twente | University of Twente | NL | http://www.utwente.nl/en/

get() takes the internal id and reads the V3 by-id route with its :: colons unencoded. A missing id raises NotFoundError.

Find name variants

find_variants() runs one search per name fragment and returns the results deduplicated by exact id, keeping the first match:

orgs = await client.organizations.find_variants(
    ["universiteit twente", "university of twente"], country="NL", page_size=3
)
for org in orgs[:4]:
    print(org.id, "|", org.legal_name)
pending_org_::f208628c3611cc36be31e23b6c09317f | Universiteit Twente, Servicecentrum Bibliotheek & Archief
openorgs____::604881198363fedbb5d5478f465305f2 | University of Twente
openorgs____::46d088020355cac53b9e53a23f13a685 | Universiteit Leiden, Faculteit der Archeologie
openorgs____::5051dc5a570e109474ca2f2d846ebe37 | Max Planck University of Twente Center for Complex Fluid Dynamics

find_variants() is the quick way to map several spellings of the same institution onto records. Merge the pending_org_:: records yourself.

Counts

n = await client.organizations.count({"country": "NL"})
print("NL organizations:", n)

by_country = await client.organizations.facets("country")["country"]
print(dict(list(by_country.items())[:3]))
NL organizations: 8909
{'UNKNOWN': 150350, 'US': 64397, 'FR': 30983}

The UNKNOWN bucket holds records whose country is not set. Filter fields live in OrganizationsFilters (country, continent, legal_name_search, communities_id, and more); plain dictionaries accept the same dotted keys.