---
title: Tickets
slug: tickets
createdAt: 2025-04-01T22:42:13.346Z
---

# Ticketing System: Detailed Core Components Documentation

This document provides an in-depth technical specification for the ticketing system's core components. It outlines how the system automatically calculates priority, handles major incidents, supports PX (Priority Exception) tickets, and manages ticket followers. The focus is on system behavior, data model, and automation triggers.

***

# Priority (Impact & Urgency)

## Overview

Tickets are assigned a priority level (P-Level) based on two key attributes:

- **Urgency:** Reflects how quickly the ticket requires a response.
- **Impact:** Indicates the severity of the issue on operations or users.

The system automatically computes the P-Level from these values, which drives SLA timings, notifications, and escalation procedures. Authorized users have the ability to override the computed P-Level when necessary.

## Data Fields

- **Urgency:**
  - **Type:** Enum
  - **Options:** `High`, `Medium`, `Low`, `N/A`
  - **Description:** Represents the time-sensitivity of the ticket. For tickets not governed by SLA, "N/A" may be selected.
- **Impact:**
  - **Type:** Enum
  - **Options:** `High`, `Medium`, `Low`, `N/A`
  - **Description:** Represents the extent of disruption caused by the ticket. "N/A" is used where impact is not applicable.
- **P-Level (Priority):**
  - **Type:** Derived Value (e.g., `P1`, `P2`, `P3`, `P4`)
  - **Description:** Automatically calculated using the matrix below.

## Priority Calculation Matrix

The matrix now includes a column and row for `N/A`. If **both** Urgency and Impact are set to `N/A`, the ticket is treated as a PX ticket and processed via a dedicated workflow (i.e., it is not tracked by standard SLA timers). If **only one** of the fields is `N/A`, the priority is calculated based on the provided value.

| **Impact \ Urgency** | **High**        | **Medium**    | **Low**       | **N/A**       |
| -------------------- | --------------- | ------------- | ------------- | ------------- |
| **High**             | P1 – Critical   | P1 – Critical | P2 – High     | P2 – High     |
| **Medium**           | P1 – Critical   | P2 – High     | P3 – Moderate | P3 – Moderate |
| **Low**              | P2 – High       | P3 – Moderate | P4 – Low      | P4 – Low      |
| **N/A**              | P2 – High<br /> | P3 – Moderate | P4 – Low      | PX            |

:::BlockQuote
**Note:**
:::

- When **only one** field (Urgency or Impact) is `N/A`, the priority is derived solely from the provided value using the corresponding mapping in the table.
- When **both** fields are `N/A`, the ticket is classified as a PX (Priority Exception) ticket, meaning it bypasses standard SLA tracking and follows a dedicated workflow.

## PX (Priority Exception) Tickets

### Overview

PX tickets are a special category where standard urgency and impact measures do not apply. For PX tickets:

- **Field Values:**
  Both Urgency and Impact are set to `N/A`.
- **P-Level Calculation:**
  Although a P-Level is computed (displayed as PX), these tickets bypass standard SLA tracking and escalation processes.
- **Workflow:**
  PX tickets excludes them from SLA timers. They are recorded for audit and reporting purposes, but they are not counted in SLA performance metrics.
- **Use Cases:**
  Typical use cases include informational requests, non-critical internal communications, or tickets where SLA tracking is not relevant.

***

# Major Incidents

## Major Incident Identification

- **Major Incident Toggle:**
  - **Type:** Boolean
  - **Description:** A flag on the ticket indicating that it is a major incident. This flag can be set manually by authorized users or automatically based on conditions such as the ticket's P-Level combined with additional criteria.

## Automated Behavior on Major Incident Activation

When a ticket is marked as a major incident:

- **Distribution List Retrieval:**
  The system automatically retrieves a pre-defined **Major Incident Stakeholders** Distribution List from configuration settings. This list contains user IDs and/or email addresses of key stakeholders.
- **Automatic Follower Addition:**
  All members from the distribution list are added as followers of the ticket. Their follow entries are marked with the reason "Auto-Follow: Major Incident Distribution."
