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
Running Command

cd /home/daytona/workspace/attachments/04d56685-df4a-4ef8-9754-91591a62d8aa && p…

Running Command

cd /home/daytona/workspace/attachments/04d56685-df4a-4ef8-9754-91591a62d8aa && p…

Running Command

cd /home/daytona/workspace/attachments/04d56685-df4a-4ef8-9754-91591a62d8aa && p…

Running Command

python3 -c " import fitz # PyMuPDF import os pdf_path = '/home/daytona/workspa…

Running Command

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

analyse_media
analyse_media
analyse_media
analyse_media
Writing File

~/epilepsy-pptx/build.js

const pptxgen = require("pptxgenjs");
const fs = require("fs");
const path = require("path");

const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Investigation of Epilepsy and Seizure";
pres.author = "Medical Education";

const IMGDIR = "/home/daytona/workspace/epilepsy-pptx/images";

// Helper: load image as base64 data URI
function imgData(filename) {
  const ext = path.extname(filename).slice(1).toLowerCase();
  const mime = ext === "png" ? "image/png" : "image/jpeg";
  const data = fs.readFileSync(filename);
  return "data:" + mime + ";base64," + data.toString("base64");
}

// ─── COLOR PALETTE ───────────────────────────────────────────────────────────
const C = {
  navy:    "0D1B2A",   // dominant dark bg
  teal:    "1A7A9B",   // accent headers
  lightBg: "F0F5FA",   // light slide bg
  white:   "FFFFFF",
  gold:    "E9C46A",   // warm accent / highlight
  orange:  "F4A261",
  red:     "E63946",
  gray:    "8D99AE",
  darkText:"1D2D44",
  green:   "2A9D8F",
};

// ─── SLIDE 1: TITLE ──────────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  // Dark bg
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.navy } });
  // Accent bar
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.06, fill: { color: C.teal } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 5.565, w: "100%", h: 0.06, fill: { color: C.gold } });

  // Brain image (page-10 has MRI/brain imaging)
  s.addImage({ path: `${IMGDIR}/page-10.png`, x: 6.2, y: 0.4, w: 3.6, h: 4.8, transparency: 30 });

  // Overlay gradient on right side
  s.addShape(pres.ShapeType.rect, { x: 5.8, y: 0, w: 4.5, h: "100%", fill: { color: C.navy, transparency: 30 } });

  s.addText("INVESTIGATION OF", {
    x: 0.4, y: 0.9, w: 5.8, h: 0.7,
    fontSize: 22, bold: true, color: C.gold, fontFace: "Calibri",
    charSpacing: 4, align: "left"
  });
  s.addText("EPILEPSY", {
    x: 0.4, y: 1.55, w: 5.8, h: 1.1,
    fontSize: 64, bold: true, color: C.white, fontFace: "Calibri",
    align: "left"
  });
  s.addText("& SEIZURE", {
    x: 0.4, y: 2.5, w: 5.8, h: 0.8,
    fontSize: 42, bold: false, color: C.teal, fontFace: "Calibri",
    align: "left"
  });
  s.addShape(pres.ShapeType.rect, { x: 0.4, y: 3.45, w: 2.5, h: 0.05, fill: { color: C.gold } });
  s.addText("Clinical Approach to Diagnosis", {
    x: 0.4, y: 3.6, w: 5.8, h: 0.5,
    fontSize: 17, bold: false, color: C.gray, fontFace: "Calibri", align: "left"
  });
  s.addText("History  •  Physical Exam  •  EEG  •  Neuroimaging  •  Genetics", {
    x: 0.4, y: 4.2, w: 6.5, h: 0.45,
    fontSize: 13, color: C.gold, fontFace: "Calibri", align: "left"
  });
  s.addText("Source: Harrison's Principles of Internal Medicine", {
    x: 0.4, y: 5.1, w: 6, h: 0.35,
    fontSize: 11, color: C.gray, fontFace: "Calibri", italic: true, align: "left"
  });
}

