Convertor

This module exists to provide ability to convert from Aleph’s data structures to AMQP data structures, specifically to convert MARCXMLRecord to EPublication simplified data structure.

aleph.datastructures.convertor.toSemanticInfo(xml)[source]

Pick informations from MARCXMLRecord object and use it to build SemanticInfo structure.

Parameters:xml (str/MARCXMLRecord) – MarcXML which will be converted to SemanticInfo. In case of str, <record> tag is required.
Returns:structureSemanticInfo.
aleph.datastructures.convertor.toEPublication(xml)[source]

Convert MARCXMLRecord object to EPublication namedtuple.

Parameters:xml (str/MARCXMLRecord) – MarcXML which will be converted to EPublication. In case of str, <record> tag is required.
Returns:structureEPublication namedtuple with data about publication.

See also

aleph.datastructures.epublication for details of EPublication, structure.

aleph.datastructures.convertor.getDocNumber(xml)[source]

Parse <doc_number> tag from xml.

Parameters:xml (str) – XML string returned from aleph.aleph.downloadRecords()
Returns:str – Doc ID as string or “-1” if not found.

Previous topic

Data structures

Next topic

SemanticInfo structure

This Page