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.

is_error_detection_enabled[source]

Check if error detection is enabled.

line_terminator[source]

Line terminator used for message.

retries_allowed[source]

Number of retries allowed by the automated circulation system.

sip2[source]

Return the SIP2 action machine.

sip2_current_date

Get current date from system.

sip2_handlers[source]

Return the SIP2 handler machine.

sip2_language

Get default language from system.

sip2_message_types[source]

Message type configuration.

support_checkin[source]

Support of checkin by the automated circulation system.

support_checkout[source]

Support of checkout by the automated circulation system.

support_offline_status[source]

Support of offline status by the automated circulation system.

support_online_status[source]

Support of online status by the automated circulation system.

support_renewal_policy[source]

Support of renewal policy by the automated circulation system.

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.

supported_protocol[source]

Supported protocol by the automated circulation system.

text_encoding[source]

Message text charset encoding.

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, message, **kwargs)[source]

Action to get status from automated circulation system.

Init action object.

execute(message, client)[source]

Execute automated circulation system status action.

Parameters:
  • message – message receive from the client
  • client – the client
Returns:

message class representing the response of the current action

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

Action to block patron.

Init action object.

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

Execute block patron action.

Parameters:
  • message – message receive from the client
  • client – the client
Returns:

message class representing the response of the current action

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

Action to checkin an item.

Init action object.

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

Execute checkin action.

Parameters:
  • message – message receive from the client
  • client – the client
Returns:

message class representing the response of the current action

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

Action to checkout an item.

Init action object.

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

Execute checkout action.

Parameters:
  • message – message receive from the client
  • client – the client
Returns:

message class representing the response of the current action

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

Action to end patron session on automated circulation system.

Init action object.

execute(message, client)[source]

Execute end patron session action.

Parameters:
  • message – message receive from the client
  • client – the client
Returns:

message class representing the response of the current action

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

Action to paid fee.

Init action object.

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

Execute fee paid action.

Parameters:
  • message – message receive from the client
  • client – the client
Returns:

message class representing the response of the current action

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

Action to hold an item.

Init action object.

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

Execute hold action.

Parameters:
  • message – message receive from the client
  • client – the client
Returns:

message class representing the response of the current action

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

Action to get item information from automated circulation system.

Init action object.

execute(message, client)[source]

Execute item information action.

Parameters:
  • message – message receive from the client
  • client – the client
Returns:

message class representing the response of the current action

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

Action to update item status.

Init action object.

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

Execute item status action.

Parameters:
  • message – message receive from the client
  • client – the client
Returns:

message class representing the response of the current action

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

Action to enable patron on automated circulation system.

Init action object.

execute(message, client)[source]

Execute enable patron action.

Parameters:
  • message – message receive from the client
  • client – the client
Returns:

message class representing the response of the current action

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

Action to get patron information from automated circulation system.

Init action object.

execute(message, client)[source]

Execute patron information action.

Parameters:
  • message – message receive from the client
  • client – the client
Returns:

message class representing the response of the current action

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

Action to get patron status from automated circulation system.

Init action object.

execute(message, client)[source]

Execute patron status action.

Parameters:
  • message – message receive from the client
  • client – the client
Returns:

message class representing the response of the current action

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

Action to renew an item.

Init action object.

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

Execute renew action.

Parameters:
  • message – message receive from the client
  • client – the client
Returns:

message class representing the response of the current action

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

Action to renew all items.

Init action object.

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

Execute renew all action.

Parameters:
  • message – message receive from the client
  • client – the client
Returns:

message class representing the response of the current action

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

Action to resend last message.

Init action object.

execute(message, client)[source]

Execute resend action.

Parameters:
  • message – message receive from the client
  • client – the client
Returns:

message class representing the response of the last action send tho the client

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

Action to selfcheck login.

Init action object.

execute(message, **kwargs)[source]

Execute login action.

Parameters:message – message receive from the client
Returns:message class representing the response of the current 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.

get_server()[source]

Get server object.

institution_id

Shortcut to institution id.

is_authenticated

Shortcut to check if the selfcheck client is authenticated.

last_request_message

Shortcut to user id.

last_response_message

Shortcut to user id.

last_sequence_number

Shortcut to user id.

library_language

Shortcut for library language.

library_name

Shortcut to library name.

remote_app

Shortcut for remote app.

server_id

Get server identifier.

terminal

Shortcut to terminal.

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.

is_running

Check if server is running.

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.

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[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

has_magnetic_media

Shortcut for desensitize.

is_success

Shortcut for checkin.

resensitize

Shortcut for resensitize.

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

desensitize

Shortcut for desensitize.

due_date

Shortcut for due date.

has_magnetic_media

Shortcut for desensitize.

is_renewal

Shortcut for renewal ok.

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.SelfcheckFeePaid(accepted=False, **kwargs)[source]

Class representing fee paid handler response.

Constructor.

Parameters:
  • accepted – payment operation is accepted or not should be set to True if the ACS accept the payment. should be set to 0 if the ACS did not accept the payment.
  • kwargs – optional fields
is_accepted

Shortcut for payment_accepted operation.

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

is_available

Shortcut for available.

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[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

charged_items_count

Shortcut for charged items count.

fine_items_count

Shortcut for fine items count.

hold_items_count

Shortcut for hold items count.

overdue_items_count

Shortcut for overdue items count.

patron_id

Shortcut for patron pid.

patron_name

Shortcut for patron pid.

recall_items_count

Shortcut for recall items count.

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.SelfcheckPaymentType[source]

Class to handle all available payment type.

CASH = '00'
CREDIT_CARD = '02'
VISA = '01'
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
desensitize

Shortcut for desensitize.

due_date

Shortcut for due date.

has_magnetic_media

Shortcut for desensitize.

is_renewal

Shortcut for renewal ok.

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_hold_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.