- **Enhanced Notification Workflow:**
  The system triggers enhanced notifications across multiple channels (email, SMS, in-app). The ticket is visibly marked with a "Major Incident" badge in the user interface, and stakeholders receive immediate alerts.
- **Audit and Logging:**
  All changes to the major incident toggle state are logged for audit purposes, ensuring traceability and accountability.

***

## TicketFollowers Table

### Purpose

The `TicketFollowers` table tracks users who follow a ticket to receive notifications about updates. It supports both manual follows (user opt-in) and automatic follows (e.g., for major incidents).

### Table Schema

| **Column Name** | **Data Type** | **Constraints**                      | **Description**                                                                                                     |
| --------------- | ------------- | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------- |
| `follower_id`   | UUID/Int      | Primary Key, Not Null                | Unique identifier for each follow entry.                                                                            |
| `ticket_id`     | UUID/Int      | Foreign Key, Not Null                | Identifier linking to the associated ticket. References the Tickets table.                                          |
| `user_id`       | UUID/Int      | Foreign Key, Not Null                | Identifier of the user following the ticket. References the Users table.                                            |
| `reason`        | VARCHAR/Text  | Not Null, Default: "User Opt-In"     | Describes why the user is following the ticket (e.g., "User Opt-In" or "Auto-Follow: Major Incident Distribution"). |
| `created_at`    | TIMESTAMP     | Not Null, Default CURRENT\_TIMESTAMP | Timestamp when the follow entry was created.                                                                        |
| `updated_at`    | TIMESTAMP     | Nullable                             | Timestamp when the follow entry was last updated.                                                                   |

### Usage Scenarios

- **Manual Follow:**
  A user chooses to follow a ticket by clicking the "Follow" link or button. A record is created in the `TicketFollowers` table with the reason set to "User Opt-In."
- **Automatic Follow for Major Incidents:**
  When a ticket's major incident toggle is activated, the system automatically adds all stakeholders from the distribution list as followers. Their records are added with the reason "Auto-Follow: Major Incident Distribution."

### Integration with the Notification System

- **Notification Dispatch:**
  The notification engine queries the `TicketFollowers` table to compile a list of recipients for ticket updates. Both manual and automatic followers receive notifications according to their preferred channels (email, SMS, in-app).
- **Synchronization:**
  Any update to a ticket (such as a status change or comment) triggers a refresh of the follower list to ensure that all current followers are notified.

***

## Developer Implementation Checklist

### Priority and Automation

- Define `Urgency` and `Impact` fields as enums with options `High`, `Medium`, `Low`, `N/A`.
- Implement backend functionality to calculate the P-Level using the updated matrix, including handling cases where one field is `N/A`.
- Allow for manual override of the calculated P-Level by authorized users.
- Integrate SLA timers and escalation logic based on the computed P-Level.

### PX Ticket Handling

- Introduce a ticket type or flag for PX (Priority Exception) tickets.
- Enforce that for PX tickets, both `Urgency` and `Impact` are set to `N/A`.
- Route PX tickets through a dedicated workflow that excludes them from SLA tracking and escalation processes.
- Ensure PX tickets are recorded for audit and reporting purposes.

### Major Incident Handling

- Add a boolean `major_incident_toggle` to the Ticket data model.
- Configure a Major Incident Distribution List in the system settings.
- Implement logic to automatically add followers to tickets marked as major incidents.
- Trigger enhanced notifications and update UI elements when a ticket is flagged as a major incident.
- Log all changes to the major incident status for audit purposes.

### TicketFollowers Table

- Create the `TicketFollowers` table with the specified schema.
- Implement logic for:
  - Manual ticket following, recording user opt-in.
  - Automatic addition of stakeholders when a ticket is marked as a major incident.
- Ensure the notification system queries the `TicketFollowers` table to dispatch updates.
- Develop and run tests for both manual and automatic follow functionalities.

***

This detailed documentation provides a comprehensive guide for developers to implement the core features of the ticketing system, including automated priority calculation (with PX considerations), robust major incident management, and efficient tracking of ticket followers.
