Skip to content

Commit

Permalink
Cumulative recidivism rate chart (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
macfarlandian committed Oct 21, 2020
1 parent b78f80f commit 687d41d
Show file tree
Hide file tree
Showing 12 changed files with 675 additions and 130 deletions.
26 changes: 26 additions & 0 deletions public-dashboard-client/src/chart-wrapper/ChartWrapper.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
// Recidiviz - a data platform for criminal justice reform
// Copyright (C) 2020 Recidiviz, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// =============================================================================

import styled from "styled-components";

const ChartWrapper = styled.div`
Expand All @@ -13,6 +30,11 @@ const ChartWrapper = styled.div`
font-size: 12px;
}
.axis-title {
fill: ${(props) => props.theme.colors.chartAxis};
font-size: 13px;
}
.background-graphics,
.visualization-layer {
shape-rendering: crispEdges;
Expand All @@ -23,6 +45,10 @@ const ChartWrapper = styled.div`
font-size: 16px;
}
.tick-line {
stroke: ${(props) => props.theme.colors.chartGridLine};
}
.xyframe-matte {
fill: ${(props) => props.theme.colors.background};
}
Expand Down
18 changes: 18 additions & 0 deletions public-dashboard-client/src/constants.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
// Recidiviz - a data platform for criminal justice reform
// Copyright (C) 2020 Recidiviz, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// =============================================================================

export const DEFAULT_TENANT = "us_nd";

export const TENANTS = {
Expand All @@ -21,6 +38,7 @@ export const SECTION_TITLES = {
[PATHS.sentencing]: {
population: "Who is being sentenced?",
types: "What types of sentences do people receive?",
recidivism: "How many people end up back in prison?",
},
[PATHS.prison]: {
population: "Who is in custody?",
Expand Down
34 changes: 34 additions & 0 deletions public-dashboard-client/src/page-sentencing/PageSentencing.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
// Recidiviz - a data platform for criminal justice reform
// Copyright (C) 2020 Recidiviz, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// =============================================================================

import React from "react";
import DetailPage from "../detail-page";
import useChartData from "../hooks/useChartData";
import Loading from "../loading";
import VizRecidivismRates from "../viz-recidivism-rates";
import VizSentencePopulation from "../viz-sentence-population";
import VizSentenceTypes from "../viz-sentence-types";
import { PATHS, ALL_PAGES, SECTION_TITLES } from "../constants";
Expand Down Expand Up @@ -63,6 +81,22 @@ export default function PageSentencing() {
locations: apiData.judicial_districts,
},
},
{
title: SECTION_TITLES[PATHS.sentencing].recidivism,
description: (
<>
After release from prison, a significant proportion of formerly
incarcerated folks end up back in prison. This is typically termed
“recidivism.” The below graph shows recidivism as reincarceration;
that is, the proportion of individuals who are incarcerated again at
some point after their release.
</>
),
VizComponent: VizRecidivismRates,
vizData: {
recidivismRates: apiData.recidivism_rates_by_cohort_by_year,
},
},
];

return (
Expand Down
24 changes: 24 additions & 0 deletions public-dashboard-client/src/theme/theme.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
// Recidiviz - a data platform for criminal justice reform
// Copyright (C) 2020 Recidiviz, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// =============================================================================

import deepMerge from "deepmerge";
import { rgb } from "d3-color";
import {
Expand Down Expand Up @@ -47,6 +64,11 @@ const dataVizColorMap = new Map([
["blue", "#4C6290"],
["paleBlue", "#90AEB5"],
["pink", "#CC989C"],
["paleGreen", "#B6CC98"],
["purple", "#56256F"],
["aqua", "#4FBABA"],
["palePurple", "#904C84"],
["skyBlue", "#5F8FD9"],
]);

const dataVizColors = Array.from(dataVizColorMap.values());
Expand Down Expand Up @@ -77,9 +99,11 @@ export const defaultTheme = {
bodyLight: white,
chartAxis: charcoal,
chartErrorBackground: buttonBackground,
chartGridLine: "#E0DFDE",
controlBackground: buttonBackground,
controlLabel: charcoal,
controlValue: black,
dataViz: dataVizColors,
footer: white,
footerBackground: darkerGreen,
divider: "#CECAC7",
Expand Down
Loading

0 comments on commit 687d41d

Please sign in to comment.