A comprehensive analytics platform for HR departments to analyze, visualize, and predict employee attrition using interactive dashboards and an AI-powered chatbot.
- Overview
- Features
- Architecture
- Prerequisites
- Installation
- Usage Guide
- API Documentation
- Dataset Requirements
- Screenshots
- Tech Stack
- Contributing
The HR Attrition Analytics Platform helps organizations understand and reduce employee attrition through advanced data visualization and AI-assisted analysis. By leveraging machine learning and interactive dashboards, HR professionals can identify key attrition factors, detect at-risk employees, and develop targeted retention strategies.
- Multi-dimensional attrition visualizations by:
- Age groups
- Gender
- Departments
- Education levels
- Job satisfaction
- Salary bands
- Performance ratings
- Segment employee data by multiple parameters
- Create custom cohorts for analysis
- Save and share filter configurations
- Natural language interface for data queries
- Contextual analysis of attrition factors
- Custom HR insights and recommendations
- Trend identification and prediction
- CSV data import functionality
- Data quality checks and validation
- Custom field mapping
- Historical data comparison
The platform follows a client-server architecture:
┌───────────────────┐ ┌───────────────────┐
│ Frontend │ │ Backend │
│ (React + TypeScript)◄────►(Flask + Python) │
└───────────────────┘ └─────────┬─────────┘
│
▼
┌───────────────────┐
│ LLM Integration │
│ (Groq API) │
└───────────────────┘
- Python 3.7+
- Node.js 18+
- npm/yarn
- Groq API key
-
Navigate to the backend directory:
cd attrition-backend -
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables:
cp .env.example .env # Edit .env file to add your GROQ_API_KEY -
Start the Flask server:
flask run --port=8000 # Or with debug mode: flask run --debug --port=8000
-
Navigate to the frontend directory:
cd attrition-frontend -
Install dependencies:
npm install # Or using yarn: yarn install -
Set up environment variables:
cp .env.example .env # Configure API URL if needed: # VITE_API_URL=http://localhost:8000/api
-
Start the development server:
npm run dev # Or using yarn: yarn dev -
Open your browser and navigate to
http://localhost:5173
The platform offers several key views:
- Overview Dashboard: High-level metrics and KPIs for attrition
- Detailed Analysis: Deep-dive visualizations for specific metrics
- Employee Segmentation: Analysis by departments, roles, and demographics
- Risk Assessment: Identification of employees or groups at risk of attrition
- AI Assistant: Natural language interface for custom insights
- Use the filters panel to focus on specific employee segments
- Compare attrition rates across different dimensions
- Identify correlating factors with high attrition rates
- Export visualizations or raw data for reporting
- Ask questions in natural language about your HR data
- Request specific analyses or comparisons
- Get strategic recommendations for reducing attrition
- Ask for explanations about attrition factors and trends
Sample questions:
- "What department has the highest attrition rate?"
- "Is there a correlation between overtime and attrition?"
- "What are the main factors contributing to attrition in the Sales department?"
- "Generate a summary of attrition trends by education level"
All API endpoints require authentication via API key. Include the key in your request headers:
Authorization: Bearer your-api-key-here
| Endpoint | Method | Description |
|---|---|---|
/api/attrition-by-age |
GET | Attrition data by age groups |
/api/attrition-by-gender |
GET | Attrition data by gender |
/api/attrition-by-department |
GET | Attrition data by department |
/api/attrition-by-education |
GET | Attrition data by education level |
/api/attrition-by-job-satisfaction |
GET | Attrition data by satisfaction level |
/api/attrition-by-salary |
GET | Attrition data by salary bands |
/api/overall-statistics |
GET | Overall attrition statistics |
/api/factors-correlation |
GET | Correlation between factors and attrition |
/api/predictive-factors |
GET | Top factors predicting attrition |
/api/filtered-data |
GET | Filtered attrition data |
/api/chat |
POST | Chat with the AI assistant |
/api/chat/reset |
POST | Reset chat conversation |
/api/dataset-metadata |
GET | Get metadata about the dataset |
Refer to the API Documentation for detailed endpoint specifications and response formats.
The platform requires HR data with the following attributes:
Attrition: Binary indicator (Yes/No)Age: Employee ageGender: Employee genderDepartment: Department nameJobSatisfaction: Satisfaction rating (1-4)MonthlyIncome: Monthly salaryYearsAtCompany: Tenure at company
Education: Education level (1-5)OverTime: Overtime status (Yes/No)JobLevel: Level in organization (1-5)WorkLifeBalance: Work-life balance rating (1-4)PerformanceRating: Performance rating (1-4)DistanceFromHome: Distance from work
The default dataset is located at: /home/Maanu/Documents/RoR Internship/Attrition-Analytics/datasets/HR-Employee-Attrition-All.csv
- Python: Core language
- Flask: Web framework
- Pandas: Data manipulation and analysis
- NumPy: Numerical computing
- Groq API: LLM integration for chatbot
- TypeScript: Type-safe JavaScript
- React: UI library
- Vite: Build tool
- shadcn/ui: Component library
- Tailwind CSS: Utility-first CSS
- Chart.js: Data visualization
- React Query: Data fetching
- Axios: HTTP client
- Fork the repository
- Create a feature branch (
git checkout -b feature/your-feature) - Commit your changes (
git commit -m 'Add some feature') - Push to the branch (
git push origin feature/your-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.




