Convert medical textbook content, lecture notes, and study materials into Anki flashcards using spaced repetition optimization. Supports multiple card types (basic, cloze, image occlusion) with automated tagging and deck organization for efficient medical exam preparation.
Intelligent flashcard generation tool that transforms medical study materials into Anki-compatible cards optimized for long-term retention through evidence-based spaced repetition.
Key Capabilities:
✅ Use this skill when:
❌ Do NOT use when:
Integration:
abstract-summarizer (textbook chapter condensation), pdf-text-extractor (content extraction)anki-sync-server (cloud backup), study-schedule-optimizer (review planning)Create fill-in-the-blank cards from dense text:
from scripts.card_creator import AnkiCardCreator
creator = AnkiCardCreator()
# Generate cloze cards from text
text = """
Acute inflammation is characterized by five cardinal signs:
redness (rubor), heat (calor), swelling (tumor), pain (dolor),
and loss of function (functio laesa). These result from
vasodilation, increased vascular permeability, and leukocyte
infiltration.
"""
cards = creator.create_cloze_cards(
text=text,
n_cards=3, # Generate 3 cards from this text
difficulty="intermediate",
tags=["Pathology", "Inflammation", "General_Pathology"]
)
# Output format (Anki-compatible)
# Card 1: "Acute inflammation is characterized by {{c1::five}} cardinal signs..."
# Card 2: "...signs: {{c1::redness}} (rubor), {{c2::heat}} (calor)..."
Cloze Strategies:
| Strategy | Use Case | Example |
|---|---|---|
| Single Deletion | Key facts | "The {{c1::liver}} is the largest internal organ" |
| Multiple Deletions | Lists/groups | "CRAB symptoms: {{c1::Calcium}}, {{c2::Renal}}, {{c3::Anemia}}, {{c4::Bone}}" |
| Hierarchical | Progressive detail | "{{c1::Metformin}} is a {{c2::biguanide}} that {{c3::decreases hepatic glucose production}}" |
Generate question-answer pairs:
# Create basic cards
cards = creator.create_basic_cards(
content={
"What is the mechanism of action of penicillin?":
"Inhibition of bacterial cell wall synthesis by binding to PBPs",
"What are the major side effects of ACE inhibitors?":
"Dry cough, hyperkalemia, angioedema, hypotension"
},
reversible=True, # Create reverse cards too
tags=["Pharmacology", "Antibiotics"]
)
Card Types:
Create visual learning cards from diagrams:
# Image occlusion for anatomy
cards = creator.create_image_occlusion(
image_path="brachial_plexus.png",
occlude_regions=[
{"label": "Musculocutaneous nerve", "coords": (120, 200, 200, 240)},
{"label": "Median nerve", "coords": (300, 250, 380, 290)},
{"label": "Ulnar nerve", "coords": (400, 280, 480, 320)}
],
card_type="one_by_one" # or "all_at_once"
)
Occlusion Types:
Automatically organize cards into logical hierarchies:
# Auto-tag based on content
cards = creator.process_textbook_chapter(
chapter_text=pathoma_chapter,
source="Pathoma - Hematopoiesis",
auto_tag=True,
tag_hierarchy=[
"Pathoma",
"{{chapter_name}}",
"{{section_name}}"
]
)
# Results in tags like:
# Pathoma::Hematopoiesis::Red_Cell_Disorders
# Pathoma::Hematopoiesis::White_Cell_Disorders
Tagging Strategies:
Scenario: Convert entire First Aid chapter to Anki deck.
# Extract and convert chapter
python scripts/main.py \
--input first_aid_cardiology.pdf \
--chapter "Ischemic Heart Disease" \
--card-type cloze \
--n-cards-per-page 3 \
--tags "First_Aid::Cardiology::IHD" \
--output ischemic_heart_disease.apkg
# Import directly to Anki
# File ready for import with media included
Workflow:
Scenario: Create comprehensive pharmacology cards.
# Generate drug cards with mechanisms
drugs = [
{
"name": "Metformin",
"class": "Biguanide",
"mechanism": "Activates AMPK, decreases hepatic gluconeogenesis",
"indications": "Type 2 diabetes, PCOS",
"side_effects": "GI upset, lactic acidosis (rare), B12 deficiency",
"image": "metformin_structure.png"
}
]
cards = creator.create_drug_cards(
drugs=drugs,
include_structures=True,
include_mechanism_diagrams=True,
tags=["Pharmacology", "Diabetes", "First_Line"]
)
Card Format:
Front: Metformin - Class?
Back: Biguanide
Tags: Pharmacology::Diabetes::First_Line
Front: Metformin - Mechanism?
Back: Activates AMPK → decreases hepatic gluconeogenesis
Image: [mechanism diagram]
Tags: Pharmacology::Diabetes::Mechanism
Front: Metformin - Side effects?
Back: GI upset, lactic acidosis (rare), B12 deficiency
Tags: Pharmacology::Diabetes::Side_Effects
Scenario: Create cards for differential diagnosis practice.
# Differential diagnosis cards
cards = creator.create_differential_cards(
condition="Cough with hemoptysis",
differentials=[
{"diagnosis": "Lung cancer", "key_features": "Smoker, weight loss, mass on CT"},
{"diagnosis": "TB", "key_features": "Immigrant, night sweats, cavitary lesion"},
{"diagnosis": "PE", "key_features": "Sudden onset, tachypnea, D-dimer elevated"},
{"diagnosis": "Bronchiectasis", "key_features": "Chronic cough, purulent sputum, dilated airways"}
],
card_type="compare_contrast"
)
Card Types:
Scenario: Convert professor's lecture slides to study cards.
# Process lecture PDF
python scripts/main.py \
--input lecture_slides.pdf \
--source "Dr_Smith_Cardiology_Lecture_5" \
--card-type mixed \
--extract-images \
--auto-tag \
--output cardiology_lecture_5.apkg
# Review and edit in Anki
# Delete low-yield cards
# Add personal mnemonics
Post-Processing Tips:
Building comprehensive USMLE Step 1 deck:
# Step 1: Process multiple sources
python scripts/main.py \
--input first_aid_pathology.pdf \
--source "First_Aid_2024" \
--card-type cloze \
--tags "First_Aid::Pathology" \
--output fa_pathology.apkg
python scripts/main.py \
--input sketchy_pharm.pdf \
--source "Sketchy_Pharm" \
--card-type basic \
--include-images \
--tags "Sketchy::Pharm" \
--output sketchy_pharm.apkg
# Step 2: Merge decks
python scripts/main.py \
--merge fa_pathology.apkg sketchy_pharm.apkg \
--output usmle_step1_master.apkg
# Step 3: Add leech tags for difficult cards
python scripts/main.py \
--input usmle_step1_master.apkg \
--tag-leeches \
--leech-threshold 8 \
--output usmle_step1_tagged.apkg
Python API:
from scripts.card_creator import AnkiCardCreator
from scripts.importers import PDFImporter
# Initialize
creator = AnkiCardCreator()
importer = PDFImporter()
# Import and process textbook
content = importer.import_pdf(
path="robbins_pathologic_basis_of_disease.pdf",
pages="150-200", # Inflammation chapter
extract_images=True
)
# Create cloze cards
cards = creator.create_cloze_cards(
text=content.text,
images=content.images,
n_cards=50,
difficulty="advanced",
tags=["Robbins", "General_Pathology", "Inflammation"]
)
# Add image occlusion for diagrams
for diagram in content.diagrams:
occlusion_cards = creator.create_image_occlusion(
image=diagram,
auto_detect_labels=True
)
cards.extend(occlusion_cards)
# Export Anki package
creator.export_apkg(
cards=cards,
deck_name="Robbins_Inflammation",
output_path="robbins_inflammation.apkg"
)
print(f"Created {len(cards)} cards ready for Anki import")
Card Quality:
Educational Value:
Technical Quality:
Before Study:
Content Issues:
❌ Too much information → "Cramming" cards with multiple facts
❌ Memorization without understanding → Memorizing without context
❌ Outdated information → Old guidelines or disproven theories
Card Design Issues:
❌ Ambiguous clozes → "The {{c1::liver}} produces {{c2::bile}}" (which one is being asked?)
❌ Overlapping cards → Testing same fact multiple ways
❌ Recognition vs. recall → Cards too easy (recognition only)
Study Strategy Issues:
❌ Too many new cards → 100+ new cards/day leads to burnout
❌ No review of missed cards → Ignoring leeches
❌ Passive card creation → Making cards without studying
Available in references/ directory:
anki_format_spec.md - Anki .apkg file format specificationsspaced_repetition_principles.md - Evidence-based SRS guidelinescard_design_best_practices.md - Effective flashcard designusmle_high_yield_facts.md - High-yield content for boardsimage_sources.md - Open-access medical imagestagging_conventions.md - Standardized tag hierarchiesLocated in scripts/ directory:
main.py - CLI interface for card creationcard_creator.py - Core card generation enginecloze_generator.py - Cloze deletion algorithmsimage_occlusion.py - Visual card creationpdf_importer.py - Textbook and slide importtag_manager.py - Automated tagging systemmedia_handler.py - Image download and optimizationanki_exporter.py - .apkg file generation| Parameter | Type | Default | Required | Description |
|---|---|---|---|---|
--input, -i | string | - | No | Input text file with Q&A pairs |
--output, -o | string | anki_cards.txt | No | Output file (Anki TSV format) |
--drug | flag | - | No | Create drug information card |
--anatomy | flag | - | No | Create anatomy card |
--name | string | - | No | Drug or structure name |
--mechanism | string | - | No | Mechanism of action (for drug cards) |
--indications | string | - | No | Clinical indications (for drug cards) |
--side-effects | string | - | No | Side effects (for drug cards) |
--location | string | - | No | Anatomical location (for anatomy cards) |
--function | string | - | No | Function (for anatomy cards) |
# Create drug card
python scripts/main.py --drug --name "Metformin" --mechanism "Decreases hepatic glucose production" --indications "Type 2 diabetes" --output metformin.txt
# Create anatomy card
python scripts/main.py --anatomy --name "Coronary arteries" --location "Surface of heart" --function "Supply oxygenated blood to myocardium" --output coronary.txt
# Parse Q&A file
python scripts/main.py --input questions.txt --output deck.txt
Q: What is the mechanism of action of Metformin?
A: Decreases hepatic glucose production, increases insulin sensitivity
Q: Which artery supplies the left ventricle?
A: Left anterior descending artery (LAD)
| Risk Indicator | Assessment | Level |
|---|---|---|
| Code Execution | Python script executed locally | Low |
| Network Access | No external API calls | Low |
| File System Access | Read input file, write to output file | Low |
| Instruction Tampering | Standard prompt guidelines | Low |
| Data Exposure | Output saved only to specified location | Low |
# Python 3.7+
# No additional packages required (uses standard library)
🧠 Study Tip: The best flashcard is one you'll actually review. Create cards for material you genuinely need to memorize, and keep the daily review load sustainable. Quality over quantity—better to deeply learn 1000 cards than superficially memorize 5000.