Issue 838: Update comparison tool to use tracts (#934)

* Updating comparison tool to use tracts, and rely more heavily on `field_names`
This commit is contained in:
Lucas Merrill Brown 2021-11-30 18:46:29 -05:00 committed by GitHub
parent 49ce0f5911
commit 5c65eed28f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 230 additions and 723 deletions

View file

@ -276,7 +276,7 @@ class ScoreETL(ExtractTransformLoad):
field_names.LIFE_EXPECTANCY_FIELD, field_names.LIFE_EXPECTANCY_FIELD,
field_names.ENERGY_BURDEN_FIELD, field_names.ENERGY_BURDEN_FIELD,
field_names.FEMA_RISK_FIELD, field_names.FEMA_RISK_FIELD,
field_names.URBAN_HERUISTIC_FIELD, field_names.URBAN_HEURISTIC_FIELD,
field_names.AIR_TOXICS_CANCER_RISK_FIELD, field_names.AIR_TOXICS_CANCER_RISK_FIELD,
field_names.RESPITORY_HAZARD_FIELD, field_names.RESPITORY_HAZARD_FIELD,
field_names.DIESEL_FIELD, field_names.DIESEL_FIELD,

View file

@ -110,7 +110,7 @@ class PostScoreETL(ExtractTransformLoad):
new_df_copy = new_df.rename( new_df_copy = new_df.rename(
columns={"USPS": "State Abbreviation", "NAME": "County Name"}, columns={"USPS": "State Abbreviation", "NAME": "County Name"},
inplace=False inplace=False,
) )
return new_df_copy return new_df_copy

View file

@ -97,7 +97,6 @@ class CensusACSETL(ExtractTransformLoad):
f"Could not download data for state/territory with FIPS code {fips}" f"Could not download data for state/territory with FIPS code {fips}"
) )
self.df = pd.concat(dfs) self.df = pd.concat(dfs)
self.df[self.GEOID_TRACT_FIELD_NAME] = self.df.index.to_series().apply( self.df[self.GEOID_TRACT_FIELD_NAME] = self.df.index.to_series().apply(

View file

@ -32,7 +32,7 @@ class EJSCREENAreasOfConcernETL(ExtractTransformLoad):
To enable the ETL code for EJSCREEN AoCs to run appropriately whether or not the person To enable the ETL code for EJSCREEN AoCs to run appropriately whether or not the person
running it has access to that data, the following method checks whether the source file exists. running it has access to that data, the following method checks whether the source file exists.
If it does exist, code can and should include to this data. If it does not exist, code should If it does exist, code can and should include this data. If it does not exist, code should
not reference this data. not reference this data.
""" """

View file

@ -17,7 +17,7 @@ class GeoCorrETL(ExtractTransformLoad):
# Need to change hyperlink to S3 # Need to change hyperlink to S3
self.GEOCORR_PLACES_URL = "https://justice40-data.s3.amazonaws.com/data-sources/geocorr_urban_rural.csv.zip" self.GEOCORR_PLACES_URL = "https://justice40-data.s3.amazonaws.com/data-sources/geocorr_urban_rural.csv.zip"
self.GEOCORR_GEOID_FIELD_NAME = "GEOID10_TRACT" self.GEOCORR_GEOID_FIELD_NAME = "GEOID10_TRACT"
self.URBAN_HERUISTIC_FIELD_NAME = "Urban Heuristic Flag" self.URBAN_HEURISTIC_FIELD_NAME = "Urban Heuristic Flag"
self.df: pd.DataFrame self.df: pd.DataFrame
@ -47,7 +47,7 @@ class GeoCorrETL(ExtractTransformLoad):
self.df.rename( self.df.rename(
columns={ columns={
"urban_heuristic_flag": self.URBAN_HERUISTIC_FIELD_NAME, "urban_heuristic_flag": self.URBAN_HEURISTIC_FIELD_NAME,
}, },
inplace=True, inplace=True,
) )

View file

@ -26,7 +26,7 @@ class PersistentPovertyETL(ExtractTransformLoad):
# self.GEOCORR_PLACES_URL = "https://justice40-data.s3.amazonaws.com/data-sources/persistent_poverty_urban_rural.csv.zip" # self.GEOCORR_PLACES_URL = "https://justice40-data.s3.amazonaws.com/data-sources/persistent_poverty_urban_rural.csv.zip"
self.GEOID_TRACT_INPUT_FIELD_NAME_1 = "TRTID10" self.GEOID_TRACT_INPUT_FIELD_NAME_1 = "TRTID10"
self.GEOID_TRACT_INPUT_FIELD_NAME_2 = "tractid" self.GEOID_TRACT_INPUT_FIELD_NAME_2 = "tractid"
# self.URBAN_HERUISTIC_FIELD_NAME = "Urban Heuristic Flag" # self.URBAN_HEURISTIC_FIELD_NAME = "Urban Heuristic Flag"
self.POVERTY_PREFIX = "Individuals in Poverty (percent)" self.POVERTY_PREFIX = "Individuals in Poverty (percent)"
self.PERSISTENT_POVERTY_FIELD = "Persistent Poverty Census Tract" self.PERSISTENT_POVERTY_FIELD = "Persistent Poverty Census Tract"

View file

@ -118,7 +118,7 @@ UNDER_5_FIELD = "Individuals under 5 years old"
OVER_64_FIELD = "Individuals over 64 years old" OVER_64_FIELD = "Individuals over 64 years old"
# Urban Rural Map # Urban Rural Map
URBAN_HERUISTIC_FIELD = "Urban Heuristic Flag" URBAN_HEURISTIC_FIELD = "Urban Heuristic Flag"
# Housing value # Housing value
MEDIAN_HOUSE_VALUE_FIELD = "Median value ($) of owner-occupied housing units" MEDIAN_HOUSE_VALUE_FIELD = "Median value ($) of owner-occupied housing units"