<aside>

🎫 Ticket Priority Classifier

An AI-powered support ticket prioritization system that automatically classifies customer support tickets into priority levels using advanced sentiment analysis and keyword detection.

Project Demo

Python

FastAPI

Streamlit

🌟 Features

🎯 Priority Levels

🚀 Quick Start

Prerequisites

Installation

  1. Clone the repository
git clone <https://github.com/yourusername/ticket-prioritization-api.git>
cd ticket-prioritization-api
  1. Create and activate virtual environment
python -m venv venv
# Windows
venv\\Scripts\\activate
# macOS/Linux
source venv/bin/activate
  1. Install dependencies
pip install -r requirements.txt

Running the Application

  1. Start the API server
python main.py

API will be available at: http://localhost:8000 Interactive docs: http://localhost:8000/docs

  1. Start the web interface (in a new terminal)
streamlit run app.py

Web app will be available at: http://localhost:8501

📖 Usage Examples

API Endpoint

import requests

payload = {
    "ticket_id": "TKT-001",
    "text": "URGENT! Production database is down and customers are affected!",
    "customer_tier": "enterprise"
}

response = requests.post("<http://localhost:8000/classify-ticket>", json=payload)
result = response.json()

print(f"Priority: {result['priority']}")
print(f"Score: {result['final_score']:.1%}")

Web Interface

  1. Select from pre-loaded examples or write custom ticket text
  2. Choose customer tier (standard/premium/enterprise)
  3. Click "Classify Ticket" to see results
  4. View detailed scoring breakdown and detected keywords

🧠 Technical Architecture

Core Components

Scoring Algorithm

Final Score = (Sentiment × 0.35) + (Keywords × 0.45) + (Tier × 0.20)

Where:
- Sentiment: 0-1 based on negative sentiment confidence
- Keywords: 0-1 based on critical/high priority keywords detected
- Tier: Customer tier multiplier (Standard: 1.0, Premium: 1.15, Enterprise: 1.3)

Project Structure

ticket-prioritization-api/
├── main.py              # FastAPI application
├── app.py               # Streamlit web interface
├── utils.py             # Classification logic
├── config.py            # Keywords and configuration
├── requirements.txt     # Dependencies
└── README.md           # This file

🔧 Configuration

Adding Keywords

Edit config.py to add new keywords:

CRITICAL_KEYWORDS = [
    "urgent", "critical", "emergency", "down", "hack",
    # Add your keywords here
]

Adjusting Scoring Weights

Modify weights in config.py:

WEIGHTS = {
    "sentiment": 0.35,      # Sentiment analysis weight
    "keywords": 0.45,       # Keyword detection weight
    "customer_tier": 0.20   # Customer tier weight
}

📊 Performance

🛠️ Built With

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🤝 Contributing

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request </aside>

Captura de pantalla 2025-11-07 235121.png

Captura de pantalla 2025-11-07 235212.png

View GitHub Repository:

https://github.com/AlvLeoAI/ticket-prioritization-api