mirror of
https://github.com/DOI-DO/j40-cejst-2.git
synced 2025-02-23 10:04:18 -08:00
Stripping thresholds from PR so the UI matches the count
Add a tuple to skip FIPS 72 when incrementing counter. TODO: clean up so it's a constant.
This commit is contained in:
parent
1b76a68838
commit
cee13b50cc
1 changed files with 35 additions and 12 deletions
|
@ -113,15 +113,29 @@ class ScoreM(Score):
|
||||||
)
|
)
|
||||||
|
|
||||||
def _increment_total_eligibility_exceeded(
|
def _increment_total_eligibility_exceeded(
|
||||||
self, columns_for_subset: list
|
self, columns_for_subset: list, skip_fips: tuple = ()
|
||||||
) -> None:
|
) -> None:
|
||||||
"""
|
"""
|
||||||
Increments the total eligible factors for a given tract
|
Increments the total eligible factors for a given tract
|
||||||
"""
|
|
||||||
|
|
||||||
self.df[field_names.THRESHOLD_COUNT] += self.df[columns_for_subset].sum(
|
The new skip_fips argument specifies which (if any) fips codes to
|
||||||
axis=1, skipna=True
|
skip over for incrementing.
|
||||||
)
|
This allows us to essentially skip data we think is of limited veracity,
|
||||||
|
without overriding any values in the data.
|
||||||
|
THIS IS A TEMPORARY FIX.
|
||||||
|
"""
|
||||||
|
if skip_fips:
|
||||||
|
self.df[field_names.THRESHOLD_COUNT] += np.where(
|
||||||
|
self.df[field_names.GEOID_TRACT_FIELD].str.startswith(
|
||||||
|
skip_fips
|
||||||
|
),
|
||||||
|
0,
|
||||||
|
self.df[columns_for_subset].sum(axis=1, skipna=True),
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
self.df[field_names.THRESHOLD_COUNT] += self.df[
|
||||||
|
columns_for_subset
|
||||||
|
].sum(axis=1, skipna=True)
|
||||||
|
|
||||||
def _climate_factor(self) -> bool:
|
def _climate_factor(self) -> bool:
|
||||||
# In Xth percentile or above for FEMA’s Risk Index (Source: FEMA
|
# In Xth percentile or above for FEMA’s Risk Index (Source: FEMA
|
||||||
|
@ -182,7 +196,9 @@ class ScoreM(Score):
|
||||||
& self.df[field_names.FPL_200_AND_COLLEGE_ATTENDANCE_SERIES]
|
& self.df[field_names.FPL_200_AND_COLLEGE_ATTENDANCE_SERIES]
|
||||||
)
|
)
|
||||||
|
|
||||||
self._increment_total_eligibility_exceeded(climate_eligibility_columns)
|
self._increment_total_eligibility_exceeded(
|
||||||
|
climate_eligibility_columns, skip_fips=("72")
|
||||||
|
)
|
||||||
|
|
||||||
return self.df[climate_eligibility_columns].any(axis="columns")
|
return self.df[climate_eligibility_columns].any(axis="columns")
|
||||||
|
|
||||||
|
@ -224,7 +240,9 @@ class ScoreM(Score):
|
||||||
& self.df[field_names.FPL_200_AND_COLLEGE_ATTENDANCE_SERIES]
|
& self.df[field_names.FPL_200_AND_COLLEGE_ATTENDANCE_SERIES]
|
||||||
)
|
)
|
||||||
|
|
||||||
self._increment_total_eligibility_exceeded(energy_eligibility_columns)
|
self._increment_total_eligibility_exceeded(
|
||||||
|
energy_eligibility_columns, skip_fips=("72")
|
||||||
|
)
|
||||||
|
|
||||||
return self.df[energy_eligibility_columns].any(axis="columns")
|
return self.df[energy_eligibility_columns].any(axis="columns")
|
||||||
|
|
||||||
|
@ -274,7 +292,7 @@ class ScoreM(Score):
|
||||||
)
|
)
|
||||||
|
|
||||||
self._increment_total_eligibility_exceeded(
|
self._increment_total_eligibility_exceeded(
|
||||||
transportion_eligibility_columns
|
transportion_eligibility_columns, skip_fips=("72")
|
||||||
)
|
)
|
||||||
|
|
||||||
return self.df[transportion_eligibility_columns].any(axis="columns")
|
return self.df[transportion_eligibility_columns].any(axis="columns")
|
||||||
|
@ -334,7 +352,9 @@ class ScoreM(Score):
|
||||||
& self.df[field_names.FPL_200_AND_COLLEGE_ATTENDANCE_SERIES]
|
& self.df[field_names.FPL_200_AND_COLLEGE_ATTENDANCE_SERIES]
|
||||||
)
|
)
|
||||||
|
|
||||||
self._increment_total_eligibility_exceeded(housing_eligibility_columns)
|
self._increment_total_eligibility_exceeded(
|
||||||
|
housing_eligibility_columns, skip_fips=("72")
|
||||||
|
)
|
||||||
|
|
||||||
return self.df[housing_eligibility_columns].any(axis="columns")
|
return self.df[housing_eligibility_columns].any(axis="columns")
|
||||||
|
|
||||||
|
@ -384,7 +404,7 @@ class ScoreM(Score):
|
||||||
)
|
)
|
||||||
|
|
||||||
self._increment_total_eligibility_exceeded(
|
self._increment_total_eligibility_exceeded(
|
||||||
pollution_eligibility_columns
|
pollution_eligibility_columns, skip_fips=("72")
|
||||||
)
|
)
|
||||||
|
|
||||||
return self.df[pollution_eligibility_columns].any(axis="columns")
|
return self.df[pollution_eligibility_columns].any(axis="columns")
|
||||||
|
@ -413,7 +433,8 @@ class ScoreM(Score):
|
||||||
)
|
)
|
||||||
|
|
||||||
self._increment_total_eligibility_exceeded(
|
self._increment_total_eligibility_exceeded(
|
||||||
[field_names.WASTEWATER_DISCHARGE_LOW_INCOME_LOW_HIGHER_ED_FIELD]
|
[field_names.WASTEWATER_DISCHARGE_LOW_INCOME_LOW_HIGHER_ED_FIELD],
|
||||||
|
skip_fips=("72"),
|
||||||
)
|
)
|
||||||
|
|
||||||
return self.df[
|
return self.df[
|
||||||
|
@ -490,7 +511,9 @@ class ScoreM(Score):
|
||||||
& self.df[field_names.FPL_200_AND_COLLEGE_ATTENDANCE_SERIES]
|
& self.df[field_names.FPL_200_AND_COLLEGE_ATTENDANCE_SERIES]
|
||||||
)
|
)
|
||||||
|
|
||||||
self._increment_total_eligibility_exceeded(health_eligibility_columns)
|
self._increment_total_eligibility_exceeded(
|
||||||
|
health_eligibility_columns, skip_fips=("72")
|
||||||
|
)
|
||||||
|
|
||||||
return self.df[health_eligibility_columns].any(axis="columns")
|
return self.df[health_eligibility_columns].any(axis="columns")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue