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().
# - - - - -   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.
# - - -   L o c a t i o n F i e l d . f l a t t e n   - - -

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