// ─── SLIDE 2: OVERVIEW / AGENDA ──────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.lightBg } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.85, fill: { color: C.navy } });
  s.addText("INVESTIGATION OVERVIEW", {
    x: 0.4, y: 0.08, w: 9.2, h: 0.65,
    fontSize: 26, bold: true, color: C.white, fontFace: "Calibri", align: "left"
  });

  const steps = [
    { num: "01", title: "Patient Presentation & First Priorities", color: C.teal },
    { num: "02", title: "History & Neurological Examination", color: C.green },
    { num: "03", title: "Laboratory Studies", color: C.gold },
    { num: "04", title: "Electrophysiologic Studies (EEG)", color: C.orange },
    { num: "05", title: "Neuroimaging (MRI / CT / PET / SPECT)", color: C.red },
    { num: "06", title: "Genetic Testing", color: C.teal },
    { num: "07", title: "Differential Diagnosis", color: C.green },
  ];

  steps.forEach((st, i) => {
    const col = i < 4 ? 0 : 1;
    const row = i < 4 ? i : i - 4;
    const x = col === 0 ? 0.35 : 5.1;
    const y = 1.05 + row * 1.05;

    s.addShape(pres.ShapeType.rect, { x, y, w: 4.4, h: 0.85, fill: { color: st.color }, line: { color: st.color } });
    s.addText(st.num, {
      x: x + 0.1, y, w: 0.7, h: 0.85,
      fontSize: 26, bold: true, color: C.white, fontFace: "Calibri",
      align: "center", valign: "middle"
    });
    s.addShape(pres.ShapeType.rect, { x: x + 0.75, y, w: 0.03, h: 0.85, fill: { color: C.white, transparency: 40 } });
    s.addText(st.title, {
      x: x + 0.85, y: y + 0.05, w: 3.45, h: 0.75,
      fontSize: 13, bold: false, color: C.white, fontFace: "Calibri",
      valign: "middle", wrap: true
    });
  });
}

// ─── SLIDE 3: FIRST PRIORITIES WHEN PATIENT PRESENTS ────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.navy } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.12, h: "100%", fill: { color: C.red } });
  s.addText("FIRST PRIORITIES WHEN A PATIENT PRESENTS AFTER A SEIZURE", {
    x: 0.35, y: 0.15, w: 9.3, h: 0.65,
    fontSize: 20, bold: true, color: C.white, fontFace: "Calibri"
  });
  s.addShape(pres.ShapeType.rect, { x: 0.35, y: 0.85, w: 9.0, h: 0.04, fill: { color: C.red } });

  const items = [
    { icon: "⚡", text: "Attention to vital signs", sub: "Assess airway, breathing, circulation immediately" },
    { icon: "🫀", text: "Respiratory & cardiovascular support", sub: "Stabilize the patient before investigation" },
    { icon: "💊", text: "Treat seizures if they resume", sub: "See Treatment: Seizures and Epilepsy protocol" },
    { icon: "🧠", text: "Rule out life-threatening conditions", sub: "CNS infection, metabolic derangement, drug toxicity" },
  ];

  items.forEach((it, i) => {
    const x = i % 2 === 0 ? 0.35 : 5.15;
    const y = 1.1 + Math.floor(i / 2) * 2.0;
    s.addShape(pres.ShapeType.rect, { x, y, w: 4.5, h: 1.7, fill: { color: "1A2B3C" }, line: { color: C.red, pt: 1.5 } });
    s.addText(it.icon, { x, y: y + 0.15, w: 4.5, h: 0.6, fontSize: 30, align: "center" });
    s.addText(it.text, { x: x + 0.15, y: y + 0.7, w: 4.2, h: 0.4, fontSize: 15, bold: true, color: C.gold, fontFace: "Calibri", align: "center" });
    s.addText(it.sub, { x: x + 0.15, y: y + 1.1, w: 4.2, h: 0.55, fontSize: 12, color: C.gray, fontFace: "Calibri", align: "center", wrap: true });
  });

  // If FIRST seizure: three questions
  s.addText("If this is the FIRST seizure — 3 key questions:", {
    x: 0.35, y: 5.1, w: 9.3, h: 0.35,
    fontSize: 13, bold: true, color: C.teal, fontFace: "Calibri"
  });
  s.addText("1. Was it truly a seizure?   2. What is the cause / precipitants?   3. Is antiseizure drug therapy required?", {
    x: 0.35, y: 5.38, w: 9.3, h: 0.3,
    fontSize: 12, color: C.white, fontFace: "Calibri"
  });
}

// ─── SLIDE 4: EVALUATION FLOWCHART (PDF page 4) ──────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.lightBg } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.72, fill: { color: C.teal } });
  s.addText("EVALUATION FLOWCHART — Adult Patient with a Seizure", {
    x: 0.4, y: 0.08, w: 9.2, h: 0.55,
    fontSize: 22, bold: true, color: C.white, fontFace: "Calibri"
  });

  // Embed the flowchart image from the PDF (page 4 rendered)
  s.addImage({ path: `${IMGDIR}/page-04.png`, x: 0.25, y: 0.85, w: 5.3, h: 4.65 });

  // Annotation box
  s.addShape(pres.ShapeType.rect, { x: 5.8, y: 0.85, w: 4.0, h: 4.65, fill: { color: C.navy }, line: { color: C.teal, pt: 1.5 } });
  s.addText("Key Investigation Steps", {
    x: 5.85, y: 0.95, w: 3.9, h: 0.45,
    fontSize: 15, bold: true, color: C.gold, fontFace: "Calibri"
  });
  const notes = [
    "CBC, electrolytes, glucose, Ca²⁺, Mg²⁺",
    "Hepatic / renal function tests",
    "Toxicology screen (blood & urine)",
    "Lumbar puncture if infection suspected",
    "Autoantibody panel (serum + CSF)",
    "EEG as soon as possible",
    "MRI brain (preferred over CT)",
    "CT brain if MRI not immediately available",
  ];
  notes.forEach((n, i) => {
    s.addText("• " + n, {
      x: 5.85, y: 1.5 + i * 0.42, w: 3.8, h: 0.38,
      fontSize: 12, color: C.white, fontFace: "Calibri"
    });
  });
}

