(self)
return field_map
Returns a crosswalk between the raw API fields and our processed humanized field names.
Returns a crosswalk between the raw API fields and our processed humanized field names.
Returns a crosswalk between the raw API fields and our processed humanized field names .
def get_raw_field_map(self):
        """
        Returns a crosswalk between the raw API fields and our processed humanized field names.
        """
        """
        API doesn't have margin of error for 2009, so we will need a different crosswalk for the 2009 data.
        """
        if self.year == 2009:
            field_map_2009 = collections.OrderedDict({
                'NAME': "name"
            })
            field_suffix_map_2009 = {
                "E": "",
                "M": "_moe"
            }
            for field_id, field_name in self.config.RAW_FIELD_CROSSWALK.items():
                for field_suffix, name_suffix in field_suffix_map_2009.items():
                    full_raw_id = f"{self.config.RAW_TABLE_NAME}_{field_id}{field_suffix}"
                    processed_name = f"{field_name}{name_suffix}".strip()
                    field_map_2009[full_raw_id] = processed_name
            return field_map_2009
        else:
            field_map = collections.OrderedDict({
                'NAME': "name"
            })
            field_suffix_map = {
                "E": "",
                "EA": "_annotation",
                "M": "_moe",
                "MA": "_moe_annotation"
            }
            for field_id, field_name in self.config.RAW_FIELD_CROSSWALK.items():
                for field_suffix, name_suffix in field_suffix_map.items():
                    full_raw_id = f"{self.config.RAW_TABLE_NAME}_{field_id}{field_suffix}"
                    processed_name = f"{field_name}{name_suffix}".strip()
                    field_map[full_raw_id] = processed_name
        return field_map
def get_raw_field_map ( self ) : """
        API doesn't have margin of error for 2009, so we will need a different crosswalk for the 2009 data.
        """ if self . year == 2009 : field_map_2009 = collections . OrderedDict ( { 'NAME' : "name" } ) field_suffix_map_2009 = { "E" : "" , "M" : "_moe" } for field_id , field_name in self . config . RAW_FIELD_CROSSWALK . items ( ) : for field_suffix , name_suffix in field_suffix_map_2009 . items ( ) : full_raw_id = f"{self.config.RAW_TABLE_NAME}_{field_id}{field_suffix}" processed_name = f"{field_name}{name_suffix}" . strip ( ) field_map_2009 [ full_raw_id ] = processed_name return field_map_2009 else : field_map = collections . OrderedDict ( { 'NAME' : "name" } ) field_suffix_map = { "E" : "" , "EA" : "_annotation" , "M" : "_moe" , "MA" : "_moe_annotation" } for field_id , field_name in self . config . RAW_FIELD_CROSSWALK . items ( ) : for field_suffix , name_suffix in field_suffix_map . items ( ) : full_raw_id = f"{self.config.RAW_TABLE_NAME}_{field_id}{field_suffix}" processed_name = f"{field_name}{name_suffix}" . strip ( ) field_map [ full_raw_id ] = processed_name return field_map