DocDoeAI / app /schemas /intelligence.py
asnannp's picture
Deploy backend cd4237ff: support routes + rate limit + exam_date nullable + upload 413 fix
7c6ffa6
Raw
History Blame Contribute Delete
2.72 kB
from typing import Literal, Any, List, Optional
from pydantic import BaseModel, Field
# 1. Student Level Detection
class DiagnosticQuestion(BaseModel):
id: str
question: str
options: List[str]
correct_answer_index: int
category: Literal["concept", "memory", "diagram", "answer_writing", "problem_solving"]
class DiagnosticQuiz(BaseModel):
id: str
document_id: str
questions: List[DiagnosticQuestion]
class DiagnosticAnswer(BaseModel):
question_id: str
answer_index: int
class DiagnosticResultRequest(BaseModel):
document_id: str
answers: List[DiagnosticAnswer]
class DiagnosticResultResponse(BaseModel):
student_level: Literal["beginner", "intermediate", "advanced"]
weak_areas: List[str] # concept, memory, etc.
analysis: str # Why this level?
# 2. What To Study Engine
class TopicItem(BaseModel):
topic: str
reason: str # Trust layer: "based on PYQ", "based on source"
class WhatToStudyResponse(BaseModel):
must_study_topics: List[TopicItem]
high_weightage_topics: List[TopicItem]
repeated_pyq_topics: List[TopicItem]
low_priority_topics: List[TopicItem]
skip_for_now_topics: List[TopicItem]
revision_keywords: List[str]
easy_marks: List[TopicItem]
danger_areas: List[TopicItem]
study_order: List[str]
# 3. Personal Study Path Engine
class StudyTimeBlock(BaseModel):
time_block: str # e.g., "00:00 - 00:30"
topic: str
reason: str
task: str
output_expected: str
revision_checkpoint: str
class StudyPathResponse(BaseModel):
plan_type: Literal["1h", "3h", "5h", "7d", "30d"]
blocks: List[StudyTimeBlock]
total_estimated_coverage: str
# 4. Exam Intelligence Output
class MarkWiseAnswer(BaseModel):
question: str
marks: int
answer_structure: str
key_points: List[str]
diagram_suggested: bool
class ExamIntelligenceResponse(BaseModel):
chapter: str
topic_importance: str # High/Medium/Low
pyq_pattern: str
likely_question_types: List[str]
answers: List[MarkWiseAnswer]
common_mistakes: List[str]
keywords_to_underline: List[str]
# 5. Video Tutor Brain (Extension)
class VideoScene(BaseModel):
scene_number: int
label: str
script_text: str = "" # renamed from 'copy' which shadows BaseModel.copy
visual_suggestion: str
class VideoPlanResponse(BaseModel):
title: str
duration_type: Literal["quick_concept", "exam_focus", "deep_masterclass", "full_chapter_war_mode"]
style: Literal["normal_teacher", "visual_tutor", "anime_tutor", "malayalam_english_tutor", "exam_war_mode"]
hook: str
analogy: str
sections: List[VideoScene]
mini_quiz: List[DiagnosticQuestion]
recap: str