Skip to main content

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_RESOLVERS
  • PERSISTENT_IDENTIFIER_PATTERNS
  • DATACITE_URL
  • CROSSREF_URL
  • HANDLE_URL
  • ORCID_PUBLIC_DUMP_S3_BUCKET_NAME
  • ORCID_AWS_ACCESS_KEY_ID
  • ORCID_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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oarepo_related_resources-1.0.0.tar.gz (24.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oarepo_related_resources-1.0.0-py3-none-any.whl (35.8 kB view details)

Uploaded Python 3

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page