mirror of
https://github.com/DOI-DO/j40-cejst-2.git
synced 2025-02-23 10:04:18 -08:00
updating field_names, adding extreme heat
This commit is contained in:
parent
e52b99542b
commit
3b5ea59b53
3 changed files with 36 additions and 8 deletions
|
@ -168,14 +168,10 @@ class ScoreETL(ExtractTransformLoad):
|
|||
|
||||
# Load COI data
|
||||
child_opportunity_index_csv = (
|
||||
<<<<<<< HEAD
|
||||
constants.DATA_PATH
|
||||
/ "dataset"
|
||||
/ "child_opportunity_index"
|
||||
/ "usa.csv"
|
||||
=======
|
||||
constants.DATA_PATH / "dataset" / "child_opportunity_index" / "usa.csv"
|
||||
>>>>>>> 050a5c30 (added fields to score_etl)
|
||||
)
|
||||
self.child_opportunity_index_df = pd.read_csv(
|
||||
child_opportunity_index_csv,
|
||||
|
@ -364,11 +360,7 @@ class ScoreETL(ExtractTransformLoad):
|
|||
self.census_acs_median_incomes_df,
|
||||
self.census_decennial_df,
|
||||
self.census_2010_df,
|
||||
<<<<<<< HEAD
|
||||
self.child_opportunity_index_df,
|
||||
=======
|
||||
self.child_opportunity_index_df
|
||||
>>>>>>> 050a5c30 (added fields to score_etl)
|
||||
]
|
||||
|
||||
# Sanity check each data frame before merging.
|
||||
|
|
|
@ -236,6 +236,11 @@ LOW_READING_FIELD = "Low third grade reading proficiency"
|
|||
EXPECTED_POPULATION_LOSS_RATE_LOW_INCOME_FIELD = f"At or above the {PERCENTILE}th percentile for expected population loss rate and is low income"
|
||||
EXPECTED_AGRICULTURE_LOSS_RATE_LOW_INCOME_FIELD = f"At or above the {PERCENTILE}th percentile for expected agriculture loss rate and is low income"
|
||||
EXPECTED_BUILDING_LOSS_RATE_LOW_INCOME_FIELD = f"At or above the {PERCENTILE}th percentile for expected building loss rate and is low income"
|
||||
EXTREME_HEAT_MEDIAN_HOUSE_VALUE_LOW_INCOME_FIELD = (
|
||||
f"At or above the {PERCENTILE}th percentile for summer days above 90F and "
|
||||
f"the median house value is less than {MEDIAN_HOUSE_VALUE_PERCENTILE}th "
|
||||
f"percentile and is low income"
|
||||
)
|
||||
|
||||
# Clean energy and efficiency
|
||||
PM25_EXPOSURE_LOW_INCOME_FIELD = f"At or above the {PERCENTILE}th percentile for PM2.5 exposure and is low income"
|
||||
|
@ -275,6 +280,11 @@ LOW_LIFE_EXPECTANCY_LOW_INCOME_FIELD = (
|
|||
f"for low life expectancy and is low income"
|
||||
)
|
||||
|
||||
HEALTHY_FOOD_LOW_INCOME_FIELD = (
|
||||
f"At or above the {PERCENTILE}th percentile for low "
|
||||
f"access to healthy food and is low income"
|
||||
)
|
||||
|
||||
# Workforce
|
||||
UNEMPLOYMENT_LOW_HS_EDUCATION_FIELD = (
|
||||
f"At or above the {PERCENTILE}th percentile for unemployment"
|
||||
|
@ -317,6 +327,10 @@ HEALTHY_FOOD_LOW_INCOME_FIELD = (
|
|||
f"At or above the {PERCENTILE}th percentile for low "
|
||||
f"access to healthy food and is low income"
|
||||
)
|
||||
READING_LOW_HS_EDUCATION_FIELD = (
|
||||
f"At or above the {PERCENTILE}th percentile for 3rd grade reading proficiency"
|
||||
" and has low HS education"
|
||||
)
|
||||
|
||||
THRESHOLD_COUNT = "Total threshold criteria exceeded"
|
||||
|
||||
|
|
|
@ -179,6 +179,7 @@ class ScoreL(Score):
|
|||
field_names.EXPECTED_POPULATION_LOSS_RATE_LOW_INCOME_FIELD,
|
||||
field_names.EXPECTED_AGRICULTURE_LOSS_RATE_LOW_INCOME_FIELD,
|
||||
field_names.EXPECTED_BUILDING_LOSS_RATE_LOW_INCOME_FIELD,
|
||||
field_names.EXTREME_HEAT_MEDIAN_HOUSE_VALUE_LOW_INCOME_FIELD,
|
||||
]
|
||||
|
||||
expected_population_loss_threshold = (
|
||||
|
@ -205,6 +206,20 @@ class ScoreL(Score):
|
|||
>= self.ENVIRONMENTAL_BURDEN_THRESHOLD
|
||||
)
|
||||
|
||||
extreme_heat_median_home_value_threshold = (
|
||||
self.df[
|
||||
field_names.EXTREME_HEAT_FIELD
|
||||
+ field_names.PERCENTILE_FIELD_SUFFIX
|
||||
]
|
||||
>= self.ENVIRONMENTAL_BURDEN_THRESHOLD
|
||||
) & (
|
||||
self.df[
|
||||
field_names.MEDIAN_HOUSE_VALUE_FIELD
|
||||
+ field_names.PERCENTILE_FIELD_SUFFIX
|
||||
]
|
||||
<= self.MEDIAN_HOUSE_VALUE_THRESHOLD
|
||||
)
|
||||
|
||||
self.df[field_names.EXPECTED_POPULATION_LOSS_RATE_LOW_INCOME_FIELD] = (
|
||||
expected_population_loss_threshold
|
||||
& self.df[field_names.FPL_200_SERIES]
|
||||
|
@ -220,6 +235,13 @@ class ScoreL(Score):
|
|||
& self.df[field_names.FPL_200_SERIES]
|
||||
)
|
||||
|
||||
self.df[
|
||||
field_names.EXTREME_HEAT_MEDIAN_HOUSE_VALUE_LOW_INCOME_FIELD
|
||||
] = (
|
||||
extreme_heat_median_home_value_threshold
|
||||
& self.df[field_names.FPL_200_SERIES]
|
||||
)
|
||||
|
||||
self._increment_total_eligibility_exceeded(climate_eligibility_columns)
|
||||
|
||||
return self.df[climate_eligibility_columns].any(axis="columns")
|
||||
|
|
Loading…
Add table
Reference in a new issue