Help me prepare a ppt on thr topic Chronic suppurative otitis media from standard textbook of ent...

Reading File
Reading File
Reading File
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Reading File
Reading File
Finding Sources
Reading File
Finding Sources
Reading File
Finding Sources
Running Command

ls /home/daytona/workspace/ && mkdir -p /home/daytona/workspace/csom-ppt

Writing File

~/csom-ppt/csom.js

const pptxgen = require("pptxgenjs");

const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Chronic Suppurative Otitis Media";
pres.author = "ENT Department";

// ── Color Palette ──────────────────────────────────────────────
// Dominant: Deep Navy #0B1F4B  |  Mid: Steel Blue #1B5E8E
// Accent: Gold #E8A820          |  Light BG: #EEF4FB
// Text on dark: #F0F6FF         |  Text on light: #0B1F4B
const C = {
  navy:    "0B1F4B",
  blue:    "1B5E8E",
  gold:    "E8A820",
  ltbg:    "EEF4FB",
  white:   "F0F6FF",
  dktext:  "0B1F4B",
  gray:    "4A6080",
  lgray:   "C5D6EC",
  red:     "C0392B",
  green:   "1A7A4A",
};

// ── Reusable helpers ───────────────────────────────────────────
function titleSlide(slide) {
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.navy } });
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 4.2, w: "100%", h: 1.4, fill: { color: C.blue } });
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.18, h: "100%", fill: { color: C.gold } });
}

function contentSlide(slide, withAccent) {
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: "100%", fill: { color: C.ltbg } });
  if (withAccent !== false) {
    slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: "100%", h: 0.85, fill: { color: C.navy } });
    slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.18, h: "100%", fill: { color: C.gold } });
  }
}

function addHeading(slide, text) {
  slide.addText(text.toUpperCase(), {
    x: 0.36, y: 0.12, w: 9.3, h: 0.62,
    fontSize: 18, bold: true, color: C.white,
    fontFace: "Calibri", charSpacing: 1.5, valign: "middle", margin: 0,
  });
}

function addBullets(slide, items, opts = {}) {
  const { x = 0.45, y = 1.05, w = 9.2, h = 4.2, size = 15, color = C.dktext, indentLevel = 0 } = opts;
  const textArr = items.map((item, i) => ({
    text: item.text || item,
    options: {
      bullet: item.sub ? { indent: 36 } : { indent: 18 },
      fontSize: item.sub ? size - 1 : size,
      color: item.sub ? C.gray : color,
      bold: item.bold || false,
      breakLine: i < items.length - 1,
      paraSpaceAfter: item.sub ? 0 : 4,
    },
  }));
  slide.addText(textArr, { x, y, w, h, fontFace: "Calibri", valign: "top" });
}

