Recidiviz / justice-counts-components

A set of React components powering a web app for exploring centralized, standardized metrics on the performance of justice systems across the United States
GNU General Public License v3.0
1 stars 0 forks source link

Annualized data support #83

Closed nasaownsky closed 3 years ago

nasaownsky commented 3 years ago

Description of the change

  1. Added annualized section to MainPage along with new Switch component
  2. Updated chart logic

Type of change

Related issues

Closes #80

Checklists

Development

These boxes should be checked by the submitter prior to merging:

Code review

These boxes should be checked by reviewers prior to merging:

colincadams commented 3 years ago

Awesome! Sorry for the delay on this @nasaownsky, here is a link to the annual fixture file: https://drive.google.com/file/d/1F7tCpTxUWEud6qDoPNB2_ZmBG3VLvx0p/view?usp=sharing

This has the same format as the existing data file, but with annual data instead of monthly. I thought that just providing the data in a separate file would be the easiest way to support this, will that work for you?

Additionally a few comments from my first pass at reviewing this:

  1. Only the first chart was switched to bars, the rest still show lines. I believe they should all be bars.

    Screen Shot 2021-04-02 at 11 42 26 AM
  2. When dropping in the annual data, it changes the time horizon to "5 years" but displays the last 5 months. When expanding to all time it still tries to show a bar for every month, even though there is only data once per year.

    Screen Shot 2021-04-05 at 1 20 37 PM Screen Shot 2021-04-05 at 1 20 50 PM
hobuobi commented 3 years ago

Additionally, we noticed that in some cases, we have to use older data than what is available in order to create the yearly metrics shown with the Annual tab. In these cases, we'll want to add a warning tooltip to let the user know that we are artificially restricted the data, and that there is more recent data available in the Monthly tab.

I updated the main description for #80 with this change, but copying it down below for convenience.


Data is restricted to older reports in order to match the other reports shown; however, more recent data is available (as of [DATE YEAR of most recent data for the metric]). Use the Reporting Frequency switch at the top of the page to see the most recent monthly data.

Group 71 (3)

As a bonus, the orange link in the design above ("Reporting Frequency switch") should scroll the user back to the page position where the data reporting frequency link can be found.

nasaownsky commented 3 years ago

@hobuobi How should I know if the data is artificially restricted?

colincadams commented 3 years ago

For that additional tooltip humphrey described, I think the easiest way to implement it would be to compare the data for that state and metric in the monthly and annual files. If there is newer data in the monthly file, then add that note to the annual block.

Do you think that will work? Otherwise we can do it in the backend when producing the files, but didn't want to clutter them any more if we didn't need to.

nasaownsky commented 3 years ago

@colincadams ok, I think that'll work & try to make that work tomorrow. For now please check the latest changes and see if there's new potential problems to fix. Thanks!

nasaownsky commented 3 years ago

@colincadams You can check new tooltip on California dashboard!

nasaownsky commented 3 years ago

@colincadams Described case can happen vice versa. So I've made solution that suites for annual and monthly data, but we need more general text for tooltip since the function doesn't know what data we are viewing. I suggest something like:

Data is not available in a public report from [STATE] in this data aggregation range; however, data is available in another range. Use the Reporting Frequency switch at the top of the page to see the most recent available data.

hobuobi commented 3 years ago

I think the preference would be to have a separate error message for monthly vs annualized data! If that is possible, I would agree with Colin's solution for the case where data is available in the annual view.

Monthly data is not available in a public report from [STATE]; however, annual data is available (as of [DATE YEAR of most recent data for the metric]). Use the Reporting Frequency switch at the top of the page to see the annual data.

If we have to do something that works for both cases, I would do something like:

Data is not available in a public report from [STATE] at this reporting frequency; however, more data is reported [MONTHLY / ANNUALLY (depending on which tab you're on)]. Use the Reporting Frequency switch at the top of the page to see the most recent available data.

nasaownsky commented 3 years ago

@colincadams @hobuobi I've added desired solution for that case. Depending on available data there will be one of two options to display: Снимок экрана 2021-04-20 в 16 07 07 Снимок экрана 2021-04-20 в 16 08 19

Please check & confirm.

nasaownsky commented 3 years ago

@colincadams Latest commit should fix slider, but more test only can be performed when we decide to merge main with v2-jails.

nasaownsky commented 3 years ago

@colincadams Let's cover that case in new Issue. @jessex I think we're ready to merge this pr.

jessex commented 3 years ago

@nasaownsky just need you to address the merge conflict that popped up from merging the latest PR and then I will merge. Thanks!

nasaownsky commented 3 years ago

@jessex You're good to go!