qubes.bulk_import¶
Bulk-import publication metadata from QUBES Hub via the OAI-PMH API.
QUBES Hub exposes an OAI-PMH (Open Archives Initiative Protocol for Metadata
Harvesting) endpoint. This module reads from the locally cached
qubes_records.json file (generated by convert_qubes_xml_to_json.py)
and translates each record into a standardised OME EducationResource card.
Attributes¶
Functions¶
|
Validate raw record dicts into |
|
Translate raw QUBES record dicts to OME EducationResource cards. |
|
Load QUBES records from the local cache and return serialised OME records. |
Module Contents¶
- qubes.bulk_import.QUBES_OAI_URL = 'https://qubeshub.org/oaipmh/?verb=ListRecords&metadataPrefix=oai_dc&set=publications'¶
- qubes.bulk_import.QUBES_BASE_URL = 'https://qubeshub.org'¶
- qubes.bulk_import.logger¶
- qubes.bulk_import.plugin¶
- qubes.bulk_import._parse_records(items: list) list[server.plugins.qubes.qubes_models.ModelItem]¶
Validate raw record dicts into
ModelItemobjects.Uses a Python 3.13+ ExceptionGroup to collect all validation errors and report them together while returning valid records to the caller.
- qubes.bulk_import.bulk_translate(records: list[dict]) collections.abc.Iterator[server.plugins.ome_plugin.EducationResource]¶
Translate raw QUBES record dicts to OME EducationResource cards.
- qubes.bulk_import.bulk_import(cache_path: pathlib.Path | None = None) list[dict]¶
Load QUBES records from the local cache and return serialised OME records.
The cache file
qubes_records.jsonis generated byconvert_qubes_xml_to_json.pyfrom the OAI-PMH XML export. Run that script first if the cache does not yet exist.- Args:
- cache_path: Path to
qubes_records.json. IfNone, defaults to the file next to this module.
- cache_path: Path to
- Returns:
A list of serialised
EducationResourcedicts.- Raises:
FileNotFoundError: If
qubes_records.jsondoes not exist.
- qubes.bulk_import.here¶