attachment
attachment

use this book as reference and use other referance and make a ppt for teaching and exam point of view as per the following questions

analyse_media
Reading File
Reading File
Reading File
Running Command

python3 << 'EOF' import pdfplumber pdf_path = "/tmp/workspace/attachments/bab20d39-44a8-44c2-9b1b-7a5164d1b1cb/Pharmacotherapeutics by DIPIRO.pdf" with pdfplumber.open(pdf_path) as pdf: print(f"Total pages: {len(pdf.pages)}") # Search for pain/headache/migraine chapters in first 50 pages (TOC) for i, page in enumerate(pdf.pages[:60]): text = page.extract_text() if text and any(kw in text.lower() for kw in ['pain', 'headache', 'migraine', 'neuralgia', 'cancer']): print(f"\n=== PAGE {i+1} ===") print(text[:1000]) print("---") EOF

Searching the Web

WHO pain ladder management pharmacotherapy DiPiro migraine headache neuralgia treatment guidelines 2024

Running Command

mkdir -p /tmp/workspace/pain-headache-ppt && ls /tmp/workspace/pain-headache-ppt/

Writing File

~/pain-headache-ppt/create_ppt.py

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
from io import BytesIO

# ── Color palette ──────────────────────────────────────────────────────────────
DARK_BLUE   = RGBColor(0x1A, 0x35, 0x5E)   # deep navy
MID_BLUE    = RGBColor(0x1F, 0x6F, 0xB8)   # accent blue
LIGHT_BLUE  = RGBColor(0xD0, 0xE4, 0xF7)   # background tint
TEAL        = RGBColor(0x00, 0x7B, 0x83)   # teal accent
ORANGE      = RGBColor(0xE8, 0x6C, 0x1A)   # highlight orange
WHITE       = RGBColor(0xFF, 0xFF, 0xFF)
DARK_GRAY   = RGBColor(0x33, 0x33, 0x33)
LIGHT_GRAY  = RGBColor(0xF4, 0xF7, 0xFC)
GREEN       = RGBColor(0x1E, 0x8A, 0x44)
RED         = RGBColor(0xC0, 0x39, 0x2B)
YELLOW_BG   = RGBColor(0xFF, 0xF3, 0xCD)

prs = Presentation()
prs.slide_width  = Inches(13.333)
prs.slide_height = Inches(7.5)
blank = prs.slide_layouts[6]

# ─────────────────────────────────────────────────────────────────────────────
# Helper utilities
# ─────────────────────────────────────────────────────────────────────────────
def add_rect(slide, x, y, w, h, fill_rgb, alpha=None):
    shape = slide.shapes.add_shape(1, Inches(x), Inches(y), Inches(w), Inches(h))
    shape.fill.solid(); shape.fill.fore_color.rgb = fill_rgb
    shape.line.fill.background()
    return shape

def add_textbox(slide, x, y, w, h, text, font_size=18, bold=False,
                color=DARK_GRAY, align=PP_ALIGN.LEFT, wrap=True, italic=False):
    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(4); tf.margin_right = Pt(4)
    tf.margin_top = Pt(2);  tf.margin_bottom = Pt(2)
    p = tf.paragraphs[0]; p.alignment = align
    r = p.add_run(); r.text = text
    r.font.name = "Calibri"; r.font.size = Pt(font_size)
    r.font.bold = bold; r.font.italic = italic
    r.font.color.rgb = color
    return tb

def add_para(tf, text, font_size=15, bold=False, color=DARK_GRAY,
             align=PP_ALIGN.LEFT, space_before=Pt(4), italic=False):
    p = tf.add_paragraph(); p.alignment = align
    p.space_before = space_before
    r = p.add_run(); r.text = text
    r.font.name = "Calibri"; r.font.size = Pt(font_size)
    r.font.bold = bold; r.font.italic = italic; r.font.color.rgb = color
    return p

def slide_header(slide, title, subtitle=None, title_color=WHITE,
                 bar_color=DARK_BLUE, sub_color=LIGHT_BLUE):
    add_rect(slide, 0, 0, 13.333, 1.15, bar_color)
    add_textbox(slide, 0.35, 0.08, 12.6, 0.75, title, font_size=28,
                bold=True, color=title_color, align=PP_ALIGN.LEFT)
    if subtitle:
        add_textbox(slide, 0.35, 0.82, 12.6, 0.32, subtitle, font_size=14,
                    color=sub_color, align=PP_ALIGN.LEFT, italic=True)
    # bottom accent line
    add_rect(slide, 0, 7.3, 13.333, 0.2, MID_BLUE)
    add_textbox(slide, 0.3, 7.3, 12.7, 0.2,
                "Pharmacotherapeutics  |  DiPiro et al.  |  Pain & Headache Management",
                font_size=9, color=WHITE, align=PP_ALIGN.CENTER)

def bullet_slide(slide, title, bullets, subtitle=None,
                 col2_bullets=None, note_text=None,
                 bullet_size=15, header_sub=None):
    slide_header(slide, title, header_sub)
    add_rect(slide, 0, 1.15, 13.333, 6.15, LIGHT_GRAY)

    if col2_bullets:
        # Two-column layout
        col_w = 6.2
        for col_idx, bullet_list in enumerate([bullets, col2_bullets]):
            ox = 0.25 + col_idx * 6.83
            tb = slide.shapes.add_textbox(Inches(ox), Inches(1.25),
                                          Inches(col_w), Inches(5.8))
            tf = tb.text_frame; tf.word_wrap = True
            tf.margin_left = Pt(4); tf.margin_right = Pt(4)
            for i, b in enumerate(bullet_list):
                if isinstance(b, tuple):
                    txt, size, bld, col = b
                else:
                    txt, size, bld, col = b, bullet_size, False, DARK_GRAY
                if i == 0:
                    p = tf.paragraphs[0]
                else:
                    p = tf.add_paragraph()
                p.alignment = PP_ALIGN.LEFT
                p.space_before = Pt(3)
                r = p.add_run(); r.text = txt
                r.font.name = "Calibri"; r.font.size = Pt(size)
                r.font.bold = bld; r.font.color.rgb = col
    else:
        tb = slide.shapes.add_textbox(Inches(0.35), Inches(1.25),
                                      Inches(12.7), Inches(5.8))
        tf = tb.text_frame; tf.word_wrap = True
        tf.margin_left = Pt(4); tf.margin_right = Pt(4)
        for i, b in enumerate(bullets):
            if isinstance(b, tuple):
                txt, size, bld, col = b
            else:
                txt, size, bld, col = b, bullet_size, False, DARK_GRAY
            if i == 0:
                p = tf.paragraphs[0]
            else:
                p = tf.add_paragraph()
            p.alignment = PP_ALIGN.LEFT
            p.space_before = Pt(3)
            r = p.add_run(); r.text = txt
            r.font.name = "Calibri"; r.font.size = Pt(size)
            r.font.bold = bld; r.font.color.rgb = col

    if note_text:
        add_rect(slide, 0.3, 6.8, 12.7, 0.45, YELLOW_BG)
        add_textbox(slide, 0.45, 6.82, 12.4, 0.4, "★  " + note_text,
                    font_size=12, bold=True, color=ORANGE)

# ─────────────────────────────────────────────────────────────────────────────
# SLIDE 1 – TITLE
# ─────────────────────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
add_rect(slide, 0, 0, 13.333, 7.5, DARK_BLUE)
add_rect(slide, 0, 2.8, 13.333, 2.1, MID_BLUE)
add_rect(slide, 0, 0, 0.15, 7.5, ORANGE)
add_rect(slide, 13.183, 0, 0.15, 7.5, ORANGE)

add_textbox(slide, 0.5, 0.5, 12.3, 1.0,
            "PAIN & HEADACHE MANAGEMENT", font_size=38, bold=True,
            color=WHITE, align=PP_ALIGN.CENTER)
add_textbox(slide, 0.5, 1.55, 12.3, 0.7,
            "Pharmacotherapeutics  |  Exam-Oriented Teaching Module",
            font_size=20, color=LIGHT_BLUE, align=PP_ALIGN.CENTER, italic=True)

add_textbox(slide, 0.5, 2.9, 12.3, 0.7,
            "Topics: Pain Types & Management  •  WHO Pain Ladder  •  Neuropathic Pain  •  Neuralgia",
            font_size=16, color=WHITE, align=PP_ALIGN.CENTER)
add_textbox(slide, 0.5, 3.55, 12.3, 0.55,
            "Migraine  •  Cluster Headache  •  Tension Headache  •  Cancer Pain",
            font_size=16, color=WHITE, align=PP_ALIGN.CENTER)

