How to use the census.core.supported_years function in census

To help you get started, we’ve selected a few census examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github datamade / census_area / census_area / __init__.py View on Github external
    @supported_years(2010, 2000)
    def state_place_block(self, *args, **kwargs):
        return self._state_place_area(self.geo_block, *args, **kwargs)
github datamade / census_area / census_area / __init__.py View on Github external
    @supported_years(2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010)
    def state_place_blockgroup(self, *args, **kwargs):
        return self._state_place_area(self.geo_blockgroup, *args, **kwargs)
github datamade / census_area / census_area / __init__.py View on Github external
    @supported_years(2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2000)
    def geo_blockgroup(self, fields, geojson_geometry, year=None, **kwargs):
        if year is None:
            year = self.default_year

        filtered_block_groups = AreaFilter(geojson_geometry,
                                           GEO_URLS['block groups'][year])

        for block_group, intersection_proportion in filtered_block_groups:
            context = {'state' : block_group['properties']['STATE'],
                       'county' : block_group['properties']['COUNTY'],
                       'tract' : block_group['properties']['TRACT']}
            within = 'state:{state} county:{county} tract:{tract}'.format(**context)

            block_group_id = block_group['properties']['BLKGRP']
            
            result = self.get(fields,
github datamade / census_area / census_area / __init__.py View on Github external
    @supported_years(2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2000, 1990)
    def geo_tract(self, fields, geojson_geometry, year=None, **kwargs):
        if year is None:
            year = self.default_year
        
        filtered_tracts = AreaFilter(geojson_geometry,
                                     GEO_URLS['tracts'][self.default_year])

        for tract, intersection_proportion in filtered_tracts:
            context = {'state' : tract['properties']['STATE'],
                       'county' : tract['properties']['COUNTY']}
            within = 'state:{state} county:{county}'.format(**context)

            tract_id = tract['properties']['TRACT']
            result = self.get(fields,
                              {'for': 'tract:{}'.format(tract_id),
                               'in' :  within}, year, **kwargs)
github datamade / census_area / census_area / __init__.py View on Github external
    @supported_years(2000, 1990)
    def state_place_tract(self, *args, **kwargs):
        return self._state_place_area(self.geo_tract, *args, **kwargs)
github datamade / census_area / census_area / __init__.py View on Github external
    @supported_years(2010, 2000)
    def state_place_blockgroup(self, *args, **kwargs):
        return self._state_place_area(self.geo_blockgroup, *args, **kwargs)
github datamade / census_area / census_area / __init__.py View on Github external
    @supported_years(2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010)
    def state_place_tract(self, *args, **kwargs):
        return self._state_place_area(self.geo_tract, *args, **kwargs)
github datamade / census_area / census_area / __init__.py View on Github external
    @supported_years(2010, 2000)
    def geo_block(self, fields, geojson_geometry, year):
        if year is None:
            year = self.default_year
        
        filtered_blocks = AreaFilter(geojson_geometry,
                                     GEO_URLS['blocks'][year])

        for block, intersection_proportion in filtered_blocks:
            context = {'state' : block['properties']['STATE'],
                       'county' : block['properties']['COUNTY'],
                       'tract' : block['properties']['TRACT']}
            within = 'state:{state} county:{county} tract:{tract}'.format(**context)

            block_id = block['properties']['BLOCK']
            result = self.get(fields,
                              {'for': 'block:{}'.format(block_id),
github datamade / census_area / census_area / __init__.py View on Github external
    @supported_years(2000)
    def state_place_blockgroup(self, *args, **kwargs):
        return self._state_place_area(self.geo_blockgroup, *args, **kwargs)
github datamade / census_area / census_area / __init__.py View on Github external
    @supported_years(2010, 2000, 1990)
    def state_place_tract(self, *args, **kwargs):
        return self._state_place_area(self.geo_tract, *args, **kwargs)