Speech ppt 60-70 in clean white slides from Dejong & bradely and other sources for neurology resident

Asking for Preferences
Reading File
Reading File
Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Running Command

mkdir -p /home/daytona/workspace/speech-pptx && ls /home/daytona/workspace/speech-pptx/

Writing File

~/speech-pptx/speech_neuro.js

const pptxgen = require("pptxgenjs");
const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Speech in Neurology";
pres.author = "Neurology Education";

// ── Design tokens ──────────────────────────────────────────────────────────────
const C = {
  white:   "FFFFFF",
  navy:    "1B3A5C",
  teal:    "1D7E8C",
  accent:  "E8F4F7",
  text:    "1A1A2E",
  muted:   "5A6A7A",
  gold:    "C8973A",
  lightLine: "D6E4EC",
  tableHead: "1B3A5C",
  tableAlt:  "EFF6FA",
};

const FONT = "Calibri";

// Helper: slide background
function bg(slide) {
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.white }, line: { color: C.white } });
}

// Helper: left accent bar
function accentBar(slide, color) {
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.12, h: 5.625, fill: { color: color || C.teal }, line: { color: color || C.teal } });
}

// Helper: slide header band
function headerBand(slide, label) {
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.95, fill: { color: C.navy }, line: { color: C.navy } });
  if (label) {
    slide.addText(label.toUpperCase(), {
      x: 0.3, y: 0, w: 9.4, h: 0.95,
      fontSize: 9, fontFace: FONT, color: "A8C8D8", bold: true,
      valign: "middle", charSpacing: 3,
    });
  }
}

// Helper: slide title below header
function slideTitle(slide, title, opts) {
  slide.addText(title, Object.assign({
    x: 0.3, y: 1.0, w: 9.4, h: 0.55,
    fontSize: 20, fontFace: FONT, bold: true, color: C.navy,
  }, opts || {}));
}

// Helper: divider line
function divider(slide, y) {
  slide.addShape(pres.ShapeType.line, { x: 0.3, y: y, w: 9.4, h: 0, line: { color: C.lightLine, width: 1 } });
}

// Helper: footer
function footer(slide, src) {
  slide.addText(src || "Bradley & Daroff's Neurology in Clinical Practice | DeJong's Neurological Examination", {
    x: 0.2, y: 5.3, w: 9.6, h: 0.28,
    fontSize: 7, fontFace: FONT, color: C.muted, italic: true, align: "center",
  });
}