add_textbox(slide, 0.5, 4.5, 12.3, 0.5,
            "Reference: DiPiro – Pharmacotherapy: A Pathophysiologic Approach",
            font_size=14, color=LIGHT_BLUE, align=PP_ALIGN.CENTER, italic=True)
add_textbox(slide, 0.5, 5.1, 12.3, 0.5,
            "IHS Classification  •  Treatment Algorithms  •  Exam Q&A Points",
            font_size=14, color=LIGHT_BLUE, align=PP_ALIGN.CENTER)

add_textbox(slide, 0.5, 6.5, 12.3, 0.6,
            "For B.Pharm / M.Pharm / Pharm.D Examinations",
            font_size=13, color=ORANGE, align=PP_ALIGN.CENTER, bold=True)

# ─────────────────────────────────────────────────────────────────────────────
# SLIDE 2 – SECTION DIVIDER: PAIN
# ─────────────────────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
add_rect(slide, 0, 0, 13.333, 7.5, TEAL)
add_rect(slide, 0, 2.9, 13.333, 1.8, RGBColor(0x00, 0x5A, 0x60))
add_textbox(slide, 0.5, 1.2, 12.3, 1.0,
            "SECTION I", font_size=36, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
add_textbox(slide, 0.5, 2.2, 12.3, 0.6,
            "PAIN MANAGEMENT", font_size=42, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
add_textbox(slide, 0.5, 3.05, 12.3, 0.6,
            "Definition  •  Types  •  Assessment  •  WHO Ladder  •  Pharmacotherapy  •  Non-Pharmacological",
            font_size=16, color=LIGHT_BLUE, align=PP_ALIGN.CENTER, italic=True)
add_textbox(slide, 0.5, 5.8, 12.3, 0.5,
            "DiPiro Chapter 30 – Pain Management", font_size=14,
            color=YELLOW_BG, align=PP_ALIGN.CENTER, italic=True)

# ─────────────────────────────────────────────────────────────────────────────
# SLIDE 3 – DEFINITION & TYPES OF PAIN
# ─────────────────────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
bullet_slide(slide,
    "Definition & Classification of Pain",
    [
        ("DEFINITION (IASP):", 16, True, DARK_BLUE),
        ("  Pain is an unpleasant sensory & emotional experience associated with actual or potential tissue damage. It is subjective – only the patient can describe it.", 14, False, DARK_GRAY),
        ("", 8, False, DARK_GRAY),
        ("TYPES OF PAIN:", 16, True, DARK_BLUE),
        ("  1. NOCICEPTIVE PAIN – due to tissue injury; subdivided into:", 15, True, TEAL),
        ("       • Somatic: well-localised, sharp/aching. Eg: bone fracture, surgery", 14, False, DARK_GRAY),
        ("       • Visceral: diffuse, poorly localised, often referred. Eg: GI pain", 14, False, DARK_GRAY),
        ("  2. NEUROPATHIC PAIN – damage to nervous system; burning/shooting/electric-like", 15, True, TEAL),
        ("       • Peripheral: PHN, diabetic neuropathy, HIV neuropathy, chemotherapy-induced", 14, False, DARK_GRAY),
        ("       • Central: trigeminal neuralgia, central post-stroke pain, CRPS", 14, False, DARK_GRAY),
        ("  3. INFLAMMATORY PAIN – arthritis, NSAIDs effective", 15, True, TEAL),
        ("  4. FUNCTIONAL PAIN – no identifiable cause (fibromyalgia, IBS)", 15, True, TEAL),
        ("", 8, False, DARK_GRAY),
        ("DURATION:", 16, True, DARK_BLUE),
        ("  • Acute pain: resolves as tissue heals; protective role", 14, False, DARK_GRAY),
        ("  • Chronic pain: persists >3 months beyond expected healing; not protective", 14, False, DARK_GRAY),
    ],
    note_text="Exam tip: Distinguish nociceptive vs neuropathic – key for drug selection!"
)

# ─────────────────────────────────────────────────────────────────────────────
# SLIDE 4 – CLINICAL PRESENTATION & CHARACTERISTICS OF NEUROPATHIC PAIN
# ─────────────────────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
bullet_slide(slide,
    "Clinical Presentation of Pain & Neuropathic Pain Characteristics",
    [
        ("CLINICAL PRESENTATION OF PAIN (PQRST Approach):", 16, True, DARK_BLUE),
        ("  P – Palliative/Precipitating factors (what makes it better/worse)", 14, False, DARK_GRAY),
        ("  Q – Quality (sharp, dull, burning, throbbing, stabbing)", 14, False, DARK_GRAY),
        ("  R – Radiation/Location (localised or referred)", 14, False, DARK_GRAY),
        ("  S – Severity (0-10 numeric scale / VAS / FACES scale)", 14, False, DARK_GRAY),
        ("  T – Temporal (onset, duration, constant vs intermittent)", 14, False, DARK_GRAY),
        ("", 8, False, DARK_GRAY),
        ("CHARACTERISTICS OF NEUROPATHIC PAIN:", 16, True, DARK_BLUE),
        ("  ✦ Burning, shooting, or electric shock-like quality", 14, False, DARK_GRAY),
        ("  ✦ Allodynia – pain from non-painful stimulus (e.g., light touch)", 14, False, DARK_GRAY),
        ("  ✦ Hyperalgesia – exaggerated pain response to painful stimulus", 14, False, DARK_GRAY),
        ("  ✦ Spontaneous pain – occurs without any stimulus", 14, False, DARK_GRAY),
        ("  ✦ Often chronic and difficult to treat completely", 14, False, DARK_GRAY),
        ("  ✦ Examples: PHN (post-herpetic neuralgia), diabetic neuropathy, trigeminal neuralgia", 14, False, DARK_GRAY),
        ("", 8, False, DARK_GRAY),
        ("PAIN ASSESSMENT SCALES:", 16, True, DARK_BLUE),
        ("  • 0-10 Numeric Rating Scale (NRS)  • Visual Analogue Scale (VAS)  • FACES Scale (paediatric)", 14, False, DARK_GRAY),
        ("  • Simple Descriptive Scale: No Pain → Mild → Moderate → Severe → Very Severe → Worst", 14, False, DARK_GRAY),
    ],
    note_text="2-mark exam tip: Allodynia & hyperalgesia are hallmarks of neuropathic pain"
)

# ─────────────────────────────────────────────────────────────────────────────
# SLIDE 5 – WHO PAIN LADDER
# ─────────────────────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
slide_header(slide, "WHO Pain Ladder for Cancer Pain Management",
             "3-Step Analgesic Approach – Applicable to all chronic pain")
add_rect(slide, 0, 1.15, 13.333, 6.15, LIGHT_GRAY)

# Step boxes
steps = [
    ("STEP 1", "Mild Pain\n(NRS 1–3)",
     "Non-opioid Analgesics:\n• Acetaminophen (APAP)\n• NSAIDs (Ibuprofen, Naproxen)\n± Adjuvants",
     RGBColor(0x27, 0xAE, 0x60), 0.3),
    ("STEP 2", "Moderate Pain\n(NRS 4–6)",
     "Weak Opioids:\n• Codeine\n• Tramadol\n• Low-dose oral morphine\n+ Non-opioid ± Adjuvants",
     ORANGE, 4.55),
    ("STEP 3", "Severe Pain\n(NRS 7–10)",
     "Strong Opioids:\n• Morphine (drug of choice)\n• Oxycodone, Hydromorphone\n• Fentanyl (transdermal)\n+ Non-opioid ± Adjuvants",
     RED, 8.8),
]
for step, severity, drugs, color, ox in steps:
    add_rect(slide, ox, 1.3, 4.2, 1.0, color)
    add_textbox(slide, ox+0.1, 1.35, 4.0, 0.9,
                step, font_size=20, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
    add_rect(slide, ox, 2.35, 4.2, 0.7, RGBColor(0xE0, 0xE0, 0xE0))
    add_textbox(slide, ox+0.1, 2.4, 4.0, 0.6,
                severity, font_size=13, bold=True, color=DARK_BLUE, align=PP_ALIGN.CENTER)
    add_rect(slide, ox, 3.1, 4.2, 3.5, WHITE)
    add_textbox(slide, ox+0.15, 3.15, 3.95, 3.4,
                drugs, font_size=13, color=DARK_GRAY, align=PP_ALIGN.LEFT)

# Arrow
add_textbox(slide, 4.22, 2.5, 0.3, 0.5, "▶", font_size=22, color=MID_BLUE)
add_textbox(slide, 8.48, 2.5, 0.3, 0.5, "▶", font_size=22, color=MID_BLUE)

add_rect(slide, 0.3, 6.75, 12.7, 0.5, YELLOW_BG)
add_textbox(slide, 0.5, 6.77, 12.4, 0.45,
            "★  Adjuvants (at any step): TCAs, AEDs (gabapentin/pregabalin), corticosteroids, muscle relaxants, bisphosphonates  |  'By the clock' – regular dosing, not PRN",
            font_size=12, bold=True, color=ORANGE)

# ─────────────────────────────────────────────────────────────────────────────
# SLIDE 6 – NON-PHARMACOLOGICAL THERAPY
# ─────────────────────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
bullet_slide(slide,
    "Non-Pharmacological Therapy of Pain",
    [
        ("PSYCHOLOGICAL INTERVENTIONS:", 16, True, DARK_BLUE),
        ("  • Cognitive Behavioural Therapy (CBT) – modifies pain perception and coping", 14, False, DARK_GRAY),
        ("  • Relaxation techniques – progressive muscle relaxation, deep breathing", 14, False, DARK_GRAY),
        ("  • Biofeedback – effective in headache & chronic low back pain", 14, False, DARK_GRAY),
        ("  • Support groups & spiritual counselling", 14, False, DARK_GRAY),
        ("  • Patient & family education", 14, False, DARK_GRAY),
        ("", 8, False, DARK_GRAY),
        ("PHYSICAL THERAPY:", 16, True, DARK_BLUE),
        ("  • Heat therapy – local hot packs, hydrotherapy, paraffin wrap, heating modalities", 14, False, DARK_GRAY),
        ("  • Cold therapy – useful in acute musculoskeletal injuries, sprains", 14, False, DARK_GRAY),
        ("  • TENS (Transcutaneous Electrical Nerve Stimulation)", 14, False, DARK_GRAY),
        ("  • Massage, ultrasound therapy, therapeutic exercise", 14, False, DARK_GRAY),
        ("", 8, False, DARK_GRAY),
        ("OTHER APPROACHES:", 16, True, DARK_BLUE),
        ("  • Acupuncture – useful in chronic pain conditions", 14, False, DARK_GRAY),
        ("  • TENS – interrupts pain transmission pathways", 14, False, DARK_GRAY),
        ("  • Nerve blocks, spinal cord stimulation (for severe refractory pain)", 14, False, DARK_GRAY),
        ("  • Lifestyle modifications: sleep hygiene, diet, exercise", 14, False, DARK_GRAY),
    ],
    note_text="Non-pharmacological therapy is COMPLEMENTARY – used with pharmacological therapy"
)

# ─────────────────────────────────────────────────────────────────────────────
# SLIDE 7 – OPIOID ANALGESICS & ADVERSE EFFECTS
# ─────────────────────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
bullet_slide(slide,
    "Opioid Analgesics – Pharmacotherapy & Adverse Effects",
    [
        ("MECHANISM: Stimulate µ, κ, δ opioid receptors in CNS → analgesia", 15, True, DARK_BLUE),
        ("", 7, False, DARK_GRAY),
        ("CLASSIFICATION:", 15, True, TEAL),
        ("  • Short-acting: Morphine IR, Oxycodone IR, Codeine, Tramadol, Hydromorphone", 14, False, DARK_GRAY),
        ("  • Long-acting: Morphine SR (MS Contin), Oxycodone CR (OxyContin), Fentanyl patch, Methadone", 14, False, DARK_GRAY),
        ("", 7, False, DARK_GRAY),
        ("MAJOR ADVERSE EFFECTS OF OPIOIDS (★ High-yield 2-mark answer):", 16, True, RED),
        ("  GI System:", 14, True, DARK_GRAY),
        ("    • Constipation (most common, does NOT develop tolerance – use laxatives prophylactically)", 14, False, DARK_GRAY),
        ("    • Nausea & vomiting (on initiation, tolerance develops)", 14, False, DARK_GRAY),
        ("  CNS:", 14, True, DARK_GRAY),
        ("    • Sedation, cognitive impairment, euphoria, dysphoria, myoclonus, seizures (meperidine)", 14, False, DARK_GRAY),
        ("  Respiratory: • Respiratory depression (most serious/life-threatening – dose-related)", 14, True, DARK_GRAY),
        ("  Cardiovascular: • Bradycardia, hypotension", 14, False, DARK_GRAY),
        ("  Endocrine: • Hypogonadism, hypothalamic-pituitary suppression (chronic use)", 14, False, DARK_GRAY),
        ("  Other: • Urinary retention, pruritus (histamine release – morphine), physical dependence", 14, False, DARK_GRAY),
        ("  Tolerance: Develops for most effects EXCEPT constipation & miosis", 14, True, TEAL),
    ],
    note_text="MEPERIDINE: Normeperidine metabolite → tremors, myoclonus, seizures – AVOID in elderly/renal failure"
)

# ─────────────────────────────────────────────────────────────────────────────
# SLIDE 8 – BARRIERS TO CANCER PAIN MANAGEMENT
# ─────────────────────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
bullet_slide(slide,
    "Barriers to Effective Pain Management in Cancer Patients",
    [
        ("PATIENT-RELATED BARRIERS:", 16, True, DARK_BLUE),
        ("  • Fear of addiction and dependence on opioids", 14, False, DARK_GRAY),
        ("  • Concerns about side effects (respiratory depression, sedation)", 14, False, DARK_GRAY),
        ("  • Stoicism – reluctance to report pain ('don't want to bother the doctor')", 14, False, DARK_GRAY),
        ("  • Fear that reporting pain means disease is worsening", 14, False, DARK_GRAY),
        ("  • Cultural and religious beliefs about suffering", 14, False, DARK_GRAY),
        ("  • Poor compliance with prescribed regimen", 14, False, DARK_GRAY),
        ("", 8, False, DARK_GRAY),
        ("HEALTHCARE PROVIDER-RELATED BARRIERS:", 16, True, DARK_BLUE),
        ("  • Inadequate pain assessment skills (3/4 physicians cite low competence – DiPiro)", 14, False, DARK_GRAY),
        ("  • Fear of regulatory scrutiny for opioid prescribing", 14, False, DARK_GRAY),
        ("  • Misconceptions about opioid pharmacology", 14, False, DARK_GRAY),
        ("  • Concern about opioid misuse, abuse, and diversion", 14, False, DARK_GRAY),
        ("", 8, False, DARK_GRAY),
        ("SYSTEM-RELATED BARRIERS:", 16, True, DARK_BLUE),
        ("  • Regulatory restrictions on opioid prescribing", 14, False, DARK_GRAY),
        ("  • Limited availability of opioids in some regions", 14, False, DARK_GRAY),
        ("  • Inadequate palliative care infrastructure", 14, False, DARK_GRAY),
        ("  • Cost and insurance issues", 14, False, DARK_GRAY),
    ],
    note_text="Cancer pain is UNDERTREATED worldwide – WHO estimates 80% of patients have inadequate relief"
)

# ─────────────────────────────────────────────────────────────────────────────
# SLIDE 9 – SECTION DIVIDER: NEURALGIA
# ─────────────────────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
add_rect(slide, 0, 0, 13.333, 7.5, RGBColor(0x4A, 0x14, 0x86))
add_rect(slide, 0, 2.9, 13.333, 1.8, RGBColor(0x6A, 0x34, 0xA6))
add_textbox(slide, 0.5, 1.2, 12.3, 1.0,
            "SECTION II", font_size=36, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
add_textbox(slide, 0.5, 2.2, 12.3, 0.6,
            "NEURALGIA", font_size=42, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
add_textbox(slide, 0.5, 3.05, 12.3, 0.6,
            "Types  •  Pathophysiology  •  Clinical Presentation  •  Management",
            font_size=16, color=LIGHT_BLUE, align=PP_ALIGN.CENTER, italic=True)
add_textbox(slide, 0.5, 5.8, 12.3, 0.5,
            "DiPiro Chapter 30 – Neuropathic Pain",
            font_size=14, color=YELLOW_BG, align=PP_ALIGN.CENTER, italic=True)

# ─────────────────────────────────────────────────────────────────────────────
# SLIDE 10 – TYPES OF NEURALGIA
# ─────────────────────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
bullet_slide(slide,
    "Types of Neuralgia",
    [
        ("NEURALGIA: Pain originating from a nerve or nerve trunk, often shooting/burning in nature", 15, True, DARK_BLUE),
        ("", 7, False, DARK_GRAY),
        ("A. PERIPHERAL NEURALGIAS:", 16, True, RGBColor(0x4A, 0x14, 0x86)),
        ("  1. Trigeminal Neuralgia (Tic Douloureux) – CN V; severe, lancinating, unilateral facial pain", 14, False, DARK_GRAY),
        ("  2. Post-Herpetic Neuralgia (PHN) – after herpes zoster reactivation; burning/allodynia", 14, False, DARK_GRAY),
        ("  3. Diabetic Peripheral Neuropathy (DPN) – distal symmetric; burning feet", 14, False, DARK_GRAY),
        ("  4. HIV Neuropathy – painful distal polyneuropathy", 14, False, DARK_GRAY),
        ("  5. Chemotherapy-Induced Peripheral Neuropathy (CIPN) – taxanes, platinum compounds", 14, False, DARK_GRAY),
        ("  6. Glossopharyngeal Neuralgia – CN IX; severe pain in throat/ear/tongue", 14, False, DARK_GRAY),
        ("  7. Occipital Neuralgia – greater/lesser occipital nerve; posterior headache", 14, False, DARK_GRAY),
        ("", 7, False, DARK_GRAY),
        ("B. CENTRAL NEURALGIAS:", 16, True, RGBColor(0x4A, 0x14, 0x86)),
        ("  1. Central Post-Stroke Pain – thalamic pain syndrome; allodynia, spontaneous pain", 14, False, DARK_GRAY),
        ("  2. Multiple Sclerosis-related pain – neuropathic pain common in MS", 14, False, DARK_GRAY),
        ("  3. Spinal Cord Injury Pain", 14, False, DARK_GRAY),
        ("  4. Complex Regional Pain Syndrome (CRPS) Type I & II – burning + autonomic changes", 14, False, DARK_GRAY),
    ],
    note_text="Exam: List 4 types of neuralgia – Trigeminal, PHN, Diabetic, Glossopharyngeal"
)

# ─────────────────────────────────────────────────────────────────────────────
# SLIDE 11 – TRIGEMINAL NEURALGIA – Pathophysiology & Management
# ─────────────────────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
bullet_slide(slide,
    "Trigeminal Neuralgia – Pathophysiology & Management",
    [
        ("DEFINITION: Severe unilateral, lancinating, paroxysmal facial pain along CN V distribution", 15, True, DARK_BLUE),
        ("", 6, False, DARK_GRAY),
        ("PATHOPHYSIOLOGY:", 15, True, RGBColor(0x4A, 0x14, 0x86)),
        ("  • Compression of trigeminal nerve root (by blood vessel – superior cerebellar artery)", 14, False, DARK_GRAY),
        ("  • Demyelination → ectopic discharges → severe paroxysmal pain", 14, False, DARK_GRAY),
        ("  • Triggers: chewing, talking, cold air, brushing teeth, light touch to face", 14, False, DARK_GRAY),
        ("", 6, False, DARK_GRAY),
        ("CLINICAL FEATURES:", 15, True, RGBColor(0x4A, 0x14, 0x86)),
        ("  • Severe electric-shock/stabbing pain; lasts seconds-minutes", 14, False, DARK_GRAY),
        ("  • Unilateral; V2 (maxillary) > V3 (mandibular) > V1 (ophthalmic)", 14, False, DARK_GRAY),
        ("  • Trigger zones on face; pain-free intervals between episodes", 14, False, DARK_GRAY),
        ("", 6, False, DARK_GRAY),
        ("MANAGEMENT:", 16, True, GREEN),
        ("  1st Line Drug: Carbamazepine (DOC) – 200-1200 mg/day; SE: drowsiness, diplopia, aplastic anaemia", 14, True, GREEN),
        ("  2nd Line: Oxcarbazepine (better tolerated than carbamazepine)", 14, False, DARK_GRAY),
        ("  Alternatives: Gabapentin, Pregabalin, Baclofen, Lamotrigine, Phenytoin", 14, False, DARK_GRAY),
        ("  Surgical (refractory cases):", 14, True, DARK_GRAY),
        ("    • Microvascular decompression (MVD) – most effective, long-term relief", 14, False, DARK_GRAY),
        ("    • Gamma Knife radiosurgery, Percutaneous rhizotomy", 14, False, DARK_GRAY),
    ],
    note_text="Carbamazepine is the DRUG OF CHOICE for trigeminal neuralgia – monitor CBC (aplastic anaemia)"
)

# ─────────────────────────────────────────────────────────────────────────────
# SLIDE 12 – POST-HERPETIC NEURALGIA (PHN) MANAGEMENT
# ─────────────────────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
bullet_slide(slide,
    "Post-Herpetic Neuralgia (PHN) – Herpes Neuralgia Management",
    [
        ("DEFINITION: Pain persisting >3 months after acute herpes zoster (shingles) outbreak", 15, True, DARK_BLUE),
        ("PATHOPHYSIOLOGY: VZV reactivation → nerve damage → central sensitisation → allodynia + burning", 14, False, DARK_GRAY),
        ("RISK FACTORS: Age >60, immunosuppression, severe acute zoster pain", 14, False, DARK_GRAY),
        ("", 7, False, DARK_GRAY),
        ("TREATMENT GOALS FOR PHN (Herpes Neuralgia):", 16, True, GREEN),
        ("  • Reduce pain intensity to tolerable levels", 14, False, DARK_GRAY),
        ("  • Improve sleep and quality of life", 14, False, DARK_GRAY),
        ("  • Minimise adverse drug effects", 14, False, DARK_GRAY),
        ("  • Prevent disability and depression", 14, False, DARK_GRAY),
        ("", 7, False, DARK_GRAY),
        ("PHARMACOLOGICAL MANAGEMENT:", 16, True, RGBColor(0x4A, 0x14, 0x86)),
        ("  1st Line:", 14, True, GREEN),
        ("    • Gabapentin (300-3600 mg/day) – FDA approved for PHN", 14, False, DARK_GRAY),
        ("    • Pregabalin (150-600 mg/day) – FDA approved; better pharmacokinetics", 14, False, DARK_GRAY),
        ("    • TCAs – Amitriptyline, Nortriptyline – effective but SE burden", 14, False, DARK_GRAY),
        ("    • Topical Lidocaine patch (5%) – 1st line for localised PHN", 14, False, DARK_GRAY),
        ("  2nd Line:", 14, True, ORANGE),
        ("    • Opioids: Oxycodone, Tramadol, Morphine (when 1st line insufficient)", 14, False, DARK_GRAY),
        ("    • Topical Capsaicin 8% patch (QUTENZA) – desensitises nociceptors", 14, False, DARK_GRAY),
        ("PREVENTION: Varicella-Zoster Vaccine (Shingrix – recombinant) recommended >50 years", 14, True, TEAL),
    ],
    note_text="Exam: Treatment goals + 1st line = Gabapentin/Pregabalin + Topical Lidocaine"
)

# ─────────────────────────────────────────────────────────────────────────────
# SLIDE 13 – SECTION DIVIDER: HEADACHE
# ─────────────────────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
add_rect(slide, 0, 0, 13.333, 7.5, RGBColor(0x14, 0x30, 0x5C))
add_rect(slide, 0, 2.9, 13.333, 1.8, MID_BLUE)
add_textbox(slide, 0.5, 1.2, 12.3, 1.0,
            "SECTION III", font_size=36, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
add_textbox(slide, 0.5, 2.2, 12.3, 0.6,
            "HEADACHE DISORDERS", font_size=42, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
add_textbox(slide, 0.5, 3.05, 12.3, 0.6,
            "Classification (IHS)  •  Migraine  •  Tension-Type  •  Cluster Headache",
            font_size=16, color=LIGHT_BLUE, align=PP_ALIGN.CENTER, italic=True)
add_textbox(slide, 0.5, 5.8, 12.3, 0.5,
            "DiPiro Chapter 31 – Headache  |  IHS ICHD-3 Classification",
            font_size=14, color=YELLOW_BG, align=PP_ALIGN.CENTER, italic=True)

# ─────────────────────────────────────────────────────────────────────────────
# SLIDE 14 – IHS CLASSIFICATION OF HEADACHE
# ─────────────────────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
bullet_slide(slide,
    "IHS Classification of Headache (ICHD-3)",
    [
        ("PRIMARY HEADACHES (no underlying cause):", 16, True, DARK_BLUE),
        ("  1. Migraine", 14, True, TEAL),
        ("       a. Migraine without aura (common migraine)", 13, False, DARK_GRAY),
        ("       b. Migraine with aura (classic migraine) – transient focal neurological symptoms", 13, False, DARK_GRAY),
        ("       c. Chronic migraine (≥15 days/month for ≥3 months)", 13, False, DARK_GRAY),
        ("  2. Tension-Type Headache (TTH)", 14, True, TEAL),
        ("       a. Infrequent episodic (<1 day/month)  b. Frequent episodic (1-14 days/month)  c. Chronic (≥15 days/month)", 13, False, DARK_GRAY),
        ("  3. Trigeminal Autonomic Cephalalgias (TACs)", 14, True, TEAL),
        ("       a. Cluster headache  b. Paroxysmal hemicrania  c. SUNCT  d. SUNA", 13, False, DARK_GRAY),
        ("  4. Other Primary Headaches (cough, exertional, thunderclap headache, etc.)", 14, True, TEAL),
        ("", 8, False, DARK_GRAY),
        ("SECONDARY HEADACHES (identifiable cause):", 16, True, RED),
        ("  • Head trauma  • Vascular disorders (SAH, CVT)  • Intracranial hypertension", 14, False, DARK_GRAY),
        ("  • Meningitis/encephalitis  • Brain tumour  • Sinusitis  • Medications (MOH)", 14, False, DARK_GRAY),
        ("", 8, False, DARK_GRAY),
        ("NEUROPATHIES & FACIAL PAIN (Group 13):", 16, True, DARK_BLUE),
        ("  • Trigeminal neuralgia, Glossopharyngeal neuralgia, Occipital neuralgia", 14, False, DARK_GRAY),
    ],
    note_text="RED FLAGS: New onset sudden severe headache, age >40, fever/weight loss, papilledema → investigate!"
)

# ─────────────────────────────────────────────────────────────────────────────
# SLIDE 15 – IHS DIAGNOSTIC CRITERIA FOR MIGRAINE
# ─────────────────────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
bullet_slide(slide,
    "IHS Diagnostic Criteria for Migraine (ICHD-3)",
    [
        ("MIGRAINE WITHOUT AURA – DIAGNOSTIC CRITERIA (5-4-3-2-1 Rule):", 16, True, DARK_BLUE),
        ("  A. ≥5 attacks fulfilling criteria B–D", 15, True, TEAL),
        ("  B. Duration 4–72 hours (untreated or unsuccessfully treated)", 15, True, TEAL),
        ("  C. ≥2 of the following headache characteristics:", 15, True, TEAL),
        ("       1. Unilateral location  2. Pulsating/throbbing quality", 14, False, DARK_GRAY),
        ("       3. Moderate or severe pain intensity  4. Aggravated by routine physical activity", 14, False, DARK_GRAY),
        ("  D. During headache ≥1 of:", 15, True, TEAL),
        ("       1. Nausea and/or vomiting  2. Photophobia AND phonophobia", 14, False, DARK_GRAY),
        ("  E. Not better accounted for by another ICHD-3 diagnosis", 15, True, TEAL),
        ("", 8, False, DARK_GRAY),
        ("MIGRAINE WITH AURA – Criteria:", 16, True, DARK_BLUE),
        ("  • ≥2 attacks with ≥1 reversible aura symptom:", 14, False, DARK_GRAY),
        ("    ◇ Visual: zigzag lines, scotoma (most common)  ◇ Sensory: paraesthesia  ◇ Dysphasia", 14, False, DARK_GRAY),
        ("  • Each aura lasts 5–60 minutes; no motor weakness", 14, False, DARK_GRAY),
        ("  • Headache begins within 60 min of aura", 14, False, DARK_GRAY),
        ("", 8, False, DARK_GRAY),
        ("CHRONIC MIGRAINE: ≥15 headache days/month for ≥3 months; ≥8 migraine days/month", 15, True, RED),
        ("STATUS MIGRAINOSUS: Debilitating migraine lasting >72 hours", 14, True, RED),
    ],
    note_text="Memory Aid: POUND – Pulsating, One-day duration, Unilateral, Nausea/vomiting, Disabling"
)

# ─────────────────────────────────────────────────────────────────────────────
# SLIDE 16 – PATHOGENESIS OF MIGRAINE
# ─────────────────────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
bullet_slide(slide,
    "Pathogenesis & Precipitating Factors of Migraine Headache",
    [
        ("PATHOGENESIS (Trigeminovascular Theory):", 16, True, DARK_BLUE),
        ("  1. Cortical Spreading Depression (CSD) – wave of neuronal depolarisation → aura", 14, False, DARK_GRAY),
        ("  2. Trigeminal nerve activation → release of vasoactive peptides:", 14, False, DARK_GRAY),
        ("       • CGRP (Calcitonin Gene-Related Peptide) – key mediator of migraine pain", 14, False, DARK_GRAY),
        ("       • Substance P, Neurokinin A → neurogenic inflammation", 14, False, DARK_GRAY),
        ("  3. Meningeal vessel dilation → sterile inflammation → pulsating pain", 14, False, DARK_GRAY),
        ("  4. Central sensitisation → allodynia (cutaneous allodynia in migraine)", 14, False, DARK_GRAY),
        ("  5. Serotonin (5-HT1B/1D) receptors on trigeminal neurons → target for triptans", 14, False, DARK_GRAY),
        ("", 7, False, DARK_GRAY),
        ("PRECIPITATING FACTORS (Triggers):", 16, True, RED),
        ("  Behavioral: Stress, fatigue, sleep excess/deficit, vigorous exercise, menstruation", 14, False, DARK_GRAY),
        ("  Dietary: Red wine, cheese, MSG, caffeine withdrawal, skipping meals, chocolate", 14, False, DARK_GRAY),
        ("  Environmental: Bright/flickering lights, loud noises, strong smells, tobacco smoke", 14, False, DARK_GRAY),
        ("  Hormonal: Oestrogen fluctuation (menstruation, OCP, menopause)", 14, False, DARK_GRAY),
        ("  Meteorological: Weather changes, high altitude", 14, False, DARK_GRAY),
        ("", 7, False, DARK_GRAY),
        ("EPIDEMIOLOGY: Affects >25 million Americans; Female:Male = 3:1 after puberty", 14, True, TEAL),
    ],
    note_text="CGRP is the KEY mediator – anti-CGRP monoclonal antibodies (erenumab) are newest preventive therapy"
)

# ─────────────────────────────────────────────────────────────────────────────
# SLIDE 17 – CLINICAL PRESENTATION OF MIGRAINE
# ─────────────────────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
bullet_slide(slide,
    "Clinical Presentation of Migraine Headache",
    [
        ("PHASES OF MIGRAINE (4 phases):", 16, True, DARK_BLUE),
        ("  1. PRODROME (hours-days before): mood changes, food cravings, yawning, neck stiffness", 14, False, DARK_GRAY),
        ("  2. AURA (20-60 min): visual scotoma/zigzag, sensory changes, dysphasia; reversible", 14, False, DARK_GRAY),
        ("  3. HEADACHE PHASE (4-72 hours):", 14, False, DARK_GRAY),
        ("       • Unilateral, pulsating/throbbing pain", 14, False, DARK_GRAY),
        ("       • Moderate-to-severe intensity", 14, False, DARK_GRAY),
        ("       • Worsens with routine activity (climbing stairs, movement)", 14, False, DARK_GRAY),
        ("       • Associated symptoms: nausea, vomiting, photophobia, phonophobia, osmophobia", 14, False, DARK_GRAY),
        ("       • Patient seeks dark, quiet room", 14, False, DARK_GRAY),
        ("  4. POSTDROME (hours after headache): fatigue, cognitive fog, scalp tenderness, mood changes", 14, False, DARK_GRAY),
        ("", 8, False, DARK_GRAY),
        ("KEY DISTINGUISHING FEATURES (vs TTH):", 16, True, TEAL),
        ("  Feature               Migraine              Tension-Type Headache", 13, True, DARK_GRAY),
        ("  Location              Unilateral            Bilateral (band-like)", 13, False, DARK_GRAY),
        ("  Quality               Throbbing/pulsating   Pressing/tightening", 13, False, DARK_GRAY),
        ("  Intensity             Moderate-severe       Mild-moderate", 13, False, DARK_GRAY),
        ("  Nausea/vomiting      Present               Absent (or minimal)", 13, False, DARK_GRAY),
        ("  Photophobia          Marked                Mild (one only)", 13, False, DARK_GRAY),
    ],
    note_text="Clinical case: 28F, unilateral throbbing headache with nausea/photophobia = MIGRAINE"
)

# ─────────────────────────────────────────────────────────────────────────────
# SLIDE 18 – TREATMENT ALGORITHM FOR MIGRAINE
# ─────────────────────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
slide_header(slide, "Treatment Algorithm for Migraine Headaches",
             "Stratified Care Approach (IHS & AHS Guidelines)")
add_rect(slide, 0, 1.15, 13.333, 6.15, LIGHT_GRAY)

# Column boxes
boxes = [
    ("MILD-MODERATE\nMIGRAINE",
     "1st Line:\n• Simple analgesics: Aspirin, Paracetamol\n• NSAIDs: Ibuprofen, Naproxen\n• Caffeinated combinations\n  (Aspirin + Paracetamol + Caffeine)\n\n2nd Line:\n• Triptans (when NSAID fails)\n• Antiemetics (Metoclopramide,\n  Prochlorperazine) for nausea",
     MID_BLUE, 0.25),
    ("MODERATE-SEVERE\nMIGRAINE",
     "1st Line Migraine-Specific:\n• Triptans (Sumatriptan, Rizatriptan,\n  Zolmitriptan, Almotriptan, etc.)\n• Sumatriptan + Naproxen combination\n• Ergotamine derivatives\n  (DHE nasal spray/injection)\n\n2nd Line:\n• Gepants (ubrogepant, rimegepant)\n• Lasmiditan (ditans – new class)",
     TEAL, 4.55),
    ("PROPHYLAXIS\n(Prevention)",
     "Indicated if:\n• ≥4 attacks/month\n• Severe/prolonged attacks\n• Significant disability\n\nDrugs:\n• Beta-blockers: Propranolol★, Metoprolol\n• AEDs: Valproate, Topiramate\n• TCAs: Amitriptyline\n• CGRP mAbs: Erenumab (newest)\n• Ca-channel blockers: Verapamil\n• Antidepressants: Venlafaxine",
     RGBColor(0x4A, 0x14, 0x86), 8.85),
]
for title, content, color, ox in boxes:
    add_rect(slide, ox, 1.3, 4.1, 0.85, color)
    add_textbox(slide, ox+0.1, 1.35, 3.9, 0.75,
                title, font_size=14, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
    add_rect(slide, ox, 2.18, 4.1, 4.9, WHITE)
    add_textbox(slide, ox+0.15, 2.22, 3.85, 4.8,
                content, font_size=12, color=DARK_GRAY, align=PP_ALIGN.LEFT)

add_rect(slide, 0.3, 7.1, 12.7, 0.32, YELLOW_BG)
add_textbox(slide, 0.5, 7.12, 12.4, 0.28,
            "★ Propranolol: 1st line preventive agent | Triptans: contraindicated in CAD, stroke, uncontrolled HTN | MOH risk: avoid analgesics >10 days/month",
            font_size=10, bold=True, color=ORANGE)

# ─────────────────────────────────────────────────────────────────────────────
# SLIDE 19 – ROLE OF PROPRANOLOL IN MIGRAINE
# ─────────────────────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
bullet_slide(slide,
    "Role of Propranolol in Migraine Management",
    [
        ("PROPRANOLOL: Non-selective beta-1 & beta-2 adrenoceptor blocker", 15, True, DARK_BLUE),
        ("", 7, False, DARK_GRAY),
        ("INDICATION: PROPHYLAXIS (Prevention) of migraine – NOT for acute treatment", 15, True, RED),
        ("", 7, False, DARK_GRAY),
        ("MECHANISM OF ACTION IN MIGRAINE:", 16, True, TEAL),
        ("  • Blocks beta-adrenoceptors → reduces catecholamine-mediated vascular changes", 14, False, DARK_GRAY),
        ("  • Inhibits noradrenaline-induced platelet aggregation and serotonin release", 14, False, DARK_GRAY),
        ("  • Modulates central serotonergic activity → reduces migraine frequency", 14, False, DARK_GRAY),
        ("  • Reduces hypersensitivity of cortical spreading depression", 14, False, DARK_GRAY),
        ("", 7, False, DARK_GRAY),
        ("DOSING: Start 40 mg BD → titrate up to 160-240 mg/day; takes 4-8 weeks for full effect", 14, True, DARK_GRAY),
        ("EFFICACY: Reduces migraine frequency by 50% in 50-70% of patients", 14, False, DARK_GRAY),
        ("", 7, False, DARK_GRAY),
        ("CONTRAINDICATIONS:", 15, True, RED),
        ("  • Asthma, COPD, bronchospasm  • Bradycardia/heart block  • Uncontrolled heart failure", 14, False, DARK_GRAY),
        ("  • Insulin-dependent diabetes (masks hypoglycaemia signs)", 14, False, DARK_GRAY),
        ("", 7, False, DARK_GRAY),
        ("OTHER BETA-BLOCKERS for migraine: Metoprolol, Atenolol, Timolol (also FDA approved)", 14, False, DARK_GRAY),
        ("NOT effective: Acebutolol, Pindolol (intrinsic sympathomimetic activity)", 14, False, DARK_GRAY),
    ],
    note_text="Propranolol = DRUG OF CHOICE for migraine prophylaxis; reduces frequency by 50%"
)

# ─────────────────────────────────────────────────────────────────────────────
# SLIDE 20 – GOALS OF THERAPY IN MIGRAINE + NON-PHARM
# ─────────────────────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
bullet_slide(slide,
    "Goals of Therapy & Non-Pharmacological Management of Migraine",
    [
        ("GOALS OF THERAPY IN MIGRAINE MANAGEMENT:", 16, True, DARK_BLUE),
        ("  Acute (Abortive):", 15, True, TEAL),
        ("    1. Rapid and complete relief of pain", 14, False, DARK_GRAY),
        ("    2. Restore normal functioning within 2 hours of treatment", 14, False, DARK_GRAY),
        ("    3. Minimise adverse effects of treatment", 14, False, DARK_GRAY),
        ("    4. Reduce use of rescue medications and ER visits", 14, False, DARK_GRAY),
        ("  Preventive (Prophylactic):", 15, True, TEAL),
        ("    5. Reduce attack frequency, severity and duration by ≥50%", 14, False, DARK_GRAY),
        ("    6. Improve responsiveness to acute treatment", 14, False, DARK_GRAY),
        ("    7. Prevent progression to chronic migraine", 14, False, DARK_GRAY),
        ("    8. Improve quality of life and reduce disability", 14, False, DARK_GRAY),
        ("    9. Reduce medication overuse headache (MOH) risk", 14, False, DARK_GRAY),
        ("", 7, False, DARK_GRAY),
        ("NON-PHARMACOLOGICAL MANAGEMENT OF MIGRAINE:", 16, True, GREEN),
        ("  • Trigger identification & avoidance diary", 14, False, DARK_GRAY),
        ("  • Regular sleep schedule, meals (avoid skipping), exercise routine", 14, False, DARK_GRAY),
        ("  • Stress management: biofeedback (most evidence), relaxation therapy, CBT", 14, False, DARK_GRAY),
        ("  • Avoid triggers: red wine, cheese, bright lights, caffeine withdrawal", 14, False, DARK_GRAY),
        ("  • Acupuncture – evidence for migraine prevention", 14, False, DARK_GRAY),
        ("  • Cold packs to head/neck during acute attack; dark quiet room", 14, False, DARK_GRAY),
    ],
    note_text="Biofeedback has the STRONGEST evidence among non-pharmacological migraine preventive therapies"
)

# ─────────────────────────────────────────────────────────────────────────────
# SLIDE 21 – CLUSTER HEADACHE
# ─────────────────────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
bullet_slide(slide,
    "Cluster Headache – Pathophysiology, Clinical Features & Management",
    [
        ("DEFINITION: One of the Trigeminal Autonomic Cephalalgias (TAC); worst headache known", 15, True, DARK_BLUE),
        ("EPIDEMIOLOGY: Male predominance (M:F = 5:1); onset 20-40 years; uncommon", 14, False, DARK_GRAY),
        ("", 7, False, DARK_GRAY),
        ("PATHOPHYSIOLOGY:", 15, True, RGBColor(0x4A, 0x14, 0x86)),
        ("  • Hypothalamic dysfunction (biological clock) – circadian rhythmicity of attacks", 14, False, DARK_GRAY),
        ("  • Trigeminal nerve activation + parasympathetic activation → autonomic symptoms", 14, False, DARK_GRAY),
        ("  • Vasoactive peptide release (VIP, CGRP) → vasodilation", 14, False, DARK_GRAY),
        ("", 7, False, DARK_GRAY),
        ("CLINICAL PRESENTATION:", 15, True, RED),
        ("  • Unilateral, orbital/supraorbital or temporal pain – SEVERE, excruciating", 14, False, DARK_GRAY),
        ("  • Attacks 15 min – 3 hours; 1-8 attacks/day; same time daily ('alarm clock' headache)", 14, False, DARK_GRAY),
        ("  • Autonomic features (ipsilateral): lacrimation, conjunctival injection, nasal congestion,", 14, False, DARK_GRAY),
        ("    rhinorrhoea, ptosis, miosis, eyelid oedema, forehead sweating (Horner's syndrome)", 14, False, DARK_GRAY),
        ("  • Patient is restless, agitated (vs migraineur who lies still)", 14, False, DARK_GRAY),
        ("", 7, False, DARK_GRAY),
        ("MANAGEMENT:", 15, True, GREEN),
        ("  Acute: High-flow 100% Oxygen (7-12 L/min for 15 min) – first line; Sumatriptan SC/nasal", 14, False, DARK_GRAY),
        ("  Preventive: Verapamil (DOC), Lithium, Corticosteroids (short course), Methysergide", 14, False, DARK_GRAY),
    ],
    note_text="Cluster HA: 'Suicide headache' – male, orbital, unilateral, autonomic features, restless patient"
)

# ─────────────────────────────────────────────────────────────────────────────
# SLIDE 22 – ONCOLOGY/CANCER PAIN MANAGEMENT
# ─────────────────────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
bullet_slide(slide,
    "Pain Management in Cancer Patients",
    [
        ("CANCER PAIN TYPES:", 16, True, DARK_BLUE),
        ("  • Nociceptive: bone mets (most common), visceral organ involvement", 14, False, DARK_GRAY),
        ("  • Neuropathic: nerve compression/invasion, post-surgery, chemotherapy-induced", 14, False, DARK_GRAY),
        ("  • Breakthrough pain: transient exacerbation over background controlled pain", 14, False, DARK_GRAY),
        ("", 7, False, DARK_GRAY),
        ("WHO ANALGESIC LADDER (Applied to Cancer Pain):", 16, True, GREEN),
        ("  Step 1 (Mild): NSAIDs + Paracetamol ± adjuvants", 14, False, DARK_GRAY),
        ("  Step 2 (Moderate): Weak opioids (Codeine, Tramadol) + non-opioid", 14, False, DARK_GRAY),
        ("  Step 3 (Severe): Strong opioids (Morphine – gold standard) + non-opioid", 14, False, DARK_GRAY),
        ("  Principles: By mouth → By the clock → By the ladder → For the individual", 14, True, TEAL),
        ("", 7, False, DARK_GRAY),
        ("OPIOID DOSING IN CANCER:", 16, True, RGBColor(0x4A, 0x14, 0x86)),
        ("  • No ceiling dose for strong opioids in cancer pain", 14, False, DARK_GRAY),
        ("  • Scheduled ATC dosing + PRN rescue doses (1/6th of total daily dose)", 14, False, DARK_GRAY),
        ("  • Anticipate and treat side effects prophylactically (laxatives ALWAYS)", 14, False, DARK_GRAY),
        ("  • Equianalgesic conversion when switching opioids", 14, False, DARK_GRAY),
        ("", 7, False, DARK_GRAY),
        ("ADJUVANT ANALGESICS IN CANCER:", 16, True, TEAL),
        ("  • Corticosteroids (bone pain, nerve compression) • Bisphosphonates (bone mets)", 14, False, DARK_GRAY),
        ("  • Gabapentin/Pregabalin (neuropathic) • Antidepressants • Ketamine (refractory)", 14, False, DARK_GRAY),
    ],
    note_text="4 Bys of WHO: By mouth, By the clock, By the ladder, For the individual – core principle"
)

# ─────────────────────────────────────────────────────────────────────────────
# SLIDE 23 – PHARMACOLOGIC TREATMENT OF ONCOLOGY PATIENTS
# ─────────────────────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
bullet_slide(slide,
    "Pharmacologic Treatment of Oncology Patients",
    [
        ("PAIN:", 16, True, RED),
        ("  Strong Opioids (Morphine, Oxycodone, Fentanyl, Hydromorphone) – see WHO Ladder", 14, False, DARK_GRAY),
        ("", 6, False, DARK_GRAY),
        ("CHEMOTHERAPY-INDUCED NAUSEA & VOMITING (CINV):", 16, True, DARK_BLUE),
        ("  • 5-HT3 antagonists: Ondansetron, Granisetron, Palonosetron (most effective)", 14, False, DARK_GRAY),
        ("  • NK1 antagonists: Aprepitant (combine for highly emetogenic regimens)", 14, False, DARK_GRAY),
        ("  • Corticosteroids: Dexamethasone (standard component)", 14, False, DARK_GRAY),
        ("  • Dopamine antagonists: Metoclopramide, Prochlorperazine (2nd line)", 14, False, DARK_GRAY),
        ("", 6, False, DARK_GRAY),
        ("MYELOSUPPRESSION / HAEMATOLOGIC SUPPORT:", 16, True, DARK_BLUE),
        ("  • G-CSF: Filgrastim, Pegfilgrastim – prevent/treat neutropenia", 14, False, DARK_GRAY),
        ("  • Erythropoietin (Epoietin alfa) – anaemia of cancer/chemotherapy", 14, False, DARK_GRAY),
        ("  • Platelet transfusions for thrombocytopenia", 14, False, DARK_GRAY),
        ("", 6, False, DARK_GRAY),
        ("MUCOSITIS:", 16, True, DARK_BLUE),
        ("  • Oral cryotherapy, Palifermin (KGF), Good oral hygiene", 14, False, DARK_GRAY),
        ("", 6, False, DARK_GRAY),
        ("BISPHOSPHONATES (Bone metastases):", 16, True, DARK_BLUE),
        ("  • Zoledronic acid (IV), Pamidronate – reduce skeletal events + analgesic effect", 14, False, DARK_GRAY),
        ("DENOSUMAB: Anti-RANKL – reduces osteoclast activity in bone mets", 14, False, DARK_GRAY),
    ],
    note_text="CINV: Ondansetron + Dexamethasone ± Aprepitant = standard triple antiemetic regimen"
)

# ─────────────────────────────────────────────────────────────────────────────
# SLIDE 24 – EXAM SUMMARY TABLE
# ─────────────────────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
slide_header(slide, "High-Yield Exam Summary – Quick Revision Table")
add_rect(slide, 0, 1.15, 13.333, 6.15, LIGHT_GRAY)

rows = [
    ("Topic", "Key Point", "Drug of Choice", ""),
    ("Trigeminal Neuralgia", "Carbamazepine 1st line; MVD surgery for refractory", "Carbamazepine", DARK_BLUE),
    ("Post-Herpetic Neuralgia", "Gabapentin/Pregabalin + Topical Lidocaine", "Gabapentin", TEAL),
    ("Migraine Acute", "Triptans (5-HT1B/D agonists) for moderate-severe attacks", "Sumatriptan", MID_BLUE),
    ("Migraine Prophylaxis", "Propranolol (reduces frequency 50%); also Topiramate, Valproate", "Propranolol", RGBColor(0x4A, 0x14, 0x86)),
    ("Cluster Headache Acute", "100% O2 high-flow (7-12 L/min); Sumatriptan SC", "O2 + Sumatriptan SC", RED),
    ("Cluster Headache Prevention", "Verapamil = drug of choice; Lithium for chronic", "Verapamil", ORANGE),
    ("Cancer Pain (Step 3)", "Morphine = gold standard; no ceiling dose", "Morphine", GREEN),
    ("Neuropathic Pain", "Gabapentin, Pregabalin, TCA, SNRI, Tramadol", "Gabapentin/Pregabalin", TEAL),
    ("WHO Pain Ladder", "Mild→NSAID; Moderate→Weak opioid; Severe→Strong opioid", "Stepwise", DARK_BLUE),
    ("Opioid: Constipation", "Does NOT develop tolerance; always use laxatives", "Senna/Lactulose", RED),
]

col_widths = [2.6, 5.0, 2.8]
col_x = [0.25, 2.9, 7.95]
row_h = 0.52
for ri, row_data in enumerate(rows):
    y = 1.22 + ri * row_h
    bg = DARK_BLUE if ri == 0 else (LIGHT_BLUE if ri % 2 == 0 else WHITE)
    add_rect(slide, 0.25, y, 12.85, row_h - 0.02,
             bg if ri == 0 else (LIGHT_BLUE if ri % 2 == 0 else WHITE))
    for ci, (cx, cw, txt) in enumerate(zip(col_x, col_widths, row_data[:3])):
        txt_color = WHITE if ri == 0 else (row_data[3] if ci == 2 else DARK_GRAY)
        add_textbox(slide, cx + 0.05, y + 0.03, cw - 0.1, row_h - 0.06,
                    txt, font_size=11 if ri > 0 else 12,
                    bold=(ri == 0 or ci == 0),
                    color=txt_color)

# ─────────────────────────────────────────────────────────────────────────────
# SLIDE 25 – EXAM Q&A RAPID FIRE
# ─────────────────────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
bullet_slide(slide,
    "Exam Rapid-Fire Q&A – 2 Mark Answers",
    [
        ("Q: Characteristics of neuropathic pain?", 14, True, DARK_BLUE),
        ("A: Burning/shooting/electric, allodynia, hyperalgesia, spontaneous pain", 13, False, TEAL),
        ("Q: Major adverse effects of opioids?", 14, True, DARK_BLUE),
        ("A: Constipation (no tolerance), respiratory depression (serious), sedation, N&V, urinary retention, pruritus", 13, False, TEAL),
        ("Q: First line treatment of migraine?", 14, True, DARK_BLUE),
        ("A: Mild-moderate: NSAIDs/Paracetamol; Moderate-severe: Triptans (Sumatriptan)", 13, False, TEAL),
        ("Q: Precipitating factors of migraine?", 14, True, DARK_BLUE),
        ("A: Stress, sleep changes, menstruation, red wine, cheese, bright lights, caffeine withdrawal", 13, False, TEAL),
        ("Q: Goals of therapy in migraine management?", 14, True, DARK_BLUE),
        ("A: Reduce frequency ≥50%, restore function, reduce disability, prevent chronification", 13, False, TEAL),
        ("Q: Role of propranolol?", 14, True, DARK_BLUE),
        ("A: Prophylaxis (prevention) of migraine; non-selective beta-blocker; reduces frequency by 50%", 13, False, TEAL),
        ("Q: Types of neuralgia?", 14, True, DARK_BLUE),
        ("A: Trigeminal, PHN, Diabetic, Glossopharyngeal, Occipital, CRPS, Central post-stroke", 13, False, TEAL),
        ("Q: Grading scales of pain?", 14, True, DARK_BLUE),
        ("A: NRS (0-10), VAS, Simple Descriptive Scale (no/mild/moderate/severe), FACES scale (paediatric)", 13, False, TEAL),
        ("Q: Non-pharmacological management of migraine?", 14, True, DARK_BLUE),
        ("A: Trigger avoidance, biofeedback, relaxation therapy, CBT, regular sleep/meals, cold packs", 13, False, TEAL),
    ],
    note_text="2-Mark format: Give 4-5 points concisely. Emphasise key terms."
)

# ─────────────────────────────────────────────────────────────────────────────
# SLIDE 26 – FINAL REFERENCES
# ─────────────────────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
add_rect(slide, 0, 0, 13.333, 7.5, DARK_BLUE)
add_rect(slide, 0, 0, 0.15, 7.5, ORANGE)
add_textbox(slide, 0.5, 0.25, 12.3, 0.7,
            "REFERENCES & FURTHER READING", font_size=28, bold=True,
            color=WHITE, align=PP_ALIGN.CENTER)
add_rect(slide, 0.5, 1.05, 12.3, 5.85, RGBColor(0x1E, 0x40, 0x6A))

refs = [
    "1.  DiPiro JT, et al. Pharmacotherapy: A Pathophysiologic Approach, 9th Edition.",
    "     Chapter 30 – Pain Management (Christine K. O'Neil)",
    "     Chapter 31 – Headache (Leigh Ann Ross & Brendan S. Ross)",
    "",
    "2.  International Headache Society (IHS). The International Classification of Headache Disorders, 3rd Edition (ICHD-3). Cephalalgia 2018.",
    "",
    "3.  Puledda F, et al. International Headache Society global practice recommendations for the acute pharmacological treatment of migraine. Cephalalgia 2024;44(8).",
    "",
    "4.  VA/DoD Clinical Practice Guideline for Headache Management. Annals of Internal Medicine, 2024.",
    "",
    "5.  World Health Organization (WHO). Cancer Pain Relief and Palliative Care. WHO Analgesic Ladder guidelines.",
    "",
    "6.  American Headache Society. 2025 Guideline Update to Acute Treatment of Migraine in the Emergency Department. Headache 2025.",
    "",
    "7.  Dworkin RH, et al. Advances in neuropathic pain: diagnosis, mechanisms, and treatment recommendations. Arch Neurol 2003.",
]
tb = slide.shapes.add_textbox(Inches(0.8), Inches(1.15), Inches(11.8), Inches(5.6))
tf = tb.text_frame; tf.word_wrap = True
for i, ref in enumerate(refs):
    if i == 0:
        p = tf.paragraphs[0]
    else:
        p = tf.add_paragraph()
    p.space_before = Pt(2)
    r = p.add_run(); r.text = ref
    r.font.name = "Calibri"
    r.font.size = Pt(12 if ref and not ref.startswith(" ") else 11)
    r.font.color.rgb = WHITE if ref else WHITE
    r.font.bold = (ref and not ref.startswith(" ") and ref != "")

add_textbox(slide, 0.5, 6.85, 12.3, 0.45,
            "Prepared for: B.Pharm / M.Pharm / Pharm.D Examinations  |  July 2026",
            font_size=13, color=LIGHT_BLUE, align=PP_ALIGN.CENTER, italic=True)

# ─────────────────────────────────────────────────────────────────────────────
# Save
# ─────────────────────────────────────────────────────────────────────────────
out_path = "/tmp/workspace/pain-headache-ppt/Pain_Headache_Pharmacotherapy.pptx"
prs.save(out_path)
print(f"Saved: {out_path}")
print(f"Slides: {len(prs.slides)}")
Running Command

cd /tmp/workspace/pain-headache-ppt && python3 create_ppt.py

Editing File

~/pain-headache-ppt/create_ppt.py

Successfully replaced 1 instance(s) of the string in '/tmp/workspace/pain-headache-ppt/create_ppt.py'
Running Command

cd /tmp/workspace/pain-headache-ppt && python3 create_ppt.py

Your PPT is ready! Download it here:

Pain Headache Pharmacotherapy

Presentation · PPTX


What's inside (26 slides, fully exam-mapped):

#SlideExam Questions Covered
1Title SlideCourse overview
2Section I Divider – Pain Management
3Definition & Classification of PainPain types (Short Essay Q1), Nociceptive vs Neuropathic
4Clinical Presentation & Neuropathic Pain CharacteristicsShort Answer Q1, Q3, Q4 (PQRST, grading scales, neuropathic features)
5WHO Pain Ladder (visual 3-step diagram)Short Essay Q4, Short Answer – 3 steps with drugs
6Non-Pharmacological TherapyShort Essay Q3 (CBT, TENS, biofeedback, PT)
7Opioid Analgesics & Adverse EffectsShort Answer Q2 (major ADRs)
8Barriers to Cancer Pain ManagementShort Essay Q2 (patient, provider, system barriers)
9Section II Divider – Neuralgia
10Types of NeuralgiaShort Essay Q5, Short Answer Q6
11Trigeminal Neuralgia – Pathophysiology & ManagementShort Essay Q6, Carbamazepine DOC
12Post-Herpetic Neuralgia (PHN) – Treatment goalsShort Answer Q5 (herpes neuralgia goals)
13Section III Divider – Headache
14IHS Classification of HeadacheShort Essay Q8 (detailed classification)
15IHS Diagnostic Criteria for MigraineShort Essay Q10 (POUND mnemonic, 5-4-3-2-1 rule)
16Pathogenesis & Precipitating FactorsShort Essay Q9, Short Answer Q9
17Clinical Presentation of MigraineShort Answer Q10 (vs TTH comparison table)
18Treatment Algorithm for Migraine (3-column visual)Short Essay Q11, Short Answer Q8
19Role of PropranololShort Answer Q12
20Goals of Therapy & Non-Pharm ManagementShort Answer Q11, Q13
21Cluster HeadacheLong Essay Q2 (pathophysiology, autonomic features, O2 therapy)
22Cancer Pain ManagementShort Essay Q12, Long Essay Q1
23Pharmacologic Treatment of Oncology PatientsLong Essay Q1 (CINV, G-CSF, bisphosphonates)
24High-Yield Exam Summary TableAll topics, DOC at a glance
25Rapid-Fire Q&A (2-mark format)All Short Answer questions
26ReferencesDiPiro Ch 30 & 31, IHS ICHD-3, 2024/2025 Guidelines
References used: DiPiro Pharmacotherapy (primary textbook), IHS ICHD-3 Classification, IHS 2024 Acute Migraine Guidelines, VA/DoD 2024 Headache CPG, AHS 2025 ER Migraine Guidelines, and WHO Pain Ladder principles.

can you make it in more descriptive

make it fast

This is a shared conversation. Sign in to Orris to start your own chat.