Skip to main content
A 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

card_id
string
required
Unique identifier for this card. Auto-generated as a UUID v4 on creation. Stable across serialization round-trips.
question
string
required
The question text presented to the learner.
options
string[]
required
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.
correct_answers
string[]
required
List of correct option letter keys. Single-answer cards use one entry (["B"]); multi-answer cards use multiple (["A", "C"]).
question_type
string
default:"single_choice"
Discriminates between answer modes.
ValueMeaning
single_choiceExactly one correct answer
multiple_choiceTwo or more correct answers
unknownType could not be determined (e.g. AI extraction fallback)
image_path
string | null
default:"null"
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.
notes
string
default:""
Free-form text notes attached to this card. Cards generated by the AI pipeline receive an automatic warning note indicating they should be reviewed.
status
integer
default:"0"
Study progress state of this card.
ValueLabelColor
0UnseenGray
1Learning / WrongOrange
2Mastered / CorrectGreen
Changing status semantics is a high-risk operation — both the desktop and mobile clients depend on these integer values.

Methods

to_dict()dict

Serializes the flashcard to a JSON-serializable dictionary. The question_type enum is stored as its string value.
card_id
string
required
UUID string.
question
string
required
Question text.
options
string[]
required
List of answer option strings.
correct_answers
string[]
required
List of correct option letter keys.
question_type
string
required
Serialized enum value: "single_choice", "multiple_choice", or "unknown".
image_path
string | null
required
Absolute path to the source image, or null.
notes
string
required
Notes text (may be empty string).
status
integer
required
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_typeTerm sideDefinition side
"simple"Question text onlyFull correct answer text
"full"Question >> A | B | CFull correct answer text
"compact"Question [A | B | C]Correct answer letter(s)
"safe"Uses {[(CauHoi)]} / {[(DapAn)]} separators for Quizlet custom importFull correct answer text
Use "safe" format when importing into Quizlet with a custom separator configuration to avoid conflicts with tab or newline characters in question text.

JSON example

{
  "card_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "question": "What is the capital of France?",
  "options": [
    "A. London",
    "B. Paris",
    "C. Berlin",
    "D. Madrid"
  ],
  "correct_answers": ["B"],
  "question_type": "single_choice",
  "image_path": "/Users/alex/scans/geography_slide_03.png",
  "notes": "",
  "status": 0
}

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.

Build docs developers (and LLMs) love