Create a ppt presentation for migraine therapy for pharmacology subject

Asking for Preferences

Who is the target audience for this presentation? · How detailed should the content be? · How many slides do you need (approximately)?

Reading File
Reading File
Reading File
Finding Sources
Good - I have the key sources. Now let me read the most relevant content from Goodman & Gilman's (pharmacology gold standard) and Bradley & Daroff's Neurology, plus search for migraine treatment drug content.
Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Finding Sources
Reading File
Reading File
Finding Sources
I now have rich content from Goodman & Gilman's, Lippincott, and Katzung. I also found a great migraine flowchart image. Let me now build the presentation using this comprehensive content.
Running Command

mkdir -p /tmp/workspace/migraine-ppt && ls /tmp/workspace/migraine-ppt/

Writing File

~/migraine-ppt/build_ppt.py

"""
Migraine Therapy - Pharmacology Presentation
Target: Undergraduate pharmacy/medical students
Slides: ~18 slides, moderate depth
"""

from pptx import Presentation
from pptx.util import Inches, Pt, Emu
from pptx.dml.color import RGBColor
from pptx.enum.text import PP_ALIGN, MSO_ANCHOR
from pptx.util import Inches, Pt
import subprocess, json, base64
from io import BytesIO

# ─── Color Palette ───────────────────────────────────────────────────────────
DEEP_PURPLE   = RGBColor(0x4A, 0x14, 0x86)   # slide header / title bg
MED_PURPLE    = RGBColor(0x7B, 0x2D, 0xBF)   # accent bars
LIGHT_PURPLE  = RGBColor(0xEE, 0xE5, 0xF8)   # light bg tint
GOLD          = RGBColor(0xF5, 0xC5, 0x18)   # highlight accent
WHITE         = RGBColor(0xFF, 0xFF, 0xFF)
DARK_GRAY     = RGBColor(0x22, 0x22, 0x22)
MID_GRAY      = RGBColor(0x55, 0x55, 0x55)
TEAL          = RGBColor(0x00, 0x8B, 0x8B)
RED_WARN      = RGBColor(0xCC, 0x22, 0x22)
GREEN_OK      = RGBColor(0x1A, 0x7A, 0x3C)

prs = Presentation()
prs.slide_width  = Inches(13.333)
prs.slide_height = Inches(7.5)

blank = prs.slide_layouts[6]   # fully blank

# ─── Helper functions ─────────────────────────────────────────────────────────

def add_rect(slide, x, y, w, h, fill_color, alpha=None):
    from pptx.util import Inches
    shape = slide.shapes.add_shape(
        1,  # MSO_SHAPE_TYPE.RECTANGLE = 1
        Inches(x), Inches(y), Inches(w), Inches(h)
    )
    shape.line.fill.background()
    shape.fill.solid()
    shape.fill.fore_color.rgb = fill_color
    return shape

def add_text(slide, text, x, y, w, h, font_size=18, bold=False, color=DARK_GRAY,
             align=PP_ALIGN.LEFT, italic=False, wrap=True):
    tb = slide.shapes.add_textbox(Inches(x), Inches(y), Inches(w), Inches(h))
    tf = tb.text_frame
    tf.word_wrap = wrap
    tf.margin_left  = Pt(0)
    tf.margin_right = Pt(0)
    tf.margin_top   = Pt(0)
    tf.margin_bottom= Pt(0)
    p = tf.paragraphs[0]
    p.alignment = align
    r = p.add_run()
    r.text = text
    r.font.size   = Pt(font_size)
    r.font.bold   = bold
    r.font.italic = italic
    r.font.color.rgb = color
    r.font.name = "Calibri"
    return tb

def add_bullet_slide(slide, title_text, bullets, note=None):
    """Add title bar + bullet list to a slide."""
    # Top purple banner
    add_rect(slide, 0, 0, 13.333, 1.1, DEEP_PURPLE)
    add_text(slide, title_text, 0.35, 0.12, 12.5, 0.85,
             font_size=30, bold=True, color=WHITE)
    # Gold accent line
    add_rect(slide, 0, 1.1, 13.333, 0.06, GOLD)
    # White body
    add_rect(slide, 0, 1.16, 13.333, 6.34, WHITE)

    y_cur = 1.35
    for bullet in bullets:
        if isinstance(bullet, dict):
            # section sub-header
            if bullet.get("type") == "header":
                add_text(slide, bullet["text"], 0.5, y_cur, 12.5, 0.45,
                         font_size=17, bold=True, color=MED_PURPLE)
                y_cur += 0.45
            elif bullet.get("type") == "sub":
                tb = slide.shapes.add_textbox(Inches(1.0), Inches(y_cur),
                                              Inches(11.8), Inches(0.42))
                tf = tb.text_frame; tf.word_wrap = True
                tf.margin_left=tf.margin_right=tf.margin_top=tf.margin_bottom=Pt(0)
                p = tf.paragraphs[0]; p.alignment = PP_ALIGN.LEFT
                r = p.add_run(); r.text = bullet["text"]
                r.font.size = Pt(15); r.font.color.rgb = MID_GRAY
                r.font.name = "Calibri"
                y_cur += 0.42
        else:
            # Normal bullet
            tb = slide.shapes.add_textbox(Inches(0.5), Inches(y_cur),
                                          Inches(12.3), Inches(0.48))
            tf = tb.text_frame; tf.word_wrap = True
            tf.margin_left=tf.margin_right=tf.margin_top=tf.margin_bottom=Pt(0)
            p = tf.paragraphs[0]; p.alignment = PP_ALIGN.LEFT
            r1 = p.add_run(); r1.text = "  \u2022  "
            r1.font.size = Pt(16); r1.font.color.rgb = MED_PURPLE
            r1.font.bold = True; r1.font.name = "Calibri"
            r2 = p.add_run(); r2.text = bullet
            r2.font.size = Pt(16); r2.font.color.rgb = DARK_GRAY
            r2.font.name = "Calibri"
            y_cur += 0.47

    if note:
        add_rect(slide, 0.4, 6.8, 12.5, 0.45, LIGHT_PURPLE)
        add_text(slide, note, 0.55, 6.82, 12.2, 0.4,
                 font_size=12, italic=True, color=MID_GRAY)