// ─── SLIDE 5: HISTORY & EXAMINATION ─────────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.lightBg } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.72, fill: { color: C.green } });
  s.addText("HISTORY & NEUROLOGICAL EXAMINATION", {
    x: 0.4, y: 0.1, w: 9.2, h: 0.55,
    fontSize: 22, bold: true, color: C.white, fontFace: "Calibri"
  });

  const cols = [
    {
      title: "History Focus",
      color: C.green,
      items: [
        "Symptoms before, during, and after the episode",
        "Witness accounts (patient may be unaware of ictal phase)",
        "History of febrile seizures / family history",
        "Prior auras not recognized as seizures",
        "Head trauma, stroke, tumor, CNS infection",
        "Developmental milestones (children)",
        "Sleep deprivation, alcohol/drug use",
        "Drugs that lower seizure threshold",
      ]
    },
    {
      title: "Neurological Examination",
      color: C.teal,
      items: [
        "Skin: tuberous sclerosis, neurofibromatosis stigmata",
        "Organomegaly → metabolic storage disease",
        "Limb asymmetry → early brain injury",
        "Auscultation: heart & carotid arteries",
        "Mental status: memory, language, abstract thinking",
        "Visual fields: optic pathway / occipital lobe",
        "Motor: pronator drift, DTRs, gait, coordination",
        "Cortical sensory testing: parietal cortex",
      ]
    }
  ];

  cols.forEach((col, ci) => {
    const x = ci === 0 ? 0.3 : 5.15;
    s.addShape(pres.ShapeType.rect, { x, y: 0.85, w: 4.6, h: 0.45, fill: { color: col.color } });
    s.addText(col.title, {
      x, y: 0.85, w: 4.6, h: 0.45,
      fontSize: 15, bold: true, color: C.white, fontFace: "Calibri",
      align: "center", valign: "middle"
    });
    col.items.forEach((item, ii) => {
      s.addShape(pres.ShapeType.rect, {
        x, y: 1.35 + ii * 0.51, w: 4.6, h: 0.47,
        fill: { color: ii % 2 === 0 ? "E8F4F8" : C.white },
        line: { color: "D0E0EA", pt: 0.5 }
      });
      s.addText("• " + item, {
        x: x + 0.1, y: 1.35 + ii * 0.51, w: 4.4, h: 0.47,
        fontSize: 11.5, color: C.darkText, fontFace: "Calibri", valign: "middle", wrap: true
      });
    });
  });
}

// ─── SLIDE 6: LABORATORY STUDIES ────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.navy } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.72, fill: { color: C.gold } });
  s.addText("LABORATORY STUDIES", {
    x: 0.4, y: 0.1, w: 9.2, h: 0.55,
    fontSize: 26, bold: true, color: C.navy, fontFace: "Calibri"
  });

  const boxes = [
    { title: "Routine Blood Tests", color: C.teal, items: ["Electrolytes (Na, K, Cl, HCO₃)", "Glucose", "Calcium & Magnesium", "Hepatic function tests", "Renal function tests", "Complete blood count (CBC)"] },
    { title: "Toxicology Screen", color: C.orange, items: ["Blood toxin screen", "Urine toxin screen", "Especially in unknown cases or high-risk groups"] },
    { title: "Lumbar Puncture", color: C.red, items: ["Indicated if meningitis / encephalitis suspected", "MANDATORY in HIV patients", "Even without overt symptoms"] },
    { title: "Autoantibody Panel", color: C.green, items: ["Serum autoantibodies", "CSF autoantibodies", "Fulminant onset epilepsy + psychiatric symptoms", "Or cognitive disturbances"] },
  ];

  boxes.forEach((bx, i) => {
    const x = (i % 2) * 4.9 + 0.3;
    const y = Math.floor(i / 2) * 2.55 + 0.9;
    s.addShape(pres.ShapeType.rect, { x, y, w: 4.5, h: 2.3, fill: { color: "0D1B2A" }, line: { color: bx.color, pt: 2 } });
    s.addShape(pres.ShapeType.rect, { x, y, w: 4.5, h: 0.38, fill: { color: bx.color } });
    s.addText(bx.title, {
      x: x + 0.1, y, w: 4.3, h: 0.38,
      fontSize: 13, bold: true, color: C.white, fontFace: "Calibri", valign: "middle"
    });
    bx.items.forEach((item, ii) => {
      s.addText("• " + item, {
        x: x + 0.15, y: y + 0.42 + ii * 0.3, w: 4.2, h: 0.3,
        fontSize: 11.5, color: C.white, fontFace: "Calibri"
      });
    });
  });
}

