-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[US_MI][Workflows] Change completion event to be the review date for …
…all scc opps (Recidiviz/recidiviz-data#29444) ## Description of the change Instead of transfer out of solitary, which all scc opps contribute to, change the completion even to be the review itself. This isn't a strictly 1-1 relationship but nested. - ALL observed SCC events (Scc, scc-warden, scc-add) should satisfy the general scc opportunity and will do so with our current logic. For example, if we observe a scc-add case note, we will use that to infer an SCC review has happened, and that the ADD was there. Therefore, the completion event for the general scc opp should include all three case note types. - For the warden and add opps, ONLY the scc-warden or scc-add case note will satisfy that opp, and the completion event will just be that case note type. - All that means, if we observe the following # of opportunities granted for each of the opps: 50 scc, 10 scc-warden, 5 scc-add. It does not mean that 65 reviews happened, but that 50 happened, with 10 of those including a warden, and 5 of those including an add. ## Type of change > All pull requests must have at least one of the following labels applied (otherwise the PR will fail): | Label | Description | |----------------------------- |----------------------------------------------------------------------------------------------------------- | | Type: Bug | non-breaking change that fixes an issue | | Type: Feature | non-breaking change that adds functionality | | Type: Breaking Change | fix or feature that would cause existing functionality to not work as expected | | Type: Non-breaking refactor | change addresses some tech debt item or prepares for a later change, but does not change functionality | | Type: Configuration Change | adjusts configuration to achieve some end related to functionality, development, performance, or security | | Type: Dependency Upgrade | upgrades a project dependency - these changes are not included in release notes | ## Related issues Closes Recidiviz/recidiviz-data#29440 ## Checklists ### Development **This box MUST be checked by the submitter prior to merging**: - [x] **Double- and triple-checked that there is no Personally Identifiable Information (PII) being mistakenly added in this pull request** These boxes should be checked by the submitter prior to merging: - [ ] Tests have been written to cover the code changed/added as part of this pull request ### 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 - [ ] Potential security implications or infrastructural changes have been considered, if relevant GitOrigin-RevId: 08e5c8003f39541321a61cc8ddd60ad922411c17
- Loading branch information
1 parent
ff7f0fe
commit cadad61
Showing
6 changed files
with
164 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...ion_events/state_specific/us_mi/add_in_person_security_classification_committee_review.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Recidiviz - a data platform for criminal justice reform | ||
# Copyright (C) 2023 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/>. | ||
# ============================================================================= | ||
"""Defines a view that shows all security committee classification review dates where the ADD was in person | ||
for residents in Michigan. | ||
""" | ||
from recidiviz.calculator.query.state.dataset_config import ANALYST_VIEWS_DATASET | ||
from recidiviz.common.constants.states import StateCode | ||
from recidiviz.task_eligibility.task_completion_event_big_query_view_builder import ( | ||
StateSpecificTaskCompletionEventBigQueryViewBuilder, | ||
TaskCompletionEventType, | ||
) | ||
from recidiviz.utils.environment import GCP_PROJECT_STAGING | ||
from recidiviz.utils.metadata import local_project_id_override | ||
|
||
_DESCRIPTION = """Defines a view that shows all security committee classification review dates where the ADD was in person | ||
for residents in Michigan. | ||
""" | ||
|
||
_QUERY_TEMPLATE = """ | ||
SELECT | ||
state_code, | ||
person_id, | ||
completion_event_date, | ||
FROM `{project_id}.{analyst_views_dataset}.us_mi_add_in_person_security_classification_committee_review_materialized` | ||
""" | ||
|
||
VIEW_BUILDER: StateSpecificTaskCompletionEventBigQueryViewBuilder = StateSpecificTaskCompletionEventBigQueryViewBuilder( | ||
state_code=StateCode.US_MI, | ||
completion_event_type=TaskCompletionEventType.ADD_IN_PERSON_SECURITY_CLASSIFICATION_COMMITTEE_REVIEW, | ||
description=_DESCRIPTION, | ||
completion_event_query_template=_QUERY_TEMPLATE, | ||
analyst_views_dataset=ANALYST_VIEWS_DATASET, | ||
) | ||
|
||
if __name__ == "__main__": | ||
with local_project_id_override(GCP_PROJECT_STAGING): | ||
VIEW_BUILDER.build_and_print() |
49 changes: 49 additions & 0 deletions
49
...bility/completion_events/state_specific/us_mi/security_classification_committee_review.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Recidiviz - a data platform for criminal justice reform | ||
# Copyright (C) 2023 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/>. | ||
# ============================================================================= | ||
"""Defines a view that shows all security committee classification review dates for residents in Michigan. | ||
""" | ||
from recidiviz.calculator.query.state.dataset_config import ANALYST_VIEWS_DATASET | ||
from recidiviz.common.constants.states import StateCode | ||
from recidiviz.task_eligibility.task_completion_event_big_query_view_builder import ( | ||
StateSpecificTaskCompletionEventBigQueryViewBuilder, | ||
TaskCompletionEventType, | ||
) | ||
from recidiviz.utils.environment import GCP_PROJECT_STAGING | ||
from recidiviz.utils.metadata import local_project_id_override | ||
|
||
_DESCRIPTION = """Defines a view that shows all security committee classification review dates for residents in Michigan. | ||
""" | ||
|
||
_QUERY_TEMPLATE = """ | ||
SELECT | ||
state_code, | ||
person_id, | ||
completion_event_date, | ||
FROM `{project_id}.{analyst_views_dataset}.us_mi_security_classification_committee_review_materialized` | ||
""" | ||
|
||
VIEW_BUILDER: StateSpecificTaskCompletionEventBigQueryViewBuilder = StateSpecificTaskCompletionEventBigQueryViewBuilder( | ||
state_code=StateCode.US_MI, | ||
completion_event_type=TaskCompletionEventType.SECURITY_CLASSIFICATION_COMMITTEE_REVIEW, | ||
description=_DESCRIPTION, | ||
completion_event_query_template=_QUERY_TEMPLATE, | ||
analyst_views_dataset=ANALYST_VIEWS_DATASET, | ||
) | ||
|
||
if __name__ == "__main__": | ||
with local_project_id_override(GCP_PROJECT_STAGING): | ||
VIEW_BUILDER.build_and_print() |
51 changes: 51 additions & 0 deletions
51
..._events/state_specific/us_mi/warden_in_person_security_classification_committee_review.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Recidiviz - a data platform for criminal justice reform | ||
# Copyright (C) 2023 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/>. | ||
# ============================================================================= | ||
"""Defines a view that shows all security committee classification review dates where the warden was in person for | ||
residents in Michigan. | ||
""" | ||
from recidiviz.calculator.query.state.dataset_config import ANALYST_VIEWS_DATASET | ||
from recidiviz.common.constants.states import StateCode | ||
from recidiviz.task_eligibility.task_completion_event_big_query_view_builder import ( | ||
StateSpecificTaskCompletionEventBigQueryViewBuilder, | ||
TaskCompletionEventType, | ||
) | ||
from recidiviz.utils.environment import GCP_PROJECT_STAGING | ||
from recidiviz.utils.metadata import local_project_id_override | ||
|
||
_DESCRIPTION = """Defines a view that shows all security committee classification review dates where the warden was | ||
in person, for residents in Michigan. | ||
""" | ||
|
||
_QUERY_TEMPLATE = """ | ||
SELECT | ||
state_code, | ||
person_id, | ||
completion_event_date, | ||
FROM `{project_id}.{analyst_views_dataset}.us_mi_warden_in_person_security_classification_committee_review_materialized` | ||
""" | ||
|
||
VIEW_BUILDER: StateSpecificTaskCompletionEventBigQueryViewBuilder = StateSpecificTaskCompletionEventBigQueryViewBuilder( | ||
state_code=StateCode.US_MI, | ||
completion_event_type=TaskCompletionEventType.WARDEN_IN_PERSON_SECURITY_CLASSIFICATION_COMMITTEE_REVIEW, | ||
description=_DESCRIPTION, | ||
completion_event_query_template=_QUERY_TEMPLATE, | ||
analyst_views_dataset=ANALYST_VIEWS_DATASET, | ||
) | ||
|
||
if __name__ == "__main__": | ||
with local_project_id_override(GCP_PROJECT_STAGING): | ||
VIEW_BUILDER.build_and_print() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters