API Docs

Flask extension for Invenio-SIP2.

class invenio_sip2.ext.InvenioSIP2(app=None)[source]

Invenio-SIP2 extension.

Extension initialization.

add_console_handler(app)[source]

Add console handler to logger.

add_fs_handler(app)[source]

Add file handler to logger.

classmethod get_logging_formatter()[source]

Return logging formatter.

init_app(app)[source]

Flask application initialization.

init_config(app)[source]

Initialize configuration.

property retries_allowed[source]

Number of retries allowed by the automated circulation system.

property sip2[source]

Return the SIP2 action machine.

property sip2_current_date

Get current date from system.

property sip2_handlers[source]

Return the SIP2 handler machine.

property sip2_language

Get default language from system.

property sip2_message_types[source]

Message type configuration.

property support_checkin[source]

Support of checkin by the automated circulation system.

property support_checkout[source]

Support of checkout by the automated circulation system.

property support_offline_status[source]

Support of offline status by the automated circulation system.

property support_online_status[source]

Support of online status by the automated circulation system.

property support_renewal_policy[source]

Support of renewal policy by the automated circulation system.

property support_status_update[source]

Support of status update by the automated circulation system.

supported_messages(remote_app)[source]

Supported messages by the automated circulation system.

property supported_protocol[source]

Supported protocol by the automated circulation system.

property timeout_period[source]

Timeout period allowed by the automated circulation system.

invenio_sip2.ext.load_fixed_field(app)[source]

Load fixed field configuration.

invenio_sip2.ext.load_variable_field(app)[source]

Load variable field configuration.

Actions

Invenio-SIP2 custom actions.

class invenio_sip2.actions.actions.AutomatedCirculationSystemStatus(command, response, **kwargs)[source]

Action to get status from automated circulation system.

Init action object.

execute(message, client)[source]

Execute action.

class invenio_sip2.actions.actions.BlockPatron(command, response, **kwargs)[source]

Action to block patron.

Init action object.

execute(message, client, **kwargs)[source]

Execute action.

class invenio_sip2.actions.actions.Checkin(command, response, **kwargs)[source]

Action to checkin an item.

Init action object.

execute(message, client, **kwargs)[source]

Execute checkin action.

class invenio_sip2.actions.actions.Checkout(command, response, **kwargs)[source]

Action to checkout an item.

Init action object.

execute(message, client, **kwargs)[source]

Execute checkout action.

class invenio_sip2.actions.actions.EndPatronSession(command, response, **kwargs)[source]

Action to end patron session on automated circulation system.

Init action object.

execute(message, client)[source]

Execute action.

class invenio_sip2.actions.actions.FeePaid(command, response, **kwargs)[source]

Action to paid fee.

Init action object.

execute(message, client, **kwargs)[source]

Execute action.

class invenio_sip2.actions.actions.Hold(command, response, **kwargs)[source]

Action to hold an item.

Init action object.

execute(message, client, **kwargs)[source]

Execute hold action.

class invenio_sip2.actions.actions.ItemInformation(command, response, **kwargs)[source]

Action to get item information from automated circulation system.

Init action object.

execute(message, client)[source]

Execute action.

class invenio_sip2.actions.actions.ItemStatusUpdate(command, response, **kwargs)[source]

Action to update item status.

Init action object.

execute(message, client, **kwargs)[source]

Execute action.

class invenio_sip2.actions.actions.PatronEnable(command, response, **kwargs)[source]

Action to enable patron on automated circulation system.

Init action object.

execute(message, client)[source]

Execute action.

class invenio_sip2.actions.actions.PatronInformation(command, response, **kwargs)[source]

Action to get patron information from automated circulation system.

Init action object.

execute(message, client)[source]

Execute action.

class invenio_sip2.actions.actions.PatronStatus(command, response, **kwargs)[source]

Action to get patron status from automated circulation system.

Init action object.

execute(message, client)[source]

Execute action.

class invenio_sip2.actions.actions.Renew(command, response, **kwargs)[source]

Action to renew an item.

Init action object.

execute(message, client, **kwargs)[source]

Execute checkout action.

class invenio_sip2.actions.actions.RenewAll(command, response, **kwargs)[source]

Action to renew all items.

Init action object.

execute(message, client, **kwargs)[source]

Execute action.

class invenio_sip2.actions.actions.RequestResend(command)[source]

Action to resend last message.

Init action object.

execute(message, client)[source]

Execute action.

class invenio_sip2.actions.actions.SelfCheckLogin(command, response, **kwargs)[source]

