Next / Previous / Contents / TCC Help System / NM Tech homepage

28. class CbcHist: The history class

An instance of this class represents the complete history detail report.
# - - - - -   c l a s s   C b c H i s t

class CbcHist(object):
    '''Represents the history of a set of efforts.

        CbcHist(db, effKeyList, txny, layoutFactory, cenFilter=None):
          [ (db is a pycbc.CBCData instance) and
            (effKeyList is an iterable containing EffortKey
            instances) and
            (txny is a taxonomy of birds as an xnomo3.Txny instance) and
            (layoutFactory is a subclass of ColumnLayout) and
            (cenFilter is a census-filter, defaulting to no filtering) ->
              if (resulting number of columns) < COLUMN_COUNT_LIMIT ->
                return a new CbcHist instance representing those values,
                with census records for the effort keys in effKeyList
                extracted from db and filtered by cenFilter
              else -> raise ScriptError ]
        .db:             [ as passed to constructor ]
        .effKeyList:     [ as passed to constructor ]
        .txny:           [ as passed to constructor ]
        .cenFilter:      [ as passed to constructor ]
        .nCols:          [ number of logical columns in self's layout ]
        .keyRow:         [ a KeyRow instance ]
        .partyHoursRow:  [ a PartyHoursRow instance ]
        .nCensusRows():  [ return the number of census rows in self ]
          [ generate the census rows of self as a sequence of CensusRow
            instances in order by (taxonomic key number, English name) ]
          [ effKey is an EffortKey instance ->
              if effKey matches an effort in self's column layout ->
                return the logical column index of the column that
                displays data for effort with key (effKey)
              else -> raise KeyError ]
          [ if 0 <= k < (number of logical columns in self) ->
              return the label for logical column [k]
            else -> raise KeyError ]
          [ generate the column labels in self's column layout as a
            sequence of strings ]

Internally we manage these values.
          [ the result of calling layoutFactory, an instance of a
            ColumnLayout concrete class ]
          [ a dictionary whose keys are the row keys in self, and each
            related value is the CensusRow with data for the
            corresponding kind of bird ]