A simple web application that automatically classifies Jira-like issues into categories (bug, enhancement, question) using Word2Vec embeddings and Random Forest classification.
- Automated Issue Classification: Classify issues as bug, enhancement, or question.
- Option to correct wrongly predicted category: If the user thinks the prediction is incorrect, it can be changed.
- Multi-language Support: Detects and validates issue language (English only)
- Supabase Integration: Persistent storage and retrieval of classifications
- Prometheus Metrics: Real-time monitoring of predictions and accuracy
- Comprehensive Testing: Unit tests with coverage reporting
- Python 3.12.3 or higher
- Docker and Docker Compose (for containerized setup)
- Supabase account (for database integration)
-
Clone the repository
git clone https://github.com/695roshan/Issue-Classification.git cd Issue-Classification -
Create a virtual environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Create and configure the .env file Create a
.envfile in the root directory with the following variables:# Supabase Configuration SUPABASE_URL=https://your-project-id.supabase.co SUPABASE_KEY=your-supabase-anon-key -
Run the application
python app.py
The application will be available at:
http://localhost:5000
Docker is used to run Prometheus and Grafana for monitoring, while the Flask server runs locally from the command line.
Start Docker services:
-
Ensure the .env file is created with your Supabase credentials
-
Start Docker Compose (Prometheus & Grafana)
docker-compose up -d
This will start:
- Prometheus: http://localhost:9090
- Grafana: http://localhost:3000
-
Stop Docker services
docker-compose down
Prometheus runs in Docker and automatically collects metrics from your Flask application at the /metrics endpoint. The prometheus.yml configuration file specifies the Flask app target.
Note: When Flask runs locally (not in Docker) and Prometheus runs in Docker, Prometheus accesses Flask via host.docker.internal:5000 (on Windows) or your machine's IP address (on Linux/Mac).
Key metrics monitored:
accuracy- Model accuracyavg_prediction_confidence- Average confidence of predictionspredictions_per_category- Number of predictions per labelcorrect_predictions_per_category- Correct predictions per labelincorrect_predictions_per_category- Incorrect predictions per labelrequest_latency_seconds- API request latency
Access Prometheus:
- URL:
http://localhost:9090 - Query metrics using PromQL in the Query interface
- Example query:
accuracy
Grafana provides visualization dashboards for your metrics.
First-time setup:
- Access Grafana at
http://localhost:3000 - Login with default credentials:
- Username:
admin - Password:
admin
- Username:
- Add Prometheus as a data source:
- Click Configuration → Data Sources
- Click Add data source
- Select Prometheus
- Set URL to
http://prometheus:9090 - Click Save & Test
- Create a dashboard:
- Click + → Dashboard
- Click Add new panel
- Select Prometheus as data source
- Add queries for metrics you want to visualize
- Example queries:
accuracy- Display model accuracyavg_prediction_confidence- Display average confidencerate(predictions_per_category[5m])- Show prediction rate
Useful Grafana Features:
- Set refresh intervals for real-time updates
- Create alerts based on metric thresholds
- Use templating for dynamic dashboards
- Export and share dashboards
# Run all tests
pytest
# Run tests with coverage report
pytest --cov=app --cov=model --cov=ticket --cov-report=term-missing
# Run specific test file
pytest tests/test_app.py
# Run with verbose output
pytest -v