Action to selfcheck login.

Init action object.

execute(message, **kwargs)[source]

Execute action.

Records API

API for manipulating the client.

class invenio_sip2.records.record.Client(data, **kwargs)[source]

class for selfcheck client.

Initialize instance with dictionary data.

Parameters

data – Dict with record metadata.

clear_patron_session()[source]

Shortcut to library name.

get_current_patron_session()[source]

Shortcut to patron session.

get_key()[source]

Get generated key for Client object.

property get_last_sequence_number

Shortcut to user id.

get_server()[source]

Get server object.

property institution_id

Shortcut to institution id.

property is_authenticated

Shortcut to check if the selfcheck client is authenticated.

property last_request_message

Shortcut to user id.

property last_response_message

Shortcut to user id.

property library_language

Shortcut for library language.

property library_name

Shortcut to library name.

property remote_app

Shortcut for remote app.

property server_id

Get server identifier.

property terminal

Shortcut to terminal.

property transaction_user_id

Shortcut to user id.

class invenio_sip2.records.record.Server(data, **kwargs)[source]

class for SIP2 server.

Initialize instance with dictionary data.

Parameters

data – Dict with record metadata.

clear_all_clients()[source]

Clear all clients.

classmethod create(data, id_=None, **kwargs)[source]

Create record.

Parameters
  • data – Dict with metadata.

  • id – Specify a UUID to use for the new record.

delete()[source]

Delete server and all attached clients.

down()[source]

Set server status to Down and clear all clients data.

classmethod find_server(**kwargs)[source]

Find server depending kwargs.

get_clients()[source]

Return clients.

property is_running

Check if server is running.

property number_of_clients

Shortcut for number of clients.

up()[source]

Set server status to running and clear all clients data.

class invenio_sip2.records.record.Sip2RecordMetadata(data, **kwargs)[source]

Sip2RecordMetadata class.

Initialize instance with dictionary data.

Parameters

data – Dict with record metadata.

classmethod count()[source]

Return number of all records based on record type.

classmethod create(data, id_=None, **kwargs)[source]

Create record.

Parameters
  • data – Dict with metadata.

  • id – Specify a UUID to use for the new record.

delete()[source]

Delete record by uuid.

dumps(**kwargs)[source]

Return pure Python dictionary with record metadata.

classmethod get_all_records()[source]

Get all records.

get_key()[source]

Get generated key for Sip2RecordMetadata object.

classmethod get_record_by_id(id_)[source]

Get record by uuid.

property id

Shortcut for id.

search(query='*', index_type=None, filter_query=None)[source]

Search record by query.

update(data)[source]

Update instance with dictionary data.

Parameters

data – Dict with metadata.

Models

Models for Invenio-SIP2.

class invenio_sip2.models.PatronStatus[source]

Class to define patron status.

Constructor.

add_patron_status_type(patron_status_type)[source]

Add patron status.

Parameters

patron_status_type – Enum of patron status type

Add patron_status_type indicates that the condition is true. raise exception if patron status type does not exist.

class invenio_sip2.models.PatronStatusTypes(value)[source]

Enum class to list all possible patron status types.

CARD_REPORTED_LOST = 'card_reported_lost'
CHARGE_PRIVILEGES_DENIED = 'charge_privileges_denied'
EXCESSIVE_OUTSTANDING_FEES = 'excessive_outstanding_fees'
EXCESSIVE_OUTSTANDING_FINES = 'excessive_outstanding_fines'
HOLD_PRIVILEGES_DENIED = 'hold_privileges_denied'
RECALL_OVERDUE = 'recall_overdue'
RECALL_PRIVILEGES_DENIED = 'recall_privileges_denied'
RENEWAL_PRIVILEGES_DENIED = 'renewal_privileges_denied'
TOO_MANY_CLAIMS_OF_ITEMS_RETURNED = 'too_many_claims_of_items_returned'
TOO_MANY_ITEMS_BILLED = 'too_many_items_billed'
TOO_MANY_ITEMS_CHARGED = 'too_many_items_charged'
TOO_MANY_ITEMS_LOST = 'too_many_items_lost'
TOO_MANY_ITEMS_OVERDUE = 'too_many_items_overdue'
TOO_MANY_RENEWALS = 'too_many_renewals'
class invenio_sip2.models.SelfcheckCheckin(permanent_location, checkin=False, alert=False, magnetic_media='unknown', resensitize='unknown', **kwargs)[source]

Class representing checkin handler response.

Constructor.