def add_two_col_slide(slide, title_text, left_header, left_items,
                      right_header, right_items, col_color_l=LIGHT_PURPLE,
                      col_color_r=RGBColor(0xE8, 0xF6, 0xEE)):
    add_rect(slide, 0, 0, 13.333, 1.1, DEEP_PURPLE)
    add_text(slide, title_text, 0.35, 0.12, 12.5, 0.85,
             font_size=30, bold=True, color=WHITE)
    add_rect(slide, 0, 1.1, 13.333, 0.06, GOLD)
    add_rect(slide, 0, 1.16, 13.333, 6.34, WHITE)

    # Left column
    add_rect(slide, 0.3, 1.35, 6.0, 0.5, MED_PURPLE)
    add_text(slide, left_header, 0.35, 1.38, 5.9, 0.44,
             font_size=16, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
    add_rect(slide, 0.3, 1.85, 6.0, 5.3, col_color_l)
    y = 2.0
    for item in left_items:
        tb = slide.shapes.add_textbox(Inches(0.55), Inches(y), Inches(5.6), Inches(0.5))
        tf = tb.text_frame; tf.word_wrap = True
        tf.margin_left=tf.margin_right=tf.margin_top=tf.margin_bottom=Pt(0)
        p = tf.paragraphs[0]
        r1=p.add_run(); r1.text="  \u2022  "
        r1.font.size=Pt(15); r1.font.color.rgb=MED_PURPLE; r1.font.bold=True
        r1.font.name="Calibri"
        r2=p.add_run(); r2.text=item
        r2.font.size=Pt(14); r2.font.color.rgb=DARK_GRAY; r2.font.name="Calibri"
        y += 0.5

    # Right column
    add_rect(slide, 6.85, 1.35, 6.2, 0.5, TEAL)
    add_text(slide, right_header, 6.9, 1.38, 6.1, 0.44,
             font_size=16, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
    add_rect(slide, 6.85, 1.85, 6.2, 5.3, col_color_r)
    y = 2.0
    for item in right_items:
        tb = slide.shapes.add_textbox(Inches(7.1), Inches(y), Inches(5.7), Inches(0.5))
        tf = tb.text_frame; tf.word_wrap = True
        tf.margin_left=tf.margin_right=tf.margin_top=tf.margin_bottom=Pt(0)
        p = tf.paragraphs[0]
        r1=p.add_run(); r1.text="  \u2022  "
        r1.font.size=Pt(15); r1.font.color.rgb=TEAL; r1.font.bold=True
        r1.font.name="Calibri"
        r2=p.add_run(); r2.text=item
        r2.font.size=Pt(14); r2.font.color.rgb=DARK_GRAY; r2.font.name="Calibri"
        y += 0.5


# ═══════════════════════════════════════════════════════════════════════════════
#  SLIDE 1 — TITLE SLIDE
# ═══════════════════════════════════════════════════════════════════════════════
slide = prs.slides.add_slide(blank)
# Full bg gradient-like with rectangle layers
add_rect(slide, 0, 0, 13.333, 7.5, DEEP_PURPLE)
add_rect(slide, 0, 4.5, 13.333, 3.0, MED_PURPLE)
add_rect(slide, 0, 3.2, 13.333, 0.08, GOLD)

# Central white card
add_rect(slide, 1.2, 1.0, 10.9, 4.8, WHITE)
add_rect(slide, 1.2, 1.0, 0.12, 4.8, GOLD)  # left accent bar

add_text(slide, "PHARMACOLOGY", 1.5, 1.15, 10.5, 0.6,
         font_size=16, bold=False, color=MED_PURPLE, align=PP_ALIGN.CENTER)
add_text(slide, "Migraine Therapy", 1.5, 1.7, 10.5, 1.3,
         font_size=48, bold=True, color=DEEP_PURPLE, align=PP_ALIGN.CENTER)
add_rect(slide, 3.0, 3.05, 7.3, 0.05, LIGHT_PURPLE)
add_text(slide, "Pathophysiology  |  Drug Classes  |  Acute Treatment  |  Prophylaxis", 
         1.5, 3.15, 10.5, 0.55,
         font_size=16, italic=True, color=MID_GRAY, align=PP_ALIGN.CENTER)
add_text(slide, "For Undergraduate Pharmacy & Medical Students", 1.5, 3.85, 10.5, 0.5,
         font_size=15, color=MID_GRAY, align=PP_ALIGN.CENTER)
add_text(slide, "Source: Goodman & Gilman's | Lippincott Pharmacology | Katzung", 
         1.5, 4.35, 10.5, 0.35,
         font_size=11, italic=True, color=RGBColor(0x99,0x99,0x99), align=PP_ALIGN.CENTER)

# Bottom watermark
add_text(slide, "Department of Pharmacology", 0, 6.95, 13.333, 0.4,
         font_size=12, color=WHITE, align=PP_ALIGN.CENTER)


# ═══════════════════════════════════════════════════════════════════════════════
#  SLIDE 2 — OUTLINE / CONTENTS
# ═══════════════════════════════════════════════════════════════════════════════
slide = prs.slides.add_slide(blank)
add_rect(slide, 0, 0, 13.333, 7.5, RGBColor(0xF7,0xF4,0xFF))
add_rect(slide, 0, 0, 13.333, 1.1, DEEP_PURPLE)
add_text(slide, "Lecture Outline", 0.35, 0.12, 12.5, 0.85,
         font_size=30, bold=True, color=WHITE)
add_rect(slide, 0, 1.1, 13.333, 0.06, GOLD)

topics = [
    ("01", "Introduction & Epidemiology"),
    ("02", "Classification of Migraine"),
    ("03", "Pathophysiology"),
    ("04", "Role of Serotonin (5-HT)"),
    ("05", "Role of CGRP"),
    ("06", "Acute Treatment — Overview"),
    ("07", "Triptans (5-HT1B/1D Agonists)"),
    ("08", "Ergot Alkaloids"),
    ("09", "Ditans & CGRP Antagonists (Gepants)"),
    ("10", "Non-Specific Analgesics & Antiemetics"),
    ("11", "Migraine Prophylaxis — Overview"),
    ("12", "Prophylactic Agents (Beta-blockers, AEDs, Antidepressants)"),
    ("13", "CGRP Monoclonal Antibodies"),
    ("14", "Special Populations"),
    ("15", "Treatment Algorithm"),
    ("16", "Summary & Key Points"),
]

# Two columns
col1 = topics[:8]
col2 = topics[8:]
for i, (num, text) in enumerate(col1):
    y = 1.35 + i * 0.73
    add_rect(slide, 0.4, y, 0.55, 0.52, MED_PURPLE)
    add_text(slide, num, 0.41, y+0.03, 0.52, 0.46,
             font_size=14, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
    add_text(slide, text, 1.05, y+0.05, 5.5, 0.45, font_size=15, color=DARK_GRAY)

for i, (num, text) in enumerate(col2):
    y = 1.35 + i * 0.73
    add_rect(slide, 7.0, y, 0.55, 0.52, TEAL)
    add_text(slide, num, 7.01, y+0.03, 0.52, 0.46,
             font_size=14, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
    add_text(slide, text, 7.65, y+0.05, 5.5, 0.45, font_size=15, color=DARK_GRAY)


# ═══════════════════════════════════════════════════════════════════════════════
#  SLIDE 3 — INTRODUCTION & EPIDEMIOLOGY
# ═══════════════════════════════════════════════════════════════════════════════
slide = prs.slides.add_slide(blank)
add_bullet_slide(slide, "Introduction & Epidemiology", [
    "Migraine affects 10–20% of the general population (Goodman & Gilman's)",
    "One of the most disabling neurological disorders worldwide",
    "More common in women (3:1 female:male ratio); peak prevalence ages 25–55",
    "Characterized by recurrent, episodic, often unilateral throbbing headache",
    "Attacks last 4–72 hours if untreated; frequency highly variable between patients",
    "Often accompanied by nausea, vomiting, photophobia, and phonophobia",
    "Genetic predisposition identified; familial hemiplegic migraine linked to ion channel mutations",
    "Significant socioeconomic burden — one of the top causes of years lived with disability (YLD)",
], note="Ref: Goodman & Gilman's Pharmacological Basis of Therapeutics, 13e")


# ═══════════════════════════════════════════════════════════════════════════════
#  SLIDE 4 — CLASSIFICATION
# ═══════════════════════════════════════════════════════════════════════════════
slide = prs.slides.add_slide(blank)
add_bullet_slide(slide, "Classification of Migraine (IHS/ICHD-3)", [
    {"type": "header", "text": "Primary Types:"},
    "Migraine Without Aura (Common Migraine) — ~80% of cases",
    "Migraine With Aura (Classic Migraine) — transient focal neurological symptoms precede headache",
    {"type": "header", "text": "Subtypes of Migraine With Aura:"},
    {"type": "sub", "text": "  - Typical aura with migraine headache"},
    {"type": "sub", "text": "  - Migraine with prolonged aura"},
    {"type": "sub", "text": "  - Migraine aura without headache (acephalgic migraine)"},
    {"type": "sub", "text": "  - Migraine with acute-onset aura"},
    {"type": "header", "text": "Other Forms:"},
    "Chronic Migraine: headache on ≥15 days/month for >3 months",
    "Hemiplegic Migraine, Retinal Migraine, Vestibular Migraine",
    {"type": "header", "text": "Phases of a Migraine Attack:"},
    {"type": "sub", "text": "  Prodrome → Aura (if present) → Headache → Postdrome"},
], note="Aura typically lasts 20–60 min; visual, sensory or speech disturbances most common")


# ═══════════════════════════════════════════════════════════════════════════════
#  SLIDE 5 — PATHOPHYSIOLOGY
# ═══════════════════════════════════════════════════════════════════════════════
slide = prs.slides.add_slide(blank)
add_bullet_slide(slide, "Pathophysiology of Migraine", [
    "Complex interaction of neural and vascular elements — no single unifying theory",
    {"type": "header", "text": "Cortical Spreading Depression (CSD):"},
    {"type": "sub", "text": "  - Wave of neuronal depolarization across cortex, correlates with aura"},
    {"type": "sub", "text": "  - Triggers activation of trigeminal pain pathways"},
    {"type": "header", "text": "Trigeminovascular Hypothesis:"},
    {"type": "sub", "text": "  - Activation of trigeminal nerve → release of vasoactive neuropeptides"},
    {"type": "sub", "text": "  - CGRP, Substance P, Neurokinin A → neurogenic inflammation + vasodilation"},
    {"type": "sub", "text": "  - Central sensitization leads to allodynia and prolonged headache"},
    {"type": "header", "text": "Vascular Component:"},
    {"type": "sub", "text": "  - Dilation of intracranial vessels and arteriovenous anastomoses"},
    {"type": "sub", "text": "  - Vasoconstriction agents (triptans) provide acute relief"},
    {"type": "header", "text": "Genetic Factors:"},
    {"type": "sub", "text": "  - Mutations in CACNA1A (Ca2+ channel), ATP1A2 (Na/K-ATPase) in familial forms"},
])


# ═══════════════════════════════════════════════════════════════════════════════
#  SLIDE 6 — ROLE OF SEROTONIN
# ═══════════════════════════════════════════════════════════════════════════════
slide = prs.slides.add_slide(blank)
add_bullet_slide(slide, "Role of Serotonin (5-HT) in Migraine", [
    "Serotonin is a key mediator in migraine pathogenesis (5-HT hypothesis)",
    {"type": "header", "text": "Evidence for 5-HT involvement:"},
    {"type": "sub", "text": "  1. Plasma & platelet 5-HT levels vary across different phases of the migraine attack"},
    {"type": "sub", "text": "  2. Urinary 5-HT and its metabolites are elevated during most attacks"},
    {"type": "sub", "text": "  3. Reserpine & fenfluramine (agents that release 5-HT) can precipitate migraine"},
    {"type": "sub", "text": "  4. 5-HT receptor agonists (triptans) are highly effective in aborting attacks"},
    {"type": "header", "text": "Key Receptor Subtypes:"},
    "5-HT1B/1D — agonism causes vasoconstriction + blocks proinflammatory neuropeptide release",
    "5-HT1F — agonism modulates trigeminal pain pathways (no vasoconstriction) — target for ditans",
    "5-HT2A — antagonism involved in prophylactic effects of some drugs (e.g., methysergide)",
    {"type": "header", "text": "Drugs acting via 5-HT receptors:"},
    {"type": "sub", "text": "  Acute: Triptans (5-HT1B/1D), Ergots (5-HT1B/1D + others), Lasmiditan (5-HT1F)"},
    {"type": "sub", "text": "  Prophylaxis: Beta-blockers (indirect), Amitriptyline (5-HT reuptake inhibition)"},
], note="Ref: Goodman & Gilman's, 13e — Chapter on Serotonin")


# ═══════════════════════════════════════════════════════════════════════════════
#  SLIDE 7 — ROLE OF CGRP
# ═══════════════════════════════════════════════════════════════════════════════
slide = prs.slides.add_slide(blank)
add_bullet_slide(slide, "Role of CGRP in Migraine", [
    "Calcitonin Gene-Related Peptide (CGRP) — potent vasodilatory & proinflammatory neuropeptide",
    "Released from trigeminal nerve terminals during a migraine attack",
    "Plasma CGRP levels are elevated during acute migraine; normalize after sumatriptan treatment",
    {"type": "header", "text": "CGRP Actions:"},
    {"type": "sub", "text": "  - Causes dilation of dural blood vessels"},
    {"type": "sub", "text": "  - Promotes neurogenic inflammation and pain sensitization"},
    {"type": "sub", "text": "  - Activates CGRP receptors on trigeminal neurons (central sensitization)"},
    {"type": "header", "text": "Drugs Targeting CGRP:"},
    "Small-molecule CGRP receptor antagonists (Gepants): rimegepant, ubrogepant — ACUTE",
    "Oral gepants for prevention: rimegepant (also), atogepant",
    "Monoclonal antibodies targeting CGRP or its receptor — PROPHYLAXIS:",
    {"type": "sub", "text": "  Erenumab (anti-receptor), Fremanezumab, Galcanezumab, Eptinezumab (anti-CGRP)"},
], note="CGRP-based therapies represent the first migraine-specific class developed for prevention")


# ═══════════════════════════════════════════════════════════════════════════════
#  SLIDE 8 — ACUTE TREATMENT OVERVIEW
# ═══════════════════════════════════════════════════════════════════════════════
slide = prs.slides.add_slide(blank)
add_bullet_slide(slide, "Acute (Abortive) Treatment — Overview", [
    "Goal: rapidly abort the migraine attack, restore normal function",
    "Treatment should begin as early as possible after attack onset",
    {"type": "header", "text": "Step-Care Approach (stratified by severity):"},
    {"type": "sub", "text": "  Mild-Moderate: Simple analgesics (NSAIDs, aspirin, acetaminophen ± caffeine)"},
    {"type": "sub", "text": "  Moderate-Severe: Migraine-specific drugs — triptans (first-line)"},
    {"type": "sub", "text": "  Severe/refractory: DHE, IV medications, opioids (last resort)"},
    {"type": "header", "text": "Drug Classes for Acute Treatment:"},
    "1. Triptans (5-HT1B/1D agonists) — FIRST-LINE for moderate-severe migraine",
    "2. Ergot alkaloids — ergotamine, dihydroergotamine (DHE)",
    "3. Ditans — lasmiditan (5-HT1F agonist)",
    "4. Gepants (CGRP receptor antagonists) — rimegepant, ubrogepant",
    "5. Non-specific analgesics — NSAIDs, acetaminophen, combination products",
    "6. Antiemetics — metoclopramide, prochlorperazine (adjunct + analgesic effect)",
], note="Medication overuse headache (MOH) is a major risk — limit acute medications to <10-15 days/month")


# ═══════════════════════════════════════════════════════════════════════════════
#  SLIDE 9 — TRIPTANS
# ═══════════════════════════════════════════════════════════════════════════════
slide = prs.slides.add_slide(blank)
add_bullet_slide(slide, "Triptans — 5-HT1B/1D Receptor Agonists", [
    {"type": "header", "text": "Drugs: Sumatriptan (prototype), Rizatriptan, Zolmitriptan, Eletriptan, Naratriptan, Frovatriptan, Almotriptan"},
    {"type": "header", "text": "Mechanism of Action:"},
    {"type": "sub", "text": "  - Potent 5-HT1B/1D receptor agonists"},
    {"type": "sub", "text": "  - Cause vasoconstriction of dilated intracranial vessels"},
    {"type": "sub", "text": "  - Block release of pro-inflammatory neuropeptides (CGRP, Substance P) from trigeminal nerve"},
    {"type": "header", "text": "Pharmacokinetics:"},
    {"type": "sub", "text": "  - Sumatriptan: SC (onset 20 min), oral (1–2 hr), intranasal; t½ = 2 hr"},
    {"type": "sub", "text": "  - Frovatriptan: longest t½ >24 hr — preferred in menstrual migraine"},
    {"type": "sub", "text": "  - Eletriptan: most effective at 2-hr and 24-hr endpoints (meta-analysis)"},
    {"type": "header", "text": "Adverse Effects:"},
    {"type": "sub", "text": "  - 'Triptan sensations': chest tightness, pressure in neck/jaw, flushing"},
    {"type": "sub", "text": "  - Nausea, dizziness; headache recurrence within 24–48 hr common"},
    {"type": "header", "text": "Contraindications:"},
    {"type": "sub", "text": "  - CAD, uncontrolled HTN, cerebrovascular disease, hemiplegic/basilar migraine"},
    {"type": "sub", "text": "  - Do NOT combine with ergots (within 24 hr) or MAOIs"},
], note="~70% of patients report significant relief with sumatriptan 6 mg SC (Goodman & Gilman's)")


# ═══════════════════════════════════════════════════════════════════════════════
#  SLIDE 10 — ERGOT ALKALOIDS
# ═══════════════════════════════════════════════════════════════════════════════
slide = prs.slides.add_slide(blank)
add_bullet_slide(slide, "Ergot Alkaloids", [
    "Derived from Claviceps purpurea (fungus on rye grain) — historically the mainstay of therapy",
    {"type": "header", "text": "Drugs: Ergotamine, Dihydroergotamine (DHE)"},
    {"type": "header", "text": "Mechanism of Action:"},
    {"type": "sub", "text": "  - Partial agonist/antagonist at 5-HT1B/1D, alpha-adrenergic & dopamine receptors"},
    {"type": "sub", "text": "  - Vasoconstriction of intracranial blood vessels (main antimigraine effect)"},
    {"type": "header", "text": "Clinical Use:"},
    {"type": "sub", "text": "  - Ergotamine: oral/sublingual/suppository (+ caffeine); effective early in attack"},
    {"type": "sub", "text": "  - DHE: IV or intranasal; indicated for severe migraine; efficacy similar to sumatriptan"},
    {"type": "header", "text": "Adverse Effects:"},
    {"type": "sub", "text": "  - Nausea & vomiting (common), vasoconstriction, rebound headache with overuse"},
    {"type": "sub", "text": "  - Long-term: pulmonary/retroperitoneal/endocardial fibrosis (methysergide — withdrawn)"},
    {"type": "header", "text": "Contraindications:"},
    {"type": "sub", "text": "  - Angina, PVD, pregnancy, uncontrolled HTN, hepatic/renal disease"},
    {"type": "sub", "text": "  - Do NOT combine with potent CYP3A4 inhibitors (risk: peripheral ischemia)"},
    "NOTE: EMA has recommended ergot derivatives no longer be used for migraine",
], note="Ergots have been largely supplanted by triptans due to adverse effect profile")


# ═══════════════════════════════════════════════════════════════════════════════
#  SLIDE 11 — DITANS & GEPANTS
# ═══════════════════════════════════════════════════════════════════════════════
slide = prs.slides.add_slide(blank)
add_two_col_slide(
    slide,
    "Newer Acute Agents: Ditans & Gepants",
    "Ditans (5-HT1F Agonists)",
    [
        "Drug: Lasmiditan",
        "MOA: Selective 5-HT1F receptor agonist",
        "Inhibits trigeminal pain pathway activation",
        "Does NOT cause vasoconstriction",
        "Advantage: safe in CVD patients",
        "Adverse effects: dizziness, sedation, CNS effects",
        "Classified as controlled substance (abuse potential)",
        "Patients MUST NOT drive for 8 hrs after use",
    ],
    "Gepants (CGRP Receptor Antagonists)",
    [
        "Drugs: Ubrogepant, Rimegepant",
        "MOA: Block CGRP receptor → reduce neurogenic inflammation",
        "No vasoconstriction — safe in CVD",
        "Oral agents; well-tolerated",
        "Ubrogepant: acute migraine Rx",
        "Rimegepant: acute Rx AND prevention",
        "Atogepant: prevention only",
        "SE: nausea, somnolence (low incidence)",
    ]
)


# ═══════════════════════════════════════════════════════════════════════════════
#  SLIDE 12 — NON-SPECIFIC ANALGESICS & ANTIEMETICS
# ═══════════════════════════════════════════════════════════════════════════════
slide = prs.slides.add_slide(blank)
add_bullet_slide(slide, "Non-Specific Analgesics & Adjuncts", [
    {"type": "header", "text": "NSAIDs (First-line for mild-moderate migraine):"},
    {"type": "sub", "text": "  - Ibuprofen, Naproxen sodium, Diclofenac — effective and widely available"},
    {"type": "sub", "text": "  - Aspirin 900–1000 mg ± metoclopramide — comparable to sumatriptan 50 mg"},
    {"type": "header", "text": "Acetaminophen (Paracetamol):"},
    {"type": "sub", "text": "  - Useful when NSAIDs contraindicated; modest efficacy alone"},
    {"type": "header", "text": "Combination Products:"},
    {"type": "sub", "text": "  - Aspirin + Acetaminophen + Caffeine (Excedrin Migraine) — OTC, widely used"},
    {"type": "sub", "text": "  - Sumatriptan + Naproxen (Treximet) — improved efficacy over either alone"},
    {"type": "sub", "text": "  - Caffeine enhances analgesic absorption and has mild vasoconstrictive effects"},
    {"type": "header", "text": "Antiemetics (Adjuncts):"},
    {"type": "sub", "text": "  - Metoclopramide: enhances gastric motility (improving drug absorption) + analgesic"},
    {"type": "sub", "text": "  - Prochlorperazine: IV/IM — analgesic and antiemetic, useful in ED setting"},
    {"type": "sub", "text": "  - Domperidone: antiemetic, improves NSAID absorption"},
], note="Medication overuse headache (MOH): limit analgesic use to <15 days/month, triptans <10 days/month")


# ═══════════════════════════════════════════════════════════════════════════════
#  SLIDE 13 — PROPHYLAXIS OVERVIEW
# ═══════════════════════════════════════════════════════════════════════════════
slide = prs.slides.add_slide(blank)
add_bullet_slide(slide, "Migraine Prophylaxis — Overview", [
    {"type": "header", "text": "Indications for Prophylactic Therapy:"},
    {"type": "sub", "text": "  - Migraine attacks ≥2 per month causing significant disability"},
    {"type": "sub", "text": "  - Severe or complicated attacks with neurological signs"},
    {"type": "sub", "text": "  - Inadequate response/contraindication to acute therapies"},
    {"type": "sub", "text": "  - Medication overuse headache (MOH) pattern"},
    {"type": "sub", "text": "  - Special forms: hemiplegic migraine, migraine with prolonged aura"},
    {"type": "header", "text": "Goals of Prophylaxis:"},
    "Reduce attack frequency, severity, and duration",
    "Improve responsiveness to acute treatment",
    "Reduce disability and medication overuse",
    {"type": "header", "text": "Drug Classes Used in Prophylaxis:"},
    "1. Beta-blockers (FIRST-LINE) — propranolol, metoprolol, timolol",
    "2. Antiepileptics — topiramate, valproate (divalproex)",
    "3. Antidepressants — amitriptyline, venlafaxine",
    "4. Calcium channel blockers — verapamil",
    "5. CGRP monoclonal antibodies — erenumab, galcanezumab, fremanezumab, eptinezumab",
    "6. Botulinum toxin (OnabotulinumtoxinA) — for chronic migraine",
], note="Trial period of at least 2–3 months needed to assess efficacy; gradual dose titration recommended")


# ═══════════════════════════════════════════════════════════════════════════════
#  SLIDE 14 — PROPHYLACTIC AGENTS DETAILS
# ═══════════════════════════════════════════════════════════════════════════════
slide = prs.slides.add_slide(blank)
add_two_col_slide(
    slide,
    "Prophylactic Drug Classes — Details",
    "Beta-blockers & AEDs",
    [
        "Propranolol: 40–240 mg/day — DOC",
        "Metoprolol: 50–200 mg/day",
        "Mechanism: unclear; reduce cortical excitability",
        "SE: fatigue, bradycardia, cold extremities",
        "CI: asthma, heart block, depression",
        "",
        "Topiramate: 25–100 mg/day",
        "Valproate/Divalproex: 500–1500 mg/day",
        "AED MOA: Na+ channel block, GABA enhancement",
        "Topiramate SE: cognitive impairment, weight loss",
        "Valproate SE: weight gain, teratogenic (CI in pregnancy)",
    ],
    "Antidepressants & CCBs",
    [
        "Amitriptyline: 10–100 mg/day (TCA)",
        "Venlafaxine: 75–150 mg/day (SNRI)",
        "MOA: 5-HT/NE reuptake inhibition",
        "SE (amitriptyline): anticholinergic, sedation",
        "Useful if comorbid depression/insomnia",
        "",
        "Verapamil: 240–480 mg/day (CCB)",
        "Less evidence than beta-blockers",
        "Useful with cardiac contraindications to BB",
        "",
        "OnabotulinumtoxinA (Botox):",
        "31 injections Q12 weeks — chronic migraine only",
    ],
    col_color_r=RGBColor(0xE0, 0xF0, 0xFF)
)


# ═══════════════════════════════════════════════════════════════════════════════
#  SLIDE 15 — CGRP MONOCLONAL ANTIBODIES
# ═══════════════════════════════════════════════════════════════════════════════
slide = prs.slides.add_slide(blank)
add_bullet_slide(slide, "CGRP Monoclonal Antibodies — Preventive Therapy", [
    "First drug class specifically developed FOR migraine prevention",
    {"type": "header", "text": "Drugs & Targets:"},
    {"type": "sub", "text": "  Erenumab — targets CGRP receptor (monthly SC injection)"},
    {"type": "sub", "text": "  Fremanezumab — targets CGRP peptide (monthly or quarterly SC)"},
    {"type": "sub", "text": "  Galcanezumab — targets CGRP peptide (monthly SC)"},
    {"type": "sub", "text": "  Eptinezumab — targets CGRP peptide (quarterly IV infusion)"},
    {"type": "header", "text": "Mechanism:"},
    "Antibodies bind CGRP or its receptor → block CGRP-mediated vasodilation and neurogenic inflammation",
    "Reduce trigeminal sensitization at both peripheral and central levels",
    {"type": "header", "text": "Efficacy:"},
    "Reduce migraine days by ~50% in majority of patients; ~25% achieve ≥75% reduction",
    {"type": "header", "text": "Adverse Effects:"},
    {"type": "sub", "text": "  - Injection site reactions, constipation, nasopharyngitis"},
    {"type": "sub", "text": "  - Generally well-tolerated; no hepatotoxicity or CNS effects"},
    {"type": "header", "text": "Advantage over traditional prophylactics:"},
    "No CNS side effects; once-monthly/quarterly dosing improves adherence",
], note="Indicated for episodic or chronic migraine with ≥4 headache days/month")


# ═══════════════════════════════════════════════════════════════════════════════
#  SLIDE 16 — SPECIAL POPULATIONS
# ═══════════════════════════════════════════════════════════════════════════════
slide = prs.slides.add_slide(blank)
add_bullet_slide(slide, "Special Populations", [
    {"type": "header", "text": "Pregnancy:"},
    {"type": "sub", "text": "  - Migraine often improves in 2nd/3rd trimester (estrogen stabilization)"},
    {"type": "sub", "text": "  - Safest acute drugs: acetaminophen, metoclopramide"},
    {"type": "sub", "text": "  - Triptans: use only if benefit outweighs risk; sumatriptan has most safety data"},
    {"type": "sub", "text": "  - AVOID: ergots (oxytocic risk), valproate (teratogen), triptans in 1st trimester"},
    {"type": "header", "text": "Menstrual Migraine:"},
    {"type": "sub", "text": "  - Linked to estrogen withdrawal; timed frovatriptan mini-prophylaxis used"},
    {"type": "header", "text": "Pediatric:"},
    {"type": "sub", "text": "  - Attacks often shorter; ibuprofen or acetaminophen first"},
    {"type": "sub", "text": "  - Sumatriptan nasal spray approved ≥12 years in some guidelines"},
    {"type": "header", "text": "Cardiovascular Disease:"},
    {"type": "sub", "text": "  - AVOID triptans (vasoconstriction risk); ergots also contraindicated"},
    {"type": "sub", "text": "  - Prefer: lasmiditan or gepants (no vasoconstriction)"},
    {"type": "header", "text": "Hepatic/Renal Impairment:"},
    {"type": "sub", "text": "  - Eletriptan CI in hepatic disease; naratriptan CI in severe renal/hepatic impairment"},
    {"type": "sub", "text": "  - Gepants: ubrogepant CI with strong CYP3A4 inhibitors"},
])


# ═══════════════════════════════════════════════════════════════════════════════
#  SLIDE 17 — TREATMENT ALGORITHM
# ═══════════════════════════════════════════════════════════════════════════════
slide = prs.slides.add_slide(blank)
add_rect(slide, 0, 0, 13.333, 7.5, WHITE)
add_rect(slide, 0, 0, 13.333, 1.1, DEEP_PURPLE)
add_text(slide, "Migraine Treatment Algorithm", 0.35, 0.12, 12.5, 0.85,
         font_size=30, bold=True, color=WHITE)
add_rect(slide, 0, 1.1, 13.333, 0.06, GOLD)

# ACUTE flowchart blocks
def flow_box(slide, x, y, w, h, text, bg, fg=WHITE, fsize=13):
    add_rect(slide, x, y, w, h, bg)
    add_text(slide, text, x+0.05, y+0.04, w-0.1, h-0.08,
             font_size=fsize, bold=True, color=fg, align=PP_ALIGN.CENTER)

def arrow(slide, x, y):
    add_text(slide, "▼", x, y, 0.4, 0.35, font_size=18, bold=True,
             color=MED_PURPLE, align=PP_ALIGN.CENTER)

# Acute pathway
add_text(slide, "ACUTE TREATMENT", 0.3, 1.25, 6.1, 0.4,
         font_size=14, bold=True, color=DEEP_PURPLE, align=PP_ALIGN.CENTER)
flow_box(slide, 0.3, 1.65, 6.1, 0.6, "Migraine Attack Onset", DEEP_PURPLE)
arrow(slide, 3.0, 2.28)
flow_box(slide, 0.3, 2.6, 2.7, 0.7, "Mild–Moderate\nNSAIDs / Acetaminophen\n± Antiemetic", 
         TEAL, fsize=11)
flow_box(slide, 3.3, 2.6, 3.1, 0.7, "Moderate–Severe\nTriptans (1st line)\nor Ergots (DHE)", 
         MED_PURPLE, fsize=11)
arrow(slide, 2.0, 3.34)
flow_box(slide, 0.3, 3.65, 6.1, 0.6, "If CVD / Triptan contraindicated:\nLasmiditan or Gepants (Rimegepant / Ubrogepant)", 
         TEAL, fsize=11)
arrow(slide, 3.0, 4.28)
flow_box(slide, 0.3, 4.6, 6.1, 0.55, "Refractory: IV Prochlorperazine / DHE / Steroids", 
         RED_WARN, fsize=12)

# Prophylaxis pathway
add_text(slide, "PROPHYLAXIS", 6.9, 1.25, 6.1, 0.4,
         font_size=14, bold=True, color=DEEP_PURPLE, align=PP_ALIGN.CENTER)
flow_box(slide, 6.9, 1.65, 6.1, 0.6, "≥2 Migraines/Month or Significant Disability", DEEP_PURPLE)
arrow(slide, 9.5, 2.28)
flow_box(slide, 6.9, 2.6, 6.1, 0.65, "First-Line:\nPropranolol / Topiramate / Amitriptyline", 
         MED_PURPLE, fsize=12)
arrow(slide, 9.5, 3.28)
flow_box(slide, 6.9, 3.6, 6.1, 0.65, "Inadequate Response:\nCGRP mAbs (Erenumab / Galcanezumab)", 
         GREEN_OK, fsize=12)
arrow(slide, 9.5, 4.28)
flow_box(slide, 6.9, 4.6, 6.1, 0.55, "Chronic Migraine: + OnabotulinumtoxinA", 
         TEAL, fsize=12)

add_rect(slide, 0.3, 5.5, 12.7, 1.6, LIGHT_PURPLE)
add_text(slide, 
    "Key Reminders: Start acute treatment early  |  Limit analgesics <15 days/month (triptans <10)  |  "
    "Reassess prophylaxis after 3 months  |  Treat comorbidities (depression, anxiety, sleep disorders)",
    0.4, 5.55, 12.5, 1.4, font_size=13, color=DEEP_PURPLE, wrap=True)


# ═══════════════════════════════════════════════════════════════════════════════
#  SLIDE 18 — SUMMARY TABLE
# ═══════════════════════════════════════════════════════════════════════════════
slide = prs.slides.add_slide(blank)
add_rect(slide, 0, 0, 13.333, 7.5, WHITE)
add_rect(slide, 0, 0, 13.333, 1.1, DEEP_PURPLE)
add_text(slide, "Summary: Drugs Used in Migraine Therapy", 0.35, 0.12, 12.5, 0.85,
         font_size=28, bold=True, color=WHITE)
add_rect(slide, 0, 1.1, 13.333, 0.06, GOLD)

from pptx.util import Inches, Pt

# Table headers
headers = ["Drug Class", "Examples", "Use", "MOA", "Key Notes"]
col_widths = [2.1, 2.8, 1.3, 3.5, 3.3]
col_x = [0.2, 2.3, 5.1, 6.4, 9.9]

# Header row
for i, (hdr, cx, cw) in enumerate(zip(headers, col_x, col_widths)):
    add_rect(slide, cx, 1.2, cw-0.05, 0.45, DEEP_PURPLE)
    add_text(slide, hdr, cx+0.05, 1.22, cw-0.1, 0.4,
             font_size=12, bold=True, color=WHITE, align=PP_ALIGN.CENTER)

rows = [
    ("Triptans", "Sumatriptan\nRizatriptan\nEletriptan", "Acute\n(1st line)", 
     "5-HT1B/1D agonist\nVasoconstriction +\nneuropeptide block",
     "CI: CAD, HTN\nDo not use with ergots\n70% response rate"),
    ("Ergots", "Ergotamine\nDHE", "Acute\n(2nd line)", 
     "5-HT1B/1D, α, DA\nreceptor agonist",
     "Rebound headache\nCI: pregnancy, PVD\nLargely replaced by triptans"),
    ("Ditans", "Lasmiditan", "Acute\n(alternative)", 
     "5-HT1F agonist\n(no vasoconstriction)",
     "Safe in CVD\nControlled substance\nAvoid driving 8h"),
    ("Gepants", "Ubrogepant\nRimegepant", "Acute ±\nPrevention", 
     "CGRP receptor\nantagonist",
     "Safe in CVD\nRimegepant also\nfor prevention"),
    ("Beta-blockers", "Propranolol\nMetoprolol", "Prevention\n(1st line)", 
     "Unknown; reduces\ncortical excitability",
     "CI: asthma, heart block\nDOC for prophylaxis"),
    ("AEDs", "Topiramate\nValproate", "Prevention", 
     "Na+ channel block\nGABA enhancement",
     "Topiramate: wt loss\nValproate: teratogenic"),
    ("CGRP mAbs", "Erenumab\nGalcanezumab\nFremanezumab", "Prevention", 
     "Bind CGRP or\nCGRP receptor",
     "Monthly/quarterly SC\nFewest CNS SE\nMigraine-specific"),
]

row_colors = [LIGHT_PURPLE, WHITE, LIGHT_PURPLE, WHITE, LIGHT_PURPLE, WHITE, LIGHT_PURPLE]
row_height = 0.73

for r_idx, (row_data, bg) in enumerate(zip(rows, row_colors)):
    y = 1.65 + r_idx * row_height
    for i, (cell_text, cx, cw) in enumerate(zip(row_data, col_x, col_widths)):
        add_rect(slide, cx, y, cw-0.05, row_height-0.03, bg)
        add_text(slide, cell_text, cx+0.05, y+0.02, cw-0.1, row_height-0.07,
                 font_size=10, color=DARK_GRAY, wrap=True)


# ═══════════════════════════════════════════════════════════════════════════════
#  SLIDE 19 — KEY POINTS & REFERENCES
# ═══════════════════════════════════════════════════════════════════════════════
slide = prs.slides.add_slide(blank)
add_rect(slide, 0, 0, 13.333, 7.5, RGBColor(0xF7,0xF4,0xFF))
add_rect(slide, 0, 0, 13.333, 1.1, DEEP_PURPLE)
add_text(slide, "Key Points & References", 0.35, 0.12, 12.5, 0.85,
         font_size=30, bold=True, color=WHITE)
add_rect(slide, 0, 1.1, 13.333, 0.06, GOLD)

key_points = [
    "Migraine is a complex neurovascular disorder — both 5-HT and CGRP are key mediators",
    "Triptans (5-HT1B/1D agonists) are first-line for acute moderate-severe migraine",
    "CGRP-based drugs (gepants, mAbs) are the most recent class with cardiovascular safety",
    "Prophylaxis indicated when attacks occur ≥2/month; propranolol & topiramate are first-line",
    "Medication overuse headache (MOH) is a key complication to monitor and prevent",
    "Drug selection must consider comorbidities, pregnancy, and cardiovascular risk",
    "CGRP monoclonal antibodies represent the first migraine-specific preventive drug class",
]

add_text(slide, "Key Take-Away Points:", 0.4, 1.25, 12.5, 0.45,
         font_size=17, bold=True, color=DEEP_PURPLE)
y = 1.7
for pt in key_points:
    add_rect(slide, 0.4, y, 0.45, 0.4, MED_PURPLE)
    add_text(slide, "✓", 0.41, y+0.03, 0.43, 0.34, font_size=14, bold=True,
             color=WHITE, align=PP_ALIGN.CENTER)
    add_text(slide, pt, 0.95, y+0.03, 12.0, 0.38, font_size=14, color=DARK_GRAY)
    y += 0.46

add_rect(slide, 0.4, 5.25, 12.5, 1.05, WHITE)
add_text(slide, "References:", 0.55, 5.28, 12.0, 0.35,
         font_size=13, bold=True, color=DEEP_PURPLE)
refs = [
    "1. Brunton LL et al. Goodman & Gilman's Pharmacological Basis of Therapeutics, 13e. McGraw-Hill, 2018",
    "2. Lippincott Illustrated Reviews: Pharmacology, 8e. Wolters Kluwer, 2023",
    "3. Katzung BG. Basic and Clinical Pharmacology, 16e. McGraw-Hill, 2021",
]
for i, ref in enumerate(refs):
    add_text(slide, ref, 0.55, 5.6 + i*0.23, 12.2, 0.22,
             font_size=10, italic=True, color=MID_GRAY)

# Thank you banner
add_rect(slide, 0, 6.65, 13.333, 0.85, DEEP_PURPLE)
add_text(slide, "Thank You  |  Questions?", 0, 6.7, 13.333, 0.6,
         font_size=22, bold=True, color=WHITE, align=PP_ALIGN.CENTER)


# ─── Save ─────────────────────────────────────────────────────────────────────
out_path = "/tmp/workspace/migraine-ppt/Migraine_Therapy_Pharmacology.pptx"
buf = BytesIO()
prs.save(buf)
with open(out_path, "wb") as f:
    f.write(buf.getvalue())

print(f"Saved: {out_path}")
print(f"Total slides: {len(prs.slides)}")
Running Command

cd /tmp/workspace/migraine-ppt && python build_ppt.py 2>&1

The file built successfully with 19 slides. Let me verify the file size is valid.
Running Command

ls -lh /tmp/workspace/migraine-ppt/Migraine_Therapy_Pharmacology.pptx

Your presentation is ready! Download it here:

Migraine Therapy Pharmacology

Presentation · PPTX


Here is what's included across the 19 slides (16:9 widescreen, purple/gold theme):
#Slide Title
1Title Slide
2Lecture Outline
3Introduction & Epidemiology
4Classification of Migraine (ICHD-3)
5Pathophysiology (CSD, Trigeminovascular hypothesis)
6Role of Serotonin (5-HT)
7Role of CGRP
8Acute Treatment - Overview & Step-Care
9Triptans - MOA, PK, ADRs, Contraindications
10Ergot Alkaloids
11Newer Agents: Ditans (Lasmiditan) & Gepants (Rimegepant/Ubrogepant) - two-column layout
12Non-Specific Analgesics & Antiemetics
13Prophylaxis - Indications & Drug Classes
14Prophylactic Agents Details - two-column layout
15CGRP Monoclonal Antibodies (erenumab, galcanezumab, etc.)
16Special Populations (pregnancy, CVD, paediatrics)
17Treatment Algorithm (visual flowchart)
18Summary Table - all drug classes at a glance
19Key Points & References
Content sourced from: Goodman & Gilman's 13e, Lippincott Illustrated Reviews Pharmacology 8e, and Katzung's Basic & Clinical Pharmacology 16e.
This is a shared conversation. Sign in to Orris to start your own chat.