def get_metadata(self): datasets = [ { 'table_id': 'GDP_SP', 'human_name': 'Nominal GDP', 'description': '2013 Gross Domestic Product (GDP) (state annual product)', 'source_name': self.name, 'source_url': 'http://bea.gov/regional/index.htm', 'geo_types': [State()], 'columns': ['2013 GDP'], 'count': 1 }, { 'table_id': 'RGDP_SP', 'human_name': 'Real GDP', 'description': '2013 Real GDP (state annual product)', 'source_name': self.name, 'source_url': 'http://bea.gov/regional/index.htm', 'geo_types': [State()], 'columns': ['2013 Real GDP'], 'count': 1 }, { 'table_id': 'PCRGDP_SP', 'human_name': 'Real GDP - Per Capita', 'description': '2013 Per capita Real GDP (state annual product)', 'source_name': self.name, 'source_url': 'http://bea.gov/regional/index.htm', 'geo_types': [State()], 'columns': ['2013 Per Capita Real GDP'], 'count': 1 }, { 'table_id': 'TPI_SI', 'human_name': 'Personal Income - Total', 'description': '2013 Total Personal Income (state annual income)', 'source_name': self.name, 'source_url': 'http://bea.gov/regional/index.htm', 'geo_types': [State()], 'columns': ['2013 Total Personal Income'], 'count': 1 }, { 'table_id': 'PCPI_SI', 'human_name': 'Personal Income - Per Capita', 'description': '2013 Per Capita personal income (state annual income)', 'source_name': self.name, 'source_url': 'http://bea.gov/regional/index.htm', 'geo_types': [State()], 'columns': ['2013 Per Capita Personal Income'], 'count': 1 } ] return datasets
def column_info(self): cols = [ { 'table_id': 'fpds', 'human_name': 'Federal Contracts', 'description': '', 'source_name': self.name, 'source_url': 'http://www.usaspending.gov/data', 'geo_types': [State(), Zip5(), CongressionalDistrict()], 'count': 1, # probably a lot more, 'columns': '', }, { 'table_id': 'faads', 'human_name': 'Federal Assistance', 'description': '', 'source_name': self.name, 'source_url': 'http://www.usaspending.gov/data', 'geo_types': [State(), City(), County()], 'count': 1, # probably a lot more 'columns': '', }, { 'table_id': 'fsrs', 'human_name': 'Federal sub-awards', 'description': '', 'source_name': self.name, 'source_url': 'http://www.usaspending.gov/data', 'geo_types': [State(), Zip5(), CongressionalDistrict()], 'count': 1, # probably a lot more 'columns': '', }, ] for col in cols: table_id = col['table_id'] url = '%s/%s/%s.php' % (self.base_url, table_id, table_id) param = TABLE_PARAMS[table_id]['state'] query = {param: 'IL', 'detail': 's'} params = urlencode(query) table = self.fetch_xml(url, params) col['count'] = len(table) col['columns'] = [ ' '.join(c.split('_')).title() for c in table.keys() ] return cols
def get_metadata(self): datasets = [{ 'table_id': 'oes', 'human_name': 'Occupational Employment Statistics', 'description': 'Occupational Employment Statistics', 'source_name': self.name, 'source_url': 'http://www.bls.gov/oes/', 'geo_types': [State(), StateFIPS()], 'columns': [self.oes_column_lookup[col] for col in self.oes_column_lookup], 'count': 3 }, { 'table_id': 'qcew', 'human_name': 'Quarterly Census of Employment & Wages', 'description': 'Quarterly Census of Employment & Wages', 'source_name': self.name, 'source_url': 'http://www.bls.gov/cew/home.htm', 'geo_types': [State(), StateFIPS()], 'columns': [self.qcew_column_lookup[col] for col in self.qcew_column_lookup], 'count': 7 }] return datasets
def column_info(self): table_ids = [ "B01003", "B19013", "B19301", "B02001", "B01002", "B15002", "B25077", "B26001", "B11009", "B05006" ] columns = [] for table in table_ids: info = self.urlopen('%s/table/%s' % (self.base_url, table)) table_info = json.loads(info) d = { 'table_id': table, 'human_name': table_info['table_title'], 'description': '', 'source_name': self.name, 'source_url': 'http://censusreporter.org/tables/%s/' % table, 'geo_types': [ City(), State(), StateFIPS(), StateCountyFIPS(), Zip5(), Zip9(), County(), SchoolDistrict(), CongressionalDistrict(), CensusTract() ], 'columns': [ v['column_title'] for v in table_info['columns'].values() if v['indent'] is not None ] } d['columns'].extend( ['%s (error margin)' % v for v in d['columns']]) d['columns'] = sorted(d['columns']) d['count'] = len(d['columns']) columns.append(d) return columns
def get_metadata(self): table_ids = [ "B01003", # Total Population "B19013", # Median Household Income "B19301", # Per Capita Income "B02001", # Race "B01002", # Median Age by Sex" "B25077", # Median Value (Dollars) "B26001", # Group Quarters Population "B11009", # Unmarried-partner Households by Sex of Partner "B05006", # Place of Birth for the Foreign-born Population in the United States "B19083", # Gini Index of Income Inequality "B15003", # Educational Attainment "B03002", # Hispanic or Latino Origin by Race ] columns = [] for table in table_ids: info = self.urlopen('%s/table/%s' % (self.base_url, table)) table_info = json.loads(info) d = { 'table_id': table, 'human_name': table_info['table_title'], 'description': '', 'source_name': self.name, 'source_url': 'http://censusreporter.org/tables/%s/' % table, 'geo_types': [City(), State(), StateFIPS(), StateCountyFIPS(), Zip5(), Zip9(), County(), SchoolDistrict(), CongressionalDistrict(), CensusTract()], 'columns': [v['column_title'] for v in table_info['columns'].values() if v['indent'] is not None] } d['columns'].extend(['%s (error margin)' % v for v in d['columns']]) d['columns'] = sorted(d['columns']) if table == 'B25077': # Overriding the name for "Median Value" table d['human_name'] = 'Median Value, Owner-Occupied Housing Units' d['columns'] = ['Median Value, Owner-Occupied Housing Units', 'Median Value, Owner-Occupied Housing Units (error margin)'] d['count'] = len(d['columns']) columns.append(d) return columns