id4_common.utils.logbook_mcr#

Fetch shift events from the APS Main Control Room logbook.

Module Contents#

class id4_common.utils.logbook_mcr.ShiftEventParser#

Bases: html.parser.HTMLParser

Parser to extract shift events from HTML.

events = []#
in_shift_events = False#
in_paragraph = False#
current_text = ''#
found_shift_events_header = False#
handle_starttag(tag, attrs)#

Track entry into <p> and <br> tags inside the shift events section.

handle_endtag(tag)#

On </p>, split the buffered paragraph into (time, description) events.

handle_data(data)#

Buffer text inside <p> tags and detect end-of-section markers.

handle_entityref(name)#

Handle HTML entities like &nbsp; &amp; etc.

handle_charref(name)#

Handle numeric character references like &#160;

id4_common.utils.logbook_mcr.fetch_shift_events(n=3)#

Fetch and display the last n shift events from the APS logbook.

Parameters:

n (int) – Number of shift events to display (default: 3)

Returns:

List of tuples containing (time, description) for each event

Return type:

list