alexsusanu@docs:Ticket Analysis Script $
alexsusanu@docs
:~$ cat Ticket Analysis Script.md

HomeSCRIPTS → Ticket Analysis Script

Ticket Analysis Script

Python script for analyzing support tickets to identify common patterns and keywords in LIMS-related issues.

Requirements

pip install pandas

Usage

  1. Place your CSV file named tickets.csv in the same directory
  2. Run the script:
python ticket_analysis.py

What It Does

  • Loads ticket data from CSV file
  • Extracts common LIMS error keywords from descriptions
  • Counts frequency of each keyword/pattern
  • Shows top 5 most common issues with example tickets

Keywords Detected

  • sample
  • login
  • slow
  • error
  • batch
  • test
  • patient
  • report
  • connection
  • timeout

Script Code

import pandas as pd
from collections import Counter
import re

# Load your CSV
df = pd.read_csv('tickets.csv')

# Extract keywords from descriptions
def extract_keywords(text):
    # Common LIMS error patterns
    keywords = ['sample', 'login', 'slow', 'error', 'batch', 'test', 'patient', 'report', 'connection', 'timeout']
    found = []
    text_lower = str(text).lower()
    for keyword in keywords:
        if keyword in text_lower:
            found.append(keyword)
    return found

# Apply to descriptions
df['keywords'] = df['description'].apply(extract_keywords)

# Count patterns
all_keywords = [keyword for sublist in df['keywords'] for keyword in sublist]
keyword_counts = Counter(all_keywords)
print(keyword_counts)

# Show tickets for top keywords
for keyword, count in keyword_counts.most_common(5):
    print(f"\n=== {keyword.upper()} ({count} tickets) ===")
    matching_tickets = df[df['keywords'].apply(lambda x: keyword in x)]
    for idx, row in matching_tickets.head(3).iterrows():
        print(f"- {row['short_description']}")

Expected CSV Format

Your tickets.csv should have columns:
- description: Full ticket description
- short_description: Brief ticket summary

Last updated: 2025-08-26 20:00 UTC