lg_utilities

Name

lg_utilities -- Utilties for Tcl logbook procssessing.

Synopsis


package require lg_utiltities
      

set ::timezone timezone-string

reportPeople people-dict-list

shiftExists shiftName

duplicateShiftMessage shiftName

peopleToids person-dict-list

_runToFd number fd

printall fd

DESCRIPTION

This package provides utility commands that are used in the lg_xxxx logbook support commands but are also useable by any Tcl script that access the logbook.

One note that there is a global variable in this package: timezone. This variable contains the timezone string for the timezone in which the logbook was filled in. It is used in time formatting. It defaults to :America/Detroit which is the timezone for FRIB/NSCL (East Lansing, Michgigan). Which is eastern time with daylight saving time adjustments. If your script is processing a logbook created at a different location, you can set this variable to get times formatted for that timezone. Note as well that future logbook versions may write the timezone string into the logbook's KV store and use that for time formatting.

COMMANDS

reportPeople people-dict-list

Returns a string that reports information about the people provided in people-dict-list. This argument is a list whose elements are people dicts. See logbookadmin for information about people dicts and for commands that can return them.

The string has the same form as the report output by $DAQBIN/lg_lspeople.

shiftExists shiftName

Returns a boolean that evaluates to true if the shiftName names a shift that is known to the logbook. If not returns a false value.

duplicateShiftMessage shiftName

Produces a string containing an error message appropriate to not allowing a duplicate shift to be created. The message is the same as that produced by $DAQBIN/lg_mkshift given then name of an existing shift; It indicates the shift exists and provides a report of its members.

peopleToids person-dict-list

Converts a list of person dicts, person-dict-list, into a list of the primary keys of those people.

_runToFd number fd

Creates the standardized markdown for a run numbered number and writes it to the file descriptor fd. The output consist of a header describing the run and then a chronological list of events that occured in the run. This list includes both transitions and notes associated with the run.

printall fd

Produces the markdown for the entire logbook writing it to the file descriptor open on fd. First all runs are written using _runToFd, next all notes not associated with a run are written