- Project Structure
- How Your System Works
- Data Flow Analysis
- The Problem Identified
- Why Calendar Events Are Missing
- Solution Architecture
burnout-system/
βββ backend/
β βββ config/
β β βββ constants.js # System constants (weights, thresholds)
β βββ models/
β β βββ CalendarEvent.js # Calendar event schema
β β βββ Grade.js # Student grades schema
β β βββ Intervention.js # Proctor interventions schema
β β βββ Signal.js # Burnout signals schema
β β βββ Task.js # Student tasks schema
β β βββ User.js # User (student/proctor/admin) schema
β β βββ WorkloadScore.js # Daily/weekly workload scores
β βββ routes/
β β βββ admin.js # Admin routes (manage users, calendar, analytics)
β β βββ auth.js # Authentication routes
β β βββ burnout.js # Burnout analysis routes
β β βββ calendar.js # Calendar routes (personal + institutional)
β β βββ calendar-upload.js # Admin calendar upload
β β βββ grades.js # Grade management routes
β β βββ proctor.js # Proctor routes
β β βββ tasks.js # Task management routes
β β βββ workload.js # Workload data routes
β β βββ routes.js # Main route aggregator
β βββ services/
β β βββ burnout.js # Main burnout prediction logic
β β βββ collision.js # Deadline collision detection
β β βββ drift.js # Performance drift detection
β β βββ recovery.js # Recovery gap detection
β β βββ volatility.js # Workload spike detection
β β βββ workload.js # Workload calculation service
β βββ jobs.js # Scheduled jobs (daily analysis)
β βββ server.js # Express server entry point
βββ frontend/
β βββ css/
β β βββ main.css # Styles
β βββ js/
β β βββ api.js # API wrapper functions
β βββ pages/
β β βββ student.html # Student dashboard (NEEDS FIX)
β β βββ tasks.html # Task management page
β β βββ calendar.html # Calendar page (WORKING)
β β βββ grades.html # Grade management page
β β βββ login.html # Login/register page
β β βββ proctor.html # Proctor dashboard
β β βββ admin.html # Admin dashboard
β βββ index.html # Landing page
- Students create tasks with:
- Title, type (exam/project/assignment/quiz)
- Deadline, estimated effort (hours)
- Completion status
- Students add grades with:
- Subject, exam type
- Marks, max marks, percentage
- Date, semester
-
Institutional Events (created by Admin):
- Student Tour, Welfare Visit, Course Wish List, etc.
- Visible to ALL students
- Have: title, eventType, startDate, endDate, priority, venue
-
Personal Events (created by Students):
- Private to each student
- Same structure as institutional
Current Implementation:
calculateWorkloadScores(studentId, startDate, endDate) {
// 1. Fetch tasks in date range
const tasks = await Task.find({ studentId, deadline: {...} });
// 2. Group by day
tasks.forEach(task => {
const weight = WEIGHTS[task.type]; // exam=3, project=2.5, etc.
const weightedEffort = task.estimatedEffort * weight;
dailyScores[date] += weightedEffort;
});
// 3. Save to WorkloadScore collection
// 4. Calculate weekly aggregates
}** Weights:**
- Exam: 3x
- Project: 2.5x
- Assignment: 1.5x
- Quiz: 1x
Current Implementation:
predictBurnout(studentId) {
// Run 4 detectors in parallel
[collision, volatility, recovery, drift] = await Promise.all([
detectCollisions(studentId), // Check upcoming deadline overload
detectVolatility(studentId), // Check workload spikes
analyzeRecoveryGap(studentId), // Check continuous work without rest
analyzePerformanceDrift(studentId) // Check grades vs effort trend
]);
// Calculate score (0-100)
score = 0;
if (collision.hasCollision) score += 30;
if (volatility.hasVolatility) score += 15-25;
if (recovery.hasRecoveryDeficit) score += 25;
if (drift.hasDrift) score += 10-20;
// Determine risk level
if (score >= 60) risk = 'high';
else if (score >= 30) risk = 'medium';
else risk = 'low';
// Save to Signal collection
}- Gets tasks from next 14 days
- Groups by week
- Checks if:
- β₯3 major tasks (exam/project) in one week, OR
- Total hours >50 in one week
- ** PROBLEM:** Only checks TASKS, not EVENTS
- Gets last 4 weeks workload
- Compares current week vs previous week
- Flags if increase β₯50%
- ** PROBLEM:** Workload only from TASKS
- Gets last 30 days workload
- Finds continuous high-load days (score >10)
- Flags if β₯7 days without rest
- ** PROBLEM:** Workload only from TASKS
- Gets 6 months of grades and workload
- Checks if effort increasing but grades declining
- Flags sustained drift (β₯3 months)
- ** PROBLEM:** Workload only from TASKS
Student adds Task
β
Task saved to MongoDB
β
calculateWorkloadScores() reads ONLY tasks
β
WorkloadScore collection updated
β
predictBurnout() runs detectors
β
Detectors read WorkloadScore (incomplete data)
β
Signal saved with INACCURATE burnout score
β
Student dashboard shows WRONG risk level
Admin uploads institutional events
β
CalendarEvent.create({ isInstitutional: true })
β
Saved to MongoDB
β
/calendar/all route returns events
β
calendar.html displays them
β
BUT... they are NEVER read by workload calculation β
β
burnout prediction ignores them β
β
student.html doesn't show them β
File: /services/workload.js
Function: calculateWorkloadScores()
Current Code:
const tasks = await Task.find({
studentId,
deadline: { $gte: startDate, $lte: endDate }
});
// β Calendar events are NEVER fetchedImpact:
- Student has 5 upcoming events β Workload shows 0
- Burnout score = LOW (incorrect)
- Charts are empty or misleading
File: /services/collision.js
Function: detectCollisions()
Current Code:
const tasks = await Task.find({
studentId,
deadline: { $gte: today, $lte: twoWeeksLater }
});
// β Doesn't count Student Tour, Welfare Visit, etc.Impact:
- Student has 3 exams + 2 events in one week
- System sees only 3 items β No collision warning
- Should trigger collision (β₯3 major items)
File: /frontend/pages/student.html
Current Code:
// Only loads:
await loadBurnoutAnalysis();
await loadWorkloadChart();
await loadUpcomingTasks();
await loadRecentGrades();
// β No function to load calendar eventsImpact:
- Events exist in database
- calendar.html shows them
- student.html doesn't display them
File: /services/workload.js
Changes:
- Fetch both tasks AND calendar events
- Calculate event workload with proper weights
- Combine task + event scores
Event Weights:
exam: 8 // High stress (equivalent to 2 exam tasks)
registration: 4 // Moderate effort
event: 3 // General attendance
holiday: 0 // Rest dayFile: /services/collision.js
Changes:
- Fetch calendar events alongside tasks
- Count institutional events as major items
- Include in collision check
File: /services/burnout.js
Changes:
- Pass event data to all detectors
- Include events in reasons array
- Update signal schema if needed
File: /frontend/js/api.js
Status: β Already correct
calendarAPI.get(startDate, endDate) {
return apiCall(`/calendar/all?startDate=${...}&endDate=${...}`);
}File: /frontend/pages/student.html
Changes:
- Add
loadUpcomingEvents()function - Display events with proper styling
- Auto-refresh when returning to page
File: /models/CalendarEvent.js
Verify fields:
eventType: exam | registration | event | holidayisInstitutional: booleanstartDate,endDate: Dateduration: number (hours) - ADD if missing
File: /models/WorkloadScore.js
Add fields:
{
taskScore: Number, // Workload from tasks only
eventScore: Number, // Workload from events only
dailyScore: Number, // Total (task + event)
// ... existing fields
}- β
Update
/services/workload.js- Include events in calculation - β
Update
/services/collision.js- Count events in collision - β
Update
/frontend/pages/student.html- Display events
- Update
/services/volatility.js- Include event spikes - Update
/services/recovery.js- Events can be rest days - Add event duration field to CalendarEvent model
- Update Signal model to track event-based signals
- Add event vs task breakdown in analytics
- Add "event-heavy week" warnings
Input Data:
- 2 Exam tasks (deadline: Feb 10)
- 1 Project task (deadline: Feb 12)
- Student Tour event (Feb 8)
- Welfare Visit event (Feb 10)
- Course Registration event (Feb 9)
Workload Calculation:
Only counts 3 tasks:
- Daily score = Exam(3x5h) + Exam(3x4h) + Project(2.5x8h) = 47h
- Events = 0 (ignored)
- Total = 47h
Collision Detection:
Week of Feb 8-14:
- Major tasks: 2 (exams)
- Total hours: 47h
- Collision? NO (needs β₯3 major OR β₯50h)
Burnout Score:
- Collision: 0 (no collision)
- Volatility: 15 (maybe spike from last week)
- Recovery: 0 (not enough data)
- Drift: 0 (grades OK)
- TOTAL: 15 β LOW RISK β
Student Dashboard:
- Burnout Risk: LOW β
- Workload Chart: Shows 47h β
- Upcoming Tasks: Shows 3 tasks β
- Upcoming Events: MISSING β
Workload Calculation:
Tasks: 47h
Events:
- Student Tour: 8 (exam-type) Γ 3h = 24
- Welfare Visit: 8 Γ 3h = 24
- Registration: 4 Γ 3h = 12
- Total event score = 60
Combined daily score = 107h for the week
Collision Detection:
Week of Feb 8-14:
- Major items: 2 exams + 2 major events = 4
- Total hours: 107h
- Collision? YES (β₯3 major AND β₯50h) β
Burnout Score:
- Collision: 30 (overload detected) β
- Volatility: 20 (spike from 47h to 107h)
- Recovery: 0
- Drift: 0
- TOTAL: 50 β MEDIUM RISK β
Student Dashboard:
- Burnout Risk: MEDIUM β
- Workload Chart: Shows 107h β
- Upcoming Tasks: Shows 3 tasks β
- Upcoming Events: Shows 3 events β
- Alerts: "Deadline Overload Alert!" β
// In MongoDB or via API
CalendarEvent.find({ isInstitutional: true })
// Should return events like Student Tour, Welfare VisitGET /api/workload?days=30
Authorization: Bearer {token}
# BEFORE FIX:
{
"date": "2026-02-10",
"dailyScore": 47,
"taskCount": 3,
"eventCount": 0 β
}
# AFTER FIX:
{
"date": "2026-02-10",
"dailyScore": 107,
"taskScore": 47,
"eventScore": 60,
"taskCount": 3,
"eventCount": 3 β
}GET /api/burnout/analysis
Authorization: Bearer {token}
# BEFORE FIX:
{
"score": 15,
"risk": "low",
"reasons": []
}
# AFTER FIX:
{
"score": 50,
"risk": "medium",
"reasons": [
"4 major deadlines/events in next 7 days",
"Workload increased by 127%"
],
"signals": {
"collision": {
"hasCollision": true,
"count": 4,
"tasks": 2,
"events": 2 β
}
}
}- Refresh page
- Should see "Upcoming Events" section
- Should see higher burnout score
- Workload chart should show spikes on event days
- β Workload calculation only counted tasks
- β Calendar events were isolated in their own feature
- β No integration between calendar and burnout system
- β Student dashboard didn't display events
- β Fetch events alongside tasks in workload calculation
- β Assign appropriate weights to event types
- β Include events in all 4 burnout detectors
- β Display events on student dashboard
- β Combine task + event data in all analyses
- Accuracy: Burnout prediction is only as good as the data
- Completeness: Missing 50% of workload = Wrong predictions
- User Trust: Students won't trust "LOW RISK" when they're overwhelmed
- Proctor Effectiveness: Can't intervene if system doesn't detect issues
- Read this document thoroughly
- Review the provided fix files
- Implement backend changes first
- Test each change individually
- Update frontend last
- Verify with test data
Ready for the detailed fix implementation! πͺ