function addDivider(slide, y) {
  slide.addShape(pres.ShapeType.line, {
    x: 0.36, y, w: 9.28, h: 0, line: { color: C.gold, width: 1.5 },
  });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 1 — Title
// ══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  titleSlide(s);

  s.addText("CHRONIC SUPPURATIVE\nOTITIS MEDIA", {
    x: 0.5, y: 0.6, w: 9, h: 2.4,
    fontSize: 38, bold: true, color: C.white, fontFace: "Calibri",
    align: "center", valign: "middle", charSpacing: 2,
  });

  s.addText("CSOM", {
    x: 0.5, y: 3.1, w: 9, h: 0.7,
    fontSize: 22, color: C.gold, fontFace: "Calibri", align: "center", bold: true, charSpacing: 8,
  });

  s.addText("Based on: Shambaugh Surgery of the Ear  |  Cummings Otolaryngology  |  Scott-Brown's ORL HNS", {
    x: 0.5, y: 4.25, w: 9, h: 0.8,
    fontSize: 10.5, color: C.lgray, fontFace: "Calibri", align: "center", italic: true,
  });

  s.addText("ENT Department  ·  2026", {
    x: 0.5, y: 5.1, w: 9, h: 0.35,
    fontSize: 10, color: C.lgray, fontFace: "Calibri", align: "center",
  });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 2 — Outline
// ══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  contentSlide(s);
  addHeading(s, "Outline");

  const topics = [
    "Definition & Introduction",
    "Epidemiology",
    "Etiopathogenesis",
    "Classification",
    "Clinical Features",
    "Audiological & Radiological Evaluation",
    "Medical Management",
    "Surgical Management",
    "Complications",
    "Key Points & Take-Away",
  ];

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

  const makeCol = (items, x) =>
    items.map((t, i) => ({
      text: `${["01","02","03","04","05","06","07","08","09","10"][items === col1 ? i : i + 5]}  ${t}`,
      options: { bullet: false, fontSize: 14, color: C.dktext, bold: false, breakLine: i < items.length - 1, paraSpaceAfter: 6 },
    }));

  s.addText(makeCol(col1, 0.4), { x: 0.36, y: 1.05, w: 4.5, h: 4.3, fontFace: "Calibri", valign: "top" });
  s.addText(makeCol(col2, 5.0), { x: 5.0, y: 1.05, w: 4.5, h: 4.3, fontFace: "Calibri", valign: "top" });

  // vertical divider
  s.addShape(pres.ShapeType.line, {
    x: 4.92, y: 1.1, w: 0, h: 4.1, line: { color: C.lgray, width: 1 },
  });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 3 — Definition
// ══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  contentSlide(s);
  addHeading(s, "Definition & Introduction");
  addDivider(s, 0.88);

  s.addText([
    { text: "CSOM is defined as ", options: { fontSize: 15, color: C.dktext } },
    { text: "chronic inflammation of the mucoperiosteum of the middle ear cleft", options: { fontSize: 15, color: C.blue, bold: true } },
    { text: " — characterized by a persistent tympanic membrane perforation with intermittent or continuous otorrhea, lasting more than ", options: { fontSize: 15, color: C.dktext } },
    { text: "6–12 weeks.", options: { fontSize: 15, color: C.blue, bold: true } },
  ], { x: 0.36, y: 0.95, w: 9.28, h: 0.85, fontFace: "Calibri", valign: "top" });

  addBullets(s, [
    { text: "The middle ear cleft includes the Eustachian tube, middle ear, mastoid antrum, and mastoid air cell system", bold: false },
    { text: "Eustachian tube dysfunction is the central driver: persistent effusion → mucosal oedema → granulation tissue → TM perforation", bold: false },
    { text: "Bacterial toxins and inflammatory mediators → basement membrane rupture → lamina propria extrusion → polyp formation", bold: false },
    { text: "Chronic inflammation → submucosal gland metaplasia → secretory mucosa → perpetuates effusion", bold: false },
    { text: "One of the leading causes of preventable hearing loss worldwide — particularly in developing nations", bold: true },
  ], { x: 0.45, y: 1.9, w: 9.1, h: 3.5, size: 14 });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 4 — Epidemiology
// ══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  contentSlide(s);
  addHeading(s, "Epidemiology");
  addDivider(s, 0.88);

  addBullets(s, [
    { text: "Prevalence: ~1–2% of the general population; higher in low-income countries and indigenous populations", bold: false },
    { text: "Peak incidence: early childhood (6 months – 2 years); correlates with Eustachian tube immaturity", bold: false },
    { text: "Risk factors:", bold: true },
    { text: "Overcrowding, poverty, malnutrition, poor hygiene", sub: true },
    { text: "Recurrent acute otitis media", sub: true },
    { text: "Cleft palate, Down syndrome — associated with ET dysfunction", sub: true },
    { text: "Allergic rhinitis and adenoid hypertrophy", sub: true },
    { text: "Immunodeficiency states (HIV, primary immunodeficiencies)", sub: true },
    { text: "WHO classifies bilateral CSOM discharging for ≥2 weeks as a 'massive' public health problem", bold: true },
  ], { x: 0.45, y: 1.0, w: 9.1, h: 4.4, size: 14 });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 5 — Etiopathogenesis
// ══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  contentSlide(s);
  addHeading(s, "Etiopathogenesis");
  addDivider(s, 0.88);

  // Pathway boxes
  const steps = [
    { label: "ET Dysfunction", detail: "Negative middle\near pressure" },
    { label: "Effusion", detail: "Serous / purulent\nmiddle ear fluid" },
    { label: "Mucosal Oedema &\nGranulation Tissue", detail: "BM rupture,\nfibroblast recruitment" },
    { label: "TM Weakening", detail: "Enzyme degradation\nof collagen skeleton" },
    { label: "Perforation /\nRetraction Pocket", detail: "Anchoring by fibrous\nbands → CSOM" },
  ];

  const boxW = 1.6, boxH = 1.1, startX = 0.38, y = 1.3, gap = 0.38;
  steps.forEach((st, i) => {
    const x = startX + i * (boxW + gap);
    s.addShape(pres.ShapeType.roundRect, {
      x, y, w: boxW, h: boxH,
      fill: { color: i === 4 ? C.red : C.blue },
      line: { color: C.navy, width: 0 },
      rectRadius: 0.08,
    });
    s.addText(st.label, { x, y: y + 0.05, w: boxW, h: 0.5, fontSize: 10.5, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle", margin: 2 });
    s.addText(st.detail, { x, y: y + 0.55, w: boxW, h: 0.5, fontSize: 9, color: C.lgray, fontFace: "Calibri", align: "center", valign: "middle", margin: 2 });
    if (i < steps.length - 1) {
      s.addShape(pres.ShapeType.line, { x: x + boxW + 0.03, y: y + boxH / 2, w: gap - 0.06, h: 0, line: { color: C.gold, width: 2 } });
    }
  });

  addBullets(s, [
    { text: "Microbiology: Most common organisms — Pseudomonas aeruginosa, Staphylococcus aureus, Proteus mirabilis, Klebsiella", bold: false },
    { text: "Biofilm formation: Bacterial biofilms demonstrated in 2006 in chronic OM; found in infected CI explants — increases treatment resistance", bold: false },
    { text: "Fungal infection: Candida spp. in 10% of purulent ears; rises to 35% after 3-week topical ciprofloxacin course (Cummings)", bold: false },
    { text: "Cholesteatoma genesis: Deep retraction pockets or perforations → keratinising squamous epithelium in middle ear cleft", bold: false },
  ], { x: 0.45, y: 2.6, w: 9.1, h: 3.0, size: 13.5 });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 6 — Classification
// ══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  contentSlide(s);
  addHeading(s, "Classification");
  addDivider(s, 0.88);

  // Two columns
  // Left: Tubo-tympanic
  s.addShape(pres.ShapeType.roundRect, { x: 0.36, y: 1.0, w: 4.3, h: 4.4, fill: { color: "D6EAF8" }, line: { color: C.blue, width: 1.5 }, rectRadius: 0.1 });
  s.addText("TUBO-TYMPANIC TYPE", { x: 0.36, y: 1.0, w: 4.3, h: 0.55, fontSize: 13, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle", fill: { color: C.blue } });
  s.addText([
    { text: "("Safe" / Benign)", options: { italic: true, fontSize: 12, color: C.blue, breakLine: true, bold: true } },
    { text: "\n", options: { fontSize: 6, breakLine: true } },
    { text: "• Central TM perforation (pars tensa)", options: { fontSize: 12, color: C.dktext, breakLine: true } },
    { text: "• No cholesteatoma", options: { fontSize: 12, color: C.dktext, breakLine: true } },
    { text: "• Mucoid or mucopurulent discharge, usually odourless", options: { fontSize: 12, color: C.dktext, breakLine: true } },
    { text: "• Conductive hearing loss", options: { fontSize: 12, color: C.dktext, breakLine: true } },
    { text: "• Responds to medical treatment", options: { fontSize: 12, color: C.dktext, breakLine: true } },
    { text: "• Surgery: Myringoplasty / Tympanoplasty", options: { fontSize: 12, color: C.dktext, breakLine: true } },
  ], { x: 0.5, y: 1.6, w: 4.0, h: 3.7, fontFace: "Calibri", valign: "top" });

  // Right: Attico-antral
  s.addShape(pres.ShapeType.roundRect, { x: 5.0, y: 1.0, w: 4.3, h: 4.4, fill: { color: "FDECEA" }, line: { color: C.red, width: 1.5 }, rectRadius: 0.1 });
  s.addText("ATTICO-ANTRAL TYPE", { x: 5.0, y: 1.0, w: 4.3, h: 0.55, fontSize: 13, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle", fill: { color: C.red } });
  s.addText([
    { text: "("Unsafe" / Dangerous)", options: { italic: true, fontSize: 12, color: C.red, breakLine: true, bold: true } },
    { text: "\n", options: { fontSize: 6, breakLine: true } },
    { text: "• Attic (marginal) perforation — pars flaccida", options: { fontSize: 12, color: C.dktext, breakLine: true } },
    { text: "• Cholesteatoma PRESENT", options: { fontSize: 12, color: C.red, bold: true, breakLine: true } },
    { text: "• Scanty, foul-smelling (fetid) discharge", options: { fontSize: 12, color: C.dktext, breakLine: true } },
    { text: "• Scutal / ossicular erosion on examination", options: { fontSize: 12, color: C.dktext, breakLine: true } },
    { text: "• Risk of intracranial complications", options: { fontSize: 12, color: C.red, bold: true, breakLine: true } },
    { text: "• Surgery: Mastoidectomy (CWU or CWD)", options: { fontSize: 12, color: C.dktext, breakLine: true } },
  ], { x: 5.14, y: 1.6, w: 4.0, h: 3.7, fontFace: "Calibri", valign: "top" });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 7 — Clinical Features
// ══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  contentSlide(s);
  addHeading(s, "Clinical Features");
  addDivider(s, 0.88);

  // Symptoms column
  s.addText("SYMPTOMS", { x: 0.36, y: 0.97, w: 4.3, h: 0.38, fontSize: 12.5, bold: true, color: C.blue, fontFace: "Calibri", align: "left", charSpacing: 1 });
  addBullets(s, [
    { text: "Otorrhoea: intermittent or continuous; mucoid/mucopurulent (safe) vs. scanty fetid (unsafe)", bold: false },
    { text: "Hearing loss: conductive (most common); SNHL if labyrinthitis or cochlear involvement", bold: false },
    { text: "Otalgia / headache: UNCOMMON — if present, suspect intracranial complication or malignancy", bold: true },
    { text: "Vertigo: suggests labyrinthitis or labyrinthine fistula", bold: false },
    { text: "Tinnitus: may accompany hearing loss", bold: false },
    { text: "Facial weakness: rare — suggests facial nerve involvement", bold: false },
  ], { x: 0.36, y: 1.38, w: 4.5, h: 3.9, size: 13 });

  // Signs column
  s.addShape(pres.ShapeType.line, { x: 4.92, y: 1.0, w: 0, h: 4.4, line: { color: C.lgray, width: 1 } });
  s.addText("SIGNS (on otoscopy / otomicroscopy)", { x: 5.04, y: 0.97, w: 4.5, h: 0.38, fontSize: 12.5, bold: true, color: C.blue, fontFace: "Calibri", align: "left", charSpacing: 1 });
  addBullets(s, [
    { text: "TM perforation: central (pars tensa) or attic/marginal (pars flaccida)", bold: false },
    { text: "Discharge in EAC; granulation tissue or polyps may obscure TM", bold: false },
    { text: "Scutal erosion (bony EAC erosion): hallmark of cholesteatoma", bold: true },
    { text: "Retraction pocket filled with squamous debris — pathognomonic of cholesteatoma", bold: false },
    { text: "CHL on tuning fork (Rinne negative, Weber lateralised to affected side)", bold: false },
    { text: "Post-auricular fistula / mastoid tenderness: suggests acute mastoiditis", bold: false },
  ], { x: 5.04, y: 1.38, w: 4.5, h: 3.9, size: 13 });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 8 — Audiological & Radiological Evaluation
// ══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  contentSlide(s);
  addHeading(s, "Audiological & Radiological Evaluation");
  addDivider(s, 0.88);

  s.addText("AUDIOLOGICAL", { x: 0.36, y: 0.96, w: 4.5, h: 0.38, fontSize: 12.5, bold: true, color: C.blue, fontFace: "Calibri", charSpacing: 1 });
  addBullets(s, [
    { text: "Pure tone audiogram (PTA): mandatory preoperative — documents type and degree of HL", bold: false },
    { text: "Conductive loss most common; CHL >30 dB suggests ossicular chain erosion", bold: false },
    { text: "Sound may still be conducted directly to oval window via cholesteatoma mass, preserving hearing despite ossicular erosion", bold: false },
    { text: "SNHL: 5–33 dB range documented in CSOM studies — indicates cochlear involvement (Shambaugh)", bold: false },
    { text: "Tympanometry: type B (flat) curve — confirms TM perforation or middle ear effusion", bold: false },
  ], { x: 0.36, y: 1.38, w: 4.5, h: 3.9, size: 13 });

  s.addShape(pres.ShapeType.line, { x: 4.92, y: 1.0, w: 0, h: 4.4, line: { color: C.lgray, width: 1 } });
  s.addText("RADIOLOGY", { x: 5.04, y: 0.96, w: 4.5, h: 0.38, fontSize: 12.5, bold: true, color: C.blue, fontFace: "Calibri", charSpacing: 1 });
  addBullets(s, [
    { text: "HRCT temporal bone (non-contrast): gold standard — assess bony erosion, ossicular chain, tegmen, sigmoid sinus, facial canal", bold: true },
    { text: "CT findings: soft tissue density in middle ear/mastoid, scutal erosion, ossicular erosion, labyrinthine fistula", bold: false },
    { text: "MRI temporal bone: evaluates intracranial extension, dural involvement, and cholesteatoma on DW-MRI (non-EPI DWI)", bold: false },
    { text: "DW-MRI: cholesteatoma shows restricted diffusion (bright on DWI, dark ADC) — useful for detecting residual/recurrent disease", bold: false },
    { text: "Complementary HRCT + MRI recommended when cochlear nerve hypoplasia suspected (Cummings)", bold: false },
  ], { x: 5.04, y: 1.38, w: 4.5, h: 3.9, size: 13 });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 9 — Medical Management
// ══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  contentSlide(s);
  addHeading(s, "Medical Management");
  addDivider(s, 0.88);

  addBullets(s, [
    { text: "Goal: dry the ear, limit inflammation, prevent progression to complications", bold: true },
    { text: "Aural toilet (ear syringing / microsuction): removes debris, discharge, and granulation tissue — essential first step", bold: false },
    { text: "Topical ototopical antibiotics:", bold: true },
    { text: "Quinolone drops (ciprofloxacin/ofloxacin): first-line — broad spectrum, not ototoxic at clinical doses", sub: true },
    { text: "Aminoglycoside drops (framycetin, gentamicin): use with caution — potential ototoxicity with TM perforation", sub: true },
    { text: "Note: 35% of ears treated with topical ciprofloxacin ≥3 weeks develop Candida overgrowth (Cummings)", sub: true },
    { text: "Systemic antibiotics: indicated for acute exacerbations, resistant infections, or when topical therapy fails", bold: false },
    { text: "Treat underlying causes: allergic rhinitis, adenoid hypertrophy, nasal polyposis", bold: false },
    { text: "Indications to proceed to surgery:", bold: true },
    { text: "Failure of multiple courses of medical treatment", sub: true },
    { text: "Presence of cholesteatoma (near-absolute indication)", sub: true },
    { text: "Complications: vertigo, facial weakness, headache (suspect intracranial spread)", sub: true },
    { text: "Atelectatic ears with significant CHL", sub: true },
  ], { x: 0.45, y: 0.95, w: 9.1, h: 4.5, size: 13.5 });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 10 — Surgical Management
// ══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  contentSlide(s);
  addHeading(s, "Surgical Management");
  addDivider(s, 0.88);

  s.addText("THREE PRIORITIES (Shambaugh)", { x: 0.36, y: 0.96, w: 9.28, h: 0.36, fontSize: 12, bold: true, color: C.blue, fontFace: "Calibri", align: "left", charSpacing: 1 });

  const priorities = [
    { num: "1", label: "Eradication\nof Disease", color: C.red },
    { num: "2", label: "Prevention of\nRecurrence", color: C.blue },
    { num: "3", label: "Preservation /\nRestoration of Hearing", color: C.green },
  ];
  priorities.forEach((p, i) => {
    const x = 0.36 + i * 3.15;
    s.addShape(pres.ShapeType.roundRect, { x, y: 1.38, w: 2.8, h: 0.85, fill: { color: p.color }, line: { color: p.color, width: 0 }, rectRadius: 0.08 });
    s.addText(`${p.num}. ${p.label}`, { x, y: 1.38, w: 2.8, h: 0.85, fontSize: 12, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle" });
  });

  addBullets(s, [
    { text: "Tympanoplasty / Myringoplasty: TM repair for tubo-tympanic type without cholesteatoma; fascia graft (underlay/overlay technique)", bold: false },
    { text: "Canal Wall Up (CWU) Mastoidectomy: posterior EAC preserved; preferred approach — fewer cavity problems; higher cholesteatoma recidivism (5–71% in children)", bold: false },
    { text: "Canal Wall Down (CWD) Mastoidectomy: posterior canal wall removed → open cavity; better access, lower recurrence; requires lifelong cavity maintenance", bold: false },
    { text: "Ossiculoplasty: reconstruction of eroded ossicular chain (TORP / PORP / autologous incus interposition)", bold: false },
    { text: "CWD indications: labyrinthine fistula, unresectable disease on facial nerve or stapes footplate, low-lying tegmen, sinus tympani disease, unreconstructable posterior wall defect (Shambaugh)", bold: false },
    { text: "Second-look surgery: planned at 12–18 months for CWU to check for residual cholesteatoma", bold: false },
  ], { x: 0.45, y: 2.35, w: 9.1, h: 3.0, size: 13 });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 11 — Complications
// ══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  contentSlide(s);
  addHeading(s, "Complications");
  addDivider(s, 0.88);

  // Extracranial
  s.addShape(pres.ShapeType.roundRect, { x: 0.36, y: 1.0, w: 4.3, h: 4.35, fill: { color: "EAF4FB" }, line: { color: C.blue, width: 1.5 }, rectRadius: 0.1 });
  s.addText("EXTRACRANIAL", { x: 0.36, y: 1.0, w: 4.3, h: 0.5, fontSize: 12.5, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle", fill: { color: C.blue } });
  s.addText([
    { text: "• Hearing loss (CHL / SNHL)", options: { fontSize: 13, color: C.dktext, breakLine: true } },
    { text: "• Labyrinthitis (suppurative / serous)", options: { fontSize: 13, color: C.dktext, breakLine: true } },
    { text: "• Labyrinthine fistula (most common: lateral SCC)", options: { fontSize: 13, color: C.dktext, breakLine: true } },
    { text: "• Facial nerve palsy (Fallopian canal erosion)", options: { fontSize: 13, color: C.dktext, breakLine: true } },
    { text: "• Acute mastoiditis / subperiosteal abscess", options: { fontSize: 13, color: C.dktext, breakLine: true } },
    { text: "• Petrous apicitis (Gradenigo's syndrome)", options: { fontSize: 13, color: C.dktext, breakLine: true } },
    { text: "• Bezold's abscess (pus tracks under SCM)", options: { fontSize: 13, color: C.dktext, breakLine: true } },
  ], { x: 0.5, y: 1.56, w: 4.0, h: 3.7, fontFace: "Calibri", valign: "top" });

  // Intracranial
  s.addShape(pres.ShapeType.roundRect, { x: 5.0, y: 1.0, w: 4.3, h: 4.35, fill: { color: "FDECEA" }, line: { color: C.red, width: 1.5 }, rectRadius: 0.1 });
  s.addText("INTRACRANIAL", { x: 5.0, y: 1.0, w: 4.3, h: 0.5, fontSize: 12.5, bold: true, color: C.white, fontFace: "Calibri", align: "center", valign: "middle", fill: { color: C.red } });
  s.addText([
    { text: "• Meningitis (most common intracranial)", options: { fontSize: 13, color: C.dktext, breakLine: true } },
    { text: "• Extradural abscess", options: { fontSize: 13, color: C.dktext, breakLine: true } },
    { text: "• Subdural empyema", options: { fontSize: 13, color: C.dktext, breakLine: true } },
    { text: "• Brain abscess (temporal lobe / cerebellum)", options: { fontSize: 13, color: C.dktext, breakLine: true } },
    { text: "• Sigmoid / lateral sinus thrombophlebitis", options: { fontSize: 13, color: C.red, bold: true, breakLine: true } },
    { text: "• Otitic hydrocephalus", options: { fontSize: 13, color: C.dktext, breakLine: true } },
    { text: "⚠ Otalgia + headache + CSOM = suspect intracranial complication until proved otherwise", options: { fontSize: 12, color: C.red, bold: true, breakLine: true } },
  ], { x: 5.14, y: 1.56, w: 4.0, h: 3.7, fontFace: "Calibri", valign: "top" });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 12 — Cholesteatoma Close-Up
// ══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  contentSlide(s);
  addHeading(s, "Cholesteatoma — Key Concepts");
  addDivider(s, 0.88);

  addBullets(s, [
    { text: "Definition: keratinising squamous epithelium within the middle ear cleft — NOT a true tumour", bold: true },
    { text: "Types:", bold: true },
    { text: "Congenital: behind intact TM, typically antero-superior quadrant; no prior OM / surgery", sub: true },
    { text: "Acquired primary: migration from attic retraction pocket (pars flaccida)", sub: true },
    { text: "Acquired secondary: ingrowth of squamous epithelium through TM perforation", sub: true },
    { text: "Mechanism of bone erosion: osteoclast activation by prostaglandins, TNF-α, IL-1, collagenases produced by keratinocytes", bold: false },
    { text: "Paediatric cholesteatoma: considered more aggressive — faster keratinocyte replication (Bujia et al.); recidivism 5–71% post-CWU surgery", bold: false },
    { text: "Imaging: DW-MRI (non-EPI) — diffusion restriction identifies residual or recurrent cholesteatoma non-invasively", bold: true },
    { text: "Surgery is the only definitive treatment; combined approach tympanoplasty (CAT) allows staged disease removal with hearing reconstruction", bold: false },
  ], { x: 0.45, y: 0.95, w: 9.1, h: 4.5, size: 13.5 });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 13 — Key Take-Away Points
// ══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  contentSlide(s);
  addHeading(s, "Key Points & Take-Away");
  addDivider(s, 0.88);

  const points = [
    { icon: "01", text: "CSOM = persistent TM perforation + otorrhoea >6–12 weeks; central pathology is ET dysfunction" },
    { icon: "02", text: "Safe (tubo-tympanic) vs. Unsafe (attico-antral/cholesteatoma) — a critical clinical distinction governing management" },
    { icon: "03", text: "Otalgia or headache in CSOM = red flag — rule out intracranial complication urgently" },
    { icon: "04", text: "Full audiogram preoperatively is mandatory; CHL >30 dB suggests ossicular erosion" },
    { icon: "05", text: "HRCT temporal bone is the imaging gold standard; DW-MRI detects residual/recurrent cholesteatoma" },
    { icon: "06", text: "Medical Rx: aural toilet + ototopical quinolones; monitor for fungal superinfection with prolonged use" },
    { icon: "07", text: "Surgery goals: 1. Eradicate disease  2. Prevent recurrence  3. Restore hearing (Shambaugh)" },
    { icon: "08", text: "Cholesteatoma combined with medically refractory CSOM = near-absolute indication for mastoidectomy" },
  ];

  const rows = 4, cols = 2;
  const bW = 4.4, bH = 0.78, gapX = 0.5, gapY = 0.15;
  const startX = 0.38, startY = 0.97;
  points.forEach((p, i) => {
    const col = i % cols;
    const row = Math.floor(i / cols);
    const x = startX + col * (bW + gapX);
    const y = startY + row * (bH + gapY);
    s.addShape(pres.ShapeType.roundRect, { x, y, w: bW, h: bH, fill: { color: row % 2 === 0 ? "E8F4FD" : "EDF7EE" }, line: { color: C.lgray, width: 0 }, rectRadius: 0.07 });
    s.addText(p.icon, { x: x + 0.05, y, w: 0.55, h: bH, fontSize: 18, bold: true, color: C.gold, fontFace: "Calibri", align: "center", valign: "middle" });
    s.addText(p.text, { x: x + 0.6, y: y + 0.06, w: bW - 0.68, h: bH - 0.12, fontSize: 11.5, color: C.dktext, fontFace: "Calibri", valign: "middle" });
  });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 14 — References
// ══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  titleSlide(s);
  addHeading(s, "References");

  s.addText([
    { text: "1. ", options: { bold: true, color: C.gold } },
    { text: "Shambaugh GE, Glasscock ME. ", options: { italic: true, color: C.white } },
    { text: "Surgery of the Ear", options: { italic: true, bold: true, color: C.lgray } },
    { text: ", 6th ed. PMPH-USA; 2010. Chapter 30 — Mastoiditis and Chronic Suppurative Otitis Media.", options: { italic: false, color: C.lgray } },
    { text: "\n", options: { breakLine: true, fontSize: 8, color: C.navy } },
    { text: "2. ", options: { bold: true, color: C.gold } },
    { text: "Flint PW, et al. ", options: { italic: true, color: C.white } },
    { text: "Cummings Otolaryngology Head and Neck Surgery", options: { italic: true, bold: true, color: C.lgray } },
    { text: ", 7th ed. Elsevier; 2021. Cochlear Implantation in CSOM.", options: { italic: false, color: C.lgray } },
    { text: "\n", options: { breakLine: true, fontSize: 8, color: C.navy } },
    { text: "3. ", options: { bold: true, color: C.gold } },
    { text: "Gleeson MJ, et al. ", options: { italic: true, color: C.white } },
    { text: "Scott-Brown's Otorhinolaryngology Head & Neck Surgery", options: { italic: true, bold: true, color: C.lgray } },
    { text: ", 8th ed. CRC Press; 2019. Chronic Otitis Media and Cholesteatoma.", options: { italic: false, color: C.lgray } },
    { text: "\n", options: { breakLine: true, fontSize: 8, color: C.navy } },
    { text: "4. ", options: { bold: true, color: C.gold } },
    { text: "Lee KJ. ", options: { italic: true, color: C.white } },
    { text: "K.J. Lee's Essential Otolaryngology", options: { italic: true, bold: true, color: C.lgray } },
    { text: ", 11th ed. McGraw-Hill; 2019.", options: { italic: false, color: C.lgray } },
  ], { x: 0.5, y: 1.0, w: 9.1, h: 4.0, fontFace: "Calibri", fontSize: 13, valign: "top" });

  s.addText("Thank You", { x: 0.5, y: 4.6, w: 9, h: 0.7, fontSize: 22, bold: true, color: C.gold, fontFace: "Calibri", align: "center", charSpacing: 6 });
}

// ── Write file ─────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/csom-ppt/CSOM_Presentation.pptx" })
  .then(() => console.log("SUCCESS: /home/daytona/workspace/csom-ppt/CSOM_Presentation.pptx"))
  .catch(e => { console.error("ERROR:", e); process.exit(1); });
Running Command

cd /home/daytona/workspace/csom-ppt && node csom.js

Editing File

~/csom-ppt/csom.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/csom-ppt/csom.js'
Editing File

~/csom-ppt/csom.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/csom-ppt/csom.js'
Running Command

cd /home/daytona/workspace/csom-ppt && node csom.js

Your CSOM presentation is ready! Download it here:

CSOM Presentation

Presentation · PPTX


What's inside — 14 slides

#Slide
1Title slide — deep navy/gold design
2Outline — 10 topics in two-column layout
3Definition & Introduction — ETD pathway, mucosal metaplasia
4Epidemiology — prevalence, peak age, WHO classification, risk factors
5Etiopathogenesis — visual flowchart (ET dysfunction → perforation) + microbiology & biofilm
6Classification — colour-coded Safe (tubo-tympanic) vs. Unsafe (attico-antral/cholesteatoma) boxes
7Clinical Features — two-column: symptoms vs. signs on otomicroscopy
8Audiological & Radiological Evaluation — PTA, HRCT, DW-MRI
9Medical Management — aural toilet, ototopical quinolones, indications for surgery
10Surgical Management — Shambaugh's 3 priorities, CWU vs. CWD mastoidectomy
11Complications — extracranial vs. intracranial two-column layout with red flags
12Cholesteatoma — Key Concepts — types, bone erosion mechanism, DW-MRI, recurrence
13Key Take-Away Points — 8 numbered cards
14References — Shambaugh, Cummings, Scott-Brown's, KJ Lee
Content is sourced directly from Shambaugh Surgery of the Ear, Cummings Otolaryngology, and Scott-Brown's ORL HNS from the textbook library. The design uses a navy/steel-blue/gold palette with clear visual hierarchy throughout.

Let the ppt be colorful, flowchart kind of, short crisppoints with lot of images.... 10 slides excluding intro slide snd thank u slide

Finding Sources
Finding Sources
Reading File
Searching Content

"cdn.orris.care" in /textbooks/9781607950264

Searching Content

"cdn.orris.care" in /textbooks/9780323612173

Finding Sources
Reading File
Reading File
Reading File
Writing File

~/csom-ppt/csom_v2.js

const pptxgen = require("pptxgenjs");
const { execSync } = require("child_process");

// ─── Fetch images as base64 ────────────────────────────────────
const IMG_URLS = [
  "https://cdn.orris.care/cdss_images/aaee9da2a72b7ca8b88ad6b3528b9f5190f0404ce8eb5c5c06f321d3c509aeaa.png", // mastoid abscess ear A
  "https://cdn.orris.care/cdss_images/714765bc5fb265cf5b0caef47a53948f22aeac9d3aefcc7652d1ed7c0f02bc17.png", // cholesteatoma otoscopy
  "https://cdn.orris.care/cdss_images/aa2041c7dd351612453d54f0591d6a35e36fc6744f94e5948e3d51e0ea04af25.png", // temporal bone histo
  "https://cdn.orris.care/cdss_images/c0bf0d337eab6e7ae3de5732b271dd4d2d5da7dcc9df9edc92515fc34f1f9079.png", // COM without cholesteatoma histo
];
console.log("Fetching images...");
let imgs = [];
try {
  const raw = execSync(
    `node /home/daytona/skills/shared/scripts/fetch_images.js ${IMG_URLS.map(u => `"${u}"`).join(" ")}`,
    { maxBuffer: 50 * 1024 * 1024 }
  ).toString();
  imgs = JSON.parse(raw);
  console.log("Images fetched:", imgs.map(i => i.error ? "FAIL" : "OK"));
} catch(e) {
  console.error("Image fetch error:", e.message);
  imgs = IMG_URLS.map(() => ({ base64: null, error: "failed" }));
}

function imgData(idx) {
  return imgs[idx] && !imgs[idx].error ? imgs[idx].base64 : null;
}

// ─── Palette ───────────────────────────────────────────────────
const C = {
  // Per-slide accent colors (vibrant)
  c1: "E74C3C",  // red
  c2: "E67E22",  // orange
  c3: "F1C40F",  // yellow
  c4: "27AE60",  // green
  c5: "1ABC9C",  // teal
  c6: "2980B9",  // blue
  c7: "8E44AD",  // purple
  c8: "D35400",  // dark orange
  c9: "16A085",  // dark teal
  c10:"C0392B",  // dark red
  white: "FFFFFF",
  dktext: "1A1A2E",
  ltgray: "ECF0F1",
  midgray:"95A5A6",
};

const SLIDE_COLORS = [C.c1, C.c2, C.c4, C.c6, C.c7, C.c5, C.c8, C.c3, C.c9, C.c10];

const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Chronic Suppurative Otitis Media";

// ─── Helpers ──────────────────────────────────────────────────
function darkBg(slide, accent) {
  slide.addShape(pres.ShapeType.rect, { x:0, y:0, w:"100%", h:"100%", fill:{ color:"1A1A2E" } });
  slide.addShape(pres.ShapeType.rect, { x:0, y:0, w:0.2, h:"100%", fill:{ color: accent } });
}

function contentBg(slide, accent) {
  slide.addShape(pres.ShapeType.rect, { x:0, y:0, w:"100%", h:"100%", fill:{ color:"F8F9FA" } });
  // top bar
  slide.addShape(pres.ShapeType.rect, { x:0, y:0, w:"100%", h:0.75, fill:{ color: accent } });
  // left accent strip
  slide.addShape(pres.ShapeType.rect, { x:0, y:0.75, w:0.06, h:"100%", fill:{ color: accent } });
}

function heading(slide, text, accent) {
  slide.addText(text, {
    x:0.25, y:0.08, w:9.5, h:0.6,
    fontSize:20, bold:true, color:C.white,
    fontFace:"Calibri", valign:"middle", align:"left",
  });
  // small decorative line at bottom of header
  slide.addShape(pres.ShapeType.rect, { x:0.25, y:0.69, w:9.5, h:0.04, fill:{ color:"FFFFFF" }, line:{ type:"none" } });
}

function crisp(items) {
  // takes array of strings and returns pptxgen rich text array
  return items.map((txt, i) => ({
    text: txt,
    options: {
      bullet: { code: "25B6", fontSize: 8 }, // filled triangle bullet
      fontSize: 13.5,
      color: C.dktext,
      bold: false,
      breakLine: i < items.length - 1,
      paraSpaceAfter: 5,
    }
  }));
}

// ══════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE
// ══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  // gradient-ish with dark navy + teal accent
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:"100%", h:"100%", fill:{ color:"0D1B2A" } });
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:"100%", h:0.18, fill:{ color:"1ABC9C" } });
  s.addShape(pres.ShapeType.rect, { x:0, y:5.46, w:"100%", h:0.18, fill:{ color:"1ABC9C" } });
  // big vertical colour splash
  s.addShape(pres.ShapeType.rect, { x:7.2, y:0, w:2.8, h:"100%", fill:{ color:"1ABC9C" }, transparency:75 });

  s.addText("CHRONIC\nSUPPURATIVE\nOTITIS MEDIA", {
    x:0.4, y:0.5, w:6.5, h:3.4,
    fontSize:42, bold:true, color:C.white, fontFace:"Calibri",
    align:"left", valign:"middle", lineSpacingMultiple:1.1,
  });
  s.addText("CSOM", {
    x:0.4, y:3.9, w:3, h:0.65,
    fontSize:28, bold:true, color:"1ABC9C", fontFace:"Calibri", charSpacing:10,
  });
  s.addText("ENT Department  ·  2026", {
    x:0.4, y:4.7, w:6, h:0.45,
    fontSize:13, color:"95A5A6", fontFace:"Calibri", italic:true,
  });
  s.addText("Source: Shambaugh Surgery of the Ear | Cummings Otolaryngology | Scott-Brown's ORL", {
    x:0.4, y:5.1, w:9, h:0.3,
    fontSize:9, color:"607080", fontFace:"Calibri", italic:true,
  });
  // decorative ear icon text
  s.addText("👂", { x:7.5, y:1.2, w:2, h:2, fontSize:80, align:"center" });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 2 — DEFINITION & EPIDEMIOLOGY  (accent: red)
// ══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  const acc = SLIDE_COLORS[0];
  contentBg(s, acc);
  heading(s, "Definition & Epidemiology", acc);

  // Definition box (left)
  s.addShape(pres.ShapeType.roundRect, {
    x:0.2, y:0.82, w:5.8, h:2.0,
    fill:{ color: acc }, line:{ type:"none" }, rectRadius:0.1,
  });
  s.addText("DEFINITION", { x:0.3, y:0.84, w:5.6, h:0.4, fontSize:11, bold:true, color:C.white, fontFace:"Calibri", charSpacing:2 });
  s.addText(
    "Chronic inflammation of the mucoperiosteum of the middle ear cleft — persistent TM perforation + otorrhoea > 6–12 weeks",
    { x:0.3, y:1.2, w:5.6, h:1.5, fontSize:13.5, color:C.white, fontFace:"Calibri", valign:"top" }
  );

  // Stats boxes (right column)
  const stats = [
    { val:"1–2%", lbl:"global prevalence" },
    { val:"<2 yrs", lbl:"peak incidence" },
    { val:"WHO", lbl:"massive public\nhealth problem" },
  ];
  stats.forEach((st, i) => {
    const y = 0.82 + i * 0.75;
    s.addShape(pres.ShapeType.roundRect, { x:6.2, y, w:3.5, h:0.65, fill:{ color:"FDECEA" }, line:{ color: acc, width:1.5 }, rectRadius:0.08 });
    s.addText(st.val, { x:6.3, y: y+0.04, w:1.0, h:0.55, fontSize:16, bold:true, color: acc, fontFace:"Calibri", align:"center", valign:"middle" });
    s.addText(st.lbl, { x:7.35, y: y+0.08, w:2.2, h:0.5, fontSize:11, color: C.dktext, fontFace:"Calibri", valign:"middle" });
  });

  // Risk factors
  s.addText("RISK FACTORS", { x:0.25, y:2.9, w:9.5, h:0.35, fontSize:11, bold:true, color: acc, fontFace:"Calibri", charSpacing:2 });
  const risks = ["Eustachian tube dysfunction", "Recurrent acute otitis media", "Overcrowding & malnutrition", "Cleft palate / Down syndrome", "Allergic rhinitis / adenoid hypertrophy", "Immunodeficiency (HIV, primary)"];
  risks.forEach((r, i) => {
    const col = i % 3;
    const row = Math.floor(i / 3);
    const x = 0.2 + col * 3.25;
    const y = 3.3 + row * 0.58;
    s.addShape(pres.ShapeType.roundRect, { x, y, w:3.1, h:0.5, fill:{ color:"FDECEA" }, line:{ color: acc, width:1 }, rectRadius:0.07 });
    s.addText("• " + r, { x: x+0.1, y, w:2.95, h:0.5, fontSize:12, color:C.dktext, fontFace:"Calibri", valign:"middle" });
  });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 3 — ETIOPATHOGENESIS FLOWCHART  (accent: orange)
// ══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  const acc = SLIDE_COLORS[1];
  contentBg(s, acc);
  heading(s, "Etiopathogenesis", acc);

  // Vertical flowchart with 5 nodes
  const nodes = [
    { label:"Eustachian Tube\nDysfunction", sub:"Negative middle ear\npressure", color: acc },
    { label:"Middle Ear\nEffusion", sub:"Serous / purulent\nfluid accumulates", color:"E67E22" },
    { label:"Mucosal Oedema &\nGranulation Tissue", sub:"BM rupture → fibroblast\nrecruitment, polyp formation", color:"D35400" },
    { label:"TM Weakening", sub:"Enzymes degrade\ncollagen skeleton", color:"C0392B" },
    { label:"Perforation /\nRetraction Pocket", sub:"→ CSOM / Cholesteatoma", color:"8B0000" },
  ];

  const nodeW = 1.7, nodeH = 0.98, startX = 0.25, arrowGap = 0.2;
  const totalW = nodes.length * nodeW + (nodes.length - 1) * arrowGap;
  nodes.forEach((n, i) => {
    const x = startX + i * (nodeW + arrowGap);
    const y = 0.88;
    s.addShape(pres.ShapeType.roundRect, { x, y, w:nodeW, h:nodeH, fill:{ color: n.color }, line:{ type:"none" }, rectRadius:0.1 });
    s.addText(n.label, { x, y: y+0.05, w:nodeW, h:0.5, fontSize:11, bold:true, color:C.white, fontFace:"Calibri", align:"center", valign:"middle" });
    s.addText(n.sub, { x, y: y+0.53, w:nodeW, h:0.42, fontSize:9, color:"FFD5C8", fontFace:"Calibri", align:"center", valign:"top" });
    if (i < nodes.length - 1) {
      const ax = x + nodeW + 0.02;
      s.addShape(pres.ShapeType.line, { x: ax, y: y + nodeH/2, w: arrowGap - 0.04, h:0, line:{ color:"FFFFFF", width:2.5 } });
      s.addText("▶", { x: ax + arrowGap - 0.2, y: y + nodeH/2 - 0.15, w:0.25, h:0.3, fontSize:12, color:C.white, fontFace:"Calibri" });
    }
  });

  // Microbiology strip
  s.addShape(pres.ShapeType.rect, { x:0.1, y:2.0, w:9.8, h:0.38, fill:{ color:"FEF9E7" }, line:{ color: acc, width:1 } });
  s.addText("🦠  KEY ORGANISMS: Pseudomonas aeruginosa  ·  Staph. aureus  ·  Proteus mirabilis  ·  Klebsiella  ·  Candida (after prolonged topical Abx)", {
    x:0.2, y:2.0, w:9.6, h:0.38, fontSize:11, color:"7D6608", fontFace:"Calibri", valign:"middle", bold:true,
  });

  // Two-column key concepts
  const cols = [
    ["Biofilm formation — major driver of treatment resistance (demonstrated 2006)", "Bacterial toxins → BM rupture → lamina propria extrusion", "Fibroblast + neovascularization → granulation polyps"],
    ["Candida overgrowth: 10% at baseline, rises to 35% after 3-week topical ciprofloxacin (Cummings)", "Submucosal gland metaplasia → secretory mucosa → perpetuates effusion", "Retraction pocket → trapped keratin → cholesteatoma"],
  ];
  cols.forEach((col, ci) => {
    const x = 0.2 + ci * 4.9;
    col.forEach((txt, ti) => {
      s.addText("▸  " + txt, {
        x, y: 2.5 + ti * 0.82, w: 4.7, h: 0.75,
        fontSize:12, color:C.dktext, fontFace:"Calibri", valign:"top",
      });
      if (ti < col.length-1) {
        s.addShape(pres.ShapeType.line, { x, y: 2.5 + (ti+1)*0.82 - 0.05, w:4.7, h:0, line:{ color:"D5D8DC", width:0.5 } });
      }
    });
  });
  s.addShape(pres.ShapeType.line, { x:5.0, y:2.5, w:0, h:2.55, line:{ color:"D5D8DC", width:1 } });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 4 — CLASSIFICATION (Safe vs Unsafe)  (accent: green)
// ══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  const acc = SLIDE_COLORS[2];
  contentBg(s, acc);
  heading(s, "Classification", acc);

  // VS badge centre
  s.addShape(pres.ShapeType.ellipse, { x:4.6, y:1.5, w:0.8, h:0.8, fill:{ color:"1A1A2E" }, line:{ type:"none" } });
  s.addText("VS", { x:4.6, y:1.5, w:0.8, h:0.8, fontSize:14, bold:true, color:C.white, fontFace:"Calibri", align:"center", valign:"middle" });

  // Left (Safe / Tubo-tympanic)
  const ltCol = [
    "Central TM perforation (pars tensa)",
    "No cholesteatoma",
    "Mucoid, odourless discharge",
    "Responds to medical Rx",
    "Surgery: Myringoplasty / Tympanoplasty",
    "Lower risk of complications",
  ];
  s.addShape(pres.ShapeType.roundRect, { x:0.15, y:0.82, w:4.3, h:4.5, fill:{ color:"E9F7EF" }, line:{ color: acc, width:2 }, rectRadius:0.12 });
  s.addShape(pres.ShapeType.roundRect, { x:0.15, y:0.82, w:4.3, h:0.7, fill:{ color: acc }, line:{ type:"none" }, rectRadius:0.12 });
  s.addText("TUBO-TYMPANIC\n(SAFE / BENIGN)", { x:0.2, y:0.84, w:4.2, h:0.65, fontSize:13, bold:true, color:C.white, fontFace:"Calibri", align:"center", valign:"middle" });
  ltCol.forEach((t, i) => {
    s.addText("✔  " + t, { x:0.3, y:1.6 + i*0.54, w:4.0, h:0.5, fontSize:12.5, color:C.dktext, fontFace:"Calibri", valign:"top" });
  });

  // Right (Unsafe / Attico-antral)
  const unsafeCol = [
    "Attic / marginal perforation (pars flaccida)",
    "CHOLESTEATOMA present",
    "Scanty, FETID (foul-smelling) discharge",
    "Scutal & ossicular erosion on examination",
    "Risk of intracranial complications ⚠",
    "Surgery: Mastoidectomy (CWU or CWD)",
  ];
  const urgRed = "C0392B";
  s.addShape(pres.ShapeType.roundRect, { x:5.55, y:0.82, w:4.3, h:4.5, fill:{ color:"FDEDEC" }, line:{ color: urgRed, width:2 }, rectRadius:0.12 });
  s.addShape(pres.ShapeType.roundRect, { x:5.55, y:0.82, w:4.3, h:0.7, fill:{ color: urgRed }, line:{ type:"none" }, rectRadius:0.12 });
  s.addText("ATTICO-ANTRAL\n(UNSAFE / DANGEROUS)", { x:5.6, y:0.84, w:4.2, h:0.65, fontSize:13, bold:true, color:C.white, fontFace:"Calibri", align:"center", valign:"middle" });
  unsafeCol.forEach((t, i) => {
    const isRed = t.includes("CHOLESTEATOMA") || t.includes("intracranial");
    s.addText((isRed ? "⚠  " : "✖  ") + t, { x:5.65, y:1.6 + i*0.54, w:4.1, h:0.5, fontSize:12.5, color: isRed ? urgRed : C.dktext, bold: isRed, fontFace:"Calibri", valign:"top" });
  });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 5 — CLINICAL FEATURES  (accent: blue)
// ══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  const acc = SLIDE_COLORS[3];
  contentBg(s, acc);
  heading(s, "Clinical Features", acc);

  // Two columns: Symptoms | Signs
  const symptoms = [
    "Otorrhoea — intermittent/continuous",
    "CHL — most common hearing complaint",
    "Otalgia / headache ⚠ = red flag (suspect complication)",
    "Vertigo → labyrinthitis / fistula",
    "Tinnitus",
    "Facial weakness — rare (CN VII involvement)",
  ];
  const signs = [
    "TM perforation (central vs. attic/marginal)",
    "Discharge / granulation tissue in EAC",
    "Scutal erosion — hallmark of cholesteatoma",
    "Retraction pocket with squamous debris",
    "Tuning fork: Rinne −ve, Weber lateralised",
    "Post-auricular swelling / fistula (mastoiditis)",
  ];

  s.addShape(pres.ShapeType.rect, { x:0.12, y:0.82, w:4.75, h:0.42, fill:{ color: acc }, line:{ type:"none" } });
  s.addText("SYMPTOMS", { x:0.2, y:0.82, w:4.6, h:0.42, fontSize:12, bold:true, color:C.white, fontFace:"Calibri", valign:"middle", charSpacing:2 });
  symptoms.forEach((t, i) => {
    const isRed = t.includes("red flag");
    s.addShape(pres.ShapeType.rect, { x:0.12, y:1.3+i*0.63, w:4.75, h:0.56, fill:{ color: i%2===0 ? "EBF5FB" : "D6EAF8" }, line:{ type:"none" } });
    s.addText((isRed ? "⚠ " : "► ") + t, { x:0.22, y:1.33+i*0.63, w:4.5, h:0.5, fontSize:12, color: isRed ? "C0392B" : C.dktext, bold: isRed, fontFace:"Calibri", valign:"middle" });
  });

  s.addShape(pres.ShapeType.rect, { x:5.13, y:0.82, w:4.75, h:0.42, fill:{ color:"1A5276" }, line:{ type:"none" } });
  s.addText("SIGNS (Otomicroscopy)", { x:5.21, y:0.82, w:4.6, h:0.42, fontSize:12, bold:true, color:C.white, fontFace:"Calibri", valign:"middle", charSpacing:2 });
  signs.forEach((t, i) => {
    const isRed = t.includes("Scutal") || t.includes("hallmark");
    s.addShape(pres.ShapeType.rect, { x:5.13, y:1.3+i*0.63, w:4.75, h:0.56, fill:{ color: i%2===0 ? "EBF5FB" : "D6EAF8" }, line:{ type:"none" } });
    s.addText((isRed ? "★ " : "► ") + t, { x:5.23, y:1.33+i*0.63, w:4.5, h:0.5, fontSize:12, color: isRed ? "8E44AD" : C.dktext, bold: isRed, fontFace:"Calibri", valign:"middle" });
  });

  // vertical divider
  s.addShape(pres.ShapeType.line, { x:4.97, y:0.82, w:0, h:4.1, line:{ color:"BDC3C7", width:1.5 } });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 6 — OTOSCOPIC IMAGES + HISTOLOGY (Image slide)  (accent: purple)
// ══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  const acc = SLIDE_COLORS[4];
  contentBg(s, acc);
  heading(s, "Otoscopic & Histological Findings", acc);

  // Image 1 (cholesteatoma otoscopy)
  const img1 = imgData(1);
  const img2 = imgData(2);
  const img3 = imgData(3);

  if (img1) {
    s.addImage({ data: img1, x:0.15, y:0.85, w:3.1, h:2.3 });
  } else {
    s.addShape(pres.ShapeType.rect, { x:0.15, y:0.85, w:3.1, h:2.3, fill:{ color:"D5D8DC" } });
  }
  s.addText("Cholesteatoma — otoscopy\n(attic retraction with keratin debris)", {
    x:0.15, y:3.2, w:3.1, h:0.65, fontSize:10.5, color:"4A235A", fontFace:"Calibri", align:"center", italic:true,
  });

  if (img2) {
    s.addImage({ data: img2, x:3.45, y:0.85, w:3.1, h:2.3 });
  } else {
    s.addShape(pres.ShapeType.rect, { x:3.45, y:0.85, w:3.1, h:2.3, fill:{ color:"D5D8DC" } });
  }
  s.addText("Cholesteatoma — H&E temporal bone\n(keratin sac eroding stapes suprastructure)", {
    x:3.45, y:3.2, w:3.1, h:0.65, fontSize:10.5, color:"4A235A", fontFace:"Calibri", align:"center", italic:true,
  });

  if (img3) {
    s.addImage({ data: img3, x:6.75, y:0.85, w:3.1, h:2.3 });
  } else {
    s.addShape(pres.ShapeType.rect, { x:6.75, y:0.85, w:3.1, h:2.3, fill:{ color:"D5D8DC" } });
  }
  s.addText("COM without cholesteatoma — H&E\n(TM perforation + inflammatory exudate)", {
    x:6.75, y:3.2, w:3.1, h:0.65, fontSize:10.5, color:"4A235A", fontFace:"Calibri", align:"center", italic:true,
  });

  // Key diagnostic points strip
  s.addShape(pres.ShapeType.rect, { x:0.1, y:4.0, w:9.8, h:1.48, fill:{ color:"F4ECF7" }, line:{ color: acc, width:1 } });
  const diagPts = [
    "Scutal erosion on CT = cholesteatoma until proved otherwise",
    "Pars flaccida retraction most common cholesteatoma origin",
    "DW-MRI (non-EPI) — restricted diffusion = cholesteatoma",
    "HRCT temporal bone = gold standard pre-op imaging",
  ];
  diagPts.forEach((d, i) => {
    const col = i % 2, row = Math.floor(i / 2);
    s.addText("◆  " + d, { x:0.25 + col*4.9, y:4.1 + row*0.65, w:4.7, h:0.6, fontSize:12, color:"6C3483", bold: i===0||i===2, fontFace:"Calibri", valign:"middle" });
  });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 7 — INVESTIGATIONS (Audiology + Radiology)  (accent: teal)
// ══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  const acc = SLIDE_COLORS[5];
  contentBg(s, acc);
  heading(s, "Investigations", acc);

  // Audiology column
  s.addShape(pres.ShapeType.roundRect, { x:0.15, y:0.82, w:4.6, h:4.6, fill:{ color:"E8F8F5" }, line:{ color: acc, width:1.5 }, rectRadius:0.1 });
  s.addShape(pres.ShapeType.rect, { x:0.15, y:0.82, w:4.6, h:0.55, fill:{ color: acc }, line:{ type:"none" } });
  s.addText("🎧  AUDIOLOGICAL", { x:0.25, y:0.84, w:4.4, h:0.5, fontSize:13, bold:true, color:C.white, fontFace:"Calibri", valign:"middle" });
  const audPts = [
    "Pure Tone Audiogram (PTA) — mandatory pre-op",
    "CHL most common; SNHL if cochlear involvement",
    "CHL >30 dB → suspect ossicular erosion",
    "Sound via cholesteatoma mass can preserve hearing despite ossicular erosion",
    "Tympanometry: Type B (flat) = TM perf / MEE",
    "SNHL range documented: 5–33 dB (Shambaugh)",
  ];
  audPts.forEach((t, i) => {
    s.addText("▸  " + t, { x:0.25, y:1.45 + i*0.58, w:4.4, h:0.54, fontSize:12, color:C.dktext, fontFace:"Calibri", valign:"top" });
    if (i < audPts.length-1) s.addShape(pres.ShapeType.line, { x:0.25, y:1.45+(i+1)*0.58-0.04, w:4.4, h:0, line:{ color:"A9DFBF", width:0.5 } });
  });

  // Radiology column
  s.addShape(pres.ShapeType.roundRect, { x:5.15, y:0.82, w:4.6, h:4.6, fill:{ color:"EBF5FB" }, line:{ color:"1A5276", width:1.5 }, rectRadius:0.1 });
  s.addShape(pres.ShapeType.rect, { x:5.15, y:0.82, w:4.6, h:0.55, fill:{ color:"1A5276" }, line:{ type:"none" } });
  s.addText("🔬  RADIOLOGY", { x:5.25, y:0.84, w:4.4, h:0.5, fontSize:13, bold:true, color:C.white, fontFace:"Calibri", valign:"middle" });
  const radPts = [
    "HRCT temporal bone — GOLD STANDARD ★",
    "CT shows: soft tissue density, scutal/ossicular erosion, labyrinthine fistula",
    "DW-MRI — bright on DWI = cholesteatoma; detects residual/recurrent disease",
    "MRI for intracranial extension, dural involvement",
    "Complementary HRCT + MRI if cochlear nerve hypoplasia suspected",
    "Plain X-rays (Schuller's view): mastoid haziness — now largely obsolete",
  ];
  radPts.forEach((t, i) => {
    const bold = t.includes("GOLD STANDARD") || t.includes("DW-MRI");
    s.addText("▸  " + t, { x:5.25, y:1.45 + i*0.58, w:4.4, h:0.54, fontSize:12, color: bold ? "1A5276" : C.dktext, bold, fontFace:"Calibri", valign:"top" });
    if (i < radPts.length-1) s.addShape(pres.ShapeType.line, { x:5.25, y:1.45+(i+1)*0.58-0.04, w:4.4, h:0, line:{ color:"AED6F1", width:0.5 } });
  });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 8 — MEDICAL MANAGEMENT  (accent: dark orange)
// ══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  const acc = SLIDE_COLORS[6];
  contentBg(s, acc);
  heading(s, "Medical Management", acc);

  // Step flowchart (horizontal 4 steps)
  const steps = [
    { icon:"🧹", num:"01", lbl:"Aural Toilet", detail:"Micro-suction / syringing\nRemoves debris & discharge\nEssential FIRST step" },
    { icon:"💊", num:"02", lbl:"Topical Abx", detail:"Quinolone drops (1st line)\nOfloxacin / Ciprofloxacin\nNot ototoxic at clinical doses" },
    { icon:"💉", num:"03", lbl:"Systemic Abx", detail:"For acute exacerbations\nResistant infection\nTopical therapy failure" },
    { icon:"🩺", num:"04", lbl:"Treat Cause", detail:"Allergic rhinitis Rx\nAdenoidectomy if needed\nNasal polyposis management" },
  ];

  const sw = 2.2, sh = 2.35, sy = 0.88, gap = 0.12;
  steps.forEach((st, i) => {
    const x = 0.15 + i*(sw+gap);
    s.addShape(pres.ShapeType.roundRect, { x, y:sy, w:sw, h:sh, fill:{ color: acc }, line:{ type:"none" }, rectRadius:0.12 });
    s.addText(st.icon, { x, y:sy+0.1, w:sw, h:0.55, fontSize:26, align:"center" });
    s.addText(st.num, { x, y:sy+0.62, w:sw, h:0.35, fontSize:10, bold:true, color:"FEF9E7", fontFace:"Calibri", align:"center", charSpacing:3 });
    s.addText(st.lbl, { x, y:sy+0.93, w:sw, h:0.42, fontSize:13, bold:true, color:C.white, fontFace:"Calibri", align:"center" });
    s.addText(st.detail, { x, y:sy+1.35, w:sw, h:0.94, fontSize:10.5, color:"FEF9E7", fontFace:"Calibri", align:"center", valign:"top" });
    if (i < steps.length-1) {
      s.addText("▶", { x: x+sw+0.01, y: sy+sh/2-0.15, w:0.14, h:0.3, fontSize:13, color:C.white });
    }
  });

  // Indications for surgery
  s.addShape(pres.ShapeType.rect, { x:0.1, y:3.38, w:9.8, h:0.38, fill:{ color:"1A1A2E" }, line:{ type:"none" } });
  s.addText("⚡  INDICATIONS TO ESCALATE TO SURGERY", {
    x:0.2, y:3.38, w:9.6, h:0.38, fontSize:12, bold:true, color:C.white, fontFace:"Calibri", valign:"middle", charSpacing:1,
  });
  const surgInd = [
    "Failed multiple courses of medical Rx",
    "Cholesteatoma present (near-absolute indication)",
    "Vertigo → suspect labyrinthine fistula",
    "Facial weakness",
    "Headache / signs of intracranial spread",
    "Atelectatic ear with significant CHL",
  ];
  surgInd.forEach((t, i) => {
    const col = i % 3, row = Math.floor(i/3);
    s.addShape(pres.ShapeType.roundRect, {
      x:0.15 + col*3.25, y:3.85 + row*0.68, w:3.1, h:0.6,
      fill:{ color:"FEF9E7" }, line:{ color: acc, width:1 }, rectRadius:0.07,
    });
    s.addText("⚠  " + t, { x:0.25+col*3.25, y:3.88+row*0.68, w:2.95, h:0.54, fontSize:11.5, color:"7E5109", fontFace:"Calibri", valign:"middle" });
  });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 9 — SURGICAL MANAGEMENT  (accent: dark teal)
// ══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  const acc = SLIDE_COLORS[8];
  contentBg(s, acc);
  heading(s, "Surgical Management", acc);

  // 3 priorities badges
  const prios = [
    { n:"1", lbl:"ERADICATE\nDISEASE", col:"C0392B" },
    { n:"2", lbl:"PREVENT\nRECURRENCE", col:"1A5276" },
    { n:"3", lbl:"RESTORE\nHEARING", col:"1E8449" },
  ];
  prios.forEach((p, i) => {
    const x = 0.2 + i*3.25;
    s.addShape(pres.ShapeType.roundRect, { x, y:0.84, w:3.1, h:0.78, fill:{ color: p.col }, line:{ type:"none" }, rectRadius:0.1 });
    s.addText(`${p.n}. ${p.lbl}`, { x, y:0.84, w:3.1, h:0.78, fontSize:13, bold:true, color:C.white, fontFace:"Calibri", align:"center", valign:"middle" });
  });

  // CWU vs CWD comparison
  const surgeries = [
    {
      name:"TYMPANOPLASTY\n/ MYRINGOPLASTY",
      color: acc,
      pts:["TM repair for safe CSOM", "Temporalis fascia graft (underlay/overlay)", "Pre-op: ear dry ≥3–4 weeks", "Hearing restoration primary goal"],
    },
    {
      name:"CANAL WALL UP\n(CWU) MASTOIDECTOMY",
      color:"1A5276",
      pts:["Posterior EAC wall preserved", "Combined approach tympanoplasty (CAT)", "Preferred — no cavity problems", "Recidivism: 5–71% paediatric"],
    },
    {
      name:"CANAL WALL DOWN\n(CWD) MASTOIDECTOMY",
      color:"C0392B",
      pts:["Posterior wall removed (open cavity)", "Better access to disease", "Requires lifelong cavity maintenance", "2nd-look at 12–18 months in CWU"],
    },
  ];

  surgeries.forEach((sg, i) => {
    const x = 0.2 + i*3.25;
    s.addShape(pres.ShapeType.roundRect, { x, y:1.75, w:3.1, h:3.65, fill:{ color:"F2F3F4" }, line:{ color: sg.color, width:1.5 }, rectRadius:0.1 });
    s.addShape(pres.ShapeType.roundRect, { x, y:1.75, w:3.1, h:0.65, fill:{ color: sg.color }, line:{ type:"none" }, rectRadius:0.1 });
    s.addText(sg.name, { x: x+0.05, y:1.77, w:3.0, h:0.63, fontSize:11.5, bold:true, color:C.white, fontFace:"Calibri", align:"center", valign:"middle" });
    sg.pts.forEach((pt, pi) => {
      s.addText("▸  " + pt, { x: x+0.1, y:2.5 + pi*0.68, w:2.95, h:0.62, fontSize:12, color:C.dktext, fontFace:"Calibri", valign:"top" });
      if (pi < sg.pts.length-1) s.addShape(pres.ShapeType.line, { x: x+0.1, y:2.5+(pi+1)*0.68-0.04, w:2.95, h:0, line:{ color:"D5D8DC", width:0.5 } });
    });
  });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 10 — COMPLICATIONS  (accent: dark red)
// ══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  const acc = SLIDE_COLORS[9];
  contentBg(s, acc);
  heading(s, "Complications", acc);

  // Extracranial cluster
  s.addShape(pres.ShapeType.roundRect, { x:0.12, y:0.82, w:4.55, h:4.55, fill:{ color:"EBF5FB" }, line:{ color:"1A5276", width:2 }, rectRadius:0.12 });
  s.addShape(pres.ShapeType.roundRect, { x:0.12, y:0.82, w:4.55, h:0.55, fill:{ color:"1A5276" }, line:{ type:"none" }, rectRadius:0.12 });
  s.addText("🦻 EXTRACRANIAL", { x:0.22, y:0.84, w:4.35, h:0.5, fontSize:13, bold:true, color:C.white, fontFace:"Calibri", valign:"middle" });
  const exCC = [
    { t:"Conductive / Sensorineural Hearing Loss", c:C.dktext },
    { t:"Labyrinthitis (suppurative / serous)", c:C.dktext },
    { t:"Labyrinthine fistula — lateral SCC (most common)", c:C.dktext },
    { t:"Facial nerve palsy — Fallopian canal erosion", c:"8E44AD" },
    { t:"Acute mastoiditis / Subperiosteal abscess", c:C.dktext },
    { t:"Petrous apicitis — Gradenigo's syndrome", c:C.dktext },
    { t:"Bezold's abscess (pus under SCM)", c:C.dktext },
  ];
  exCC.forEach((item, i) => {
    s.addShape(pres.ShapeType.rect, { x:0.17, y:1.44+i*0.55, w:4.45, h:0.5, fill:{ color: i%2===0?"D6EAF8":"EBF5FB" }, line:{ type:"none" } });
    s.addText("• " + item.t, { x:0.27, y:1.47+i*0.55, w:4.25, h:0.46, fontSize:11.5, color:item.c, fontFace:"Calibri", valign:"middle" });
  });

  // Intracranial cluster
  s.addShape(pres.ShapeType.roundRect, { x:5.23, y:0.82, w:4.55, h:4.55, fill:{ color:"FDEDEC" }, line:{ color: acc, width:2 }, rectRadius:0.12 });
  s.addShape(pres.ShapeType.roundRect, { x:5.23, y:0.82, w:4.55, h:0.55, fill:{ color: acc }, line:{ type:"none" }, rectRadius:0.12 });
  s.addText("🧠 INTRACRANIAL", { x:5.33, y:0.84, w:4.35, h:0.5, fontSize:13, bold:true, color:C.white, fontFace:"Calibri", valign:"middle" });
  const intCC = [
    { t:"Meningitis — most common intracranial complication", c:acc },
    { t:"Extradural abscess", c:C.dktext },
    { t:"Subdural empyema", c:C.dktext },
    { t:"Brain abscess — temporal lobe / cerebellum", c: acc },
    { t:"Sigmoid / lateral sinus thrombophlebitis", c: acc },
    { t:"Otitic hydrocephalus", c:C.dktext },
    { t:"⚠ Otalgia + headache = intracranial complication until proved otherwise!", c: acc },
  ];
  intCC.forEach((item, i) => {
    const isBold = item.t.startsWith("⚠");
    s.addShape(pres.ShapeType.rect, { x:5.28, y:1.44+i*0.55, w:4.45, h:0.5, fill:{ color: i%2===0?"FADBD8":"FDEDEC" }, line:{ type:"none" } });
    s.addText("• " + item.t, { x:5.38, y:1.47+i*0.55, w:4.25, h:0.46, fontSize:11.5, color:item.c, bold: isBold, fontFace:"Calibri", valign:"middle" });
  });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 11 — MASTOID ABSCESS IMAGE + KEY SURGICAL POINTS
// ══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  const acc = "E74C3C";
  contentBg(s, acc);
  heading(s, "Mastoiditis — Clinical Correlation", acc);

  const img0 = imgData(0);
  if (img0) {
    s.addImage({ data: img0, x:0.15, y:0.85, w:3.8, h:3.0 });
  } else {
    s.addShape(pres.ShapeType.roundRect, { x:0.15, y:0.85, w:3.8, h:3.0, fill:{ color:"D5D8DC" }, rectRadius:0.1 });
    s.addText("Image: Mastoid Subperiosteal Abscess", { x:0.2, y:1.6, w:3.7, h:1.2, fontSize:11, color:"555", fontFace:"Calibri", align:"center" });
  }
  s.addText("Mastoid subperiosteal abscess\n(Shambaugh Surgery of the Ear, Fig. 30–1)", {
    x:0.15, y:3.88, w:3.8, h:0.6, fontSize:10, italic:true, color:"7B241C", fontFace:"Calibri", align:"center",
  });

  // Key points on the right
  const kpts = [
    { icon:"🔴", txt:"Acute-on-chronic — most common complication of CSOM" },
    { icon:"🌡️", txt:"Fever + pinna displacement + post-auricular tenderness + swelling" },
    { icon:"⚕️", txt:"HRCT: bony erosion of mastoid cortex + rim-enhancing collection" },
    { icon:"💊", txt:"IV antibiotics (anti-pseudomonal) + urgent cortical mastoidectomy" },
    { icon:"⚠", txt:"Bezold's abscess: pus perforates mastoid tip → tracks under SCM" },
    { icon:"⚡", txt:"Intracranial extension must always be excluded with MRI" },
  ];
  kpts.forEach((k, i) => {
    s.addShape(pres.ShapeType.roundRect, { x:4.2, y:0.88+i*0.75, w:5.65, h:0.67, fill:{ color: i%2===0?"FDEDEC":"FEF9E7" }, line:{ color: acc, width:0.5 }, rectRadius:0.07 });
    s.addText(k.icon + "  " + k.txt, { x:4.3, y:0.92+i*0.75, w:5.45, h:0.58, fontSize:12, color:C.dktext, fontFace:"Calibri", valign:"middle" });
  });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 12 — KEY TAKE-AWAYS / SUMMARY  (dark bg with vivid cards)
// ══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:"100%", h:"100%", fill:{ color:"0D1B2A" } });
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:"100%", h:0.72, fill:{ color:"1ABC9C" } });
  s.addText("KEY TAKE-AWAYS", {
    x:0.3, y:0.1, w:9.4, h:0.55, fontSize:20, bold:true, color:"0D1B2A", fontFace:"Calibri", align:"left", charSpacing:2,
  });

  const cards = [
    { acc:"E74C3C", txt:"CSOM = TM perforation + otorrhoea >6–12 wks | Central cause: ET dysfunction" },
    { acc:"E67E22", txt:"SAFE (tubo-tympanic) vs. UNSAFE (attico-antral / cholesteatoma) — critical distinction" },
    { acc:"F1C40F", txt:"Otalgia + headache = RED FLAG → rule out intracranial complication urgently" },
    { acc:"27AE60", txt:"Full PTA mandatory pre-op; CHL >30 dB = ossicular erosion; document SNHL" },
    { acc:"1ABC9C", txt:"HRCT temporal bone = gold standard; DW-MRI detects residual / recurrent cholesteatoma" },
    { acc:"2980B9", txt:"Medical Rx: aural toilet + ototopical quinolones; watch for Candida with prolonged use" },
    { acc:"8E44AD", txt:"Surgery: (1) Eradicate disease  (2) Prevent recurrence  (3) Restore hearing (Shambaugh)" },
    { acc:"E8A820", txt:"Cholesteatoma + medically refractory CSOM = near-absolute indication for mastoidectomy" },
  ];

  const cw = 4.7, ch = 0.72, gap = 0.12;
  cards.forEach((c, i) => {
    const col = i % 2, row = Math.floor(i / 2);
    const x = 0.15 + col * (cw + gap);
    const y = 0.86 + row * (ch + gap);
    s.addShape(pres.ShapeType.roundRect, { x, y, w:cw, h:ch, fill:{ color:"132236" }, line:{ color: c.acc, width:2 }, rectRadius:0.08 });
    s.addShape(pres.ShapeType.roundRect, { x, y, w:0.35, h:ch, fill:{ color: c.acc }, line:{ type:"none" }, rectRadius:0.08 });
    s.addText(String(i+1).padStart(2,"0"), { x, y, w:0.35, h:ch, fontSize:13, bold:true, color:"0D1B2A", fontFace:"Calibri", align:"center", valign:"middle" });
    s.addText(c.txt, { x: x+0.42, y: y+0.04, w: cw-0.5, h: ch-0.08, fontSize:11.5, color:"ECF0F1", fontFace:"Calibri", valign:"middle" });
  });
}

// ══════════════════════════════════════════════════════════════
// SLIDE 13 — THANK YOU
// ══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:"100%", h:"100%", fill:{ color:"0D1B2A" } });
  // colorful diagonal strips
  const strips = ["E74C3C","E67E22","F1C40F","27AE60","1ABC9C","2980B9","8E44AD"];
  strips.forEach((col, i) => {
    s.addShape(pres.ShapeType.rect, { x: i * (10/strips.length), y:0, w: 10/strips.length, h:0.22, fill:{ color: col }, line:{ type:"none" } });
    s.addShape(pres.ShapeType.rect, { x: i * (10/strips.length), y:5.4, w: 10/strips.length, h:0.22, fill:{ color: col }, line:{ type:"none" } });
  });

  s.addText("THANK YOU", {
    x:0.5, y:1.4, w:9, h:1.5, fontSize:52, bold:true, color:"1ABC9C",
    fontFace:"Calibri", align:"center", valign:"middle", charSpacing:8,
  });
  s.addText("Questions & Discussion", {
    x:0.5, y:3.0, w:9, h:0.7, fontSize:22, color:"95A5A6",
    fontFace:"Calibri", align:"center", italic:true,
  });
  s.addText("Sources: Shambaugh Surgery of the Ear  ·  Cummings Otolaryngology  ·  Scott-Brown's ORL HNS  ·  KJ Lee's Essential Otolaryngology", {
    x:0.5, y:4.6, w:9, h:0.5, fontSize:9.5, color:"607080",
    fontFace:"Calibri", align:"center", italic:true,
  });
}

// ─── Write ─────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/csom-ppt/CSOM_v2.pptx" })
  .then(() => console.log("SUCCESS: /home/daytona/workspace/csom-ppt/CSOM_v2.pptx"))
  .catch(e => { console.error("ERROR:", e); process.exit(1); });
Running Command

cd /home/daytona/workspace/csom-ppt && node csom_v2.js 2>&1

Running Command

cd /home/daytona/workspace/csom-ppt && node -e " const {execSync}=require('child_process'); const urls=[ 'https://cdn.orris.care/cdss_images/aaee9da2a72b7ca8b88ad6b3528b9f5190f0404ce8eb5c5c06f321d3c509aeaa.png', 'https://cdn.orris.care/cdss_images/714765bc5fb265cf5b0caef47a53948f22aeac9d3aefcc7652d1ed7c0f02bc17.png', 'https://cdn.orris.care/cdss_images/aa2041c7dd351612453d54f0591d6a35e36fc6744f94e5948e3d51e0ea04af25.png', 'https://cdn.orris.care/cdss_images/c0bf0d337eab6e7ae3de5732b271dd4d2d5da7dcc9df9edc92515fc34f1f9079.png', ]; const results=urls.map((u,i)=>{ try{ const r=JSON.parse(execSync('node /home/daytona/skills/shared/scripts/fetch_images.js \"'+u+'\"',{maxBuffer:20*1024*1024}).toString()); console.log('img'+i+': '+(r[0].error?'FAIL:'+r[0].error:'OK len='+r[0].base64.length)); return r[0].error?null:r[0].base64; }catch(e){console.error('img'+i+' err:',e.message);return null;} }); require('fs').writeFileSync('/home/daytona/workspace/csom-ppt/images.json',JSON.stringify(results)); console.log('Saved images.json'); " 2>&1

Running Command

cd /home/daytona/workspace/csom-ppt && node -e " const {execSync}=require('child_process'); const urls=[ 'https://cdn.orris.care/cdss_images/aa2041c7dd351612453d54f0591d6a35e36fc6744f94e5948e3d51e0ea04af25.png', 'https://cdn.orris.care/cdss_images/c0bf0d337eab6e7ae3de5732b271dd4d2d5da7dcc9df9edc92515fc34f1f9079.png', ]; const existing=JSON.parse(require('fs').readFileSync('/home/daytona/workspace/csom-ppt/images.json')); urls.forEach((u,i)=>{ try{ const r=JSON.parse(execSync('node /home/daytona/skills/shared/scripts/fetch_images.js \"'+u+'\"',{maxBuffer:20*1024*1024}).toString()); console.log('img'+(i+2)+': '+(r[0].error?'FAIL':'OK len='+r[0].base64.length)); existing[i+2]=r[0].error?null:r[0].base64; }catch(e){console.error('img'+(i+2)+' err:',e.message);existing[i+2]=null;} }); require('fs').writeFileSync('/home/daytona/workspace/csom-ppt/images.json',JSON.stringify(existing)); console.log('Updated images.json'); " 2>&1

Running Command

cd /home/daytona/workspace/csom-ppt && \ wget -q "https://cdn.orris.care/cdss_images/aa2041c7dd351612453d54f0591d6a35e36fc6744f94e5948e3d51e0ea04af25.png" -O img2.png && \ wget -q "https://cdn.orris.care/cdss_images/c0bf0d337eab6e7ae3de5732b271dd4d2d5da7dcc9df9edc92515fc34f1f9079.png" -O img3.png && \ echo "Downloads done:" && ls -lh img*.png 2>&1

Writing File

~/csom-ppt/csom_v3.js

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

// ─── Load images ──────────────────────────────────────────────
// images.json has base64 for img0 and img1; img2/3 are local files
const imgs = JSON.parse(fs.readFileSync("/home/daytona/workspace/csom-ppt/images.json"));
// img2 and img3 from local file
try {
  const raw2 = fs.readFileSync("/home/daytona/workspace/csom-ppt/img2.png");
  imgs[2] = "image/png;base64," + raw2.toString("base64");
  console.log("img2 loaded from file, size:", raw2.length);
} catch(e) { console.log("img2 not available:", e.message); }
try {
  const raw3 = fs.readFileSync("/home/daytona/workspace/csom-ppt/img3.png");
  imgs[3] = "image/png;base64," + raw3.toString("base64");
  console.log("img3 loaded from file, size:", raw3.length);
} catch(e) { console.log("img3 not available:", e.message); }

function imgData(idx) { return imgs[idx] || null; }

// ─── Palette ──────────────────────────────────────────────────
const C = {
  c1: "E74C3C", c2: "E67E22", c3: "F39C12", c4: "27AE60",
  c5: "1ABC9C", c6: "2980B9", c7: "8E44AD", c8: "D35400",
  c9: "16A085", c10:"C0392B",
  white: "FFFFFF", dktext: "1A1A2E", ltgray: "ECF0F1",
};
const SLIDE_COLORS = [C.c1,C.c2,C.c4,C.c6,C.c7,C.c5,C.c8,C.c3,C.c9,C.c10];

const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Chronic Suppurative Otitis Media";

// ─── Helpers ──────────────────────────────────────────────────
function contentBg(slide, accent) {
  slide.addShape(pres.ShapeType.rect, { x:0, y:0, w:"100%", h:"100%", fill:{ color:"F8F9FA" } });
  slide.addShape(pres.ShapeType.rect, { x:0, y:0, w:"100%", h:0.75, fill:{ color: accent } });
  slide.addShape(pres.ShapeType.rect, { x:0, y:0.75, w:0.06, h:"100%", fill:{ color: accent } });
}
function heading(slide, text) {
  slide.addText(text, {
    x:0.22, y:0.1, w:9.5, h:0.57,
    fontSize:20, bold:true, color:C.white,
    fontFace:"Calibri", valign:"middle", align:"left",
  });
}
function addImg(slide, idx, x, y, w, h, fallbackLabel) {
  const d = imgData(idx);
  if (d) {
    slide.addImage({ data: d, x, y, w, h });
  } else {
    slide.addShape(pres.ShapeType.roundRect, { x, y, w, h, fill:{ color:"D5D8DC" }, line:{ color:"AEB6BF", width:1 }, rectRadius:0.1 });
    slide.addText(fallbackLabel || "Image", { x, y: y+h/2-0.3, w, h:0.6, fontSize:10, color:"666666", fontFace:"Calibri", align:"center" });
  }
}

// ════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE
// ════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:"100%", h:"100%", fill:{ color:"0D1B2A" } });
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:"100%", h:0.2, fill:{ color:"1ABC9C" } });
  s.addShape(pres.ShapeType.rect, { x:0, y:5.4, w:"100%", h:0.22, fill:{ color:"1ABC9C" } });
  // right splash
  s.addShape(pres.ShapeType.rect, { x:7.5, y:0.2, w:2.5, h:5.2, fill:{ color:"132236" } });
  // coloured vertical bar on right
  const barCols = ["E74C3C","E67E22","F1C40F","27AE60","1ABC9C","2980B9","8E44AD"];
  barCols.forEach((c,i) => s.addShape(pres.ShapeType.rect, { x:9.6, y:0.2+i*(5.2/7), w:0.4, h:5.2/7, fill:{ color:c }, line:{ type:"none" } }));

  s.addText("CHRONIC\nSUPPURATIVE\nOTITIS MEDIA", {
    x:0.4, y:0.45, w:6.8, h:3.2, fontSize:44, bold:true, color:C.white,
    fontFace:"Calibri", align:"left", valign:"middle", lineSpacingMultiple:1.1,
  });
  s.addText("C S O M", { x:0.4, y:3.75, w:3, h:0.65, fontSize:26, bold:true, color:"1ABC9C", fontFace:"Calibri", charSpacing:12 });
  s.addText("ENT Department  ·  2026", { x:0.4, y:4.52, w:6.5, h:0.4, fontSize:13, color:"95A5A6", fontFace:"Calibri", italic:true });
  s.addText("Sources: Shambaugh Surgery of the Ear | Cummings Otolaryngology | Scott-Brown's ORL", {
    x:0.4, y:4.94, w:9, h:0.28, fontSize:9, color:"607080", fontFace:"Calibri", italic:true,
  });
  s.addText("👂", { x:7.6, y:1.0, w:1.8, h:2.5, fontSize:90, align:"center" });
}

