Fast flag update (#1844)

Added additional flags for the front end based on our conversation in stand up this morning.
This commit is contained in:
Emma Nechamkin 2022-08-19 13:14:44 -04:00 committed by GitHub
commit d892bce6cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 63 additions and 31 deletions

View file

@ -1,7 +1,7 @@
# Suffixes
PERCENTILE_FIELD_SUFFIX = " (percentile)"
ISLAND_AREAS_PERCENTILE_ADJUSTMENT_FIELD = " for island areas"
ADJACENT_MEAN_SUFFIX = " (including adjacency index)"
ADJACENT_MEAN_SUFFIX = " (based on adjacency index and low income alone)"
ADJACENCY_INDEX_SUFFIX = " (average of neighbors)"
# Geographic field names
@ -12,6 +12,9 @@ COUNTY_FIELD = "County Name"
# Score file field names
# Definition M fields
SCORE_M = "Definition M"
FINAL_SCORE_N_BOOLEAN = (
"Definition M community, including adjacency index tracts"
)
SCORE_M_COMMUNITIES = "Definition M (communities)"
M_CLIMATE = "Climate Factor (Definition M)"
M_ENERGY = "Energy Factor (Definition M)"
@ -67,6 +70,9 @@ ADJUSTED_POVERTY_LESS_THAN_200_PERCENT_FPL_FIELD_NAME = (
# this is what gets used in the score
POVERTY_LESS_THAN_200_FPL_IMPUTED_FIELD = "Percent of individuals below 200% Federal Poverty Line, imputed and adjusted"
IMPUTED_INCOME_FLAG_FIELD_NAME = (
"Income data has been estimated based on neighbor income"
)
POVERTY_LESS_THAN_150_FPL_FIELD = (
"Percent of individuals < 150% Federal Poverty Line"
)

View file

@ -385,8 +385,10 @@ class ScoreNarwhal(Score):
# Kitchen / plumbing
self.df[field_names.NO_KITCHEN_OR_INDOOR_PLUMBING_PCTILE_THRESHOLD] = (
self.df[field_names.NO_KITCHEN_OR_INDOOR_PLUMBING_FIELD
+ field_names.PERCENTILE_FIELD_SUFFIX]
self.df[
field_names.NO_KITCHEN_OR_INDOOR_PLUMBING_FIELD
+ field_names.PERCENTILE_FIELD_SUFFIX
]
>= self.ENVIRONMENTAL_BURDEN_THRESHOLD
)
@ -971,8 +973,8 @@ class ScoreNarwhal(Score):
>= self.SCORE_THRESHOLD_DONUT
)
# This should be the "final list" of Score Narwhal communities, meaning that we would
# expect this to be True if either the tract is a donut hole community OR the tract is a DAC
# This constructs the boolean for whether it's a donut hole community
# This can also be true when the tract itself is a DAC on its own
self.df[
field_names.SCORE_N_COMMUNITIES + field_names.ADJACENT_MEAN_SUFFIX
] = (
@ -980,6 +982,16 @@ class ScoreNarwhal(Score):
& self.df[field_names.ADJACENT_TRACT_SCORE_ABOVE_DONUT_THRESHOLD]
)
# This should be the "final list" of Score Narwhal communities, meaning that we would
# expect this to be True if either the tract is a donut hole community OR the tract is a DAC
self.df[field_names.FINAL_SCORE_N_BOOLEAN] = (
self.df[field_names.SCORE_N_COMMUNITIES]
| self.df[
field_names.SCORE_N_COMMUNITIES
+ field_names.ADJACENT_MEAN_SUFFIX
]
)
def add_columns(self) -> pd.DataFrame:
logger.info("Adding Score Narhwal")