Next / Previous / Contents / NM Tech homepage

7.8. staticloader: addPhysio()

staticloader
# - - -   a d d P h y s i o

def addPhysio ( db, rawLine ):
    '''Add one row to the physios table.

      [ (db is a CBCData instance) and
        (rawLine is a valid physios file line) ->
            db  :=  db with a new physios row made from rawLine ]

      Line format:
        0         1         2
        012345678901234567890
        ---------------------
        05 Mississippi Alluvial Plain
    '''
    #-- 1 --
    # [ physio_code  :=  the physio code field from rawLine
    #   physio_name  :=  the physio name field from rawLine ]
    physio_code = rawLine[:2]
    physio_name = unicode(rawLine[3:].strip())

    #-- 2 --
    # [ db.s  +:=  a new Physio row added using physio_code and
    #              physio_name ]
    db.s.add ( db.Physio ( physio_code, physio_name ) )