// ════════════════════════════════════════════════════════════
// SLIDE 2 — DEFINITION & EPIDEMIOLOGY
// ════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  const acc = SLIDE_COLORS[0];
  contentBg(s, acc);
  heading(s, "Definition & Epidemiology");

  s.addShape(pres.ShapeType.roundRect, { x:0.15, y:0.82, w:5.5, h:1.85, fill:{ color: acc }, line:{ type:"none" }, rectRadius:0.1 });
  s.addText("DEFINITION", { x:0.25, y:0.84, w:5.3, h:0.35, fontSize:10.5, bold:true, color:C.white, fontFace:"Calibri", charSpacing:2 });
  s.addText("Chronic inflammation of the mucoperiosteum of the middle ear cleft — persistent TM perforation + otorrhoea lasting > 6–12 weeks.", {
    x:0.25, y:1.18, w:5.3, h:1.42, fontSize:13.5, color:C.white, fontFace:"Calibri", valign:"top",
  });

  const stats = [
    { val:"1–2%", lbl:"Global prevalence" },
    { val:"<2 yrs", lbl:"Peak incidence" },
    { val:"WHO", lbl:"Massive public health problem" },
  ];
  stats.forEach((st, i) => {
    const y = 0.82 + i*0.65;
    s.addShape(pres.ShapeType.roundRect, { x:5.85, y, w:3.9, h:0.58, fill:{ color:"FDECEA" }, line:{ color: acc, width:1.5 }, rectRadius:0.08 });
    s.addText(st.val, { x:5.95, y: y+0.04, w:1.1, h:0.5, fontSize:16, bold:true, color: acc, fontFace:"Calibri", align:"center", valign:"middle" });
    s.addText(st.lbl, { x:7.12, y: y+0.09, w:2.5, h:0.42, fontSize:11.5, color:C.dktext, fontFace:"Calibri", valign:"middle" });
  });

  s.addText("RISK FACTORS", { x:0.18, y:2.75, w:9.5, h:0.32, fontSize:10.5, bold:true, color: acc, fontFace:"Calibri", charSpacing:2 });
  const risks = ["ET dysfunction","Recurrent AOM","Overcrowding / malnutrition","Cleft palate / Down syndrome","Allergic rhinitis / adenoid hypertrophy","Immunodeficiency (HIV, primary)"];
  risks.forEach((r, i) => {
    const col = i % 3, row = Math.floor(i / 3);
    const x = 0.18 + col * 3.22, y = 3.12 + row * 0.58;
    s.addShape(pres.ShapeType.roundRect, { x, y, w:3.08, h:0.5, fill:{ color:"FDECEA" }, line:{ color: acc, width:1 }, rectRadius:0.07 });
    s.addText("• " + r, { x: x+0.1, y, w:2.94, h:0.5, fontSize:12, color:C.dktext, fontFace:"Calibri", valign:"middle" });
  });
}

