tickets has ticket_id, priority and opened_at (an ISO timestamp string). priority was typed by hand: it can have stray spaces and any capitalisation, be missing, or hold a value that isn't a priority.
Priorities rank critical, high, medium, low, in that order. After trimming spaces and lower-casing, anything that isn't one of those four (including a missing value) is "unknown", which ranks after low.
Write priority_report(tickets) returning a tuple (order, counts):
- •
order — the ticket_ids sorted by priority rank, then opened_at (earliest first), then ticket_id. - •
counts — a list of (priority, count) tuples for all five priorities in rank order — critical, high, medium, low, unknown — including any with no tickets (count 0).
Python 3.13 in your browser — the standard library plus pandas and numpy; no pip installs.