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.

cbchistlib.py
# - - - - -   c l a s s   C b c H i s t

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

      Exports:
        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 ]
        .nPhysRows(maxPhysRows):
          
        .nCensusRows():  [ return the number of census rows in self ]
        .genCensusRows():
          [ generate the census rows of self as a sequence of CensusRow
            instances in order by (taxonomic key number, English name) ]
        .findColumn(effKey):
          [ 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 ]
        .colLabel(k):
          [ if 0 <= k < (number of logical columns in self) ->
              return the label for logical column [k]
            else -> raise KeyError ]
        .genColLabels():
          [ generate the column labels in self's column layout as a
            sequence of strings ]

Internally we manage these values.

cbchistlib.py
      State/Invariants:
        ._columnLayout:
          [ the result of calling layoutFactory, an instance of a
            ColumnLayout concrete class ]
        ._rowMap:
          [ 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 ]
    '''