Spaces:
Paused
Paused
| 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 |