-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Exam Content Prediction Engine
Linear Issue: SSC-14
Priority: High
Feature Type: Premium Feature (STUDENT_PLUS/UNIVERSITY subscription only)
Overview
Build an intelligent exam prediction system that analyzes lecture content, concept importance, professor emphasis patterns, and historical study data to predict likely exam content and generate focused study recommendations.
This is a KEY DIFFERENTIATOR feature for StudySync.
Current State
- Knowledge Graph: Concept extraction with importance scores exists
- Embeddings: Semantic search and similarity working
- Study Tracking: QuizAttempt, StudySession, Flashcard models exist
- Feature Gating: `examPrediction` is gated to STUDENT_PLUS+ in pricing config
Implementation Plan
📄 Full implementation plan: docs/SSC-14-IMPLEMENTATION-PLAN.md
Phase 1: Database Schema (Commits 1-3)
Commit 1: Create ExamPrediction model
```prisma
model ExamPrediction {
id String @id @default(cuid())
userId String
title String // "Midterm 1", "Final Exam"
examDate DateTime?
courseContext String?
status PredictionStatus @default(ACTIVE)
overallReadiness Float @default(0) // 0-100 readiness score
generatedAt DateTime @default(now())
updatedAt DateTime @updatedat
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
topicPredictions TopicPrediction[]
studyPlan StudyPlan?
actualExam ActualExamResult?
@@index([userId])
}
enum PredictionStatus {
ACTIVE
COMPLETED
ARCHIVED
}
```
Commit 2: Create TopicPrediction model
```prisma
model TopicPrediction {
id String @id @default(cuid())
examPredictionId String
conceptId String?
topicName String
probability Float // 0-100 likelihood
confidence Float @default(0.7)
difficulty String @default("medium")
importanceScore Float @default(0.5)
emphasisScore Float @default(0.5)
studyStatus StudyStatus @default(NOT_STARTED)
currentMastery Float @default(0)
recommendedTime Int @default(60) // minutes
reasoning String?
examPrediction ExamPrediction @relation(...)
concept Concept? @relation(...)
@@index([examPredictionId])
}
enum StudyStatus {
NOT_STARTED
IN_PROGRESS
NEEDS_REVIEW
MASTERED
}
```
API Endpoints
| Method | Endpoint | Description |
|---|---|---|
| POST | `/api/predictions` | Create new prediction |
| GET | `/api/predictions` | List user's predictions |
| GET | `/api/predictions/:id` | Get prediction details |
| PUT | `/api/predictions/:id` | Update prediction |
| DELETE | `/api/predictions/:id` | Delete prediction |
| GET | `/api/predictions/:id/study-plan` | Get study plan |
| PUT | `/api/predictions/:id/study-plan` | Update study progress |
| GET | `/api/predictions/:id/readiness` | Get readiness assessment |
| POST | `/api/predictions/:id/feedback` | Submit exam feedback |
| GET | `/api/predictions/accuracy` | Historical accuracy stats |
All endpoints require STUDENT_PLUS+ subscription.
Checklist
Database
- Create ExamPrediction model
- Create TopicPrediction model
- Create StudyPlan model
- Create ActualExamResult model
- Add enums: PredictionStatus, StudyStatus
- Run migrations
Backend - Prediction Service
- Create `examPrediction.service.ts`
- Implement `generatePrediction()`
- Implement `detectEmphasis()`
- Implement `calculateProbabilities()`
- Implement `generateStudyPlan()`
- Implement `calculateReadiness()`
- Implement `recordActualExamResult()`
Backend - AI Analysis
- Create `emphasisDetection.service.ts`
- AI prompt for emphasis detection
- Pattern recognition for question types
Backend - API
- Create `examPrediction.controller.ts`
- Create `examPrediction.routes.ts`
- Add subscription middleware (STUDENT_PLUS+)
- Wire up all endpoints
Frontend
- Create `exam-prediction-api.ts`
- Create exam prediction context
- Create exam-prep page
- Create PredictionCard component
- Create TopicProbabilityList component
- Create ReadinessGauge component
- Create StudyPlanTimeline component
- Create prediction wizard
- Create feedback modal
Success Criteria
- All 18 commits completed
- 70%+ prediction accuracy (via feedback loop)
- Predictions generate in <5 seconds
- Study plans consider probability + mastery
- Post-exam feedback recorded
- Feature gated to STUDENT_PLUS+
- Mobile-responsive design
Dependencies
This feature depends on:
- Knowledge Graph (SSC-11) ✅ Complete
- Analytics Dashboard (SSC-17) - For mastery data integration