CERN Accelerating science

BibCatalog Admin Guide

1. Overview

1.1 What is BibCatalog

The BibCatalog Admin module allows the administrator to setup automatic ticket generation for incoming or existing records.

In the future, this might be expanded to also be able to manage the configured ticketing system via the command line. Like resolving a range of tickets etc.

1.2 Features

The following functionality is currently available:

  • BibCatalog BibTask to create tickets both newly updated records or a selection of records using search queries, record ID's etc.
  • Easy-to-define ticket templates to customize each specific ticket contents, queue and requirements

2. Configuration

2.1 Define ticket templates

Before you can create any tickets, you need to have defined a ticket template. A ticket template is a single python file/module that implements two functions:
  • check_record(ticket, record): this function accepts a ticket object (BibCatalogTicket) and a record object (BibRecord) and returns True if the record should have a ticket created for it. False if not.
    def check_record(ticket, record):
        """
        Checks to see if we should create a ticket.
    
        @param ticket: a ticket object as created by BibCatalogTicket() containing
                       the subject, body and queue to create a ticket in.
        @type ticket: record object of BibCatalogTicket.
    
        @param record: a recstruct object as created by bibrecord.create_record()
        @type record: record object of BibRecord.
    
        @return: returns True if record is a 'ARTICLE' record.
        @rtype: bool
        """
        return record_in_collection(record, "ARTICLE")
    
  • generate_ticket(ticket, record): generates the content and subject of the ticket itself. Returns the enriched BibCatalogTicket object.
    def generate_ticket(ticket, record):
        """
        Generates a ticket to be created, filling subject, body and queue values
        of the passed BibCatalogTicket object. The enriched object is returned.
    
        @param ticket: a ticket object as created by BibCatalogTicket() containing
                       the subject, body and queue to create a ticket in.
        @type ticket: record object of BibCatalogTicket.
    
        @param record: a recstruct object as created by bibrecord.create_record()
        @type record: record object of BibRecord.
    
        @return: the modified ticket object to create.
        @rtype: BibCatalogTicket
        """
        title_code = load_tag_code_from_name("title")
        title = record_get_field_value(record, **split_tag_code(title_code))
    
        abstract_code = load_tag_code_from_name("abstract")
        abstract = record_get_field_value(record, **split_tag_code(abstract_code))
    
        ticket.queue = "NEW-ARTICLES"
        ticket.body = "%s\n\n%s" % (title, abstract)
        ticket.subject = "New record: %s" % (title,)
        return ticket
    

The name of this file, or ticket template, is what you would later use to refer to it.

For example: a ticket template named article_record.py will be referred to on the command line like this:

 $ bibcatalog --tickets="article_record"
Note: You can select more than one ticket template to run by seperating their names with comma (,)

3. Usage

3.1 Basic Usage

List available ticket templates

To list all the available tickets, you can run the following:

 $ bibcatalog --list-tickets

The special argument --all-tickets can be used to select all tickets available

When launching the BibCatalog daemon, selecting a specific ticket using --ticket=TICKET,TICKET or --all-tickets is mandatory.

Note: If some templates cannot be loaded due to syntax errors etc. BibCatalog will report the broken plug-ins to the terminal output. <∕p>

Select ticket templates

A ticket template like the above named article_record.py will be referred to on the command line like this:

 $ bibcatalog --tickets="article_record"
Note: You can select more than one ticket template to run by seperating their names with comma (,)

Find records

BibCatalog needs a set of records to create tickets for. You can give the BibCatalog task these records in many ways:

By search query:

 $ bibcatalog -q "collection:Thesis and not subject:automation" --all-tickets

or, by -i parameter:

 $ bibcatalog -i 12,13,15 --tickets="article_ticket,thesis_ticket"