Models¶
This section documents the data models used in the PhonoLab backend.
Phoneme Models¶
Vowel
¶
Bases: Model
Database model representing a vowel phoneme in the PhonoLab system.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
Unique identifier for the vowel. |
phoneme |
str
|
The IPA symbol for the vowel. |
name |
str
|
Human-readable name for the vowel. |
audio_url |
str
|
URL to the audio file demonstrating the vowel sound. |
Relationships: word_examples: One-to-many relationship with WordExample model. lesson: One-to-one relationship with Lesson model (via backref).
Source code in src/models/phoneme.py
get_lesson_card
¶
Return a dictionary with the lesson card information.
Source code in src/models/phoneme.py
WordExample
¶
Bases: Model
Database model representing example words that contain specific vowel sounds.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
int
|
Unique identifier for the word example. |
word |
str
|
The example word containing the target vowel. |
audio_url |
str
|
URL to the audio file of the word. |
ipa |
str
|
IPA transcription of the word. |
example_sentence |
str
|
Example sentence using the word. |
vowel_id |
str
|
Foreign key to the associated vowel. |
Relationships
vowel: Many-to-one relationship with the Vowel model.
Source code in src/models/phoneme.py
Quiz Models¶
QuizItem
¶
Bases: Model
Database model representing a quiz question in the PhonoLab system.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
int
|
Unique identifier for the quiz item. |
prompt_word |
str
|
The word presented as the quiz question. |
prompt_audio_url |
str
|
URL to the audio file of the prompt word. |
prompt_ipa |
str
|
IPA transcription of the prompt word. |
feedback_correct |
str
|
Feedback for correct answers. |
feedback_incorrect |
str
|
Feedback for incorrect answers. |
vowel_id |
str
|
Foreign key to the associated vowel. |
Relationships
vowel: Many-to-one relationship with the Vowel model. options: One-to-many relationship with QuizOption model.
Source code in src/models/quiz.py
QuizOption
¶
Bases: Model
Database model representing an answer option for a quiz question.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
int
|
Unique identifier for the quiz option. |
word |
str
|
The word presented as an answer option. |
ipa |
str
|
IPA transcription of the option word. |
audio_url |
str
|
URL to the audio file of the option word. |
is_correct |
bool
|
Whether this option is the correct answer. |
language |
str
|
Language identifier for the word. |
quiz_item_id |
int
|
Foreign key to the associated quiz item. |
Relationships
quiz_item: Many-to-one relationship with the QuizItem model.
Source code in src/models/quiz.py
Lesson Model¶
Lesson
¶
Bases: Model
Database model representing a lesson on a specific vowel phoneme.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
int
|
Unique identifier for the lesson. |
vowel_id |
str
|
Foreign key to the associated vowel. |
Relationships
vowel: One-to-one relationship with the Vowel model.