API Docs

Invenio module with nice defaults for MARC21 overlay.

class invenio_marc21.ext.InvenioMARC21(app=None)[source]

Invenio-MARC21 extension.

Extension initialization.

Parameters:app – An instance of flask.Flask.
init_app(app)[source]

Flask application initialization.

Parameters:app – An instance of flask.Flask.
init_config(app)[source]

Initialize configuration.

Parameters:app – An instance of flask.Flask.

Serializers

Base class for dojson based serializers.

class invenio_marc21.serializers.dojson.DoJSONSerializer(dojson_model, replace_refs=False)[source]

Base class for marshmallow serializers.

Initialize serializer.

Parameters:
  • dojson_model – The DoJSON model able to convert JSON through the do() function.
  • replace_refs – Boolean value to configure if the $ref keys are replaced. (Default: False)
dump(obj)[source]

Serialize object with schema.

Parameters:obj – The object to serialize.
Returns:The object serialized.
transform_record(pid, record, links_factory=None)[source]

Transform record into an intermediate representation.

Parameters:
Returns:

The intermediate representation for the record.

transform_search_hit(pid, record_hit, links_factory=None)[source]

Transform search result hit into an intermediate representation.

Parameters:
Returns:

The intermediate representation for the record.

MARC21 based serializer.

class invenio_marc21.serializers.marcxml.MARCXMLSerializer(dojson_model, xslt_filename=None, schema_class=None, replace_refs=False)[source]

DoJSON based MARCXML serializer for records.

Note: This serializer is not suitable for serializing large number of records due to high memory usage.

Initialize serializer.

Parameters:
  • dojson_model – The DoJSON model able to convert JSON through the do() function.
  • xslt_filename – XSLT filename. (Default: None)
  • schema_class – The schema class. (Default: None)
  • replace_refs – Boolean value to configure if replace the $ref keys within the JSON. (Default: False)
dump(obj)[source]

Serialize object with schema.

Parameters:obj – The object to serialize.
Returns:The object serialized.
serialize(pid, record, links_factory=None)[source]

Serialize a single record and persistent identifier.

Parameters:
Returns:

The object serialized.

serialize_oaipmh(pid, record)[source]

Serialize a single record for OAI-PMH.

Parameters:
Returns:

The object serialized.

Serialize a search result.

Parameters:
  • pid_fetcher – Persistent identifier fetcher.
  • search_result – Elasticsearch search result.
  • item_links_factory – Factory function for the items in result. (Default: None)
Returns:

The objects serialized.