// ─── SLIDE 7: EEG BASICS ────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.lightBg } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.72, fill: { color: C.orange } });
  s.addText("ELECTROPHYSIOLOGIC STUDIES — EEG BASICS", {
    x: 0.4, y: 0.1, w: 9.2, h: 0.55,
    fontSize: 22, bold: true, color: C.white, fontFace: "Calibri"
  });

  // EEG page image
  s.addImage({ path: `${IMGDIR}/page-07.png`, x: 0.3, y: 0.85, w: 5.5, h: 4.65 });

  // Right column notes
  const pts = [
    { label: "Alpha rhythm", val: "8–13 Hz, posterior, eyes closed, attenuated on eye opening" },
    { label: "Beta activity", val: ">13 Hz, generalized" },
    { label: "Theta", val: "4–7 Hz, seen in drowsiness" },
    { label: "Delta", val: "<4 Hz, light sleep / pathological when awake" },
    { label: "Bipolar derivation", val: "Potential difference between pairs of scalp electrodes" },
    { label: "Referential derivation", val: "Individual scalp electrode vs. common reference" },
    { label: "10–20 System", val: "International electrode placement standard" },
  ];

  s.addText("Normal EEG Rhythms & Technique", {
    x: 6.05, y: 0.9, w: 3.8, h: 0.42,
    fontSize: 14, bold: true, color: C.orange, fontFace: "Calibri"
  });

  pts.forEach((pt, i) => {
    s.addShape(pres.ShapeType.rect, {
      x: 6.05, y: 1.38 + i * 0.51, w: 3.8, h: 0.47,
      fill: { color: i % 2 === 0 ? "FFF3E0" : C.white },
      line: { color: "F4A261", pt: 0.5 }
    });
    s.addText([
      { text: pt.label + ": ", options: { bold: true, color: C.darkText } },
      { text: pt.val, options: { color: "4A4A6A" } }
    ], {
      x: 6.15, y: 1.4 + i * 0.51, w: 3.65, h: 0.43,
      fontSize: 11, fontFace: "Calibri", valign: "middle", wrap: true
    });
  });
}

// ─── SLIDE 8: EEG IN SEIZURE DIAGNOSIS ───────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.navy } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.72, fill: { color: C.orange } });
  s.addText("EEG IN SEIZURE DIAGNOSIS", {
    x: 0.4, y: 0.1, w: 9.2, h: 0.55,
    fontSize: 24, bold: true, color: C.navy, fontFace: "Calibri"
  });

  // Seizure EEG page
  s.addImage({ path: `${IMGDIR}/page-11.png`, x: 0.25, y: 0.82, w: 5.5, h: 4.7 });

  // Caption
  s.addText("FIGURE 425-4: Electrographic Seizures", {
    x: 0.25, y: 5.35, w: 5.5, h: 0.25,
    fontSize: 9, italic: true, color: C.gray, fontFace: "Calibri"
  });

  const rows = [
    { label: "A. Tonic seizure", val: "Generalized repetitive sharp activity, synchronous onset over both hemispheres" },
    { label: "B. Focal seizure", val: "Burst of repetitive spikes in right temporal region — impairment of awareness" },
    { label: "C. Absence seizure", val: "Generalized 3-Hz spike-wave activity over both hemispheres" },
    { label: "Always abnormal", val: "EEG is always abnormal during generalized tonic-clonic seizures" },
    { label: "Interictal epileptiform", val: "Bursts of spikes / sharp waves — supportive but not definitive" },
    { label: "Sensitivity limit", val: "Initial routine interictal EEG may be normal in 50–80% of epilepsy cases" },
  ];

  s.addText("EEG Findings", {
    x: 5.95, y: 0.82, w: 3.9, h: 0.42,
    fontSize: 14, bold: true, color: C.gold, fontFace: "Calibri"
  });

  rows.forEach((r, i) => {
    s.addShape(pres.ShapeType.rect, {
      x: 5.95, y: 1.3 + i * 0.73, w: 3.9, h: 0.68,
      fill: { color: i % 2 === 0 ? "1A2B3C" : "0F1E2D" },
      line: { color: C.orange, pt: 0.5 }
    });
    s.addText([
      { text: r.label + "\n", options: { bold: true, color: C.gold, breakLine: true } },
      { text: r.val, options: { color: C.white } }
    ], {
      x: 6.05, y: 1.32 + i * 0.73, w: 3.75, h: 0.64,
      fontSize: 10.5, fontFace: "Calibri", valign: "top", wrap: true
    });
  });
}

// ─── SLIDE 9: EEG ACTIVATING PROCEDURES & VIDEO-EEG ─────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.lightBg } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.72, fill: { color: C.orange } });
  s.addText("EEG ACTIVATING PROCEDURES & ADVANCED MONITORING", {
    x: 0.4, y: 0.1, w: 9.2, h: 0.55,
    fontSize: 20, bold: true, color: C.white, fontFace: "Calibri"
  });

  // Activating procedures
  const procs = [
    { icon: "💨", title: "Hyperventilation", desc: "3–4 minutes of forced breathing" },
    { icon: "💡", title: "Photic Stimulation", desc: "Strobe light at varying frequencies" },
    { icon: "😴", title: "Sleep Recording", desc: "EEG recorded during natural sleep" },
    { icon: "🌙", title: "Sleep Deprivation", desc: "Night before the recording" },
  ];

  procs.forEach((p, i) => {
    const x = 0.3 + i * 2.4;
    s.addShape(pres.ShapeType.rect, { x, y: 0.88, w: 2.2, h: 1.8, fill: { color: "FFF3E0" }, line: { color: C.orange, pt: 1.5 } });
    s.addText(p.icon, { x, y: 0.95, w: 2.2, h: 0.55, fontSize: 28, align: "center" });
    s.addText(p.title, { x, y: 1.55, w: 2.2, h: 0.38, fontSize: 13, bold: true, color: C.orange, fontFace: "Calibri", align: "center" });
    s.addText(p.desc, { x, y: 1.93, w: 2.2, h: 0.65, fontSize: 11, color: C.darkText, fontFace: "Calibri", align: "center", wrap: true });
  });

  // Advanced monitoring
  const adv = [
    { title: "Video-EEG Telemetry", color: C.teal, desc: "Continuous monitoring in hospital — correlates clinical events with EEG. Standard approach for poorly characterized or refractory seizures." },
    { title: "Ambulatory EEG (≥24 h)", color: C.green, desc: "Portable continuous recording. Captures electrophysiologic correlates of clinical events during daily activities." },
    { title: "Magnetoencephalography (MEG)", color: C.teal, desc: "Measures magnetic fields generated by brain electrical activity. Source estimates plotted on MRI → Magnetic Source Image (MSI) to localize seizure foci." },
  ];

  adv.forEach((a, i) => {
    s.addShape(pres.ShapeType.rect, { x: 0.3, y: 2.9 + i * 0.88, w: 9.4, h: 0.8, fill: { color: "1A2B3C" }, line: { color: a.color, pt: 1.5 } });
    s.addShape(pres.ShapeType.rect, { x: 0.3, y: 2.9 + i * 0.88, w: 2.6, h: 0.8, fill: { color: a.color } });
    s.addText(a.title, { x: 0.35, y: 2.9 + i * 0.88, w: 2.5, h: 0.8, fontSize: 13, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle", wrap: true });
    s.addText(a.desc, { x: 3.1, y: 2.95 + i * 0.88, w: 6.45, h: 0.7, fontSize: 12, color: C.white, fontFace: "Calibri", valign: "middle", wrap: true });
  });
}

// ─── SLIDE 10: BRAIN IMAGING ─────────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.navy } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.72, fill: { color: C.red } });
  s.addText("NEUROIMAGING IN EPILEPSY", {
    x: 0.4, y: 0.1, w: 9.2, h: 0.55,
    fontSize: 24, bold: true, color: C.white, fontFace: "Calibri"
  });

  // Brain MRI image from PDF
  s.addImage({ path: `${IMGDIR}/page-10.png`, x: 0.25, y: 0.82, w: 5.0, h: 4.65 });

  s.addText("FIGURE 425-5: Brain MRI findings relevant to epilepsy", {
    x: 0.25, y: 5.35, w: 5.0, h: 0.25,
    fontSize: 9, italic: true, color: C.gray, fontFace: "Calibri"
  });

  const imgs = [
    { title: "MRI", color: C.red, sub: "First choice", pts: ["Superior to CT for cerebral lesions", "3D imaging at submillimeter resolution", "Detects hippocampal atrophy (mesial temporal sclerosis)", "Cortical architecture abnormalities", "Neuronal migration disorders"] },
    { title: "CT", color: C.orange, sub: "Emergency fallback", pts: ["Used emergently when MRI unavailable", "Detects tumors, bleeds, mass lesions", "Less sensitive than MRI for epilepsy lesions"] },
    { title: "PET / SPECT", color: C.teal, sub: "Functional imaging", pts: ["Medically refractory seizures", "Identify hypometabolic seizure foci (PET)", "Ictal perfusion changes (SPECT)"] },
  ];

  imgs.forEach((im, i) => {
    const y = 0.82 + i * 1.6;
    s.addShape(pres.ShapeType.rect, { x: 5.5, y, w: 4.25, h: 1.5, fill: { color: "0D1B2A" }, line: { color: im.color, pt: 1.5 } });
    s.addShape(pres.ShapeType.rect, { x: 5.5, y, w: 1.1, h: 1.5, fill: { color: im.color } });
    s.addText(im.title, { x: 5.5, y: y + 0.3, w: 1.1, h: 0.5, fontSize: 18, bold: true, color: C.white, fontFace: "Calibri", align: "center" });
    s.addText(im.sub, { x: 5.5, y: y + 0.82, w: 1.1, h: 0.45, fontSize: 9, color: C.white, fontFace: "Calibri", align: "center", wrap: true });
    im.pts.forEach((pt, pi) => {
      s.addText("• " + pt, {
        x: 6.7, y: y + 0.05 + pi * 0.27, w: 2.95, h: 0.27,
        fontSize: 10.5, color: C.white, fontFace: "Calibri"
      });
    });
  });
}

// ─── SLIDE 11: GENETIC TESTING ───────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.lightBg } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.72, fill: { color: C.teal } });
  s.addText("GENETIC TESTING IN EPILEPSY", {
    x: 0.4, y: 0.1, w: 9.2, h: 0.55,
    fontSize: 24, bold: true, color: C.white, fontFace: "Calibri"
  });

  // Left: when to test
  s.addShape(pres.ShapeType.rect, { x: 0.3, y: 0.88, w: 4.4, h: 4.65, fill: { color: C.navy }, line: { color: C.teal, pt: 1.5 } });
  s.addText("WHEN TO CONSIDER GENETIC TESTING", {
    x: 0.35, y: 0.95, w: 4.3, h: 0.5,
    fontSize: 13, bold: true, color: C.gold, fontFace: "Calibri", align: "center"
  });
  const when = [
    "Infants and children with epilepsy syndromes thought to have a genetic cause",
    "Older patients with undiagnosed genetic epilepsy syndrome that began early in life",
    "Patients with rapidly progressing or fulminant epilepsy onset",
    "Dravet syndrome — sodium channel gene mutations (SCN1A)",
    "Lennox-Gastaut syndrome",
    "Any epilepsy + psychiatric symptoms / cognitive decline",
  ];
  when.forEach((w, i) => {
    s.addShape(pres.ShapeType.rect, {
      x: 0.35, y: 1.55 + i * 0.6, w: 4.3, h: 0.52,
      fill: { color: i % 2 === 0 ? "1A2B3C" : "0D1B2A" }
    });
    s.addText("• " + w, {
      x: 0.45, y: 1.57 + i * 0.6, w: 4.1, h: 0.48,
      fontSize: 11, color: C.white, fontFace: "Calibri", valign: "middle", wrap: true
    });
  });

  // Right: benefits
  s.addShape(pres.ShapeType.rect, { x: 5.0, y: 0.88, w: 4.7, h: 4.65, fill: { color: "E8F9F5" }, line: { color: C.green, pt: 1.5 } });
  s.addText("BENEFITS OF GENETIC DIAGNOSIS", {
    x: 5.05, y: 0.95, w: 4.6, h: 0.5,
    fontSize: 13, bold: true, color: C.green, fontFace: "Calibri", align: "center"
  });
  const benefits = [
    { icon: "✅", text: "Provides definitive diagnosis" },
    { icon: "🧬", text: "Guides specific therapeutic options" },
    { icon: "👨‍👩‍👧", text: "Benefits patient & family members" },
    { icon: "🛑", text: "Avoids unrevealing additional tests" },
    { icon: "💊", text: "Informs selection of antiseizure drugs", note: "(e.g. avoid sodium channel blockers in SCN1A gain-of-function)" },
  ];
  benefits.forEach((b, i) => {
    s.addText(b.icon, { x: 5.05, y: 1.55 + i * 0.72, w: 0.6, h: 0.62, fontSize: 22, align: "center" });
    s.addText(b.text + (b.note ? "\n" + b.note : ""), {
      x: 5.65, y: 1.55 + i * 0.72, w: 3.95, h: 0.62,
      fontSize: 12, color: C.darkText, fontFace: "Calibri", valign: "middle", wrap: true
    });
  });
}

// ─── SLIDE 12: DIFFERENTIAL DIAGNOSIS ───────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.navy } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.72, fill: { color: C.teal } });
  s.addText("DIFFERENTIAL DIAGNOSIS OF SEIZURES", {
    x: 0.4, y: 0.1, w: 9.2, h: 0.55,
    fontSize: 24, bold: true, color: C.white, fontFace: "Calibri"
  });

  // Table image from PDF page 13 (table 425-6)
  s.addImage({ path: `${IMGDIR}/page-13.png`, x: 0.25, y: 0.82, w: 4.9, h: 4.7 });

  // Right side columns
  const cats = [
    { title: "Syncope", color: C.orange, features: ["Triggered by pain/emotional stress or orthostatic change", "Tiredness, sweating, nausea, tunnel vision pre-syncopal", "Brief LOC with rapid recovery", "Brief 1–10 s convulsive motor activity possible at onset", "Less postictal confusion vs. seizure"] },
    { title: "Psychogenic Seizures", color: C.red, features: ["Side-to-side head turning, ictal eye closure", "Asymmetric large-amplitude limb shaking", "Twitching all four limbs without LOC", "Pelvic thrusting", "Often longer than epileptic seizures; wax and wane over minutes–hours", "Video-EEG is gold standard to distinguish"] },
  ];

  cats.forEach((cat, ci) => {
    const y = 0.82 + ci * 2.45;
    s.addShape(pres.ShapeType.rect, { x: 5.35, y, w: 4.4, h: 2.3, fill: { color: "0D1B2A" }, line: { color: cat.color, pt: 2 } });
    s.addShape(pres.ShapeType.rect, { x: 5.35, y, w: 4.4, h: 0.4, fill: { color: cat.color } });
    s.addText(cat.title, { x: 5.4, y, w: 4.3, h: 0.4, fontSize: 14, bold: true, color: C.white, fontFace: "Calibri", valign: "middle" });
    cat.features.forEach((f, fi) => {
      s.addText("• " + f, {
        x: 5.45, y: y + 0.45 + fi * 0.36, w: 4.2, h: 0.35,
        fontSize: 10.5, color: C.white, fontFace: "Calibri", wrap: true
      });
    });
  });
}

// ─── SLIDE 13: SEIZURE VS SYNCOPE TABLE ─────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.lightBg } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.72, fill: { color: C.navy } });
  s.addText("SEIZURE vs SYNCOPE — KEY DISTINGUISHING FEATURES", {
    x: 0.4, y: 0.1, w: 9.2, h: 0.55,
    fontSize: 18, bold: true, color: C.white, fontFace: "Calibri"
  });

  // Table from PDF page 15
  s.addImage({ path: `${IMGDIR}/page-15.png`, x: 0.25, y: 0.82, w: 9.5, h: 4.65 });
}

// ─── SLIDE 14: TREATMENT OVERVIEW ───────────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.navy } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.72, fill: { color: C.green } });
  s.addText("TREATMENT APPROACH — OVERVIEW", {
    x: 0.4, y: 0.1, w: 9.2, h: 0.55,
    fontSize: 24, bold: true, color: C.white, fontFace: "Calibri"
  });

  const pillars = [
    { icon: "🎯", title: "Treat underlying cause", color: C.teal, desc: "Address conditions that cause or contribute to seizures" },
    { icon: "🚫", title: "Avoid precipitating factors", color: C.orange, desc: "Sleep deprivation, alcohol, specific drugs, metabolic triggers" },
    { icon: "💊", title: "Antiseizure medications", color: C.green, desc: "Prophylactic pharmacotherapy — individualized based on seizure type" },
    { icon: "🔪", title: "Surgery", color: C.red, desc: "Surgical resection for refractory focal epilepsy" },
    { icon: "🧠", title: "Psychological & social support", color: C.gold, desc: "Comprehensive psychosocial management is essential" },
  ];

  pillars.forEach((p, i) => {
    const x = 0.3 + i * 1.88;
    s.addShape(pres.ShapeType.rect, { x, y: 0.88, w: 1.7, h: 3.8, fill: { color: "0D1B2A" }, line: { color: p.color, pt: 2 } });
    s.addShape(pres.ShapeType.rect, { x, y: 0.88, w: 1.7, h: 0.38, fill: { color: p.color } });
    s.addText(p.icon, { x, y: 1.35, w: 1.7, h: 0.6, fontSize: 28, align: "center" });
    s.addText(p.title, { x, y: 2.0, w: 1.7, h: 0.55, fontSize: 12, bold: true, color: p.color, fontFace: "Calibri", align: "center", wrap: true });
    s.addText(p.desc, { x: x + 0.08, y: 2.6, w: 1.55, h: 2.0, fontSize: 11, color: C.white, fontFace: "Calibri", align: "center", wrap: true });
  });

  s.addText("Drug Mechanism Classes:", {
    x: 0.3, y: 4.82, w: 4.5, h: 0.38,
    fontSize: 12, bold: true, color: C.gold, fontFace: "Calibri"
  });
  s.addText("Na⁺ channel blockade  •  GABA potentiation  •  GABA availability  •  T-type Ca²⁺ inhibition  •  Synaptic vesicle modulation (SV2A)",
    { x: 0.3, y: 5.2, w: 9.4, h: 0.35, fontSize: 11, color: C.white, fontFace: "Calibri" });
}

// ─── SLIDE 15: SUMMARY ──────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.navy } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.06, fill: { color: C.teal } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 5.565, w: "100%", h: 0.06, fill: { color: C.gold } });

  s.addText("SUMMARY", {
    x: 0.4, y: 0.3, w: 9.2, h: 0.65,
    fontSize: 36, bold: true, color: C.gold, fontFace: "Calibri", charSpacing: 4
  });
  s.addText("Investigation of Epilepsy & Seizure", {
    x: 0.4, y: 0.95, w: 9.2, h: 0.5,
    fontSize: 18, color: C.teal, fontFace: "Calibri"
  });
  s.addShape(pres.ShapeType.rect, { x: 0.4, y: 1.5, w: 9.2, h: 0.04, fill: { color: C.gold } });

  const summary = [
    { step: "Step 1", text: "Stabilize patient — vitals, airway, cardiovascular support, rule out emergencies" },
    { step: "Step 2", text: "Detailed history — episode characterization, risk factors, precipitants, family history" },
    { step: "Step 3", text: "Neurological exam — mental status, visual fields, motor and sensory signs" },
    { step: "Step 4", text: "Lab studies — electrolytes, glucose, Ca/Mg, liver/renal, toxicology, LP, autoantibodies" },
    { step: "Step 5", text: "EEG — as soon as possible; activating procedures; video-EEG telemetry for refractory cases" },
    { step: "Step 6", text: "MRI (preferred) or CT brain — identify structural lesions, MTS, cortical dysplasia" },
    { step: "Step 7", text: "Genetic testing — in infants, children, and where genetic syndrome suspected" },
  ];

  summary.forEach((sm, i) => {
    s.addShape(pres.ShapeType.rect, {
      x: 0.4, y: 1.65 + i * 0.54, w: 9.2, h: 0.48,
      fill: { color: i % 2 === 0 ? "1A2B3C" : "0F1E2D" }
    });
    s.addShape(pres.ShapeType.rect, { x: 0.4, y: 1.65 + i * 0.54, w: 0.8, h: 0.48, fill: { color: C.teal } });
    s.addText(sm.step, {
      x: 0.4, y: 1.65 + i * 0.54, w: 0.8, h: 0.48,
      fontSize: 11, bold: true, color: C.white, fontFace: "Calibri",
      align: "center", valign: "middle"
    });
    s.addText(sm.text, {
      x: 1.3, y: 1.65 + i * 0.54, w: 8.2, h: 0.48,
      fontSize: 12, color: C.white, fontFace: "Calibri", valign: "middle"
    });
  });

  s.addText("Source: Harrison's Principles of Internal Medicine, Chapter 425", {
    x: 0.4, y: 5.32, w: 9.2, h: 0.28,
    fontSize: 10, italic: true, color: C.gray, fontFace: "Calibri", align: "right"
  });
}

// ─── WRITE FILE ──────────────────────────────────────────────────────────────
const outPath = "/home/daytona/workspace/epilepsy-pptx/Epilepsy_Investigation.pptx";
pres.writeFile({ fileName: outPath }).then(() => {
  console.log("Saved:", outPath);
}).catch(err => {
  console.error("Error:", err);
});
Running Command

cd /home/daytona/workspace/epilepsy-pptx && node build.js 2>&1

Running Command

ls -lh /home/daytona/workspace/epilepsy-pptx/Epilepsy_Investigation.pptx

Your presentation is ready! Download it here:

Epilepsy Investigation

Presentation · PPTX


What's inside (15 slides, sourced entirely from your PDF):
SlideContent
1Title slide - dark navy theme with embedded brain MRI image from the PDF
2Investigation Overview - numbered roadmap of all 7 investigation steps
3First Priorities - vital signs, resuscitation, 3 key questions for first seizure
4Evaluation Flowchart - the actual Fig. 425-2 flowchart from your PDF + annotated key steps
5History & Neurological Examination - side-by-side two-column layout
6Laboratory Studies - 4 boxed categories (routine bloods, toxicology, LP, autoantibodies)
7EEG Basics - actual EEG traces image from the PDF (Fig. 425-3) + alpha/beta/theta/delta guide
8EEG in Seizure Diagnosis - electrographic seizure patterns image (Fig. 425-4) + tonic/focal/absence EEG findings
9Activating Procedures & Advanced Monitoring - hyperventilation, photic, sleep deprivation, video-EEG, MEG
10Neuroimaging - brain MRI image from PDF + MRI vs CT vs PET/SPECT comparison
11Genetic Testing - when to test, benefits, specific syndromes (Dravet, Lennox-Gastaut)
12Differential Diagnosis - Table 425-6 image + syncope vs psychogenic seizures
13Seizure vs Syncope - Table 425-7 image full-slide for comparing distinguishing features
14Treatment Overview - 5 pillars: treat cause, avoid triggers, medications, surgery, psychosocial
15Summary - 7-step investigation checklist with source citation
All images (EEG traces, brain MRI, flowchart, differential diagnosis tables) are taken directly from the rendered PDF pages.
This is a shared conversation. Sign in to Orris to start your own chat.