Skip to content

Latest commit

 

History

History
250 lines (192 loc) · 6.26 KB

File metadata and controls

250 lines (192 loc) · 6.26 KB

AI Features - Quick Setup Guide

What's Been Added

AI Promotion Recommendation System - Predicts who should be promoted based on performance, tenure, projects, and attendance ✅ Performance Tracking Dashboard - Monitor individual and team performance with detailed analytics ✅ Work From Home Tracking - Track remote workers and compare performance metrics ✅ Backend AI Routes - Complete API for all AI features ✅ Frontend UI Pages - Beautiful, interactive dashboards for all features ✅ Navigation Integration - New menu items in sidebar


Installation Steps

1. Backend Dependencies

The backend uses existing dependencies. No new npm packages needed!

2. Update Database Schema

The Employee model has been updated with new fields:

  • performanceRating (1-5)
  • workFromHome (boolean)
  • projectsCompleted (number)
  • attendancePercentage (0-100)
  • promotionScore (0-100)
  • promotionEligible (boolean)

If you have existing employee records in MongoDB, add these fields with default values.

3. Restart Backend Server

cd backend
npm start

The new routes will automatically be available at:

  • GET /api/ai/promotion-recommendations
  • GET /api/ai/performance/:employeeId
  • GET /api/ai/work-from-home
  • PUT /api/ai/performance/:employeeId

4. Verify Frontend

The frontend has been updated with:

  • 3 new page files created
  • Sidebar navigation updated
  • App.jsx routes updated
  • New feature pages ready to use

Just start the frontend normally:

cd frontend
npm run dev

How to Use

1. Promotion Recommendations

Navigate to Sidebar → Promotions

What you'll see:

  • List of all employees ranked by promotion score (0-100)
  • Color-coded scores: Green (85+), Blue (70-84), Yellow (<70)
  • Employees with score ≥ 70 are marked "Eligible"
  • Filter by: All / Eligible / Not Yet Eligible
  • Sort by: Score / Name / Tenure

Scoring Breakdown:

  • Performance Rating: 35 points
  • Tenure: 25 points
  • Projects Completed: 20 points
  • Attendance: 15 points
  • Work-from-Home Bonus: 5 points

2. Performance Tracking

Navigate to Sidebar → Performance

Three views available:

  1. Team Overview - Overall team metrics, trends, projects
  2. Individual Performance - Deep dive into one employee's metrics
  3. Department Comparison - Compare departments

Metrics shown:

  • Performance ratings (1-5 scale)
  • Attendance percentages
  • Projects completed
  • Years of service
  • Radar charts for visual profile
  • Historical trends

3. Work From Home

Navigate to Sidebar → Work From Home

What you'll see:

  • Statistics: Total WFH vs Office employees
  • Pie chart of work arrangement
  • Stacked bar chart by department
  • Performance comparison: WFH vs Office
  • Employee list in Grid or List view

Insights:

  • Compare average performance: WFH vs Office
  • Compare attendance: WFH vs Office
  • See which departments use WFH most

Adding Performance Data to Employees

Currently, the features use mock data for demonstration. To use real data:

Option 1: Update via API

# Update an employee's performance
PUT /api/ai/performance/{employeeId}

{
  "performanceRating": 4.5,
  "projectsCompleted": 12,
  "workFromHome": true,
  "attendancePercentage": 95
}

Option 2: Update in MongoDB Directly

db.employees.updateOne(
  { _id: ObjectId("...") },
  {
    $set: {
      performanceRating: 4.5,
      projectsCompleted: 12,
      workFromHome: true,
      attendancePercentage: 95
    }
  }
)

Option 3: Create Admin Panel

Create an "Edit Performance" modal in the Employees page to update these fields.


Key Features Explained

Promotion Score Algorithm

Score = (Rating/5 × 35) + (Tenure/5 × 25) + (Projects/10 × 20) + (Attendance/100 × 15) + (WFH Bonus 5)

Example:
- Senior employee: 4 years, Rating 4.8/5, 15 projects, 98% attendance, WFH
- Score = (4.8/5 × 35) + (4/5 × 25) + (15/10 × 20, capped at 20) + (98/100 × 15) + 5
- Score = 33.6 + 20 + 20 + 14.7 + 5 = 93.3 ✓ ELIGIBLE

Performance Rating Scale

  • 1.0-1.9: Poor
  • 2.0-2.9: Below Average
  • 3.0-3.9: Average
  • 4.0-4.4: Good
  • 4.5-5.0: Excellent

Customization Options

1. Change Promotion Score Weights

Edit /backend/routes/aiRoutes.js in the calculatePromotionScore function:

// Change weights here
score += (employee.performanceRating / 5) * 35; // Change 35 to different value
score += tenureScore; // Change weight
// etc...

2. Change Promotion Eligibility Threshold

Edit in aiRoutes.js:

promotionEligible: promotionScore >= 70, // Change 70 to different threshold

3. Customize Colors

Edit the React component files to change color schemes.


Troubleshooting

Issue: Performance data not updating

  • Make sure the API endpoint is being called with correct employeeId
  • Check MongoDB connection
  • Verify employee record exists before updating

Issue: Sidebar menu not showing new items

  • Refresh the browser (Ctrl+F5)
  • Clear browser cache
  • Restart frontend dev server

Issue: Charts not displaying

  • Check if Recharts library is installed: npm list recharts
  • Verify data is being fetched
  • Check browser console for errors

Database Queries for Analysis

Find all promotion-eligible employees

db.employees.find({ promotionScore: { $gte: 70 } })

Find all WFH employees

db.employees.find({ workFromHome: true })

Find highest performers in each department

db.employees.aggregate([
  { $group: { _id: "$department", topScore: { $max: "$promotionScore" } } }
])

Next Steps

  1. Add real employee data - Update existing employees with performance metrics
  2. Test the features - Navigate through each page to ensure everything works
  3. Customize scoring - Adjust weights based on your organization's needs
  4. Create admin interface - Add ability to manage performance ratings
  5. Set up notifications - Alert managers when employees become promotion-eligible
  6. Export reports - Generate PDF/CSV reports for HR

Support

For questions or issues:

  1. Check the AI_FEATURES.md documentation
  2. Review the code comments in the component files
  3. Check browser console for error messages
  4. Verify API endpoints are responding correctly