:param permanent_location - permanent_location of the item :param checkin - checkin operation is success or not :param alert - indicate if the selcheck will generate sound alert :param magnetic_media - indicate the presence of magnetic media :param resensitize - resensitize an item ? :param kwargs - optional fields

property has_magnetic_media

Shortcut for desensitize.

property is_success

Shortcut for checkin.

property resensitize

Shortcut for resensitize.

property sound_alert

Shortcut for alert.

class invenio_sip2.models.SelfcheckCheckout(title_id, checkout=False, renewal=False, magnetic_media='unknown', desensitize='unknown', **kwargs)[source]

Class representing checkout handler response.

Constructor.

:param title_id - title_id (e.g. title, identifier, …) :param checkout - checkout operation is success or not :param renewal - renewal operation is success or not :param magnetic_media - indicate the presence of magnetic media :param desensitize - desensitize an item ? :param kwargs - optional fields

property desensitize

Shortcut for desensitize.

property due_date

Shortcut for due date.

property has_magnetic_media

Shortcut for desensitize.

property is_renewal

Shortcut for renewal ok.

property is_success

Shortcut for checkout ok.

class invenio_sip2.models.SelfcheckCirculationStatus[source]

Class to handle all available circulation status of an item.

AVAILABLE = '03'
CHARGED = '04'
CHARGED_RECALL = '05'
CLAIMED_RETURNED = '11'
IN_PROCESS = '06'
IN_TRANSIT = '10'
LOST = '12'
MISSING = '13'
ON_ORDER = '02'
OTHER = '01'
RECALLED = '07'
WAITING_ON_HOLD_SHELF = '08'
WAITING_TO_RESHELF = '09'
class invenio_sip2.models.SelfcheckEnablePatron(patron_id, institution_id, patron_name='', patron_status=None, language='und', **kwargs)[source]

Class representing patron information handler response.

Constructor.

:param patron_id - patron identifier (e.g. id, barcode, …) :param institution_id - institution id (or code) of the patron :param patron_name - full name of the patron :param patron_status - status of the patron :param language - iso-639-2 language :param kwargs - optional fields

class invenio_sip2.models.SelfcheckFeeType[source]

Class to handle all available fee type.

ADMINISTRATIVE = '02'
COMPUTER_ACCESS_CHARGE = '08'
DAMAGE = '03'
HOLD_FEE = '09'
OTHER = '01'
OVERDUE = '04'
PROCESSING = '05'
RENTAL = '06'
REPLACEMENT = '07'
class invenio_sip2.models.SelfcheckHold(hold=False, available=False, **kwargs)[source]

Class representing hold handler response.

Constructor.

:param hold - hold operation is success or not :param available - item available or not :param kwargs - optional fields

property is_available

Shortcut for available.

property is_success

Shortcut for hold ok.

class invenio_sip2.models.SelfcheckItemInformation(item_id, title_id=None, circulation_status=None, fee_type=None, security_marker=None, **kwargs)[source]

Class representing item information handler response.

Constructor.

:param patron_id - patron identifier (e.g. id, barcode, …) :param patron_name - full name of the patron :param institution_id - institution id (or code) of the patron :param language - iso-639-2 language :param kwargs - optional fields

class invenio_sip2.models.SelfcheckLanguage(value)[source]

Enum class to list all available language.

ARABIC = '016'
BELGIAN = '026'
CANADIAN_FRENCH = '011'
CHINESE = '019'
DANISH = '009'
DUTCH = '005'
ENGLISH = '001'
FINNISH = '007'
FRENCH = '002'
GERMAN = '003'
GREEK = '018'
HEBREW = '013'
ICELANDIC = '025'
ITALIAN = '004'
JAPANESE = '014'
KOREAN = '020'
MALAY = '023'
NORTH_AMERICAN_SPANISH = '021'
NORWEGIAN = '012'
POLISH = '017'
PORTUGUESE = '010'
RUSSIAN = '015'
SPANISH = '008'
SWEDISH = '006'
TAIWANESE = '027'
TAMIL = '022'
UNITED_KINGDOM = '024'
UNKNOWN = '000'
chi = '019'
dan = '009'
dut = '005'
eng = '001'
fin = '007'
fra = '002'
fre = '002'
ger = '003'
gre = '018'
heb = '013'
ice = '025'
isl = '025'
ita = '004'
jpn = '014'
kor = '020'
may = '023'
msa = '023'
nor = '012'
pol = '017'
por = '010'
rus = '015'
spa = '008'
swe = '006'
tam = '022'
und = '000'
zho = '019'
class invenio_sip2.models.SelfcheckMediaType[source]

