Use new street miles column to do robust calculation
This the second pull request for this indicator after we realized we were doing it incorrectly.
We now use data emailed to us by dcp transportation that has street miles for each puma
Back-solve for total number of events
The process to get all data for a given year range was decomposed into a new function, get_year_range_df. The code was also updated to return the total number of events, not the number per 100 street miles. Even though the number per 100 street miles is how the data comes originally and what we want as final output, a consistent process that does the division correctly requires the number of events and street miles.
Sum total number and street miles
This math lives in mean_by_geography. The first parameter passed is a numerator dataframe of a single data point (pedestrian injury, cyclist injury, etc) across a given year range. The second parameter is the denominator dataframe of corresponding street miles for each year. Each is aggregated on the geography, and then the sum of the numerator divided by the sum of the denominator times 100 gives the number of events per 100 street miles.
Use new street miles column to do robust calculation
This the second pull request for this indicator after we realized we were doing it incorrectly. We now use data emailed to us by dcp transportation that has street miles for each puma
Back-solve for total number of events
The process to get all data for a given year range was decomposed into a new function,
get_year_range_df
. The code was also updated to return the total number of events, not the number per 100 street miles. Even though the number per 100 street miles is how the data comes originally and what we want as final output, a consistent process that does the division correctly requires the number of events and street miles.Sum total number and street miles
This math lives in
mean_by_geography
. The first parameter passed is a numerator dataframe of a single data point (pedestrian injury, cyclist injury, etc) across a given year range. The second parameter is the denominator dataframe of corresponding street miles for each year. Each is aggregated on the geography, and then the sum of the numerator divided by the sum of the denominator times 100 gives the number of events per 100 street miles.