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

[Publisher] Agency Settings - Add new agency-wide Courts + Supervision Subpopulation TIG elements #1541

Merged
merged 5 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,272 @@
// Recidiviz - a data platform for criminal justice reform
// Copyright (C) 2024 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 { AgencySystems } from "@justice-counts/common/types";

import { AgencyIncludesExcludesType, IncludesExcludesEnum } from "./types";

/**
* Agency-wide Includes/Excludes definitions for Court and Supervision Subpopulation sectors
*/

// Helper function to map boolean values to `YES` | `NO` enums
export const boolToYesNoEnum = (bool: boolean): IncludesExcludesEnum =>
bool ? IncludesExcludesEnum.YES : IncludesExcludesEnum.NO;

export const AgencyIncludesExcludes: AgencyIncludesExcludesType = {
[AgencySystems.COURTS_AND_PRETRIAL]: {
SPECIAL_OR_LIMITED_JURISDICTION: {
label: "Courts of special or limited jurisdiction (e.g., traffic court)",
default: IncludesExcludesEnum.YES,
},
GENERAL_JURISDICTION: {
label: "Courts of general jurisdiction",
default: IncludesExcludesEnum.YES,
},
PROBLEM_SOLVING: {
label: "Problem-solving courts (e.g., drug court, veterans court)",
default: IncludesExcludesEnum.YES,
},
APPEALS: {
label: "Courts of appeal",
default: IncludesExcludesEnum.YES,
},
CIVIL: {
label: "Civil courts",
default: IncludesExcludesEnum.NO,
},
FAMILY: {
label: "Family courts",
default: IncludesExcludesEnum.NO,
},
JUVENILE: {
label: "Juvenile courts",
default: IncludesExcludesEnum.NO,
},
},
[AgencySystems.PROBATION]: {
PROBATION_IN_LIEU_INCARCERATION: {
label:
"People sentenced to a period of probation in lieu of incarceration (including to electronic monitoring, home confinement, traditional supervision, etc.)",
default: IncludesExcludesEnum.YES,
},
PROBATION_AFTER_INCARCERATION: {
label:
"People sentenced to a period of probation after a period of incarceration (including to electronic monitoring, home confinement, traditional supervision, etc.)",
default: IncludesExcludesEnum.YES,
},
PROBATION_POST_ADJUCATION_PROGRAM: {
label:
"People on probation as part of a post-adjudication specialty or problem-solving court program (e.g., drug court)",
default: IncludesExcludesEnum.YES,
},
PROBATION_TEMPORARILY_CONFINED: {
label:
"People sentenced to probation who are temporarily confined in jail, prison, or another confinement center for a short “dip” sanction (typically less than 30 days)",
default: IncludesExcludesEnum.YES,
},
PROBATION_CONFINED_ANY_LENGTH: {
label:
"People sentenced to probation confined for any length of time in a violation center or halfway back facility operated by the supervision agency",
default: IncludesExcludesEnum.YES,
},
PROBATION_HOLD_PENDING: {
label:
"People sentenced to probation who are in jail or prison on a hold pending resolution of a violation or revocation",
default: IncludesExcludesEnum.YES,
},
PROBATION_LONGER_SANCTION: {
label:
"People sentenced to probation who are confined in jail or prison for a longer sanction (e.g., more than 30 days, 120 days, 6 months, etc.)",
default: IncludesExcludesEnum.YES,
},
PROBATION_COMPACT_AGREEMENT: {
label:
"People sentenced to probation in another jurisdiction who are supervised by the agency through interstate compact, intercounty compact, or other mutual supervision agreement",
default: IncludesExcludesEnum.YES,
},
PROBATION_ANOTHER_JURISTICTION: {
label:
"People sentenced to probation who are being supervised by another jurisdiction",
default: IncludesExcludesEnum.NO,
},
PROBATION_IN_COMMUNITY: {
label:
"People who have not been sentenced but are supervised on probation in the community prior to the resolution of their case",
default: IncludesExcludesEnum.NO,
},
PROBATION_ANOTHER_FORM_SUPERVISION: {
label:
"People sentenced to probation who are also on another form of supervision",
default: IncludesExcludesEnum.NO,
},
PROBATION_PRE_ADJUCTATION_PROGRAM: {
label:
"People on probation as part of a pre-adjudication specialty or problem-solving court program (e.g., drug court)",
default: IncludesExcludesEnum.NO,
},
},
[AgencySystems.PAROLE]: {
PAROLE_EARLY_RELEASE: {
label:
"People approved by a parole board or similar entity for early conditional release from incarceration to parole supervision (including to electronic monitoring, home confinement, traditional supervision, etc.)",
default: IncludesExcludesEnum.YES,
},
PAROLE_STATUTORY_REQUIREMENT: {
label:
"People conditionally released from incarceration to parole supervision by statutory requirement (including to electronic monitoring, home confinement, traditional supervision, etc.)",
default: IncludesExcludesEnum.YES,
},
PAROLE_TEMPORARILY_CONFINED: {
label:
"People on parole who are temporarily confined in jail, prison, or another confinement center for a short “dip” sanction (typically less than 30 days)",
default: IncludesExcludesEnum.YES,
},
PAROLE_CONFINED_ANY_LENGTH: {
label:
"People on parole confined for any length of time in a violation center or halfway back facility operated by the supervision agency",
default: IncludesExcludesEnum.YES,
},
PAROLE_HOLD_PENDING: {
label:
"People on parole who are in jail or prison on a hold pending resolution of a violation or revocation",
default: IncludesExcludesEnum.YES,
},
PAROLE_LONGER_SANCTION: {
label:
"People on parole who are confined in jail or prison for a longer sanction (e.g., more than 30 days, 120 days, 6 months, etc.)",
default: IncludesExcludesEnum.YES,
},
PAROLE_COMPACT_AGREEMENT: {
label:
"People released to parole in another jurisdiction who are supervised by the agency through interstate compact, intercounty compact, or other mutual supervision agreement",
default: IncludesExcludesEnum.YES,
},
PAROLE_ANOTHER_FORM_SUPERVISION: {
label: "People on parole who are also on another form of supervision",
default: IncludesExcludesEnum.NO,
},
PAROLE_ANOTHER_JURISTICTION: {
label:
"People on parole who are being supervised by another jurisdiction",
default: IncludesExcludesEnum.NO,
},
},
[AgencySystems.PRETRIAL_SUPERVISION]: {
PRETRIAL_CITATION_RELEASE: {
label: "People on citation release (i.e., were never booked)",
default: IncludesExcludesEnum.YES,
},
PRETRIAL_CONDITION_SUPERVISION: {
label:
"People released from jail or otherwise not held pretrial on the condition of supervision (including electronic monitoring, home confinement, traditional supervision, etc.)",
default: IncludesExcludesEnum.YES,
},
PRETRIAL_STATUTORY_REQUIREMENT: {
label:
"People released from jail or otherwise not held pretrial due to statutory requirement",
default: IncludesExcludesEnum.YES,
},
PRETRIAL_COURT_PROGRAM: {
label:
"People supervised as part of a pre-adjudication specialty or problem-solving court program (e.g., drug court)",
default: IncludesExcludesEnum.YES,
},
PRETRIAL_HOLD_PENDING: {
label:
"People on pretrial supervision who are incarcerated on a hold pending resolution of a violation or revocation",
default: IncludesExcludesEnum.YES,
},
PRETRIAL_ANOTHER_FORM_SUPERVISION: {
label:
"People on pretrial supervision who are also on another form of supervision",
default: IncludesExcludesEnum.NO,
},
},
[AgencySystems.OTHER_SUPERVISION]: {
OTHER_IN_LIEU_INCARCERATION: {
label:
"People sentenced to a period of other community supervision in lieu of incarceration (including to electronic monitoring, home confinement, traditional supervision, etc.)",
default: IncludesExcludesEnum.YES,
},
OTHER_DETERMINATE_PERIOD: {
label:
"People sentenced to a determinate period of other community supervision after a period of incarceration (including to electronic monitoring, home confinement, traditional supervision, etc.)",
default: IncludesExcludesEnum.YES,
},
OTHER_POST_ADJUCATION_PROGRAM: {
label:
"People on other community supervision as part of a post-adjudication specialty or problem-solving court program (e.g., drug court)",
default: IncludesExcludesEnum.YES,
},
OTHER_EARLY_RELEASE: {
label:
"People approved by a parole board or similar entity for early conditional release from incarceration to other community supervision (including to electronic monitoring, home confinement, traditional supervision, etc.)",
default: IncludesExcludesEnum.YES,
},
OTHER_STATUTORY_REQUIREMENT: {
label:
"People conditionally released from incarceration to other community supervision by statutory requirement (including to electronic monitoring, home confinement, traditional supervision, etc.)",
default: IncludesExcludesEnum.YES,
},
OTHER_TEMPORARILY_CONFINED: {
label:
"People on other community supervision who are temporarily confined in jail, prison, or another confinement center for a short “dip” sanction (typically less than 30 days)",
default: IncludesExcludesEnum.YES,
},
OTHER_CONFINED_ANY_LENGTH: {
label:
"People on other community supervision confined for any length of time in a violation center or halfway back facility operated by the supervision agency",
default: IncludesExcludesEnum.YES,
},
OTHER_JAIL_OR_PRISON_HOLD_PENDING: {
label:
"People on other community supervision who are in jail or prison on a hold pending resolution of a violation or revocation",
default: IncludesExcludesEnum.YES,
},
OTHER_LONGER_SANTION: {
label:
"People on other community supervision who are confined in jail or prison for a longer sanction (e.g., more than 30 days, 120 days, 6 months, etc.)",
default: IncludesExcludesEnum.YES,
},
OTHER_INCARCERATED_HOLD_PENDING: {
label:
"People on other community supervision who are incarcerated on a hold pending resolution of a violation or revocation",
default: IncludesExcludesEnum.YES,
},
OTHER_COMPACT_AGREEMENT: {
label:
"People on supervision in another jurisdiction who are supervised by the agency through interstate compact, intercounty compact, or other mutual supervision agreement",
default: IncludesExcludesEnum.YES,
},
OTHER_ANOTHER_FORM_SUPERVISION: {
label:
"People on other community supervision who are also on another form of supervision",
default: IncludesExcludesEnum.YES,
},
OTHER_PRIOR_TO_RESOLUTION: {
label:
"People on other community supervision who have not been sentenced but are supervised in the community prior to the resolution of their case",
default: IncludesExcludesEnum.NO,
},
OTHER_COURT_PROGRAM: {
label:
"People on other community supervision in a pre-adjudication specialty or problem-solving court program (e.g., drug court, etc.)",
default: IncludesExcludesEnum.NO,
},
},
};
41 changes: 41 additions & 0 deletions publisher/src/components/AgencySettings/IncludesExcludes/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Recidiviz - a data platform for criminal justice reform
// Copyright (C) 2024 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 { AgencySystems } from "@justice-counts/common/types";

