usds/justice40-tool

Lead paint indicator on side panel is not highlighted when values are above 90th percentile

vim-usds opened this issue · 1 comments

Describe the bug
Lead paint indicator on side panel is not highlighted when values are above 90th percentile

To Reproduce
Steps to reproduce the behavior, the following tracts exhibit the behavior:

Expected behavior
Each of the above tracts should have their lead paint indicator shown with a blue highlight

The lead paint indicator is more accurately described as capturing the probability of lead paint in homes then it is the overall prevalence of lead paint. This indicator is constructed from the joint distribution of median household income and percent of homes built before 1960. Right now, the percentile ranking is done on the "percent of homes built before 1960" field. And then a filter is applied such so that tracts in the 90th percentile of median household income and in the 90th percentile of percent of homes built before 1960 will not trigger the indicator threshold. But, the percentile being displayed is still the percentile associated with percent of homes built before 1960.

There are two ways to fix it. The first method preserves the current score, the second would involve changing the score.

Method 1: For any tract that satisfies both conditions (high old home share and high median income), display a Null value as opposed to displaying the old home share percentile.
Method 2: Calculate the joint distribution of percent of old homes and income by setting the percent of old homes equal to 0 when the median household income is above the 90th percentile. Then calculate the percentiles for percent of old homes.

Method 2 is preferable to Method 1 because it preserves the validity of flagging the top 10% of the indicator (probability of lead paint). Method 1 flags less than 10% of tracts because it flags 10% of tracts based on old home percentage and then limits that further with median household income. Method 2 should be implemented with a CEJST 2.0 update.