Flashcard represents a single question with answer options, correct answer tracking, and study-progress state. It is the core unit stored inside a Deck.
Fields
Unique identifier for this card. Auto-generated as a UUID v4 on creation. Stable across serialization round-trips.
The question text presented to the learner.
Ordered list of answer choices. Each entry is prefixed with a letter and separator, e.g.
"A. London", "B. Paris". The prefix letters are used as keys in correct_answers.List of correct option letter keys. Single-answer cards use one entry (
["B"]); multi-answer cards use multiple (["A", "C"]).Discriminates between answer modes.
| Value | Meaning |
|---|---|
single_choice | Exactly one correct answer |
multiple_choice | Two or more correct answers |
unknown | Type could not be determined (e.g. AI extraction fallback) |
Absolute local path to the source image file from which this card was extracted.
null for manually created cards.Image paths are device-specific. The Smart Merge sync bypasses overwriting this field to prevent cross-device path corruption.
Free-form text notes attached to this card. Cards generated by the AI pipeline receive an automatic warning note indicating they should be reviewed.
Study progress state of this card.
| Value | Label | Color |
|---|---|---|
0 | Unseen | Gray |
1 | Learning / Wrong | Orange |
2 | Mastered / Correct | Green |
Methods
to_dict() → dict
Serializes the flashcard to a JSON-serializable dictionary. The question_type enum is stored as its string value.
UUID string.
Question text.
List of answer option strings.
List of correct option letter keys.
Serialized enum value:
"single_choice", "multiple_choice", or "unknown".Absolute path to the source image, or
null.Notes text (may be empty string).
Integer progress state:
0, 1, or 2.from_dict(data) → Flashcard
Deserializes a Flashcard from a dictionary (e.g. parsed JSON). Missing fields fall back to defaults — a new card_id UUID is generated if card_id is absent.
get_correct_answer_text() → str
Resolves each entry in correct_answers to the full option text from options. Supports both letter-key format ("B") and full-text format (the answer is already the full string). Multiple correct answers are joined with |.
Returns "Unknown" if no answers can be resolved.
to_quizlet_row(format_type) → str
Exports this card as a Quizlet-compatible tab-separated row. The format_type parameter controls how question and answer are formatted.
format_type | Term side | Definition side |
|---|---|---|
"simple" | Question text only | Full correct answer text |
"full" | Question >> A | B | C | Full correct answer text |
"compact" | Question [A | B | C] | Correct answer letter(s) |
"safe" | Uses {[(CauHoi)]} / {[(DapAn)]} separators for Quizlet custom import | Full correct answer text |
JSON example
See also
Deck
The container that holds a list of Flashcard objects.
QuizSession
Tracks progress and answer history for a quiz run over a deck.