export enum IncludesExcludesEnum {
YES = "YES",
NO = "NO",
}

export type IncludesExcludesWithDefault = {
[key: string]: {
label: string;
default: IncludesExcludesEnum;
};
};

type AgencySystemKeys =
| AgencySystems.COURTS_AND_PRETRIAL
| AgencySystems.PAROLE
| AgencySystems.PROBATION
| AgencySystems.PRETRIAL_SUPERVISION
| AgencySystems.OTHER_SUPERVISION;

export type AgencyIncludesExcludesType = {
[key in AgencySystemKeys]: IncludesExcludesWithDefault;
};
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import {
} from "@justice-counts/common/components/GlobalStyles";
import styled from "styled-components/macro";

import { AccountSettingsTitle } from "../AgencySettings/AccountSettings.styles";
import { LabelRow, Row, Table } from "../Reports";
import { AccountSettingsTitle } from "../Settings/AccountSettings.styles";

const STICKY_RESPONSIVE_UPLOADED_FILES_TITLE_HEIGHT = 48;

Expand Down
2 changes: 1 addition & 1 deletion publisher/src/components/DataViz/MetricsDataChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ import { useCurrentPng } from "recharts-to-png";
import { NotFound } from "../../pages/NotFound";
import { useStore } from "../../stores";
import { formatSystemName } from "../../utils";
import { useSettingsSearchParams } from "../AgencySettings";
import { ReactComponent as SwitchToChartIcon } from "../assets/switch-to-chart-icon.svg";
import { ReactComponent as SwitchToDataTableIcon } from "../assets/switch-to-data-table-icon.svg";
import { AppGuideKeys, GuideKeys } from "../HelpCenter/types";
import { createURLToGuide } from "../HelpCenter/utils";
import { Loading } from "../Loading";
import { ChildAgenciesDropdown } from "../MetricsConfiguration/ChildAgenciesDropdown";
import { useSettingsSearchParams } from "../Settings";
import ConnectedDatapointsView from "./ConnectedDatapointsView";
import * as Styled from "./MetricsDataChart.styled";
import { ChartView } from "./types";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {
getActiveSystemMetricKey,
replaceSystemMetricKeyWithNewSystem,
useSettingsSearchParams,
} from "../Settings";
} from "../AgencySettings";
import * as Styled from "./Configuration.styled";
import MetricAvailability from "./MetricAvailability";
import MetricDefinitions from "./MetricDefinitions";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import {
getActiveSystemMetricKey,
replaceSystemMetricKeyWithNewSystem,
useSettingsSearchParams,
} from "../Settings";
} from "../AgencySettings";
import { ConfigurationStatusButton } from "./ConfigurationStatusButton";
import { RACE_ETHNICITY_DISAGGREGATION_KEY } from "./constants";
import DefinitionModalForm from "./DefinitionModalForm";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import {
getActiveSystemMetricKey,
replaceSystemMetricKeyWithNewSystem,
useSettingsSearchParams,
} from "../Settings";
} from "../AgencySettings";
import { ConfigurationStatusText } from "./ConfigurationStatusButton";
import { RACE_ETHNICITY_DISAGGREGATION_KEY } from "./constants";
import DefinitionModalForm from "./DefinitionModalForm";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import React, { useEffect, useState } from "react";
import { useParams } from "react-router-dom";

import { useStore } from "../../stores";
import { useSettingsSearchParams } from "../AgencySettings";
import { Loading } from "../Loading";
import { useSettingsSearchParams } from "../Settings";
import Configuration from "./Configuration";
import { MetricsOverview } from "./MetricsOverview";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ import { useParams } from "react-router-dom";
import { NotFound } from "../../pages/NotFound";
import { useStore } from "../../stores";
import { formatSystemName } from "../../utils";
import {
replaceSystemMetricKeyWithNewSystem,
useSettingsSearchParams,
} from "../AgencySettings";
import { ReactComponent as RightArrowIcon } from "../assets/bold-right-arrow-icon.svg";
import { AppGuideKeys, GuideKeys } from "../HelpCenter/types";
import { createURLToGuide } from "../HelpCenter/utils";
import { DisclaimerBanner } from "../primitives";
import {
replaceSystemMetricKeyWithNewSystem,
useSettingsSearchParams,
} from "../Settings";
import { ChildAgenciesDropdown } from "./ChildAgenciesDropdown";
import * as Styled from "./MetricsOverview.styled";
import { MetricInfo } from "./types";
Expand Down
Loading
Loading