Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data model for racial disparities narrative #351

Merged
merged 5 commits into from
Mar 11, 2021

Conversation

macfarlandian
Copy link
Collaborator

@macfarlandian macfarlandian commented Mar 5, 2021

Description of the change

Reimplements the racial disparities data fetching and calculations in a new Mobx data model, and adds a few new ones.

There's a lot here, and it's a bit tedious, but nothing tricky and very little that is really new — just reorganized. Each text section and chart now has a corresponding method on the model that produces its data (with respect to any relevant filters), rather than there being one monolithic function that computes everything. Future states are not guaranteed to have all these sections and metrics, so this should help make this page more flexible in addition to hopefully being easier to read.

I verified the data snapshots by comparing them to the dynamic text and charts on v1 in demo mode. The new chart data is made up of the same data that goes into the text metrics, so I verified them against the text as well. (There were a few unrealistic values in the data fixture that made this confusing so I updated them -- namely, the total sentenced count did not add up to the sum of its parts, which was an artifact of earlier calc behavior that has since changed).

FWIW the commit history on this branch is pretty clean and can be reviewed sequentially, to demarcate the ported stuff from the new stuff if that helps make sense of this.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Configuration change (adjusts configuration to achieve some end related to functionality, development, performance, or security)

Related issues

Closes #318

Checklists

Development

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

  • Manual testing against realistic data has been performed locally

Code review

These boxes should be checked by reviewers prior to merging:

  • This pull request has a descriptive title and information useful to a reviewer
  • This pull request has been moved out of a Draft state, has no "Work In Progress" label, and has assigned reviewers
  • Potential security implications or infrastructural changes have been considered, if relevant

@macfarlandian macfarlandian changed the title Ian/318 disparities model Data model for racial disparities narrative Mar 5, 2021
@coveralls
Copy link

coveralls commented Mar 5, 2021

Pull Request Test Coverage Report for Build 623013360

  • 159 of 159 (100.0%) changed or added relevant lines in 5 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+1.2%) to 72.271%

Totals Coverage Status
Change from base Build 618982258: 1.2%
Covered Lines: 2555
Relevant Lines: 3419

💛 - Coveralls

export default class RacialDisparitiesNarrative {
// metadata
readonly title = "Racial Disparities";

// TODO: customize text?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you want to resolve this TODO in this PR?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that comment was a straggler, it's resolved now

Comment on lines +167 to +170
const fetchedData = await fetchAndTransformMetric({
sourceFileName: "racial_disparities",
tenantId: this.tenantId,
transformFn: createRacialDisparitiesRecords,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a really nice pattern. Now, having seen the limitations of our DataStores, I appreciate more this approach.

@macfarlandian macfarlandian merged commit 50a0642 into master Mar 11, 2021
@macfarlandian macfarlandian deleted the ian/318-disparities-model branch March 11, 2021 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Data model for racial disparities narrative
3 participants