explain abtianginal drugs

Reading File
Finding Sources
Searching the Web

antianginal drugs mechanisms classification pharmacology

Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Finding Sources
Finding Sources
Reading File
Finding Sources
I now have comprehensive content from authoritative sources. Let me compile the full answer.

Antianginal Drugs

Angina pectoris results from a mismatch between myocardial oxygen supply and demand. Antianginal drugs correct this by either reducing O₂ demand or increasing O₂ supply (or both). They fall into four major classes, plus newer second-line agents.

Pathophysiology Basis

Myocardial O₂ demand is determined by:
  • Heart rate (chronotropy)
  • Contractility (inotropy)
  • Wall stress = preload (ventricular filling pressure) + afterload (arterial resistance)
Any drug reducing one or more of these reduces angina in stable (exertional) angina. In vasospastic (Prinzmetal's) angina, the goal is to prevent or reverse coronary vasospasm.

Class 1: Organic Nitrates

Examples: Nitroglycerin (GTN), Isosorbide dinitrate (ISDN), Isosorbide mononitrate (ISMN)

Mechanism

Nitrates are bioconverted to nitric oxide (NO), which activates soluble guanylyl cyclase → ↑ cGMP → dephosphorylation of myosin light chains → smooth muscle relaxation and vasodilation.
Key hemodynamic effects:
  • Venodilation (primary) → ↓ preload → ↓ ventricular wall stress → ↓ O₂ demand
  • Arterial dilation (at higher doses) → ↓ afterload
  • Direct coronary vasodilation → relief of vasospasm; redistributes flow to ischemic subendocardium
  • In ACS: IV nitroglycerin rapidly titrated; contraindicated within 24 h of PDE5 inhibitor use (risk of profound hypotension)

Uses

  • Sublingual GTN: acute angina attack (onset 1–3 min)
  • Long-acting nitrates/patches: prophylaxis of stable angina
  • Vasospastic angina (first-line)

Tolerance

Continuous nitrate exposure causes nitrate tolerance (loss of efficacy). A daily nitrate-free interval of 8–12 hours is required (e.g., patch off at night).

Adverse Effects

Headache (most common — vasodilation of meningeal vessels), postural hypotension, reflex tachycardia, flushing.

Class 2: Beta-Blockers (β-Adrenoceptor Antagonists)

Examples: Metoprolol, Atenolol, Bisoprolol, Propranolol (non-selective), Carvedilol

Mechanism

Block β₁ receptors in the heart:
  • ↓ Heart rate (chronotropy)
  • ↓ Contractility (inotropy)
  • ↓ AV conduction velocity
Net effect: ↓ myocardial O₂ consumption, especially during exercise. Also blunt sympathetic activation.

Uses

  • First-line for chronic stable angina (ACC/AHA and ESC guidelines recommend β-blockers as preferred initial therapy)
  • Post-MI (reduce mortality)
  • Preferred when angina coexists with hypertension, heart failure, or arrhythmias

Combination with nitrates

Beta-blockers block the reflex tachycardia triggered by nitrate-induced vasodilation. Nitrates counteract the ↑ end-diastolic volume (preload) caused by β-blockade. The combination is synergistic.

Adverse Effects

Bradycardia, fatigue, cold extremities, bronchoconstriction (non-selective), masking of hypoglycemia, sexual dysfunction. Contraindicated in vasospastic angina (β-blockade leaves α-adrenoceptors unopposed → may worsen vasospasm).

Class 3: Calcium Channel Blockers (CCBs)

Examples:
  • Dihydropyridines (DHPs): Nifedipine, Amlodipine, Felodipine — primarily vascular
  • Non-DHPs: Verapamil, Diltiazem — cardiac + vascular

Mechanism

Block voltage-gated L-type Ca²⁺ channels in cardiac and vascular smooth muscle. Drugs bind from the inner side of the membrane to open/inactivated channels → ↓ Ca²⁺ influx → smooth muscle relaxation.
DrugHeart RateContractilityVasodilation
Verapamil↓↓↓↓
Diltiazem
Nifedipine/Amlodipine↑ (reflex)minimal↑↑

Uses

  • Verapamil/Diltiazem: alternatives to β-blockers for chronic stable angina (especially if β-blockers contraindicated)
  • DHPs: preferred when heart rate is already low or β-blockers are not tolerated
  • Vasospastic angina: CCBs are first-line (both DHPs and non-DHPs)
  • DHPs + β-blocker combination: recommended for persistent angina

Adverse Effects

  • DHPs: peripheral edema, flushing, reflex tachycardia
  • Verapamil: constipation, bradycardia, heart block, negative inotropy (avoid in HFrEF)
  • Both: hypotension

Class 4: Second-Line (Newer) Agents

Ranolazine

  • Inhibits late inward Na⁺ current (late Iₙₐ) → reduces intracellular Na⁺ → reduces Ca²⁺ overload via Na⁺/Ca²⁺ exchanger → ↓ diastolic wall tension
  • No significant hemodynamic effects (does not lower BP or HR)
  • Can be combined with all other antianginal drugs
  • Used when angina is not controlled by first-line agents

Ivabradine

  • Selectively inhibits the If (funny) current (HCN channels) in the SA node → ↓ heart rate without affecting contractility
  • Used as an alternative to β-blockers in patients with normal sinus rhythm who cannot tolerate β-blockers
  • Caution: toxic when combined with β-blockers, verapamil, or diltiazem (additive bradycardia)

Nicorandil

  • Dual mechanism: K⁺-channel opener (arteriolar dilation, ↓ afterload) + nitrate-like effect (venodilation, ↓ preload)
  • Available outside the US; used as add-on therapy

Trimetazidine

  • Metabolic agent: inhibits fatty acid oxidation → shifts myocardial metabolism to glucose (more O₂-efficient)
  • No hemodynamic effects; used as add-on in Europe

Management Summary Table

(Adapted from ESC Guidelines, Goodman & Gilman's, 17th Ed.)
SituationFirst-LineSecond-Line
Chronic stable anginaβ-Blocker OR diltiazem/verapamilAdd DHP, long-acting nitrate, ranolazine, ivabradine
Vasospastic anginaCCB (DHP or non-DHP) + long-acting nitrateAvoid β-blockers
Angina + low HRLong-acting DHP
Angina + HFAmlodipine (safe), avoid verapamilNicorandil, ranolazine
Acute attackSublingual GTNIV nitroglycerin (ACS)
ACSAspirin + anticoagulant + β-blocker + nitrateReperfusion

Key Principles

  1. All CAD patients should have short-acting sublingual nitrate as standby + aspirin + statin.
  2. β-Blockers are preferred first-line for exertional stable angina due to evidence of fewer anginal episodes vs. nifedipine.
  3. No significant outcome differences between long-acting nitrates, CCBs, and β-blockers overall, but β-blockers are guideline-preferred.
  4. Combination therapy is additive: nitrate + β-blocker is the classic pair; DHP + β-blocker for refractory angina.
  5. Ranolazine and trimetazidine act independently of hemodynamics and can be added to any regimen.

Sources: Katzung's Basic and Clinical Pharmacology, 16th Ed. | Goodman & Gilman's The Pharmacological Basis of Therapeutics, 13th Ed. | Fuster and Hurst's The Heart, 15th Ed.

also give me flashcards

Asking for Preferences
Reading File
Running Command

mkdir -p /home/daytona/workspace/antianginal-flashcards

Writing File

~/antianginal-flashcards/make_flashcards.py

from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import cm
from reportlab.platypus import (
    SimpleDocTemplate, Table, TableStyle, Spacer, Paragraph, HRFlowable
)
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_CENTER, TA_LEFT
from reportlab.platypus import KeepTogether

OUTPUT = "/home/daytona/workspace/antianginal-flashcards/Antianginal_Drugs_Flashcards.pdf"

# ── Colour palette ────────────────────────────────────────────────────────────
DARK_BLUE   = colors.HexColor("#1B3A5C")
MID_BLUE    = colors.HexColor("#2E6DA4")
LIGHT_BLUE  = colors.HexColor("#D6E8F7")
ACCENT      = colors.HexColor("#E8F4FD")
GREEN       = colors.HexColor("#1A7A4A")
GREEN_LIGHT = colors.HexColor("#D4EDDA")
ORANGE      = colors.HexColor("#C05A00")
ORANGE_LIGHT= colors.HexColor("#FFF0D9")
PURPLE      = colors.HexColor("#5B2D8E")
PURPLE_LIGHT= colors.HexColor("#EDE3F7")
RED         = colors.HexColor("#B22222")
RED_LIGHT   = colors.HexColor("#FDECEA")
GREY_LIGHT  = colors.HexColor("#F5F5F5")
WHITE       = colors.white

styles = getSampleStyleSheet()

# Custom paragraph styles
Q_style = ParagraphStyle(
    "Question",
    parent=styles["Normal"],
    fontSize=10.5,
    leading=14,
    textColor=DARK_BLUE,
    fontName="Helvetica-Bold",
)
A_style = ParagraphStyle(
    "Answer",
    parent=styles["Normal"],
    fontSize=10,
    leading=14,
    textColor=colors.HexColor("#1A1A1A"),
    fontName="Helvetica",
)
LABEL_style = ParagraphStyle(
    "Label",
    parent=styles["Normal"],
    fontSize=7.5,
    textColor=WHITE,
    fontName="Helvetica-Bold",
    alignment=TA_CENTER,
)
TITLE_style = ParagraphStyle(
    "Title",
    parent=styles["Normal"],
    fontSize=20,
    leading=26,
    textColor=WHITE,
    fontName="Helvetica-Bold",
    alignment=TA_CENTER,
)
SUBTITLE_style = ParagraphStyle(
    "Subtitle",
    parent=styles["Normal"],
    fontSize=12,
    leading=16,
    textColor=LIGHT_BLUE,
    fontName="Helvetica",
    alignment=TA_CENTER,
)
SECTION_style = ParagraphStyle(
    "Section",
    parent=styles["Normal"],
    fontSize=13,
    leading=18,
    textColor=WHITE,
    fontName="Helvetica-Bold",
    alignment=TA_CENTER,
)

# ── Flashcard data ────────────────────────────────────────────────────────────
# Each card: (category, label_color, q_bg, question, answer)
CARDS = [
    # ── BASICS ────────────────────────────────────────────────────────────────
    ("BASICS", MID_BLUE, ACCENT,
     "What is the core problem in angina pectoris?",
     "Mismatch between myocardial O₂ supply and demand.\n"
     "Demand > Supply → ischaemia → chest pain."),

    ("BASICS", MID_BLUE, ACCENT,
     "What are the 4 determinants of myocardial O₂ demand?",
     "1. Heart rate (chronotropy)\n"
     "2. Contractility (inotropy)\n"
     "3. Preload (ventricular filling pressure / wall stress)\n"
     "4. Afterload (arterial resistance)"),

    ("BASICS", MID_BLUE, ACCENT,
     "Name the 3 types of angina and their main cause.",
     "1. Stable (exertional) — fixed atherosclerotic stenosis; demand ↑\n"
     "2. Vasospastic (Prinzmetal's) — coronary vasospasm; supply ↓\n"
     "3. Unstable angina (ACS) — plaque rupture + thrombosis; supply ↓"),

    ("BASICS", MID_BLUE, ACCENT,
     "What is the first-line drug for an ACUTE angina attack?",
     "Sublingual nitroglycerin (GTN) — onset 1–3 min.\n"
     "All CAD patients should carry it as standby medication."),

    # ── NITRATES ──────────────────────────────────────────────────────────────
    ("NITRATES", GREEN, GREEN_LIGHT,
     "Mechanism of organic nitrates.",
     "Bioconverted → Nitric Oxide (NO)\n"
     "→ activates soluble guanylyl cyclase\n"
     "→ ↑ cGMP → myosin light-chain dephosphorylation\n"
     "→ smooth muscle relaxation & vasodilation"),

    ("NITRATES", GREEN, GREEN_LIGHT,
     "Primary vs. secondary haemodynamic effect of nitrates.",
     "Primary: VENODILATION → ↓ preload → ↓ wall stress → ↓ O₂ demand\n"
     "Secondary (higher doses): Arterial dilation → ↓ afterload\n"
     "Also: Direct coronary vasodilation → relieves vasospasm"),

    ("NITRATES", GREEN, GREEN_LIGHT,
     "Examples of organic nitrates and their duration.",
     "• Nitroglycerin (GTN) sublingual — 30–60 min\n"
     "• GTN patch / spray — 4–8 h\n"
     "• Isosorbide dinitrate (ISDN) — 4–6 h\n"
     "• Isosorbide mononitrate (ISMN) — 6–10 h"),

    ("NITRATES", GREEN, GREEN_LIGHT,
     "What is nitrate tolerance? How is it prevented?",
     "Continuous exposure → loss of efficacy (tolerance).\n"
     "Prevention: nitrate-free interval of 8–12 h daily\n"
     "(e.g., remove transdermal patch at night)."),

    ("NITRATES", GREEN, GREEN_LIGHT,
     "Key adverse effects of nitrates.",
     "• Headache (most common — meningeal vasodilation)\n"
     "• Postural hypotension\n"
     "• Reflex tachycardia\n"
     "• Flushing\n"
     "⚠ Contraindicated within 24 h of PDE5 inhibitors → profound hypotension"),

    # ── BETA-BLOCKERS ─────────────────────────────────────────────────────────
    ("β-BLOCKERS", ORANGE, ORANGE_LIGHT,
     "Mechanism of beta-blockers in angina.",
     "Block β₁ receptors in the heart:\n"
     "→ ↓ Heart rate (chronotropy)\n"
     "→ ↓ Contractility (inotropy)\n"
     "→ ↓ AV conduction velocity\n"
     "Net: ↓ myocardial O₂ consumption (especially on exertion)"),

    ("β-BLOCKERS", ORANGE, ORANGE_LIGHT,
     "Which type of angina are β-blockers FIRST-LINE for?",
     "Chronic STABLE (exertional) angina.\n"
     "Also: Post-MI, angina + HF, angina + hypertension.\n"
     "⚠ AVOID in vasospastic angina — unopposed α-activity worsens spasm."),

    ("β-BLOCKERS", ORANGE, ORANGE_LIGHT,
     "Examples of β-blockers used in angina.",
     "Cardioselective (β₁): Metoprolol, Atenolol, Bisoprolol\n"
     "Non-selective: Propranolol\n"
     "α+β blocker: Carvedilol (useful in angina + HF)"),

    ("β-BLOCKERS", ORANGE, ORANGE_LIGHT,
     "Why are β-blockers + nitrates a good combination?",
     "Complementary actions:\n"
     "• β-blockers block reflex tachycardia from nitrates\n"
     "• Nitrates counteract ↑ preload from β-blockade\n"
     "• Nitrates alleviate ↑ coronary vascular resistance from β-blockade\n"
     "→ Synergistic reduction of O₂ demand"),

    ("β-BLOCKERS", ORANGE, ORANGE_LIGHT,
     "Key adverse effects and contraindications of β-blockers.",
     "Side effects: Bradycardia, fatigue, cold extremities,\n"
     "  bronchoconstriction (non-selective), masks hypoglycaemia\n"
     "Contraindications: Severe asthma/COPD, significant bradycardia,\n"
     "  high-degree AV block, vasospastic angina, decompensated HF"),

    # ── CALCIUM CHANNEL BLOCKERS ──────────────────────────────────────────────
    ("CALCIUM CHANNEL BLOCKERS", PURPLE, PURPLE_LIGHT,
     "Mechanism of calcium channel blockers (CCBs).",
     "Block voltage-gated L-type Ca²⁺ channels (bind open/inactivated state)\n"
     "→ ↓ Ca²⁺ influx into smooth muscle → vasodilation\n"
     "→ ↓ Ca²⁺ in cardiac muscle → ↓ contractility, HR, AV conduction"),

    ("CALCIUM CHANNEL BLOCKERS", PURPLE, PURPLE_LIGHT,
     "Difference between DHP and non-DHP CCBs.",
     "Dihydropyridines (nifedipine, amlodipine): mainly vascular\n"
     "  → vasodilation ↑↑, reflex tachycardia, minimal cardiac effect\n\n"
     "Non-DHPs (verapamil, diltiazem): cardiac + vascular\n"
     "  → ↓ HR, ↓ contractility, ↓ AV conduction + vasodilation"),

    ("CALCIUM CHANNEL BLOCKERS", PURPLE, PURPLE_LIGHT,
     "Which CCB sub-class is used for vasospastic angina?",
     "BOTH DHPs and non-DHPs are first-line for vasospastic angina.\n"
     "They relax coronary smooth muscle and prevent vasospasm.\n"
     "Long-acting nitrates are also first-line; β-blockers are avoided."),

    ("CALCIUM CHANNEL BLOCKERS", PURPLE, PURPLE_LIGHT,
     "When do guidelines prefer DHPs over non-DHPs in stable angina?",
     "• When heart rate is already LOW\n"
     "• When β-blockers are not tolerated or contraindicated\n"
     "• DHP + β-blocker combination → for PERSISTENT angina\n"
     "⚠ Non-DHPs + β-blockers → risk of severe bradycardia / heart block"),

    ("CALCIUM CHANNEL BLOCKERS", PURPLE, PURPLE_LIGHT,
     "Adverse effects of verapamil vs. nifedipine.",
     "Verapamil: Constipation, bradycardia, heart block, ↓ contractility\n"
     "  ⚠ Avoid in HFrEF\n\n"
     "Nifedipine: Peripheral oedema, flushing, reflex tachycardia\n\n"
     "Both: Hypotension"),

    # ── SECOND-LINE AGENTS ─────────────────────────────────────────────────────
    ("SECOND-LINE", RED, RED_LIGHT,
     "Mechanism of ranolazine.",
     "Inhibits late inward Na⁺ current (late Iₙₐ)\n"
     "→ ↓ intracellular Na⁺ → ↓ Na⁺/Ca²⁺ exchanger activity\n"
     "→ ↓ intracellular Ca²⁺ overload → ↓ diastolic wall tension\n"
     "✓ No significant effect on BP or HR"),

    ("SECOND-LINE", RED, RED_LIGHT,
     "Mechanism and advantage of ivabradine.",
     "Selectively inhibits HCN (If 'funny') channels in SA node\n"
     "→ ↓ heart rate WITHOUT affecting contractility or BP\n"
     "Use: Alternative to β-blockers in normal sinus rhythm\n"
     "⚠ Avoid combining with β-blockers, verapamil, or diltiazem"),

    ("SECOND-LINE", RED, RED_LIGHT,
     "Mechanism of nicorandil.",
     "Dual mechanism:\n"
     "1. K⁺-channel opener → arteriolar dilation → ↓ afterload\n"
     "2. Nitrate-like action → venodilation → ↓ preload\n"
     "Add-on therapy; not available in the US"),

    ("SECOND-LINE", RED, RED_LIGHT,
     "Mechanism of trimetazidine.",
     "Metabolic agent — inhibits fatty acid β-oxidation\n"
     "→ shifts myocardial fuel to glucose (more O₂-efficient per ATP)\n"
     "✓ No haemodynamic effects → safe to combine with all antianginals\n"
     "Available mainly in Europe"),

    # ── GUIDELINES ────────────────────────────────────────────────────────────
    ("GUIDELINES", MID_BLUE, ACCENT,
     "First-line antianginal treatment per ACC/AHA & ESC guidelines.",
     "All CAD patients:\n"
     "  • Sublingual nitrate (standby) + Aspirin + Statin\n\n"
     "Chronic stable angina:\n"
     "  • β-Blocker (preferred) OR diltiazem/verapamil\n"
     "  • DHP if HR is low or β-blockers not tolerated\n"
     "  • β-Blocker + DHP for persistent angina"),

    ("GUIDELINES", MID_BLUE, ACCENT,
     "Second-line antianginal options per ESC guidelines.",
     "Add or switch to:\n"
     "• Ivabradine\n"
     "• Long-acting nitrates\n"
     "• Nicorandil\n"
     "• Ranolazine\n"
     "• Trimetazidine (Europe only)\n\n"
     "Ranolazine & trimetazidine can combine with ALL first-line agents."),

    ("GUIDELINES", MID_BLUE, ACCENT,
     "Meta-analysis comparison of the 3 main antianginal classes.",
     "β-Blockers > nifedipine: fewer angina episodes/week, fewer withdrawals.\n"
     "No significant difference: long-acting nitrates vs. CCBs vs. β-blockers in outcomes.\n"
     "→ β-Blockers remain guideline-preferred first-line."),

    ("GUIDELINES", MID_BLUE, ACCENT,
     "Antianginal drug to AVOID in vasospastic angina and why?",
     "β-BLOCKERS — avoid!\n"
     "β-blockade leaves α-adrenoceptors unopposed\n"
     "→ vasoconstriction → worsens coronary vasospasm\n\n"
     "Use CCBs and/or long-acting nitrates instead."),
]

CATEGORY_COLORS = {
    "BASICS": MID_BLUE,
    "NITRATES": GREEN,
    "β-BLOCKERS": ORANGE,
    "CALCIUM CHANNEL BLOCKERS": PURPLE,
    "SECOND-LINE": RED,
    "GUIDELINES": MID_BLUE,
}

SECTION_ORDER = [
    ("BASICS", "Basics of Angina"),
    ("NITRATES", "Class 1 — Organic Nitrates"),
    ("β-BLOCKERS", "Class 2 — Beta-Blockers"),
    ("CALCIUM CHANNEL BLOCKERS", "Class 3 — Calcium Channel Blockers"),
    ("SECOND-LINE", "Class 4 — Second-Line Agents"),
    ("GUIDELINES", "Clinical Guidelines"),
]

# ── Build PDF ─────────────────────────────────────────────────────────────────
def build_pdf():
    doc = SimpleDocTemplate(
        OUTPUT,
        pagesize=A4,
        leftMargin=1.5*cm,
        rightMargin=1.5*cm,
        topMargin=1.5*cm,
        bottomMargin=1.5*cm,
    )
    W = A4[0] - 3*cm  # usable width

    story = []

    # ── Cover block ────────────────────────────────────────────────────────
    cover_data = [[Paragraph("💊 Antianginal Drugs", TITLE_style)],
                  [Paragraph("Pharmacology Flashcards", SUBTITLE_style)],
                  [Paragraph("Based on Katzung's Basic & Clinical Pharmacology, 16th Ed.\n"
                             "Goodman & Gilman's Pharmacological Basis of Therapeutics", SUBTITLE_style)]]
    cover = Table(cover_data, colWidths=[W])
    cover.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), DARK_BLUE),
        ("ROUNDEDCORNERS", [12]),
        ("TOPPADDING", (0,0), (-1,-1), 18),
        ("BOTTOMPADDING", (0,0), (-1,-1), 18),
        ("LEFTPADDING", (0,0), (-1,-1), 20),
        ("RIGHTPADDING", (0,0), (-1,-1), 20),
    ]))
    story.append(cover)
    story.append(Spacer(1, 0.6*cm))

    # ── Cards grouped by section ───────────────────────────────────────────
    cards_by_cat = {cat: [] for cat, _ in SECTION_ORDER}
    for cat, label_color, q_bg, q, a in CARDS:
        cards_by_cat[cat].append((label_color, q_bg, q, a))

    card_num = 0
    for cat_key, cat_title in SECTION_ORDER:
        if not cards_by_cat[cat_key]:
            continue
        # Section header
        sect_color = CATEGORY_COLORS[cat_key]
        sect_data = [[Paragraph(cat_title, SECTION_style)]]
        sect_tbl = Table(sect_data, colWidths=[W])
        sect_tbl.setStyle(TableStyle([
            ("BACKGROUND", (0,0), (-1,-1), sect_color),
            ("ROUNDEDCORNERS", [8]),
            ("TOPPADDING", (0,0), (-1,-1), 8),
            ("BOTTOMPADDING", (0,0), (-1,-1), 8),
            ("LEFTPADDING", (0,0), (-1,-1), 12),
            ("RIGHTPADDING", (0,0), (-1,-1), 12),
        ]))
        story.append(KeepTogether([sect_tbl, Spacer(1, 0.3*cm)]))

        for label_color, q_bg, q_text, a_text in cards_by_cat[cat_key]:
            card_num += 1

            # Q label pill
            label_pill_data = [[Paragraph(f"Q{card_num}", LABEL_style)]]
            label_pill = Table(label_pill_data, colWidths=[1.4*cm])
            label_pill.setStyle(TableStyle([
                ("BACKGROUND", (0,0), (-1,-1), label_color),
                ("ROUNDEDCORNERS", [6]),
                ("TOPPADDING", (0,0), (-1,-1), 2),
                ("BOTTOMPADDING", (0,0), (-1,-1), 2),
                ("LEFTPADDING", (0,0), (-1,-1), 4),
                ("RIGHTPADDING", (0,0), (-1,-1), 4),
            ]))

            # Question row
            q_para = Paragraph(q_text, Q_style)
            q_row_data = [[label_pill, q_para]]
            q_row = Table(q_row_data, colWidths=[1.6*cm, W - 1.6*cm])
            q_row.setStyle(TableStyle([
                ("BACKGROUND", (0,0), (-1,-1), q_bg),
                ("VALIGN", (0,0), (-1,-1), "MIDDLE"),
                ("TOPPADDING", (0,0), (-1,-1), 10),
                ("BOTTOMPADDING", (0,0), (-1,-1), 10),
                ("LEFTPADDING", (0,0), (-1,-1), 10),
                ("RIGHTPADDING", (0,0), (-1,-1), 10),
                ("ROUNDEDCORNERS", [8]),
            ]))

            # Answer
            a_label_data = [[Paragraph("ANSWER", LABEL_style)]]
            a_label = Table(a_label_data, colWidths=[1.8*cm])
            a_label.setStyle(TableStyle([
                ("BACKGROUND", (0,0), (-1,-1), colors.HexColor("#999999")),
                ("ROUNDEDCORNERS", [4]),
                ("TOPPADDING", (0,0), (-1,-1), 1),
                ("BOTTOMPADDING", (0,0), (-1,-1), 1),
                ("LEFTPADDING", (0,0), (-1,-1), 4),
                ("RIGHTPADDING", (0,0), (-1,-1), 4),
            ]))

            a_para = Paragraph(a_text.replace("\n", "<br/>"), A_style)
            a_row_data = [[a_label, a_para]]
            a_row = Table(a_row_data, colWidths=[2.0*cm, W - 2.0*cm])
            a_row.setStyle(TableStyle([
                ("BACKGROUND", (0,0), (-1,-1), GREY_LIGHT),
                ("VALIGN", (0,0), (-1,-1), "TOP"),
                ("TOPPADDING", (0,0), (-1,-1), 10),
                ("BOTTOMPADDING", (0,0), (-1,-1), 10),
                ("LEFTPADDING", (0,0), (-1,-1), 10),
                ("RIGHTPADDING", (0,0), (-1,-1), 10),
            ]))

            # Outer card container
            card_data = [[q_row], [a_row]]
            card = Table(card_data, colWidths=[W])
            card.setStyle(TableStyle([
                ("BOX", (0,0), (-1,-1), 1, colors.HexColor("#CCCCCC")),
                ("ROUNDEDCORNERS", [10]),
                ("TOPPADDING", (0,0), (-1,-1), 0),
                ("BOTTOMPADDING", (0,0), (-1,-1), 0),
                ("LEFTPADDING", (0,0), (-1,-1), 0),
                ("RIGHTPADDING", (0,0), (-1,-1), 0),
                ("LINEBELOW", (0,0), (-1,0), 1, colors.HexColor("#CCCCCC")),
            ]))

            story.append(KeepTogether([card, Spacer(1, 0.35*cm)]))

        story.append(Spacer(1, 0.2*cm))

    # ── Footer note ────────────────────────────────────────────────────────
    footer_data = [[Paragraph(
        "Sources: Katzung's Basic & Clinical Pharmacology 16th Ed. | "
        "Goodman & Gilman's 13th Ed. | Fuster & Hurst's The Heart 15th Ed.",
        ParagraphStyle("footer", parent=styles["Normal"], fontSize=7.5,
                       textColor=colors.HexColor("#888888"), alignment=TA_CENTER))]]
    footer = Table(footer_data, colWidths=[W])
    story.append(footer)

    doc.build(story)
    print(f"PDF saved to: {OUTPUT}")

build_pdf()
Running Command

python /home/daytona/workspace/antianginal-flashcards/make_flashcards.py

Your flashcard PDF is ready!

Antianginal Drugs Flashcards

PDF Document · PDF


The PDF contains 26 flashcards organized into 6 color-coded sections:
ColorSection
🔵 BlueBasics of Angina (4 cards)
🟢 GreenClass 1 — Organic Nitrates (5 cards)
🟠 OrangeClass 2 — Beta-Blockers (5 cards)
🟣 PurpleClass 3 — Calcium Channel Blockers (5 cards)
🔴 RedClass 4 — Second-Line Agents (4 cards)
🔵 BlueClinical Guidelines (3 cards)
Each card shows the question on top and the answer directly below — ideal for self-testing by covering the answer half. The source textbooks are credited in the footer.
This is a shared conversation. Sign in to Orris to start your own chat.