// Helper: bullet block
function bullets(slide, items, opts) {
  const rows = items.map((item, i) => {
    if (typeof item === "string") {
      return { text: item, options: { bullet: true, breakLine: i < items.length - 1, fontSize: 13, fontFace: FONT, color: C.text, paraSpaceAfter: 4 } };
    }
    return item;
  });
  slide.addText(rows, Object.assign({ x: 0.4, y: 1.7, w: 9.2, h: 3.4 }, opts || {}));
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 1 — Title slide
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  // Deep navy full background
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.navy }, line: { color: C.navy } });
  // Teal accent strip top
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.12, fill: { color: C.teal }, line: { color: C.teal } });
  // Teal accent strip bottom
  s.addShape(pres.ShapeType.rect, { x: 0, y: 5.5, w: 10, h: 0.125, fill: { color: C.teal }, line: { color: C.teal } });
  // Decorative circle (right side)
  s.addShape(pres.ShapeType.ellipse, { x: 7.2, y: 0.5, w: 3.5, h: 3.5, fill: { color: "1C4060" }, line: { color: "1C4060" } });
  s.addShape(pres.ShapeType.ellipse, { x: 7.6, y: 0.9, w: 2.7, h: 2.7, fill: { color: "1B3A5C" }, line: { color: "1B3A5C" } });

  s.addText("SPEECH IN NEUROLOGY", {
    x: 0.5, y: 1.2, w: 7, h: 0.7,
    fontSize: 30, fontFace: FONT, bold: true, color: C.white, charSpacing: 2,
  });
  s.addText("Motor Speech Disorders & Aphasia", {
    x: 0.5, y: 1.95, w: 7, h: 0.5,
    fontSize: 16, fontFace: FONT, color: "A8C8D8", italic: false,
  });
  divider: s.addShape(pres.ShapeType.line, { x: 0.5, y: 2.55, w: 4.5, h: 0, line: { color: C.teal, width: 2 } });
  s.addText("For Neurology Residents", {
    x: 0.5, y: 2.7, w: 5, h: 0.35,
    fontSize: 12, fontFace: FONT, color: "7FAFC8",
  });
  s.addText("Based on Bradley & Daroff's Neurology in Clinical Practice\n& Adams and Victor's Principles of Neurology", {
    x: 0.5, y: 4.6, w: 9, h: 0.7,
    fontSize: 9, fontFace: FONT, color: "7FAFC8", italic: true,
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 2 — Overview / outline
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  bg(s); accentBar(s); headerBand(s, "Overview"); footer(s);
  slideTitle(s, "Topics Covered");
  divider(s, 1.62);

  const topics = [
    ["1", "Introduction — What is a Motor Speech Disorder?"],
    ["2", "Speech Examination at the Bedside"],
    ["3", "Dysarthria — Definition & Classification"],
    ["4", "Types of Dysarthria (Flaccid, Spastic, Ataxic)"],
    ["5", "Types of Dysarthria (Hypokinetic, Hyperkinetic, Mixed)"],
    ["6", "Apraxia of Speech"],
    ["7", "Oral / Buccolingual Apraxia"],
    ["8", "Rare Motor Speech Disorders"],
    ["9", "Aphasia — Introduction & Bedside Testing"],
    ["10", "Broca Aphasia"],
    ["11", "Wernicke Aphasia"],
    ["12", "Global Aphasia"],
    ["13", "Conduction Aphasia"],
    ["14", "Transcortical Aphasias & Anomic Aphasia"],
    ["15", "Aphasia Syndromes — Comparison Table"],
    ["16", "Localization of Lesions"],
    ["17", "Aphasia vs. Motor Speech Disorder"],
    ["18", "Management & Rehabilitation"],
    ["19", "Clinical Pearls"],
    ["20", "Key Takeaways"],
  ];

  // Two-column layout
  const col1 = topics.slice(0, 10);
  const col2 = topics.slice(10);

  const makeColItems = (arr) => arr.map((t, i) => [
    { text: t[0] + ".", options: { bold: true, color: C.teal, fontSize: 11, fontFace: FONT } },
    { text: "  " + t[1], options: { color: C.text, fontSize: 11, fontFace: FONT, breakLine: i < arr.length - 1 } },
  ]).flat();

  s.addText(makeColItems(col1), { x: 0.35, y: 1.75, w: 4.5, h: 3.5 });
  s.addText(makeColItems(col2), { x: 5.1, y: 1.75, w: 4.5, h: 3.5 });
  // Vertical divider
  s.addShape(pres.ShapeType.line, { x: 5.0, y: 1.75, w: 0, h: 3.5, line: { color: C.lightLine, width: 1 } });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 3 — Introduction: Motor Speech Disorders
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  bg(s); accentBar(s); headerBand(s, "Introduction"); footer(s);
  slideTitle(s, "Motor Speech Disorders — Key Concepts");
  divider(s, 1.62);

  s.addText([
    { text: "Definition", options: { bold: true, color: C.teal, fontSize: 14, fontFace: FONT, breakLine: true } },
    { text: "Syndromes of abnormal articulation WITHOUT abnormalities of language", options: { color: C.text, fontSize: 13, fontFace: FONT, breakLine: true, paraSpaceAfter: 8 } },
    { text: "Core rule: ", options: { bold: true, color: C.navy, fontSize: 13, fontFace: FONT } },
    { text: "If you transcribe the patient's speech into text → it reads as normal language", options: { color: C.text, fontSize: 13, fontFace: FONT, breakLine: true, paraSpaceAfter: 8 } },
    { text: "Conditions preserved in motor speech disorders:", options: { bold: true, color: C.navy, fontSize: 13, fontFace: FONT, breakLine: true } },
    { text: "Normal expressive language in writing", options: { bullet: { code: "2022", color: C.teal }, color: C.text, fontSize: 12, fontFace: FONT, indentLevel: 1, breakLine: true } },
    { text: "Normal comprehension of spoken and written language", options: { bullet: { code: "2022", color: C.teal }, color: C.text, fontSize: 12, fontFace: FONT, indentLevel: 1, breakLine: true, paraSpaceAfter: 8 } },
    { text: "Categories (Bradley & Daroff, Ch.14):", options: { bold: true, color: C.navy, fontSize: 13, fontFace: FONT, breakLine: true } },
    { text: "Dysarthrias (46.3% of speech/language disorders at Mayo Clinic)", options: { bullet: { code: "2022", color: C.teal }, color: C.text, fontSize: 12, fontFace: FONT, indentLevel: 1, breakLine: true } },
    { text: "Apraxia of Speech (4.6%)", options: { bullet: { code: "2022", color: C.teal }, color: C.text, fontSize: 12, fontFace: FONT, indentLevel: 1, breakLine: true } },
    { text: "Rare syndromes: Aphemia, Foreign Accent Syndrome, Acquired Stuttering, Opercular Syndrome", options: { bullet: { code: "2022", color: C.teal }, color: C.text, fontSize: 12, fontFace: FONT, indentLevel: 1 } },
  ], { x: 0.35, y: 1.7, w: 9.3, h: 3.65 });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 4 — Bedside Examination of Speech
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  bg(s); accentBar(s); headerBand(s, "Examination"); footer(s);
  slideTitle(s, "Bedside Speech Examination");
  divider(s, 1.62);

  // 2-column layout: what to test vs what to observe
  s.addShape(pres.ShapeType.rect, { x: 0.25, y: 1.7, w: 4.45, h: 3.5, fill: { color: C.accent }, line: { color: C.lightLine } });
  s.addShape(pres.ShapeType.rect, { x: 5.3, y: 1.7, w: 4.45, h: 3.5, fill: { color: "F0FBF5" }, line: { color: C.lightLine } });

  s.addText("What to Test", { x: 0.3, y: 1.72, w: 4.3, h: 0.4, fontSize: 13, fontFace: FONT, bold: true, color: C.navy });
  s.addText([
    { text: "Repeat syllables, words, sentences", options: { bullet: true, breakLine: true, fontSize: 12, fontFace: FONT, color: C.text } },
    { text: "Single consonant repetition  /p/, /p/, /p/", options: { bullet: true, breakLine: true, fontSize: 12, fontFace: FONT, color: C.text } },
    { text: "Consonant shift  /p/, /t/, /k/ (diadochokinesis)", options: { bullet: true, breakLine: true, fontSize: 12, fontFace: FONT, color: C.text } },
    { text: "Polysyllabic words: 'catastrophe', 'television'", options: { bullet: true, breakLine: true, fontSize: 12, fontFace: FONT, color: C.text } },
    { text: "Repeat same word 5× → reveals inconsistency in apraxia", options: { bullet: true, breakLine: true, fontSize: 12, fontFace: FONT, color: C.text } },
    { text: "Fluency, comprehension, naming, repetition, reading, writing (aphasia battery)", options: { bullet: true, fontSize: 12, fontFace: FONT, color: C.text } },
  ], { x: 0.35, y: 2.15, w: 4.2, h: 3.0 });

  s.addText("What to Observe", { x: 5.35, y: 1.72, w: 4.3, h: 0.4, fontSize: 13, fontFace: FONT, bold: true, color: C.navy });
  s.addText([
    { text: "Rate & rhythm (slow, fast, irregular)", options: { bullet: true, breakLine: true, fontSize: 12, fontFace: FONT, color: C.text } },
    { text: "Voice quality (harsh, breathy, nasal, strained)", options: { bullet: true, breakLine: true, fontSize: 12, fontFace: FONT, color: C.text } },
    { text: "Articulation (consonant distortion vs. substitution)", options: { bullet: true, breakLine: true, fontSize: 12, fontFace: FONT, color: C.text } },
    { text: "Prosody / melody", options: { bullet: true, breakLine: true, fontSize: 12, fontFace: FONT, color: C.text } },
    { text: "Consistency of errors (consistent = dysarthria; inconsistent = apraxia)", options: { bullet: true, breakLine: true, fontSize: 12, fontFace: FONT, color: C.text } },
    { text: "Associated signs: facial droop, tongue weakness, palatal movement, jaw jerk, gag reflex", options: { bullet: true, fontSize: 12, fontFace: FONT, color: C.text } },
  ], { x: 5.4, y: 2.15, w: 4.2, h: 3.0 });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 5 — Dysarthria: Definition & Classification
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  bg(s); accentBar(s); headerBand(s, "Motor Speech — Dysarthria"); footer(s);
  slideTitle(s, "Dysarthria — Definition & Classification");
  divider(s, 1.62);

  s.addText([
    { text: "Definition ", options: { bold: true, color: C.teal, fontSize: 14, fontFace: FONT } },
    { text: "(Duffy, 1995)", options: { italic: true, color: C.muted, fontSize: 12, fontFace: FONT, breakLine: true } },
    { text: "Abnormal neuromuscular activation of speech muscles affecting speed, strength, timing, range, or accuracy. Most consistent finding: ", options: { color: C.text, fontSize: 12, fontFace: FONT } },
    { text: "distortion of consonant sounds.", options: { bold: true, color: C.navy, fontSize: 12, fontFace: FONT, breakLine: true, paraSpaceAfter: 6 } },
    { text: "Neurogenic", options: { bold: true, color: C.navy, fontSize: 12, fontFace: FONT } },
    { text: " — CNS, PNS, NMJ, or muscle dysfunction (NOT local structural palate/tongue/larynx problems)", options: { color: C.text, fontSize: 12, fontFace: FONT, breakLine: true, paraSpaceAfter: 6 } },
    { text: "Affected domains: ", options: { bold: true, color: C.navy, fontSize: 12, fontFace: FONT } },
    { text: "Articulation • Phonation • Breathing • Prosody", options: { color: C.text, fontSize: 12, fontFace: FONT, breakLine: true, paraSpaceAfter: 6 } },
    { text: "Complete loss of articulation = ", options: { color: C.text, fontSize: 12, fontFace: FONT } },
    { text: "Anarthria", options: { bold: true, color: C.teal, fontSize: 12, fontFace: FONT, breakLine: true, paraSpaceAfter: 8 } },
    { text: "Mayo Clinic Classification (Duffy, 1995) — 6 Types:", options: { bold: true, color: C.navy, fontSize: 13, fontFace: FONT, breakLine: true } },
  ], { x: 0.35, y: 1.7, w: 9.3, h: 2.2 });

  // 6-box grid
  const types = [
    { label: "Flaccid", sublabel: "LMN / NMJ / Muscle", color: "E8F4F7" },
    { label: "Spastic", sublabel: "Bilateral UMN", color: "EDF7ED" },
    { label: "Ataxic", sublabel: "Cerebellum", color: "FFF8E8" },
    { label: "Hypokinetic", sublabel: "Basal Ganglia (PD)", color: "F7EEF7" },
    { label: "Hyperkinetic", sublabel: "Basal Ganglia", color: "FEF3F0" },
    { label: "Mixed", sublabel: "Multiple systems", color: "F0F0F7" },
  ];
  types.forEach((t, i) => {
    const col = i % 3;
    const row = Math.floor(i / 3);
    const x = 0.3 + col * 3.15;
    const y = 3.85 + row * 0.85;
    s.addShape(pres.ShapeType.roundRect, { x, y, w: 3.0, h: 0.75, fill: { color: t.color }, line: { color: C.lightLine }, rectRadius: 0.05 });
    s.addText(t.label, { x: x + 0.1, y: y + 0.03, w: 2.8, h: 0.35, fontSize: 13, fontFace: FONT, bold: true, color: C.navy });
    s.addText(t.sublabel, { x: x + 0.1, y: y + 0.38, w: 2.8, h: 0.3, fontSize: 10, fontFace: FONT, color: C.muted });
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 6 — Dysarthria Types Part 1 (Flaccid, Spastic, Ataxic)
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  bg(s); accentBar(s); headerBand(s, "Dysarthria Types (1/2)"); footer(s);
  slideTitle(s, "Flaccid • Spastic • Ataxic Dysarthria");
  divider(s, 1.62);

  const rowData = [
    { type: "Flaccid", lesion: "LMN, NMJ, muscle", speech: "Breathy, nasal; indistinct consonants; fatigable", examples: "MG, polymyositis, bulbar polio, GBS", color: "E8F4F7" },
    { type: "Spastic", lesion: "Bilateral corticobulbar / motor cortex", speech: "Harsh, 'strain-strangle'; slow rate; low pitch; consonant errors", examples: "Bilateral strokes, ALS (pseudobulbar palsy)", color: "EDF7ED" },
    { type: "Unilateral UMN", lesion: "Unilateral UMN lesion", speech: "Milder spastic pattern; very common after unilateral stroke", examples: "Unilateral hemispheric stroke", color: "F5F7ED" },
    { type: "Ataxic", lesion: "Cerebellum", speech: "'Scanning speech': explosive syllables with pauses OR equal stress on every syllable; irregular /p/ repetition", examples: "MS, cerebellar ataxias, alcohol", color: "FFF8E8" },
  ];

  // Header row
  const headers = ["Type", "Lesion Site", "Speech Character", "Causes"];
  const colW = [1.5, 2.2, 3.5, 2.3];
  const startX = [0.25, 1.8, 4.05, 7.6];
  const headerY = 1.72;

  headers.forEach((h, i) => {
    s.addShape(pres.ShapeType.rect, { x: startX[i], y: headerY, w: colW[i], h: 0.4, fill: { color: C.navy }, line: { color: C.navy } });
    s.addText(h, { x: startX[i] + 0.05, y: headerY, w: colW[i] - 0.1, h: 0.4, fontSize: 11, fontFace: FONT, bold: true, color: C.white, valign: "middle" });
  });

  rowData.forEach((r, ri) => {
    const y = 2.15 + ri * 0.78;
    const vals = [r.type, r.lesion, r.speech, r.examples];
    vals.forEach((v, ci) => {
      s.addShape(pres.ShapeType.rect, { x: startX[ci], y, w: colW[ci], h: 0.76, fill: { color: ri % 2 === 0 ? r.color : "FAFCFF" }, line: { color: C.lightLine } });
      s.addText(v, { x: startX[ci] + 0.05, y: y + 0.05, w: colW[ci] - 0.1, h: 0.66, fontSize: 10, fontFace: FONT, color: ci === 0 ? C.navy : C.text, bold: ci === 0, valign: "middle" });
    });
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 7 — Dysarthria Types Part 2 (Hypokinetic, Hyperkinetic, Mixed)
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  bg(s); accentBar(s); headerBand(s, "Dysarthria Types (2/2)"); footer(s);
  slideTitle(s, "Hypokinetic • Hyperkinetic • Mixed Dysarthria");
  divider(s, 1.62);

  // Hypokinetic box
  s.addShape(pres.ShapeType.rect, { x: 0.25, y: 1.7, w: 4.55, h: 1.7, fill: { color: "F7EEF7" }, line: { color: C.lightLine } });
  s.addText("Hypokinetic Dysarthria", { x: 0.35, y: 1.72, w: 4.3, h: 0.38, fontSize: 13, fontFace: FONT, bold: true, color: C.navy });
  s.addText([
    { text: "Lesion: ", options: { bold: true, color: C.navy, fontSize: 11, fontFace: FONT } },
    { text: "Basal ganglia (especially substantia nigra → Parkinson disease)", options: { color: C.text, fontSize: 11, fontFace: FONT, breakLine: true } },
    { text: "Speech: ", options: { bold: true, color: C.navy, fontSize: 11, fontFace: FONT } },
    { text: "Hypophonic (very soft), rapid rate (festination of speech), monotone, reduced loudness, mumbling", options: { color: C.text, fontSize: 11, fontFace: FONT, breakLine: true } },
    { text: "Also: ", options: { bold: true, color: C.navy, fontSize: 11, fontFace: FONT } },
    { text: "Progressive supranuclear palsy, MSA", options: { color: C.text, fontSize: 11, fontFace: FONT } },
  ], { x: 0.35, y: 2.12, w: 4.3, h: 1.25 });

  // Hyperkinetic box
  s.addShape(pres.ShapeType.rect, { x: 5.2, y: 1.7, w: 4.55, h: 1.7, fill: { color: "FEF3F0" }, line: { color: C.lightLine } });
  s.addText("Hyperkinetic Dysarthria", { x: 5.3, y: 1.72, w: 4.3, h: 0.38, fontSize: 13, fontFace: FONT, bold: true, color: C.navy });
  s.addText([
    { text: "Lesion: ", options: { bold: true, color: C.navy, fontSize: 11, fontFace: FONT } },
    { text: "Basal ganglia (abnormal involuntary movements)", options: { color: C.text, fontSize: 11, fontFace: FONT, breakLine: true } },
    { text: "Speech: ", options: { bold: true, color: C.navy, fontSize: 11, fontFace: FONT } },
    { text: "Involuntary intrusions, variable rate & pitch, voice arrests, excess loudness variations", options: { color: C.text, fontSize: 11, fontFace: FONT, breakLine: true } },
    { text: "Also: ", options: { bold: true, color: C.navy, fontSize: 11, fontFace: FONT } },
    { text: "Huntington disease, dystonia, Tourette's, myoclonus", options: { color: C.text, fontSize: 11, fontFace: FONT } },
  ], { x: 5.3, y: 2.12, w: 4.3, h: 1.25 });

  // Mixed box
  s.addShape(pres.ShapeType.rect, { x: 0.25, y: 3.55, w: 9.5, h: 1.5, fill: { color: "F0F0F7" }, line: { color: C.lightLine } });
  s.addText("Mixed Dysarthria", { x: 0.35, y: 3.57, w: 9.2, h: 0.38, fontSize: 13, fontFace: FONT, bold: true, color: C.navy });
  s.addText([
    { text: "Combination of two or more dysarthria types. Most important examples:", options: { color: C.text, fontSize: 12, fontFace: FONT, breakLine: true } },
    { text: "ALS: ", options: { bold: true, color: C.navy, fontSize: 12, fontFace: FONT } },
    { text: "Mixed spastic + flaccid (bulbar + pseudobulbar features simultaneously)", options: { color: C.text, fontSize: 12, fontFace: FONT, breakLine: true } },
    { text: "Wilson disease: ", options: { bold: true, color: C.navy, fontSize: 12, fontFace: FONT } },
    { text: "Mixed spastic + ataxic + hypokinetic", options: { color: C.text, fontSize: 12, fontFace: FONT, breakLine: true } },
    { text: "Multiple strokes: ", options: { bold: true, color: C.navy, fontSize: 12, fontFace: FONT } },
    { text: "Any combination depending on lesion locations", options: { color: C.text, fontSize: 12, fontFace: FONT } },
  ], { x: 0.35, y: 3.97, w: 9.2, h: 1.0 });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 8 — Apraxia of Speech
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  bg(s); accentBar(s); headerBand(s, "Motor Speech — Apraxia of Speech"); footer(s);
  slideTitle(s, "Apraxia of Speech");
  divider(s, 1.62);

  s.addText([
    { text: "Definition: ", options: { bold: true, color: C.teal, fontSize: 13, fontFace: FONT } },
    { text: "Disorder of programing articulation of sequences of phonemes — no weakness, slowness or incoordination of speech muscles. Patient ", options: { color: C.text, fontSize: 13, fontFace: FONT } },
    { text: '"knows what they want to say and how it should sound" yet cannot articulate it properly', options: { italic: true, color: C.navy, fontSize: 12, fontFace: FONT, breakLine: true, paraSpaceAfter: 6 } },
  ], { x: 0.35, y: 1.7, w: 9.3, h: 0.8 });

  // 4-cardinal features in boxes
  s.addText("4 Cardinal Features:", { x: 0.35, y: 2.55, w: 9.3, h: 0.35, fontSize: 13, fontFace: FONT, bold: true, color: C.navy });

  const features = [
    { num: "1", text: "Effortful, groping 'trial-and-error' attempts with self-correction" },
    { num: "2", text: "Dysprosody (abnormal melody of speech)" },
    { num: "3", text: "Inconsistent articulation errors (≠ dysarthria)" },
    { num: "4", text: "Difficulty initiating utterances — worst on first phoneme of polysyllabic words" },
  ];

  features.forEach((f, i) => {
    const x = 0.25 + (i % 2) * 4.85;
    const y = 3.0 + Math.floor(i / 2) * 0.82;
    s.addShape(pres.ShapeType.rect, { x, y, w: 4.65, h: 0.72, fill: { color: C.accent }, line: { color: C.lightLine } });
    s.addShape(pres.ShapeType.ellipse, { x: x + 0.1, y: y + 0.14, w: 0.44, h: 0.44, fill: { color: C.teal }, line: { color: C.teal } });
    s.addText(f.num, { x: x + 0.1, y: y + 0.14, w: 0.44, h: 0.44, fontSize: 12, fontFace: FONT, bold: true, color: C.white, align: "center", valign: "middle" });
    s.addText(f.text, { x: x + 0.65, y: y + 0.08, w: 3.9, h: 0.56, fontSize: 11, fontFace: FONT, color: C.text, valign: "middle" });
  });

  s.addText([
    { text: "Localization: ", options: { bold: true, color: C.navy, fontSize: 12, fontFace: FONT } },
    { text: "Left hemisphere insula (Dronkers, 1996) and/or Broca area (Hillis et al., 2004)  |  ", options: { color: C.text, fontSize: 11, fontFace: FONT } },
    { text: "Bedside test: ", options: { bold: true, color: C.navy, fontSize: 12, fontFace: FONT } },
    { text: "Repeat 'catastrophe' or 'television' 5× — inconsistent errors emerge", options: { color: C.text, fontSize: 11, fontFace: FONT } },
  ], { x: 0.35, y: 4.7, w: 9.3, h: 0.4 });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 9 — Apraxia vs Dysarthria + Oral Apraxia
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  bg(s); accentBar(s); headerBand(s, "Comparison"); footer(s);
  slideTitle(s, "Apraxia of Speech vs. Dysarthria");
  divider(s, 1.62);

  const rows = [
    ["Feature", "Apraxia of Speech", "Dysarthria"],
    ["Error type", "Consonant substitutions", "Consonant distortions"],
    ["Consistency", "Inconsistent (trial to trial)", "Consistent"],
    ["Weakness", "Absent", "Often present (flaccid/spastic)"],
    ["Prosody", "Dysprosodic", "Variable"],
    ["First phoneme", "Most difficult", "Not specifically"],
    ["Repetition", "Errors worsen on repetition", "Consistent pattern"],
    ["Writing", "Better than speaking (usually)", "Not specifically affected"],
    ["Lesion", "Left insula / Broca area", "Varies by type"],
  ];

  const colW2 = [2.5, 3.2, 3.2];
  const startX2 = [0.25, 2.8, 6.05];
  rows.forEach((row, ri) => {
    const y = 1.72 + ri * 0.41;
    const isHeader = ri === 0;
    row.forEach((cell, ci) => {
      s.addShape(pres.ShapeType.rect, {
        x: startX2[ci], y, w: colW2[ci], h: 0.39,
        fill: { color: isHeader ? C.navy : (ri % 2 === 0 ? C.accent : C.white) },
        line: { color: C.lightLine },
      });
      s.addText(cell, {
        x: startX2[ci] + 0.06, y: y + 0.03, w: colW2[ci] - 0.12, h: 0.33,
        fontSize: isHeader ? 11 : 10, fontFace: FONT,
        bold: isHeader || ci === 0, color: isHeader ? C.white : (ci === 0 ? C.navy : C.text),
        valign: "middle",
      });
    });
  });

  s.addText("Oral/Buccolingual Apraxia (distinct from Apraxia of Speech)", { x: 0.25, y: 5.15, w: 9.5, h: 0.28, fontSize: 10, fontFace: FONT, bold: true, color: C.teal });
  s.addText("Test: Ask patient to lick upper lip, smile, stick out tongue voluntarily. Both oral apraxia and apraxia of speech can coexist with Broca aphasia.", { x: 0.25, y: 5.35, w: 9.5, h: 0.22, fontSize: 9, fontFace: FONT, color: C.text });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 10 — Rare Motor Speech Disorders
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  bg(s); accentBar(s); headerBand(s, "Rare Motor Speech Disorders"); footer(s);
  slideTitle(s, "Aphemia • Foreign Accent Syndrome • Acquired Stuttering • Opercular Syndrome");
  divider(s, 1.62);

  const rare = [
    {
      name: "Aphemia",
      text: "Near muteness with normal comprehension, reading, and writing. Clearly motor — NOT aphasia. Patient is often anarthric, then effortful non-fluent speech emerges. Lesion: face area of motor cortex / Broca area vicinity.",
      color: C.accent,
    },
    {
      name: "Foreign Accent Syndrome",
      text: 'Acquired dysfluency resembling a foreign accent. Usually after unilateral stroke involving left motor cortex. Can be mixed with aphasia.',
      color: "EDF7ED",
    },
    {
      name: "Acquired Stuttering",
      text: "Hesitancy producing initial phonemes + dysrhythmia. Overlaps with apraxia of speech. Left hemisphere cortical strokes most common; also subcortical (pons, basal ganglia, white matter). May also be psychogenic.",
      color: "FFF8E8",
    },
    {
      name: "Opercular Syndrome (Foix-Chavany-Marie)",
      text: "Bilateral perisylvian cortex/subcortical lesions → complete mutism. Can follow limb commands but cannot voluntarily move cranial muscles. Key feature: automatic-voluntary dissociation (smile when amused, yawn spontaneously — but cannot open mouth on command).",
      color: "FEF3F0",
    },
  ];

  rare.forEach((r, i) => {
    const x = i % 2 === 0 ? 0.25 : 5.2;
    const y = i < 2 ? 1.72 : 3.5;
    s.addShape(pres.ShapeType.rect, { x, y, w: 4.55, h: 1.65, fill: { color: r.color }, line: { color: C.lightLine } });
    s.addText(r.name, { x: x + 0.1, y: y + 0.05, w: 4.3, h: 0.38, fontSize: 12, fontFace: FONT, bold: true, color: C.navy });
    s.addText(r.text, { x: x + 0.1, y: y + 0.45, w: 4.35, h: 1.1, fontSize: 10, fontFace: FONT, color: C.text });
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 11 — Aphasia Introduction
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  bg(s); accentBar(s); headerBand(s, "Aphasia"); footer(s);
  slideTitle(s, "Aphasia — Introduction & Bedside Testing");
  divider(s, 1.62);

  s.addText([
    { text: "Definition: ", options: { bold: true, color: C.teal, fontSize: 14, fontFace: FONT } },
    { text: "Acquired disorder of language (not speech mechanics) due to brain injury. 27.1% of speech/language disorders at Mayo Clinic.", options: { color: C.text, fontSize: 13, fontFace: FONT, breakLine: true, paraSpaceAfter: 8 } },
    { text: "Bedside Language Battery (6 domains):", options: { bold: true, color: C.navy, fontSize: 13, fontFace: FONT, breakLine: true } },
  ], { x: 0.35, y: 1.72, w: 9.3, h: 1.05 });

  const domains = [
    { label: "Spontaneous Speech", note: "Fluent vs. Non-fluent; agrammatic/telegraphic vs. paraphasic", icon: "1" },
    { label: "Naming", note: "Confrontation naming; word-finding; paraphasic errors", icon: "2" },
    { label: "Comprehension", note: "Yes/no questions; follow commands; complex syntax", icon: "3" },
    { label: "Repetition", note: "Single words → phrases → sentences", icon: "4" },
    { label: "Reading", note: "Aloud and for comprehension (may dissociate)", icon: "5" },
    { label: "Writing", note: "Assess independently of motor weakness", icon: "6" },
  ];

  domains.forEach((d, i) => {
    const col = i % 3;
    const row = Math.floor(i / 3);
    const x = 0.25 + col * 3.18;
    const y = 2.85 + row * 0.88;
    s.addShape(pres.ShapeType.rect, { x, y, w: 3.05, h: 0.78, fill: { color: row === 0 ? C.accent : "EDF7ED" }, line: { color: C.lightLine } });
    s.addShape(pres.ShapeType.ellipse, { x: x + 0.08, y: y + 0.16, w: 0.38, h: 0.38, fill: { color: C.navy }, line: { color: C.navy } });
    s.addText(d.icon, { x: x + 0.08, y: y + 0.16, w: 0.38, h: 0.38, fontSize: 10, fontFace: FONT, bold: true, color: C.white, align: "center", valign: "middle" });
    s.addText(d.label, { x: x + 0.55, y: y + 0.04, w: 2.4, h: 0.3, fontSize: 11, fontFace: FONT, bold: true, color: C.navy });
    s.addText(d.note, { x: x + 0.55, y: y + 0.38, w: 2.4, h: 0.36, fontSize: 9, fontFace: FONT, color: C.text });
  });

  s.addText("Clinical tip: Associated neurological signs (hemiparesis, visual field defects, sensory loss) help classify aphasia type and localize lesion.", {
    x: 0.3, y: 5.2, w: 9.4, h: 0.3, fontSize: 9.5, fontFace: FONT, color: C.muted, italic: true,
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 12 — Broca Aphasia
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  bg(s); accentBar(s); headerBand(s, "Aphasia — Broca"); footer(s);
  slideTitle(s, "Broca Aphasia");
  divider(s, 1.62);

  // Left column: features
  s.addShape(pres.ShapeType.rect, { x: 0.25, y: 1.7, w: 5.1, h: 3.65, fill: { color: C.accent }, line: { color: C.lightLine } });
  s.addText("Bedside Features (Table 13.1)", { x: 0.35, y: 1.72, w: 4.9, h: 0.38, fontSize: 12, fontFace: FONT, bold: true, color: C.navy });
  const brocaRows = [
    ["Spontaneous speech", "Nonfluent, mute, or telegraphic; agrammatic; ± dysarthric"],
    ["Naming", "Impaired; tip-of-tongue phenomenon common"],
    ["Comprehension", "Relatively intact (mild difficulty with complex syntax)"],
    ["Repetition", "Impaired (hesitant, resembles spontaneous speech)"],
    ["Reading", "Often impaired ('third alexia')"],
    ["Writing", "Impaired (dysmorphic, dysgrammatical)"],
    ["Associated", "Right hemiparesis, hemisensory loss, ± left limb apraxia"],
  ];
  brocaRows.forEach((r, i) => {
    const y = 2.15 + i * 0.44;
    s.addText(r[0] + ":", { x: 0.35, y, w: 1.6, h: 0.38, fontSize: 9.5, fontFace: FONT, bold: true, color: C.navy, valign: "middle" });
    s.addText(r[1], { x: 2.0, y, w: 3.2, h: 0.38, fontSize: 9.5, fontFace: FONT, color: C.text, valign: "middle" });
  });

  // Right column: key pearls
  s.addText("Clinical Pearls", { x: 5.6, y: 1.72, w: 4.1, h: 0.38, fontSize: 12, fontFace: FONT, bold: true, color: C.navy });
  s.addText([
    { text: "Agrammatism / telegraphic speech:", options: { bold: true, color: C.navy, fontSize: 11, fontFace: FONT, breakLine: true } },
    { text: '"wife come hospital" — nouns/verbs preserved, grammatical words omitted', options: { italic: true, color: C.teal, fontSize: 11, fontFace: FONT, breakLine: true, paraSpaceAfter: 5 } },
    { text: "Phonemic paraphasias:", options: { bold: true, color: C.navy, fontSize: 11, fontFace: FONT, breakLine: true } },
    { text: "Substitutions closely resemble target (p for b); inconsistent", options: { color: C.text, fontSize: 11, fontFace: FONT, breakLine: true, paraSpaceAfter: 5 } },
    { text: "Lesion:", options: { bold: true, color: C.navy, fontSize: 11, fontFace: FONT, breakLine: true } },
    { text: "Left inferior frontal gyrus (Broca area — BA 44/45) ± adjacent motor cortex", options: { color: C.text, fontSize: 11, fontFace: FONT, breakLine: true, paraSpaceAfter: 5 } },
    { text: "Psychiatric:", options: { bold: true, color: C.navy, fontSize: 11, fontFace: FONT, breakLine: true } },
    { text: "Frequent depression; patients are aware of and frustrated by their deficits", options: { color: C.text, fontSize: 11, fontFace: FONT, breakLine: true, paraSpaceAfter: 5 } },
    { text: "Historic note:", options: { bold: true, color: C.navy, fontSize: 11, fontFace: FONT, breakLine: true } },
    { text: 'Paul Broca (1861) — patient who could only say "tan"', options: { italic: true, color: C.muted, fontSize: 11, fontFace: FONT } },
  ], { x: 5.6, y: 2.15, w: 4.1, h: 3.2 });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 13 — Wernicke Aphasia
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  bg(s); accentBar(s); headerBand(s, "Aphasia — Wernicke"); footer(s);
  slideTitle(s, "Wernicke Aphasia");
  divider(s, 1.62);

  s.addShape(pres.ShapeType.rect, { x: 0.25, y: 1.7, w: 5.1, h: 3.65, fill: { color: "EDF7ED" }, line: { color: C.lightLine } });
  s.addText("Bedside Features (Table 13.2)", { x: 0.35, y: 1.72, w: 4.9, h: 0.38, fontSize: 12, fontFace: FONT, bold: true, color: C.navy });
  const werRows = [
    ["Spontaneous speech", "Fluent, ± logorrhoeic; paraphasias, neologisms, jargon; NOT dysarthric"],
    ["Naming", "Impaired (bizarre paraphasic substitutions)"],
    ["Comprehension", "Impaired (even for simple questions)"],
    ["Repetition", "Impaired"],
    ["Reading", "Impaired (comprehension similarly affected)"],
    ["Writing", "Well-formed but paragraphic (spelling errors)"],
    ["Associated", "± Right hemianopia; NO hemiparesis usually"],
  ];
  werRows.forEach((r, i) => {
    const y = 2.15 + i * 0.44;
    s.addText(r[0] + ":", { x: 0.35, y, w: 1.6, h: 0.38, fontSize: 9.5, fontFace: FONT, bold: true, color: C.navy, valign: "middle" });
    s.addText(r[1], { x: 2.0, y, w: 3.2, h: 0.38, fontSize: 9.5, fontFace: FONT, color: C.text, valign: "middle" });
  });

  s.addText("Clinical Pearls", { x: 5.6, y: 1.72, w: 4.1, h: 0.38, fontSize: 12, fontFace: FONT, bold: true, color: C.navy });
  s.addText([
    { text: "Fluent but empty speech:", options: { bold: true, color: C.navy, fontSize: 11, fontFace: FONT, breakLine: true } },
    { text: "A speaker of a foreign language might notice nothing amiss, but a native listener detects meaningless speech", options: { italic: true, color: C.teal, fontSize: 11, fontFace: FONT, breakLine: true, paraSpaceAfter: 5 } },
    { text: "Lesion:", options: { bold: true, color: C.navy, fontSize: 11, fontFace: FONT, breakLine: true } },
    { text: "Posterior superior temporal gyrus (Wernicke area — BA 22) ± inferior parietal lobe and middle temporal gyrus", options: { color: C.text, fontSize: 11, fontFace: FONT, breakLine: true, paraSpaceAfter: 5 } },
    { text: "Psychiatric:", options: { bold: true, color: C.navy, fontSize: 11, fontFace: FONT, breakLine: true } },
    { text: "Often unaware/unconcerned about deficits; may become angry/paranoid over time", options: { color: C.text, fontSize: 11, fontFace: FONT, breakLine: true, paraSpaceAfter: 5 } },
    { text: "Danger:", options: { bold: true, color: C.gold, fontSize: 11, fontFace: FONT, breakLine: true } },
    { text: "May be misdiagnosed as psychosis due to fluent jargon — look for temporal lobe stroke signs, no hemiplegia", options: { color: C.text, fontSize: 11, fontFace: FONT } },
  ], { x: 5.6, y: 2.15, w: 4.1, h: 3.2 });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 14 — Global Aphasia
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  bg(s); accentBar(s); headerBand(s, "Aphasia — Global"); footer(s);
  slideTitle(s, "Global Aphasia");
  divider(s, 1.62);

  s.addShape(pres.ShapeType.rect, { x: 0.25, y: 1.7, w: 4.5, h: 3.4, fill: { color: "FEF3F0" }, line: { color: C.lightLine } });
  s.addText("Bedside Features (Table 13.3)", { x: 0.35, y: 1.72, w: 4.2, h: 0.38, fontSize: 12, fontFace: FONT, bold: true, color: C.navy });
  const globalRows = [
    ["Spontaneous speech", "Mute or severely nonfluent"],
    ["Naming", "Impaired"],
    ["Comprehension", "Impaired"],
    ["Repetition", "Impaired"],
    ["Reading", "Impaired"],
    ["Writing", "Impaired"],
    ["Associated", "Right hemiparesis + hemisensory loss + hemianopia"],
  ];
  globalRows.forEach((r, i) => {
    const y = 2.15 + i * 0.41;
    s.addText(r[0] + ":", { x: 0.35, y, w: 1.5, h: 0.36, fontSize: 9.5, fontFace: FONT, bold: true, color: C.navy, valign: "middle" });
    s.addText(r[1], { x: 1.9, y, w: 2.7, h: 0.36, fontSize: 9.5, fontFace: FONT, color: C.text, valign: "middle" });
  });

  s.addText("Key Points", { x: 5.0, y: 1.72, w: 4.7, h: 0.38, fontSize: 12, fontFace: FONT, bold: true, color: C.navy });
  s.addText([
    { text: "= Broca + Wernicke deficits combined", options: { bold: true, color: C.teal, fontSize: 12, fontFace: FONT, breakLine: true, paraSpaceAfter: 6 } },
    { text: "Lesion: ", options: { bold: true, color: C.navy, fontSize: 12, fontFace: FONT } },
    { text: "Large left MCA territory — inferior frontal + superior temporal + parietal", options: { color: C.text, fontSize: 12, fontFace: FONT, breakLine: true, paraSpaceAfter: 6 } },
    { text: "Recovery: ", options: { bold: true, color: C.navy, fontSize: 12, fontFace: FONT } },
    { text: "If superior temporal gyrus spared → may evolve toward Broca aphasia. Second 6 months may show MORE recovery than first 6 months.", options: { color: C.text, fontSize: 12, fontFace: FONT, breakLine: true, paraSpaceAfter: 6 } },
    { text: "If milder — termed 'mixed aphasia' (all modalities impaired but not as severely as global)", options: { color: C.muted, fontSize: 11, fontFace: FONT, italic: true } },
  ], { x: 5.0, y: 2.15, w: 4.7, h: 2.7 });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 15 — Conduction Aphasia
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  bg(s); accentBar(s); headerBand(s, "Aphasia — Conduction"); footer(s);
  slideTitle(s, "Conduction Aphasia");
  divider(s, 1.62);

  s.addShape(pres.ShapeType.rect, { x: 0.25, y: 1.7, w: 4.5, h: 3.4, fill: { color: "F5F0FF" }, line: { color: C.lightLine } });
  s.addText("Bedside Features (Table 13.4)", { x: 0.35, y: 1.72, w: 4.2, h: 0.38, fontSize: 12, fontFace: FONT, bold: true, color: C.navy });
  const condRows = [
    ["Spontaneous speech", "Fluent with literal paraphasias and self-correction pauses"],
    ["Naming", "Moderately impaired"],
    ["Comprehension", "Intact"],
    ["Repetition", "SEVERELY impaired (hallmark)"],
    ["Reading aloud", "Moderately impaired; comprehension largely intact"],
    ["Writing", "Variable deficits"],
    ["Associated", "± Apraxia left limbs; ± mild right hemiparesis; ± right hemisensory loss; ± right hemianopia"],
  ];
  condRows.forEach((r, i) => {
    const y = 2.15 + i * 0.41;
    s.addText(r[0] + ":", { x: 0.35, y, w: 1.5, h: 0.36, fontSize: 9.5, fontFace: FONT, bold: r[0] === "Repetition", color: r[0] === "Repetition" ? C.teal : C.navy, valign: "middle" });
    s.addText(r[1], { x: 1.9, y, w: 2.7, h: 0.36, fontSize: 9.5, fontFace: FONT, color: C.text, valign: "middle" });
  });

  s.addText("Key Points", { x: 5.0, y: 1.72, w: 4.7, h: 0.38, fontSize: 12, fontFace: FONT, bold: true, color: C.navy });
  s.addText([
    { text: "Hallmark:", options: { bold: true, color: C.teal, fontSize: 13, fontFace: FONT, breakLine: true } },
    { text: "Disproportionately impaired repetition despite intact comprehension and relatively fluent speech", options: { color: C.text, fontSize: 12, fontFace: FONT, breakLine: true, paraSpaceAfter: 6 } },
    { text: "Classic example:", options: { bold: true, color: C.navy, fontSize: 12, fontFace: FONT, breakLine: true } },
    { text: "Cannot repeat 'boy' but says 'I like girls better'", options: { italic: true, color: C.teal, fontSize: 12, fontFace: FONT, breakLine: true, paraSpaceAfter: 6 } },
    { text: "Lesion:", options: { bold: true, color: C.navy, fontSize: 12, fontFace: FONT, breakLine: true } },
    { text: "Superior temporal or inferior parietal region (arcuate fasciculus disconnection). Parietal lesion → often with limb apraxia; Temporal lesion → without apraxia.", options: { color: C.text, fontSize: 12, fontFace: FONT, breakLine: true, paraSpaceAfter: 6 } },
    { text: "Pearl:", options: { bold: true, color: C.gold, fontSize: 12, fontFace: FONT, breakLine: true } },
    { text: "Limb apraxia may mimic comprehension deficit — always test comprehension with yes/no questions or pointing", options: { color: C.text, fontSize: 12, fontFace: FONT } },
  ], { x: 5.0, y: 2.15, w: 4.7, h: 3.1 });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 16 — Transcortical & Anomic Aphasia
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  bg(s); accentBar(s); headerBand(s, "Aphasia — Transcortical & Anomic"); footer(s);
  slideTitle(s, "Transcortical Aphasias & Anomic Aphasia");
  divider(s, 1.62);

  const types = [
    {
      name: "Transcortical Motor Aphasia",
      features: "Nonfluent; intact repetition (key); impaired naming; comprehension intact",
      lesion: "Left anterior frontal lobe (SMA area), sparing Broca area",
      note: "Repetition PRESERVED — distinguishes from Broca aphasia",
      color: C.accent,
    },
    {
      name: "Transcortical Sensory Aphasia",
      features: "Fluent with paraphasias; intact repetition (key); severely impaired comprehension",
      lesion: "Left posterior temporal-parietal area, sparing Wernicke area",
      note: "Repetition PRESERVED — distinguishes from Wernicke aphasia; may echo examiner (echolalia)",
      color: "EDF7ED",
    },
    {
      name: "Mixed Transcortical Aphasia",
      features: "Nonfluent; intact repetition; impaired comprehension and naming",
      lesion: "Isolation of speech area (border-zone infarctions)",
      note: "AKA isolation of the speech area — may echo any phrase heard",
      color: "FFF8E8",
    },
    {
      name: "Anomic Aphasia",
      features: "Fluent; naming prominently impaired; comprehension/repetition intact",
      lesion: "Variable; may be angular gyrus or temporal-parietal junction",
      note: "Often a residual state after recovery from other aphasias; least specific localizing value",
      color: "F7EEF7",
    },
  ];

  types.forEach((t, i) => {
    const x = i % 2 === 0 ? 0.25 : 5.1;
    const y = i < 2 ? 1.72 : 3.55;
    s.addShape(pres.ShapeType.rect, { x, y, w: 4.65, h: 1.7, fill: { color: t.color }, line: { color: C.lightLine } });
    s.addText(t.name, { x: x + 0.1, y: y + 0.04, w: 4.45, h: 0.35, fontSize: 12, fontFace: FONT, bold: true, color: C.navy });
    s.addText([
      { text: "Features: ", options: { bold: true, color: C.navy, fontSize: 10, fontFace: FONT } },
      { text: t.features, options: { color: C.text, fontSize: 10, fontFace: FONT, breakLine: true } },
      { text: "Lesion: ", options: { bold: true, color: C.navy, fontSize: 10, fontFace: FONT } },
      { text: t.lesion, options: { color: C.text, fontSize: 10, fontFace: FONT, breakLine: true } },
      { text: "Pearl: ", options: { bold: true, color: C.teal, fontSize: 10, fontFace: FONT } },
      { text: t.note, options: { italic: true, color: C.navy, fontSize: 10, fontFace: FONT } },
    ], { x: x + 0.1, y: y + 0.42, w: 4.45, h: 1.2 });
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 17 — Aphasia Syndromes Comparison Table
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  bg(s); accentBar(s); headerBand(s, "Comparison Table"); footer(s);
  slideTitle(s, "Aphasia Syndromes — At-a-Glance");
  divider(s, 1.62);

  const tableData = [
    ["Syndrome", "Fluency", "Comprehension", "Repetition", "Lesion Site"],
    ["Broca", "NF", "Intact", "Impaired", "L inf frontal (BA44/45)"],
    ["Wernicke", "F", "Impaired", "Impaired", "L sup temporal (BA22)"],
    ["Global", "NF", "Impaired", "Impaired", "L MCA territory (large)"],
    ["Conduction", "F", "Intact", "IMPAIRED ★", "L sup temp / inf parietal"],
    ["Trans. Motor", "NF", "Intact", "Preserved ★", "L anterior frontal (SMA)"],
    ["Trans. Sensory", "F", "Impaired", "Preserved ★", "L post temp-parietal"],
    ["Mixed Trans.", "NF", "Impaired", "Preserved ★", "Border-zone (isolation)"],
    ["Anomic", "F", "Intact", "Intact", "Variable (angular gyrus)"],
  ];

  const colW3 = [1.8, 0.8, 1.55, 1.55, 3.9];
  const startX3 = [0.2, 2.05, 2.9, 4.5, 6.1];
  const cellH = 0.44;

  tableData.forEach((row, ri) => {
    const y = 1.72 + ri * cellH;
    const isHeader = ri === 0;
    row.forEach((cell, ci) => {
      const isHighlight = cell.includes("★");
      s.addShape(pres.ShapeType.rect, {
        x: startX3[ci], y, w: colW3[ci], h: cellH,
        fill: { color: isHeader ? C.navy : isHighlight ? "FFFAE0" : (ri % 2 === 0 ? C.accent : C.white) },
        line: { color: C.lightLine },
      });
      s.addText(cell, {
        x: startX3[ci] + 0.04, y: y + 0.04, w: colW3[ci] - 0.08, h: cellH - 0.08,
        fontSize: isHeader ? 10 : 9.5, fontFace: FONT,
        bold: isHeader || (ci === 0 && !isHeader),
        color: isHeader ? C.white : isHighlight ? "#8B5E00" : (ci === 0 ? C.navy : C.text),
        valign: "middle",
      });
    });
  });

  s.addText("NF = Non-fluent  |  F = Fluent  |  ★ = Hallmark feature", {
    x: 0.25, y: 5.28, w: 9.5, h: 0.22, fontSize: 8.5, fontFace: FONT, color: C.muted, italic: true, align: "center",
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 18 — Localization
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  bg(s); accentBar(s); headerBand(s, "Localization"); footer(s);
  slideTitle(s, "Localization of Speech & Language Lesions");
  divider(s, 1.62);

  s.addText([
    { text: "Left hemisphere dominance for language: ", options: { bold: true, color: C.navy, fontSize: 13, fontFace: FONT } },
    { text: "~96% of right-handers; ~70% of left-handers", options: { color: C.text, fontSize: 13, fontFace: FONT, breakLine: true, paraSpaceAfter: 6 } },
  ], { x: 0.35, y: 1.72, w: 9.3, h: 0.5 });

  const locs = [
    { region: "Broca area (BA 44/45)", struct: "Left inferior frontal gyrus", disorder: "Broca aphasia, Apraxia of speech, Aphemia" },
    { region: "Wernicke area (BA 22)", struct: "Left posterior superior temporal gyrus", disorder: "Wernicke aphasia" },
    { region: "Arcuate fasciculus", struct: "White matter tract connecting temporal & frontal", disorder: "Conduction aphasia" },
    { region: "Perisylvian watershed", struct: "Border-zone cortex", disorder: "Transcortical aphasias (isolation)" },
    { region: "Left insula", struct: "Insular cortex (deep)", disorder: "Apraxia of speech (Dronkers, 1996)" },
    { region: "Left motor cortex (face area)", struct: "Primary motor cortex, face representation", disorder: "Aphemia, Acquired stuttering" },
    { region: "Cerebellum", struct: "Cerebellar hemispheres", disorder: "Ataxic dysarthria (scanning speech)" },
    { region: "Basal ganglia / Substantia nigra", struct: "Striatum, SN, STN", disorder: "Hypokinetic (PD) / Hyperkinetic dysarthria" },
    { region: "Bilateral perisylvian", struct: "Bilateral opercular cortex", disorder: "Opercular syndrome (Foix-Chavany-Marie)" },
  ];

  const cW = [2.8, 3.1, 3.6];
  const cX = [0.2, 3.05, 6.2];
  // header
  ["Region / Structure", "Anatomy", "Disorder(s)"].forEach((h, i) => {
    s.addShape(pres.ShapeType.rect, { x: cX[i], y: 2.3, w: cW[i], h: 0.32, fill: { color: C.teal }, line: { color: C.teal } });
    s.addText(h, { x: cX[i] + 0.04, y: 2.3, w: cW[i] - 0.08, h: 0.32, fontSize: 10, fontFace: FONT, bold: true, color: C.white, valign: "middle" });
  });

  locs.forEach((r, ri) => {
    const y = 2.64 + ri * 0.32;
    const vals = [r.region, r.struct, r.disorder];
    vals.forEach((v, ci) => {
      s.addShape(pres.ShapeType.rect, { x: cX[ci], y, w: cW[ci], h: 0.30, fill: { color: ri % 2 === 0 ? C.accent : C.white }, line: { color: C.lightLine } });
      s.addText(v, { x: cX[ci] + 0.04, y: y + 0.02, w: cW[ci] - 0.08, h: 0.26, fontSize: 8.5, fontFace: FONT, color: ci === 0 ? C.navy : C.text, bold: ci === 0, valign: "middle" });
    });
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 19 — Aphasia vs. Motor Speech Disorder
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  bg(s); accentBar(s); headerBand(s, "Differential Diagnosis"); footer(s);
  slideTitle(s, "Aphasia vs. Motor Speech Disorder — Key Distinctions");
  divider(s, 1.62);

  const rows = [
    ["Feature", "Aphasia", "Motor Speech Disorder"],
    ["Core deficit", "Language (content)", "Articulation / speech mechanics"],
    ["Written language", "Also impaired", "Normal"],
    ["Comprehension", "Often impaired", "Normal"],
    ["Speech transcription", "Text reads abnormally", "Text reads normally"],
    ["Fluency type", "Reflects linguistic deficit", "Reflects motor deficit"],
    ["Reading", "Often impaired", "Normal (can read aloud poorly but comprehends)"],
    ["Brain locus", "Perisylvian cortex (language areas)", "Variable (motor cortex, cerebellum, BG, brainstem, NMJ, muscle)"],
  ];

  const cW4 = [2.2, 3.5, 3.8];
  const cX4 = [0.25, 2.5, 6.05];
  rows.forEach((row, ri) => {
    const y = 1.72 + ri * 0.45;
    const isHeader = ri === 0;
    row.forEach((cell, ci) => {
      s.addShape(pres.ShapeType.rect, {
        x: cX4[ci], y, w: cW4[ci], h: 0.43,
        fill: { color: isHeader ? C.navy : ci === 1 ? (ri % 2 === 0 ? "FFF3F0" : C.white) : (ri % 2 === 0 ? C.accent : C.white) },
        line: { color: C.lightLine },
      });
      s.addText(cell, {
        x: cX4[ci] + 0.06, y: y + 0.04, w: cW4[ci] - 0.12, h: 0.35,
        fontSize: isHeader ? 11 : 10, fontFace: FONT,
        bold: isHeader || ci === 0, color: isHeader ? C.white : (ci === 0 ? C.navy : C.text),
        valign: "middle",
      });
    });
  });

  s.addText("Practical pearl: Ask the patient to write — preserved writing rules out most motor speech disorders and points toward aphasia.", {
    x: 0.25, y: 5.22, w: 9.5, h: 0.3, fontSize: 9.5, fontFace: FONT, color: C.teal, bold: true,
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 20 — Management & Rehabilitation
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  bg(s); accentBar(s); headerBand(s, "Management"); footer(s);
  slideTitle(s, "Management & Rehabilitation");
  divider(s, 1.62);

  s.addText([
    { text: "Speech-Language Therapy", options: { bold: true, color: C.teal, fontSize: 14, fontFace: FONT, breakLine: true } },
    { text: "Evidence supports efficacy of speech therapy for post-stroke dysarthria (Mackenzie, 2011) and aphasia (Bradley & Daroff, Ch.14)", options: { color: C.text, fontSize: 12, fontFace: FONT, breakLine: true, paraSpaceAfter: 8 } },
  ], { x: 0.35, y: 1.72, w: 9.3, h: 0.9 });

  const mgmt = [
    {
      title: "Dysarthria",
      items: ["Speech-language pathology referral", "Treat underlying cause (e.g., anti-parkinsonian agents, immunotherapy for MG)", "Augmentative & alternative communication (AAC) devices for severe cases", "LSVT (Lee Silverman Voice Treatment) for Parkinson disease"],
      color: C.accent,
    },
    {
      title: "Aphasia",
      items: ["Intensive speech-language therapy", "Constraint-induced aphasia therapy (CIAT)", "Melodic intonation therapy (MIT) for Broca aphasia — uses preserved right-hemisphere melody processing", "Address depression (especially Broca aphasia — high risk)", "Family/caregiver communication training"],
      color: "EDF7ED",
    },
  ];

  mgmt.forEach((m, i) => {
    const x = i === 0 ? 0.25 : 5.1;
    s.addShape(pres.ShapeType.rect, { x, y: 2.65, w: 4.65, h: 2.6, fill: { color: m.color }, line: { color: C.lightLine } });
    s.addText(m.title, { x: x + 0.1, y: 2.67, w: 4.45, h: 0.38, fontSize: 13, fontFace: FONT, bold: true, color: C.navy });
    s.addText(m.items.map((item, ii) => ({ text: item, options: { bullet: true, breakLine: ii < m.items.length - 1, fontSize: 11, fontFace: FONT, color: C.text, paraSpaceAfter: 3 } })),
      { x: x + 0.1, y: 3.1, w: 4.45, h: 2.1 });
  });

  s.addText("Prognosis: Best predictors of aphasia recovery include younger age, smaller lesion, preserved Wernicke area, early speech therapy initiation.", {
    x: 0.25, y: 5.28, w: 9.5, h: 0.22, fontSize: 9, fontFace: FONT, color: C.muted, italic: true,
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 21 — Clinical Pearls
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  bg(s); accentBar(s); headerBand(s, "Clinical Pearls"); footer(s);
  slideTitle(s, "Clinical Pearls for the Neurology Resident");
  divider(s, 1.62);

  const pearls = [
    { n: "1", text: "If a patient's TRANSCRIPTION reads normally → motor speech disorder, not aphasia. Always ask them to write." },
    { n: "2", text: "Repetition is the most important discriminating feature among aphasia syndromes — test it in every patient." },
    { n: "3", text: "Preserved repetition = Transcortical aphasia (motor or sensory) or Anomic aphasia → lesion outside the perisylvian core." },
    { n: "4", text: "Disproportionately impaired repetition with intact comprehension = Conduction aphasia (arcuate fasciculus lesion)." },
    { n: "5", text: "Inconsistent phonemic errors on repeating the same word 5× = Apraxia of speech. Consistent distortions = Dysarthria." },
    { n: "6", text: "Fluent aphasia + no hemiparesis = Wernicke aphasia until proven otherwise — can be mistaken for psychosis." },
    { n: "7", text: "Opercular syndrome: patient cannot open their mouth on command but yawns spontaneously — automatic-voluntary dissociation is pathognomonic." },
    { n: "8", text: "ALS = mixed spastic + flaccid dysarthria. Strain-strangle voice (UMN) + nasal/breathy (LMN) together is a red flag." },
    { n: "9", text: "Myasthenia gravis: speech fatigues DURING the examination — start with full paragraph reading." },
    { n: "10", text: "Parkinson disease: hypophonic + rapid festinating speech → LSVT is evidence-based treatment." },
  ];

  pearls.forEach((p, i) => {
    const col = i < 5 ? 0 : 1;
    const row = i % 5;
    const x = col === 0 ? 0.25 : 5.1;
    const y = 1.75 + row * 0.7;
    s.addShape(pres.ShapeType.ellipse, { x: x + 0.03, y: y + 0.12, w: 0.4, h: 0.4, fill: { color: C.teal }, line: { color: C.teal } });
    s.addText(p.n, { x: x + 0.03, y: y + 0.12, w: 0.4, h: 0.4, fontSize: 10, fontFace: FONT, bold: true, color: C.white, align: "center", valign: "middle" });
    s.addText(p.text, { x: x + 0.55, y: y + 0.06, w: 4.3, h: 0.6, fontSize: 9.5, fontFace: FONT, color: C.text, valign: "middle" });
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 22 — Key Takeaways
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  // Dark background
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.navy }, line: { color: C.navy } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.1, fill: { color: C.teal }, line: { color: C.teal } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 5.525, w: 10, h: 0.1, fill: { color: C.teal }, line: { color: C.teal } });

  s.addText("KEY TAKEAWAYS", {
    x: 0.5, y: 0.25, w: 9, h: 0.55, fontSize: 22, fontFace: FONT, bold: true, color: C.white, charSpacing: 3,
  });
  s.addShape(pres.ShapeType.line, { x: 0.5, y: 0.85, w: 4, h: 0, line: { color: C.teal, width: 2 } });

  const takeaways = [
    ["Motor Speech Disorders", "Problem is ARTICULATION — language content is normal. Subtypes: Dysarthria, Apraxia of Speech, and rare syndromes."],
    ["6 Dysarthria Types", "Flaccid (LMN/NMJ/Muscle) · Spastic (bilateral UMN) · Ataxic (cerebellum) · Hypokinetic (BG/PD) · Hyperkinetic (BG) · Mixed (ALS = both)"],
    ["Apraxia of Speech", "Inconsistent phonemic substitutions, effortful speech, left insula/Broca area. Test: repeat same polysyllabic word 5×."],
    ["Aphasia", "Language disorder — transcription reads abnormally. 6 domains: fluency, naming, comprehension, repetition, reading, writing."],
    ["Master Repetition", "Preserved + nonfluent = Transcortical Motor | Preserved + fluent = Transcortical Sensory | Impaired + fluent + intact comprehension = Conduction | All impaired + nonfluent = Global."],
  ];

  takeaways.forEach((t, i) => {
    const y = 1.05 + i * 0.87;
    s.addShape(pres.ShapeType.rect, { x: 0.3, y, w: 9.4, h: 0.78, fill: { color: "1C4060" }, line: { color: "2A5A80" } });
    s.addShape(pres.ShapeType.rect, { x: 0.3, y, w: 0.06, h: 0.78, fill: { color: C.teal }, line: { color: C.teal } });
    s.addText(t[0], { x: 0.5, y: y + 0.06, w: 2.0, h: 0.28, fontSize: 11, fontFace: FONT, bold: true, color: C.teal });
    s.addText(t[1], { x: 0.5, y: y + 0.36, w: 9.0, h: 0.38, fontSize: 10, fontFace: FONT, color: "C8DCEA" });
  });

  s.addText("Bradley & Daroff's Neurology in Clinical Practice  |  Adams and Victor's Principles of Neurology", {
    x: 0.5, y: 5.42, w: 9, h: 0.15, fontSize: 7.5, fontFace: FONT, color: "4A7A9C", italic: true, align: "center",
  });
}

// ── Write file ──────────────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/speech-pptx/Speech_Neurology_Residents.pptx" })
  .then(() => console.log("DONE: /home/daytona/workspace/speech-pptx/Speech_Neurology_Residents.pptx"))
  .catch(err => { console.error(err); process.exit(1); });
Running Command

cd /home/daytona/workspace/speech-pptx && node speech_neuro.js 2>&1

Running Command

ls -lh /home/daytona/workspace/speech-pptx/Speech_Neurology_Residents.pptx

Your presentation is ready:

Speech Neurology Residents

Presentation · PPTX


What's Inside (22 Slides)

The deck is sourced directly from Bradley & Daroff's Neurology in Clinical Practice and Adams and Victor's Principles of Neurology, organized for neurology residents:
#SlideContent
1TitleDark navy cover slide
2OutlineTwo-column topic map
3Motor Speech Disorders — IntroductionDefinition, core rule, Mayo Clinic prevalence data
4Bedside ExaminationTwo-column: what to test vs. what to observe (diadochokinesis, consonant repetition)
5Dysarthria — Definition & ClassificationDefinition, anarthria, 6-box Mayo Clinic classification grid
6Flaccid / Spastic / Ataxic DysarthriaTable with lesion site, speech character, causes
7Hypokinetic / Hyperkinetic / MixedBoxes per type; ALS/Wilson disease mixed examples
8Apraxia of SpeechDefinition + 4 cardinal features in numbered boxes + localization
9Apraxia vs. DysarthriaComparison table + Oral/Buccolingual Apraxia note
10Rare Motor Speech DisordersAphemia, Foreign Accent Syndrome, Acquired Stuttering, Opercular Syndrome
11Aphasia Introduction6-domain battery explained
12Broca AphasiaFeature table (Table 13.1) + pearls (agrammatism, lesion, depression)
13Wernicke AphasiaFeature table (Table 13.2) + pitfall (misdiagnosis as psychosis)
14Global AphasiaFeature table + recovery pattern note
15Conduction AphasiaHallmark disproportionate repetition deficit; classic example
16Transcortical & Anomic AphasiasAll 4 types with preserved repetition highlighted
17Aphasia Comparison TableAll 8 syndromes vs. fluency / comprehension / repetition / lesion
18Localization9-row anatomy-to-disorder table
19Aphasia vs. Motor Speech DisorderDifferential table; practical writing test pearl
20ManagementDysarthria (LSVT, AAC) and Aphasia (CIAT, MIT, depression management)
21Clinical Pearls10 numbered pearls for residents
22Key TakeawaysDark slide summarizing all major concepts
This is a shared conversation. Sign in to Orris to start your own chat.