From 776a52595f3e09ec0a0721479205aba465a42c2d Mon Sep 17 00:00:00 2001 From: Lucas Merrill Brown Date: Wed, 17 Nov 2021 15:25:15 -0500 Subject: [PATCH] Switching island territories data to tracts (#879) --- .../data_pipeline/etl/sources/census_decennial/etl.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/data/data-pipeline/data_pipeline/etl/sources/census_decennial/etl.py b/data/data-pipeline/data_pipeline/etl/sources/census_decennial/etl.py index 8cb61cb4..ee563391 100644 --- a/data/data-pipeline/data_pipeline/etl/sources/census_decennial/etl.py +++ b/data/data-pipeline/data_pipeline/etl/sources/census_decennial/etl.py @@ -140,7 +140,7 @@ class CensusDecennialETL(ExtractTransformLoad): self.API_URL = ( "https://api.census.gov/data/{}/dec/{}?get=NAME,{}" - + "&for=block%20group:*&in=state:{}%20county:{}" + + "&for=tract:*&in=state:{}%20county:{}" ) self.df: pd.DataFrame @@ -219,11 +219,10 @@ class CensusDecennialETL(ExtractTransformLoad): ) / self.df_all[self.TOTAL_POPULATION_FIELD_NAME] # Creating Geo ID (Census Block Group) Field Name - self.df_all[self.GEOID_FIELD_NAME] = ( + self.df_all[self.GEOID_TRACT_FIELD_NAME] = ( self.df_all["state"] + self.df_all["county"] + self.df_all["tract"] - + self.df_all["block group"] ) # Reporting Missing Values @@ -240,7 +239,7 @@ class CensusDecennialETL(ExtractTransformLoad): self.OUTPUT_PATH.mkdir(parents=True, exist_ok=True) columns_to_include = [ - self.GEOID_FIELD_NAME, + self.GEOID_TRACT_FIELD_NAME, self.MEDIAN_INCOME_FIELD_NAME, self.PERCENTAGE_HOUSEHOLDS_BELOW_200_PERC_POVERTY_LEVEL_FIELD_NAME, self.PERCENTAGE_HIGH_SCHOOL_ED_FIELD_NAME,