Next / Previous / Contents / Shipman's homepage

30. class LocationField: Location code field

This class inherits from FieldItem, but it doesn't have a .scanField() method, because the location code comes from the input file name. It does have a .flatten() method used by BaseEncounter.flatten().

baseclasses.py
# - - - - -   c l a s s   L o c a t i o n F i e l d   - - - - -

class LocationField(FieldItem):
    '''Represents a location code.

      Exports: as inherited.
    '''

30.1. LocationField.flatten()

Generic field flattener.

baseclasses.py
# - - -   L o c a t i o n F i e l d . f l a t t e n   - - -

    @staticmethod
    def flatten(locationField):
        '''Flatten a location code.
        '''
        if  locationField is None:
            return BLANK_LOC_CODE
        else:
            return locationField.value