Related resource metadata import module extracted from NMA
Project description
oarepo-related-resources
A library for retrieving metadata from persistent identifiers (DOI/Handle) in Invenio/OARepo applications.
What It Does
- detects whether a persistent identifier is supported,
- uses resolvers to fetch metadata (title, creators, publication_date, resource_type, ...),
- returns a normalized internal ID (
doi/...,handle/...) and metadata, - provides an ORCID importer (
current_orcid_importer).
Installation
Add oarepo-related-resources as a dependency in your project.
For local development (editable):
[tool.uv.sources]
oarepo-related-resources = { path = "/path/to/oarepo-related-resources", editable = true }
Registering the Extension
In your application's pyproject.toml:
[project.entry-points."invenio_base.api_apps"]
related_resources_import_extension = "oarepo_related_resources.ext:RelatedResourcesImportExtension"
[project.entry-points."invenio_base.apps"]
related_resources_import_extension = "oarepo_related_resources.ext:RelatedResourcesImportExtension"
Configuration
Default configuration is provided by oarepo_related_resources.config.
Most important keys:
PERSISTENT_IDENTIFIER_RESOLVERSPERSISTENT_IDENTIFIER_PATTERNSDATACITE_URLCROSSREF_URLHANDLE_URLORCID_PUBLIC_DUMP_S3_BUCKET_NAMEORCID_AWS_ACCESS_KEY_IDORCID_AWS_SECRET_ACCESS_KEY
Usage in Code
1) Resolver registry (DOI/Handle -> metadata)
from oarepo_related_resources.proxies import current_resolver_registry
record_data, problems = current_resolver_registry.resolve("https://doi.org/10.1234/abcd")
# record_data:
# {
# "id": "doi/10.1234/abcd",
# "metadata": {
# "title": "...",
# "creators": [...],
# "publication_date": "...",
# "resource_type": {"id": "..."},
# "persistent_url": "https://doi.org/10.1234/abcd"
# }
# }
2) ORCID importer
from oarepo_related_resources.proxies import current_orcid_importer
person = current_orcid_importer.resolve("0000-0001-2345-6789", vocabulary="names")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters