presentation topic of investigation of epilepsy and seizure reference this pdf only and also add brain image eeg and all pictures

Reading File
Reading File
Reading File
Reading File
Running Command

cd /home/daytona/workspace && python3 -c " import pdfplumber pdf_path = '/home/d…

Searching the Web

EEG epilepsy brain scan images free medical educational

Running Command

mkdir -p /home/daytona/workspace/epilepsy-pptx/images && cd /home/daytona/worksp…

Running Command

cd /home/daytona/workspace/epilepsy-pptx && node /home/daytona/skills/shared/scr…

Running Command

ls /home/daytona/workspace/epilepsy-pptx/images/

Running Command

ls -lh /home/daytona/workspace/Investigation_of_Epilepsy_and_Seizure.pptx

Running Command

mkdir -p /home/daytona/workspace/epilepsy-pptx/images && cd /home/daytona/worksp…

Writing File

~/epilepsy-pptx/build_pptx.js

const PptxGenJS = require("pptxgenjs");
const https = require("https");
const http = require("http");

// ============================================================
// COLORS
// ============================================================
const DARK_NAVY  = "0B1F3A";
const TEAL       = "1B7B8A";
const LIGHT_TEAL = "2EAAB8";
const WHITE      = "FFFFFF";
const LIGHT_GRAY = "E8F0F2";
const ACCENT_GOLD= "F4B942";
const TEXT_DARK  = "1A2B3C";

// ============================================================
// HELPERS
// ============================================================
function fetchImage(url) {
  return new Promise((resolve) => {
    const proto = url.startsWith("https") ? https : http;
    const req = proto.get(url, {
      headers: {
        "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 Chrome/120",
        "Accept": "image/*,*/*;q=0.8"
      },
      timeout: 15000
    }, (res) => {
      if (res.statusCode === 301 || res.statusCode === 302) {
        fetchImage(res.headers.location).then(resolve);
        return;
      }
      if (res.statusCode !== 200) { resolve(null); return; }
      const chunks = [];
      res.on("data", c => chunks.push(c));
      res.on("end", () => {
        const buf = Buffer.concat(chunks);
        const ct = res.headers["content-type"] || "image/jpeg";
        resolve(`${ct};base64,${buf.toString("base64")}`);
      });
    });
    req.on("error", () => resolve(null));
    req.on("timeout", () => { req.destroy(); resolve(null); });
  });
}

function hdr(slide, title) {
  slide.addShape(PptxGenJS.ShapeType ? PptxGenJS.ShapeType.rect : "rect", {
    x: 0, y: 0, w: "100%", h: 1.0, fill: { color: DARK_NAVY }
  });
  slide.addShape(PptxGenJS.ShapeType ? PptxGenJS.ShapeType.rect : "rect", {
    x: 0, y: 0.95, w: "100%", h: 0.06, fill: { color: ACCENT_GOLD }
  });
  slide.addText(title, {
    x: 0.4, y: 0.1, w: 9.2, h: 0.78,
    fontSize: 26, bold: true, color: WHITE, fontFace: "Calibri"
  });
}

function footer(slide, text) {
  slide.addShape(PptxGenJS.ShapeType ? PptxGenJS.ShapeType.rect : "rect", {
    x: 0, y: 5.3, w: "100%", h: 0.33, fill: { color: DARK_NAVY }
  });
  slide.addText(text, {
    x: 0.3, y: 5.32, w: 9.4, h: 0.28,
    fontSize: 11, color: ACCENT_GOLD, fontFace: "Calibri", italic: true
  });
}

function colHeader(slide, x, y, w, h, text, color) {
  slide.addShape("rect", { x, y, w, h, fill: { color } });
  slide.addText(text, {
    x: x + 0.08, y, w: w - 0.16, h,
    fontSize: 13, bold: true, color: WHITE, fontFace: "Calibri", valign: "middle"
  });
}

function stripedRows(slide, x, startY, w, rowH, items, fontSize, colorA, colorB, textColor) {
  items.forEach((item, i) => {
    slide.addShape("rect", {
      x, y: startY + i * rowH, w, h: rowH - 0.04, fill: { color: i % 2 === 0 ? colorA : colorB }
    });
    const txt = Array.isArray(item) ? item[0] : `• ${item}`;
    if (Array.isArray(item)) {
      slide.addText(item[0], {
        x: x + 0.1, y: startY + i * rowH + 0.02, w: 1.1, h: rowH - 0.08,
        fontSize, bold: true, color: TEAL, fontFace: "Calibri", valign: "middle"
      });
      slide.addText(item[1], {
        x: x + 1.2, y: startY + i * rowH + 0.02, w: w - 1.3, h: rowH - 0.08,
        fontSize, color: textColor, fontFace: "Calibri", valign: "middle"
      });
    } else {
      slide.addText(txt, {
        x: x + 0.12, y: startY + i * rowH + 0.02, w: w - 0.24, h: rowH - 0.08,
        fontSize, color: textColor, fontFace: "Calibri", valign: "middle"
      });
    }
  });
}

// ============================================================
// MAIN
// ============================================================
async function build() {
  console.log("Fetching images...");
  const [eegB64, megB64] = await Promise.all([
    fetchImage("https://thumbs.dreamstime.com/z/epilepsy-eeg-healthy-brain-epileptic-seizure-condition-characterized-recurrent-unpredictable-seizures-human-primary-126355586.jpg"),
    fetchImage("https://www.defeatingepilepsy.org/wp-content/uploads/2023/01/MEG-Scan-Pic.png")
  ]);
  console.log("EEG image:", eegB64 ? "loaded" : "placeholder");
  console.log("MEG image:", megB64 ? "loaded" : "placeholder");

  const pptx = new PptxGenJS();
  pptx.layout = "LAYOUT_16x9";
  pptx.title = "Investigation of Epilepsy and Seizure";

  // --------------------------------------------------------
  // SLIDE 1: TITLE
  // --------------------------------------------------------
  let slide = pptx.addSlide();
  slide.background = { color: DARK_NAVY };
  slide.addShape("rect", { x: 0, y: 0, w: "100%", h: 0.12, fill: { color: TEAL } });
  slide.addShape("rect", { x: 0, y: 0.12, w: "100%", h: 0.05, fill: { color: ACCENT_GOLD } });
  slide.addShape("rect", { x: 0.4, y: 1.25, w: 2.0, h: 0.06, fill: { color: TEAL } });
  slide.addText("INVESTIGATION OF\nEPILEPSY AND SEIZURE", {
    x: 0.4, y: 1.4, w: 9.2, h: 1.8,
    fontSize: 44, bold: true, color: WHITE, fontFace: "Calibri", align: "left"
  });
  slide.addShape("rect", { x: 0.4, y: 3.3, w: 8.0, h: 0.05, fill: { color: LIGHT_TEAL } });
  slide.addText("Comprehensive Clinical Evaluation, Electrophysiology & Neuroimaging", {
    x: 0.4, y: 3.45, w: 9.2, h: 0.55,
    fontSize: 20, color: LIGHT_TEAL, fontFace: "Calibri", align: "left"
  });
  slide.addText("Department of Neurology  |  Medical Education Series", {
    x: 0.4, y: 4.1, w: 9.2, h: 0.4,
    fontSize: 14, color: ACCENT_GOLD, fontFace: "Calibri", align: "left"
  });
  slide.addShape("rect", { x: 0, y: 4.8, w: "100%", h: 0.65, fill: { color: TEAL } });
  slide.addText("Based on Harrison's Principles of Internal Medicine", {
    x: 0.4, y: 4.9, w: 9.2, h: 0.45,
    fontSize: 13, color: WHITE, fontFace: "Calibri", align: "left", italic: true
  });
  slide.addShape("rect", { x: 0, y: 5.45, w: "100%", h: 0.18, fill: { color: ACCENT_GOLD } });

  // --------------------------------------------------------
  // SLIDE 2: APPROACH TO THE PATIENT
  // --------------------------------------------------------
  slide = pptx.addSlide();
  slide.background = { color: WHITE };
  hdr(slide, "APPROACH TO THE SEIZURE PATIENT");

  const c1x = 0.3, c2x = 5.1, cW = 4.6;
  colHeader(slide, c1x, 1.15, cW, 0.44, "FIRST SEIZURE — Key Questions", TEAL);
  stripedRows(slide, c1x, 1.59, cW, 0.46, [
    "Was this truly a seizure?",
    "Determine underlying cause",
    "Seizure type classification",
    "Risk of recurrence?",
    "Decision on treatment",
    "Vital signs & cardiorespiratory support"
  ], 12.5, LIGHT_GRAY, WHITE, TEXT_DARK);

  colHeader(slide, c2x, 1.15, cW, 0.44, "PRIOR SEIZURES — Evaluation Focus", LIGHT_TEAL);
  stripedRows(slide, c2x, 1.59, cW, 0.46, [
    "Identify cause and precipitants",
    "Adequacy of current therapy",
    "Drug levels and compliance",
    "EEG and neuroimaging review",
    "Sleep deprivation, stress, alcohol",
    "Neurologist referral if refractory"
  ], 12.5, "EFF9FB", WHITE, TEXT_DARK);

  footer(slide, "Immediate priority: secure airway, breathing, circulation; IV access; glucose check");

  // --------------------------------------------------------
  // SLIDE 3: HISTORY & PHYSICAL EXAMINATION
  // --------------------------------------------------------
  slide = pptx.addSlide();
  slide.background = { color: WHITE };
  hdr(slide, "HISTORY & PHYSICAL EXAMINATION");

  colHeader(slide, 0.3, 1.12, 4.4, 0.4, "HISTORY", TEAL);
  [
    ["Pre-ictal:", "Aura (visual, sensory, autonomic), focal onset"],
    ["Ictal:", "Duration, motor activity, level of consciousness"],
    ["Post-ictal:", "Confusion, Todd's paralysis, headache"],
    ["Past Hx:", "Febrile seizures, head trauma, CNS infection"],
    ["Family Hx:", "Genetic epilepsy syndromes"],
    ["Triggers:", "Sleep deprivation, alcohol, medications"]
  ].forEach(([label, val], i) => {
    slide.addShape("rect", { x: 0.3, y: 1.52 + i * 0.46, w: 4.4, h: 0.44, fill: { color: i % 2 === 0 ? LIGHT_GRAY : WHITE } });
    slide.addText(label, { x: 0.44, y: 1.54 + i * 0.46, w: 1.1, h: 0.40, fontSize: 11.5, bold: true, color: TEAL, fontFace: "Calibri", valign: "middle" });
    slide.addText(val, { x: 1.54, y: 1.54 + i * 0.46, w: 3.0, h: 0.40, fontSize: 11.5, color: TEXT_DARK, fontFace: "Calibri", valign: "middle" });
  });

  colHeader(slide, 5.05, 1.12, 4.6, 0.4, "PHYSICAL EXAMINATION", LIGHT_TEAL);
  [
    ["Skin:", "Neurocutaneous stigmata (tuberous sclerosis, NF)"],
    ["Cardiovascular:", "Arrhythmia, syncope exclusion"],
    ["Abdomen:", "Hepatosplenomegaly (metabolic disease)"],
    ["Limbs:", "Asymmetry — focal cortical pathology"],
    ["Head:", "Signs of trauma, birth injury"],
    ["Neuro:", "Cognitive, visual fields, motor, sensory"]
  ].forEach(([label, val], i) => {
    slide.addShape("rect", { x: 5.05, y: 1.52 + i * 0.46, w: 4.6, h: 0.44, fill: { color: i % 2 === 0 ? "EFF9FB" : WHITE } });
    slide.addText(label, { x: 5.18, y: 1.54 + i * 0.46, w: 1.35, h: 0.40, fontSize: 11.5, bold: true, color: LIGHT_TEAL, fontFace: "Calibri", valign: "middle" });
    slide.addText(val, { x: 6.53, y: 1.54 + i * 0.46, w: 2.95, h: 0.40, fontSize: 11, color: TEXT_DARK, fontFace: "Calibri", valign: "middle" });
  });

  footer(slide, "Witness history is critical — the patient may not recall the event accurately");

  // --------------------------------------------------------
  // SLIDE 4: LABORATORY STUDIES
  // --------------------------------------------------------
  slide = pptx.addSlide();
  slide.background = { color: WHITE };
  hdr(slide, "LABORATORY STUDIES");

  const labCols = [
    { title: "Routine Blood Tests", color: TEAL, items: ["CBC — infection, anemia", "Electrolytes — Na+, K+, Cl-, HCO3-", "Glucose — hypoglycemia (common)", "Calcium, Magnesium — convulsions", "Hepatic & Renal function"] },
    { title: "Toxicology Screen", color: "2E7D32", items: ["Alcohol level", "Drug screen (cocaine, amphetamines)", "Prescription drugs (theophylline, INH)", "Antiepileptic drug levels", "Heavy metals if indicated"] },
    { title: "CSF / Lumbar Puncture", color: "5C3566", items: ["Mandatory in suspected meningitis", "Required in all HIV-positive patients", "Cell count, protein, glucose, culture", "HSV PCR if encephalitis suspected", "Opening pressure measurement"] },
    { title: "Autoantibody Testing", color: "C62828", items: ["Anti-NMDAR encephalitis", "Anti-LGI1, CASPR2, GABA-B antibodies", "Serum + CSF both recommended", "Indicated in fulminant epilepsy with\npsychiatric/cognitive symptoms", "Can be treatable and reversible"] }
  ];

  labCols.forEach((lab, col) => {
    const cx = 0.25 + col * 2.42;
    colHeader(slide, cx, 1.12, 2.3, 0.42, lab.title, lab.color);
    lab.items.forEach((item, i) => {
      slide.addShape("rect", { x: cx, y: 1.54 + i * 0.72, w: 2.3, h: 0.70, fill: { color: i % 2 === 0 ? LIGHT_GRAY : WHITE } });
      slide.addText(`• ${item}`, { x: cx + 0.08, y: 1.56 + i * 0.72, w: 2.15, h: 0.66, fontSize: 11, color: TEXT_DARK, fontFace: "Calibri", valign: "middle" });
    });
  });

  footer(slide, "Serum prolactin: elevated after generalized tonic-clonic seizure (not psychogenic) — useful adjunct");

  // --------------------------------------------------------
  // SLIDE 5: EEG WITH IMAGE
  // --------------------------------------------------------
  slide = pptx.addSlide();
  slide.background = { color: WHITE };
  hdr(slide, "ELECTROPHYSIOLOGIC STUDIES — EEG");

  if (eegB64) {
    slide.addImage({ data: eegB64, x: 0.3, y: 1.1, w: 4.8, h: 3.25 });
  } else {
    slide.addShape("rect", { x: 0.3, y: 1.1, w: 4.8, h: 3.25, fill: { color: "CCCCCC" } });
    slide.addText("EEG Comparison Image\n(Normal vs Epileptic)", { x: 0.3, y: 2.4, w: 4.8, h: 0.7, fontSize: 14, color: "666666", fontFace: "Calibri", align: "center" });
  }
  slide.addText("Normal vs Epileptic EEG Patterns", {
    x: 0.3, y: 4.38, w: 4.8, h: 0.32, fontSize: 10, color: "666666", fontFace: "Calibri", italic: true, align: "center"
  });

  colHeader(slide, 5.3, 1.1, 4.4, 0.42, "ELECTROENCEPHALOGRAPHY (EEG)", TEAL);
  [
    ["Normal:", "8-13 Hz alpha (posterior), >13 Hz beta"],
    ["Drowsy:", "4-7 Hz theta; delta <4 Hz in slow-wave sleep"],
    ["Epileptiform:", "Spikes, sharp waves, spike-wave complexes"],
    ["Key finding:", "Always abnormal during generalized TC seizure"],
    ["Sensitivity:", "Initial EEG normal in 50-80% of known epilepsy"],
    ["Activation:", "Hyperventilation, photic stim, sleep deprivation"]
  ].forEach(([label, val], i) => {
    slide.addShape("rect", { x: 5.3, y: 1.52 + i * 0.48, w: 4.4, h: 0.46, fill: { color: i % 2 === 0 ? LIGHT_GRAY : WHITE } });
    slide.addText(label, { x: 5.44, y: 1.54 + i * 0.48, w: 1.1, h: 0.42, fontSize: 11, bold: true, color: TEAL, fontFace: "Calibri", valign: "middle" });
    slide.addText(val, { x: 6.54, y: 1.54 + i * 0.48, w: 3.0, h: 0.42, fontSize: 10.5, color: TEXT_DARK, fontFace: "Calibri", valign: "middle" });
  });

  footer(slide, "Video-EEG telemetry: gold standard for difficult-to-diagnose seizures and pre-surgical evaluation");

  // --------------------------------------------------------
  // SLIDE 6: EEG PATTERNS
  // --------------------------------------------------------
  slide = pptx.addSlide();
  slide.background = { color: WHITE };
  hdr(slide, "EEG PATTERNS & INTERPRETATION");

  const patterns = [
    { title: "Normal EEG", color: "2E7D32", desc: "Posterior 9 Hz alpha rhythm, attenuates with eye opening; >13 Hz beta frontally", use: "Baseline for comparison" },
    { title: "Encephalitis Pattern", color: "C62828", desc: "Diffuse slow-wave activity (delta/theta); reduced alpha; may see periodic complexes", use: "Suggests diffuse cerebral dysfunction; infectious, autoimmune" },
    { title: "Focal Lesion", color: "F57C00", desc: "Irregular slow waves over focal region (e.g., right parietal in glioma)", use: "Localizes structural pathology; guides neuroimaging" },
    { title: "Tonic Seizure", color: TEAL, desc: "Generalized repetitive sharp waves at high frequency during ictal phase", use: "Characteristic of tonic seizures; Lennox-Gastaut syndrome" },
    { title: "Absence Epilepsy", color: "5C3566", desc: "Classic 3-Hz spike-and-wave (SWD) discharges, diffuse, bilateral, synchronous", use: "Pathognomonic for childhood absence epilepsy" },
    { title: "Creutzfeldt-Jakob", color: "4E342E", desc: "Periodic sharp wave complexes at ~1/second on a suppressed background", use: "Highly characteristic of prion disease (CJD)" }
  ];

  patterns.forEach((p, i) => {
    const r = Math.floor(i / 2), c = i % 2;
    const px = 0.3 + c * 4.85, py = 1.12 + r * 1.38, pw = 4.6, ph = 1.3;
    slide.addShape("rect", { x: px, y: py, w: pw, h: 0.36, fill: { color: p.color } });
    slide.addText(p.title, { x: px + 0.08, y: py, w: pw - 0.16, h: 0.36, fontSize: 13, bold: true, color: WHITE, fontFace: "Calibri", valign: "middle" });
    slide.addShape("rect", { x: px, y: py + 0.36, w: pw, h: ph - 0.36, fill: { color: LIGHT_GRAY } });
    slide.addText(p.desc, { x: px + 0.08, y: py + 0.38, w: pw - 0.16, h: 0.52, fontSize: 10.5, color: TEXT_DARK, fontFace: "Calibri" });
    slide.addText(`-> ${p.use}`, { x: px + 0.08, y: py + 0.88, w: pw - 0.16, h: 0.38, fontSize: 10, color: p.color, fontFace: "Calibri", bold: true });
  });

  // --------------------------------------------------------
  // SLIDE 7: MEG
  // --------------------------------------------------------
  slide = pptx.addSlide();
  slide.background = { color: WHITE };
  hdr(slide, "MAGNETOENCEPHALOGRAPHY (MEG)");

  if (megB64) {
    slide.addImage({ data: megB64, x: 5.5, y: 1.15, w: 4.1, h: 3.8 });
    slide.addText("MEG Scan — Mapping epileptic activity", {
      x: 5.5, y: 5.0, w: 4.1, h: 0.3, fontSize: 9.5, color: "666666", fontFace: "Calibri", italic: true, align: "center"
    });
  } else {
    slide.addShape("rect", { x: 5.5, y: 1.15, w: 4.1, h: 3.8, fill: { color: "DDEEFF" } });
    slide.addText("MEG Brain Scan\nImage", { x: 5.5, y: 2.8, w: 4.1, h: 0.6, fontSize: 14, color: "666666", fontFace: "Calibri", align: "center" });
  }

  colHeader(slide, 0.3, 1.15, 4.9, 0.42, "PRINCIPLES OF MEG", TEAL);
  [
    ["Measures:", "Extracranial magnetic fields from neuronal currents"],
    ["Advantage:", "Not distorted by skull/scalp (unlike EEG)"],
    ["Resolution:", "Superior spatial localization of epileptiform source"],
    ["MSI:", "Magnetic Source Image = MEG co-registered on MRI"],
    ["Application:", "Pre-surgical epilepsy mapping"],
    ["Combined:", "MEG + EEG gives complementary information"],
    ["Limitation:", "Expensive, limited availability, requires shielding"]
  ].forEach(([label, val], i) => {
    slide.addShape("rect", { x: 0.3, y: 1.57 + i * 0.48, w: 4.9, h: 0.46, fill: { color: i % 2 === 0 ? LIGHT_GRAY : WHITE } });
    slide.addText(label, { x: 0.44, y: 1.59 + i * 0.48, w: 1.12, h: 0.42, fontSize: 11.5, bold: true, color: TEAL, fontFace: "Calibri", valign: "middle" });
    slide.addText(val, { x: 1.56, y: 1.59 + i * 0.48, w: 3.48, h: 0.42, fontSize: 11, color: TEXT_DARK, fontFace: "Calibri", valign: "middle" });
  });

  // --------------------------------------------------------
  // SLIDE 8: BRAIN IMAGING
  // --------------------------------------------------------
  slide = pptx.addSlide();
  slide.background = { color: WHITE };
  hdr(slide, "BRAIN IMAGING");

  const modalities = [
    { name: "MRI", subtitle: "First-line Imaging", color: TEAL, points: ["Superior to CT for structural lesions", "Hippocampal atrophy (mesial temporal sclerosis)", "Cortical migration abnormalities", "Tumors, vascular malformations", "High-res 3T protocols preferred"] },
    { name: "CT", subtitle: "Emergency Use", color: "C62828", points: ["Used when MRI unavailable/emergent", "Rapid: rules out hemorrhage, mass", "Less sensitive than MRI for subtle lesions", "Head trauma evaluation", "Detects calcifications"] },
    { name: "PET", subtitle: "Metabolic Imaging", color: "5C3566", points: ["FDG-PET: glucose metabolism", "Interictal: hypometabolism at seizure focus", "Ictal: hypermetabolism at focus", "Pre-surgical planning for refractory epilepsy", "Sensitive when MRI is normal"] },
    { name: "SPECT", subtitle: "Blood Flow Imaging", color: "E65100", points: ["Cerebral blood flow measurement", "Ictal SPECT: hyperperfusion at focus", "SISCOM: ictal-interictal subtraction", "Medically refractory seizures", "Localizes when EEG inconclusive"] }
  ];

  modalities.forEach((mod, i) => {
    const mx = 0.27 + i * 2.42;
    slide.addShape("rect", { x: mx, y: 1.12, w: 2.32, h: 0.55, fill: { color: mod.color } });
    slide.addText(mod.name, { x: mx + 0.05, y: 1.12, w: 2.22, h: 0.28, fontSize: 18, bold: true, color: WHITE, fontFace: "Calibri", valign: "bottom" });
    slide.addText(mod.subtitle, { x: mx + 0.05, y: 1.40, w: 2.22, h: 0.24, fontSize: 10, color: WHITE, fontFace: "Calibri", italic: true });
    mod.points.forEach((pt, j) => {
      slide.addShape("rect", { x: mx, y: 1.67 + j * 0.68, w: 2.32, h: 0.66, fill: { color: j % 2 === 0 ? LIGHT_GRAY : WHITE } });
      slide.addText(`• ${pt}`, { x: mx + 0.08, y: 1.69 + j * 0.68, w: 2.18, h: 0.62, fontSize: 10.5, color: TEXT_DARK, fontFace: "Calibri", valign: "middle" });
    });
  });

  footer(slide, "Almost all new-onset seizures require neuroimaging — MRI preferred for structural evaluation");

  // --------------------------------------------------------
  // SLIDE 9: GENETIC TESTING
  // --------------------------------------------------------
  slide = pptx.addSlide();
  slide.background = { color: WHITE };
  hdr(slide, "GENETIC TESTING IN EPILEPSY");

  slide.addShape("rect", { x: 0.3, y: 1.12, w: 9.4, h: 0.42, fill: { color: TEAL } });
  slide.addText("Genetic testing has an increasingly important role, especially in infants and children", {
    x: 0.4, y: 1.12, w: 9.2, h: 0.42, fontSize: 13.5, color: WHITE, fontFace: "Calibri", valign: "middle"
  });

  const genetics = [
    { syndrome: "Dravet Syndrome", gene: "SCN1A", color: "C62828", desc: "Sodium channel mutation; febrile seizures evolving to treatment-resistant epilepsy; CBD approved therapy" },
    { syndrome: "KCNQ2 Epilepsy", gene: "KCNQ2", color: TEAL, desc: "Potassium channel; neonatal onset; often self-limited; quinidine may be effective" },
    { syndrome: "Lennox-Gastaut", gene: "Multiple", color: "5C3566", desc: "Multiple etiologies (genetic, structural, unknown); CBD approved; multiple seizure types" },
    { syndrome: "GLUT1 Deficiency", gene: "SLC2A1", color: "F57C00", desc: "Glucose transporter defect; responds well to ketogenic diet; CSF glucose low" },
    { syndrome: "TSC Epilepsy", gene: "TSC1/TSC2", color: "2E7D32", desc: "Tuberous sclerosis; mTOR inhibitors (everolimus) as targeted therapy; skin lesions" },
    { syndrome: "CDKL5 Disorder", gene: "CDKL5", color: "4E342E", desc: "X-linked; early-onset seizures; intellectual disability; difficult to treat" }
  ];

  genetics.forEach((g, i) => {
    const gx = 0.3 + (i % 3) * 3.18, gy = 1.65 + Math.floor(i / 3) * 1.65;
    slide.addShape("rect", { x: gx, y: gy, w: 3.0, h: 0.4, fill: { color: g.color } });
    slide.addText(g.syndrome, { x: gx + 0.08, y: gy, w: 1.8, h: 0.4, fontSize: 12, bold: true, color: WHITE, fontFace: "Calibri", valign: "middle" });
    slide.addText(`Gene: ${g.gene}`, { x: gx + 1.9, y: gy, w: 1.0, h: 0.4, fontSize: 11, color: ACCENT_GOLD, fontFace: "Calibri", valign: "middle", align: "right" });
    slide.addShape("rect", { x: gx, y: gy + 0.4, w: 3.0, h: 1.18, fill: { color: LIGHT_GRAY } });
    slide.addText(g.desc, { x: gx + 0.1, y: gy + 0.42, w: 2.8, h: 1.14, fontSize: 10.5, color: TEXT_DARK, fontFace: "Calibri" });
  });

  footer(slide, "Genetic testing guides targeted therapy selection and predicts prognosis");

  // --------------------------------------------------------
  // SLIDE 10: DIFFERENTIAL DIAGNOSIS
  // --------------------------------------------------------
  slide = pptx.addSlide();
  slide.background = { color: WHITE };
  hdr(slide, "DIFFERENTIAL DIAGNOSIS");

  colHeader(slide, 0.3, 1.12, 4.2, 0.45, "SEIZURE FEATURES", TEAL);
  stripedRows(slide, 0.3, 1.57, 4.2, 0.44, [
    "Preceded by aura",
    "Cyanosis during episode",
    "Motor activity >15 seconds",
    "Post-ictal confusion",
    "Muscle soreness afterward",
    "EEG abnormality",
    "Tongue biting (lateral)",
    "Elevated prolactin (post-ictal)"
  ], 12, LIGHT_GRAY, WHITE, TEXT_DARK);

  colHeader(slide, 5.2, 1.12, 4.5, 0.45, "SYNCOPE / PSYCHOGENIC (PNES)", "C62828");
  stripedRows(slide, 5.2, 1.57, 4.5, 0.44, [
    "Provoked by pain, stress, prolonged standing",
    "Dizziness, sweating, nausea prodrome",
    "Brief LOC, rapid recovery",
    "Pallor (not cyanosis)",
    "No post-ictal confusion",
    "Side-to-side head movements (PNES)",
    "Ictal eye closure (PNES)",
    "Pelvic thrusting, prolonged duration (PNES)"
  ], 11, "FFF3F3", WHITE, TEXT_DARK);

  // --------------------------------------------------------
  // SLIDE 11: PNES
  // --------------------------------------------------------
  slide = pptx.addSlide();
  slide.background = { color: WHITE };
  hdr(slide, "PSYCHOGENIC NON-EPILEPTIC SEIZURES (PNES)");

  slide.addShape("rect", { x: 0.3, y: 1.12, w: 9.4, h: 0.55, fill: { color: TEAL } });
  slide.addText("PNES = nonepileptic behaviors representing a conversion reaction; may coexist with true epilepsy", {
    x: 0.4, y: 1.12, w: 9.2, h: 0.55, fontSize: 13, color: WHITE, fontFace: "Calibri", valign: "middle"
  });

  const pnesSections = [
    { title: "Clinical Features", color: "C62828", items: ["Side-to-side head/body movements", "Ictal eye closure (eyes open in true seizures)", "Asymmetric limb shaking", "Pelvic thrusting or arc-en-ciel", "Prolonged duration (>2 min common)", "Waxing/waning course during episode", "Recall during apparent LOC"] },
    { title: "Diagnosis", color: TEAL, items: ["Video-EEG monitoring: GOLD STANDARD", "No EEG changes during typical spell", "Serum prolactin: NOT elevated post-PNES", "(Elevated after true tonic-clonic seizure)", "Normal MRI, normal interictal EEG", "Careful psychiatric history", "May coexist with true epilepsy (~30%)"] },
    { title: "Management", color: "2E7D32", items: ["Diagnosis communicated sensitively", "Psychiatric/psychological referral", "Cognitive behavioral therapy (CBT)", "Treat underlying psychiatric disorder", "Multidisciplinary team approach", "Avoid unnecessary antiepileptic drugs", "Regular follow-up monitoring"] }
  ];

  pnesSections.forEach((sec, i) => {
    const sx = 0.3 + i * 3.22;
    colHeader(slide, sx, 1.78, 3.05, 0.4, sec.title, sec.color);
    stripedRows(slide, sx, 2.18, 3.05, 0.44, sec.items, 10.5, LIGHT_GRAY, WHITE, TEXT_DARK);
  });

  footer(slide, "Video-EEG monitoring captures the typical event with simultaneous EEG — essential for definitive diagnosis");

  // --------------------------------------------------------
  // SLIDE 12: TREATMENT
  // --------------------------------------------------------
  slide = pptx.addSlide();
  slide.background = { color: WHITE };
  hdr(slide, "TREATMENT OVERVIEW");

  const txCols = [
    { title: "Antiseizure Medications", color: TEAL, items: ["Na+ channel blockers: carbamazepine, phenytoin, lamotrigine, oxcarbazepine", "GABA enhancers: benzodiazepines, phenobarbital, valproate, tiagabine", "Ca2+ current inhibitors: ethosuximide (absence epilepsy)", "Multiple targets: topiramate, felbamate, levetiracetam", "AMPA-R blocker: perampanel", "CBD (cannabidiol): Dravet syndrome, Lennox-Gastaut"] },
    { title: "Non-Pharmacologic", color: "5C3566", items: ["Epilepsy surgery: resection of focus in refractory epilepsy", "Ketogenic diet: high-fat, low-carbohydrate; effective in children", "Vagal nerve stimulation (VNS): adjunctive therapy", "Responsive neurostimulation (RNS): closed-loop device", "Deep brain stimulation (DBS): ANT of thalamus", "LASER interstitial thermal therapy (LITT)"] },
    { title: "General Principles", color: "2E7D32", items: ["Treat underlying condition if identified", "Avoid precipitating factors (alcohol, sleep deprivation)", "Neurologist essential for refractory epilepsy", "Antiepileptogenic drugs: not yet clinically available", "Psychological and social support critical", "Driving restrictions: varies by jurisdiction"] }
  ];

  txCols.forEach((tc, i) => {
    const tx = 0.3 + i * 3.22;
    colHeader(slide, tx, 1.12, 3.05, 0.42, tc.title, tc.color);
    tc.items.forEach((item, j) => {
      slide.addShape("rect", { x: tx, y: 1.54 + j * 0.62, w: 3.05, h: 0.60, fill: { color: j % 2 === 0 ? LIGHT_GRAY : WHITE } });
      slide.addText(`• ${item}`, { x: tx + 0.1, y: 1.56 + j * 0.62, w: 2.88, h: 0.56, fontSize: 10.5, color: TEXT_DARK, fontFace: "Calibri", valign: "middle" });
    });
  });

  footer(slide, "Treatment is multimodal: medications, surgical options, dietary therapies, and psychosocial support");

  // --------------------------------------------------------
  // SLIDE 13: KEY TAKEAWAYS
  // --------------------------------------------------------
  slide = pptx.addSlide();
  slide.background = { color: DARK_NAVY };
  slide.addShape("rect", { x: 0, y: 0, w: "100%", h: 0.1, fill: { color: TEAL } });
  slide.addShape("rect", { x: 0, y: 0.1, w: "100%", h: 0.05, fill: { color: ACCENT_GOLD } });

  slide.addText("KEY TAKEAWAYS", {
    x: 0.4, y: 0.25, w: 9.2, h: 0.55, fontSize: 30, bold: true, color: WHITE, fontFace: "Calibri", align: "center"
  });
  slide.addText("Investigation of Epilepsy and Seizure", {
    x: 0.4, y: 0.8, w: 9.2, h: 0.3, fontSize: 14, color: LIGHT_TEAL, fontFace: "Calibri", align: "center", italic: true
  });

  const takeaways = [
    { num: "01", text: "Thorough history (pre/ictal/postictal phases) + witness account is the most important diagnostic step" },
    { num: "02", text: "EEG: always abnormal during generalized tonic-clonic seizure; initial EEG normal in 50-80% of known epilepsy" },
    { num: "03", text: "MRI is superior to CT for structural lesions — mesial temporal sclerosis, cortical dysplasia, tumors" },
    { num: "04", text: "MEG + co-registered MRI (MSI) provides precise epileptic source localization for surgical planning" },
    { num: "05", text: "Genetic testing guides targeted therapy; increasingly important in pediatric epilepsy evaluation" },
    { num: "06", text: "Video-EEG monitoring is gold standard for diagnosing PNES (psychogenic non-epileptic seizures)" },
    { num: "07", text: "Treatment is multimodal: antiseizure medications, surgery, dietary therapies, and psychosocial support" }
  ];

  takeaways.forEach((t, i) => {
    const ty = 1.25 + i * 0.57;
    slide.addShape("rect", { x: 0.3, y: ty, w: 0.55, h: 0.5, fill: { color: TEAL } });
    slide.addText(t.num, { x: 0.3, y: ty, w: 0.55, h: 0.5, fontSize: 14, bold: true, color: WHITE, fontFace: "Calibri", align: "center", valign: "middle" });
    slide.addShape("rect", { x: 0.88, y: ty, w: 8.85, h: 0.5, fill: { color: "132944" } });
    slide.addText(t.text, { x: 1.0, y: ty, w: 8.65, h: 0.5, fontSize: 12, color: WHITE, fontFace: "Calibri", valign: "middle" });
  });

  slide.addShape("rect", { x: 0, y: 5.28, w: "100%", h: 0.35, fill: { color: TEAL } });
  slide.addText("Ref: Harrison's Principles of Internal Medicine — Epilepsy and Seizure Chapter", {
    x: 0.3, y: 5.3, w: 9.4, h: 0.3, fontSize: 11, color: WHITE, fontFace: "Calibri", italic: true
  });

  // --------------------------------------------------------
  // SAVE
  // --------------------------------------------------------
  const outPath = "/home/daytona/workspace/Investigation_of_Epilepsy_and_Seizure.pptx";
  await pptx.writeFile({ fileName: outPath });
  console.log("SUCCESS: Saved to", outPath);
}

build().catch(err => { console.error("FAILED:", err); process.exit(1); });
Your credits are exhausted. You can purchase a top-up or subscribe to a plan to continue using Orris. If you're already subscribed, your daily credits will reset tomorrow.
This is a shared conversation. Sign in to Orris to start your own chat.