1295-college-attendance-field (#1297)

Lucas' work. Adding college attendance to tiles.
This commit is contained in:
Lucas Merrill Brown 2022-02-17 19:50:52 -05:00 committed by GitHub
parent e48ab86b85
commit 6e64134dc6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 25 additions and 7 deletions

View file

@ -203,6 +203,8 @@ TILES_SCORE_COLUMNS = {
+ field_names.PERCENTILE_FIELD_SUFFIX: "IAULHSE_PFS", + field_names.PERCENTILE_FIELD_SUFFIX: "IAULHSE_PFS",
# Percentage of HS Degree completion for Islands # Percentage of HS Degree completion for Islands
field_names.CENSUS_DECENNIAL_HIGH_SCHOOL_ED_FIELD_2009: "IAHSEF", field_names.CENSUS_DECENNIAL_HIGH_SCHOOL_ED_FIELD_2009: "IAHSEF",
field_names.COLLEGE_ATTENDANCE_FIELD: "CA",
field_names.COLLEGE_ATTENDANCE_LESS_THAN_20_FIELD: "CA_LT20",
} }
# columns to round floats to 2 decimals # columns to round floats to 2 decimals
@ -252,6 +254,7 @@ TILES_SCORE_FLOAT_COLUMNS = [
field_names.ISLAND_AREAS_LOW_HS_EDUCATION_FIELD, field_names.ISLAND_AREAS_LOW_HS_EDUCATION_FIELD,
field_names.WASTEWATER_FIELD + field_names.PERCENTILE_FIELD_SUFFIX, field_names.WASTEWATER_FIELD + field_names.PERCENTILE_FIELD_SUFFIX,
field_names.SCORE_M + field_names.PERCENTILE_FIELD_SUFFIX, field_names.SCORE_M + field_names.PERCENTILE_FIELD_SUFFIX,
field_names.COLLEGE_ATTENDANCE_FIELD,
] ]
# Finally we augment with the GEOID10, county, and state # Finally we augment with the GEOID10, county, and state
@ -263,6 +266,8 @@ DOWNLOADABLE_SCORE_COLUMNS = [
field_names.SCORE_M_COMMUNITIES, field_names.SCORE_M_COMMUNITIES,
field_names.TOTAL_POP_FIELD, field_names.TOTAL_POP_FIELD,
field_names.FPL_200_AND_COLLEGE_ATTENDANCE_SERIES, field_names.FPL_200_AND_COLLEGE_ATTENDANCE_SERIES,
field_names.COLLEGE_ATTENDANCE_FIELD,
field_names.COLLEGE_ATTENDANCE_LESS_THAN_20_FIELD,
field_names.EXPECTED_AGRICULTURE_LOSS_RATE_LOW_INCOME_LOW_HIGHER_ED_FIELD, field_names.EXPECTED_AGRICULTURE_LOSS_RATE_LOW_INCOME_LOW_HIGHER_ED_FIELD,
field_names.EXPECTED_AGRICULTURE_LOSS_RATE_FIELD field_names.EXPECTED_AGRICULTURE_LOSS_RATE_FIELD
+ field_names.PERCENTILE_FIELD_SUFFIX, + field_names.PERCENTILE_FIELD_SUFFIX,

File diff suppressed because one or more lines are too long

View file

@ -375,6 +375,10 @@ SCORE_M_LOW_INCOME_SUFFIX = (
", is low income, and has a low percent of higher ed students" ", is low income, and has a low percent of higher ed students"
) )
COLLEGE_ATTENDANCE_LESS_THAN_20_FIELD = (
"Percent higher ed enrollment rate is less than 20%"
)
# Climate Change # Climate Change
EXPECTED_POPULATION_LOSS_RATE_LOW_INCOME_LOW_HIGHER_ED_FIELD = ( EXPECTED_POPULATION_LOSS_RATE_LOW_INCOME_LOW_HIGHER_ED_FIELD = (
f"Greater than or equal to the {PERCENTILE}th percentile" f"Greater than or equal to the {PERCENTILE}th percentile"

View file

@ -92,6 +92,7 @@ class ScoreM(Score):
of booleans based on the condition of the FPL at 200% of booleans based on the condition of the FPL at 200%
is at or more than some established threshold is at or more than some established threshold
""" """
return ( return (
( (
df[ df[
@ -101,10 +102,7 @@ class ScoreM(Score):
>= self.LOW_INCOME_THRESHOLD >= self.LOW_INCOME_THRESHOLD
) )
) & ( ) & (
( df[field_names.COLLEGE_ATTENDANCE_LESS_THAN_20_FIELD]
df[field_names.COLLEGE_ATTENDANCE_FIELD]
<= self.MAX_COLLEGE_ATTENDANCE_THRESHOLD
)
| ( | (
# If college attendance data is null for this tract, just rely on the # If college attendance data is null for this tract, just rely on the
# poverty data # poverty data
@ -732,6 +730,17 @@ class ScoreM(Score):
logger.info("Adding Score M") logger.info("Adding Score M")
self.df[field_names.THRESHOLD_COUNT] = 0 self.df[field_names.THRESHOLD_COUNT] = 0
# TODO: move this inside of
# `_create_low_income_and_low_college_attendance_threshold`
# and change the return signature of that method.
# Create a standalone field that captures the college attendance boolean
# threshold.
self.df[field_names.COLLEGE_ATTENDANCE_LESS_THAN_20_FIELD] = (
self.df[field_names.COLLEGE_ATTENDANCE_FIELD]
<= self.MAX_COLLEGE_ATTENDANCE_THRESHOLD
)
self.df[ self.df[
field_names.FPL_200_AND_COLLEGE_ATTENDANCE_SERIES field_names.FPL_200_AND_COLLEGE_ATTENDANCE_SERIES
] = self._create_low_income_and_low_college_attendance_threshold( ] = self._create_low_income_and_low_college_attendance_threshold(