Class to handle all available media type.

AUDIO = '004'
BOOK = '001'
BOOK_WHIT_AUDIO_TAPE = '010'
BOOK_WHIT_CD = '009'
BOOK_WHIT_DISKETTE = '008'
BOUND_JOURNAL = '003'
CD_OR_CDROM = '006'
DISKETTE = '007'
MAGAZINE = '002'
OTHER = '000'
VIDEO = '005'
class invenio_sip2.models.SelfcheckPatronInformation(patron_id, institution_id, patron_name='', patron_status=None, language='und', **kwargs)[source]

Class representing patron information handler response.

Constructor.

:param patron_id - patron identifier (e.g. id, barcode, …) :param institution_id - institution id (or code) of the patron :param patron_name - full name of the patron :param patron_status - status of the patron :param language - iso-639-2 language :param kwargs - optional fields

property charged_items_count

Shortcut for charged items count.

property fine_items_count

Shortcut for fine items count.

property hold_items_count

Shortcut for hold items count.

property overdue_items_count

Shortcut for overdue items count.

property patron_id

Shortcut for patron pid.

property patron_name

Shortcut for patron pid.

property recall_items_count

Shortcut for recall items count.

property unavailable_items_count

Shortcut for unavailable items count.

class invenio_sip2.models.SelfcheckPatronStatus(patron_id, institution_id, patron_name='', patron_status=None, language='und', **kwargs)[source]

Class representing patron information handler response.

Constructor.

:param patron_id - patron identifier (e.g. id, barcode, …) :param institution_id - institution id (or code) of the patron :param patron_name - full name of the patron :param patron_status - status of the patron :param language - iso-639-2 language :param kwargs - optional fields

class invenio_sip2.models.SelfcheckRenew(title_id, success=False, renewal=False, magnetic_media='unknown', desensitize='unknown', **kwargs)[source]

Class representing renew handler response.

Constructor.

Parameters
  • title_id – title_id (e.g. title, identifier, …)

  • renew – renew operation is success or not should be set to True if the ACS renew the item. should be set to 0 if the ACS did not renew the item.

  • renewal – renewal operation. should be set to True if the patron requesting to renew the item already has the item renewed. should be set to False if the item is not already renewed.

  • magnetic_media – indicate the presence of magnetic media

  • desensitize – desensitize an item ?

  • kwargs – optional fields

property desensitize

Shortcut for desensitize.

property due_date

Shortcut for due date.

property has_magnetic_media

Shortcut for desensitize.

property is_renewal

Shortcut for renewal ok.

property is_success

Shortcut for success operation.

class invenio_sip2.models.SelfcheckSecurityMarkerType[source]

Class to handle all available security marker type.

NONE = '01'
OTHER = '00'
TATTLE_TAPE_SECURITY_STRIP = '02'
WHISPHER_TAPE = '03'
class invenio_sip2.models.SelfcheckSummary(text)[source]

Class representing summary.

Init.

fields = ['hold_items', 'overdue_items', 'charged_items', 'fine_items', 'recall_items', 'unavailable_items']
is_needed(key)[source]

Check if the given information is needed.

class invenio_sip2.models.SupportedMessages[source]

Class to define supported mesages from handler config.

Constructor.

add_supported_message(handler)[source]

Add supported message.

handlers = ['patron_status', 'checkout', 'checkin', 'block_patron', 'system_status', 'request_resend', 'login', 'account', 'end_patron_session', 'fee_paid', 'item', 'item_status_update', 'enable_patron', 'hold', 'renew', 'renew_all']

Rest API

API blueprint for Invenio-SIP2.

class invenio_sip2.views.rest.Monitoring[source]

Monitoring class.

classmethod get_clients_by_server_id(server_id)[source]

Get list of clients by server id.

classmethod get_number_client_by_server(server_id)[source]

Get total number of clients by server.

classmethod get_servers()[source]

Get list of servers.

classmethod status()[source]

Check status for all servers.

invenio_sip2.views.rest.get_clients()[source]

Display all connected clients to server.

invenio_sip2.views.rest.get_server(server_id)[source]

Display all running SIP2 servers.

invenio_sip2.views.rest.get_servers()[source]

Display all running SIP2 servers.

invenio_sip2.views.rest.status()[source]

Display status for all SIP2 server.

Views

Blueprint for Invenio-SIP2.

invenio_sip2.views.views.monitoring()[source]

Render a basic view.