// ════════════════════════════════════════════════════════════
// SLIDE 3 — ETIOPATHOGENESIS FLOWCHART
// ════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  const acc = SLIDE_COLORS[1];
  contentBg(s, acc);
  heading(s, "Etiopathogenesis");

  // Flowchart nodes
  const nodes = [
    { lbl:"ET\nDysfunction", sub:"Negative ME\npressure", color:"E67E22" },
    { lbl:"ME\nEffusion", sub:"Serous /\npurulent fluid", color:"D35400" },
    { lbl:"Mucosal Oedema\n& Granulation", sub:"BM rupture,\npolyps", color:"C0392B" },
    { lbl:"TM\nWeakening", sub:"Enzyme collagen\ndegradation", color:"992D22" },
    { lbl:"Perforation /\nRetraction", sub:"→ CSOM /\nCholesteatoma", color:"7B241C" },
  ];
  const nW=1.78, nH=1.0, sy=0.88, gap=0.23, sx=0.18;
  nodes.forEach((n,i)=>{
    const x = sx + i*(nW+gap);
    s.addShape(pres.ShapeType.roundRect, { x, y:sy, w:nW, h:nH, fill:{ color: n.color }, line:{ type:"none" }, rectRadius:0.1 });
    s.addText(n.lbl, { x, y:sy+0.06, w:nW, h:0.46, fontSize:11, bold:true, color:C.white, fontFace:"Calibri", align:"center", valign:"middle" });
    s.addText(n.sub, { x, y:sy+0.54, w:nW, h:0.42, fontSize:9, color:"FFD5C8", fontFace:"Calibri", align:"center", valign:"top" });
    if (i<nodes.length-1) {
      const ax = x+nW+0.04;
      s.addShape(pres.ShapeType.line, { x:ax, y:sy+nH/2, w:gap-0.1, h:0, line:{ color:C.white, width:2 } });
      s.addText("▶", { x:ax+gap-0.22, y:sy+nH/2-0.16, w:0.22, h:0.32, fontSize:12, color:C.white });
    }
  });

  // Microbiology bar
  s.addShape(pres.ShapeType.rect, { x:0.1, y:2.02, w:9.8, h:0.38, fill:{ color:"FEF9E7" }, line:{ color: acc, width:1 } });
  s.addText("🦠  KEY ORGANISMS:  Pseudomonas aeruginosa  ·  Staph. aureus  ·  Proteus mirabilis  ·  Klebsiella  ·  Candida (after prolonged topical Abx)", {
    x:0.2, y:2.02, w:9.6, h:0.38, fontSize:11, bold:true, color:"7D6608", fontFace:"Calibri", valign:"middle",
  });

  // Key concept 6-box grid
  const concepts = [
    "Biofilm formation — key driver of treatment resistance (2006)",
    "Bacterial toxins → BM rupture → lamina propria extrusion → granulation",
    "Submucosal gland metaplasia → secretory mucosa → perpetuates effusion",
    "Candida overgrowth 10% baseline → 35% after 3-wk topical ciprofloxacin (Cummings)",
    "Retraction pocket deepening → contact with mucosa → fibrous band / perforation",
    "Deep retraction pocket or perforation → cholesteatoma genesis",
  ];
  concepts.forEach((c,i) => {
    const col=i%3, row=Math.floor(i/3);
    const x=0.18+col*3.22, y=2.52+row*0.8;
    s.addShape(pres.ShapeType.roundRect, { x, y, w:3.08, h:0.72, fill:{ color: col%2===0?"FFF3E0":"FFF8E1" }, line:{ color: acc, width:0.5 }, rectRadius:0.07 });
    s.addText("▸  "+c, { x:x+0.08, y:y+0.05, w:2.95, h:0.62, fontSize:11, color:C.dktext, fontFace:"Calibri", valign:"middle" });
  });
}

