File size: 1,275 Bytes
1bc3f18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
from pydantic import BaseModel
from typing import List, Optional, Dict, Any, Union
from enum import Enum

class QuestionType(str, Enum):
    MULTIPLE_CHOICE = "multiple_choice"
    TRUE_FALSE = "true_false"
    SHORT_ANSWER = "short_answer"
    ESSAY = "essay"
    CODE = "code"

class StudentAnswer(BaseModel):
    question_no: int  
    question_type: QuestionType
    question_text: str
    student_response: str
    max_score: float = 1.0
    metadata: Optional[Dict[str, Any]] = {}

class GradedAnswer(BaseModel):
    question_no: int
    question_type: QuestionType
    question_text: str
    student_response: str
    correct_answer: Optional[Any] 
    score: float
    max_score: float
    feedback: str
    is_correct: bool

class ExamSubmission(BaseModel):
    exam_id: str
    course_id: str
    student_id: str
    student_name: Optional[str]
    answers: List[StudentAnswer]
    submission_time: str
    metadata: Optional[Dict[str, Any]] = {}

class ExamResult(BaseModel):
    exam_id: str
    student_id: str
    student_name: Optional[str]
    graded_answers: List[GradedAnswer]
    total_score: float
    max_total_score: float
    percentage: float
    grade: Optional[str]  
    feedback_summary: Optional[str]
    submission_time: str
    graded_time: str