Skip to content

Commit

Permalink
Copy revisions after PA review (#466)
Browse files Browse the repository at this point in the history
  • Loading branch information
macfarlandian committed Jul 29, 2021
1 parent e4bc1b9 commit 2f9ac1d
Show file tree
Hide file tree
Showing 15 changed files with 232 additions and 116 deletions.
2 changes: 1 addition & 1 deletion spotlight-client/package.json
@@ -1,7 +1,7 @@
{
"name": "spotlight-client",
"description": "A public-facing dashboard to help educate citizens and build accountability",
"version": "2.2.1",
"version": "2.2.2",
"private": true,
"repository": "git@github.com:Recidiviz/public-dashboard.git",
"author": "Recidiviz <team@recidiviz.org>",
Expand Down
2 changes: 1 addition & 1 deletion spotlight-client/src/DataStore/TenantStore.test.ts
Expand Up @@ -193,6 +193,6 @@ test("section number is validated against current narrative", () => {
});

reactImmediately(() => {
expect(tenantStore.currentSectionNumber).toBe(7);
expect(tenantStore.currentSectionNumber).toBe(6);
});
});
2 changes: 1 addition & 1 deletion spotlight-client/src/PageTenant/PageTenant.tsx
Expand Up @@ -66,7 +66,7 @@ const PageTenant: React.FC<RouteComponentProps> = () => {
// tenant may be briefly undefined during initial page load
<article>
<Introduction>
<Title>Explore correctional data from {tenant.name}.</Title>
<Title>{tenant.landingPageTitle}</Title>
<Description>{HTMLReactParser(tenant.description)}</Description>
</Introduction>
<Links>
Expand Down
Expand Up @@ -19,9 +19,11 @@ import { TenantContent } from "../../contentApi/types";

const content: TenantContent = {
name: "Test Tenant",
landingPageTitle: "test landing page title",
description: "test tenant description",
coBrandingCopy: "test tenant co-branding",
feedbackUrl: "https://example.com/feedback",
smallDataDisclaimer: "test small data disclaimer",
metrics: {
SentencePopulationCurrent: {
name: "test SentencePopulationCurrent name",
Expand Down
23 changes: 19 additions & 4 deletions spotlight-client/src/VizNotes/VizNotes.test.tsx
Expand Up @@ -15,12 +15,27 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// =============================================================================

import { render, screen } from "@testing-library/react";
import { screen } from "@testing-library/react";
import { runInAction } from "mobx";
import React from "react";
import DataStore from "../DataStore";
import { renderWithStore } from "../testUtils";
import VizNotes from "./VizNotes";

beforeEach(() => {
runInAction(() => {
DataStore.tenantStore.currentTenantId = "US_ND";
});
});

afterEach(() => {
runInAction(() => {
DataStore.tenantStore.currentTenantId = undefined;
});
});

test("all notes", () => {
render(
renderWithStore(
<VizNotes
smallData
unknowns={{ gender: 1, ageBucket: 0, raceOrEthnicity: 0 }}
Expand All @@ -35,15 +50,15 @@ test("all notes", () => {
});

test("small data only", () => {
render(<VizNotes smallData />);
renderWithStore(<VizNotes smallData />);

expect(screen.getByRole("listitem")).toHaveTextContent(
"counts are especially low"
);
});

test("unknowns only", () => {
render(
renderWithStore(
<VizNotes unknowns={{ gender: 1, ageBucket: 0, raceOrEthnicity: 0 }} />
);

Expand Down
14 changes: 5 additions & 9 deletions spotlight-client/src/VizNotes/VizNotes.tsx
Expand Up @@ -15,9 +15,11 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// =============================================================================

import { observer } from "mobx-react-lite";
import React from "react";
import { Unknowns } from "../contentModels/types";
import Notes from "../Notes";
import { useDataStore } from "../StoreProvider";
import { UnknownsNote } from "./UnknownsNote";

type VizNotesProps = {
Expand All @@ -26,19 +28,13 @@ type VizNotesProps = {
};

const VizNotes: React.FC<VizNotesProps> = ({ smallData, unknowns }) => {
const { tenant } = useDataStore();
return (
<Notes>
{smallData && (
<>
Please always take note of the number of people associated with each
proportion presented here; in cases where the counts are especially
low, the proportion may not be statistically significant and therefore
not indicative of long-term trends.
</>
)}
{smallData && <>{tenant?.smallDataDisclaimer}</>}
{unknowns && <UnknownsNote unknowns={unknowns} />}
</Notes>
);
};

export default VizNotes;
export default observer(VizNotes);
Expand Up @@ -62,7 +62,7 @@ const getTooltipProps: TooltipContentFunction = (columnData) => {
} else {
records.push({
pct,
value: `${value} of ${formatAsNumber(denominator)}`,
value: `${formatAsNumber(value)} of ${formatAsNumber(denominator)}`,
});
}

Expand Down Expand Up @@ -137,7 +137,7 @@ const VizRecidivismRateSingleFollowup: React.FC<VizRecidivismRateSingleFollowupP
item.singleFollowupDemographics && (
<BarChartTrellis
angledLabels={useAngledLabels}
barAxisLabel="Release Cohort"
barAxisLabel="Release Year"
data={item.singleFollowupDemographics}
getTooltipProps={getTooltipProps}
/>
Expand Down
8 changes: 6 additions & 2 deletions spotlight-client/src/charts/RateCohorts.tsx
Expand Up @@ -21,7 +21,7 @@ import styled from "styled-components/macro";
import MeasureWidth from "../MeasureWidth";
import { isRateFields, RateFields } from "../metricsApi";
import { animation, colors } from "../UiLibrary";
import { formatAsPct } from "../utils";
import { formatAsNumber, formatAsPct } from "../utils";
import ChartWrapper from "./ChartWrapper";
import ResponsiveTooltipController from "./ResponsiveTooltipController";
import { highlightFade, useHighlightedItem } from "./utils";
Expand Down Expand Up @@ -95,7 +95,11 @@ export default function RateCohorts({
title: originalDataPoint.label,
records: [
{
value: `${originalDataPoint.rateNumerator} of ${originalDataPoint.rateDenominator}`,
value: `${formatAsNumber(
originalDataPoint.rateNumerator
)} of ${formatAsNumber(
originalDataPoint.rateDenominator
)}`,
pct: originalDataPoint.rate,
},
],
Expand Down
6 changes: 6 additions & 0 deletions spotlight-client/src/contentApi/sources/us_nd.ts
Expand Up @@ -82,6 +82,7 @@ in a North Dakota court may occasionally complete their supervision in a differe

const content: TenantContent = {
name: "North Dakota",
landingPageTitle: "Explore correctional data from North Dakota.",
description:
'<a href="https://www.docr.nd.gov">The North Dakota Department of Corrections and Rehabilitation (DOCR)</a> provides correctional services for the state of North Dakota. Our mission is to transform lives, influence change, and strengthen community. Transparency is a critical element of our mission; sharing information builds greater accountability between the DOCR and the communities we serve.',
coBrandingCopy:
Expand All @@ -97,6 +98,10 @@ const content: TenantContent = {
"OTHER",
],
},
smallDataDisclaimer: `Please always take note of the number of people associated with each
proportion presented here; in cases where the counts are especially
low, the proportion may not be statistically significant and therefore
not indicative of long-term trends.`,
metrics: {
SentencePopulationCurrent: {
name: "Sentenced Population",
Expand Down Expand Up @@ -529,6 +534,7 @@ const content: TenantContent = {
programmingParticipants: "Free Through Recovery active participants",
supervisionPopulation: "All people under supervision",
totalPopulationSentences: "All people sentenced and under DOCR control",
revocationProportions: "Proportions of revocation reasons",
},
introduction: `<p>In North Dakota, people of color are overrepresented in prison,
on probation, and on parole.</p>
Expand Down

0 comments on commit 2f9ac1d

Please sign in to comment.