// ════════════════════════════════════════════════════════════
// SLIDE 4 — CLASSIFICATION (Safe vs Unsafe)
// ════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  const acc = SLIDE_COLORS[2];
  contentBg(s, acc);
  heading(s, "Classification — Safe vs. Unsafe");

  // VS badge
  s.addShape(pres.ShapeType.ellipse, { x:4.62, y:1.6, w:0.76, h:0.76, fill:{ color:"1A1A2E" }, line:{ type:"none" } });
  s.addText("VS", { x:4.62, y:1.6, w:0.76, h:0.76, fontSize:14, bold:true, color:C.white, fontFace:"Calibri", align:"center", valign:"middle" });

  // Safe
  s.addShape(pres.ShapeType.roundRect, { x:0.12, y:0.82, w:4.38, h:4.55, fill:{ color:"E9F7EF" }, line:{ color: acc, width:2 }, rectRadius:0.12 });
  s.addShape(pres.ShapeType.roundRect, { x:0.12, y:0.82, w:4.38, h:0.68, fill:{ color: acc }, line:{ type:"none" }, rectRadius:0.12 });
  s.addText("TUBO-TYMPANIC  (SAFE)", { x:0.18, y:0.84, w:4.25, h:0.64, fontSize:12.5, bold:true, color:C.white, fontFace:"Calibri", align:"center", valign:"middle" });
  const safeItems = ["Central TM perforation (pars tensa)","No cholesteatoma","Mucoid, odourless discharge","Responds to medical treatment","Surgery: Myringoplasty / Tympanoplasty","Lower risk of complications","Conductive hearing loss"];
  safeItems.forEach((t,i) => {
    s.addShape(pres.ShapeType.rect, { x:0.17, y:1.57+i*0.54, w:4.28, h:0.5, fill:{ color: i%2===0?"D5F5E3":"E9F7EF" }, line:{ type:"none" } });
    s.addText("✔  "+t, { x:0.27, y:1.6+i*0.54, w:4.08, h:0.45, fontSize:12, color:"145A32", fontFace:"Calibri", valign:"middle" });
  });

  // Unsafe
  const ured = "C0392B";
  s.addShape(pres.ShapeType.roundRect, { x:5.5, y:0.82, w:4.38, h:4.55, fill:{ color:"FDEDEC" }, line:{ color: ured, width:2 }, rectRadius:0.12 });
  s.addShape(pres.ShapeType.roundRect, { x:5.5, y:0.82, w:4.38, h:0.68, fill:{ color: ured }, line:{ type:"none" }, rectRadius:0.12 });
  s.addText("ATTICO-ANTRAL  (UNSAFE)", { x:5.56, y:0.84, w:4.25, h:0.64, fontSize:12.5, bold:true, color:C.white, fontFace:"Calibri", align:"center", valign:"middle" });
  const unsafeItems = [
    { t:"Attic / marginal perforation (pars flaccida)", red:false },
    { t:"CHOLESTEATOMA present ⚠", red:true },
    { t:"Scanty, FETID (foul-smelling) discharge", red:false },
    { t:"Scutal & ossicular erosion", red:false },
    { t:"HIGH risk — intracranial complications ⚠", red:true },
    { t:"Surgery: CWU or CWD Mastoidectomy", red:false },
    { t:"Second-look surgery at 12–18 months (CWU)", red:false },
  ];
  unsafeItems.forEach((item,i) => {
    s.addShape(pres.ShapeType.rect, { x:5.55, y:1.57+i*0.54, w:4.28, h:0.5, fill:{ color: i%2===0?"FADBD8":"FDEDEC" }, line:{ type:"none" } });
    s.addText((item.red?"⚠  ":"✖  ")+item.t, { x:5.65, y:1.6+i*0.54, w:4.08, h:0.45, fontSize:12, color: item.red ? ured : "7B241C", bold: item.red, fontFace:"Calibri", valign:"middle" });
  });
}

