Skip to main content

Database Models

The application uses SQLAlchemy with PostgreSQL. Models are defined in app.common.models.

User

Stores user profile information.

  • username (PK): Unique identifier.
  • password_hash: Hashed password.
  • learning_goals, prior_knowledge, learning_style: Personalization fields.

Topic

Represents a subject the user is learning.

  • id (PK)
  • name: Name of the topic.
  • user_id: Owner of the topic.
  • study_plan: JSON list of steps.

Relationships:

  • steps: One-to-Many with StudyStep.
  • quizzes: One-to-Many with Quiz.
  • flashcards: One-to-Many with Flashcard.

StudyStep

A single unit of learning within a Topic.

  • topic_id: FK to Topic.
  • step_index: Order in the plan.
  • content: Markdown text of the lesson.
  • questions: JSON list of assessment questions.
  • user_answers: JSON record of user's answers.

Quiz

A standalone quiz generated for a topic.

  • questions: JSON list of multiple-choice questions.
  • score: Float representing performance.

Flashcard

Vocabulary builder tool.

  • term: The concept.
  • definition: The explanation.