{
  "format": "dataset-manifest/1",
  "slug": "ticket-status-history",
  "version": 1,
  "seed": "ticket-status-history:1",
  "spec": {
    "format": "dataset/1",
    "slug": "ticket-status-history",
    "name": "Ticket Status History",
    "tagline": "History of ticket status changes, tracking each event for time-in-status and reopen rates.",
    "description": "In customer support, understanding the journey of each ticket is crucial. This dataset models the status history of support tickets, capturing every change as an event. It allows for analysis of time spent in each status, identification of bottlenecks, and calculation of reopen rates. The three tables in this dataset interact to provide a comprehensive view: tickets, status changes, and statuses. This synthetic dataset is designed for developers looking to practice SQL queries, build ETL pipelines, or create analytics dashboards. With this data, questions like 'How long do tickets stay in each status?' or 'What is the rate of ticket reopens?' can be answered effectively, supporting performance improvement efforts in customer support operations.",
    "domain": "customer-support",
    "shape": "event-log",
    "useCases": [
      "analytics-demo",
      "etl-pipelines"
    ],
    "keywords": [
      "customer support",
      "ticketing",
      "status history",
      "event log",
      "analytics"
    ],
    "locale": "en",
    "license": "CC0-1.0",
    "version": 1,
    "tables": {
      "tickets": {
        "description": "This table contains records of each support ticket. Each row represents a unique ticket with its creation details.",
        "rows": 200,
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for the ticket."
          },
          "created_at": {
            "kind": "datetime",
            "from": "2023-01-01",
            "to": "2023-10-01",
            "description": "Timestamp when the ticket was created.",
            "dayProfile": "waking"
          },
          "title": {
            "kind": "sentence",
            "min": 10,
            "max": 50,
            "description": "Brief title summarizing the ticket issue."
          },
          "description": {
            "kind": "paragraph",
            "min": 20,
            "max": 500,
            "description": "Detailed description of the issue reported in the ticket.",
            "nullable": true
          }
        }
      },
      "statuses": {
        "description": "This table defines the different statuses that tickets can have. Each status represents a step in the ticket lifecycle.",
        "rows": 5,
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for the status."
          },
          "name": {
            "kind": "enum",
            "values": [
              "Open",
              "In Progress",
              "On Hold",
              "Resolved",
              "Closed"
            ],
            "description": "The name of the ticket status."
          }
        }
      },
      "status_changes": {
        "description": "This table logs every status change for each ticket. Each row represents a unique event recording the change of status.",
        "rows": {
          "per": "tickets",
          "via": "ticket_id",
          "min": 1,
          "max": 5,
          "skew": "long-tail"
        },
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for the status change event."
          },
          "ticket_id": {
            "kind": "fk",
            "ref": "tickets.id",
            "description": "Reference to the ticket that changed status."
          },
          "status_id": {
            "kind": "fk",
            "ref": "statuses.id",
            "description": "Reference to the new status of the ticket."
          },
          "changed_at": {
            "kind": "datetime",
            "after": "ticket_id.created_at",
            "withinDays": 30,
            "description": "Timestamp when the status change occurred."
          }
        }
      }
    },
    "structure": "multi-table",
    "traits": [
      "timestamped",
      "categorical",
      "nullable"
    ],
    "analysisQuestions": [
      "How long do tickets stay in each status on average?",
      "What percentage of tickets are reopened after being resolved?",
      "Which status has the highest average time spent?",
      "Are there specific trends in ticket statuses over time?"
    ],
    "suggestedQueries": [
      {
        "title": "List all tickets with their current status",
        "sql": "SELECT t.id, t.title, s.name FROM tickets t JOIN status_changes sc ON t.id = sc.ticket_id JOIN statuses s ON sc.status_id = s.id WHERE sc.changed_at = (SELECT MAX(changed_at) FROM status_changes WHERE ticket_id = t.id);",
        "dialect": "postgres"
      },
      {
        "title": "Average time spent in each status",
        "sql": "SELECT s.name, AVG(EXTRACT(EPOCH FROM (sc.changed_at - t.created_at))/3600) AS avg_hours FROM tickets t JOIN status_changes sc ON t.id = sc.ticket_id JOIN statuses s ON sc.status_id = s.id GROUP BY s.name;",
        "dialect": "postgres"
      },
      {
        "title": "Count of tickets by status",
        "sql": "SELECT s.name, COUNT(sc.ticket_id) AS ticket_count FROM status_changes sc JOIN statuses s ON sc.status_id = s.id GROUP BY s.name;",
        "dialect": "postgres"
      },
      {
        "title": "Reopen rate of tickets",
        "sql": "SELECT (SUM(CASE WHEN s.name = 'Open' THEN 1 ELSE 0 END) * 100.0 / COUNT(*)) AS reopen_rate FROM status_changes sc JOIN statuses s ON sc.status_id = s.id WHERE sc.ticket_id IN (SELECT ticket_id FROM status_changes WHERE status_id = (SELECT id FROM statuses WHERE name = 'Resolved'));",
        "dialect": "postgres"
      }
    ],
    "usageScenarios": [
      {
        "title": "Data Analysts Exploring Ticket Trends",
        "body": "Data analysts at a customer support center can utilize this dataset to explore ticket trends over time. By analyzing the status changes, they can identify patterns such as peak ticket volume periods and average resolution times. This information allows them to make informed decisions about staffing and process improvements."
      },
      {
        "title": "ETL Pipeline Development",
        "body": "Data engineers can leverage this dataset to build ETL pipelines that extract ticket status change events for further analysis. By transforming and loading this data into a data warehouse, they can facilitate reporting and dashboarding efforts, ensuring that the customer support team has access to real-time insights."
      },
      {
        "title": "Customer Support Performance Reviews",
        "body": "Customer support managers can use this dataset to evaluate the performance of their teams. By analyzing the time spent in each status, they can identify areas for improvement and understand the impact of workflow changes on ticket resolution times. This helps in optimizing support processes and enhancing customer satisfaction."
      }
    ]
  },
  "counts": {
    "statuses": 5,
    "tickets": 200,
    "status_changes": 420
  },
  "stats": {
    "tickets": {
      "rows": 200,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 200,
          "min": 1,
          "max": 200
        },
        "created_at": {
          "nulls": 0,
          "distinct": 200,
          "min": "2023-01-02 12:46:44",
          "max": "2023-10-01 09:01:02"
        },
        "title": {
          "nulls": 0,
          "distinct": 200
        },
        "description": {
          "nulls": 21,
          "distinct": 179
        }
      }
    },
    "statuses": {
      "rows": 5,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 5,
          "min": 1,
          "max": 5
        },
        "name": {
          "nulls": 0,
          "distinct": 3,
          "min": "Closed",
          "max": "Resolved"
        }
      }
    },
    "status_changes": {
      "rows": 420,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 420,
          "min": 1,
          "max": 420
        },
        "ticket_id": {
          "nulls": 0,
          "distinct": 200,
          "min": 1,
          "max": 200
        },
        "status_id": {
          "nulls": 0,
          "distinct": 5,
          "min": 1,
          "max": 5
        },
        "changed_at": {
          "nulls": 0,
          "distinct": 420,
          "min": "2023-01-12 20:15:00",
          "max": "2023-10-23 00:24:40"
        }
      }
    }
  },
  "artifacts": [
    {
      "file": "csv/statuses.csv",
      "format": "csv",
      "table": "statuses",
      "key": "datasets/ticket-status-history/v1/csv/statuses.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/ticket-status-history/v1/csv/statuses.csv",
      "bytes": 59,
      "sha256": "6a0e529939832d2a182d962e8a406c6c9442a6fab155e09d6f80c4540c82425b",
      "rows": 5,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/tickets.csv",
      "format": "csv",
      "table": "tickets",
      "key": "datasets/ticket-status-history/v1/csv/tickets.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/ticket-status-history/v1/csv/tickets.csv",
      "bytes": 44974,
      "sha256": "ab1e98021faa8833c92d5c375a7eacbff52f5985ebf2afa079965c1f947893d9",
      "rows": 200,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/status_changes.csv",
      "format": "csv",
      "table": "status_changes",
      "key": "datasets/ticket-status-history/v1/csv/status_changes.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/ticket-status-history/v1/csv/status_changes.csv",
      "bytes": 12717,
      "sha256": "dedf3776e239a7ab06b661a16f1f0f47ae89d0202d956685e04872978bd4207b",
      "rows": 420,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "ticket-status-history.json",
      "format": "json",
      "table": null,
      "key": "datasets/ticket-status-history/v1/ticket-status-history.json",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/ticket-status-history/v1/ticket-status-history.json",
      "bytes": 112090,
      "sha256": "497bf54d5b3482919f009832cf3a3bdead6224b829145fdc3a1c2ffa73b0477c",
      "rows": null,
      "contentType": "application/json; charset=utf-8"
    },
    {
      "file": "sql/postgres.sql",
      "format": "sql-postgres",
      "table": null,
      "key": "datasets/ticket-status-history/v1/sql/postgres.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/ticket-status-history/v1/sql/postgres.sql",
      "bytes": 66861,
      "sha256": "c9ec58d8c77ecdae616fee998b758fe7b050f0f829da6177b6a8f5799c0cb5e7",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "sql/mysql.sql",
      "format": "sql-mysql",
      "table": null,
      "key": "datasets/ticket-status-history/v1/sql/mysql.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/ticket-status-history/v1/sql/mysql.sql",
      "bytes": 66526,
      "sha256": "90d589b499bd1b6c207a7cdd04215bfa913fcdbda9c272a1f84804e8abcc9ade",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "sql/mssql.sql",
      "format": "sql-mssql",
      "table": null,
      "key": "datasets/ticket-status-history/v1/sql/mssql.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/ticket-status-history/v1/sql/mssql.sql",
      "bytes": 67744,
      "sha256": "4fd657c2690ab9beb358aa416f0166633f92eae337f79adb27f583f48883a466",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "sql/sqlite.sql",
      "format": "sql-sqlite",
      "table": null,
      "key": "datasets/ticket-status-history/v1/sql/sqlite.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/ticket-status-history/v1/sql/sqlite.sql",
      "bytes": 66409,
      "sha256": "e37e17d045f4bab6bafce0e0269d1ac56fde33f401419dc9c54deba387abeaaa",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "prisma/seed.ts",
      "format": "prisma-seed",
      "table": null,
      "key": "datasets/ticket-status-history/v1/prisma/seed.ts",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/ticket-status-history/v1/prisma/seed.ts",
      "bytes": 102309,
      "sha256": "c9785af5738c9360ab65f8dde69f5100fc8ee1ef0ec3f79dbf59de739baad4e1",
      "rows": null,
      "contentType": "application/typescript; charset=utf-8"
    },
    {
      "file": "django/fixtures.json",
      "format": "django-fixture",
      "table": null,
      "key": "datasets/ticket-status-history/v1/django/fixtures.json",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/ticket-status-history/v1/django/fixtures.json",
      "bytes": 139520,
      "sha256": "c2872c16a28fe2faed0d10968996c4c59f38986ec1db372521839d79736b17e7",
      "rows": null,
      "contentType": "application/json; charset=utf-8"
    }
  ],
  "publishedAt": 1788767564623,
  "updatedAt": 1788767564623
}
