Skip to content
This repository was archived by the owner on Sep 3, 2025. It is now read-only.
Merged
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
5 changes: 4 additions & 1 deletion src/dispatch/incident/metrics.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import json
import logging
import math
from calendar import monthrange
Expand Down Expand Up @@ -31,12 +32,14 @@ def create_incident_metric_query(
db_session,
end_date: date,
start_date: date = None,
filter_spec: List[dict] = None,
filter_spec: List[dict] | str | None = None,
):
"""Fetches eligible incidents."""
query = db_session.query(Incident)

if filter_spec:
if isinstance(filter_spec, str):
filter_spec = json.loads(filter_spec)
query = apply_filter_specific_joins(Incident, filter_spec, query)
query = apply_filters(query, filter_spec)

Expand Down
Loading