-
Notifications
You must be signed in to change notification settings - Fork 3
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
Conversation
Pull Request Test Coverage Report for Build 623013360
💛 - Coveralls |
export default class RacialDisparitiesNarrative { | ||
// metadata | ||
readonly title = "Racial Disparities"; | ||
|
||
// TODO: customize text? |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
const fetchedData = await fetchAndTransformMetric({ | ||
sourceFileName: "racial_disparities", | ||
tenantId: this.tenantId, | ||
transformFn: createRacialDisparitiesRecords, |
There was a problem hiding this comment.
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.
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
Related issues
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: