'Lazy getter for case event types
@return: a dict {id: Row} for dvr_case_event_type, with an
additional key "_default" for the default event type'

def get_event_types(self):

    if (not hasattr(self, 'event_types')):
        event_types = {}
        table = current.s3db.dvr_case_event_type
        query = (((table.is_inactive == False) & table.code.like('FOOD%')) & (table.deleted == False))
        sr = current.auth.get_system_roles()
        roles = current.session.s3.roles
        if (sr.ADMIN not in roles):
            query &= ((table.role_required == None) | table.role_required.belongs(roles))
        rows = current.db(query).select(table.id, table.code, table.name, table.is_default, table.min_interval, table.max_per_day, table.comments)
        for row in rows:
            event_types[row.id] = row
            if row.is_default:
                event_types['_default'] = row
        self.event_types = event_types
    return self.event_types
