mirror of
https://github.com/DOI-DO/j40-cejst-2.git
synced 2025-07-28 14:11:17 -07:00
Update Side Panel Tile Data (#866)
* Update Side Panel Tile Data * Update Side Panel Tile Data * Correct indicator names to match csv * Replace Score with Rate * Comment out FEMA Loss Rate to troubleshoot * Removes all "FEMA Loss Rate" array elements * Revert FEMA to Score * Remove expected loss rate * Remove RMP and NPL from BASIC array * Attempt to make shape mismatch align - update README typo * Add Score L indicators to TILE_SCORE_FLOAT_COLUMNS * removing cbg references * completes the ticket * Update side panel fields * Update index file writing to create parent dir * Updates from linting * fixing missing field_names for island territories 90th percentile fields * Update downloadable fields and fix field name * Update file fields and tests * Update ordering of fields and leave TODO * Update pickle after re-ordering of file * fixing bugs in etl_score_geo * Repeating index for diesel fix * passing tests * adding pytest.ini Co-authored-by: Vim USDS <vimal.k.shah@omb.eop.gov> Co-authored-by: Shelby Switzer <shelby.switzer@cms.hhs.gov> Co-authored-by: lucasmbrown-usds <lucas.m.brown@omb.eop.gov>
This commit is contained in:
parent
83eb7b0982
commit
9709d08ca3
13 changed files with 328 additions and 141 deletions
|
@ -291,14 +291,27 @@ POVERTY_LOW_HS_EDUCATION_FIELD = (
|
|||
" and has low HS education"
|
||||
)
|
||||
|
||||
LOW_READING_LOW_HS_EDUCATION_FIELD = (
|
||||
f"At or above the {PERCENTILE}th percentile for low 3rd grade reading proficiency"
|
||||
" and has low HS education"
|
||||
LOW_MEDIAN_INCOME_LOW_HS_EDUCATION_FIELD = (
|
||||
f"At or above the {PERCENTILE}th percentile for low median household income as a "
|
||||
f"percent of area median income and has low HS education"
|
||||
)
|
||||
|
||||
LOW_MEDIAN_INCOME_LOW_HS_EDUCATION_FIELD = (
|
||||
f"At or below the {PERCENTILE}th percentile for low median household income as a "
|
||||
f"percent of area median income and has low HS education"
|
||||
# Workforce for island areas
|
||||
ISLAND_AREAS_SUFFIX = " in 2009 (island areas)"
|
||||
ISLAND_AREAS_UNEMPLOYMENT_LOW_HS_EDUCATION_FIELD = (
|
||||
f"At or above the {PERCENTILE}th percentile for unemployment"
|
||||
f" and has low HS education{ISLAND_AREAS_SUFFIX}"
|
||||
)
|
||||
|
||||
ISLAND_AREAS_POVERTY_LOW_HS_EDUCATION_FIELD = (
|
||||
f"At or above the {PERCENTILE}th percentile for households at or below 100% federal poverty level"
|
||||
f" and has low HS education{ISLAND_AREAS_SUFFIX}"
|
||||
)
|
||||
|
||||
ISLAND_AREAS_LOW_MEDIAN_INCOME_LOW_HS_EDUCATION_FIELD = (
|
||||
f"At or above 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}"
|
||||
)
|
||||
|
||||
# Not currently used in a factor
|
||||
|
@ -317,6 +330,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"
|
||||
)
|
||||
LOW_READING_LOW_HS_EDUCATION_FIELD = (
|
||||
f"At or above the {PERCENTILE}th percentile for low 3rd grade reading proficiency"
|
||||
" and has low HS education"
|
||||
)
|
||||
|
||||
THRESHOLD_COUNT = "Total threshold criteria exceeded"
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ class ScoreL(Score):
|
|||
"""
|
||||
|
||||
self.df[field_names.THRESHOLD_COUNT] += self.df[columns_for_subset].sum(
|
||||
axis=1
|
||||
axis=1, skipna=True
|
||||
)
|
||||
|
||||
def add_columns(self) -> pd.DataFrame:
|
||||
|
@ -162,7 +162,7 @@ class ScoreL(Score):
|
|||
non_workforce_factors
|
||||
].any(axis=1)
|
||||
|
||||
self.df["Definition L (percentile)"] = self.df[
|
||||
self.df[field_names.SCORE_L + field_names.PERCENTILE_FIELD_SUFFIX] = self.df[
|
||||
field_names.SCORE_L_COMMUNITIES
|
||||
].astype(int)
|
||||
|
||||
|
@ -586,12 +586,16 @@ class ScoreL(Score):
|
|||
)
|
||||
|
||||
# Now, calculate workforce criteria for island territories.
|
||||
island_areas_workforce_eligibility_columns = [
|
||||
field_names.ISLAND_AREAS_UNEMPLOYMENT_LOW_HS_EDUCATION_FIELD,
|
||||
field_names.ISLAND_AREAS_POVERTY_LOW_HS_EDUCATION_FIELD,
|
||||
field_names.ISLAND_AREAS_LOW_MEDIAN_INCOME_LOW_HS_EDUCATION_FIELD,
|
||||
]
|
||||
|
||||
# F a couple of values, create a combined field and criteria field.
|
||||
# First, combine unemployment.
|
||||
(
|
||||
self.df,
|
||||
unemployment_island_areas_criteria_field_name,
|
||||
island_areas_unemployment_criteria_field_name,
|
||||
) = self._combine_island_areas_with_states_and_set_thresholds(
|
||||
df=self.df,
|
||||
column_from_island_areas=field_names.CENSUS_DECENNIAL_UNEMPLOYMENT_FIELD_2009,
|
||||
|
@ -603,7 +607,7 @@ class ScoreL(Score):
|
|||
# Next, combine poverty.
|
||||
(
|
||||
self.df,
|
||||
poverty_island_areas_criteria_field_name,
|
||||
island_areas_poverty_criteria_field_name,
|
||||
) = self._combine_island_areas_with_states_and_set_thresholds(
|
||||
df=self.df,
|
||||
column_from_island_areas=field_names.CENSUS_DECENNIAL_POVERTY_LESS_THAN_100_FPL_FIELD_2009,
|
||||
|
@ -614,12 +618,12 @@ class ScoreL(Score):
|
|||
|
||||
# Also check whether low area median income is 90th percentile or higher
|
||||
# within the islands.
|
||||
low_median_income_as_a_percent_of_ami_island_areas_criteria_field_name = (
|
||||
island_areas_low_median_income_as_a_percent_of_ami_criteria_field_name = (
|
||||
f"{field_names.LOW_CENSUS_DECENNIAL_AREA_MEDIAN_INCOME_PERCENT_FIELD_2009} exceeds "
|
||||
f"{field_names.PERCENTILE}th percentile"
|
||||
)
|
||||
self.df[
|
||||
low_median_income_as_a_percent_of_ami_island_areas_criteria_field_name
|
||||
island_areas_low_median_income_as_a_percent_of_ami_criteria_field_name
|
||||
] = (
|
||||
self.df[
|
||||
field_names.LOW_CENSUS_DECENNIAL_AREA_MEDIAN_INCOME_PERCENT_FIELD_2009
|
||||
|
@ -628,17 +632,40 @@ class ScoreL(Score):
|
|||
>= self.ENVIRONMENTAL_BURDEN_THRESHOLD
|
||||
)
|
||||
|
||||
workforce_combined_criteria_for_island_areas = (
|
||||
self.df[unemployment_island_areas_criteria_field_name]
|
||||
| self.df[poverty_island_areas_criteria_field_name]
|
||||
| self.df[
|
||||
low_median_income_as_a_percent_of_ami_island_areas_criteria_field_name
|
||||
]
|
||||
) & (
|
||||
island_areas_high_scool_achievement_rate_threshold = (
|
||||
self.df[field_names.CENSUS_DECENNIAL_HIGH_SCHOOL_ED_FIELD_2009]
|
||||
>= self.LACK_OF_HIGH_SCHOOL_MINIMUM_THRESHOLD
|
||||
)
|
||||
|
||||
self.df[
|
||||
field_names.ISLAND_AREAS_UNEMPLOYMENT_LOW_HS_EDUCATION_FIELD
|
||||
] = (
|
||||
self.df[island_areas_unemployment_criteria_field_name]
|
||||
& island_areas_high_scool_achievement_rate_threshold
|
||||
)
|
||||
|
||||
self.df[field_names.ISLAND_AREAS_POVERTY_LOW_HS_EDUCATION_FIELD] = (
|
||||
self.df[island_areas_poverty_criteria_field_name]
|
||||
& island_areas_high_scool_achievement_rate_threshold
|
||||
)
|
||||
|
||||
self.df[
|
||||
field_names.ISLAND_AREAS_LOW_MEDIAN_INCOME_LOW_HS_EDUCATION_FIELD
|
||||
] = (
|
||||
self.df[
|
||||
island_areas_low_median_income_as_a_percent_of_ami_criteria_field_name
|
||||
]
|
||||
& island_areas_high_scool_achievement_rate_threshold
|
||||
)
|
||||
|
||||
workforce_combined_criteria_for_island_areas = self.df[
|
||||
island_areas_workforce_eligibility_columns
|
||||
].any(axis="columns")
|
||||
|
||||
self._increment_total_eligibility_exceeded(
|
||||
island_areas_workforce_eligibility_columns
|
||||
)
|
||||
|
||||
percent_of_island_tracts_highlighted = (
|
||||
100
|
||||
* workforce_combined_criteria_for_island_areas.sum()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue