✅ 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
The backend uses existing dependencies. No new npm packages needed!
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.
cd backend
npm startThe new routes will automatically be available at:
GET /api/ai/promotion-recommendationsGET /api/ai/performance/:employeeIdGET /api/ai/work-from-homePUT /api/ai/performance/:employeeId
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 devNavigate 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
Navigate to Sidebar → Performance
Three views available:
- Team Overview - Overall team metrics, trends, projects
- Individual Performance - Deep dive into one employee's metrics
- 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
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
Currently, the features use mock data for demonstration. To use real data:
# Update an employee's performance
PUT /api/ai/performance/{employeeId}
{
"performanceRating": 4.5,
"projectsCompleted": 12,
"workFromHome": true,
"attendancePercentage": 95
}db.employees.updateOne(
{ _id: ObjectId("...") },
{
$set: {
performanceRating: 4.5,
projectsCompleted: 12,
workFromHome: true,
attendancePercentage: 95
}
}
)Create an "Edit Performance" modal in the Employees page to update these fields.
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
- 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
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...Edit in aiRoutes.js:
promotionEligible: promotionScore >= 70, // Change 70 to different thresholdEdit the React component files to change color schemes.
- Make sure the API endpoint is being called with correct employeeId
- Check MongoDB connection
- Verify employee record exists before updating
- Refresh the browser (Ctrl+F5)
- Clear browser cache
- Restart frontend dev server
- Check if Recharts library is installed:
npm list recharts - Verify data is being fetched
- Check browser console for errors
db.employees.find({ promotionScore: { $gte: 70 } })db.employees.find({ workFromHome: true })db.employees.aggregate([
{ $group: { _id: "$department", topScore: { $max: "$promotionScore" } } }
])- Add real employee data - Update existing employees with performance metrics
- Test the features - Navigate through each page to ensure everything works
- Customize scoring - Adjust weights based on your organization's needs
- Create admin interface - Add ability to manage performance ratings
- Set up notifications - Alert managers when employees become promotion-eligible
- Export reports - Generate PDF/CSV reports for HR
For questions or issues:
- Check the AI_FEATURES.md documentation
- Review the code comments in the component files
- Check browser console for error messages
- Verify API endpoints are responding correctly