Chapter 8 — Teacher Management & Academic Workspace
ShippedComplete teacher-facing workspace covering profile management, homework, student observations, leave management, performance analytics, and Elite AI Copilot tools powered by Gemini 2.0 Flash.
Basic Tier — All Schools
- Teacher Profile & Identity (§8.1–8.10)
- Subject & Class Teacher Assignments (§8.11–8.20)
- Homework Management (§8.26–8.28)
- Student Observations (§8.37–8.38)
- Leave Management with Substitute (§8.41–8.42)
- Performance Analytics (§8.43–8.44)
Elite Tier — AI Copilot Tools
- Worksheet Generator (§8.46)
- Quiz Generator (§8.47)
- Evaluation Assistant (§8.48)
- Report Card Comments (§8.49)
- Observation Assistant (§8.50)
- Teacher Copilot / Chat (§8.51)
- Class Recording Summary (§8.45)
Guarded by checkEliteTier middleware (backend) + EliteGuard component (frontend)
Basic Tier — Feature Details
Teacher Profile & Identity (§8.1–8.10)
- TeacherProfile model supplements the User document (one-to-one)
- Employee ID, department, designation, joining date, employment type (full-time / part-time / contract / guest / visiting)
- Qualifications array: degree, university, year of completion, specialization, certificate URL
- Status state machine: pending → active → on_leave → suspended → inactive → archived
- Emergency contact, bio, and comprehensive metrics object
- Admin can search, filter by status/employment-type, and view subject & class-teacher summary
Subject & Class Teacher Assignments (§8.11–8.20)
- Subject assignments array: subject, class, section, academic year, isActive flag
- PATCH /api/teacher-profiles/:id/subject-assignments — full array replacement
- Class teacher assignment: PATCH /api/teacher-profiles/:id/class-teacher (stored as classTeacherOf[] on TeacherProfile)
- Dashboard summary: today's sessions, this-month sessions, class teacher status
- Admin view: school-wide teacher list with subject counts badges
- Teacher-profile CRUD UI lives on the admin side (dashboard/admin/teachers), not under dashboard/teacher/ — teachers themselves only hit GET dashboard-summary and GET/PUT their own :id
Homework Management (§8.26–8.28)
- Homework model separate from Assignments (lighter-weight, class-level)
- Lifecycle: draft → published → closed
- PATCH /api/homework/:id/publish — publishes to students at a point in time
- Student submission subdocs: content, attachments, status, feedback, marks, reviewedAt
- POST /api/homework/:id/submit — deadline check, duplicate prevention
- PATCH /api/homework/:id/review/:studentId — marks + feedback per student
- GET /api/homework/student/my — student's own homework with submission status
- Frontend: list with status filter tabs, create modal, view submissions modal
- Mobile: FlatList with filter chips, create modal, publish button on draft items
Student Observations (§8.37–8.38)
- Observation types: academic / behavior / participation / leadership / health / other
- Visibility levels: private / shared / parent_visible
- Follow-up system: followUpRequired flag, followUpDate, PATCH /complete-followup
- Tags for cross-observation filtering
- GET /api/teacher-observations/student/:studentId — student-level view for parents/admin
- Frontend: type-filter chip row, create modal with visibility selector
- Mobile: color-coded type badges, follow-up completion button per card
Teacher Leave Management (§8.41–8.42)
- Leave types: casual / sick / earned / maternity / paternity / emergency / duty / other
- Auto-computed totalDays in pre-save Mongoose hook
- Status flow: pending → approved / rejected; teacher can cancel pending only
- PATCH /api/teacher-leaves/:id/review — admin approves or rejects with remarks
- Substitute management: assign substitute teacher, notes, assignedBy, assignedAt
- GET /api/teacher-leaves/available-substitutes — teachers without conflicting approved leaves
- Frontend: apply modal, cancel button for pending leaves, substitute info card
- Mobile: status-filter chips, leave type selector, date inputs, Alert confirm for cancel
Teacher Analytics & Performance (§8.43–8.44)
- GET /api/teacher-analytics/my — personal overview (sessions, completion rate, homework, quizzes, assignments, subjects, leave days, isClassTeacher)
- Monthly session trend via MongoDB aggregation ($group by year+month)
- Subject breakdown: sessions grouped by course name
- GET /api/teacher-analytics/school — admin view: sessions per teacher this month
- GET /api/teacher-analytics/workload — subject counts assignments per teacher
- Frontend: stat cards grid, bar chart for monthly trend, progress bars for subject breakdown
- Mobile: scrollable stats grid with colored left borders, bar chart, progress bars
Elite Tier — AI Copilot Tools (§8.45–8.51)
All AI endpoints POST to /api/teacher-ai/<tool> and require thecheckEliteTier middleware. Powered by Google Gemini 2.0 Flash. Responses are structured JSON for easy rendering.
Worksheet Generator (§8.46)
POST /api/teacher-ai/worksheet-generator — topic, subject, grade → structured worksheet JSON with title, instructions, and questions array.
Quiz Generator (§8.47)
POST /api/teacher-ai/quiz-generator — topic, subject, grade → quiz JSON with MCQ and short-answer questions including correct answers.
Evaluation Assistant (§8.48)
POST /api/teacher-ai/evaluation-assistant — expectedAnswer, studentAnswer, optional rubric → suggestedMarks, percentage, grade, detailedFeedback.
Report Card Comments (§8.49)
POST /api/teacher-ai/report-card-comments — studentName, grade, subject → 3 comment variations (encouraging / formal / balanced).
Observation Assistant (§8.50)
POST /api/teacher-ai/observation-assistant — raw teacher notes → structured observation JSON (type, title, content, tags, followUpRequired).
Teacher Copilot (§8.51)
POST /api/teacher-ai/copilot — free-form question + subject → answer, keyPoints[], tips[]. The general-purpose AI assistant for teachers.
Class Recording Summary (§8.45)
POST /api/teacher-ai/recording-summary — summarizes an uploaded class recording into key topics, homework mentioned, and action items (generateRecordingSummary in teacherAiCopilotController.js).
API Endpoints Summary
Frontend Pages
Real pages under src/app/dashboard/teacher/. Note the folder is singularleave/, not leaves/. A separatedashboard/teacher/copilot page is a distinct Storybook-AI-style copilot (Chapter 24), not the same as the ai-tools page's Teacher Copilot tab documented above. Teacher-profile CRUD lives at dashboard/admin/teachers (admin-side).