mirror of
https://github.com/DOI-DO/j40-cejst-2.git
synced 2025-07-28 23:21:17 -07:00
Updating field names to match score M definitions (#1190)
When implementing definition M for the score, the variable names were not yet updated. For example: This legacy field naming: ``` UNEMPLOYMENT_LOW_HS_EDUCATION_FIELD = ( f"Greater than or equal to the {PERCENTILE}th percentile for unemployment" " and has low HS education" ) ``` Should actually be renamed something like this: ``` UNEMPLOYMENT_LOW_HS_LOW_HIGHER_ED_FIELD = ( f"Greater than or equal to the {PERCENTILE}th percentile for unemployment" " and has low HS education and low higher ed attendance" ) ``` This PR is for the backend updates for this -- keeping the old fields, and adding new, Score M specific fields as listed below: - [x] `field_names`: add new fields to capture low_higher_ed - [x] `score_m`: replace old fields with new fields - [x] `DOWNLOADABLE_SCORE_COLUMNS`: replace old fields with new fields - [x] `TILES_SCORE_COLUMNS`: replace old fields with new fields
This commit is contained in:
parent
403a490985
commit
49868401be
7 changed files with 250 additions and 152 deletions
|
@ -313,8 +313,7 @@ TRANSPORTATION_COSTS = "Transportation Costs"
|
|||
|
||||
#####
|
||||
# Names for individual factors being exceeded
|
||||
# TODO: for Definition M, create new output field names (different than those used by
|
||||
# Definition L) and change all output fields to say low income and low college
|
||||
|
||||
# Climate Change
|
||||
EXPECTED_POPULATION_LOSS_RATE_LOW_INCOME_FIELD = (
|
||||
f"Greater than or equal to the {PERCENTILE}th percentile"
|
||||
|
@ -369,50 +368,156 @@ LOW_LIFE_EXPECTANCY_LOW_INCOME_FIELD = (
|
|||
f"for low life expectancy and is low income?"
|
||||
)
|
||||
|
||||
# Score M Low Income Change
|
||||
SCORE_M_LOW_INCOME_SUFFIX = (
|
||||
", is low income, and has a low percent of higher ed students"
|
||||
)
|
||||
|
||||
# Climate Change
|
||||
EXPECTED_POPULATION_LOSS_RATE_LOW_INCOME_LOW_HIGHER_ED_FIELD = (
|
||||
f"Greater than or equal to the {PERCENTILE}th percentile"
|
||||
f" for expected population loss rate{SCORE_M_LOW_INCOME_SUFFIX}?"
|
||||
)
|
||||
EXPECTED_AGRICULTURE_LOSS_RATE_LOW_INCOME_LOW_HIGHER_ED_FIELD = (
|
||||
f"Greater than or equal to the {PERCENTILE}th percentile"
|
||||
f" for expected agriculture loss rate{SCORE_M_LOW_INCOME_SUFFIX}?"
|
||||
)
|
||||
EXPECTED_BUILDING_LOSS_RATE_LOW_INCOME_LOW_HIGHER_ED_FIELD = (
|
||||
f"Greater than or equal to the {PERCENTILE}th percentile"
|
||||
f" for expected building loss rate{SCORE_M_LOW_INCOME_SUFFIX}?"
|
||||
)
|
||||
|
||||
# Clean Energy and Efficiency
|
||||
PM25_EXPOSURE_LOW_INCOME_LOW_HIGHER_ED_FIELD = (
|
||||
f"Greater than or equal to the {PERCENTILE}th percentile "
|
||||
f"for PM2.5 exposure{SCORE_M_LOW_INCOME_SUFFIX}?"
|
||||
)
|
||||
ENERGY_BURDEN_LOW_INCOME_LOW_HIGHER_ED_FIELD = (
|
||||
f"Greater than or equal to the {PERCENTILE}th percentile "
|
||||
f"for energy burden{SCORE_M_LOW_INCOME_SUFFIX}?"
|
||||
)
|
||||
|
||||
# Clean Transportation
|
||||
DIESEL_PARTICULATE_MATTER_LOW_INCOME_LOW_HIGHER_ED_FIELD = (
|
||||
f"Greater than or equal to the {PERCENTILE}th percentile for "
|
||||
f"diesel particulate matter{SCORE_M_LOW_INCOME_SUFFIX}?"
|
||||
)
|
||||
TRAFFIC_PROXIMITY_LOW_INCOME_LOW_HIGHER_ED_FIELD = (
|
||||
f"Greater than or equal to the {PERCENTILE}th percentile for "
|
||||
f"traffic proximity{SCORE_M_LOW_INCOME_SUFFIX}?"
|
||||
)
|
||||
|
||||
# Affordable and Sustainable Housing
|
||||
LEAD_PAINT_MEDIAN_HOUSE_VALUE_LOW_INCOME_LOW_HIGHER_ED_FIELD = (
|
||||
f"Greater than or equal to the {PERCENTILE}th percentile for lead paint,"
|
||||
f" the median house value is less than {MEDIAN_HOUSE_VALUE_PERCENTILE}th "
|
||||
f"percentile{SCORE_M_LOW_INCOME_SUFFIX}?"
|
||||
)
|
||||
HOUSING_BURDEN_LOW_INCOME_LOW_HIGHER_ED_FIELD = (
|
||||
f"Greater than or equal to the {PERCENTILE}th percentile "
|
||||
f"for housing burden{SCORE_M_LOW_INCOME_SUFFIX}?"
|
||||
)
|
||||
|
||||
# Remediation and Reduction of Legacy Pollution
|
||||
RMP_LOW_INCOME_LOW_HIGHER_ED_FIELD = (
|
||||
f"Greater than or equal to the {PERCENTILE}th percentile for "
|
||||
f"proximity to RMP sites{SCORE_M_LOW_INCOME_SUFFIX}?"
|
||||
)
|
||||
SUPERFUND_LOW_INCOME_LOW_HIGHER_ED_FIELD = (
|
||||
f"Greater than or equal to the {PERCENTILE}th percentile for proximity to "
|
||||
f"superfund sites{SCORE_M_LOW_INCOME_SUFFIX}?"
|
||||
)
|
||||
HAZARDOUS_WASTE_LOW_INCOME_LOW_HIGHER_ED_FIELD = (
|
||||
f"Greater than or equal to the {PERCENTILE}th percentile"
|
||||
f" for proximity to hazardous waste facilities{SCORE_M_LOW_INCOME_SUFFIX}?"
|
||||
)
|
||||
|
||||
# Critical Clean Water and Waste Infrastructure
|
||||
WASTEWATER_DISCHARGE_LOW_INCOME_LOW_HIGHER_ED_FIELD = (
|
||||
f"Greater than or equal to the {PERCENTILE}th percentile for"
|
||||
f" wastewater discharge{SCORE_M_LOW_INCOME_SUFFIX}?"
|
||||
)
|
||||
|
||||
# Health Burdens
|
||||
DIABETES_LOW_INCOME_LOW_HIGHER_ED_FIELD = f"Greater than or equal to the {PERCENTILE}th percentile for diabetes{SCORE_M_LOW_INCOME_SUFFIX}?"
|
||||
ASTHMA_LOW_INCOME_LOW_HIGHER_ED_FIELD = f"Greater than or equal to the {PERCENTILE}th percentile for asthma{SCORE_M_LOW_INCOME_SUFFIX}?"
|
||||
HEART_DISEASE_LOW_INCOME_LOW_HIGHER_ED_FIELD = (
|
||||
f"Greater than or equal to the {PERCENTILE}th percentile "
|
||||
f"for heart disease{SCORE_M_LOW_INCOME_SUFFIX}?"
|
||||
)
|
||||
|
||||
LOW_LIFE_EXPECTANCY_LOW_INCOME_LOW_HIGHER_ED_FIELD = (
|
||||
f"Greater than or equal to the {PERCENTILE}th percentile "
|
||||
f"for low life expectancy{SCORE_M_LOW_INCOME_SUFFIX}?"
|
||||
)
|
||||
|
||||
# Workforce
|
||||
# TODO: for Definition M, create new output field names (different than those used by
|
||||
# Definition L) and change all output fields to say low HS and low college
|
||||
UNEMPLOYMENT_LOW_HS_EDUCATION_FIELD = (
|
||||
f"Greater than or equal to the {PERCENTILE}th percentile for unemployment"
|
||||
" and has low HS education"
|
||||
" and has low HS education?"
|
||||
)
|
||||
|
||||
LINGUISTIC_ISOLATION_LOW_HS_EDUCATION_FIELD = (
|
||||
f"Greater than or equal to the {PERCENTILE}th percentile for households in linguistic isolation"
|
||||
" and has low HS education"
|
||||
" and has low HS education?"
|
||||
)
|
||||
|
||||
POVERTY_LOW_HS_EDUCATION_FIELD = (
|
||||
f"Greater than or equal to the {PERCENTILE}th percentile for households at or below 100% federal poverty level"
|
||||
" and has low HS education"
|
||||
" and has low HS education?"
|
||||
)
|
||||
|
||||
LOW_MEDIAN_INCOME_LOW_HS_EDUCATION_FIELD = (
|
||||
f"Greater than or equal to the {PERCENTILE}th percentile for low median household income as a "
|
||||
f"percent of area median income and has low HS education"
|
||||
f"percent of area median income and has low HS education?"
|
||||
)
|
||||
|
||||
# Score M Workforce Variables
|
||||
SCORE_M_LOW_EDUCATION_SUFFIX = (
|
||||
", has low HS attainment, and has a low percent of higher ed students"
|
||||
)
|
||||
|
||||
UNEMPLOYMENT_LOW_HS_LOW_HIGHER_ED_FIELD = (
|
||||
f"Greater than or equal to the {PERCENTILE}th percentile for unemployment"
|
||||
f"{SCORE_M_LOW_EDUCATION_SUFFIX}?"
|
||||
)
|
||||
|
||||
LINGUISTIC_ISOLATION_LOW_HS_LOW_HIGHER_ED_FIELD = (
|
||||
f"Greater than or equal to the {PERCENTILE}th percentile for households in linguistic isolation"
|
||||
f"{SCORE_M_LOW_EDUCATION_SUFFIX}?"
|
||||
)
|
||||
|
||||
POVERTY_LOW_HS_LOW_HIGHER_ED_FIELD = (
|
||||
f"Greater than or equal to the {PERCENTILE}th percentile for households at or below 100% federal poverty level"
|
||||
f"{SCORE_M_LOW_EDUCATION_SUFFIX}?"
|
||||
)
|
||||
|
||||
LOW_MEDIAN_INCOME_LOW_HS_LOW_HIGHER_ED_FIELD = (
|
||||
f"Greater than or equal to the {PERCENTILE}th percentile for low median household income as a "
|
||||
f"percent of area median income{SCORE_M_LOW_EDUCATION_SUFFIX}?"
|
||||
)
|
||||
|
||||
LOW_HS_EDUCATION_FIELD = "Low high school education"
|
||||
LOW_HS_EDUCATION_LOW_COLLEGE_ATTENDANCE_FIELD = (
|
||||
"Low high school education and low college attendance"
|
||||
LOW_HS_EDUCATION_LOW_HIGHER_ED_FIELD = (
|
||||
"Low high school education and low percent of higher ed students"
|
||||
)
|
||||
|
||||
# Workforce for island areas
|
||||
ISLAND_AREAS_SUFFIX = " in 2009 (island areas)"
|
||||
ISLAND_AREAS_UNEMPLOYMENT_LOW_HS_EDUCATION_FIELD = (
|
||||
f"Greater than or equal to the {PERCENTILE}th percentile for unemployment"
|
||||
f" and has low HS education{ISLAND_AREAS_SUFFIX}"
|
||||
f" and has low HS education{ISLAND_AREAS_SUFFIX}?"
|
||||
)
|
||||
|
||||
ISLAND_AREAS_POVERTY_LOW_HS_EDUCATION_FIELD = (
|
||||
f"Greater than or equal to the {PERCENTILE}th percentile for households at or below 100% federal poverty level"
|
||||
f" and has low HS education{ISLAND_AREAS_SUFFIX}"
|
||||
f" and has low HS education{ISLAND_AREAS_SUFFIX}?"
|
||||
)
|
||||
|
||||
ISLAND_AREAS_LOW_MEDIAN_INCOME_LOW_HS_EDUCATION_FIELD = (
|
||||
f"Greater than or equal to the {PERCENTILE}th percentile for low median household income as a "
|
||||
f"percent of area median income"
|
||||
f" and has low HS education{ISLAND_AREAS_SUFFIX}"
|
||||
f" and has low HS education{ISLAND_AREAS_SUFFIX}?"
|
||||
)
|
||||
|
||||
ISLAND_AREAS_LOW_HS_EDUCATION_FIELD = (
|
||||
|
@ -425,9 +530,10 @@ EXTREME_HEAT_MEDIAN_HOUSE_VALUE_LOW_INCOME_FIELD = (
|
|||
f"the median house value is less than {MEDIAN_HOUSE_VALUE_PERCENTILE}th "
|
||||
f"percentile and is low income?"
|
||||
)
|
||||
|
||||
IMPENETRABLE_SURFACES_LOW_INCOME_FIELD = (
|
||||
f"Greater than or equal to the {PERCENTILE}th percentile for impenetrable surfaces and is low "
|
||||
f"income"
|
||||
f"income?"
|
||||
)
|
||||
AIR_TOXICS_CANCER_RISK_LOW_INCOME_FIELD = f"Greater than or equal to the {PERCENTILE}th percentile for air toxics cancer risk and is low income?"
|
||||
RESPIRATORY_HAZARD_LOW_INCOME_FIELD = f"Greater than or equal to the {PERCENTILE}th percentile for respiratory hazard index and is low income?"
|
||||
|
@ -435,16 +541,17 @@ HEALTHY_FOOD_LOW_INCOME_FIELD = (
|
|||
f"Greater than or equal to the {PERCENTILE}th percentile for low "
|
||||
f"access to healthy food and is low income?"
|
||||
)
|
||||
|
||||
LOW_READING_LOW_HS_EDUCATION_FIELD = (
|
||||
f"Greater than or equal to the {PERCENTILE}th percentile for low 3rd grade reading proficiency"
|
||||
" and has low HS education"
|
||||
" and has low HS education?"
|
||||
)
|
||||
|
||||
THRESHOLD_COUNT = "Total threshold criteria exceeded"
|
||||
|
||||
FPL_200_SERIES = "Is low income?"
|
||||
FPL_200_AND_COLLEGE_ATTENDANCE_SERIES = (
|
||||
"Is low income and low college attendance?"
|
||||
"Is low income and has a low percent of higher ed students?"
|
||||
)
|
||||
# End of names for individual factors being exceeded
|
||||
####
|
||||
|
|
|
@ -143,13 +143,13 @@ class ScoreM(Score):
|
|||
# AND
|
||||
# Low income: In Nth percentile or above for percent of block group population
|
||||
# of households where household income is less than or equal to twice the federal
|
||||
# poverty level. Source: Census's American Community Survey]
|
||||
# poverty level and there is low higher ed attendance
|
||||
# Source: Census's American Community Survey
|
||||
|
||||
climate_eligibility_columns = [
|
||||
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,
|
||||
field_names.EXPECTED_POPULATION_LOSS_RATE_LOW_INCOME_LOW_HIGHER_ED_FIELD,
|
||||
field_names.EXPECTED_AGRICULTURE_LOSS_RATE_LOW_INCOME_LOW_HIGHER_ED_FIELD,
|
||||
field_names.EXPECTED_BUILDING_LOSS_RATE_LOW_INCOME_LOW_HIGHER_ED_FIELD,
|
||||
]
|
||||
|
||||
expected_population_loss_threshold = (
|
||||
|
@ -176,39 +176,24 @@ class ScoreM(Score):
|
|||
>= self.ENVIRONMENTAL_BURDEN_THRESHOLD
|
||||
)
|
||||
|
||||
extreme_heat_and_median_house_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] = (
|
||||
self.df[
|
||||
field_names.EXPECTED_POPULATION_LOSS_RATE_LOW_INCOME_LOW_HIGHER_ED_FIELD
|
||||
] = (
|
||||
expected_population_loss_threshold
|
||||
& self.df[field_names.FPL_200_AND_COLLEGE_ATTENDANCE_SERIES]
|
||||
)
|
||||
|
||||
self.df[field_names.EXPECTED_AGRICULTURE_LOSS_RATE_LOW_INCOME_FIELD] = (
|
||||
self.df[
|
||||
field_names.EXPECTED_AGRICULTURE_LOSS_RATE_LOW_INCOME_LOW_HIGHER_ED_FIELD
|
||||
] = (
|
||||
expected_agriculture_loss_threshold
|
||||
& self.df[field_names.FPL_200_AND_COLLEGE_ATTENDANCE_SERIES]
|
||||
)
|
||||
|
||||
self.df[field_names.EXPECTED_BUILDING_LOSS_RATE_LOW_INCOME_FIELD] = (
|
||||
expected_building_loss_threshold
|
||||
& self.df[field_names.FPL_200_AND_COLLEGE_ATTENDANCE_SERIES]
|
||||
)
|
||||
|
||||
self.df[
|
||||
field_names.EXTREME_HEAT_MEDIAN_HOUSE_VALUE_LOW_INCOME_FIELD
|
||||
field_names.EXPECTED_BUILDING_LOSS_RATE_LOW_INCOME_LOW_HIGHER_ED_FIELD
|
||||
] = (
|
||||
extreme_heat_and_median_house_value_threshold
|
||||
expected_building_loss_threshold
|
||||
& self.df[field_names.FPL_200_AND_COLLEGE_ATTENDANCE_SERIES]
|
||||
)
|
||||
|
||||
|
@ -221,11 +206,12 @@ class ScoreM(Score):
|
|||
# AND
|
||||
# Low income: In Nth percentile or above for percent of block group population
|
||||
# of households where household income is less than or equal to twice the federal
|
||||
# poverty level. Source: Census's American Community Survey]
|
||||
# poverty level and has low higher ed attendance.
|
||||
# Source: Census's American Community Survey
|
||||
|
||||
energy_eligibility_columns = [
|
||||
field_names.PM25_EXPOSURE_LOW_INCOME_FIELD,
|
||||
field_names.ENERGY_BURDEN_LOW_INCOME_FIELD,
|
||||
field_names.PM25_EXPOSURE_LOW_INCOME_LOW_HIGHER_ED_FIELD,
|
||||
field_names.ENERGY_BURDEN_LOW_INCOME_LOW_HIGHER_ED_FIELD,
|
||||
]
|
||||
|
||||
energy_burden_threshold = (
|
||||
|
@ -243,12 +229,12 @@ class ScoreM(Score):
|
|||
>= self.ENVIRONMENTAL_BURDEN_THRESHOLD
|
||||
)
|
||||
|
||||
self.df[field_names.PM25_EXPOSURE_LOW_INCOME_FIELD] = (
|
||||
self.df[field_names.PM25_EXPOSURE_LOW_INCOME_LOW_HIGHER_ED_FIELD] = (
|
||||
pm25_threshold
|
||||
& self.df[field_names.FPL_200_AND_COLLEGE_ATTENDANCE_SERIES]
|
||||
)
|
||||
|
||||
self.df[field_names.ENERGY_BURDEN_LOW_INCOME_FIELD] = (
|
||||
self.df[field_names.ENERGY_BURDEN_LOW_INCOME_LOW_HIGHER_ED_FIELD] = (
|
||||
energy_burden_threshold
|
||||
& self.df[field_names.FPL_200_AND_COLLEGE_ATTENDANCE_SERIES]
|
||||
)
|
||||
|
@ -266,11 +252,12 @@ class ScoreM(Score):
|
|||
# AND
|
||||
# Low income: In Nth percentile or above for percent of block group population
|
||||
# of households where household income is less than or equal to twice the federal
|
||||
# poverty level. Source: Census's American Community Survey]
|
||||
# poverty level and has a low percent of higher ed students.
|
||||
# Source: Census's American Community Survey
|
||||
|
||||
transportion_eligibility_columns = [
|
||||
field_names.DIESEL_PARTICULATE_MATTER_LOW_INCOME_FIELD,
|
||||
field_names.TRAFFIC_PROXIMITY_LOW_INCOME_FIELD,
|
||||
field_names.DIESEL_PARTICULATE_MATTER_LOW_INCOME_LOW_HIGHER_ED_FIELD,
|
||||
field_names.TRAFFIC_PROXIMITY_LOW_INCOME_LOW_HIGHER_ED_FIELD,
|
||||
]
|
||||
|
||||
diesel_threshold = (
|
||||
|
@ -287,12 +274,16 @@ class ScoreM(Score):
|
|||
>= self.ENVIRONMENTAL_BURDEN_THRESHOLD
|
||||
)
|
||||
|
||||
self.df[field_names.DIESEL_PARTICULATE_MATTER_LOW_INCOME_FIELD] = (
|
||||
self.df[
|
||||
field_names.DIESEL_PARTICULATE_MATTER_LOW_INCOME_LOW_HIGHER_ED_FIELD
|
||||
] = (
|
||||
diesel_threshold
|
||||
& self.df[field_names.FPL_200_AND_COLLEGE_ATTENDANCE_SERIES]
|
||||
)
|
||||
|
||||
self.df[field_names.TRAFFIC_PROXIMITY_LOW_INCOME_FIELD] = (
|
||||
self.df[
|
||||
field_names.TRAFFIC_PROXIMITY_LOW_INCOME_LOW_HIGHER_ED_FIELD
|
||||
] = (
|
||||
traffic_threshold
|
||||
& self.df[field_names.FPL_200_AND_COLLEGE_ATTENDANCE_SERIES]
|
||||
)
|
||||
|
@ -315,11 +306,12 @@ class ScoreM(Score):
|
|||
# AND
|
||||
# Low income: In Nth percentile or above for percent of block group population
|
||||
# of households where household income is less than or equal to twice the federal
|
||||
# poverty level. Source: Census's American Community Survey]
|
||||
# poverty level and has a low percent of higher ed students.
|
||||
# Source: Census's American Community Survey
|
||||
|
||||
housing_eligibility_columns = [
|
||||
field_names.LEAD_PAINT_MEDIAN_HOUSE_VALUE_LOW_INCOME_FIELD,
|
||||
field_names.HOUSING_BURDEN_LOW_INCOME_FIELD,
|
||||
field_names.LEAD_PAINT_MEDIAN_HOUSE_VALUE_LOW_INCOME_LOW_HIGHER_ED_FIELD,
|
||||
field_names.HOUSING_BURDEN_LOW_INCOME_LOW_HIGHER_ED_FIELD,
|
||||
]
|
||||
|
||||
lead_paint_median_home_value_threshold = (
|
||||
|
@ -345,12 +337,14 @@ class ScoreM(Score):
|
|||
)
|
||||
|
||||
# series by series indicators
|
||||
self.df[field_names.LEAD_PAINT_MEDIAN_HOUSE_VALUE_LOW_INCOME_FIELD] = (
|
||||
self.df[
|
||||
field_names.LEAD_PAINT_MEDIAN_HOUSE_VALUE_LOW_INCOME_LOW_HIGHER_ED_FIELD
|
||||
] = (
|
||||
lead_paint_median_home_value_threshold
|
||||
& self.df[field_names.FPL_200_AND_COLLEGE_ATTENDANCE_SERIES]
|
||||
)
|
||||
|
||||
self.df[field_names.HOUSING_BURDEN_LOW_INCOME_FIELD] = (
|
||||
self.df[field_names.HOUSING_BURDEN_LOW_INCOME_LOW_HIGHER_ED_FIELD] = (
|
||||
housing_burden_threshold
|
||||
& self.df[field_names.FPL_200_AND_COLLEGE_ATTENDANCE_SERIES]
|
||||
)
|
||||
|
@ -364,12 +358,13 @@ class ScoreM(Score):
|
|||
# AND
|
||||
# Low income: In Nth percentile or above for percent of block group population
|
||||
# of households where household income is less than or equal to twice the federal
|
||||
# poverty level. Source: Census's American Community Survey]
|
||||
# poverty level and has a low percent of higher ed students.
|
||||
# Source: Census's American Community Survey
|
||||
|
||||
pollution_eligibility_columns = [
|
||||
field_names.RMP_LOW_INCOME_FIELD,
|
||||
field_names.SUPERFUND_LOW_INCOME_FIELD,
|
||||
field_names.HAZARDOUS_WASTE_LOW_INCOME_FIELD,
|
||||
field_names.RMP_LOW_INCOME_LOW_HIGHER_ED_FIELD,
|
||||
field_names.SUPERFUND_LOW_INCOME_LOW_HIGHER_ED_FIELD,
|
||||
field_names.HAZARDOUS_WASTE_LOW_INCOME_LOW_HIGHER_ED_FIELD,
|
||||
]
|
||||
|
||||
rmp_sites_threshold = (
|
||||
|
@ -390,15 +385,15 @@ class ScoreM(Score):
|
|||
)
|
||||
|
||||
# individual series-by-series
|
||||
self.df[field_names.RMP_LOW_INCOME_FIELD] = (
|
||||
self.df[field_names.RMP_LOW_INCOME_LOW_HIGHER_ED_FIELD] = (
|
||||
rmp_sites_threshold
|
||||
& self.df[field_names.FPL_200_AND_COLLEGE_ATTENDANCE_SERIES]
|
||||
)
|
||||
self.df[field_names.SUPERFUND_LOW_INCOME_FIELD] = (
|
||||
self.df[field_names.SUPERFUND_LOW_INCOME_LOW_HIGHER_ED_FIELD] = (
|
||||
npl_sites_threshold
|
||||
& self.df[field_names.FPL_200_AND_COLLEGE_ATTENDANCE_SERIES]
|
||||
)
|
||||
self.df[field_names.HAZARDOUS_WASTE_LOW_INCOME_FIELD] = (
|
||||
self.df[field_names.HAZARDOUS_WASTE_LOW_INCOME_LOW_HIGHER_ED_FIELD] = (
|
||||
tsdf_sites_threshold
|
||||
& self.df[field_names.FPL_200_AND_COLLEGE_ATTENDANCE_SERIES]
|
||||
)
|
||||
|
@ -414,7 +409,8 @@ class ScoreM(Score):
|
|||
# AND
|
||||
# Low income: In Nth percentile or above for percent of block group population
|
||||
# of households where household income is less than or equal to twice the federal
|
||||
# poverty level. Source: Census's American Community Survey]
|
||||
# poverty level and has a low percent of higher ed students
|
||||
# Source: Census's American Community Survey
|
||||
|
||||
wastewater_threshold = (
|
||||
self.df[
|
||||
|
@ -424,16 +420,20 @@ class ScoreM(Score):
|
|||
>= self.ENVIRONMENTAL_BURDEN_THRESHOLD
|
||||
)
|
||||
|
||||
self.df[field_names.WASTEWATER_DISCHARGE_LOW_INCOME_FIELD] = (
|
||||
self.df[
|
||||
field_names.WASTEWATER_DISCHARGE_LOW_INCOME_LOW_HIGHER_ED_FIELD
|
||||
] = (
|
||||
wastewater_threshold
|
||||
& self.df[field_names.FPL_200_AND_COLLEGE_ATTENDANCE_SERIES]
|
||||
)
|
||||
|
||||
self._increment_total_eligibility_exceeded(
|
||||
[field_names.WASTEWATER_DISCHARGE_LOW_INCOME_FIELD]
|
||||
[field_names.WASTEWATER_DISCHARGE_LOW_INCOME_LOW_HIGHER_ED_FIELD]
|
||||
)
|
||||
|
||||
return self.df[field_names.WASTEWATER_DISCHARGE_LOW_INCOME_FIELD]
|
||||
return self.df[
|
||||
field_names.WASTEWATER_DISCHARGE_LOW_INCOME_LOW_HIGHER_ED_FIELD
|
||||
]
|
||||
|
||||
def _health_factor(self) -> bool:
|
||||
# In Xth percentile or above for diabetes (Source: CDC Places)
|
||||
|
@ -446,14 +446,14 @@ class ScoreM(Score):
|
|||
# AND
|
||||
# Low income: In Nth percentile or above for percent of block group population
|
||||
# of households where household income is less than or equal to twice the federal
|
||||
# poverty level. Source: Census's American Community Survey]
|
||||
# poverty level and has a low percent of higher ed students
|
||||
# Source: Census's American Community Survey
|
||||
|
||||
health_eligibility_columns = [
|
||||
field_names.DIABETES_LOW_INCOME_FIELD,
|
||||
field_names.ASTHMA_LOW_INCOME_FIELD,
|
||||
field_names.HEART_DISEASE_LOW_INCOME_FIELD,
|
||||
field_names.LOW_LIFE_EXPECTANCY_LOW_INCOME_FIELD,
|
||||
# field_names.HEALTHY_FOOD_LOW_INCOME_FIELD,
|
||||
field_names.DIABETES_LOW_INCOME_LOW_HIGHER_ED_FIELD,
|
||||
field_names.ASTHMA_LOW_INCOME_LOW_HIGHER_ED_FIELD,
|
||||
field_names.HEART_DISEASE_LOW_INCOME_LOW_HIGHER_ED_FIELD,
|
||||
field_names.LOW_LIFE_EXPECTANCY_LOW_INCOME_LOW_HIGHER_ED_FIELD,
|
||||
]
|
||||
|
||||
diabetes_threshold = (
|
||||
|
@ -486,34 +486,24 @@ class ScoreM(Score):
|
|||
>= self.ENVIRONMENTAL_BURDEN_THRESHOLD
|
||||
)
|
||||
|
||||
healthy_food_threshold = (
|
||||
self.df[
|
||||
field_names.HEALTHY_FOOD_FIELD
|
||||
+ field_names.PERCENTILE_FIELD_SUFFIX
|
||||
]
|
||||
>= self.ENVIRONMENTAL_BURDEN_THRESHOLD
|
||||
)
|
||||
|
||||
self.df[field_names.DIABETES_LOW_INCOME_FIELD] = (
|
||||
self.df[field_names.DIABETES_LOW_INCOME_LOW_HIGHER_ED_FIELD] = (
|
||||
diabetes_threshold
|
||||
& self.df[field_names.FPL_200_AND_COLLEGE_ATTENDANCE_SERIES]
|
||||
)
|
||||
self.df[field_names.ASTHMA_LOW_INCOME_FIELD] = (
|
||||
self.df[field_names.ASTHMA_LOW_INCOME_LOW_HIGHER_ED_FIELD] = (
|
||||
asthma_threshold
|
||||
& self.df[field_names.FPL_200_AND_COLLEGE_ATTENDANCE_SERIES]
|
||||
)
|
||||
self.df[field_names.HEART_DISEASE_LOW_INCOME_FIELD] = (
|
||||
self.df[field_names.HEART_DISEASE_LOW_INCOME_LOW_HIGHER_ED_FIELD] = (
|
||||
heart_disease_threshold
|
||||
& self.df[field_names.FPL_200_AND_COLLEGE_ATTENDANCE_SERIES]
|
||||
)
|
||||
self.df[field_names.LOW_LIFE_EXPECTANCY_LOW_INCOME_FIELD] = (
|
||||
self.df[
|
||||
field_names.LOW_LIFE_EXPECTANCY_LOW_INCOME_LOW_HIGHER_ED_FIELD
|
||||
] = (
|
||||
low_life_expectancy_threshold
|
||||
& self.df[field_names.FPL_200_AND_COLLEGE_ATTENDANCE_SERIES]
|
||||
)
|
||||
self.df[field_names.HEALTHY_FOOD_LOW_INCOME_FIELD] = (
|
||||
healthy_food_threshold
|
||||
& self.df[field_names.FPL_200_AND_COLLEGE_ATTENDANCE_SERIES]
|
||||
)
|
||||
|
||||
self._increment_total_eligibility_exceeded(health_eligibility_columns)
|
||||
|
||||
|
@ -531,17 +521,18 @@ class ScoreM(Score):
|
|||
# AND
|
||||
# Where the high school degree achievement rates for adults 25 years and older
|
||||
# is less than Y%
|
||||
# AND the higher ed attendance rates are under Z%
|
||||
# (necessary to screen out university tracts)
|
||||
|
||||
# Workforce criteria for states fields.
|
||||
workforce_eligibility_columns = [
|
||||
field_names.UNEMPLOYMENT_LOW_HS_EDUCATION_FIELD,
|
||||
field_names.POVERTY_LOW_HS_EDUCATION_FIELD,
|
||||
field_names.LINGUISTIC_ISOLATION_LOW_HS_EDUCATION_FIELD,
|
||||
field_names.LOW_MEDIAN_INCOME_LOW_HS_EDUCATION_FIELD,
|
||||
field_names.UNEMPLOYMENT_LOW_HS_LOW_HIGHER_ED_FIELD,
|
||||
field_names.POVERTY_LOW_HS_LOW_HIGHER_ED_FIELD,
|
||||
field_names.LINGUISTIC_ISOLATION_LOW_HS_LOW_HIGHER_ED_FIELD,
|
||||
field_names.LOW_MEDIAN_INCOME_LOW_HS_LOW_HIGHER_ED_FIELD,
|
||||
]
|
||||
|
||||
self.df[field_names.LOW_HS_EDUCATION_LOW_COLLEGE_ATTENDANCE_FIELD] = (
|
||||
self.df[field_names.LOW_HS_EDUCATION_LOW_HIGHER_ED_FIELD] = (
|
||||
self.df[field_names.HIGH_SCHOOL_ED_FIELD]
|
||||
>= self.LACK_OF_HIGH_SCHOOL_MINIMUM_THRESHOLD
|
||||
) & (
|
||||
|
@ -588,24 +579,24 @@ class ScoreM(Score):
|
|||
>= self.ENVIRONMENTAL_BURDEN_THRESHOLD
|
||||
)
|
||||
|
||||
self.df[field_names.LINGUISTIC_ISOLATION_LOW_HS_EDUCATION_FIELD] = (
|
||||
self.df[field_names.LINGUISTIC_ISOLATION_LOW_HS_LOW_HIGHER_ED_FIELD] = (
|
||||
linguistic_isolation_threshold
|
||||
& self.df[field_names.LOW_HS_EDUCATION_LOW_COLLEGE_ATTENDANCE_FIELD]
|
||||
& self.df[field_names.LOW_HS_EDUCATION_LOW_HIGHER_ED_FIELD]
|
||||
)
|
||||
|
||||
self.df[field_names.POVERTY_LOW_HS_EDUCATION_FIELD] = (
|
||||
self.df[field_names.POVERTY_LOW_HS_LOW_HIGHER_ED_FIELD] = (
|
||||
poverty_threshold
|
||||
& self.df[field_names.LOW_HS_EDUCATION_LOW_COLLEGE_ATTENDANCE_FIELD]
|
||||
& self.df[field_names.LOW_HS_EDUCATION_LOW_HIGHER_ED_FIELD]
|
||||
)
|
||||
|
||||
self.df[field_names.LOW_MEDIAN_INCOME_LOW_HS_EDUCATION_FIELD] = (
|
||||
self.df[field_names.LOW_MEDIAN_INCOME_LOW_HS_LOW_HIGHER_ED_FIELD] = (
|
||||
low_median_income_threshold
|
||||
& self.df[field_names.LOW_HS_EDUCATION_LOW_COLLEGE_ATTENDANCE_FIELD]
|
||||
& self.df[field_names.LOW_HS_EDUCATION_LOW_HIGHER_ED_FIELD]
|
||||
)
|
||||
|
||||
self.df[field_names.UNEMPLOYMENT_LOW_HS_EDUCATION_FIELD] = (
|
||||
self.df[field_names.UNEMPLOYMENT_LOW_HS_LOW_HIGHER_ED_FIELD] = (
|
||||
unemployment_threshold
|
||||
& self.df[field_names.LOW_HS_EDUCATION_LOW_COLLEGE_ATTENDANCE_FIELD]
|
||||
& self.df[field_names.LOW_HS_EDUCATION_LOW_HIGHER_ED_FIELD]
|
||||
)
|
||||
|
||||
workforce_combined_criteria_for_states = self.df[
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue