swsd_ticket_stats
Summarizes tickets created or updated in a date range, defaulting to the last seven days, and returns totals plus assignee, category, SLA, and resolution breakdowns.
Instructions
Summarize scanned tickets created OR last updated in [from, to), defaulting to the last seven days. Alternates created and updated incident-list queries, deduplicates IDs, and shares max_pages across both scans. Totals and breakdowns cover only scanned matching rows, not the tenant backlog or a historical state snapshot. Open excludes Resolved/Closed; unassigned means no individual assignee. Breached uses computeSlaRisk on open tickets at scan time, using due_at and any returned sla_violations (list rows may omit violations). Resolution counts and median elapsed hours use valid resolved_at timestamps in the window only; rows without resolved_at are excluded, never approximated with updated_at. The list API may omit resolved_at, so resolution metrics may be incomplete. An older ticket resolved during the window but last updated afterward can also be absent from these date-filtered scans. Median is null if no valid nonnegative created_at-to-resolved_at durations exist. Assignee/category breakdowns return the top ten.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | No | Exclusive window end. Date-only values mean UTC midnight. Defaults to now. | |
| from | No | Inclusive window start. Date-only values mean UTC midnight. Defaults to seven days before to. | |
| per_page | No | Results per page (1-100), matching swsd_sla_risk. | |
| max_pages | No | Total page budget shared by the created and updated scans (1-10). | |
| assigned_to_group | No | Server-side assignment group ID. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scan | Yes | ||
| totals | Yes | ||
| window | Yes | ||
| by_state | Yes | ||
| by_assignee | Yes | ||
| by_category | Yes | ||
| by_priority | Yes | ||
| median_resolution_hours | Yes |