pdf-quiz-generator/backend/app/schemas/attempt.py
ifedan-ed b876f13fac Initial commit: PDF Quiz Generator app
- FastAPI backend with JWT auth, roles (admin/moderator/user)
- PDF upload (up to 500MB) with streaming, PyMuPDF text extraction
- ChromaDB vectorization per page with metadata
- LiteLLM AI question extraction from PDF (not generation)
- Image extraction from PDF pages, graceful fallback
- Quiz modes: timed (countdown timer) + learning (answers shown inline)
- Page-by-page question navigation with dot navigator
- TTS endpoint using LiteLLM (Google Vertex / OpenAI voices)
- Admin dashboard: AI model management per task, user role management
- Moderator role: upload PDFs, create sections, generate quizzes
- Spaced repetition reminders via SMTP email (SM-2 intervals)
- APScheduler daily reminder jobs
- Celery + Redis for background PDF processing
- React frontend with all pages
- Docker Compose deployment (nginx + backend + celery + redis)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 20:04:53 +00:00

60 lines
1.1 KiB
Python

from datetime import datetime
from pydantic import BaseModel
class AnswerSubmission(BaseModel):
question_id: int
user_answer: str
class AttemptSubmit(BaseModel):
answers: list[AnswerSubmission]
class AnswerDetail(BaseModel):
question_id: int
question_text: str
question_type: str
user_answer: str
correct_answer: str
is_correct: bool
explanation: str | None
class Config:
from_attributes = True
class AttemptResponse(BaseModel):
id: int
quiz_id: int
score: int
total_questions: int
percentage: float
started_at: datetime
completed_at: datetime | None
class Config:
from_attributes = True
class AttemptDetail(AttemptResponse):
answers: list[AnswerDetail] = []
# Stats schemas
class QuizStats(BaseModel):
quiz_id: int
quiz_title: str
attempts_count: int
best_score: float
latest_score: float
average_score: float
class DashboardStats(BaseModel):
total_documents: int
total_quizzes: int
total_attempts: int
average_score: float
quiz_stats: list[QuizStats] = []