aleph.convertors module¶
This module exists to provide ability to convert from AMQP data structures to Aleph’s data structures.
It can convert MARCXMLRecord to EPublication simplified data structure. It can also serialize any namedtuple to JSON.
- aleph.convertors.fromJSON(json_data)[source]¶
Convert JSON string back to python structures.
This is necessary, because standard JSON module can’t serialize namedtuples.
Parameters: json_data (str) – JSON string. Returns: python data/nameduple – with deserialized data.
- aleph.convertors.toEPublication(marcxml)[source]¶
Convert MARCXMLRecord object to EPublication named tuple (see __init__.py).
Parameters: marcxml (str/MARCXMLRecord) – MarcXML which will be converted to EPublication. In case of str, <record> tag is required. Returns: EPublication – named tuple with data about publication. See also
aleph.datastructures.epublication for details of EPublication structure.