Recidiviz / justice-counts

Technical infrastructure for the Justice Counts initiative
GNU General Public License v3.0
2 stars 0 forks source link

[Admin Panel] [Publisher] Add Reporting Agency Feature to Admin Panel #1553

Open nichelle-hall opened 1 week ago

nichelle-hall commented 1 week ago

CSG has requested a feature in the admin panel to assign reporting agencies for metrics. Currently, reporting agencies can be CSG, a vendor (e.g., Karpel), or a superagency that reports data for one or more metrics on behalf of another agency. This data is saved in the MetricSettings table and surfaced via the API for dashboards, but there is no way to input this information without directly editing the database.

To address this, we need to build a frontend feature in the admin panel that allows users to input and manage reporting agencies for each metric. We'll build this into existing agency modal that comes up when a user selects an agency in the Admin Panel. In addition to the other data that the FE sends, now there will be a new key/value pair in the API request that will look like this:

reporting_agencies: [
{
  "metric_key": "LAW_ENFORCEMENT_FUNDING" # Metric is reported by another agency
  "reporting_agency_id": 123,
  "is_self_reported": false
},
{
  "metric_key": "LAW_ENFORCEMENT_STAFF"  # Metric is self-reported by the agency
  "reporting_agency_id": null,
  "is_self_reported":True
},
{
  "metric_key": "LAW_ENFORCEMENT_ARRESTS". # Metric reporting agency has not been configured
  "reporting_agency_id": null,
  "is_self_reported":null
},
...
]

Additionally, the design should incorporate a drop-down menu for selecting the reporting agency for a metric. This dropdown will include a list of options. In this list there will be:

A list of what agencies should be in this dropdown will be returned by the BE when fetching the metadata for the agency.

mxosman commented 3 days ago

@nichelle-hall - can the metrics in the reporting_agencies be broken up by sector? Or even include the sector as a field to each object? That would be super helpful for the FE if it's not a too much of a hassle - as inferring from the keys can be wonky as far as figuring out the best place to split or maintaining a list of sector keys.

Also, the admin/agency/<agency_id> GET endpoint gives us a list of all of the metrics for an agency which is triggered when selecting the "Copy metric settings to child agency" checkbox - and I think we should trigger it when users click on the "Metrics Report Agency" tab within the modal - might be a perfect spot for the list of reporting agencies + metrics w/ assigned reporting agencies.

mxosman commented 3 days ago

Hi @nasaownsky - just flagging this to give you a preview of the next high-priority task as soon as the team has a chance to look at the designs and the BE API is in place. We might be able to get a head start on some of the FE elements, but will let you know once things are ready to go. Will post the Figma designs here once they are ready.