Updated this to the latest version of develop, got rid of most of the duplication, might be missing some packages in toml, needs testing

This commit is contained in:
Carlos Mesquita
2024-08-30 02:35:11 +01:00
parent 3cf9fa5cba
commit f92a803d96
73 changed files with 3642 additions and 2703 deletions

View File

@@ -1,19 +0,0 @@
from .listening import SaveListeningDTO
from .speaking import (
SaveSpeakingDTO, SpeakingGradeTask1And2DTO,
SpeakingGradeTask3DTO, SpeakingGenerateVideoDTO,
SpeakingGenerateInteractiveVideoDTO
)
from .training import TipsDTO
from .writing import WritingGradeTaskDTO
__all__ = [
"SaveListeningDTO",
"SaveSpeakingDTO",
"SpeakingGradeTask1And2DTO",
"SpeakingGradeTask3DTO",
"SpeakingGenerateVideoDTO",
"SpeakingGenerateInteractiveVideoDTO",
"TipsDTO",
"WritingGradeTaskDTO"
]

57
app/dtos/exam.py Normal file
View File

@@ -0,0 +1,57 @@
from pydantic import BaseModel, Field
from typing import List, Dict, Union, Optional
from uuid import uuid4, UUID
class Option(BaseModel):
id: str
text: str
class MultipleChoiceQuestion(BaseModel):
id: str
prompt: str
variant: str = "text"
solution: str
options: List[Option]
class MultipleChoiceExercise(BaseModel):
id: UUID = Field(default_factory=uuid4)
type: str = "multipleChoice"
prompt: str = "Select the appropriate option."
questions: List[MultipleChoiceQuestion]
userSolutions: List = Field(default_factory=list)
class FillBlanksWord(BaseModel):
id: str
options: Dict[str, str]
class FillBlanksSolution(BaseModel):
id: str
solution: str
class FillBlanksExercise(BaseModel):
id: UUID = Field(default_factory=uuid4)
type: str = "fillBlanks"
variant: str = "mc"
prompt: str = "Click a blank to select the appropriate word for it."
text: str
solutions: List[FillBlanksSolution]
words: List[FillBlanksWord]
userSolutions: List = Field(default_factory=list)
Exercise = Union[MultipleChoiceExercise, FillBlanksExercise]
class Part(BaseModel):
exercises: List[Exercise]
context: Optional[str] = Field(default=None)
class Exam(BaseModel):
parts: List[Part]

View File

@@ -1,4 +1,5 @@
import random
import uuid
from typing import List, Dict
from pydantic import BaseModel
@@ -10,3 +11,4 @@ class SaveListeningDTO(BaseModel):
parts: List[Dict]
minTimer: int = MinTimers.LISTENING_MIN_TIMER_DEFAULT
difficulty: str = random.choice(EducationalContent.DIFFICULTIES)
id: str = str(uuid.uuid4())

29
app/dtos/sheet.py Normal file
View File

@@ -0,0 +1,29 @@
from pydantic import BaseModel
from typing import List, Dict, Union, Any, Optional
class Option(BaseModel):
id: str
text: str
class MultipleChoiceQuestion(BaseModel):
type: str = "multipleChoice"
id: str
prompt: str
variant: str = "text"
options: List[Option]
class FillBlanksWord(BaseModel):
type: str = "fillBlanks"
id: str
options: Dict[str, str]
Component = Union[MultipleChoiceQuestion, FillBlanksWord, Dict[str, Any]]
class Sheet(BaseModel):
batch: Optional[int] = None
components: List[Component]

View File

@@ -11,23 +11,31 @@ class SaveSpeakingDTO(BaseModel):
minTimer: int = MinTimers.SPEAKING_MIN_TIMER_DEFAULT
class SpeakingGradeTask1And2DTO(BaseModel):
class GradeSpeakingDTO(BaseModel):
question: str
answer: str
class SpeakingGradeTask3DTO(BaseModel):
answers: Dict
class GradeSpeakingAnswersDTO(BaseModel):
answers: List[Dict]
class SpeakingGenerateVideoDTO(BaseModel):
class GenerateVideo1DTO(BaseModel):
avatar: str = (random.choice(list(AvatarEnum))).value
questions: List[str]
first_topic: str
second_topic: str
class GenerateVideo2DTO(BaseModel):
avatar: str = (random.choice(list(AvatarEnum))).value
prompts: List[str] = []
suffix: str = ""
question: str
topic: str
class SpeakingGenerateInteractiveVideoDTO(BaseModel):
class GenerateVideo3DTO(BaseModel):
avatar: str = (random.choice(list(AvatarEnum))).value
questions: List[str]
topic: str

View File

@@ -1,8 +1,37 @@
from pydantic import BaseModel
from typing import List
class TipsDTO(BaseModel):
class FetchTipsDTO(BaseModel):
context: str
question: str
answer: str
correct_answer: str
class QueryDTO(BaseModel):
category: str
text: str
class DetailsDTO(BaseModel):
exam_id: str
date: int
performance_comment: str
detailed_summary: str
class WeakAreaDTO(BaseModel):
area: str
comment: str
class TrainingContentDTO(BaseModel):
details: List[DetailsDTO]
weak_areas: List[WeakAreaDTO]
queries: List[QueryDTO]
class TipsDTO(BaseModel):
tip_ids: List[str]