API reference
Generated from the source with mkdocstrings. Every path below is the public import path; private plumbing stays out of the pages. The sync twins mirror every async resource under the suffixed name (NamespacesSyncResource, ResourcesSyncResource, InstitutionsSyncResource, LocationsSyncResource); their pages are identical, so they are not listed again here.
Client
bibliofabric.identifiersdotorg.IdentifiersDotOrgClient
Client for the Identifiers.org resolution and registry APIs.
The resolver needs no credentials. resolve(), reverse(), and
similar() read the resolution API at resolver.api.identifiers.org
(the client's base URL); the namespaces, resources,
institutions, and locations resources read the registry API at
registry.api.identifiers.org. namespace_usage() reads the
registry statistics route, and download_resolver_dataset() fetches
the full registry snapshot. The client paces itself at one request per
second by default.
namespaces: NamespacesResource
cached
property
The registry namespace resource client.
resources: ResourcesResource
cached
property
The registry resource (provider) resource client.
institutions: InstitutionsResource
cached
property
The registry institution resource client.
locations: LocationsResource
cached
property
The registry location (country) resource client.
resolve(curie: str) -> list[ResolvedResource]
async
Resolve a compact identifier and return its resources.
The answer lists one entry per provider of the namespace, sorted by
the upstream recommendation index (highest first). Accepts
namespace curies (taxonomy:9606) and provider-code curies
(pdbe/pdb:2gc4). An unresolvable curie (unknown prefix, local
identifier that misses the namespace pattern, or no colon) answers
HTTP 400 upstream and raises NotFoundError carrying the
upstream explanation.
reverse(url: str, *, accession: str | None = None) -> ReverseMatch | None
async
Convert a provider URL into its identifiers.org URI, exactly.
Returns the match with prefix, curie, and pattern check, or
None when no namespace claims the URL (upstream answers 204).
accession supplies the local identifier; without it the
resolver guesses it from the URL components.
similar(url: str, *, accession: str | None = None) -> list[ReverseMatch]
async
List identifiers.org URIs similar to a provider URL.
Ranked by upstream similarity score. Returns an empty list when nothing matches.
namespace_usage(prefix: str) -> NamespaceUsage
async
Return the usage counts the registry reports for one prefix.
The upstream statistics feature is in trial and may disappear;
a prefix without data raises NotFoundError.
download_resolver_dataset(dest: Path | str) -> Path
async
Stream the full registry snapshot to dest.
The snapshot holds every namespace with its nested resources (869
namespaces, about 2 MB). Read it with
:func:bibliofabric.identifiersdotorg.iter_resolver_dataset. The
download goes to a temporary file next to dest that replaces
dest only after the last chunk arrived, so an interrupted
download leaves no partial file. Parent directories are created,
an existing file is overwritten, and the path is returned.
Settings
bibliofabric.identifiersdotorg.IdentifiersDotOrgSettings
Identifiers.org client settings.
Inherits timeout, max_retries, max_retry_wait,
max_requests_per_second, max_concurrency, user_agent and
mailto from :class:bibliofabric.config.BaseApiSettings. The
resolution and registry routes need no credentials; prefix registration
is a separate write workflow and out of scope.
max_requests_per_second: float | None = Field(default=DEFAULT_MAX_REQUESTS_PER_SECOND, gt=0)
class-attribute
instance-attribute
max_concurrency: int = Field(default=DEFAULT_MAX_CONCURRENCY, gt=0)
class-attribute
instance-attribute
Resources
bibliofabric.identifiersdotorg.NamespacesResource
Client for the /restApi/namespaces routes.
get(id) reads one namespace by its numeric registry id;
:meth:by_prefix reads one namespace by its prefix, the key users
normally have. The browse route behind search() lists every
namespace, and iterate() and collect() walk it page by page.
by_prefix(prefix: str) -> Namespace
async
Return the namespace with exactly this prefix.
Raises NotFoundError when the prefix is not registered.
by_prefix_containing(content: str, *, sort: str | None = None) -> list[Namespace]
async
Return every namespace whose prefix contains content.
by_prefix_start(prefix_start: str, *, sort: str | None = None) -> list[Namespace]
async
Return every namespace whose prefix starts with prefix_start.
bibliofabric.identifiersdotorg.ResourcesResource
Client for the /restApi/resources routes.
A registry resource is a provider site for one namespace. get(id)
reads one resource by its numeric registry id; the by_ methods
read the search routes and return every match as a list.
by_namespace(namespace_id: int | str) -> list[RegistryResource]
async
Return every resource of the namespace with this registry id.
by_namespace_and_provider_code(namespace_id: int | str, provider_code: str) -> list[RegistryResource]
async
Return the resources of one namespace under one provider code.
by_provider_code(provider_code: str) -> list[RegistryResource]
async
Return every resource served under provider_code.
bibliofabric.identifiersdotorg.InstitutionsResource
Client for the /restApi/institutions routes.
get(id) reads one institution by its numeric registry id;
:meth:by_name reads one institution by its exact name, which the
upstream route requires verbatim (EBI answers 404, the full name
European Bioinformatics Institute answers the record).
by_country_code(country_code: str) -> list[Institution]
async
Return every institution located in country_code (ISO 3166).
by_name(name: str) -> Institution
async
Return the institution whose name matches name exactly.
Raises NotFoundError when no institution carries this name.
by_name_fragment(name_content: str) -> list[Institution]
async
Return every institution whose name contains name_content.
bibliofabric.identifiersdotorg.LocationsResource
Client for the /restApi/locations routes.
A location is a country, and its id is the ISO 3166 country code, so
get("GB") returns Great Britain and search() lists every
location. The upstream findByCountryCode search route answers the
same record as get(), so the client wraps only the direct route.
Models
bibliofabric.identifiersdotorg.Namespace
A namespace (prefix) of the registry.
Collection records carry prefix, mirId, name, pattern,
and description; the resolver dataset copies add id and the
nested resources list and may carry a successor.
bibliofabric.identifiersdotorg.RegistryResource
A resource (provider) of the registry.
providerCode is "" when the resource has no provider code,
which is the case for most official resources. Collection records
carry no institution or location; dataset and resolver copies
nest both.
bibliofabric.identifiersdotorg.Institution
An institution of the registry.
The nested copies inside dataset resources and resolver answers omit
created and modified and may carry "CURATOR_REVIEW"
placeholders in homeUrl and description.
bibliofabric.identifiersdotorg.Location
A country of the registry, or the location nested in a record.
The location routes carry countryName and created only; the
nested copies inside institutions, resources, and resolver answers
carry countryCode and countryName.
bibliofabric.identifiersdotorg.ResolvedResource
One provider answer for a resolved compact identifier.
The resolver sorts resolvedResources by recommendation.recommendationIndex
descending. compactIdentifierResolvedUrl is None for resources
that currently have no working URL, and providerCode is "" for
resources without a provider code.
bibliofabric.identifiersdotorg.ReverseMatch
One identifiers.org URI guess for a provider URL.
lui_pattern_match reports whether the guessed local identifier
matches the namespace pattern; similarity_score runs from 0 to 100.
Both URI fields are None when the namespace pattern rejects the
guessed identifier.
bibliofabric.identifiersdotorg.NamespaceUsage
Usage counts for one namespace, as reported by the statistics route.
Resolver dataset
bibliofabric.identifiersdotorg.iter_resolver_dataset(path: Path | str) -> Iterator[Namespace]
Yield one :class:Namespace per namespace of a downloaded dataset.
The dataset file is the JSON answer of
https://registry.api.identifiers.org/resolutionApi/getResolverDataset
(about 2 MB): every namespace of the registry with its nested
resources. Namespaces validate lazily, one at a time; a record that
does not match the model raises
:class:bibliofabric.ValidationError. The top-level apiVersion and
errorMessage keys of the envelope are not returned; an envelope
without a payload.namespaces list raises ValueError.