// ════════════════════════════════════════════════════════════
// SLIDE 5 — CLINICAL FEATURES
// ════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  const acc = SLIDE_COLORS[3];
  contentBg(s, acc);
  heading(s, "Clinical Features");

  const symptoms = [
    { t:"Otorrhoea — intermittent / continuous", red:false },
    { t:"Conductive hearing loss (most common)", red:false },
    { t:"Otalgia / headache  ⚠ RED FLAG = suspect complication", red:true },
    { t:"Vertigo → labyrinthitis / labyrinthine fistula", red:false },
    { t:"Tinnitus", red:false },
    { t:"Facial weakness — CN VII involvement (rare)", red:false },
  ];
  const signs = [
    { t:"TM perforation — central (safe) vs attic/marginal (unsafe)", red:false },
    { t:"Discharge / granulation tissue / polyp in EAC", red:false },
    { t:"Scutal erosion ★ = hallmark of cholesteatoma", red:true },
    { t:"Retraction pocket with squamous keratin debris", red:false },
    { t:"Tuning fork: Rinne −ve, Weber lateralised to affected ear", red:false },
    { t:"Post-auricular swelling / fistula = mastoiditis", red:false },
  ];

  // Headers
  s.addShape(pres.ShapeType.rect, { x:0.1, y:0.82, w:4.75, h:0.42, fill:{ color: acc }, line:{ type:"none" } });
  s.addText("SYMPTOMS", { x:0.18, y:0.82, w:4.6, h:0.42, fontSize:12, bold:true, color:C.white, fontFace:"Calibri", valign:"middle", charSpacing:2 });
  symptoms.forEach((item,i) => {
    s.addShape(pres.ShapeType.rect, { x:0.1, y:1.3+i*0.63, w:4.75, h:0.57, fill:{ color: i%2===0?"EBF5FB":"D6EAF8" }, line:{ type:"none" } });
    s.addText((item.red?"⚠ ":"▶ ")+item.t, { x:0.2, y:1.33+i*0.63, w:4.55, h:0.5, fontSize:12, color: item.red?"C0392B":C.dktext, bold:item.red, fontFace:"Calibri", valign:"middle" });
  });

  s.addShape(pres.ShapeType.line, { x:5.0, y:0.82, w:0, h:4.5, line:{ color:"BDC3C7", width:1.5 } });

  s.addShape(pres.ShapeType.rect, { x:5.15, y:0.82, w:4.75, h:0.42, fill:{ color:"1A5276" }, line:{ type:"none" } });
  s.addText("SIGNS — Otomicroscopy", { x:5.23, y:0.82, w:4.6, h:0.42, fontSize:12, bold:true, color:C.white, fontFace:"Calibri", valign:"middle", charSpacing:2 });
  signs.forEach((item,i) => {
    s.addShape(pres.ShapeType.rect, { x:5.15, y:1.3+i*0.63, w:4.75, h:0.57, fill:{ color: i%2===0?"EBF5FB":"D6EAF8" }, line:{ type:"none" } });
    s.addText((item.red?"★ ":"▶ ")+item.t, { x:5.25, y:1.33+i*0.63, w:4.55, h:0.5, fontSize:12, color: item.red?"8E44AD":C.dktext, bold:item.red, fontFace:"Calibri", valign:"middle" });
  });
}

