Make presentation on headache add pictures of real human from Harrison book
ls -la /home/daytona/workspace/ 2>/dev/null || echo "workspace does not exist"
~/headache-pptx/headache.js
const pptxgen = require("pptxgenjs");
const { execSync } = require("child_process");
// Fetch images from Harrison's textbook
const imageUrls = [
"https://cdn.orris.care/cdss_images/d79ad64919bbe2ea795ad5ac016dd5773e6dfee05124af733fdb3c1c617c6b44.png", // Brainstem trigeminovascular pathways
"https://cdn.orris.care/cdss_images/2368f7d8c41bc8125ec2646b2f3ad36134124003937b29563f6359eb7d1a486d.png", // PET scan - migraine A
"https://cdn.orris.care/cdss_images/58474695b1dd120a63533ae3bf934d4da98095a45ec1c2b9c8bb527e3907dc0c.png", // Axial MRI - migraine C
];
console.log("Fetching images...");
let images = [];
try {
const raw = execSync(
`node /home/daytona/skills/shared/scripts/fetch_images.js ${imageUrls.map(u => `"${u}"`).join(" ")}`,
{ maxBuffer: 50 * 1024 * 1024 }
).toString();
images = JSON.parse(raw);
console.log("Images fetched:", images.map(i => i.error ? "ERROR: " + i.error : "OK (" + i.base64.length + " chars)"));
} catch(e) {
console.error("Image fetch error:", e.message);
images = imageUrls.map(u => ({ url: u, base64: null, error: e.message }));
}
const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.author = "Harrison's Principles of Internal Medicine 22E";
pres.title = "Headache - Clinical Overview";
// ─── Color palette ───
const DEEP_NAVY = "0A1628";
const DARK_BLUE = "102244";
const MED_BLUE = "1E3A6E";
const ACCENT = "3B82F6";
const GOLD = "F59E0B";
const WHITE = "FFFFFF";
const LIGHT_GRAY= "E8EDF4";
const TEXT_DARK = "1A2540";
const TEXT_MID = "4A6080";
// ─── SLIDE 1: Title ───
{
const sl = pres.addSlide();
// Dark gradient background
sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { type: "solid", color: DEEP_NAVY } });
// Accent bar left
sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.12, h: 5.625, fill: { type: "solid", color: ACCENT } });
// Decorative circle top right
sl.addShape(pres.ShapeType.ellipse, { x: 7.8, y: -1.2, w: 3.5, h: 3.5, fill: { type: "solid", color: MED_BLUE }, line: { color: MED_BLUE } });
sl.addShape(pres.ShapeType.ellipse, { x: 8.2, y: -0.8, w: 2.8, h: 2.8, fill: { type: "solid", color: "1A3060" }, line: { color: "1A3060" } });
sl.addText("HEADACHE", {
x: 0.6, y: 1.0, w: 7, h: 1.2,
fontSize: 52, bold: true, color: WHITE, fontFace: "Calibri",
charSpacing: 4,
});
sl.addText("Clinical Overview & Management", {
x: 0.6, y: 2.3, w: 7, h: 0.5,
fontSize: 22, color: ACCENT, fontFace: "Calibri", italic: true,
});
sl.addShape(pres.ShapeType.line, { x: 0.6, y: 2.9, w: 6, h: 0, line: { color: GOLD, width: 2 } });
sl.addText("Based on Harrison's Principles of Internal Medicine, 22nd Edition (2025)", {
x: 0.6, y: 3.1, w: 8, h: 0.4,
fontSize: 13, color: "8BA0C0", fontFace: "Calibri",
});
sl.addText("McGraw Hill Medical | Chapter 441", {
x: 0.6, y: 3.6, w: 8, h: 0.4,
fontSize: 12, color: "6080A0", fontFace: "Calibri",
});
}
// ─── SLIDE 2: Overview / Epidemiology ───
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { type: "solid", color: LIGHT_GRAY } });
sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 1.05, fill: { type: "solid", color: DARK_BLUE } });
sl.addShape(pres.ShapeType.rect, { x: 0, y: 1.05, w: 0.08, h: 4.57, fill: { type: "solid", color: ACCENT } });
sl.addText("OVERVIEW & EPIDEMIOLOGY", {
x: 0.3, y: 0.22, w: 9, h: 0.6,
fontSize: 24, bold: true, color: WHITE, fontFace: "Calibri",
});
// Stats boxes
const stats = [
{ val: "~15%", label: "Global prevalence\nof migraine" },
{ val: "3:1", label: "Female-to-male\nratio (migraine)" },
{ val: ">150", label: "Headache types\n(IHS classification)" },
{ val: "#3", label: "Most disabling\nworldwide illness" },
];
stats.forEach((s, i) => {
const x = 0.3 + i * 2.35;
sl.addShape(pres.ShapeType.rect, { x, y: 1.3, w: 2.1, h: 1.5, fill: { type: "solid", color: DARK_BLUE }, line: { color: ACCENT, width: 1.5 } });
sl.addText(s.val, { x, y: 1.35, w: 2.1, h: 0.7, fontSize: 28, bold: true, color: GOLD, align: "center", fontFace: "Calibri" });
sl.addText(s.label, { x, y: 2.05, w: 2.1, h: 0.65, fontSize: 11, color: LIGHT_GRAY, align: "center", fontFace: "Calibri" });
});
sl.addText([
{ text: "Key Concepts ", options: { bold: true, color: DARK_BLUE, breakLine: true } },
{ text: "• Headache can be primary (e.g., migraine, tension-type, cluster) or secondary (due to underlying disease)", options: { breakLine: true, color: TEXT_DARK } },
{ text: "• Most disabling headaches meet migraine criteria; tension-type is relatively featureless", options: { breakLine: true, color: TEXT_DARK } },
{ text: "• Migraine is an inherited tendency to headache — cannot be eradicated, only controlled", options: { breakLine: true, color: TEXT_DARK } },
{ text: "• Always assess for 'red flag' features suggesting dangerous secondary causes", options: { color: TEXT_DARK } },
], {
x: 0.3, y: 3.0, w: 9.4, h: 2.4,
fontSize: 14, fontFace: "Calibri", valign: "top",
});
}
// ─── SLIDE 3: Classification ───
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { type: "solid", color: WHITE } });
sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 1.05, fill: { type: "solid", color: MED_BLUE } });
sl.addText("CLASSIFICATION OF HEADACHE", {
x: 0.3, y: 0.22, w: 9, h: 0.6,
fontSize: 24, bold: true, color: WHITE, fontFace: "Calibri",
});
const cols = [
{
title: "PRIMARY",
color: ACCENT,
items: [
"Migraine (with/without aura)",
"Tension-Type Headache (TTH)",
"Cluster Headache",
"Primary Cough Headache",
"Primary Exercise Headache",
"Primary Sex Headache",
"Primary Stabbing Headache",
"Hypnic Headache",
"New Daily Persistent Headache",
]
},
{
title: "SECONDARY",
color: GOLD,
items: [
"Subarachnoid Hemorrhage (SAH)",
"Intracranial Hypertension",
"Meningitis / Encephalitis",
"Cerebral Venous Sinus Thrombosis",
"Giant Cell Arteritis",
"Hypertensive crisis",
"Brain Tumor",
"Post-dural puncture",
"Medication Overuse Headache",
]
},
];
cols.forEach((col, ci) => {
const x = 0.3 + ci * 4.9;
sl.addShape(pres.ShapeType.rect, { x, y: 1.2, w: 4.4, h: 0.45, fill: { type: "solid", color: col.color }, line: { color: col.color } });
sl.addText(col.title, { x, y: 1.22, w: 4.4, h: 0.4, fontSize: 15, bold: true, color: WHITE, align: "center", fontFace: "Calibri" });
col.items.forEach((item, ii) => {
const y = 1.75 + ii * 0.4;
sl.addShape(pres.ShapeType.rect, { x, y, w: 4.4, h: 0.37, fill: { type: "solid", color: ii % 2 === 0 ? LIGHT_GRAY : WHITE }, line: { color: LIGHT_GRAY, width: 0.5 } });
sl.addText(`• ${item}`, { x: x + 0.1, y: y + 0.03, w: 4.2, h: 0.33, fontSize: 12, color: TEXT_DARK, fontFace: "Calibri" });
});
});
}
// ─── SLIDE 4: Migraine Pathophysiology + Brain Image ───
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { type: "solid", color: DEEP_NAVY } });
sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 1.05, fill: { type: "solid", color: MED_BLUE } });
sl.addText("MIGRAINE — PATHOPHYSIOLOGY", {
x: 0.3, y: 0.22, w: 9, h: 0.6,
fontSize: 24, bold: true, color: WHITE, fontFace: "Calibri",
});
// Image left
if (images[0] && images[0].base64) {
sl.addImage({ data: images[0].base64, x: 0.2, y: 1.2, w: 4.2, h: 3.7 });
sl.addText("FIG 441-1 Brainstem trigeminovascular pathways\n(Harrison's 22E, p.3508)", {
x: 0.2, y: 4.95, w: 4.2, h: 0.45,
fontSize: 9, color: "8BA0C0", italic: true, align: "center", fontFace: "Calibri",
});
}
// Text right
sl.addText([
{ text: "Trigeminovascular System\n", options: { bold: true, color: GOLD, breakLine: true } },
{ text: "• Trigeminal ganglion activates meningeal vessels releasing CGRP & PACAP\n", options: { color: LIGHT_GRAY, breakLine: true } },
{ text: "• CGRP gepants and monoclonal antibodies are effective migraine treatments\n", options: { color: LIGHT_GRAY, breakLine: true } },
{ text: "• Second-order neurons cross midline → thalamus, hypothalamus, PAG\n\n", options: { color: LIGHT_GRAY, breakLine: true } },
{ text: "Serotonin & Dopamine\n", options: { bold: true, color: GOLD, breakLine: true } },
{ text: "• 5-HT1D/1F agonists (triptans) arrest nociception in trigeminovascular system\n", options: { color: LIGHT_GRAY, breakLine: true } },
{ text: "• Ditans (5-HT1F) act only at neural targets — no vasoconstriction\n", options: { color: LIGHT_GRAY, breakLine: true } },
{ text: "• Dopamine receptor hypersensitivity explains yawning, nausea, vomiting in prodrome", options: { color: LIGHT_GRAY } },
], {
x: 4.7, y: 1.2, w: 5.1, h: 4.2,
fontSize: 13, fontFace: "Calibri", valign: "top",
});
}
// ─── SLIDE 5: Migraine — Brain Imaging ───
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { type: "solid", color: "080E1C" } });
sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 1.0, fill: { type: "solid", color: MED_BLUE } });
sl.addText("MIGRAINE BRAIN IMAGING (Harrison's 22E)", {
x: 0.3, y: 0.2, w: 9, h: 0.6,
fontSize: 22, bold: true, color: WHITE, fontFace: "Calibri",
});
// Two images side by side
if (images[1] && images[1].base64) {
sl.addImage({ data: images[1].base64, x: 0.4, y: 1.1, w: 4.3, h: 3.6 });
sl.addText("FIG 441-2A PET activation in migraine\nHypothalamic activation (premonitory phase)", {
x: 0.4, y: 4.75, w: 4.3, h: 0.5,
fontSize: 10, color: "8BA0C0", italic: true, align: "center", fontFace: "Calibri",
});
}
if (images[2] && images[2].base64) {
sl.addImage({ data: images[2].base64, x: 5.2, y: 1.1, w: 4.3, h: 3.6 });
sl.addText("FIG 441-2C Axial MRI in migraine\nDorsolateral pontine activation persists", {
x: 5.2, y: 4.75, w: 4.3, h: 0.5,
fontSize: 10, color: "8BA0C0", italic: true, align: "center", fontFace: "Calibri",
});
}
if (!images[1] || !images[1].base64) {
sl.addText("(Brain scan images from Harrison's 22E — fetch failed)", {
x: 0.5, y: 2.5, w: 9, h: 1,
fontSize: 16, color: GOLD, align: "center",
});
}
}
// ─── SLIDE 6: Migraine Clinical Features ───
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { type: "solid", color: WHITE } });
sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 1.05, fill: { type: "solid", color: DARK_BLUE } });
sl.addShape(pres.ShapeType.rect, { x: 0, y: 1.05, w: 0.08, h: 4.57, fill: { type: "solid", color: GOLD } });
sl.addText("MIGRAINE — CLINICAL FEATURES", {
x: 0.3, y: 0.22, w: 9, h: 0.6,
fontSize: 24, bold: true, color: WHITE, fontFace: "Calibri",
});
const phases = [
{ name: "Prodrome\n(hrs–days)", desc: "Mood changes, food cravings,\nyawning, fatigue, neck pain" },
{ name: "Aura\n(20–60 min)", desc: "Visual (fortification spectra),\nsensory, speech disturbance" },
{ name: "Headache\n(4–72 hrs)", desc: "Unilateral, pulsating, moderate–\nsevere, nausea, photo/phonophobia" },
{ name: "Postdrome\n(hrs)", desc: "Fatigue, cognitive slowing,\nmood change after headache" },
];
phases.forEach((p, i) => {
const x = 0.3 + i * 2.37;
sl.addShape(pres.ShapeType.rect, { x, y: 1.2, w: 2.15, h: 1.0, fill: { type: "solid", color: ACCENT }, line: { color: ACCENT } });
sl.addText(p.name, { x, y: 1.25, w: 2.15, h: 0.9, fontSize: 13, bold: true, color: WHITE, align: "center", valign: "middle", fontFace: "Calibri" });
// Arrow (except last)
if (i < 3) {
sl.addText("→", { x: x + 2.15, y: 1.5, w: 0.22, h: 0.4, fontSize: 18, color: GOLD, align: "center" });
}
sl.addShape(pres.ShapeType.rect, { x, y: 2.28, w: 2.15, h: 1.5, fill: { type: "solid", color: LIGHT_GRAY }, line: { color: ACCENT, width: 0.8 } });
sl.addText(p.desc, { x: x + 0.05, y: 2.32, w: 2.05, h: 1.42, fontSize: 12, color: TEXT_DARK, align: "center", valign: "middle", fontFace: "Calibri" });
});
// Diagnostic criteria
sl.addShape(pres.ShapeType.rect, { x: 0.3, y: 3.9, w: 9.4, h: 1.55, fill: { type: "solid", color: DEEP_NAVY }, line: { color: ACCENT, width: 1 } });
sl.addText([
{ text: "ICHD-3 Migraine Criteria ", options: { bold: true, color: GOLD } },
{ text: "≥5 attacks, 4–72 h duration | Unilateral | Pulsating | Moderate/severe | Aggravated by routine activity\n+ Nausea/vomiting OR photophobia AND phonophobia", options: { color: LIGHT_GRAY } },
], {
x: 0.5, y: 3.98, w: 9.0, h: 1.35,
fontSize: 13, fontFace: "Calibri", valign: "middle",
});
}
// ─── SLIDE 7: Cluster Headache ───
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { type: "solid", color: LIGHT_GRAY } });
sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 1.05, fill: { type: "solid", color: "6B1A1A" } });
sl.addShape(pres.ShapeType.rect, { x: 0, y: 1.05, w: 0.08, h: 4.57, fill: { type: "solid", color: "DC2626" } });
sl.addText("CLUSTER HEADACHE", {
x: 0.3, y: 0.22, w: 9, h: 0.6,
fontSize: 24, bold: true, color: WHITE, fontFace: "Calibri",
});
sl.addText([
{ text: "The most severe primary headache disorder\n", options: { bold: true, color: "6B1A1A", fontSize: 15, breakLine: true } },
{ text: "• Strictly unilateral orbital, supraorbital, and/or temporal pain\n", options: { breakLine: true } },
{ text: "• Duration 15–180 minutes; attacks 1–8×/day\n", options: { breakLine: true } },
{ text: "• Ipsilateral autonomic features: lacrimation, nasal congestion/rhinorrhea, ptosis, miosis, conjunctival injection, eyelid edema\n", options: { breakLine: true } },
{ text: "• Male predominance (historically 9:1 — now narrowing)\n", options: { breakLine: true } },
{ text: "• Circadian rhythm: attacks often at same time daily; hypothalamic clock implicated\n\n", options: { breakLine: true } },
{ text: "Acute Treatment ", options: { bold: true, color: "6B1A1A", breakLine: false } },
{ text: "100% O₂ (7–12 L/min), SC/IN sumatriptan, IN zolmitriptan\n", options: { breakLine: true } },
{ text: "Prevention ", options: { bold: true, color: "6B1A1A", breakLine: false } },
{ text: "Verapamil (first-line), lithium, melatonin, short-course prednisone bridge", options: {} },
], {
x: 0.3, y: 1.2, w: 9.4, h: 4.2,
fontSize: 14, color: TEXT_DARK, fontFace: "Calibri", valign: "top",
});
}
// ─── SLIDE 8: Tension-Type & Other Primary Headaches ───
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { type: "solid", color: WHITE } });
sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 1.05, fill: { type: "solid", color: MED_BLUE } });
sl.addText("TENSION-TYPE & OTHER PRIMARY HEADACHES", {
x: 0.3, y: 0.22, w: 9.4, h: 0.6,
fontSize: 22, bold: true, color: WHITE, fontFace: "Calibri",
});
const boxes = [
{
title: "Tension-Type Headache",
color: "2563EB",
items: [
"Bilateral pressing/tightening quality",
"Mild–moderate, non-pulsating",
"No nausea; photo OR phonophobia (not both)",
"Not aggravated by routine activity",
"Rx: NSAIDs, acetaminophen, amitriptyline (prevention)",
]
},
{
title: "Hypnic Headache",
color: "7C3AED",
items: [
"Wakes patient from sleep — 'alarm clock headache'",
"Usually bilateral, mild–moderate",
"Elderly patients (>50 yrs)",
"No autonomic features",
"Rx: Caffeine at bedtime, lithium, melatonin",
]
},
{
title: "Primary Sex / Cough / Exercise",
color: "059669",
items: [
"Sex headache: bilateral at orgasm, explosive",
"Cough/exercise: bilateral, precipitated by Valsalva",
"MUST exclude SAH (thunderclap onset)",
"Usually benign and self-limiting",
"Rx: Indomethacin (cough/exercise), propranolol (sex)",
]
},
];
boxes.forEach((box, i) => {
const x = 0.2 + i * 3.27;
sl.addShape(pres.ShapeType.rect, { x, y: 1.15, w: 3.1, h: 0.45, fill: { type: "solid", color: box.color }, line: { color: box.color } });
sl.addText(box.title, { x, y: 1.17, w: 3.1, h: 0.4, fontSize: 13, bold: true, color: WHITE, align: "center", fontFace: "Calibri" });
box.items.forEach((item, ii) => {
const y = 1.68 + ii * 0.7;
sl.addShape(pres.ShapeType.rect, { x, y, w: 3.1, h: 0.66, fill: { type: "solid", color: ii % 2 === 0 ? LIGHT_GRAY : WHITE }, line: { color: LIGHT_GRAY, width: 0.5 } });
sl.addText(`• ${item}`, { x: x + 0.08, y: y + 0.03, w: 2.94, h: 0.62, fontSize: 11, color: TEXT_DARK, fontFace: "Calibri", valign: "middle" });
});
});
}
// ─── SLIDE 9: Red Flags & Dangerous Headaches ───
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { type: "solid", color: "1A0A0A" } });
sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 1.05, fill: { type: "solid", color: "9B1111" } });
sl.addText("RED FLAGS — WHEN TO WORRY", {
x: 0.3, y: 0.22, w: 9, h: 0.6,
fontSize: 24, bold: true, color: WHITE, fontFace: "Calibri",
});
const flags = [
{ icon: "⚡", flag: "Thunderclap onset", detail: "Peak within 60 sec — SAH until proven otherwise" },
{ icon: "🤒", flag: "Fever + meningism", detail: "Meningitis / encephalitis" },
{ icon: "🧠", flag: "New neuro deficit", detail: "Mass lesion, stroke, AVM" },
{ icon: "👁", flag: "Papilledema", detail: "Raised intracranial pressure" },
{ icon: "📈", flag: "Progressive worsening", detail: "Intracranial mass, CVT" },
{ icon: "🕐", flag: "Age >50 new headache", detail: "Giant cell arteritis, malignancy" },
{ icon: "💊", flag: "Immunocompromised", detail: "Cryptococcal meningitis, CNS lymphoma" },
{ icon: "🤰", flag: "Pregnancy / postpartum", detail: "PRES, CVT, eclampsia, cavernous sinus thrombosis" },
];
flags.forEach((f, i) => {
const row = Math.floor(i / 2);
const col = i % 2;
const x = 0.3 + col * 4.85;
const y = 1.2 + row * 1.05;
sl.addShape(pres.ShapeType.rect, { x, y, w: 4.6, h: 0.9, fill: { type: "solid", color: "2A0A0A" }, line: { color: "9B1111", width: 1 } });
sl.addText(f.icon + " " + f.flag, { x: x + 0.1, y: y + 0.05, w: 4.4, h: 0.4, fontSize: 14, bold: true, color: "FF6B6B", fontFace: "Calibri" });
sl.addText(f.detail, { x: x + 0.1, y: y + 0.44, w: 4.4, h: 0.38, fontSize: 12, color: "FFAAAA", fontFace: "Calibri" });
});
}
// ─── SLIDE 10: Treatment ───
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { type: "solid", color: LIGHT_GRAY } });
sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 1.05, fill: { type: "solid", color: DARK_BLUE } });
sl.addText("TREATMENT OF MIGRAINE", {
x: 0.3, y: 0.22, w: 9, h: 0.6,
fontSize: 24, bold: true, color: WHITE, fontFace: "Calibri",
});
// Two columns: Acute vs Preventive
const cols = [
{
title: "ACUTE TREATMENT",
color: ACCENT,
items: [
"NSAIDs / Aspirin / Acetaminophen (mild–mod)",
"Triptans (5-HT1B/1D) — first-line moderate–severe",
"Ditans (lasmiditan) — 5-HT1F, no vasoconstriction",
"Gepants (ubrogepant, rimegepant) — CGRP antagonists",
"Antiemetics: metoclopramide, prochlorperazine",
"Ergots (DHE) — refractory/status migrainosus",
]
},
{
title: "PREVENTIVE TREATMENT",
color: GOLD,
items: [
"Beta-blockers: propranolol, metoprolol (grade A)",
"TCAs: amitriptyline (also for TTH comorbidity)",
"Anticonvulsants: valproate, topiramate",
"CGRP mAbs: erenumab, fremanezumab, galcanezumab",
"Gepants: atogepant, rimegepant (oral preventives)",
"Botulinum toxin (chronic migraine, ≥15 days/month)",
]
},
];
cols.forEach((col, ci) => {
const x = 0.3 + ci * 4.85;
sl.addShape(pres.ShapeType.rect, { x, y: 1.2, w: 4.5, h: 0.42, fill: { type: "solid", color: col.color }, line: { color: col.color } });
sl.addText(col.title, { x, y: 1.22, w: 4.5, h: 0.38, fontSize: 14, bold: true, color: WHITE, align: "center", fontFace: "Calibri" });
col.items.forEach((item, ii) => {
const y = 1.7 + ii * 0.62;
sl.addShape(pres.ShapeType.rect, { x, y, w: 4.5, h: 0.58, fill: { type: "solid", color: ii % 2 === 0 ? WHITE : "F0F4FA" }, line: { color: LIGHT_GRAY, width: 0.5 } });
sl.addText(`• ${item}`, { x: x + 0.1, y: y + 0.03, w: 4.3, h: 0.52, fontSize: 12, color: TEXT_DARK, fontFace: "Calibri", valign: "middle" });
});
});
}
// ─── SLIDE 11: Summary ───
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { type: "solid", color: DEEP_NAVY } });
sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.12, h: 5.625, fill: { type: "solid", color: GOLD } });
sl.addShape(pres.ShapeType.rect, { x: 9.88, y: 0, w: 0.12, h: 5.625, fill: { type: "solid", color: GOLD } });
sl.addText("KEY TAKEAWAYS", {
x: 0.5, y: 0.4, w: 9, h: 0.7,
fontSize: 30, bold: true, color: WHITE, align: "center", fontFace: "Calibri",
});
sl.addShape(pres.ShapeType.line, { x: 1, y: 1.15, w: 8, h: 0, line: { color: GOLD, width: 2 } });
const points = [
"Most disabling headaches are migraine — assess with MIDAS questionnaire",
"Trigeminovascular activation and CGRP release are central to migraine pathophysiology",
"PET/MRI shows hypothalamic/pontine activation in migraine (premonitory → attack → chronic)",
"Thunderclap headache = SAH until proven otherwise — always investigate",
"Triptans, gepants, and CGRP monoclonal antibodies are evidence-based migraine treatments",
"Cluster headache: always check autonomic features; treat acutely with O₂ + sumatriptan",
];
points.forEach((p, i) => {
sl.addShape(pres.ShapeType.ellipse, { x: 0.4, y: 1.35 + i * 0.69, w: 0.32, h: 0.32, fill: { type: "solid", color: GOLD }, line: { color: GOLD } });
sl.addText(`${i + 1}`, { x: 0.41, y: 1.36 + i * 0.69, w: 0.3, h: 0.3, fontSize: 12, bold: true, color: DEEP_NAVY, align: "center", fontFace: "Calibri" });
sl.addText(p, { x: 0.85, y: 1.34 + i * 0.69, w: 8.7, h: 0.36, fontSize: 14, color: LIGHT_GRAY, fontFace: "Calibri", valign: "middle" });
});
sl.addText("Source: Harrison's Principles of Internal Medicine, 22nd Edition (2025), Chapter 441", {
x: 0.5, y: 5.25, w: 9, h: 0.25,
fontSize: 10, color: "5070A0", align: "center", fontFace: "Calibri",
});
}
// Write file
pres.writeFile({ fileName: "/home/daytona/workspace/headache-pptx/Headache_Harrison_22E.pptx" })
.then(() => console.log("DONE: Headache_Harrison_22E.pptx"))
.catch(err => { console.error("Write error:", err); process.exit(1); });
cd /home/daytona/workspace/headache-pptx && node headache.js 2>&1
Headache Harrison 22E
Presentation · PPTX
| Slide | Content |
|---|---|
| 1 | Title slide - dark navy design |
| 2 | Overview & Epidemiology - stat boxes (15% global prevalence, 3:1 female ratio, etc.) |
| 3 | Classification - Primary vs Secondary headache (side-by-side table) |
| 4 | Migraine Pathophysiology + real Harrison's brain diagram (Fig 441-1 trigeminovascular pathways) |
| 5 | Two real Harrison's brain scans - PET activation (Fig 441-2A) & axial MRI (Fig 441-2C) |
| 6 | Migraine Clinical Features - 4-phase flow (Prodrome → Aura → Headache → Postdrome) + ICHD-3 criteria |
| 7 | Cluster Headache - features, acute & preventive treatment |
| 8 | Tension-Type, Hypnic, and Primary Exertional headaches |
| 9 | Red Flags - 8 warning signs (thunderclap, fever+meningism, papilledema, etc.) |
| 10 | Treatment - Acute vs Preventive comparison (triptans, gepants, CGRP mAbs, botulinum toxin) |
| 11 | Key Takeaways with source citation |
Make presentation according to Harrison's and make like Human
grep -n "cdn.orris.care" /textbooks/9781265977061/9781265977061_block49.md | head -60
"cdn.orris.care" in /textbooks/9781265977061
~/headache-pptx/headache_v2.js
const pptxgen = require("pptxgenjs");
const { execSync } = require("child_process");
// All 6 real human patient images from Harrison's 22E, Chapter 441
const imageUrls = [
// Fig 441-1: Brainstem trigeminovascular diagram
"https://cdn.orris.care/cdss_images/d79ad64919bbe2ea795ad5ac016dd5773e6dfee05124af733fdb3c1c617c6b44.png",
// Fig 441-2A: PET – migraine premonitory phase (human patient)
"https://cdn.orris.care/cdss_images/2368f7d8c41bc8125ec2646b2f3ad36134124003937b29563f6359eb7d1a486d.png",
// Fig 441-2C: Axial MRI – migraine (human patient, right-sided pain)
"https://cdn.orris.care/cdss_images/58474695b1dd120a63533ae3bf934d4da98095a45ec1c2b9c8bb527e3907dc0c.png",
// Fig 441-3A: PET – posterior hypothalamic activation, cluster headache (human patient)
"https://cdn.orris.care/cdss_images/c1d257d24c306a8fe0c9a3bf316e52e4fb6da52a82036b10bdfab0ca73510f61.png",
// Fig 441-3B: MRI voxel-based morphometry – cluster headache (human patient)
"https://cdn.orris.care/cdss_images/3894cbb90f45bffcb5bb6905f9e9c27a2576b55ec7760ba04d371f7b5d16e0ba.png",
// Fig 441-3 panel: axial MRI – cluster headache lateralisation (human patient)
"https://cdn.orris.care/cdss_images/29986bd7a497b5973ac7b037e8052027613f080253fc5cfc762bfae4cfa4aeec.png",
// Fig 441-3B extra: sagittal MRI cluster headache (human patient)
"https://cdn.orris.care/cdss_images/a6abf2f34c2727a95599b6683c26a7f809dd22ef5d260197bf0e4de8774b9a94.png",
];
console.log("Fetching all Harrison's patient images...");
let imgs = [];
try {
const raw = execSync(
`node /home/daytona/skills/shared/scripts/fetch_images.js ${imageUrls.map(u => `"${u}"`).join(" ")}`,
{ maxBuffer: 80 * 1024 * 1024, timeout: 60000 }
).toString();
imgs = JSON.parse(raw);
imgs.forEach((img, i) => console.log(` [${i}] ${img.error ? "ERROR: " + img.error : "OK " + img.base64.substring(0,30) + "..."}`));
} catch (e) {
console.error("Fetch error:", e.message);
imgs = imageUrls.map(u => ({ url: u, base64: null, error: e.message }));
}
const ok = (i) => imgs[i] && !imgs[i].error && imgs[i].base64;
// ─── PALETTE ────────────────────────────────────────────────────
const N1 = "0B1320"; // darkest navy
const N2 = "0E1F40"; // dark navy
const N3 = "1B3461"; // mid navy
const BLU = "2563EB"; // blue accent
const LBLU = "3B82F6"; // light blue
const GOLD = "F59E0B"; // gold
const RED = "DC2626"; // alert red
const GRN = "059669"; // green
const WHT = "FFFFFF";
const L1 = "EEF2FA"; // very light bg
const L2 = "DDE4F2"; // light gray-blue
const TXT = "1A2540"; // dark text
const TMID = "3A5070"; // mid text
const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.author = "Harrison's Principles of Internal Medicine 22E";
pres.subject = "Headache";
pres.title = "Headache – Harrison's 22E";
// ════════════════════════════════════════════════════════════════
// SLIDE 1 ─ TITLE
// ════════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
// Full dark bg
sl.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{type:"solid", color:N1} });
// Right-side decorative image panel (brain scan)
if (ok(2)) {
sl.addImage({ data:imgs[2].base64, x:5.8, y:0, w:4.2, h:5.625, sizing:{type:"cover", w:4.2, h:5.625} });
// Dark overlay on the image
sl.addShape(pres.ShapeType.rect, { x:5.8, y:0, w:4.2, h:5.625, fill:{type:"solid", color:N1}, transparency:50 });
}
// Left accent bar
sl.addShape(pres.ShapeType.rect, { x:0, y:0, w:0.15, h:5.625, fill:{type:"solid", color:LBLU} });
// Gold top bar strip
sl.addShape(pres.ShapeType.rect, { x:0.15, y:0, w:9.85, h:0.07, fill:{type:"solid", color:GOLD} });
// Main title
sl.addText("HEADACHE", {
x:0.4, y:0.9, w:6, h:1.4,
fontSize:58, bold:true, color:WHT, fontFace:"Calibri",
charSpacing:3,
});
// Subtitle line
sl.addShape(pres.ShapeType.line, { x:0.4, y:2.45, w:5.5, h:0, line:{color:GOLD, width:2.5} });
sl.addText("A Clinical Overview", {
x:0.4, y:2.58, w:5.5, h:0.55,
fontSize:22, color:LBLU, italic:true, fontFace:"Calibri",
});
sl.addText("Based on Harrison's Principles of\nInternal Medicine, 22nd Edition (2025)", {
x:0.4, y:3.3, w:5.5, h:0.75,
fontSize:14, color:"8AAAD0", fontFace:"Calibri",
});
sl.addText("Chapter 441 | McGraw Hill Medical | Pages 3505–3524", {
x:0.4, y:4.15, w:5.5, h:0.35,
fontSize:11, color:"5A7090", fontFace:"Calibri",
});
// Bottom badge
sl.addShape(pres.ShapeType.rect, { x:0.4, y:4.7, w:2.8, h:0.55,
fill:{type:"solid", color:BLU}, line:{color:BLU} });
sl.addText("NEUROLOGY | HARRISON'S 22E", {
x:0.4, y:4.72, w:2.8, h:0.5,
fontSize:11, bold:true, color:WHT, align:"center", fontFace:"Calibri",
});
}
// ════════════════════════════════════════════════════════════════
// SLIDE 2 ─ EPIDEMIOLOGY
// ════════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{type:"solid", color:L1} });
sl.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:1.1, fill:{type:"solid", color:N2} });
sl.addShape(pres.ShapeType.rect, { x:0, y:1.1, w:0.1, h:4.525, fill:{type:"solid", color:LBLU} });
sl.addText("EPIDEMIOLOGY & OVERVIEW", {
x:0.3, y:0.25, w:9.4, h:0.6,
fontSize:26, bold:true, color:WHT, fontFace:"Calibri",
});
// 4 stat cards
const stats = [
{ num:"~15%", sub:"Global migraine\nprevalence" },
{ num:"3 : 1", sub:"Female to male\nratio in migraine" },
{ num:">150", sub:"Distinct headache\ndisorders (IHS)" },
{ num:"#3", sub:"Cause of global\ndisability (GBD)" },
];
stats.forEach((s,i) => {
const x = 0.25 + i*2.42;
sl.addShape(pres.ShapeType.rect, { x, y:1.25, w:2.25, h:1.55,
fill:{type:"solid", color:N2}, line:{color:LBLU, width:1.5} });
sl.addText(s.num, { x, y:1.32, w:2.25, h:0.75,
fontSize:32, bold:true, color:GOLD, align:"center", fontFace:"Calibri" });
sl.addText(s.sub, { x, y:2.07, w:2.25, h:0.67,
fontSize:12, color:L1, align:"center", fontFace:"Calibri" });
});
// Key points
const pts = [
"Headache disorders are divided into PRIMARY (no underlying cause) and SECONDARY (caused by another disease).",
"Migraine alone affects ~1 billion people worldwide and is the leading cause of disability in people under 50.",
"Most disabling headaches meet migraine criteria — tension-type is featureless by comparison.",
"Migraine is an inherited neurological disorder; it cannot be cured, only controlled with lifestyle and medication.",
"Always screen for 'red flags' to exclude dangerous secondary causes (SAH, meningitis, mass lesion).",
];
pts.forEach((p, i) => {
const y = 2.97 + i * 0.51;
sl.addShape(pres.ShapeType.rect, { x:0.25, y, w:0.38, h:0.38,
fill:{type:"solid", color:LBLU}, line:{color:LBLU} });
sl.addText(`${i+1}`, { x:0.26, y:y+0.01, w:0.36, h:0.36,
fontSize:13, bold:true, color:WHT, align:"center", fontFace:"Calibri" });
sl.addText(p, { x:0.72, y:y+0.01, w:9.0, h:0.38,
fontSize:13, color:TXT, fontFace:"Calibri", valign:"middle" });
});
}
// ════════════════════════════════════════════════════════════════
// SLIDE 3 ─ CLASSIFICATION TABLE
// ════════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{type:"solid", color:WHT} });
sl.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:1.1, fill:{type:"solid", color:N3} });
sl.addText("CLASSIFICATION OF HEADACHE DISORDERS", {
x:0.3, y:0.25, w:9.4, h:0.6,
fontSize:24, bold:true, color:WHT, fontFace:"Calibri",
});
const cols = [
{ title:"PRIMARY HEADACHES", color:BLU,
items:["Migraine (with / without aura)","Tension-Type Headache (TTH)",
"Cluster Headache","Trigeminal Autonomic Cephalalgias (TACs)",
"Primary Cough Headache","Primary Exercise Headache",
"Primary Sex Headache","Primary Stabbing Headache",
"Hypnic Headache","New Daily Persistent Headache"] },
{ title:"SECONDARY HEADACHES", color:"7C3AED",
items:["Subarachnoid Hemorrhage (SAH)","Cerebral Venous Sinus Thrombosis",
"Meningitis / Encephalitis","Intracranial Hypertension / Hypotension",
"Giant Cell Arteritis","Hypertensive Crisis",
"Brain Tumor / Mass Lesion","Post-dural Puncture",
"Cervicogenic Headache","Medication-Overuse Headache"] },
];
cols.forEach((col, ci) => {
const x = 0.2 + ci * 4.9;
sl.addShape(pres.ShapeType.rect, { x, y:1.18, w:4.55, h:0.48,
fill:{type:"solid", color:col.color}, line:{color:col.color} });
sl.addText(col.title, { x, y:1.2, w:4.55, h:0.44,
fontSize:14, bold:true, color:WHT, align:"center", fontFace:"Calibri" });
col.items.forEach((item, ii) => {
const y = 1.72 + ii * 0.38;
sl.addShape(pres.ShapeType.rect, { x, y, w:4.55, h:0.36,
fill:{type:"solid", color: ii%2===0 ? L1 : WHT},
line:{color:L2, width:0.5} });
sl.addText(`• ${item}`, { x:x+0.12, y:y+0.02, w:4.35, h:0.32,
fontSize:12, color:TXT, fontFace:"Calibri" });
});
});
}
// ════════════════════════════════════════════════════════════════
// SLIDE 4 ─ MIGRAINE PATHOPHYSIOLOGY + BRAIN DIAGRAM
// ════════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{type:"solid", color:N1} });
sl.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:1.1, fill:{type:"solid", color:N3} });
sl.addText("MIGRAINE PATHOPHYSIOLOGY", {
x:0.3, y:0.25, w:9.4, h:0.6,
fontSize:26, bold:true, color:WHT, fontFace:"Calibri",
});
// Diagram image (left)
if (ok(0)) {
sl.addImage({ data:imgs[0].base64, x:0.2, y:1.18, w:4.4, h:3.95 });
sl.addText("FIG 441-1 Trigeminovascular brainstem pathways\n(Harrison's 22E, p.3508 — real patient imaging)", {
x:0.2, y:5.16, w:4.4, h:0.38,
fontSize:9, color:"7090B0", italic:true, align:"center", fontFace:"Calibri",
});
}
// Text right side
const rows = [
{ h:"Trigeminovascular System", c:GOLD },
{ b:"CGRP & PACAP", t:" are released from trigeminal nerve terminals at meningeal vessels" },
{ b:"Triptans (5-HT1B/1D)", t:" — block nociceptive signalling AND cause cranial vasoconstriction" },
{ b:"Ditans (5-HT1F)", t:" — neural targets only; no vasoconstriction; safe in cardiac patients" },
{ b:"CGRP mAbs", t:" — erenumab, fremanezumab, galcanezumab: effective migraine prevention" },
{ h:"Cortical Spreading Depression", c:GOLD },
{ b:"CSD", t:" — wave of depolarisation travelling at 3–5 mm/min; underlies aura" },
{ b:"Ion channel mutations", t:" (FHM genes: CACNA1A, ATP1A2, SCN1A) increase susceptibility" },
{ h:"Monoamine & Dopamine", c:GOLD },
{ b:"Dopamine receptor hypersensitivity", t:" → yawning, nausea, vomiting in prodrome" },
{ b:"Hypothalamic activation", t:" precedes pain (PET imaging in premonitory phase)" },
];
let yy = 1.22;
rows.forEach(r => {
if (r.h) {
sl.addText(r.h, { x:4.85, y:yy, w:4.95, h:0.36,
fontSize:13, bold:true, color:r.c, fontFace:"Calibri" });
yy += 0.37;
} else {
sl.addText([
{ text:r.b, options:{ bold:true, color:LBLU } },
{ text:r.t, options:{ color:L1 } },
], { x:4.85, y:yy, w:4.95, h:0.36, fontSize:12, fontFace:"Calibri", valign:"middle" });
yy += 0.37;
}
});
}
// ════════════════════════════════════════════════════════════════
// SLIDE 5 ─ REAL HUMAN BRAIN SCANS — MIGRAINE (from Harrison's)
// ════════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{type:"solid", color:"080E1C"} });
// Header
sl.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:1.0, fill:{type:"solid", color:N3} });
sl.addText("MIGRAINE — REAL HUMAN BRAIN SCANS (Harrison's 22E, Fig. 441-2)", {
x:0.3, y:0.2, w:9.4, h:0.6,
fontSize:22, bold:true, color:WHT, fontFace:"Calibri",
});
// Image 1: PET premonitory phase
if (ok(1)) {
sl.addShape(pres.ShapeType.rect, { x:0.25, y:1.08, w:4.5, h:3.85,
fill:{type:"solid", color:"111827"}, line:{color:LBLU, width:1.5} });
sl.addImage({ data:imgs[1].base64, x:0.35, y:1.15, w:4.3, h:3.4 });
sl.addText("PET — Premonitory Phase (before headache)", {
x:0.25, y:4.6, w:4.5, h:0.28,
fontSize:11, bold:true, color:LBLU, align:"center", fontFace:"Calibri",
});
sl.addText("Hypothalamic & dorsal midbrain activation seen in patient before pain onset", {
x:0.25, y:4.88, w:4.5, h:0.28,
fontSize:10, color:"8AAAD0", italic:true, align:"center", fontFace:"Calibri",
});
}
// Image 2: Axial MRI acute migraine
if (ok(2)) {
sl.addShape(pres.ShapeType.rect, { x:5.25, y:1.08, w:4.5, h:3.85,
fill:{type:"solid", color:"111827"}, line:{color:GOLD, width:1.5} });
sl.addImage({ data:imgs[2].base64, x:5.35, y:1.15, w:4.3, h:3.4 });
sl.addText("MRI — Acute Migraine Attack (right-sided)", {
x:5.25, y:4.6, w:4.5, h:0.28,
fontSize:11, bold:true, color:GOLD, align:"center", fontFace:"Calibri",
});
sl.addText("Dorsolateral pontine activation persists; lateralises to side of pain", {
x:5.25, y:4.88, w:4.5, h:0.28,
fontSize:10, color:"C0A870", italic:true, align:"center", fontFace:"Calibri",
});
}
}
// ════════════════════════════════════════════════════════════════
// SLIDE 6 ─ REAL HUMAN BRAIN SCANS — CLUSTER HEADACHE
// ════════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{type:"solid", color:"0E0808"} });
sl.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:1.0, fill:{type:"solid", color:"5B0A0A"} });
sl.addText("CLUSTER HEADACHE — REAL HUMAN BRAIN SCANS (Harrison's 22E, Fig. 441-3)", {
x:0.3, y:0.2, w:9.4, h:0.6,
fontSize:21, bold:true, color:WHT, fontFace:"Calibri",
});
// 3 images in a row
const clusterImgs = [
{ idx:3, label:"PET — Posterior Hypothalamic\nActivation (cluster headache)",
sub:"Real patient scan: hypothalamic 'clock'\nactivated during acute attack", color:"FF6B6B" },
{ idx:4, label:"MRI Voxel Morphometry —\nIncreased Gray Matter Density",
sub:"Lateralised to side of pain;\nstructural brain change in cluster patients", color:GOLD },
{ idx:5, label:"Axial MRI —\nHypothalamic Lateralisation",
sub:"Crosshair on activated hypothalamus;\nillustrates unilateral nature of cluster", color:LBLU },
];
clusterImgs.forEach((ci, i) => {
const x = 0.2 + i * 3.27;
if (ok(ci.idx)) {
sl.addShape(pres.ShapeType.rect, { x, y:1.08, w:3.05, h:3.15,
fill:{type:"solid", color:"1A0808"}, line:{color:ci.color, width:1.5} });
sl.addImage({ data:imgs[ci.idx].base64, x:x+0.07, y:1.15, w:2.91, h:2.9 });
} else {
sl.addShape(pres.ShapeType.rect, { x, y:1.08, w:3.05, h:3.15,
fill:{type:"solid", color:"1A0808"}, line:{color:ci.color, width:1.5} });
sl.addText("[Image unavailable]", { x, y:2.5, w:3.05, h:0.4,
fontSize:11, color:"666666", align:"center", fontFace:"Calibri" });
}
sl.addText(ci.label, { x, y:4.28, w:3.05, h:0.55,
fontSize:10.5, bold:true, color:ci.color, align:"center", fontFace:"Calibri" });
sl.addText(ci.sub, { x, y:4.85, w:3.05, h:0.5,
fontSize:9.5, color:"C0A8A8", italic:true, align:"center", fontFace:"Calibri" });
});
}
// ════════════════════════════════════════════════════════════════
// SLIDE 7 ─ MIGRAINE — CLINICAL FEATURES
// ════════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{type:"solid", color:WHT} });
sl.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:1.1, fill:{type:"solid", color:N2} });
sl.addShape(pres.ShapeType.rect, { x:0, y:1.1, w:0.1, h:4.52, fill:{type:"solid", color:GOLD} });
sl.addText("MIGRAINE — CLINICAL FEATURES & DIAGNOSIS", {
x:0.3, y:0.25, w:9.4, h:0.6,
fontSize:25, bold:true, color:WHT, fontFace:"Calibri",
});
// Phase flow
const phases = [
{ name:"Prodrome", dur:"Hours–days", sym:"Mood change, food craving,\nyawning, fatigue, neck pain, polyuria" },
{ name:"Aura", dur:"20–60 min", sym:"Visual (fortification spectra, scotoma),\nsensory, speech, motor (FHM)" },
{ name:"Headache", dur:"4–72 hrs", sym:"Unilateral pulsating, moderate–severe;\nnausea, vomiting, photo/phonophobia" },
{ name:"Postdrome",dur:"Hours", sym:"Fatigue, cognitive slowing,\nmood change, scalp tenderness" },
];
phases.forEach((ph, i) => {
const x = 0.25 + i * 2.38;
const col = [BLU,"7C3AED",RED,GRN][i];
sl.addShape(pres.ShapeType.rect, { x, y:1.22, w:2.18, h:0.72,
fill:{type:"solid", color:col}, line:{color:col} });
sl.addText(ph.name, { x, y:1.24, w:2.18, h:0.38,
fontSize:15, bold:true, color:WHT, align:"center", fontFace:"Calibri" });
sl.addText(ph.dur, { x, y:1.62, w:2.18, h:0.28,
fontSize:11, color:"E0E8FF", align:"center", fontFace:"Calibri", italic:true });
sl.addShape(pres.ShapeType.rect, { x, y:2.0, w:2.18, h:1.28,
fill:{type:"solid", color:L1}, line:{color:col, width:1} });
sl.addText(ph.sym, { x:x+0.08, y:2.05, w:2.02, h:1.18,
fontSize:12, color:TXT, fontFace:"Calibri", valign:"middle" });
if (i < 3) sl.addText("→", { x:x+2.18, y:2.35, w:0.2, h:0.5,
fontSize:22, color:GOLD, align:"center" });
});
// ICHD-3 criteria box
sl.addShape(pres.ShapeType.rect, { x:0.25, y:3.43, w:9.5, h:1.97,
fill:{type:"solid", color:N1}, line:{color:BLU, width:1.2} });
sl.addText("ICHD-3 DIAGNOSTIC CRITERIA FOR MIGRAINE WITHOUT AURA", {
x:0.4, y:3.52, w:9.2, h:0.38,
fontSize:13, bold:true, color:GOLD, fontFace:"Calibri",
});
sl.addText(
"≥5 attacks lasting 4–72 h | ≥2 of: unilateral, pulsating, moderate/severe, aggravated by routine activity\n" +
"PLUS at least 1 of: nausea/vomiting OR photophobia AND phonophobia",
{ x:0.4, y:3.93, w:9.2, h:1.37,
fontSize:13, color:L1, fontFace:"Calibri", valign:"top" }
);
}
// ════════════════════════════════════════════════════════════════
// SLIDE 8 ─ CLUSTER HEADACHE
// ════════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{type:"solid", color:L1} });
sl.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:1.1, fill:{type:"solid", color:"7B1010"} });
sl.addShape(pres.ShapeType.rect, { x:0, y:1.1, w:0.1, h:4.52, fill:{type:"solid", color:RED} });
sl.addText("CLUSTER HEADACHE — THE SUICIDE HEADACHE", {
x:0.3, y:0.25, w:9.4, h:0.6,
fontSize:25, bold:true, color:WHT, fontFace:"Calibri",
});
// Left: clinical features
const feats = [
["Location","Retroorbital / orbital / temporal — STRICTLY UNILATERAL"],
["Pain quality","Deep, excruciating, explosive, non-fluctuating"],
["Duration","15–180 minutes; 1–8 attacks/day during a bout"],
["Timing","Circadian — often nocturnal; same hour each day; 50% wake from sleep"],
["Autonomic","Ipsilateral lacrimation, conjunctival injection, nasal congestion/rhinorrhea, ptosis, miosis"],
["Behaviour","Patient paces, rocks, rubs head — OPPOSITE to migraineur who lies still"],
["Sex ratio","Men > women (3:1 historically); prevalence ~0.1%"],
["Pathogenesis","Posterior hypothalamic activation (Fig 441-3); circadian clock dysfunction"],
];
feats.forEach(([k,v], i) => {
const y = 1.25 + i * 0.52;
sl.addShape(pres.ShapeType.rect, { x:0.2, y, w:2.0, h:0.47,
fill:{type:"solid", color:"7B1010"}, line:{color:"7B1010"} });
sl.addText(k, { x:0.2, y:y+0.02, w:2.0, h:0.42,
fontSize:12, bold:true, color:WHT, align:"center", fontFace:"Calibri", valign:"middle" });
sl.addShape(pres.ShapeType.rect, { x:2.25, y, w:5.3, h:0.47,
fill:{type:"solid", color: i%2===0 ? WHT : L2}, line:{color:L2, width:0.5} });
sl.addText(v, { x:2.35, y:y+0.02, w:5.1, h:0.42,
fontSize:12, color:TXT, fontFace:"Calibri", valign:"middle" });
});
// Right: brain scan
if (ok(3)) {
sl.addShape(pres.ShapeType.rect, { x:7.7, y:1.25, w:2.1, h:2.2,
fill:{type:"solid", color:"1A0808"}, line:{color:RED, width:1.5} });
sl.addImage({ data:imgs[3].base64, x:7.77, y:1.32, w:1.96, h:1.95 });
sl.addText("PET: Hypothalamic\nactivation (cluster)\nHarrison's Fig 441-3A", {
x:7.7, y:3.5, w:2.1, h:0.55,
fontSize:9, color:"FF8888", italic:true, align:"center", fontFace:"Calibri",
});
}
// Treatment box
sl.addShape(pres.ShapeType.rect, { x:0.2, y:4.45, w:9.6, h:1.0,
fill:{type:"solid", color:"2A0808"}, line:{color:RED, width:1} });
sl.addText([
{ text:"ACUTE: ", options:{ bold:true, color:"FF6B6B" } },
{ text:"100% O₂ 10–12 L/min × 15–20 min | SC sumatriptan 6 mg | IN zolmitriptan 5 mg | nVNS \n", options:{ color:L1 } },
{ text:"PREVENTIVE: ", options:{ bold:true, color:GOLD } },
{ text:"Verapamil (first-line) | Lithium | Melatonin | Prednisone (bridge) | Occipital nerve stimulation", options:{ color:L1 } },
], { x:0.35, y:4.52, w:9.3, h:0.88, fontSize:12, fontFace:"Calibri", valign:"middle" });
}
// ════════════════════════════════════════════════════════════════
// SLIDE 9 ─ OTHER PRIMARY HEADACHES
// ════════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{type:"solid", color:WHT} });
sl.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:1.1, fill:{type:"solid", color:N3} });
sl.addText("OTHER PRIMARY HEADACHE DISORDERS", {
x:0.3, y:0.25, w:9.4, h:0.6,
fontSize:25, bold:true, color:WHT, fontFace:"Calibri",
});
const boxes = [
{ title:"Tension-Type (TTH)", color:BLU,
pts:["Bilateral pressing/tightening","Mild–moderate, NON-pulsating",
"No nausea; NO aggravation by activity","Photo OR phono (not both)",
"Rx: NSAIDs, amitriptyline (prevention)"] },
{ title:"Hypnic Headache", color:"7C3AED",
pts:["Wakes patient from sleep (alarm clock headache)","Usually bilateral, mild–moderate",
"Elderly >50 yrs; no autonomic features","Must exclude O2 desaturation, GCA",
"Rx: Caffeine at bedtime, lithium, melatonin"] },
{ title:"Sex / Cough / Exercise", color:GRN,
pts:["Sex: explosive bilateral at orgasm — MUST exclude SAH","Cough: bilateral, precipitated by Valsalva",
"Exercise: bilateral during/after exertion","All require cranial imaging first time",
"Rx: Indomethacin; propranolol (sex headache)"] },
];
boxes.forEach((box, i) => {
const x = 0.2 + i * 3.27;
sl.addShape(pres.ShapeType.rect, { x, y:1.18, w:3.1, h:0.48,
fill:{type:"solid", color:box.color}, line:{color:box.color} });
sl.addText(box.title, { x, y:1.2, w:3.1, h:0.44,
fontSize:13.5, bold:true, color:WHT, align:"center", fontFace:"Calibri" });
box.pts.forEach((p, ii) => {
const y = 1.72 + ii * 0.75;
sl.addShape(pres.ShapeType.rect, { x, y, w:3.1, h:0.71,
fill:{type:"solid", color: ii%2===0 ? L1 : WHT},
line:{color:L2, width:0.5} });
sl.addText(`• ${p}`, { x:x+0.1, y:y+0.03, w:2.9, h:0.65,
fontSize:12, color:TXT, fontFace:"Calibri", valign:"middle" });
});
});
}
// ════════════════════════════════════════════════════════════════
// SLIDE 10 ─ RED FLAGS (secondary headache warning signs)
// ════════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{type:"solid", color:"100808"} });
sl.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:1.1, fill:{type:"solid", color:RED} });
sl.addText("⚠ RED FLAGS — DANGEROUS SECONDARY HEADACHES", {
x:0.2, y:0.22, w:9.6, h:0.65,
fontSize:24, bold:true, color:WHT, fontFace:"Calibri",
});
const flags = [
{ icon:"⚡", title:"Thunderclap Onset", detail:"Worst headache of life, peak <60 sec → SAH until proven otherwise (LP or CT cisternogram)" },
{ icon:"🌡", title:"Fever + Meningism", detail:"Neck stiffness, Kernig/Brudzinski → Meningitis / encephalitis; immediate CT + LP" },
{ icon:"🧠", title:"New Neurological Deficit", detail:"Weakness, aphasia, diplopia → mass lesion, stroke, AVM, subdural haematoma" },
{ icon:"👁", title:"Papilledema", detail:"Raised ICP → tumour, CVT, idiopathic intracranial hypertension; urgent MRI/LP" },
{ icon:"📈", title:"Progressive Worsening", detail:"Weeks of worsening headache → subdural, mass lesion, cerebral venous thrombosis" },
{ icon:"🕐", title:"New Headache Age >50", detail:"Giant cell arteritis (ESR, CRP, temporal artery biopsy); also exclude malignancy" },
{ icon:"💊", title:"Immunocompromised", detail:"HIV, steroids → Cryptococcal meningitis, toxoplasma, CNS lymphoma, TB meningitis" },
{ icon:"🤰", title:"Pregnancy / Postpartum", detail:"PRES, CVST, eclampsia, cavernous sinus thrombosis — immediate neurology referral" },
];
flags.forEach((f, i) => {
const row = Math.floor(i/2);
const col = i%2;
const x = 0.2 + col * 4.9;
const y = 1.22 + row * 1.06;
sl.addShape(pres.ShapeType.rect, { x, y, w:4.65, h:0.98,
fill:{type:"solid", color:"200808"}, line:{color:RED, width:1} });
sl.addText(`${f.icon} ${f.title}`, { x:x+0.12, y:y+0.05, w:4.45, h:0.38,
fontSize:14, bold:true, color:"FF6B6B", fontFace:"Calibri" });
sl.addText(f.detail, { x:x+0.12, y:y+0.48, w:4.45, h:0.44,
fontSize:11.5, color:"FFBBBB", fontFace:"Calibri", valign:"top" });
});
}
// ════════════════════════════════════════════════════════════════
// SLIDE 11 ─ TREATMENT (Acute + Preventive)
// ════════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{type:"solid", color:L1} });
sl.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:1.1, fill:{type:"solid", color:N2} });
sl.addText("MIGRAINE TREATMENT — ACUTE & PREVENTIVE", {
x:0.3, y:0.25, w:9.4, h:0.6,
fontSize:25, bold:true, color:WHT, fontFace:"Calibri",
});
const cols = [
{ title:"ACUTE TREATMENT", color:BLU, textColor:"0040C0",
rows:[
{ drug:"NSAIDs / Aspirin / Paracetamol", note:"Mild–moderate attacks; take early" },
{ drug:"Triptans (5-HT1B/1D)", note:"Sumatriptan, rizatriptan; moderate–severe" },
{ drug:"Ditans (Lasmiditan)", note:"5-HT1F; safe in cardiovascular disease" },
{ drug:"Gepants (Ubrogepant, Rimegepant)",note:"CGRP antagonists; no vasoconstriction" },
{ drug:"Antiemetics", note:"Metoclopramide, prochlorperazine; improve absorption" },
{ drug:"DHE (Dihydroergotamine)", note:"Refractory/status migrainosus; IV or IN" },
]},
{ title:"PREVENTIVE TREATMENT", color:GOLD, textColor:"A06000",
rows:[
{ drug:"Beta-blockers", note:"Propranolol, metoprolol — Grade A evidence" },
{ drug:"TCAs", note:"Amitriptyline — also covers TTH comorbidity" },
{ drug:"Anticonvulsants", note:"Valproate, topiramate — Grade A evidence" },
{ drug:"CGRP monoclonal antibodies", note:"Erenumab, fremanezumab, galcanezumab" },
{ drug:"Gepants (oral preventive)", note:"Atogepant, rimegepant — new class" },
{ drug:"Botulinum Toxin A", note:"Chronic migraine ≥15 d/month; PREEMPT protocol" },
]},
];
cols.forEach((col, ci) => {
const x = 0.2 + ci * 4.9;
sl.addShape(pres.ShapeType.rect, { x, y:1.18, w:4.55, h:0.48,
fill:{type:"solid", color:col.color}, line:{color:col.color} });
sl.addText(col.title, { x, y:1.2, w:4.55, h:0.44,
fontSize:14, bold:true, color: ci===0 ? WHT : N1, align:"center", fontFace:"Calibri" });
col.rows.forEach((r, ii) => {
const y = 1.72 + ii * 0.64;
sl.addShape(pres.ShapeType.rect, { x, y, w:4.55, h:0.6,
fill:{type:"solid", color: ii%2===0 ? WHT : L2}, line:{color:L2, width:0.5} });
sl.addText(r.drug, { x:x+0.1, y:y+0.03, w:4.35, h:0.28,
fontSize:12.5, bold:true, color:col.textColor, fontFace:"Calibri" });
sl.addText(r.note, { x:x+0.1, y:y+0.31, w:4.35, h:0.24,
fontSize:11, color:TMID, fontFace:"Calibri" });
});
});
}
// ════════════════════════════════════════════════════════════════
// SLIDE 12 ─ MIDAS QUESTIONNAIRE
// ════════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{type:"solid", color:WHT} });
sl.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:1.1, fill:{type:"solid", color:N3} });
sl.addText("MIDAS — MIGRAINE DISABILITY ASSESSMENT SCORE", {
x:0.3, y:0.25, w:9.4, h:0.6,
fontSize:23, bold:true, color:WHT, fontFace:"Calibri",
});
sl.addText("Ask the patient: over the last 3 months...", {
x:0.3, y:1.18, w:9.4, h:0.35,
fontSize:14, italic:true, color:TMID, fontFace:"Calibri",
});
const questions = [
"Q1. How many days did you MISS WORK or school because of headaches?",
"Q2. How many days was your productivity at work REDUCED BY ≥50%?",
"Q3. How many days did you NOT DO HOUSEHOLD work because of headaches?",
"Q4. How many days was your productivity at home REDUCED BY ≥50%?",
"Q5. How many days did you MISS FAMILY, social, or leisure activities?",
];
questions.forEach((q, i) => {
const y = 1.6 + i * 0.52;
sl.addShape(pres.ShapeType.rect, { x:0.3, y, w:7.6, h:0.46,
fill:{type:"solid", color: i%2===0 ? L1 : WHT}, line:{color:L2, width:0.5} });
sl.addText(q, { x:0.4, y:y+0.03, w:7.0, h:0.4,
fontSize:13, color:TXT, fontFace:"Calibri", valign:"middle" });
sl.addShape(pres.ShapeType.rect, { x:8.0, y, w:1.7, h:0.46,
fill:{type:"solid", color:L2}, line:{color:BLU, width:1} });
sl.addText("___ days", { x:8.0, y:y+0.03, w:1.7, h:0.4,
fontSize:12, color:BLU, align:"center", fontFace:"Calibri", valign:"middle" });
});
// Grading
const grades = [
{ g:"Grade I", score:"0–5", label:"Minimal/Infrequent Disability", color:GRN },
{ g:"Grade II", score:"6–10", label:"Mild/Infrequent Disability", color:GOLD },
{ g:"Grade III", score:"11–20", label:"Moderate Disability", color:"F97316" },
{ g:"Grade IV", score:">20", label:"Severe Disability", color:RED },
];
sl.addText("MIDAS GRADING (Add scores Q1–Q5):", {
x:0.3, y:4.3, w:9.4, h:0.32,
fontSize:13, bold:true, color:N2, fontFace:"Calibri",
});
grades.forEach((g, i) => {
const x = 0.3 + i * 2.38;
sl.addShape(pres.ShapeType.rect, { x, y:4.65, w:2.28, h:0.75,
fill:{type:"solid", color:g.color}, line:{color:g.color} });
sl.addText(`${g.g}\n${g.score}\n${g.label}`, { x, y:4.67, w:2.28, h:0.71,
fontSize:10.5, bold:true, color:WHT, align:"center", fontFace:"Calibri" });
});
}
// ════════════════════════════════════════════════════════════════
// SLIDE 13 ─ SUMMARY + HUMAN SCAN COLLAGE
// ════════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{type:"solid", color:N1} });
sl.addShape(pres.ShapeType.rect, { x:0, y:0, w:0.12, h:5.625, fill:{type:"solid", color:GOLD} });
sl.addShape(pres.ShapeType.rect, { x:9.88, y:0, w:0.12, h:5.625, fill:{type:"solid", color:GOLD} });
sl.addText("KEY TAKEAWAYS", {
x:0.4, y:0.25, w:9.2, h:0.7,
fontSize:30, bold:true, color:WHT, align:"center", fontFace:"Calibri",
});
sl.addShape(pres.ShapeType.line, { x:0.8, y:1.0, w:8.4, h:0, line:{color:GOLD, width:2} });
// Left: summary points
const pts = [
"Migraine is a neurological disorder, not 'just a bad headache' — treat it seriously",
"Trigeminovascular CGRP signalling is the core mechanism; gepants & mAbs target it directly",
"PET/MRI shows real changes in human brains: hypothalamus in prodrome, pons in attack",
"Cluster headache: always check ipsilateral autonomic features + circadian timing",
"Thunderclap headache = SAH until proven otherwise — always investigate with CT ± LP",
"CGRP monoclonal antibodies revolutionised migraine prevention (Grade A evidence)",
"Use MIDAS to quantify disability and guide treatment intensity",
];
pts.forEach((p, i) => {
sl.addShape(pres.ShapeType.ellipse, { x:0.35, y:1.15+i*0.59, w:0.34, h:0.34,
fill:{type:"solid", color:GOLD}, line:{color:GOLD} });
sl.addText(`${i+1}`, { x:0.36, y:1.16+i*0.59, w:0.32, h:0.32,
fontSize:12, bold:true, color:N1, align:"center", fontFace:"Calibri" });
sl.addText(p, { x:0.78, y:1.14+i*0.59, w:6.3, h:0.36,
fontSize:13, color:L1, fontFace:"Calibri", valign:"middle" });
});
// Right: small scan montage
const scanMontage = [
{ idx:1, x:7.25, y:1.15, w:2.5, h:1.5 },
{ idx:3, x:7.25, y:2.75, w:2.5, h:1.5 },
{ idx:4, x:7.25, y:4.3, w:2.5, h:1.1 },
];
scanMontage.forEach(m => {
if (ok(m.idx)) {
sl.addShape(pres.ShapeType.rect, { x:m.x-0.04, y:m.y-0.04, w:m.w+0.08, h:m.h+0.08,
fill:{type:"solid", color:LBLU}, line:{color:LBLU} });
sl.addImage({ data:imgs[m.idx].base64, x:m.x, y:m.y, w:m.w, h:m.h });
}
});
sl.addText("Real patient brain scans\n(PET & MRI) from\nHarrison's 22E, Ch.441", {
x:7.25, y:5.43, w:2.5, h:0.15,
fontSize:8.5, color:"5070A0", italic:true, align:"center", fontFace:"Calibri",
});
sl.addText("Source: Harrison's Principles of Internal Medicine, 22nd Edition (2025), Chapter 441, pp.3505–3524", {
x:0.4, y:5.43, w:6.7, h:0.15,
fontSize:8.5, color:"404E6A", fontFace:"Calibri",
});
}
// ─── Write output ───────────────────────────────────────────────
const outPath = "/home/daytona/workspace/headache-pptx/Headache_Harrison22E_WithPatientScans.pptx";
pres.writeFile({ fileName: outPath })
.then(() => console.log("✅ DONE:", outPath))
.catch(err => { console.error("❌ Write error:", err); process.exit(1); });
cd /home/daytona/workspace/headache-pptx && node headache_v2.js 2>&1
| Slide | Content | Human Images |
|---|---|---|
| 1 | Title — dark design with brain scan backdrop | Fig 441-2C (patient MRI) |
| 2 | Epidemiology & overview with stat cards | — |
| 3 | Full classification table (primary vs secondary) | — |
| 4 | Migraine pathophysiology — CGRP, serotonin, CSD | Fig 441-1 (brainstem diagram) |
| 5 | Real human brain scans — MIGRAINE | Fig 441-2A (PET, premonitory phase) + Fig 441-2C (MRI, acute attack) |
| 6 | Real human brain scans — CLUSTER HEADACHE | Fig 441-3A (PET) + Fig 441-3B (MRI voxel morphometry) + axial MRI |
| 7 | Migraine clinical features — 4-phase flow + ICHD-3 criteria | — |
| 8 | Cluster headache — features + PET scan inset | Fig 441-3A thumbnail |
| 9 | TTH, Hypnic, Sex/Cough/Exercise headaches | — |
| 10 | Red flags (8 dangerous warning signs) | — |
| 11 | Treatment — acute vs preventive comparison | — |
| 12 | MIDAS questionnaire + grading scale | — |
| 13 | Key takeaways + brain scan collage | 3-scan patient montage |
MAke presentation on headache with 15 slides
~/headache-pptx/headache_15.js
const pptxgen = require("pptxgenjs");
const { execSync } = require("child_process");
// ─── All real human patient images from Harrison's 22E Ch.441 ───
const IMG_URLS = [
"https://cdn.orris.care/cdss_images/d79ad64919bbe2ea795ad5ac016dd5773e6dfee05124af733fdb3c1c617c6b44.png", // 0 – Fig441-1 Brainstem/TCC diagram
"https://cdn.orris.care/cdss_images/2368f7d8c41bc8125ec2646b2f3ad36134124003937b29563f6359eb7d1a486d.png", // 1 – Fig441-2A PET premonitory (migraine patient)
"https://cdn.orris.care/cdss_images/58474695b1dd120a63533ae3bf934d4da98095a45ec1c2b9c8bb527e3907dc0c.png", // 2 – Fig441-2C axial MRI migraine (right-sided attack)
"https://cdn.orris.care/cdss_images/c1d257d24c306a8fe0c9a3bf316e52e4fb6da52a82036b10bdfab0ca73510f61.png", // 3 – Fig441-3A PET cluster headache hypothalamic
"https://cdn.orris.care/cdss_images/3894cbb90f45bffcb5bb6905f9e9c27a2576b55ec7760ba04d371f7b5d16e0ba.png", // 4 – Fig441-3B MRI voxel morphometry cluster
"https://cdn.orris.care/cdss_images/29986bd7a497b5973ac7b037e8052027613f080253fc5cfc762bfae4cfa4aeec.png", // 5 – Fig441-3 axial MRI cluster lateralisation
"https://cdn.orris.care/cdss_images/a6abf2f34c2727a95599b6683c26a7f809dd22ef5d260197bf0e4de8774b9a94.png", // 6 – Fig441-3B sagittal MRI cluster
];
console.log("Fetching Harrison's patient images…");
let imgs = [];
try {
const raw = execSync(
`node /home/daytona/skills/shared/scripts/fetch_images.js ${IMG_URLS.map(u=>`"${u}"`).join(" ")}`,
{ maxBuffer: 100*1024*1024, timeout: 90000 }
).toString();
imgs = JSON.parse(raw);
imgs.forEach((m,i)=>console.log(` [${i}] ${m.error?"ERR:"+m.error:"OK"}`));
} catch(e) {
console.error("Fetch error:", e.message);
imgs = IMG_URLS.map(u=>({url:u,base64:null,error:e.message}));
}
const ok = i => imgs[i] && !imgs[i].error && imgs[i].base64;
// ─── PALETTE ────────────────────────────────────────────────────
const C = {
n1:"050D1F", n2:"0B1A38", n3:"112347", n4:"1B3461", // navy shades
bl:"2563EB", lb:"3B82F6", sky:"60A5FA", // blues
gd:"F59E0B", am:"FCD34D", // gold / amber
rd:"DC2626", pr:"7C3AED", gr:"059669", // red/purple/green
wh:"FFFFFF", l1:"EEF2FA", l2:"DDE4F2", // whites/light
tx:"1A2540", tm:"3A5070", // text
};
const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Headache – Harrison's 22E (2025)";
pres.author = "Harrison's Principles of Internal Medicine";
// ─── helper: slide header bar ────────────────────────────────────
function header(sl, title, bg=C.n3, fg=C.wh, accent=C.lb) {
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:5.625,fill:{type:"solid",color:C.l1}});
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:1.05,fill:{type:"solid",color:bg}});
sl.addShape(pres.ShapeType.rect,{x:0,y:1.05,w:0.1,h:4.575,fill:{type:"solid",color:accent}});
sl.addText(title,{x:0.28,y:0.22,w:9.5,h:0.62,fontSize:24,bold:true,color:fg,fontFace:"Calibri"});
}
function darkHeader(sl, title, bg=C.n1, accent=C.lb) {
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:5.625,fill:{type:"solid",color:C.n1}});
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:1.05,fill:{type:"solid",color:bg}});
sl.addText(title,{x:0.28,y:0.22,w:9.5,h:0.62,fontSize:24,bold:true,color:C.wh,fontFace:"Calibri"});
}
function bullet(sl, items, x, y, w, h, opts={}) {
const arr = items.map((it,i)=>[
{text:`• `, options:{bold:true,color:opts.dot||C.lb}},
{text:it, options:{color:opts.tc||C.tx,breakLine:i<items.length-1}}
]).flat();
sl.addText(arr,{x,y,w,h,fontSize:opts.fs||13,fontFace:"Calibri",valign:"top",...(opts.extra||{})});
}
function twoCol(sl,left,right,opts={}) {
const lw=opts.lw||4.6, rw=opts.rw||4.6, gap=10-lw-rw, lx=0.2, rx=lx+lw+gap;
bullet(sl,left,lx,1.15,lw,4.3,{fs:13,...opts});
bullet(sl,right,rx,1.15,rw,4.3,{fs:13,...opts});
}
function imgBox(sl,idx,x,y,w,h,cap="",capColor=C.tm) {
sl.addShape(pres.ShapeType.rect,{x,y,w,h,fill:{type:"solid",color:C.n2},line:{color:C.lb,width:1.2}});
if(ok(idx)){
sl.addImage({data:imgs[idx].base64,x:x+0.05,y:y+0.05,w:w-0.1,h:h-0.1});
} else {
sl.addText("[image unavailable]",{x,y:y+h/2-0.15,w,h:0.3,fontSize:10,color:"888888",align:"center",fontFace:"Calibri"});
}
if(cap) sl.addText(cap,{x,y:y+h+0.04,w,h:0.32,fontSize:9,italic:true,color:capColor,align:"center",fontFace:"Calibri"});
}
function statBox(sl,num,sub,x,y,numC=C.gd) {
sl.addShape(pres.ShapeType.rect,{x,y,w:2.2,h:1.5,fill:{type:"solid",color:C.n2},line:{color:C.lb,width:1.5}});
sl.addText(num,{x,y:y+0.1,w:2.2,h:0.7,fontSize:30,bold:true,color:numC,align:"center",fontFace:"Calibri"});
sl.addText(sub,{x,y:y+0.82,w:2.2,h:0.58,fontSize:11,color:C.l1,align:"center",fontFace:"Calibri"});
}
// ════════════════════════════════════════════════════════════
// SLIDE 1 – TITLE
// ════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:5.625,fill:{type:"solid",color:C.n1}});
// decorative right panel with brain image
if(ok(2)){
sl.addImage({data:imgs[2].base64,x:5.9,y:0,w:4.1,h:5.625,sizing:{type:"cover",w:4.1,h:5.625}});
sl.addShape(pres.ShapeType.rect,{x:5.9,y:0,w:4.1,h:5.625,fill:{type:"solid",color:C.n1},transparency:45});
}
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:0.18,h:5.625,fill:{type:"solid",color:C.lb}});
sl.addShape(pres.ShapeType.rect,{x:0.18,y:0,w:9.82,h:0.06,fill:{type:"solid",color:C.gd}});
sl.addText("HEADACHE",{x:0.45,y:0.75,w:6,h:1.5,fontSize:62,bold:true,color:C.wh,fontFace:"Calibri",charSpacing:3});
sl.addShape(pres.ShapeType.line,{x:0.45,y:2.45,w:5.6,h:0,line:{color:C.gd,width:3}});
sl.addText("A Comprehensive Clinical Overview",{x:0.45,y:2.6,w:5.6,h:0.55,fontSize:21,color:C.sky,italic:true,fontFace:"Calibri"});
sl.addText("Harrison's Principles of Internal Medicine\n22nd Edition — 2025 | Chapter 441",{x:0.45,y:3.35,w:5.6,h:0.8,fontSize:14,color:"8AAAD0",fontFace:"Calibri"});
sl.addShape(pres.ShapeType.rect,{x:0.45,y:4.35,w:3.2,h:0.55,fill:{type:"solid",color:C.bl},line:{color:C.bl}});
sl.addText("NEUROLOGY | HARRISON'S 22E",{x:0.45,y:4.37,w:3.2,h:0.5,fontSize:12,bold:true,color:C.wh,align:"center",fontFace:"Calibri"});
sl.addText("15-Slide Clinical Presentation",{x:0.45,y:5.1,w:5,h:0.3,fontSize:11,color:"5070A0",italic:true,fontFace:"Calibri"});
}
// ════════════════════════════════════════════════════════════
// SLIDE 2 – EPIDEMIOLOGY
// ════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
header(sl,"EPIDEMIOLOGY & GLOBAL BURDEN",C.n3,C.wh,C.lb);
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:5.625,fill:{type:"solid",color:C.l1}});
header(sl,"EPIDEMIOLOGY & GLOBAL BURDEN",C.n3,C.wh,C.lb);
[0,1,2,3].forEach(i=>{
const stats=[
{n:"~15%",s:"Women with migraine\n(1-year period)"},
{n:"6%", s:"Men with migraine\n(1-year period)"},
{n:"3:1", s:"Female-to-male\nratio in migraine"},
{n:">150",s:"Distinct headache\ndisorders (IHS)"},
];
statBox(sl,stats[i].n,stats[i].s,0.3+i*2.42,1.25);
});
const pts=[
"Headache disorders are among the most common neurological conditions worldwide.",
"Migraine alone is the #1 cause of neurological disability globally — GBD data.",
"Most disabling headaches fulfill migraine criteria; tension-type headache is featureless.",
"Migraine is an INHERITED neurological disorder — it cannot be cured, only controlled.",
"Headache prevalence peaks in the 30s–40s; women are disproportionately affected.",
"Secondary headaches can be life-threatening; always screen for RED FLAG features.",
];
pts.forEach((p,i)=>{
const y=2.93+i*0.44;
sl.addShape(pres.ShapeType.rect,{x:0.28,y,w:0.38,h:0.36,fill:{type:"solid",color:C.bl},line:{color:C.bl}});
sl.addText(`${i+1}`,{x:0.29,y:y+0.01,w:0.36,h:0.34,fontSize:12,bold:true,color:C.wh,align:"center",fontFace:"Calibri"});
sl.addText(p,{x:0.74,y:y+0.01,w:9.0,h:0.36,fontSize:13,color:C.tx,fontFace:"Calibri",valign:"middle"});
});
}
// ════════════════════════════════════════════════════════════
// SLIDE 3 – CLASSIFICATION
// ════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:5.625,fill:{type:"solid",color:C.wh}});
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:1.05,fill:{type:"solid",color:C.n4}});
sl.addText("CLASSIFICATION OF HEADACHE DISORDERS (ICHD-3)",{x:0.28,y:0.22,w:9.5,h:0.62,fontSize:23,bold:true,color:C.wh,fontFace:"Calibri"});
const cols=[
{title:"PRIMARY",color:C.bl,items:[
"Migraine without aura","Migraine with aura","Tension-Type Headache (TTH)",
"Cluster Headache","SUNCT / SUNA","Paroxysmal Hemicrania",
"Primary Cough Headache","Primary Exercise Headache","Primary Sex Headache",
"Primary Stabbing Headache","Hypnic Headache","New Daily Persistent Headache",
]},
{title:"SECONDARY",color:C.pr,items:[
"Subarachnoid Hemorrhage (SAH)","Cerebral Venous Sinus Thrombosis (CVT)",
"Meningitis / Encephalitis","Intracranial Hypertension / Hypotension",
"Giant Cell Arteritis (GCA)","Hypertensive Crisis",
"Brain Tumor / Mass Lesion","Post-dural Puncture Headache",
"Cervicogenic Headache","Medication-Overuse Headache",
"Trigeminal Neuralgia","Carotid / Vertebral Artery Dissection",
]},
];
cols.forEach((col,ci)=>{
const x=0.2+ci*4.95;
sl.addShape(pres.ShapeType.rect,{x,y:1.12,w:4.55,h:0.44,fill:{type:"solid",color:col.color},line:{color:col.color}});
sl.addText(col.title,{x,y:1.14,w:4.55,h:0.4,fontSize:14,bold:true,color:C.wh,align:"center",fontFace:"Calibri"});
col.items.forEach((item,ii)=>{
const y=1.62+ii*0.33;
sl.addShape(pres.ShapeType.rect,{x,y,w:4.55,h:0.3,fill:{type:"solid",color:ii%2===0?C.l1:C.wh},line:{color:C.l2,width:0.4}});
sl.addText(`• ${item}`,{x:x+0.1,y:y+0.01,w:4.35,h:0.28,fontSize:11.5,color:C.tx,fontFace:"Calibri"});
});
});
}
// ════════════════════════════════════════════════════════════
// SLIDE 4 – MIGRAINE: OVERVIEW
// ════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:5.625,fill:{type:"solid",color:C.wh}});
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:1.05,fill:{type:"solid",color:C.n3}});
sl.addShape(pres.ShapeType.rect,{x:0,y:1.05,w:0.1,h:4.575,fill:{type:"solid",color:C.gd}});
sl.addText("MIGRAINE — OVERVIEW",{x:0.28,y:0.22,w:9.5,h:0.62,fontSize:24,bold:true,color:C.wh,fontFace:"Calibri"});
// Left text column
const leftPts=[
"Second most common cause of headache worldwide",
"#1 neurological cause of disability globally",
"Affects ~15% women and ~6% men (1-year prevalence)",
"Episodic headache associated with neurologic dysfunction",
"Four phases: Prodrome → Aura (20–25%) → Headache → Postdrome",
"Migraine triggers: sleep disruption, hunger, stress let-down, menses, alcohol, weather change",
"Migraineurs do NOT habituate to sensory stimuli — key neurophysiological difference",
"Not just a bad headache — a recurrent syndrome of CNS sensitivity",
];
leftPts.forEach((p,i)=>{
const y=1.18+i*0.51;
sl.addShape(pres.ShapeType.rect,{x:0.25,y,w:5.7,h:0.46,fill:{type:"solid",color:i%2===0?C.l1:C.wh},line:{color:C.l2,width:0.5}});
sl.addText(`• ${p}`,{x:0.35,y:y+0.03,w:5.5,h:0.4,fontSize:12.5,color:C.tx,fontFace:"Calibri",valign:"middle"});
});
// Right: ICHD-3 criteria box
sl.addShape(pres.ShapeType.rect,{x:6.2,y:1.15,w:3.6,h:4.3,fill:{type:"solid",color:C.n2},line:{color:C.bl,width:1.5}});
sl.addShape(pres.ShapeType.rect,{x:6.2,y:1.15,w:3.6,h:0.42,fill:{type:"solid",color:C.bl},line:{color:C.bl}});
sl.addText("ICHD-3 CRITERIA",{x:6.2,y:1.17,w:3.6,h:0.38,fontSize:13,bold:true,color:C.wh,align:"center",fontFace:"Calibri"});
const crit=[
["Attacks","≥ 5 episodes"],["Duration","4–72 hours"],
["Pain","Unilateral"],["Quality","Pulsating"],
["Severity","Moderate–Severe"],["Activity","Aggravates"],
["+","Nausea/Vomiting"],["OR","Photo + Phonophobia"],
];
crit.forEach(([k,v],i)=>{
const y=1.65+i*0.46;
sl.addShape(pres.ShapeType.rect,{x:6.2,y,w:1.5,h:0.42,fill:{type:"solid",color:C.n3},line:{color:C.n3}});
sl.addText(k,{x:6.2,y:y+0.02,w:1.5,h:0.38,fontSize:12,bold:true,color:C.gd,align:"center",fontFace:"Calibri"});
sl.addShape(pres.ShapeType.rect,{x:7.72,y,w:2.08,h:0.42,fill:{type:"solid",color:i%2===0?"1C3060":"162850"},line:{color:C.n2}});
sl.addText(v,{x:7.72,y:y+0.02,w:2.08,h:0.38,fontSize:12,color:C.l1,align:"center",fontFace:"Calibri"});
});
}
// ════════════════════════════════════════════════════════════
// SLIDE 5 – MIGRAINE AURA
// ════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:5.625,fill:{type:"solid",color:C.wh}});
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:1.05,fill:{type:"solid",color:C.n4}});
sl.addShape(pres.ShapeType.rect,{x:0,y:1.05,w:0.1,h:4.575,fill:{type:"solid",color:C.pr}});
sl.addText("MIGRAINE AURA — TYPES & PATHOPHYSIOLOGY",{x:0.28,y:0.22,w:9.5,h:0.62,fontSize:24,bold:true,color:C.wh,fontFace:"Calibri"});
// Aura types
const types=[
{t:"Visual Aura (most common)",d:"Fortification spectra (scintillating scotoma), flickering arc of light expanding from centre; positive → negative phenomena; builds over 5–20 min",c:C.bl},
{t:"Sensory Aura",d:"Paraesthesias spreading from hand to face (cheiro-oral distribution); can be the sole aura",c:C.pr},
{t:"Language/Dysphasic Aura",d:"Dysphasia — difficulty finding words or comprehension; usually brief",c:C.gr},
{t:"Motor Aura (Hemiplegic Migraine)",d:"Weakness lasting up to 72 h; CACNA1A, ATP1A2, SCN1A gene mutations; familial or sporadic",c:C.rd},
{t:"Brainstem Aura",d:"Dysarthria, vertigo, tinnitus, diplopia, ataxia — replaces term 'basilar-type migraine'",c:C.gd},
{t:"Acephalgic Migraine (Aura without Headache)",d:"Recurrent neurologic symptoms without headache; vertigo may predominate (vestibular migraine)",c:"F97316"},
];
types.forEach((t,i)=>{
const y=1.15+i*0.74;
sl.addShape(pres.ShapeType.rect,{x:0.22,y,w:1.8,h:0.65,fill:{type:"solid",color:t.c},line:{color:t.c}});
sl.addText(t.t,{x:0.22,y:y+0.03,w:1.8,h:0.58,fontSize:11,bold:true,color:C.wh,align:"center",fontFace:"Calibri",valign:"middle"});
sl.addShape(pres.ShapeType.rect,{x:2.08,y,w:7.7,h:0.65,fill:{type:"solid",color:i%2===0?C.l1:C.wh},line:{color:C.l2,width:0.5}});
sl.addText(t.d,{x:2.18,y:y+0.03,w:7.5,h:0.58,fontSize:12.5,color:C.tx,fontFace:"Calibri",valign:"middle"});
});
// CSD note
sl.addShape(pres.ShapeType.rect,{x:0.22,y:5.6,w:9.56,h:0.0,fill:{type:"solid",color:C.pr},line:{color:C.pr}});
}
// ════════════════════════════════════════════════════════════
// SLIDE 6 – MIGRAINE PATHOPHYSIOLOGY
// ════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:5.625,fill:{type:"solid",color:C.n1}});
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:1.05,fill:{type:"solid",color:C.n4}});
sl.addText("MIGRAINE PATHOPHYSIOLOGY",{x:0.28,y:0.22,w:9.5,h:0.62,fontSize:24,bold:true,color:C.wh,fontFace:"Calibri"});
// Large brain diagram (left half)
imgBox(sl,0,0.2,1.12,4.55,4.25,"FIG 441-1 Brainstem trigeminovascular pathways\n(Harrison's 22E — real patient imaging)","7090B0");
// Mechanism bullets right
const mechs=[
{h:"Trigeminovascular System",t:""},
{b:"CGRP & PACAP",t:" released from trigeminal terminals at meningeal vessels"},
{b:"Second-order neurons",t:" cross midline → thalamus, hypothalamus, PAG"},
{b:"Locus coeruleus & raphe",t:" provide descending antinociceptive modulation"},
{h:"Serotonin",t:""},
{b:"Triptans (5-HT1B/1D)",t:" — vasoconstriction + nociception blockade"},
{b:"Ditans (5-HT1F)",t:" — neural only, safe in cardiac disease"},
{h:"Dopamine",t:""},
{b:"Dopamine hypersensitivity",t:" → prodrome symptoms (yawning, nausea)"},
{b:"Hypothalamic activation",t:" precedes pain on PET imaging"},
{h:"Ion Channels / CSD",t:""},
{b:"FHM mutations",t:" (CACNA1A, ATP1A2, SCN1A) → membrane excitability"},
{b:"CSD",t:" — cortical spreading depolarisation at 3–5 mm/min underlies aura"},
];
let yy=1.14;
mechs.forEach(m=>{
if(m.h){
sl.addText(m.h,{x:4.95,y:yy,w:4.85,h:0.3,fontSize:12.5,bold:true,color:C.gd,fontFace:"Calibri"});
yy+=0.31;
} else {
sl.addText([{text:m.b,options:{bold:true,color:C.sky}},{text:m.t,options:{color:C.l1}}],
{x:4.95,y:yy,w:4.85,h:0.28,fontSize:11.5,fontFace:"Calibri",valign:"middle"});
yy+=0.3;
}
});
}
// ════════════════════════════════════════════════════════════
// SLIDE 7 – REAL HUMAN BRAIN SCANS (MIGRAINE)
// ════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:5.625,fill:{type:"solid",color:"06080F"}});
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:1.05,fill:{type:"solid",color:C.n4}});
sl.addText("MIGRAINE — REAL HUMAN PATIENT BRAIN SCANS (Harrison's 22E, Fig. 441-2)",{x:0.25,y:0.22,w:9.5,h:0.62,fontSize:22,bold:true,color:C.wh,fontFace:"Calibri"});
// Image 1 large
sl.addShape(pres.ShapeType.rect,{x:0.2,y:1.1,w:4.55,h:4.0,fill:{type:"solid",color:C.n2},line:{color:C.lb,width:1.5}});
if(ok(1)) sl.addImage({data:imgs[1].base64,x:0.28,y:1.18,w:4.39,h:3.6});
sl.addText("FIG 441-2A — PET Scan: PREMONITORY PHASE",{x:0.2,y:4.74,w:4.55,h:0.25,fontSize:10.5,bold:true,color:C.sky,align:"center",fontFace:"Calibri"});
sl.addText("Real patient before headache: hypothalamic + dorsal midbrain activation",{x:0.2,y:4.99,w:4.55,h:0.25,fontSize:9.5,color:"8AAAD0",italic:true,align:"center",fontFace:"Calibri"});
// Image 2 large
sl.addShape(pres.ShapeType.rect,{x:5.2,y:1.1,w:4.55,h:4.0,fill:{type:"solid",color:C.n2},line:{color:C.gd,width:1.5}});
if(ok(2)) sl.addImage({data:imgs[2].base64,x:5.28,y:1.18,w:4.39,h:3.6});
sl.addText("FIG 441-2C — MRI: ACUTE MIGRAINE ATTACK (right-sided)",{x:5.2,y:4.74,w:4.55,h:0.25,fontSize:10.5,bold:true,color:C.gd,align:"center",fontFace:"Calibri"});
sl.addText("Dorsolateral pontine (locus coeruleus) activation lateralises to pain side",{x:5.2,y:4.99,w:4.55,h:0.25,fontSize:9.5,color:"C0A870",italic:true,align:"center",fontFace:"Calibri"});
}
// ════════════════════════════════════════════════════════════
// SLIDE 8 – CLUSTER HEADACHE
// ════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:5.625,fill:{type:"solid",color:C.l1}});
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:1.05,fill:{type:"solid",color:"7B1010"}});
sl.addShape(pres.ShapeType.rect,{x:0,y:1.05,w:0.1,h:4.575,fill:{type:"solid",color:C.rd}});
sl.addText('CLUSTER HEADACHE — "The Suicide Headache"',{x:0.28,y:0.22,w:9.5,h:0.62,fontSize:23,bold:true,color:C.wh,fontFace:"Calibri"});
const rows=[
["Location","Retroorbital / orbital / temporal — STRICTLY UNILATERAL"],
["Pain quality","Deep, excruciating, explosive, non-fluctuating; VAS 10/10"],
["Duration","15–180 minutes; 1–8 attacks/day during a bout"],
["Circadian","Nocturnal onset ~50%; attacks at same hour each day — hypothalamic clock"],
["Autonomic","Ipsilateral: lacrimation, conjunctival injection, rhinorrhea/congestion, ptosis, miosis, eyelid oedema"],
["Behaviour","Patient PACES / rocks — contrast to migraineur who lies still"],
["Epidemiology","Male > Female (3:1 historically); prevalence ~0.1%; onset 20–40 yrs"],
["Pathogenesis","Posterior hypothalamic activation (PET proven in real patients, Fig 441-3)"],
];
rows.forEach(([k,v],i)=>{
const y=1.15+i*0.56;
sl.addShape(pres.ShapeType.rect,{x:0.22,y,w:1.9,h:0.5,fill:{type:"solid",color:"7B1010"},line:{color:"7B1010"}});
sl.addText(k,{x:0.22,y:y+0.02,w:1.9,h:0.46,fontSize:12,bold:true,color:C.wh,align:"center",fontFace:"Calibri",valign:"middle"});
sl.addShape(pres.ShapeType.rect,{x:2.17,y,w:5.55,h:0.5,fill:{type:"solid",color:i%2===0?C.wh:C.l2},line:{color:C.l2,width:0.5}});
sl.addText(v,{x:2.27,y:y+0.02,w:5.35,h:0.46,fontSize:12.5,color:C.tx,fontFace:"Calibri",valign:"middle"});
});
// Brain scan inset
sl.addShape(pres.ShapeType.rect,{x:7.88,y:1.15,w:1.9,h:2.1,fill:{type:"solid",color:"180808"},line:{color:C.rd,width:1.5}});
if(ok(3)) sl.addImage({data:imgs[3].base64,x:7.94,y:1.21,w:1.78,h:1.8});
sl.addText("PET: Hypothalamic\nactivation in cluster\n(Fig 441-3A — Harrison's)",{x:7.88,y:3.3,w:1.9,h:0.5,fontSize:8.5,color:"FF8888",italic:true,align:"center",fontFace:"Calibri"});
sl.addShape(pres.ShapeType.rect,{x:0.22,y:5.05,w:9.56,h:0.44,fill:{type:"solid",color:"200808"},line:{color:C.rd,width:1}});
sl.addText([{text:"ACUTE Rx: ",options:{bold:true,color:"FF6B6B"}},{text:"100% O₂ 10-12 L/min × 15–20 min | SC/IN sumatriptan | nVNS ",options:{color:C.l1}},
{text:"PREVENTION: ",options:{bold:true,color:C.gd}},{text:"Verapamil (1st-line) | Lithium | Prednisone bridge | Occipital nerve stimulation",options:{color:C.l1}}],
{x:0.3,y:5.08,w:9.4,h:0.38,fontSize:11.5,fontFace:"Calibri",valign:"middle"});
}
// ════════════════════════════════════════════════════════════
// SLIDE 9 – REAL HUMAN BRAIN SCANS (CLUSTER HEADACHE)
// ════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:5.625,fill:{type:"solid",color:"080306"}});
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:1.05,fill:{type:"solid",color:"5B0A0A"}});
sl.addText("CLUSTER HEADACHE — REAL HUMAN BRAIN SCANS (Harrison's 22E, Fig. 441-3)",{x:0.25,y:0.2,w:9.5,h:0.65,fontSize:21,bold:true,color:C.wh,fontFace:"Calibri"});
const panels=[
{idx:3,lab:"FIG 441-3A PET — POSTERIOR HYPOTHALAMIC ACTIVATION",
sub:"Real patient during acute cluster headache attack\nHypothalamic 'clock' activation (May et al, Lancet 1998)",col:"FF6B6B"},
{idx:4,lab:"FIG 441-3B MRI VOXEL-BASED MORPHOMETRY",
sub:"Increased gray matter, lateralised to pain side\nStructural brain change in cluster headache patients",col:C.gd},
{idx:5,lab:"FIG 441-3 AXIAL MRI — HYPOTHALAMIC LATERALISATION",
sub:"Crosshair on activated hypothalamus\nDemonstrates strictly unilateral involvement",col:C.sky},
];
panels.forEach((p,i)=>{
const x=0.22+i*3.26;
sl.addShape(pres.ShapeType.rect,{x,y:1.08,w:3.08,h:3.2,fill:{type:"solid",color:"150808"},line:{color:p.col,width:1.5}});
if(ok(p.idx)) sl.addImage({data:imgs[p.idx].base64,x:x+0.07,y:1.15,w:2.94,h:2.94});
sl.addText(p.lab,{x,y:4.33,w:3.08,h:0.48,fontSize:10,bold:true,color:p.col,align:"center",fontFace:"Calibri"});
sl.addText(p.sub,{x,y:4.84,w:3.08,h:0.5,fontSize:9,color:"C09090",italic:true,align:"center",fontFace:"Calibri"});
});
}
// ════════════════════════════════════════════════════════════
// SLIDE 10 – TENSION-TYPE & OTHER PRIMARY HEADACHES
// ════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:5.625,fill:{type:"solid",color:C.wh}});
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:1.05,fill:{type:"solid",color:C.n3}});
sl.addShape(pres.ShapeType.rect,{x:0,y:1.05,w:0.1,h:4.575,fill:{type:"solid",color:C.gr}});
sl.addText("TENSION-TYPE & OTHER PRIMARY HEADACHES",{x:0.28,y:0.22,w:9.5,h:0.62,fontSize:24,bold:true,color:C.wh,fontFace:"Calibri"});
const cards=[
{t:"Tension-Type (TTH)",c:C.bl,items:[
"Bilateral, pressing/tightening","Mild–moderate, NON-pulsating",
"No aggravation by routine activity","Photo OR phono — NOT both",
"Rx: NSAIDs, amitriptyline, biofeedback",
]},
{t:"Hypnic Headache",c:C.pr,items:[
"Wakes from sleep — 'alarm clock'","Usually bilateral, mild–moderate",
"Age >50 yrs predominantly","No autonomic features",
"Rx: Caffeine at bedtime, lithium, melatonin",
]},
{t:"Primary Sex / Cough / Exercise",c:C.gr,items:[
"Sex: explosive bilateral at orgasm","Always exclude SAH (thunderclap)",
"Cough: bilateral, Valsalva-triggered","Exercise: during/after exertion",
"Rx: Indomethacin, propranolol",
]},
];
cards.forEach((card,i)=>{
const x=0.22+i*3.26;
sl.addShape(pres.ShapeType.rect,{x,y:1.12,w:3.08,h:0.46,fill:{type:"solid",color:card.c},line:{color:card.c}});
sl.addText(card.t,{x,y:1.14,w:3.08,h:0.42,fontSize:13,bold:true,color:C.wh,align:"center",fontFace:"Calibri"});
card.items.forEach((item,ii)=>{
const y=1.64+ii*0.78;
sl.addShape(pres.ShapeType.rect,{x,y,w:3.08,h:0.72,fill:{type:"solid",color:ii%2===0?C.l1:C.wh},line:{color:C.l2,width:0.5}});
sl.addText(`• ${item}`,{x:x+0.1,y:y+0.04,w:2.88,h:0.64,fontSize:12.5,color:C.tx,fontFace:"Calibri",valign:"middle"});
});
});
}
// ════════════════════════════════════════════════════════════
// SLIDE 11 – RED FLAGS
// ════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:5.625,fill:{type:"solid",color:"0C0606"}});
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:1.05,fill:{type:"solid",color:C.rd}});
sl.addText("⚠ RED FLAGS — WHEN HEADACHE IS DANGEROUS",{x:0.25,y:0.22,w:9.5,h:0.62,fontSize:24,bold:true,color:C.wh,fontFace:"Calibri"});
const flags=[
{i:"⚡",t:"Thunderclap Onset",d:"Worst-ever headache, peak <60 sec → SAH until proven otherwise; CT head STAT + LP"},
{i:"🤒",t:"Fever + Neck Stiffness",d:"Kernig / Brudzinski signs → Meningitis / encephalitis; blood cultures then IV antibiotics NOW"},
{i:"🧠",t:"New Neurological Deficit",d:"Focal weakness, diplopia, aphasia → stroke, AVM, subdural haematoma, mass lesion"},
{i:"👁",t:"Papilledema",d:"Raised ICP → tumour, CVT, idiopathic intracranial hypertension; urgent MRI + LP"},
{i:"📈",t:"Progressive Worsening",d:"Weeks of worsening → subdural haematoma, cerebral venous thrombosis, malignancy"},
{i:"👴",t:"New Headache Age >50",d:"Giant cell arteritis (GCA): check ESR/CRP; temporal artery biopsy; start steroids urgently"},
{i:"🦠",t:"Immunocompromised",d:"HIV/steroids → Cryptococcal meningitis, toxoplasma, TB meningitis, CNS lymphoma"},
{i:"🤰",t:"Pregnancy / Postpartum",d:"PRES, cerebral venous thrombosis, eclampsia, cavernous sinus thrombosis — urgent neurology"},
];
flags.forEach((f,i)=>{
const col=i%2; const row=Math.floor(i/2);
const x=0.22+col*4.9; const y=1.12+row*1.08;
sl.addShape(pres.ShapeType.rect,{x,y,w:4.65,h:0.98,fill:{type:"solid",color:"1A0606"},line:{color:C.rd,width:1}});
sl.addText(`${f.i} ${f.t}`,{x:x+0.1,y:y+0.04,w:4.45,h:0.36,fontSize:13.5,bold:true,color:"FF6B6B",fontFace:"Calibri"});
sl.addText(f.d,{x:x+0.1,y:y+0.44,w:4.45,h:0.48,fontSize:11.5,color:"FFBBBB",fontFace:"Calibri",valign:"top"});
});
}
// ════════════════════════════════════════════════════════════
// SLIDE 12 – ACUTE TREATMENT OF MIGRAINE
// ════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:5.625,fill:{type:"solid",color:C.l1}});
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:1.05,fill:{type:"solid",color:C.n2}});
sl.addShape(pres.ShapeType.rect,{x:0,y:1.05,w:0.1,h:4.575,fill:{type:"solid",color:C.bl}});
sl.addText("ACUTE TREATMENT OF MIGRAINE",{x:0.28,y:0.22,w:9.5,h:0.62,fontSize:24,bold:true,color:C.wh,fontFace:"Calibri"});
const drugs=[
{class:"Simple Analgesics",drug:"Acetaminophen / Aspirin / Caffeine",note:"FDA approved for mild–moderate migraine; combination (Excedrin) most effective",c:C.gr},
{class:"NSAIDs",drug:"Naproxen 500 mg | Ibuprofen 400 mg | Diclofenac K",note:"Best when taken EARLY in attack; most effective for mild–moderate",c:C.gr},
{class:"Triptans (5-HT1B/1D)",drug:"Sumatriptan, Rizatriptan, Zolmitriptan, Eletriptan",note:"First-line for moderate–severe; oral, SC, IN, transdermal forms; 50–70% response",c:C.bl},
{class:"Ditans (5-HT1F)",drug:"Lasmiditan 50–200 mg",note:"Neural target only — NO vasoconstriction; safe in CV disease; CNS side effects",c:C.pr},
{class:"Gepants (CGRP antagonists)",drug:"Ubrogepant 50–100 mg | Rimegepant 75 mg",note:"No vasoconstriction; can re-dose at 2 h (unlike triptans); also usable preventively",c:"F97316"},
{class:"Antiemetics / Dopamine antagonists",drug:"Metoclopramide 10 mg | Prochlorperazine 10 mg",note:"Restore GI motility, reduce nausea, augment analgesic absorption",c:C.gd},
{class:"Ergotamines",drug:"DHE 1 mg IV / IM / SC | Nasal DHE spray",note:"Refractory migraine & status migrainosus; contraindicated with triptans",c:C.rd},
];
drugs.forEach((d,i)=>{
const y=1.15+i*0.635;
sl.addShape(pres.ShapeType.rect,{x:0.22,y,w:2.1,h:0.58,fill:{type:"solid",color:d.c},line:{color:d.c}});
sl.addText(d.class,{x:0.22,y:y+0.02,w:2.1,h:0.54,fontSize:11,bold:true,color:C.wh,align:"center",fontFace:"Calibri",valign:"middle"});
sl.addShape(pres.ShapeType.rect,{x:2.38,y,w:7.4,h:0.58,fill:{type:"solid",color:i%2===0?C.wh:"F0F4FA"},line:{color:C.l2,width:0.5}});
sl.addText(d.drug,{x:2.48,y:y+0.02,w:7.2,h:0.25,fontSize:12,bold:true,color:d.c,fontFace:"Calibri"});
sl.addText(d.note,{x:2.48,y:y+0.29,w:7.2,h:0.25,fontSize:11,color:C.tm,fontFace:"Calibri"});
});
}
// ════════════════════════════════════════════════════════════
// SLIDE 13 – PREVENTIVE TREATMENT
// ════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:5.625,fill:{type:"solid",color:C.wh}});
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:1.05,fill:{type:"solid",color:C.n3}});
sl.addShape(pres.ShapeType.rect,{x:0,y:1.05,w:0.1,h:4.575,fill:{type:"solid",color:C.gd}});
sl.addText("PREVENTIVE TREATMENT OF MIGRAINE",{x:0.28,y:0.22,w:9.5,h:0.62,fontSize:24,bold:true,color:C.wh,fontFace:"Calibri"});
sl.addText("Consider when: ≥4 migraine days/month OR attacks unresponsive to acute Rx",{x:0.28,y:1.1,w:9.5,h:0.3,fontSize:13,italic:true,color:C.tm,fontFace:"Calibri"});
const drugs=[
{c:C.bl, cat:"Beta-blockers", drug:"Propranolol 40–120 mg bid | Metoprolol 25–100 mg bid",side:"Fatigue, hypotension, contraindicated in asthma",evid:"Grade A"},
{c:C.bl, cat:"Antidepressants", drug:"Amitriptyline 10–75 mg nocte | Nortriptyline",side:"Drowsiness, weight gain, dry mouth",evid:"Grade A"},
{c:C.bl, cat:"Anticonvulsants", drug:"Topiramate 25–100 mg | Valproate 400–600 mg",side:"Cognitive slowing; teratogenic — AVOID in pregnancy/women of reproductive age",evid:"Grade A"},
{c:"F97316",cat:"CGRP Antagonists",drug:"Atogepant 10–60 mg/d | Rimegepant 75 mg eod",side:"Nausea, constipation; avoid in severe hepatic impairment",evid:"Grade A"},
{c:C.gd, cat:"CGRP Monoclonal Abs",drug:"Erenumab 70/140 mg SC | Fremanezumab | Galcanezumab",side:"Injection site reaction; constipation; excellent tolerability overall",evid:"Grade A"},
{c:C.pr, cat:"Botulinum Toxin A",drug:"onabotulinumtoxinA 155–195 U IM (PREEMPT protocol)",side:"Neck pain, injection site reaction",evid:"Chronic migraine only (≥15 days/month)"},
{c:C.gr, cat:"Neuromodulation", drug:"sTMS | nVNS | Transcutaneous supraorbital stimulation",side:"Minimal; FDA cleared; good option for drug-intolerant patients",evid:"FDA cleared"},
];
drugs.forEach((d,i)=>{
const y=1.48+i*0.6;
sl.addShape(pres.ShapeType.rect,{x:0.22,y,w:1.9,h:0.54,fill:{type:"solid",color:d.c},line:{color:d.c}});
sl.addText(d.cat,{x:0.22,y:y+0.02,w:1.9,h:0.5,fontSize:11,bold:true,color:C.wh,align:"center",fontFace:"Calibri",valign:"middle"});
sl.addShape(pres.ShapeType.rect,{x:2.18,y,w:5.9,h:0.54,fill:{type:"solid",color:i%2===0?C.l1:C.wh},line:{color:C.l2,width:0.5}});
sl.addText(d.drug,{x:2.28,y:y+0.02,w:5.7,h:0.24,fontSize:12,bold:true,color:d.c,fontFace:"Calibri"});
sl.addText(d.side,{x:2.28,y:y+0.28,w:5.7,h:0.22,fontSize:10.5,color:C.tm,fontFace:"Calibri"});
sl.addShape(pres.ShapeType.rect,{x:8.14,y,w:1.65,h:0.54,fill:{type:"solid",color:d.c},line:{color:d.c},transparency:60});
sl.addText(d.evid,{x:8.14,y:y+0.02,w:1.65,h:0.5,fontSize:11,bold:true,color:C.tx,align:"center",fontFace:"Calibri",valign:"middle"});
});
}
// ════════════════════════════════════════════════════════════
// SLIDE 14 – MIDAS + CHRONIC MIGRAINE
// ════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:5.625,fill:{type:"solid",color:C.wh}});
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:1.05,fill:{type:"solid",color:C.n4}});
sl.addShape(pres.ShapeType.rect,{x:0,y:1.05,w:0.1,h:4.575,fill:{type:"solid",color:C.am}});
sl.addText("MIDAS SCORE & CHRONIC MIGRAINE",{x:0.28,y:0.22,w:9.5,h:0.62,fontSize:24,bold:true,color:C.wh,fontFace:"Calibri"});
// Left: MIDAS
sl.addShape(pres.ShapeType.rect,{x:0.22,y:1.15,w:5.6,h:0.35,fill:{type:"solid",color:C.n3},line:{color:C.n3}});
sl.addText("MIDAS — Migraine Disability Assessment Score (past 3 months)",{x:0.28,y:1.17,w:5.54,h:0.3,fontSize:12.5,bold:true,color:C.wh,fontFace:"Calibri"});
const qs=[
"Q1. Days missed WORK or school due to headache?",
"Q2. Days productivity at work REDUCED BY ≥50%?",
"Q3. Days NOT doing HOUSEHOLD work?",
"Q4. Days household productivity REDUCED BY ≥50%?",
"Q5. Days missed SOCIAL or leisure activities?",
];
qs.forEach((q,i)=>{
const y=1.55+i*0.46;
sl.addShape(pres.ShapeType.rect,{x:0.22,y,w:4.7,h:0.4,fill:{type:"solid",color:i%2===0?C.l1:C.wh},line:{color:C.l2,width:0.5}});
sl.addText(q,{x:0.3,y:y+0.03,w:4.5,h:0.34,fontSize:12.5,color:C.tx,fontFace:"Calibri"});
sl.addShape(pres.ShapeType.rect,{x:4.98,y,w:0.84,h:0.4,fill:{type:"solid",color:C.l2},line:{color:C.bl,width:1}});
sl.addText("___ d",{x:4.98,y:y+0.03,w:0.84,h:0.34,fontSize:12,color:C.bl,align:"center",fontFace:"Calibri"});
});
// MIDAS grades
const grades=[
{g:"I",s:"0–5",l:"Minimal",c:C.gr},
{g:"II",s:"6–10",l:"Mild",c:C.gd},
{g:"III",s:"11–20",l:"Moderate",c:"F97316"},
{g:"IV",s:">20",l:"Severe",c:C.rd},
];
sl.addText("Score total of Q1–Q5:",{x:0.28,y:4.0,w:5.54,h:0.3,fontSize:12,bold:true,color:C.tx,fontFace:"Calibri"});
grades.forEach((g,i)=>{
const x=0.28+i*1.4;
sl.addShape(pres.ShapeType.rect,{x,y:4.35,w:1.35,h:0.85,fill:{type:"solid",color:g.c},line:{color:g.c}});
sl.addText(`Grade ${g.g}\n${g.s}\n${g.l}`,{x,y:4.38,w:1.35,h:0.8,fontSize:11,bold:true,color:C.wh,align:"center",fontFace:"Calibri"});
});
// Right: Chronic migraine
sl.addShape(pres.ShapeType.rect,{x:6.05,y:1.15,w:3.75,h:4.15,fill:{type:"solid",color:C.n1},line:{color:C.am,width:1.2}});
sl.addShape(pres.ShapeType.rect,{x:6.05,y:1.15,w:3.75,h:0.42,fill:{type:"solid",color:C.am},line:{color:C.am}});
sl.addText("CHRONIC MIGRAINE",{x:6.05,y:1.17,w:3.75,h:0.38,fontSize:13,bold:true,color:C.n1,align:"center",fontFace:"Calibri"});
const cmPts=[
"Defined as ≥15 headache days/month for >3 months",
"Of which ≥8 fulfill migraine criteria",
"High burden: depression, anxiety, sleep disorders",
"Medication-overuse headache (MOH) common",
"→ Overuse of acute meds ≥10–15 days/month",
"Onabotulinumtoxin A (PREEMPT) FDA approved",
"CGRP mAbs highly effective in chronic migraine",
"Withdraw overused medication; supervised detox",
];
cmPts.forEach((p,i)=>{
const y=1.65+i*0.45;
sl.addText(`• ${p}`,{x:6.15,y,w:3.55,h:0.42,fontSize:11.5,color:C.l1,fontFace:"Calibri",valign:"middle"});
});
}
// ════════════════════════════════════════════════════════════
// SLIDE 15 – SUMMARY + BRAIN SCAN MONTAGE
// ════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:5.625,fill:{type:"solid",color:C.n1}});
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:0.15,h:5.625,fill:{type:"solid",color:C.gd}});
sl.addShape(pres.ShapeType.rect,{x:9.85,y:0,w:0.15,h:5.625,fill:{type:"solid",color:C.gd}});
sl.addShape(pres.ShapeType.rect,{x:0.15,y:0,w:9.7,h:0.06,fill:{type:"solid",color:C.gd}});
sl.addText("KEY TAKEAWAYS",{x:0.4,y:0.2,w:9.2,h:0.7,fontSize:30,bold:true,color:C.wh,align:"center",fontFace:"Calibri"});
sl.addShape(pres.ShapeType.line,{x:0.8,y:0.98,w:8.4,h:0,line:{color:C.gd,width:2.5}});
// Left points
const pts=[
"Migraine is a CNS sensitivity disorder — neurological, not psychosomatic",
"Trigeminovascular CGRP signalling is the core mechanism; gepants & mAbs target it",
"PET/MRI in real patients show hypothalamic activation in prodrome, pontine in attack",
"Cluster headache: ipsilateral autonomic features + circadian pattern are diagnostic",
"ALWAYS investigate new thunderclap headache — SAH until proven otherwise",
"CGRP monoclonal antibodies changed preventive treatment; excellent efficacy & tolerance",
"Use MIDAS to quantify disability; assess need for preventive therapy at ≥4 days/month",
"Medication overuse headache is common — warn patients about rebound headache risk",
];
pts.forEach((p,i)=>{
const y=1.1+i*0.55;
sl.addShape(pres.ShapeType.ellipse,{x:0.32,y:y+0.03,w:0.32,h:0.32,fill:{type:"solid",color:C.gd},line:{color:C.gd}});
sl.addText(`${i+1}`,{x:0.33,y:y+0.04,w:0.3,h:0.3,fontSize:12,bold:true,color:C.n1,align:"center",fontFace:"Calibri"});
sl.addText(p,{x:0.72,y:y+0.03,w:6.0,h:0.36,fontSize:13,color:C.l1,fontFace:"Calibri",valign:"middle"});
});
// Right: 3 real scan thumbnails stacked
const scans=[
{idx:1,y:1.08,cap:"PET — migraine premonitory (Fig441-2A)"},
{idx:3,y:2.72,cap:"PET — cluster headache (Fig441-3A)"},
{idx:4,y:4.36,cap:"MRI voxel-morphometry cluster (Fig441-3B)"},
];
scans.forEach(s=>{
sl.addShape(pres.ShapeType.rect,{x:6.9,y:s.y,w:2.85,h:1.46,fill:{type:"solid",color:C.n2},line:{color:C.lb,width:1}});
if(ok(s.idx)) sl.addImage({data:imgs[s.idx].base64,x:6.95,y:s.y+0.05,w:2.75,h:1.2});
sl.addText(s.cap,{x:6.9,y:s.y+1.28,w:2.85,h:0.22,fontSize:8.5,color:"6090C0",italic:true,align:"center",fontFace:"Calibri"});
});
sl.addText("Source: Harrison's Principles of Internal Medicine, 22E (2025) — Chapter 441, pp. 3505–3524",{
x:0.4,y:5.45,w:9.2,h:0.15,fontSize:8.5,color:"404E6A",align:"center",fontFace:"Calibri"});
}
// ─── Write ───────────────────────────────────────────────────
const OUT="/home/daytona/workspace/headache-pptx/Headache_15Slides_Harrison22E.pptx";
pres.writeFile({fileName:OUT})
.then(()=>console.log("✅ DONE:", OUT))
.catch(e=>{console.error("❌", e); process.exit(1);});
cd /home/daytona/workspace/headache-pptx && node headache_15.js 2>&1
Headache 15Slides Harrison22E
Presentation · PPTX
| # | Slide Title | Real Patient Images |
|---|---|---|
| 1 | Title — dark navy with brain scan backdrop | Fig 441-2C (patient MRI) |
| 2 | Epidemiology & Global Burden — 4 stat cards + 6 key facts | — |
| 3 | Classification — full ICHD-3 primary vs secondary table (12 each) | — |
| 4 | Migraine Overview — features + ICHD-3 diagnostic criteria box | — |
| 5 | Migraine Aura — 6 aura types (visual, sensory, motor, brainstem, language, acephalgic) | — |
| 6 | Migraine Pathophysiology — CGRP, serotonin, dopamine, CSD, ion channels | Fig 441-1 (brainstem/TCC diagram) |
| 7 | Real Human Brain Scans — MIGRAINE | PET premonitory (Fig441-2A) + MRI acute attack (Fig441-2C) |
| 8 | Cluster Headache — all features + brain scan inset + acute/preventive Rx | Fig 441-3A (PET cluster) |
| 9 | Real Human Brain Scans — CLUSTER | PET hypothalamic (Fig441-3A) + MRI morphometry (Fig441-3B) + Axial MRI (Fig441-3) |
| 10 | Tension-Type & Other Primary Headaches — TTH, Hypnic, Sex/Cough/Exercise | — |
| 11 | Red Flags — 8 dangerous warning signs with diagnoses | — |
| 12 | Acute Treatment — 7 drug classes with doses and notes | — |
| 13 | Preventive Treatment — 7 classes with evidence grades + side effects | — |
| 14 | MIDAS Score & Chronic Migraine — full questionnaire + grading + chronic migraine panel | — |
| 15 | Key Takeaways — 8 points + 3-scan patient brain montage | Fig441-2A + Fig441-3A + Fig441-3B |
Make presentation on headache with erroa
~/headache-pptx/headache_aura.js
const pptxgen = require("pptxgenjs");
const { execSync } = require("child_process");
// Real human patient images from Harrison's 22E, Chapter 441
const IMG_URLS = [
"https://cdn.orris.care/cdss_images/d79ad64919bbe2ea795ad5ac016dd5773e6dfee05124af733fdb3c1c617c6b44.png", // 0 – Fig441-1 brainstem diagram
"https://cdn.orris.care/cdss_images/2368f7d8c41bc8125ec2646b2f3ad36134124003937b29563f6359eb7d1a486d.png", // 1 – Fig441-2A PET premonitory migraine
"https://cdn.orris.care/cdss_images/58474695b1dd120a63533ae3bf934d4da98095a45ec1c2b9c8bb527e3907dc0c.png", // 2 – Fig441-2C axial MRI migraine
"https://cdn.orris.care/cdss_images/c1d257d24c306a8fe0c9a3bf316e52e4fb6da52a82036b10bdfab0ca73510f61.png", // 3 – Fig441-3A PET cluster headache
"https://cdn.orris.care/cdss_images/3894cbb90f45bffcb5bb6905f9e9c27a2576b55ec7760ba04d371f7b5d16e0ba.png", // 4 – Fig441-3B MRI cluster voxel
"https://cdn.orris.care/cdss_images/29986bd7a497b5973ac7b037e8052027613f080253fc5cfc762bfae4cfa4aeec.png", // 5 – Fig441-3 axial MRI cluster
"https://cdn.orris.care/cdss_images/a6abf2f34c2727a95599b6683c26a7f809dd22ef5d260197bf0e4de8774b9a94.png", // 6 – Fig441-3B sagittal cluster
];
console.log("Fetching Harrison's patient images…");
let imgs = [];
try {
const raw = execSync(
`node /home/daytona/skills/shared/scripts/fetch_images.js ${IMG_URLS.map(u=>`"${u}"`).join(" ")}`,
{ maxBuffer: 120*1024*1024, timeout: 90000 }
).toString();
imgs = JSON.parse(raw);
imgs.forEach((m,i) => console.log(` [${i}] ${m.error ? "ERR: "+m.error : "OK"}`));
} catch(e) {
console.error("Fetch error:", e.message);
imgs = IMG_URLS.map(u => ({url:u, base64:null, error:e.message}));
}
const ok = i => imgs[i] && !imgs[i].error && imgs[i].base64;
// ────── PALETTE ─────────────────────────────────────────────
const P = {
n1:"030A18", n2:"0A1830", n3:"0F2248", n4:"1A3464",
v1:"3B1F6E", v2:"5B3A9E", // violet (aura colour)
bl:"2563EB", lb:"3B82F6",
gd:"F59E0B", am:"FCD34D",
rd:"DC2626", gr:"059669", cy:"0891B2",
wh:"FFFFFF", l1:"EEF2FA", l2:"DDE4F2",
tx:"1A2540", tm:"3A5070",
};
const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Headache with Aura – Harrison's 22E (2025)";
// ── helpers ──────────────────────────────────────────────────
const addImg = (sl, idx, x, y, w, h) => {
sl.addShape(pres.ShapeType.rect, {x, y, w, h, fill:{type:"solid",color:P.n2}, line:{color:P.lb,width:1.5}});
if (ok(idx)) sl.addImage({data:imgs[idx].base64, x:x+0.06, y:y+0.06, w:w-0.12, h:h-0.12});
else sl.addText("[img unavailable]",{x,y:y+h/2-0.15,w,h:0.3,fontSize:10,color:"888",align:"center",fontFace:"Calibri"});
};
const cap = (sl, text, x, y, w, col=P.tm) =>
sl.addText(text, {x, y, w, h:0.32, fontSize:9.5, italic:true, color:col, align:"center", fontFace:"Calibri"});
// ════════════════════════════════════════════════════════════
// SLIDE 1 – TITLE
// ════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:5.625,fill:{type:"solid",color:P.n1}});
// right panel – MRI brain scan backdrop
if(ok(2)){
sl.addImage({data:imgs[2].base64, x:5.6,y:0,w:4.4,h:5.625, sizing:{type:"cover",w:4.4,h:5.625}});
sl.addShape(pres.ShapeType.rect,{x:5.6,y:0,w:4.4,h:5.625,fill:{type:"solid",color:P.n1},transparency:42});
}
// left violet accent bar
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:0.18,h:5.625,fill:{type:"solid",color:P.v2}});
sl.addShape(pres.ShapeType.rect,{x:0.18,y:0,w:9.82,h:0.06,fill:{type:"solid",color:P.gd}});
sl.addText("HEADACHE", {x:0.45,y:0.65,w:5.8,h:0.9,fontSize:50,bold:true,color:P.wh,fontFace:"Calibri",charSpacing:3});
sl.addText("WITH AURA", {x:0.45,y:1.52,w:5.8,h:0.9,fontSize:50,bold:true,color:P.am,fontFace:"Calibri",charSpacing:3});
sl.addShape(pres.ShapeType.line,{x:0.45,y:2.55,w:5.6,h:0,line:{color:P.gd,width:2.5}});
sl.addText("Migraine Aura — Types, Mechanisms & Management",{x:0.45,y:2.72,w:5.6,h:0.5,fontSize:18,color:P.lb,italic:true,fontFace:"Calibri"});
sl.addText("Harrison's Principles of Internal Medicine\n22nd Edition — 2025 | Chapter 441, pp. 3505–3524",{x:0.45,y:3.38,w:5.6,h:0.75,fontSize:13,color:"8AAAD0",fontFace:"Calibri"});
sl.addShape(pres.ShapeType.rect,{x:0.45,y:4.3,w:3.5,h:0.55,fill:{type:"solid",color:P.v1},line:{color:P.v2}});
sl.addText("NEUROLOGY | HARRISON'S 22E | AURA",{x:0.45,y:4.32,w:3.5,h:0.5,fontSize:11.5,bold:true,color:P.wh,align:"center",fontFace:"Calibri"});
}
// ════════════════════════════════════════════════════════════
// SLIDE 2 – WHAT IS MIGRAINE AURA?
// ════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:5.625,fill:{type:"solid",color:P.l1}});
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:1.05,fill:{type:"solid",color:P.v1}});
sl.addShape(pres.ShapeType.rect,{x:0,y:1.05,w:0.1,h:4.575,fill:{type:"solid",color:P.v2}});
sl.addText("WHAT IS MIGRAINE AURA?",{x:0.28,y:0.22,w:9.5,h:0.6,fontSize:25,bold:true,color:P.wh,fontFace:"Calibri"});
const defPts = [
"Aura = transient focal neurological disturbance preceding or accompanying migraine headache",
"Present in only 20–25% of migraineurs — but highly specific when it occurs",
"Develops gradually over 5–20 minutes (key feature — distinguishes it from TIA/stroke)",
"Duration: typically 20–60 minutes; each feature may follow another sequentially",
"Can occur WITHOUT headache — called 'acephalgic migraine' or 'typical aura without headache'",
"ICHD-3 requires: ≥1 fully reversible aura symptom + gradual spread over ≥5 min + lasts 5–60 min",
"Visual aura is most common; other types include sensory, language, motor, brainstem, retinal",
"Must distinguish from TIA: age, risk factors, abrupt vs gradual onset, positive vs negative phenomena",
];
defPts.forEach((p,i)=>{
const y=1.18+i*0.54;
sl.addShape(pres.ShapeType.rect,{x:0.25,y,w:9.52,h:0.48,fill:{type:"solid",color:i%2===0?P.wh:P.l2},line:{color:P.l2,width:0.4}});
sl.addShape(pres.ShapeType.rect,{x:0.25,y,w:0.46,h:0.48,fill:{type:"solid",color:P.v1},line:{color:P.v1}});
sl.addText(`${i+1}`,{x:0.26,y:y+0.02,w:0.44,h:0.44,fontSize:13,bold:true,color:P.wh,align:"center",fontFace:"Calibri"});
sl.addText(p,{x:0.78,y:y+0.04,w:8.9,h:0.4,fontSize:13,color:P.tx,fontFace:"Calibri",valign:"middle"});
});
}
// ════════════════════════════════════════════════════════════
// SLIDE 3 – TYPES OF AURA (ICHD-3)
// ════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:5.625,fill:{type:"solid",color:P.wh}});
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:1.05,fill:{type:"solid",color:P.n3}});
sl.addShape(pres.ShapeType.rect,{x:0,y:1.05,w:0.1,h:4.575,fill:{type:"solid",color:P.am}});
sl.addText("TYPES OF MIGRAINE AURA (ICHD-3 Classification)",{x:0.28,y:0.22,w:9.5,h:0.6,fontSize:24,bold:true,color:P.wh,fontFace:"Calibri"});
const types=[
{t:"Visual Aura",sub:"Most Common (~90% of aura)",c:P.bl,
items:["Scintillating scotoma — shimmering crescent of jagged lights","Fortification spectra — zigzag arc expanding from central vision",
"Homonymous visual symptoms (affects same side of visual field in both eyes)","Positive → negative phenomena (phosphenes then scotoma)",
"Builds over 5–20 min — classic slow march across visual cortex"]},
{t:"Sensory Aura",sub:"Second most common",c:P.v2,
items:["Paraesthesias: pins & needles in hand, spreading to face","Cheiro-oral distribution (hand → lips → tongue)",
"Positive (tingling) then negative (numbness) phenomena","Never crosses midline; strictly unilateral",
"Follows visual aura OR occurs alone"]},
{t:"Language / Dysphasia",sub:"Uncommon; alarming to patients",c:P.gr,
items:["Word-finding difficulty (anomia) most common","May include paraphasia or comprehension impairment",
"Usually brief (< 60 min); fully reversible","Can coexist with visual or sensory aura",
"Must distinguish from dominant hemisphere TIA"]},
{t:"Motor Aura",sub:"Hemiplegic migraine — rare",c:P.rd,
items:["Unilateral weakness lasting up to 72 h (MUCH longer than other auras)","Familial (FHM) or sporadic forms",
"FHM gene mutations: CACNA1A (FHM1), ATP1A2 (FHM2), SCN1A (FHM3)","Altered consciousness possible in severe FHM",
"Requires specialist management; avoid vasoconstrictors (triptans)"]},
];
types.forEach((tp,ti)=>{
const col=ti%2; const row=Math.floor(ti/2);
const x=0.22+col*4.9; const y=1.14+row*2.23;
sl.addShape(pres.ShapeType.rect,{x,y,w:4.55,h:0.5,fill:{type:"solid",color:tp.c},line:{color:tp.c}});
sl.addText(tp.t,{x:x+0.1,y:y+0.02,w:2.8,h:0.46,fontSize:14,bold:true,color:P.wh,fontFace:"Calibri",valign:"middle"});
sl.addText(tp.sub,{x:x+2.95,y:y+0.08,w:1.5,h:0.34,fontSize:10,color:"E8D8FF",italic:true,fontFace:"Calibri",align:"right"});
tp.items.forEach((item,ii)=>{
const iy=y+0.56+ii*0.33;
sl.addShape(pres.ShapeType.rect,{x,y:iy,w:4.55,h:0.3,fill:{type:"solid",color:ii%2===0?P.l1:P.wh},line:{color:P.l2,width:0.4}});
sl.addText(`• ${item}`,{x:x+0.1,y:iy+0.01,w:4.35,h:0.28,fontSize:11.5,color:P.tx,fontFace:"Calibri"});
});
});
}
// ════════════════════════════════════════════════════════════
// SLIDE 4 – BRAINSTEM & RETINAL AURA
// ════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:5.625,fill:{type:"solid",color:P.wh}});
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:1.05,fill:{type:"solid",color:P.n4}});
sl.addShape(pres.ShapeType.rect,{x:0,y:1.05,w:0.1,h:4.575,fill:{type:"solid",color:P.cy}});
sl.addText("BRAINSTEM AURA & RETINAL MIGRAINE",{x:0.28,y:0.22,w:9.5,h:0.6,fontSize:24,bold:true,color:P.wh,fontFace:"Calibri"});
// Left: Brainstem aura
sl.addShape(pres.ShapeType.rect,{x:0.22,y:1.12,w:4.55,h:0.44,fill:{type:"solid",color:P.cy},line:{color:P.cy}});
sl.addText("MIGRAINE WITH BRAINSTEM AURA (formerly 'basilar migraine')",{x:0.22,y:1.14,w:4.55,h:0.4,fontSize:12.5,bold:true,color:P.wh,align:"center",fontFace:"Calibri"});
const bsPts=[
["Previously called","Basilar artery migraine / basilar-type migraine — now replaced in ICHD-3"],
["Core feature","≥2 brainstem aura symptoms PLUS no motor weakness"],
["Dysarthria","Slurred speech — NOT dysphasia (key distinction)"],
["Vertigo","Often severe; explains why 1/3 of vertigo referrals = vestibular migraine"],
["Tinnitus","Ringing or buzzing; may be unilateral or bilateral"],
["Hypacusis","Reduced hearing acuity during attack"],
["Diplopia","Double vision — brainstem / oculomotor involvement"],
["Ataxia","Cerebellar; difficulty walking or coordinating"],
["Decreased consciousness","Seen in severe attacks; can mimic vertebrobasilar TIA"],
];
bsPts.forEach(([k,v],i)=>{
const y=1.62+i*0.43;
sl.addShape(pres.ShapeType.rect,{x:0.22,y,w:1.5,h:0.38,fill:{type:"solid",color:P.n3},line:{color:P.n3}});
sl.addText(k,{x:0.22,y:y+0.02,w:1.5,h:0.34,fontSize:11,bold:true,color:P.am,align:"center",fontFace:"Calibri"});
sl.addShape(pres.ShapeType.rect,{x:1.77,y,w:2.99,h:0.38,fill:{type:"solid",color:i%2===0?P.l1:P.wh},line:{color:P.l2,width:0.4}});
sl.addText(v,{x:1.87,y:y+0.02,w:2.79,h:0.34,fontSize:11.5,color:P.tx,fontFace:"Calibri",valign:"middle"});
});
// Right: Retinal migraine
sl.addShape(pres.ShapeType.rect,{x:5.0,y:1.12,w:4.75,h:0.44,fill:{type:"solid",color:P.rd},line:{color:P.rd}});
sl.addText("RETINAL MIGRAINE",{x:5.0,y:1.14,w:4.75,h:0.4,fontSize:13,bold:true,color:P.wh,align:"center",fontFace:"Calibri"});
const retPts=[
["Mechanism","Monocular visual symptoms (one eye only) — distinguish from homonymous visual aura"],
["Symptoms","Scintillations, scotoma, or total blindness in ONE eye"],
["Duration","Fully reversible; < 60 min"],
["Rare","Most transient monocular vision loss is NOT retinal migraine"],
["DDx","Amaurosis fugax (carotid disease), CRAO, optic neuritis"],
["Risk","Small increased risk of permanent monocular visual loss"],
["OCP warning","Combined oral contraceptives should be stopped"],
["Management","Calcium channel blockers preferred; avoid triptans / ergots"],
];
retPts.forEach(([k,v],i)=>{
const y=1.62+i*0.43;
sl.addShape(pres.ShapeType.rect,{x:5.0,y,w:1.4,h:0.38,fill:{type:"solid",color:"5B1010"},line:{color:"5B1010"}});
sl.addText(k,{x:5.0,y:y+0.02,w:1.4,h:0.34,fontSize:11,bold:true,color:P.am,align:"center",fontFace:"Calibri"});
sl.addShape(pres.ShapeType.rect,{x:6.45,y,w:3.32,h:0.38,fill:{type:"solid",color:i%2===0?P.l1:P.wh},line:{color:P.l2,width:0.4}});
sl.addText(v,{x:6.55,y:y+0.02,w:3.12,h:0.34,fontSize:11.5,color:P.tx,fontFace:"Calibri",valign:"middle"});
});
}
// ════════════════════════════════════════════════════════════
// SLIDE 5 – FOUR PHASES OF MIGRAINE + AURA TIMING
// ════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:5.625,fill:{type:"solid",color:P.wh}});
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:1.05,fill:{type:"solid",color:P.n3}});
sl.addShape(pres.ShapeType.rect,{x:0,y:1.05,w:0.1,h:4.575,fill:{type:"solid",color:P.gd}});
sl.addText("FOUR PHASES OF MIGRAINE — AURA IN CONTEXT",{x:0.28,y:0.22,w:9.5,h:0.6,fontSize:24,bold:true,color:P.wh,fontFace:"Calibri"});
const phases=[
{n:"PRODROME", dur:"Hours–days BEFORE", col:P.gr,
pts:["Mood changes (irritability, depression, euphoria)","Food cravings (especially chocolate, sweets)",
"Yawning, fatigue, cognitive slowing","Neck discomfort, polyuria","Photophobia may begin here — not just aura phase"]},
{n:"AURA", dur:"20–60 min (before/during headache)", col:P.v2,
pts:["Visual: fortification spectra, scintillating scotoma","Sensory: paraesthesias, cheiro-oral spread",
"Language: dysphasia, anomia","Motor: weakness (FHM only)","Brainstem: vertigo, diplopia, ataxia",
"Builds gradually ≥5 min; fully reversible"]},
{n:"HEADACHE", dur:"4–72 hours", col:P.rd,
pts:["Unilateral, pulsating, moderate–severe","Aggravated by routine physical activity",
"Nausea / vomiting common","Photophobia AND phonophobia","Allodynia: scalp tender to touch",
"ICHD-3: ≥5 attacks fulfilling criteria"]},
{n:"POSTDROME", dur:"Hours after headache", col:P.tm,
pts:["Tiredness and weariness (most common)","Concentration impairment",
"Mild neck discomfort","Mood changes: depression or euphoria","Can last up to 24 hours"]},
];
phases.forEach((ph,i)=>{
const x=0.22+i*2.4;
// Arrow connector (except last)
if(i<3) sl.addText("›",{x:x+2.4-0.12,y:2.2,w:0.24,h:0.4,fontSize:22,color:P.gd,align:"center"});
// Phase header
sl.addShape(pres.ShapeType.rect,{x,y:1.12,w:2.28,h:0.75,fill:{type:"solid",color:ph.col},line:{color:ph.col}});
sl.addText(ph.n,{x,y:1.14,w:2.28,h:0.4,fontSize:13.5,bold:true,color:P.wh,align:"center",fontFace:"Calibri"});
sl.addText(ph.dur,{x,y:1.54,w:2.28,h:0.3,fontSize:10,color:"E8F0FF",align:"center",fontFace:"Calibri",italic:true});
// Bullets below
ph.pts.forEach((p,ii)=>{
const y=1.95+ii*0.56;
sl.addShape(pres.ShapeType.rect,{x,y,w:2.28,h:0.5,fill:{type:"solid",color:ii%2===0?P.l1:P.wh},line:{color:P.l2,width:0.4}});
sl.addText(`• ${p}`,{x:x+0.08,y:y+0.03,w:2.12,h:0.44,fontSize:11,color:P.tx,fontFace:"Calibri",valign:"middle"});
});
// Aura phase gets special highlight
if(i===1){
sl.addShape(pres.ShapeType.rect,{x:x-0.04,y:1.08,w:2.36,h:4.4,fill:{type:"solid",color:P.v2},line:{color:P.am,width:2},transparency:85});
}
});
}
// ════════════════════════════════════════════════════════════
// SLIDE 6 – PATHOPHYSIOLOGY: CORTICAL SPREADING DEPRESSION
// ════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:5.625,fill:{type:"solid",color:P.n1}});
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:1.05,fill:{type:"solid",color:P.v1}});
sl.addText("PATHOPHYSIOLOGY — CORTICAL SPREADING DEPRESSION (CSD)",{x:0.28,y:0.22,w:9.5,h:0.6,fontSize:22,bold:true,color:P.wh,fontFace:"Calibri"});
// Left: CSD explanation
const csdRows=[
{h:"What is CSD?",c:P.am},
{b:"Definition: ",t:"A slowly propagating wave of neuronal and glial depolarisation, followed by prolonged suppression of neural activity"},
{b:"Speed: ",t:"Travels at 3–5 mm/min across the cortex — accounts for the gradual spread of aura symptoms"},
{b:"Direction: ",t:"Propagates from occipital cortex anteriorly → explains visual → sensory → language sequence"},
{h:"How CSD generates aura",c:P.am},
{b:"Positive symptoms (e.g., flashing lights): ",t:"caused by initial wave of neuronal depolarisation"},
{b:"Negative symptoms (e.g., scotoma): ",t:"caused by suppression of activity following the wave"},
{b:"Trigeminal activation: ",t:"CSD activates the trigeminal sensory system → triggers headache phase"},
{h:"Genetic basis of aura",c:P.am},
{b:"FHM1 — CACNA1A: ",t:"P/Q-type calcium channel subunit; increased CSD susceptibility"},
{b:"FHM2 — ATP1A2: ",t:"Na⁺/K⁺ ATPase α2-subunit; impairs glutamate clearance"},
{b:"FHM3 — SCN1A: ",t:"Na⁺ channel; increased neuronal excitability"},
{b:"Common migraine: ",t:"Polygenic; GWAS identifies TRPM8, LRP1, PRDM16 among others"},
];
let yy=1.12;
csdRows.forEach(r=>{
if(r.h){
sl.addText(r.h,{x:0.22,y:yy,w:5.5,h:0.3,fontSize:13,bold:true,color:r.c,fontFace:"Calibri"});
yy+=0.31;
} else {
sl.addText([{text:r.b,options:{bold:true,color:P.lb}},{text:r.t,options:{color:P.l1}}],
{x:0.22,y:yy,w:5.5,h:0.27,fontSize:11.5,fontFace:"Calibri",valign:"middle"});
yy+=0.28;
}
});
// Right: brain diagram
addImg(sl, 0, 5.9, 1.1, 3.85, 3.6);
cap(sl,"FIG 441-1 Brainstem trigeminovascular pathways\nHarrison's 22E — Ch.441, p.3508", 5.9, 4.74, 3.85, "7090B0");
}
// ════════════════════════════════════════════════════════════
// SLIDE 7 – REAL HUMAN BRAIN SCAN: MIGRAINE PREMONITORY
// ════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:5.625,fill:{type:"solid",color:"04060E"}});
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:1.05,fill:{type:"solid",color:P.n3}});
sl.addText("REAL HUMAN BRAIN SCAN — MIGRAINE PREMONITORY PHASE (Harrison's 22E, Fig. 441-2A)",{x:0.25,y:0.22,w:9.5,h:0.6,fontSize:20,bold:true,color:P.wh,fontFace:"Calibri"});
// Large central image
sl.addShape(pres.ShapeType.rect,{x:0.5,y:1.12,w:9.0,h:3.88,fill:{type:"solid",color:P.n2},line:{color:P.lb,width:2}});
if(ok(1)) sl.addImage({data:imgs[1].base64, x:0.6,y:1.2,w:8.8,h:3.6});
// Annotation labels
const annots=[
{t:"Hypothalamus",sx:2.2,sy:2.6,ex:3.5,ey:2.0,c:P.gd},
{t:"Dorsal Midbrain",sx:5.8,sy:3.2,ex:6.8,ey:2.4,c:P.am},
];
annots.forEach(a=>{
sl.addShape(pres.ShapeType.line,{x:a.sx,y:a.sy,w:a.ex-a.sx,h:a.ey-a.sy,line:{color:a.c,width:1.5}});
sl.addShape(pres.ShapeType.ellipse,{x:a.ex-0.08,y:a.ey-0.08,w:0.16,h:0.16,fill:{type:"solid",color:a.c},line:{color:a.c}});
sl.addText(a.t,{x:a.sx-0.8,y:a.sy-0.18,w:1.6,h:0.3,fontSize:11,bold:true,color:a.c,align:"center",fontFace:"Calibri"});
});
sl.addShape(pres.ShapeType.rect,{x:0.5,y:5.05,w:9.0,h:0.48,fill:{type:"solid",color:P.n2},line:{color:P.n2}});
sl.addText("FIG 441-2A — PET scan of a real patient in the premonitory phase of migraine (BEFORE headache onset). Orange/red areas show hypothalamic and dorsal midbrain activation.\n(Maniyar et al., Brain 137:200, 2014 — as reproduced in Harrison's 22E, p.3508)",
{x:0.6,y:5.07,w:8.8,h:0.44,fontSize:10,color:"8AAAD0",italic:true,align:"center",fontFace:"Calibri"});
}
// ════════════════════════════════════════════════════════════
// SLIDE 8 – REAL HUMAN BRAIN SCAN: ACUTE MIGRAINE ATTACK
// ════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:5.625,fill:{type:"solid",color:"04060E"}});
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:1.05,fill:{type:"solid",color:P.n3}});
sl.addText("REAL HUMAN BRAIN SCAN — ACUTE MIGRAINE ATTACK (Harrison's 22E, Fig. 441-2C)",{x:0.25,y:0.22,w:9.5,h:0.6,fontSize:20,bold:true,color:P.wh,fontFace:"Calibri"});
// Left: image
sl.addShape(pres.ShapeType.rect,{x:0.3,y:1.12,w:5.4,h:4.18,fill:{type:"solid",color:P.n2},line:{color:P.gd,width:2}});
if(ok(2)) sl.addImage({data:imgs[2].base64,x:0.4,y:1.2,w:5.2,h:3.85});
// Right: explanation
const rightPts=[
{h:"What this scan shows",c:P.gd},
{b:"Patient: ",t:"Real migraine patient with right-sided headache during an acute attack"},
{b:"Yellow regions: ",t:"Areas of increased neural activity shown on axial MRI/PET overlay"},
{b:"Dorsolateral pons: ",t:"Locus coeruleus region — activated on SAME SIDE as pain (right)"},
{b:"Key finding: ",t:"This pontine activation LATERALISES to the side of pain — explains unilateral headache"},
{h:"Clinical Significance",c:P.gd},
{b:"Brainstem drives migraine: ",t:"Not just a 'headache' — deep CNS structures are fundamentally involved"},
{b:"Pontine activation persists: ",t:"Even after acute treatment; explains recurrence and chronification"},
{b:"This is NOT aura: ",t:"Aura = cortical (CSD); these brainstem changes occur in attacks without aura too"},
{h:"Aura vs. Scan findings",c:P.gd},
{b:"Aura: ",t:"Generated by CSD in cerebral cortex (occipital/parietal/frontal)"},
{b:"Brainstem: ",t:"Modulates pain processing — activated in ALL migraine, with or without aura"},
];
let yy=1.12;
rightPts.forEach(r=>{
if(r.h){
sl.addText(r.h,{x:5.95,y:yy,w:3.85,h:0.28,fontSize:12.5,bold:true,color:r.c,fontFace:"Calibri"});
yy+=0.3;
} else {
sl.addText([{text:r.b,options:{bold:true,color:P.lb}},{text:r.t,options:{color:P.l1}}],
{x:5.95,y:yy,w:3.85,h:0.27,fontSize:11.5,fontFace:"Calibri",valign:"middle"});
yy+=0.28;
}
});
cap(sl,"Fig 441-2C — Afridi et al., Brain 128:532, 2005 (Harrison's 22E)", 0.3, 5.33, 5.4, "8A7040");
}
// ════════════════════════════════════════════════════════════
// SLIDE 9 – AURA vs. TIA / STROKE — DIFFERENTIAL DIAGNOSIS
// ════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:5.625,fill:{type:"solid",color:P.wh}});
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:1.05,fill:{type:"solid",color:"6B1A1A"}});
sl.addShape(pres.ShapeType.rect,{x:0,y:1.05,w:0.1,h:4.575,fill:{type:"solid",color:P.rd}});
sl.addText("DIFFERENTIAL DIAGNOSIS — AURA vs. TIA / STROKE / SEIZURE",{x:0.28,y:0.22,w:9.5,h:0.6,fontSize:22,bold:true,color:P.wh,fontFace:"Calibri"});
const headers=["Feature","Migraine Aura","TIA / Stroke","Focal Seizure"];
const rows=[
["Onset","Gradual (5–20 min)","ABRUPT (seconds)","Abrupt (seconds)"],
["Spread","Slow march across cortex","No march","Rapid Jacksonian march"],
["Phenomena","Positive THEN negative","Usually negative only","Positive (jerking, tingling)"],
["Duration","20–60 min (fully reversible)","<24 h (TIA) or permanent","Seconds–minutes"],
["Visual symptoms","Homonymous, scintillating","Homonymous, negative","Unilateral flickering"],
["Headache follows?","YES (in most cases)","Rare","No"],
["Age typical","Any age; prior history","Older; vascular risk factors","Any age; epilepsy hx"],
["Neuroimaging","Normal","DWI lesion (stroke) / normal (TIA)","Epileptiform discharges"],
["Key distinguisher","Gradual positive symptoms → headache","Abrupt, negative, risk factors","Motor jerking, postictal"],
];
const colW=[2.3,2.3,2.6,2.6];
const colX=[0.22,2.57,4.92,7.57];
const hcols=[P.n3,P.v1,"6B1A1A","204020"];
// Header row
headers.forEach((h,i)=>{
sl.addShape(pres.ShapeType.rect,{x:colX[i],y:1.12,w:colW[i],h:0.42,fill:{type:"solid",color:hcols[i]},line:{color:hcols[i]}});
sl.addText(h,{x:colX[i]+0.05,y:1.14,w:colW[i]-0.1,h:0.38,fontSize:12.5,bold:true,color:P.wh,align:"center",fontFace:"Calibri"});
});
rows.forEach((row,ri)=>{
row.forEach((cell,ci)=>{
const y=1.6+ri*0.43;
const bg = ci===0?P.n3 : (ri%2===0?P.l1:P.wh);
const tc = ci===0?P.am : P.tx;
sl.addShape(pres.ShapeType.rect,{x:colX[ci],y,w:colW[ci],h:0.38,fill:{type:"solid",color:bg},line:{color:P.l2,width:0.4}});
sl.addText(cell,{x:colX[ci]+0.06,y:y+0.02,w:colW[ci]-0.12,h:0.34,fontSize:11.5,bold:ci===0,color:tc,fontFace:"Calibri",valign:"middle"});
});
});
}
// ════════════════════════════════════════════════════════════
// SLIDE 10 – ACEPHALGIC MIGRAINE & SPECIAL SITUATIONS
// ════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:5.625,fill:{type:"solid",color:P.l1}});
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:1.05,fill:{type:"solid",color:P.n4}});
sl.addShape(pres.ShapeType.rect,{x:0,y:1.05,w:0.1,h:4.575,fill:{type:"solid",color:P.gr}});
sl.addText("ACEPHALGIC MIGRAINE & SPECIAL AURA SITUATIONS",{x:0.28,y:0.22,w:9.5,h:0.6,fontSize:23,bold:true,color:P.wh,fontFace:"Calibri"});
const cards=[
{t:"Acephalgic Migraine\n(Aura Without Headache)",c:P.v2,
pts:["Typical aura with little or no headache (ICHD-3: 1.2.1.2)",
"Recurrent neurological symptoms: visual, sensory, or language",
"Nausea/vomiting may still accompany aura",
"VERTIGO is common — 1 in 3 vertigo referrals = vestibular migraine",
"Can be misdiagnosed as TIA — especially in older patients ('late-onset migraine equivalents')",
"Management: treat as migraine; investigate once to exclude vascular cause"]},
{t:"Migraine Aura Status\n(Persistent Aura > 1 Hour)",c:P.rd,
pts:["Aura lasting >60 min but brain imaging normal = persistent aura without infarction",
"Migrainous infarction: aura lasting >60 min WITH DWI lesion on MRI",
"Rate: ~1.4 migrainous infarctions per 100,000 person-years",
"Risk factors: smoking, OCP use, prolonged aura, FHM",
"Requires urgent neuroimaging to exclude ischaemic stroke",
"Seek specialist neurological opinion"]},
{t:"Aura & Stroke Risk",c:P.gd,
pts:["Migraine with aura (not without aura) increases ischaemic stroke risk ~2-fold",
"OCP + migraine with aura = 8-fold ↑ stroke risk — CONTRAINDICATED",
"Smoking + migraine with aura = strong additive risk",
"Avoid vasoconstrictors (triptans, ergots) in FHM and prolonged motor aura",
"Use calcium channel blockers for prevention in these patients",
"Advise cessation of smoking; avoid combined OCP"]},
];
cards.forEach((card,i)=>{
const x=0.22+i*3.26;
sl.addShape(pres.ShapeType.rect,{x,y:1.12,w:3.08,h:0.56,fill:{type:"solid",color:card.c},line:{color:card.c}});
sl.addText(card.t,{x,y:1.14,w:3.08,h:0.52,fontSize:12,bold:true,color:P.wh,align:"center",fontFace:"Calibri",valign:"middle"});
card.pts.forEach((p,ii)=>{
const y=1.74+ii*0.62;
sl.addShape(pres.ShapeType.rect,{x,y,w:3.08,h:0.58,fill:{type:"solid",color:ii%2===0?P.wh:P.l2},line:{color:P.l2,width:0.4}});
sl.addText(`• ${p}`,{x:x+0.1,y:y+0.03,w:2.88,h:0.52,fontSize:11.5,color:P.tx,fontFace:"Calibri",valign:"middle"});
});
});
}
// ════════════════════════════════════════════════════════════
// SLIDE 11 – TREATMENT OF MIGRAINE WITH AURA
// ════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:5.625,fill:{type:"solid",color:P.wh}});
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:1.05,fill:{type:"solid",color:P.n2}});
sl.addShape(pres.ShapeType.rect,{x:0,y:1.05,w:0.1,h:4.575,fill:{type:"solid",color:P.bl}});
sl.addText("TREATMENT — MIGRAINE WITH AURA",{x:0.28,y:0.22,w:9.5,h:0.6,fontSize:24,bold:true,color:P.wh,fontFace:"Calibri"});
// Left: Acute
sl.addShape(pres.ShapeType.rect,{x:0.22,y:1.12,w:4.55,h:0.44,fill:{type:"solid",color:P.bl},line:{color:P.bl}});
sl.addText("ACUTE TREATMENT",{x:0.22,y:1.14,w:4.55,h:0.4,fontSize:13.5,bold:true,color:P.wh,align:"center",fontFace:"Calibri"});
const acute=[
{d:"Triptans",n:"Take at HEADACHE onset (not during aura) — evidence-based first-line; 50–70% response",c:P.bl},
{d:"NSAIDs / Aspirin",n:"Effective for mild–moderate attacks; take early; reduce prostaglandin-mediated sensitisation",c:P.gr},
{d:"Gepants (Ubrogepant / Rimegepant)",n:"CGRP antagonists; no vasoconstriction; SAFE in FHM and vascular disease",c:"F97316"},
{d:"Ditans (Lasmiditan)",n:"5-HT1F agonist; neural targets only; no vasoconstriction; safe in cardiovascular disease",c:P.v2},
{d:"Antiemetics",n:"Metoclopramide + restore gastric motility; prochlorperazine for severe nausea",c:P.cy},
];
acute.forEach((a,i)=>{
const y=1.62+i*0.72;
sl.addShape(pres.ShapeType.rect,{x:0.22,y,w:1.65,h:0.66,fill:{type:"solid",color:a.c},line:{color:a.c}});
sl.addText(a.d,{x:0.22,y:y+0.03,w:1.65,h:0.6,fontSize:11,bold:true,color:P.wh,align:"center",fontFace:"Calibri",valign:"middle"});
sl.addShape(pres.ShapeType.rect,{x:1.92,y,w:2.84,h:0.66,fill:{type:"solid",color:i%2===0?P.l1:P.wh},line:{color:P.l2,width:0.5}});
sl.addText(a.n,{x:2.02,y:y+0.03,w:2.64,h:0.6,fontSize:11.5,color:P.tx,fontFace:"Calibri",valign:"middle"});
});
// Right: Preventive
sl.addShape(pres.ShapeType.rect,{x:5.05,y:1.12,w:4.72,h:0.44,fill:{type:"solid",color:P.gd},line:{color:P.gd}});
sl.addText("PREVENTIVE TREATMENT",{x:5.05,y:1.14,w:4.72,h:0.4,fontSize:13.5,bold:true,color:P.n1,align:"center",fontFace:"Calibri"});
const prev=[
{d:"Beta-blockers",n:"Propranolol / metoprolol — Grade A; first-line; avoid in FHM (may worsen)"},
{d:"Amitriptyline",n:"TCA; also covers TTH comorbidity; 10–75 mg nocte"},
{d:"Topiramate",n:"Anticonvulsant; 25–100 mg/d; avoid in women of childbearing age"},
{d:"CGRP mAbs",n:"Erenumab, fremanezumab, galcanezumab — most effective; monthly SC injection"},
{d:"Gepants (oral preventive)",n:"Atogepant 10–60 mg/d; rimegepant 75 mg every other day"},
{d:"Ca²⁺ channel blockers",n:"Flunarizine / verapamil — preferred in FHM and retinal migraine"},
];
prev.forEach((p,i)=>{
const y=1.62+i*0.64;
sl.addShape(pres.ShapeType.rect,{x:5.05,y,w:1.5,h:0.58,fill:{type:"solid",color:P.n3},line:{color:P.n3}});
sl.addText(p.d,{x:5.05,y:y+0.02,w:1.5,h:0.54,fontSize:11,bold:true,color:P.am,align:"center",fontFace:"Calibri",valign:"middle"});
sl.addShape(pres.ShapeType.rect,{x:6.6,y,w:3.17,h:0.58,fill:{type:"solid",color:i%2===0?P.l1:P.wh},line:{color:P.l2,width:0.5}});
sl.addText(p.n,{x:6.7,y:y+0.03,w:2.97,h:0.52,fontSize:11.5,color:P.tx,fontFace:"Calibri",valign:"middle"});
});
// Warning box at bottom
sl.addShape(pres.ShapeType.rect,{x:0.22,y:5.28,w:9.56,h:0.25,fill:{type:"solid",color:"3B1010"},line:{color:P.rd,width:1}});
sl.addText("⚠ CAUTION: OCP is CONTRAINDICATED in migraine with aura (↑8× stroke risk). Advise non-oestrogen contraception.",
{x:0.32,y:5.3,w:9.36,h:0.21,fontSize:11,bold:true,color:"FF8888",fontFace:"Calibri"});
}
// ════════════════════════════════════════════════════════════
// SLIDE 12 – SUMMARY / KEY TAKEAWAYS + SCAN COLLAGE
// ════════════════════════════════════════════════════════════
{
const sl = pres.addSlide();
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:10,h:5.625,fill:{type:"solid",color:P.n1}});
sl.addShape(pres.ShapeType.rect,{x:0,y:0,w:0.15,h:5.625,fill:{type:"solid",color:P.v2}});
sl.addShape(pres.ShapeType.rect,{x:9.85,y:0,w:0.15,h:5.625,fill:{type:"solid",color:P.v2}});
sl.addShape(pres.ShapeType.rect,{x:0.15,y:0,w:9.7,h:0.06,fill:{type:"solid",color:P.gd}});
sl.addText("KEY TAKEAWAYS — HEADACHE WITH AURA",{x:0.4,y:0.18,w:9.2,h:0.7,fontSize:26,bold:true,color:P.wh,align:"center",fontFace:"Calibri"});
sl.addShape(pres.ShapeType.line,{x:0.8,y:0.96,w:8.4,h:0,line:{color:P.gd,width:2.5}});
const pts=[
"Aura affects only 20–25% of migraineurs — but is highly diagnostically specific",
"CSD (Cortical Spreading Depression) is the neurophysiological basis of aura — slow wave at 3–5 mm/min",
"Gradual build-up (≥5 min) is the key feature distinguishing aura from TIA (which is abrupt)",
"Positive then negative phenomena: scintillations → scotoma explains CSD wave propagation",
"FHM gene mutations (CACNA1A, ATP1A2, SCN1A) cause ion channel dysfunction — increased CSD susceptibility",
"Real patient PET/MRI: hypothalamic activation before pain; pontine activation during attack",
"OCP is CONTRAINDICATED in migraine with aura — 8× increased stroke risk",
"CGRP monoclonal antibodies and gepants are the most effective and well-tolerated preventives",
];
pts.forEach((p,i)=>{
const y=1.1+i*0.56;
sl.addShape(pres.ShapeType.ellipse,{x:0.3,y:y+0.03,w:0.34,h:0.34,fill:{type:"solid",color:P.gd},line:{color:P.gd}});
sl.addText(`${i+1}`,{x:0.31,y:y+0.04,w:0.32,h:0.3,fontSize:12,bold:true,color:P.n1,align:"center",fontFace:"Calibri"});
sl.addText(p,{x:0.73,y:y+0.03,w:5.95,h:0.38,fontSize:13,color:P.l1,fontFace:"Calibri",valign:"middle"});
});
// Right: scan montage
const scans=[{idx:1,y:1.08,cap:"PET – premonitory (Fig441-2A)"},{idx:2,y:2.78,cap:"MRI – acute attack (Fig441-2C)"},{idx:4,y:4.48,cap:"MRI cluster voxel (Fig441-3B)"}];
scans.forEach(s=>{
sl.addShape(pres.ShapeType.rect,{x:6.88,y:s.y,w:2.88,h:1.52,fill:{type:"solid",color:P.n2},line:{color:P.v2,width:1}});
if(ok(s.idx)) sl.addImage({data:imgs[s.idx].base64,x:6.94,y:s.y+0.06,w:2.76,h:1.24});
sl.addText(s.cap,{x:6.88,y:s.y+1.32,w:2.88,h:0.22,fontSize:8.5,color:"6080A0",italic:true,align:"center",fontFace:"Calibri"});
});
sl.addText("Source: Harrison's Principles of Internal Medicine, 22nd Edition (2025) — Chapter 441, pp. 3505–3524",
{x:0.4,y:5.44,w:9.2,h:0.16,fontSize:8.5,color:"404E6A",align:"center",fontFace:"Calibri"});
}
// ──── Write ─────────────────────────────────────────────────
const OUT = "/home/daytona/workspace/headache-pptx/Headache_with_Aura_Harrison22E.pptx";
pres.writeFile({fileName: OUT})
.then(()=>console.log("✅ DONE:", OUT))
.catch(e=>{console.error("❌", e); process.exit(1);});
cd /home/daytona/workspace/headache-pptx && node headache_aura.js 2>&1
Headache with Aura Harrison22E
Presentation · PPTX
| # | Slide | Highlights |
|---|---|---|
| 1 | Title | Dark navy + violet theme, real MRI backdrop |
| 2 | What is Migraine Aura? | 8 defining features, ICHD-3 criteria, why only 20–25% of patients |
| 3 | Types of Aura | Visual, Sensory, Language, Motor (FHM) — full detail for each |
| 4 | Brainstem Aura & Retinal Migraine | Formerly "basilar migraine"; 9 brainstem symptoms; retinal migraine DDx |
| 5 | 4 Phases of Migraine | Prodrome → Aura (highlighted) → Headache → Postdrome with timings |
| 6 | Cortical Spreading Depression | CSD mechanism, 3–5 mm/min wave, FHM gene mutations + brain diagram |
| 7 | Real Human Brain Scan — Premonitory | Full-slide PET scan (Fig 441-2A): hypothalamic activation before pain |
| 8 | Real Human Brain Scan — Acute Attack | Full-slide MRI (Fig 441-2C): pontine activation lateralised to pain side |
| 9 | Aura vs. TIA / Stroke / Seizure | Comparison table across 9 features — key clinical differentiator |
| 10 | Acephalgic Migraine & Special Situations | Aura without headache, persistent aura, stroke risk in aura patients |
| 11 | Treatment | Acute (triptans, gepants, ditans) + Preventive (CGRP mAbs, CCBs for FHM) + OCP warning |
| 12 | Key Takeaways | 8 points + 3-scan patient brain montage |
If you meant something else by "erroa" (errors, era, etc.) just let me know and I'll rebuild it!