Welcome to the Fatal Injury and Violence Analytics - Map View challenge! CDC’s National Center for Injury Prevention and Control (NCIPC) works to understand how injury and violence impact society, and what can be done to prevent it. In the previous competitions (1, 2) we implemented a base Python/Dash solution for the fatal injury and violence data analytics and visualization dashboard. In today's challenge you will further build on the codebase provided in the challenge forum to implement new functionality, explained below.
- Add a new, third tab to the dashboard (the tab selector is just below the app title). The tab will display in a table the top increases or decreases in the number of deaths for the most recent data year (2018 in the currently included sample dataset) compared to the previous data year (2017), or optionally a selected range of years.
The overall logic behind the top increases / decreases calculations will be very similar to the current logic behind the map view (second tab). Please, do your best to reuse calculation functions, and result caching, doing necessary refactoring on the way. In general, we want to show the same data on the view, and in the table.If you see logic described below is different from what is done for the map view, feel free to also correct that for the map view. If you have any question bring it up in the challenge forum.
- The tab will have these inputs:
- The Cause selector
- The Intent selector
- Custom year range selector to compare the latest year data against. Defaults to the previous year (2017 in case of current dataset). If a range of years is selected you will compare the last year incidents against the average yearly incident count for the year range).
- State / county / mixed radio-switch to toggle the calculation level.
- Given the above inputs the app should comb through all geographic (state / county), age (by age group), gender, race, and ethnicity combinations, and calculate the percent increase or decrease between the latest year and the chosen comparison year(s).
By the percent increase or decrease we mean namely: if Ny and Ny-1 are recorded death counts for current variables in the years y and y-1 the relative count change is:
. If the year span selector selects multiple years for Ny-1 you will use the average count for that year.
The task will likely require long calculations. Be sure the results are cached and reused when possible, also be sure the interface is clearly indicating the calculation state & progress.
- To somewhat speed-up calculations, narrow down different age values to the following age groups: 0-9; 10-19; 20-29; 30-39; 40-49; 50-59; 60-69; 70-79; 80+; unknown. Also update the existing two tabs to use the same age groups.
- For each variable you should consider “undefined” as one of the considered values (e.g. “any gender”, “any age”, etc.).
- The output of computations will be a table showing the following report:
- The list of top 10 combinations of variables (i.e. geography / age / gender / race / ethnicity) that results in the largest increase in deaths by relative percent for the given cause and intent inputs).
- Followed by the list of top 10 combinations of variables resulting in the largest decrease in deaths by relative percent.
- Here is the draft of expected output: