Skip to content

Modules

Core modules

Koha

Koha scripts for processing MARC files and interacting with API.

Oauth2 session

In order to interact with your Koha API you will need to create a Client ID and Secret Key for your Koha admin user. Follow the offical documentation in order to generate Client and Secret keys for your user.

GET metadata from Koha

There are two main serializations for the MARC metadata of records and authorities that the Koha API provides: a detailed MARC in JSON dictionary serialization and a standard JSON serialization.

PUT metadata to Koha

Import bibliographic and authority catalogue

In order to import the whole catalogue, we provide two methods:

  1. Batch import from pre-downloaded MARC file from Cataloging/Stage record for import. See import_koha_authorities_from_marc and import_koha_biblios_from_marc.
  2. Batch import via API with parallel processing. See import_koha_authorities_from_api and import_koha_biblios_from_api.

Utilities

The module provides a series of functions that will extract specific fields from the MARC-in-JSON dictionary, such as

Enhancing modules

Wikidata

This module provides a way to programmatically interact with Wikidata or another Wikibase instance. It is mostly based on WikibaseIntegrator and requires specific username-password or API keys credentials.

Authentication

In order to avoid Too Many Requests errors from the API endpoint, we advise to create an account on Wikidata (or another Wikibase instance).

Enhancing Authorities

These scripts provide a controlled way to enrich your catalogue's authorities from Wikidata or another Wikibase instance.

The methods do not direct update the Koha catalogue. Instead, they generate backup_auth and changed_auth lists of dictionaries which are stored locally as JSON files. Once the user has manually checked the integrity of the data via sampling, the new records can be updated via pyreslib.wikidata.update_enhanced_authorities.

Mapping Wikidata properties URIs

In order to specify a relation statement between two authorites in our Koha catalogue, we have found a solution by recording the property's URI (such as [country][http://wikidata.org/entity/P17]) via a new subfield i, not belonging to the standard MARC21 framework for field 024.

To facilitate readibility of the URIs, we have created a new Authorized value group called RELATION_PROPERTY, associating each URI to the property name.

Google Books

This module allows to harvest metadata information from the Google Books API via ISBN of the book. This is useful if you wish to populate your new record with basic metadata by only providing the ISBN code in field 020. A mapping between Google and Koha fields is available in data/mappins/google.

Transkribus

This module allows the user to interact with the Transkribus API directly on Python. Transkribus is a state-of-the-art Handwritten Text Recognition platform for Digital Humanities scholars.

Kraken

Kraken is an open-source OCR and HTR software built in Python. Because of its size, we have set its dependencies as optional and you have to build them manually via uv or pip.

uv add pyreslib[ocr] # uv
pip install pyreslib[ocr] # pip

Conversion modules

MARC

This module allows to process MARC files and records with the help of pymarc. It provides methods to convert MARC records to JSON dictionaries and vice versa, as well as to extract and modify specific information from MARC records.

BibTeX

This modules allows the export of bibliographic records in BibTeX format, improving the built-in Koha export feature.

RDF

This module provides a series of scripts in order to export Koha record to RDF data structures using the RDFlib Python package.

Omeka S

Still in development...

ResourceSpace

Still in development...