// ════════════════════════════════════════════════════════════
// SLIDE 6 — OTOSCOPIC & HISTOLOGICAL IMAGES
// ════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  const acc = SLIDE_COLORS[4];
  contentBg(s, acc);
  heading(s, "Otoscopic & Histological Findings");

  // 3 images in a row
  addImg(s, 1, 0.12, 0.82, 3.2, 2.5, "Cholesteatoma — otoscopy");
  s.addShape(pres.ShapeType.rect, { x:0.12, y:3.35, w:3.2, h:0.55, fill:{ color:"F4ECF7" }, line:{ type:"none" } });
  s.addText("Cholesteatoma (otoscopy)\nAttic retraction with keratin debris\n(Shambaugh, Fig. 25–5)", { x:0.14, y:3.36, w:3.16, h:0.52, fontSize:9, color:"6C3483", fontFace:"Calibri", align:"center", italic:true });

  addImg(s, 2, 3.4, 0.82, 3.2, 2.5, "Cholesteatoma — H&E temporal bone");
  s.addShape(pres.ShapeType.rect, { x:3.4, y:3.35, w:3.2, h:0.55, fill:{ color:"F4ECF7" }, line:{ type:"none" } });
  s.addText("COM with cholesteatoma — H&E\nKeratin sac eroding stapes suprastructure\n(Shambaugh, Fig. 25–6)", { x:3.42, y:3.36, w:3.16, h:0.52, fontSize:9, color:"6C3483", fontFace:"Calibri", align:"center", italic:true });

  addImg(s, 3, 6.68, 0.82, 3.2, 2.5, "COM without cholesteatoma — H&E");
  s.addShape(pres.ShapeType.rect, { x:6.68, y:3.35, w:3.2, h:0.55, fill:{ color:"F4ECF7" }, line:{ type:"none" } });
  s.addText("COM without cholesteatoma — H&E\nTM perf + inflammatory exudate\n(Shambaugh, Fig. 25–7)", { x:6.7, y:3.36, w:3.16, h:0.52, fontSize:9, color:"6C3483", fontFace:"Calibri", align:"center", italic:true });

  // Key imaging facts
  const diagPts = [
    "Scutal erosion on CT = cholesteatoma until proved otherwise",
    "DW-MRI (non-EPI) — restricted diffusion = cholesteatoma",
    "HRCT temporal bone = gold standard pre-op imaging",
    "Pars flaccida retraction = most common cholesteatoma site",
  ];
  diagPts.forEach((d,i) => {
    const col=i%2, row=Math.floor(i/2);
    s.addShape(pres.ShapeType.roundRect, { x:0.2+col*4.9, y:4.0+row*0.63, w:4.7, h:0.55, fill:{ color:"F4ECF7" }, line:{ color: acc, width:1 }, rectRadius:0.07 });
    s.addText("◆  "+d, { x:0.3+col*4.9, y:4.03+row*0.63, w:4.5, h:0.5, fontSize:12, color:"6C3483", bold: d.includes("gold standard")||d.includes("DW-MRI"), fontFace:"Calibri", valign:"middle" });
  });
}

// ════════════════════════════════════════════════════════════
// SLIDE 7 — INVESTIGATIONS
// ════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  const acc = SLIDE_COLORS[5];
  contentBg(s, acc);
  heading(s, "Investigations");

  // Audiology card
  s.addShape(pres.ShapeType.roundRect, { x:0.12, y:0.82, w:4.65, h:4.55, fill:{ color:"E8F8F5" }, line:{ color: acc, width:1.5 }, rectRadius:0.1 });
  s.addShape(pres.ShapeType.rect, { x:0.12, y:0.82, w:4.65, h:0.55, fill:{ color: acc }, line:{ type:"none" } });
  s.addText("🎧  AUDIOLOGICAL", { x:0.2, y:0.84, w:4.5, h:0.5, fontSize:13, bold:true, color:C.white, fontFace:"Calibri", valign:"middle" });
  [
    "Pure Tone Audiogram (PTA) — mandatory pre-op",
    "CHL most common; SNHL if cochlear involvement",
    "CHL >30 dB → suspect ossicular erosion",
    "Hearing preserved by cholesteatoma mass despite ossicular erosion",
    "Tympanometry: Type B (flat) = TM perf or MEE",
    "SNHL range documented: 5–33 dB (Shambaugh)",
  ].forEach((t,i) => {
    const bold = t.includes("30 dB") || t.includes("mandatory");
    s.addShape(pres.ShapeType.rect, { x:0.17, y:1.44+i*0.59, w:4.55, h:0.52, fill:{ color:i%2===0?"D1F2EB":"E8F8F5" }, line:{ type:"none" } });
    s.addText("▸  "+t, { x:0.27, y:1.47+i*0.59, w:4.35, h:0.48, fontSize:12, color: bold?"16A085":C.dktext, bold, fontFace:"Calibri", valign:"middle" });
  });

  // Radiology card
  s.addShape(pres.ShapeType.roundRect, { x:5.23, y:0.82, w:4.65, h:4.55, fill:{ color:"EBF5FB" }, line:{ color:"1A5276", width:1.5 }, rectRadius:0.1 });
  s.addShape(pres.ShapeType.rect, { x:5.23, y:0.82, w:4.65, h:0.55, fill:{ color:"1A5276" }, line:{ type:"none" } });
  s.addText("🔬  RADIOLOGY", { x:5.31, y:0.84, w:4.5, h:0.5, fontSize:13, bold:true, color:C.white, fontFace:"Calibri", valign:"middle" });
  [
    { t:"HRCT temporal bone — GOLD STANDARD ★", bold:true },
    { t:"CT shows: soft tissue, scutal & ossicular erosion, labyrinthine fistula", bold:false },
    { t:"DW-MRI — bright DWI = cholesteatoma; detects residual/recurrent disease", bold:true },
    { t:"MRI for intracranial extension & dural involvement", bold:false },
    { t:"CT + MRI complementary if cochlear nerve hypoplasia suspected", bold:false },
    { t:"Plain X-ray (Schuller's view) — mastoid haziness; largely obsolete", bold:false },
  ].forEach((item,i) => {
    s.addShape(pres.ShapeType.rect, { x:5.28, y:1.44+i*0.59, w:4.55, h:0.52, fill:{ color:i%2===0?"D6EAF8":"EBF5FB" }, line:{ type:"none" } });
    s.addText("▸  "+item.t, { x:5.38, y:1.47+i*0.59, w:4.35, h:0.48, fontSize:12, color: item.bold?"1A5276":C.dktext, bold:item.bold, fontFace:"Calibri", valign:"middle" });
  });
}

// ════════════════════════════════════════════════════════════
// SLIDE 8 — MEDICAL MANAGEMENT
// ════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  const acc = SLIDE_COLORS[6];
  contentBg(s, acc);
  heading(s, "Medical Management");

  // Step flowchart
  const steps = [
    { icon:"🧹", n:"01", lbl:"Aural Toilet", detail:"Micro-suction / syringing\nRemoves debris & discharge\nESSENTIAL first step" },
    { icon:"💊", n:"02", lbl:"Topical Abx", detail:"Quinolone drops (1st line)\nOfloxacin / Ciprofloxacin\nNot ototoxic at clinical doses" },
    { icon:"💉", n:"03", lbl:"Systemic Abx", detail:"Acute exacerbations\nResistant infections\nTopical therapy failure" },
    { icon:"🩺", n:"04", lbl:"Treat Cause", detail:"Allergic rhinitis Rx\nAdenoidectomy\nNasal polyposis Rx" },
  ];
  const sw=2.25, sh=2.3, sy=0.85, gap=0.12;
  steps.forEach((st,i) => {
    const x=0.15+i*(sw+gap);
    s.addShape(pres.ShapeType.roundRect, { x, y:sy, w:sw, h:sh, fill:{ color: acc }, line:{ type:"none" }, rectRadius:0.12 });
    s.addText(st.icon, { x, y:sy+0.08, w:sw, h:0.55, fontSize:28, align:"center" });
    s.addText(st.n, { x, y:sy+0.6, w:sw, h:0.3, fontSize:9.5, bold:true, color:"FEF9E7", fontFace:"Calibri", align:"center", charSpacing:3 });
    s.addText(st.lbl, { x, y:sy+0.88, w:sw, h:0.4, fontSize:13, bold:true, color:C.white, fontFace:"Calibri", align:"center" });
    s.addText(st.detail, { x, y:sy+1.28, w:sw, h:0.96, fontSize:10.5, color:"FEF9E7", fontFace:"Calibri", align:"center", valign:"top" });
    if (i<steps.length-1) s.addText("▶", { x:x+sw+0.02, y:sy+sh/2-0.16, w:0.14, h:0.32, fontSize:14, color:C.white });
  });

  // Warning about Candida
  s.addShape(pres.ShapeType.rect, { x:0.1, y:3.28, w:9.8, h:0.38, fill:{ color:"FEF9E7" }, line:{ color:"F39C12", width:1.5 } });
  s.addText("⚠  NOTE: Candida overgrowth occurs in 35% of ears after 3 weeks of topical ciprofloxacin — monitor for fungal superinfection (Cummings Otolaryngology)", {
    x:0.2, y:3.28, w:9.6, h:0.38, fontSize:11, bold:false, color:"7D6608", fontFace:"Calibri", valign:"middle",
  });

  // Indications for surgery
  s.addShape(pres.ShapeType.rect, { x:0.1, y:3.74, w:9.8, h:0.38, fill:{ color:"1A1A2E" }, line:{ type:"none" } });
  s.addText("⚡  ESCALATE TO SURGERY WHEN:", { x:0.2, y:3.74, w:9.6, h:0.38, fontSize:12, bold:true, color:C.white, fontFace:"Calibri", valign:"middle", charSpacing:1 });
  const ind = ["Failed multiple courses of medical Rx","Cholesteatoma present (near-absolute indication)","Vertigo → labyrinthine fistula","Facial weakness — CN VII involvement","Headache → intracranial extension","Atelectatic ear with significant CHL"];
  ind.forEach((t,i) => {
    const col=i%3, row=Math.floor(i/3);
    const x=0.15+col*3.25, y=4.2+row*0.65;
    s.addShape(pres.ShapeType.roundRect, { x, y, w:3.1, h:0.58, fill:{ color:"FEF9E7" }, line:{ color: acc, width:1 }, rectRadius:0.07 });
    s.addText("⚠  "+t, { x:x+0.1, y, w:2.96, h:0.58, fontSize:11.5, color:"7E5109", fontFace:"Calibri", valign:"middle" });
  });
}

// ════════════════════════════════════════════════════════════
// SLIDE 9 — SURGICAL MANAGEMENT
// ════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  const acc = SLIDE_COLORS[8];
  contentBg(s, acc);
  heading(s, "Surgical Management");

  // Priority badges
  [
    { n:"1", lbl:"ERADICATE DISEASE", col:"C0392B" },
    { n:"2", lbl:"PREVENT RECURRENCE", col:"1A5276" },
    { n:"3", lbl:"RESTORE HEARING", col:"1E8449" },
  ].forEach((p,i) => {
    const x=0.18+i*3.25;
    s.addShape(pres.ShapeType.roundRect, { x, y:0.84, w:3.1, h:0.72, fill:{ color: p.col }, line:{ type:"none" }, rectRadius:0.1 });
    s.addText(`${p.n}. ${p.lbl}`, { x, y:0.84, w:3.1, h:0.72, fontSize:13, bold:true, color:C.white, fontFace:"Calibri", align:"center", valign:"middle" });
  });

  // 3-column surgery type cards
  const surgeries = [
    { name:"TYMPANOPLASTY /\nMYRINGOPLASTY", color: acc,
      pts:["TM repair for safe CSOM (no cholesteatoma)","Temporalis fascia graft — underlay / overlay","Pre-op: ear dry ≥3–4 weeks","Eustachian tube function = key to success","Hearing restoration primary goal"] },
    { name:"CANAL WALL UP\n(CWU) MASTOIDECTOMY", color:"1A5276",
      pts:["Posterior EAC wall preserved","Combined approach tympanoplasty (CAT)","Preferred — avoids chronic cavity problems","Recidivism: 5–71% in paediatric cases","Second-look surgery at 12–18 months"] },
    { name:"CANAL WALL DOWN\n(CWD) MASTOIDECTOMY", color:"C0392B",
      pts:["Posterior canal wall removed (open cavity)","Better surgical access / exposure","Lifelong cavity maintenance required","Indications: labyrinthine fistula, low tegmen, unresectable disease (Shambaugh)","Lower recurrence vs CWU"] },
  ];
  surgeries.forEach((sg,i) => {
    const x=0.18+i*3.25;
    s.addShape(pres.ShapeType.roundRect, { x, y:1.65, w:3.1, h:3.75, fill:{ color:"F2F3F4" }, line:{ color: sg.color, width:1.5 }, rectRadius:0.1 });
    s.addShape(pres.ShapeType.roundRect, { x, y:1.65, w:3.1, h:0.65, fill:{ color: sg.color }, line:{ type:"none" }, rectRadius:0.1 });
    s.addText(sg.name, { x:x+0.05, y:1.67, w:3.0, h:0.63, fontSize:11.5, bold:true, color:C.white, fontFace:"Calibri", align:"center", valign:"middle" });
    sg.pts.forEach((pt,pi) => {
      s.addShape(pres.ShapeType.rect, { x:x+0.05, y:2.38+pi*0.59, w:3.0, h:0.54, fill:{ color:pi%2===0?"EAECEE":"F8F9FA" }, line:{ type:"none" } });
      s.addText("▸  "+pt, { x:x+0.1, y:2.4+pi*0.59, w:2.9, h:0.5, fontSize:11.5, color:C.dktext, fontFace:"Calibri", valign:"middle" });
    });
  });
}

// ════════════════════════════════════════════════════════════
// SLIDE 10 — COMPLICATIONS
// ════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  const acc = SLIDE_COLORS[9];
  contentBg(s, acc);
  heading(s, "Complications");

  // Mastoid abscess image on left
  addImg(s, 0, 0.12, 0.82, 2.5, 2.1, "Mastoid Subperiosteal Abscess");
  s.addText("Mastoid subperiosteal\nabscess (Shambaugh, Fig. 30–1)", { x:0.12, y:2.94, w:2.5, h:0.42, fontSize:9, italic:true, color:"7B241C", fontFace:"Calibri", align:"center" });

  // Extracranial
  s.addShape(pres.ShapeType.roundRect, { x:2.72, y:0.82, w:3.45, h:4.5, fill:{ color:"EBF5FB" }, line:{ color:"1A5276", width:1.5 }, rectRadius:0.1 });
  s.addShape(pres.ShapeType.roundRect, { x:2.72, y:0.82, w:3.45, h:0.52, fill:{ color:"1A5276" }, line:{ type:"none" }, rectRadius:0.1 });
  s.addText("🦻 EXTRACRANIAL", { x:2.8, y:0.84, w:3.3, h:0.48, fontSize:12.5, bold:true, color:C.white, fontFace:"Calibri", valign:"middle" });
  ["Conductive / Sensorineural hearing loss","Labyrinthitis (suppurative / serous)","Labyrinthine fistula — lateral SCC (most common)","Facial nerve palsy — Fallopian canal erosion","Acute mastoiditis / subperiosteal abscess","Petrous apicitis — Gradenigo's syndrome","Bezold's abscess (pus tracks under SCM)"].forEach((t,i) => {
    s.addShape(pres.ShapeType.rect, { x:2.77, y:1.4+i*0.54, w:3.35, h:0.5, fill:{ color:i%2===0?"D6EAF8":"EBF5FB" }, line:{ type:"none" } });
    s.addText("• "+t, { x:2.87, y:1.43+i*0.54, w:3.15, h:0.44, fontSize:11.5, color: t.includes("Facial")?"8E44AD":C.dktext, fontFace:"Calibri", valign:"middle" });
  });

  // Intracranial
  s.addShape(pres.ShapeType.roundRect, { x:6.3, y:0.82, w:3.58, h:4.5, fill:{ color:"FDEDEC" }, line:{ color: acc, width:1.5 }, rectRadius:0.1 });
  s.addShape(pres.ShapeType.roundRect, { x:6.3, y:0.82, w:3.58, h:0.52, fill:{ color: acc }, line:{ type:"none" }, rectRadius:0.1 });
  s.addText("🧠 INTRACRANIAL", { x:6.38, y:0.84, w:3.43, h:0.48, fontSize:12.5, bold:true, color:C.white, fontFace:"Calibri", valign:"middle" });
  [
    { t:"Meningitis — MOST COMMON intracranial complication", red:true },
    { t:"Extradural abscess", red:false },
    { t:"Subdural empyema", red:false },
    { t:"Brain abscess — temporal lobe / cerebellum", red:true },
    { t:"Sigmoid / lateral sinus thrombophlebitis", red:true },
    { t:"Otitic hydrocephalus", red:false },
    { t:"⚠ Otalgia + headache = intracranial until proved otherwise!", red:true },
  ].forEach((item,i) => {
    s.addShape(pres.ShapeType.rect, { x:6.35, y:1.4+i*0.54, w:3.48, h:0.5, fill:{ color:i%2===0?"FADBD8":"FDEDEC" }, line:{ type:"none" } });
    s.addText("• "+item.t, { x:6.45, y:1.43+i*0.54, w:3.28, h:0.44, fontSize:11, color: item.red ? acc : C.dktext, bold: item.t.startsWith("⚠"), fontFace:"Calibri", valign:"middle" });
  });
}

// ════════════════════════════════════════════════════════════
// SLIDE 11 — KEY TAKE-AWAYS
// ════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:"100%", h:"100%", fill:{ color:"0D1B2A" } });
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:"100%", h:0.72, fill:{ color:"1ABC9C" } });
  s.addText("KEY TAKE-AWAYS", { x:0.3, y:0.1, w:9.4, h:0.55, fontSize:20, bold:true, color:"0D1B2A", fontFace:"Calibri", align:"left", charSpacing:2 });

  const cards = [
    { acc:"E74C3C", txt:"CSOM = TM perforation + otorrhoea >6–12 wks; central cause: Eustachian tube dysfunction" },
    { acc:"E67E22", txt:"SAFE (tubo-tympanic) vs. UNSAFE (attico-antral/cholesteatoma) — critical clinical distinction" },
    { acc:"F1C40F", txt:"Otalgia + headache = RED FLAG → rule out intracranial complication urgently" },
    { acc:"27AE60", txt:"Full PTA mandatory pre-op; CHL >30 dB = ossicular erosion; document any SNHL" },
    { acc:"1ABC9C", txt:"HRCT temporal bone = gold standard; DW-MRI detects residual / recurrent cholesteatoma" },
    { acc:"2980B9", txt:"Medical Rx: aural toilet + ototopical quinolones; watch for Candida with prolonged use" },
    { acc:"8E44AD", txt:"Surgery goals: 1. Eradicate disease  2. Prevent recurrence  3. Restore hearing (Shambaugh)" },
    { acc:"D35400", txt:"Cholesteatoma + medically refractory CSOM = near-absolute indication for mastoidectomy" },
  ];

  const cw=4.75, ch=0.72, gap=0.1;
  cards.forEach((c,i) => {
    const col=i%2, row=Math.floor(i/2);
    const x=0.12+col*(cw+gap), y=0.84+row*(ch+gap);
    s.addShape(pres.ShapeType.roundRect, { x, y, w:cw, h:ch, fill:{ color:"132236" }, line:{ color: c.acc, width:2 }, rectRadius:0.08 });
    s.addShape(pres.ShapeType.roundRect, { x, y, w:0.34, h:ch, fill:{ color: c.acc }, line:{ type:"none" }, rectRadius:0.08 });
    s.addText(String(i+1).padStart(2,"0"), { x, y, w:0.34, h:ch, fontSize:13, bold:true, color:"0D1B2A", fontFace:"Calibri", align:"center", valign:"middle" });
    s.addText(c.txt, { x:x+0.42, y:y+0.04, w:cw-0.5, h:ch-0.08, fontSize:11.5, color:"ECF0F1", fontFace:"Calibri", valign:"middle" });
  });
}

// ════════════════════════════════════════════════════════════
// SLIDE 12 — THANK YOU
// ════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:"100%", h:"100%", fill:{ color:"0D1B2A" } });
  const cols = ["E74C3C","E67E22","F1C40F","27AE60","1ABC9C","2980B9","8E44AD"];
  cols.forEach((c,i) => {
    s.addShape(pres.ShapeType.rect, { x:i*(10/cols.length), y:0, w:10/cols.length, h:0.22, fill:{ color:c }, line:{ type:"none" } });
    s.addShape(pres.ShapeType.rect, { x:i*(10/cols.length), y:5.4, w:10/cols.length, h:0.22, fill:{ color:c }, line:{ type:"none" } });
  });
  s.addText("THANK YOU", { x:0.5, y:1.4, w:9, h:1.5, fontSize:52, bold:true, color:"1ABC9C", fontFace:"Calibri", align:"center", valign:"middle", charSpacing:8 });
  s.addText("Questions & Discussion", { x:0.5, y:3.0, w:9, h:0.7, fontSize:22, color:"95A5A6", fontFace:"Calibri", align:"center", italic:true });
  s.addText("Sources: Shambaugh Surgery of the Ear  ·  Cummings Otolaryngology  ·  Scott-Brown's ORL HNS  ·  KJ Lee's Essential Otolaryngology", {
    x:0.5, y:4.6, w:9, h:0.5, fontSize:9.5, color:"607080", fontFace:"Calibri", align:"center", italic:true,
  });
}

// ─── Write ────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/csom-ppt/CSOM_v2.pptx" })
  .then(() => console.log("SUCCESS: /home/daytona/workspace/csom-ppt/CSOM_v2.pptx"))
  .catch(e => { console.error("ERROR:", e); process.exit(1); });
Running Command

cd /home/daytona/workspace/csom-ppt && node csom_v3.js 2>&1

All 4 images loaded and the PPT built successfully. Here's your download:

CSOM v2

Presentation · PPTX


What's in the new version — 12 slides total

#SlideDesign
1TitleDark navy, rainbow colour-bar, large emoji ear
2Definition & EpidemiologyRed accent — stats badge cards + risk factor grid
3EtiopathogenesisOrange — 5-node flowchart (ET dysfunction → Perforation) + organism bar + 6-concept grid
4ClassificationGreen — side-by-side Safe vs. Unsafe comparison with colour-coded rows and VS badge
5Clinical FeaturesBlue — two-column symptom / sign table with coloured alternating rows
6Otoscopic & Histological ImagesPurple — 3 real textbook images (cholesteatoma otoscopy, H&E cholesteatoma, H&E COM) from Shambaugh
7InvestigationsTeal — two-column Audiology vs. Radiology cards
8Medical ManagementDark orange — 4-step horizontal flowchart + Candida warning + indications grid
9Surgical ManagementTeal — 3 priority badges + 3-column surgery type comparison (Tympanoplasty, CWU, CWD)
10ComplicationsDark red — mastoid abscess image + extracranial vs. intracranial two-column layout
11Key Take-AwaysDark background — 8 colour-numbered cards
12Thank YouDark with rainbow top/bottom stripe
Every content slide has a different vivid accent colour, crisp bullet points, and real clinical images from Shambaugh Surgery of the Ear.
This is a shared conversation. Sign in to Orris to start your own chat.