Ventilator ppt

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

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

Writing File

~/ventilator-ppt/ventilator.js

const pptxgen = require("pptxgenjs");
const prs = new pptxgen();

prs.layout = "LAYOUT_16x9";
prs.title = "Mechanical Ventilation - A Medical Student Guide";
prs.author = "Orris Medical Education";

// ─── Color Palette ───────────────────────────────────────────────
const C = {
  dark:    "0D1B2A",   // deep navy  (dominant background for title/key slides)
  mid:     "1B3A5C",   // medium navy
  accent:  "2EC4B6",   // teal accent
  light:   "E8F4F8",   // near-white (text on dark bg)
  white:   "FFFFFF",
  orange:  "F4A261",   // warm highlight
  gray:    "4A5568",   // body text on light bg
  lbg:     "F0F7FA",   // light background slides
  border:  "2EC4B6",
};

// ─── Shared helpers ───────────────────────────────────────────────
function sectionHeader(slide, label) {
  slide.addShape(prs.ShapeType.rect, { x: 0, y: 0, w: 0.18, h: 5.625, fill: { color: C.accent } });
  slide.addText(label, {
    x: 0.28, y: 0.18, w: 9.5, h: 0.45,
    fontSize: 10, bold: true, color: C.accent, charSpacing: 3,
  });
}

function slideTitle(slide, txt) {
  slide.addText(txt, {
    x: 0.28, y: 0.72, w: 9.5, h: 0.7,
    fontSize: 28, bold: true, color: C.dark, fontFace: "Calibri",
  });
  slide.addShape(prs.ShapeType.rect, {
    x: 0.28, y: 1.38, w: 1.2, h: 0.06, fill: { color: C.accent },
  });
}

function bullet(text, indent) {
  return { text, options: { bullet: { indent: indent || 20 }, fontSize: 16, color: C.gray, breakLine: true, paraSpaceAfter: 6 } };
}
function subBullet(text) {
  return { text, options: { bullet: { indent: 40 }, fontSize: 14, color: "6B7280", breakLine: true, paraSpaceAfter: 4 } };
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 1 — Title
// ═══════════════════════════════════════════════════════════════════
{
  const s = prs.addSlide();
  // Full dark background
  s.addShape(prs.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.dark } });
  // Teal bar left
  s.addShape(prs.ShapeType.rect, { x: 0, y: 0, w: 0.5, h: 5.625, fill: { color: C.accent } });
  // Decorative circles
  s.addShape(prs.ShapeType.ellipse, { x: 7.5, y: -1.2, w: 4.5, h: 4.5, fill: { color: C.mid }, line: { color: C.mid } });
  s.addShape(prs.ShapeType.ellipse, { x: 8.2, y: 3.2, w: 3, h: 3, fill: { color: "162D4A" }, line: { color: "162D4A" } });

  s.addText("MECHANICAL", { x: 0.7, y: 1.1, w: 8, h: 0.8, fontSize: 46, bold: true, color: C.accent, fontFace: "Calibri", charSpacing: 4 });
  s.addText("VENTILATION", { x: 0.7, y: 1.85, w: 8, h: 0.8, fontSize: 46, bold: true, color: C.white, fontFace: "Calibri", charSpacing: 4 });
  s.addText("A Foundation Guide for Medical Students", { x: 0.7, y: 2.8, w: 7.5, h: 0.45, fontSize: 18, color: C.light, fontFace: "Calibri", italic: true });
  s.addShape(prs.ShapeType.rect, { x: 0.7, y: 3.35, w: 2.2, h: 0.05, fill: { color: C.accent } });
  s.addText("Roberts & Hedges · Rosen's EM · Pfenninger & Fowler", { x: 0.7, y: 3.55, w: 8, h: 0.35, fontSize: 11, color: "8EAFC2", fontFace: "Calibri" });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 2 — What is Mechanical Ventilation?
// ═══════════════════════════════════════════════════════════════════
{
  const s = prs.addSlide();
  s.addShape(prs.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.lbg } });
  sectionHeader(s, "OVERVIEW");
  slideTitle(s, "What is Mechanical Ventilation?");

  // Definition box
  s.addShape(prs.ShapeType.rect, { x: 0.28, y: 1.55, w: 9.5, h: 1.1, fill: { color: C.mid }, rectRadius: 0.1 });
  s.addText("Mechanical ventilation (MV) is a life-support technique that uses a machine to move air in and out of the lungs when a patient cannot breathe adequately on their own.", {
    x: 0.38, y: 1.6, w: 9.3, h: 1.0, fontSize: 16, color: C.white, valign: "middle", wrap: true, fontFace: "Calibri",
  });

  s.addText([
    bullet("Positive-pressure ventilation pushes air INTO the lungs (most common clinical type)"),
    bullet("Negative-pressure ventilation pulls the chest wall outward (iron lung — historical)"),
    bullet("Can be invasive (via endotracheal tube) or non-invasive (mask-based NIV/BiPAP/CPAP)"),
    bullet("Manages both oxygenation (O₂) and ventilation (CO₂ removal) simultaneously"),
  ], { x: 0.38, y: 2.8, w: 9.3, h: 2.5, valign: "top", fontFace: "Calibri" });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 3 — Indications
// ═══════════════════════════════════════════════════════════════════
{
  const s = prs.addSlide();
  s.addShape(prs.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.lbg } });
  sectionHeader(s, "INDICATIONS");
  slideTitle(s, "When is Mechanical Ventilation Needed?");

  // Two column layout
  const col1 = [
    "Respiratory or cardiac arrest",
    "Acute respiratory failure",
    "Severe hypoxemia refractory to O₂",
    "Inability to protect the airway",
  ];
  const col2 = [
    "Altered consciousness / agitation",
    "Failure of non-invasive ventilation",
    "Massive aspiration",
    "Persistent inability to clear secretions",
  ];

  // Left card
  s.addShape(prs.ShapeType.rect, { x: 0.28, y: 1.55, w: 4.55, h: 3.65, fill: { color: C.white }, line: { color: C.accent, pt: 2 }, rectRadius: 0.1 });
  s.addText("Absolute Indications", { x: 0.38, y: 1.62, w: 4.3, h: 0.45, fontSize: 14, bold: true, color: C.accent, fontFace: "Calibri" });
  s.addText(col1.map(t => ({ text: t, options: { bullet: { code: "2713", indent: 20 }, color: C.gray, fontSize: 15, breakLine: true, paraSpaceAfter: 10 } })),
    { x: 0.38, y: 2.08, w: 4.3, h: 2.9, valign: "top", fontFace: "Calibri" });

  // Right card
  s.addShape(prs.ShapeType.rect, { x: 5.17, y: 1.55, w: 4.55, h: 3.65, fill: { color: C.white }, line: { color: C.orange, pt: 2 }, rectRadius: 0.1 });
  s.addText("Clinical Indications", { x: 5.27, y: 1.62, w: 4.3, h: 0.45, fontSize: 14, bold: true, color: C.orange, fontFace: "Calibri" });
  s.addText(col2.map(t => ({ text: t, options: { bullet: { code: "2713", indent: 20 }, color: C.gray, fontSize: 15, breakLine: true, paraSpaceAfter: 10 } })),
    { x: 5.27, y: 2.08, w: 4.3, h: 2.9, valign: "top", fontFace: "Calibri" });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 4 — Key Physiology
// ═══════════════════════════════════════════════════════════════════
{
  const s = prs.addSlide();
  s.addShape(prs.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.dark } });
  s.addShape(prs.ShapeType.rect, { x: 0, y: 0, w: 0.18, h: 5.625, fill: { color: C.accent } });
  s.addText("PHYSIOLOGY", { x: 0.28, y: 0.18, w: 9.5, h: 0.45, fontSize: 10, bold: true, color: C.accent, charSpacing: 3 });
  s.addText("Key Physiological Concepts", { x: 0.28, y: 0.72, w: 9.5, h: 0.7, fontSize: 28, bold: true, color: C.white, fontFace: "Calibri" });
  s.addShape(prs.ShapeType.rect, { x: 0.28, y: 1.38, w: 1.2, h: 0.06, fill: { color: C.accent } });

  const boxes = [
    { x: 0.28, title: "Minute Volume (Vₑ)", body: "Vₑ = VT × f\nNormal: 7–10 L/min\nControls CO₂ removal" },
    { x: 3.43, title: "Tidal Volume (VT)", body: "Volume per breath\nLung-protective: 6–8 mL/kg\nReduces barotrauma risk" },
    { x: 6.57, title: "Compliance", body: "V = P × C\nStiff lungs → ↑ pressure\nMonitor plateau pressure" },
  ];

  boxes.forEach(b => {
    s.addShape(prs.ShapeType.rect, { x: b.x, y: 1.6, w: 3.0, h: 3.6, fill: { color: C.mid }, rectRadius: 0.12 });
    s.addShape(prs.ShapeType.rect, { x: b.x, y: 1.6, w: 3.0, h: 0.55, fill: { color: C.accent }, rectRadius: 0.12 });
    s.addText(b.title, { x: b.x + 0.1, y: 1.63, w: 2.8, h: 0.5, fontSize: 14, bold: true, color: C.dark, valign: "middle", fontFace: "Calibri" });
    s.addText(b.body, { x: b.x + 0.15, y: 2.25, w: 2.7, h: 2.8, fontSize: 15, color: C.light, valign: "top", fontFace: "Calibri", lineSpacingMultiple: 1.4 });
  });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 5 — Airway Pressures
// ═══════════════════════════════════════════════════════════════════
{
  const s = prs.addSlide();
  s.addShape(prs.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.lbg } });
  sectionHeader(s, "PHYSIOLOGY");
  slideTitle(s, "Airway Pressures You Must Know");

  const rows = [
    ["Peak Airway Pressure (PIP)", "Dynamic pressure during inspiration", "Reflects airway resistance + compliance", "Normal: < 35 cmH₂O"],
    ["Plateau Pressure (Pplat)", "Static pressure during inspiratory hold", "Reflects lung compliance", "Target: ≤ 30 cmH₂O"],
    ["PEEP", "Pressure at end of expiration", "Prevents alveolar collapse & atelectasis", "Typical: 5–10 cmH₂O"],
    ["Peak-Plateau Gradient", "PIP − Pplat", "Normal: < 4 cmH₂O", "↑ = increased airway resistance (e.g. bronchospasm)"],
  ];

  const headers = ["Pressure", "Definition", "Clinical Meaning", "Target/Notes"];
  const colW = [2.1, 2.3, 2.7, 2.7];
  const startX = 0.28;
  let y = 1.6;

  // Header row
  let cx = startX;
  headers.forEach((h, i) => {
    s.addShape(prs.ShapeType.rect, { x: cx, y, w: colW[i], h: 0.48, fill: { color: C.mid } });
    s.addText(h, { x: cx + 0.05, y, w: colW[i] - 0.1, h: 0.48, fontSize: 13, bold: true, color: C.white, valign: "middle", fontFace: "Calibri" });
    cx += colW[i];
  });
  y += 0.48;

  rows.forEach((row, ri) => {
    let cx2 = startX;
    const bg = ri % 2 === 0 ? C.white : "EAF4F8";
    row.forEach((cell, ci) => {
      s.addShape(prs.ShapeType.rect, { x: cx2, y, w: colW[ci], h: 0.72, fill: { color: bg }, line: { color: "D1E8EF", pt: 1 } });
      s.addText(cell, { x: cx2 + 0.06, y: y + 0.04, w: colW[ci] - 0.12, h: 0.64, fontSize: 12.5, color: ci === 0 ? C.dark : C.gray, bold: ci === 0, valign: "middle", wrap: true, fontFace: "Calibri" });
      cx2 += colW[ci];
    });
    y += 0.72;
  });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 6 — Modes of Ventilation
// ═══════════════════════════════════════════════════════════════════
{
  const s = prs.addSlide();
  s.addShape(prs.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.dark } });
  s.addShape(prs.ShapeType.rect, { x: 0, y: 0, w: 0.18, h: 5.625, fill: { color: C.orange } });
  s.addText("MODES", { x: 0.28, y: 0.18, w: 9.5, h: 0.45, fontSize: 10, bold: true, color: C.orange, charSpacing: 3 });
  s.addText("Modes of Ventilation", { x: 0.28, y: 0.72, w: 9.5, h: 0.7, fontSize: 28, bold: true, color: C.white, fontFace: "Calibri" });
  s.addShape(prs.ShapeType.rect, { x: 0.28, y: 1.38, w: 1.2, h: 0.06, fill: { color: C.orange } });

  const modes = [
    { name: "Assist-Control (AC)", color: C.accent, pts: ["Most common mode for newly intubated patients", "Delivers full breath with EVERY trigger", "Volume-controlled (VC) or Pressure-controlled (PC)", "Risk: hyperventilation in tachypneic patients"] },
    { name: "SIMV", color: C.orange, pts: ["Synchronized Intermittent Mandatory Ventilation", "Set number of mandatory breaths + patient can breathe spontaneously in between", "Used as a weaning mode", "Spontaneous breaths NOT assisted"] },
    { name: "Pressure Support (PSV)", color: "A8D8EA", pts: ["Supports patient-initiated breaths only", "No backup rate — requires respiratory drive", "Patient controls rate, depth and timing", "Ideal for weaning / spontaneous breathing trials"] },
  ];

  modes.forEach((m, i) => {
    const x = 0.28 + i * 3.24;
    s.addShape(prs.ShapeType.rect, { x, y: 1.55, w: 3.1, h: 3.7, fill: { color: C.mid }, rectRadius: 0.12 });
    s.addShape(prs.ShapeType.rect, { x, y: 1.55, w: 3.1, h: 0.52, fill: { color: m.color }, rectRadius: 0.12 });
    s.addText(m.name, { x: x + 0.1, y: 1.57, w: 2.9, h: 0.48, fontSize: 13.5, bold: true, color: C.dark, valign: "middle", fontFace: "Calibri" });
    s.addText(m.pts.map(p => ({ text: p, options: { bullet: { indent: 18 }, fontSize: 13, color: C.light, breakLine: true, paraSpaceAfter: 7 } })),
      { x: x + 0.12, y: 2.15, w: 2.86, h: 2.95, valign: "top", fontFace: "Calibri" });
  });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 7 — Initial Ventilator Settings
// ═══════════════════════════════════════════════════════════════════
{
  const s = prs.addSlide();
  s.addShape(prs.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.lbg } });
  sectionHeader(s, "SETTINGS");
  slideTitle(s, "Setting Up the Ventilator — Where to Start");

  const settings = [
    { param: "Mode",       value: "AC (Volume Control)",    note: "Default starting point for most patients" },
    { param: "Tidal Volume (VT)", value: "6–8 mL/kg IBW",  note: "Use ideal body weight; reduces lung injury" },
    { param: "Rate (RR)",  value: "12–16 breaths/min",      note: "Titrate to normalize PaCO₂" },
    { param: "FiO₂",      value: "Start at 1.0 → wean",    note: "Target SpO₂ 92–96%; avoid oxygen toxicity" },
    { param: "PEEP",       value: "5 cmH₂O (standard)",    note: "Increase if ARDS / refractory hypoxemia" },
    { param: "I:E Ratio",  value: "1:2 (default)",          note: "Prolong expiration in obstructive disease" },
  ];

  settings.forEach((r, i) => {
    const y = 1.62 + i * 0.63;
    const bg = i % 2 === 0 ? C.white : "E8F4FB";
    s.addShape(prs.ShapeType.rect, { x: 0.28, y, w: 9.5, h: 0.6, fill: { color: bg }, line: { color: "CBE8F2", pt: 1 } });
    s.addShape(prs.ShapeType.rect, { x: 0.28, y, w: 2.3, h: 0.6, fill: { color: C.mid } });
    s.addText(r.param,  { x: 0.33, y, w: 2.2, h: 0.6, fontSize: 13.5, bold: true, color: C.white, valign: "middle", fontFace: "Calibri" });
    s.addText(r.value,  { x: 2.65, y, w: 2.5, h: 0.6, fontSize: 14, bold: true, color: C.accent, valign: "middle", fontFace: "Calibri" });
    s.addText(r.note,   { x: 5.2,  y, w: 4.5, h: 0.6, fontSize: 13, color: C.gray, valign: "middle", italic: true, fontFace: "Calibri" });
  });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 8 — PEEP & Lung-Protective Ventilation
// ═══════════════════════════════════════════════════════════════════
{
  const s = prs.addSlide();
  s.addShape(prs.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.lbg } });
  sectionHeader(s, "LUNG-PROTECTIVE");
  slideTitle(s, "Lung-Protective Ventilation & PEEP");

  // PEEP explainer box
  s.addShape(prs.ShapeType.rect, { x: 0.28, y: 1.55, w: 4.6, h: 3.7, fill: { color: C.white }, line: { color: C.accent, pt: 2 }, rectRadius: 0.1 });
  s.addShape(prs.ShapeType.rect, { x: 0.28, y: 1.55, w: 4.6, h: 0.5, fill: { color: C.accent }, rectRadius: 0.1 });
  s.addText("PEEP — Why It Matters", { x: 0.36, y: 1.57, w: 4.4, h: 0.46, fontSize: 14.5, bold: true, color: C.dark, valign: "middle", fontFace: "Calibri" });
  s.addText([
    bullet("Keeps alveoli open at end of expiration"),
    bullet("Prevents atelectasis and cyclic opening/closing injury"),
    bullet("Increases functional residual capacity (FRC)"),
    bullet("High PEEP (>10 cmH₂O): can worsen hemodynamics"),
    bullet("Caution in: shock, raised intracranial pressure"),
  ], { x: 0.36, y: 2.1, w: 4.4, h: 3.0, valign: "top", fontFace: "Calibri" });

  // Lung-protective strategy box
  s.addShape(prs.ShapeType.rect, { x: 5.12, y: 1.55, w: 4.6, h: 3.7, fill: { color: C.white }, line: { color: C.orange, pt: 2 }, rectRadius: 0.1 });
  s.addShape(prs.ShapeType.rect, { x: 5.12, y: 1.55, w: 4.6, h: 0.5, fill: { color: C.orange }, rectRadius: 0.1 });
  s.addText("Lung-Protective Strategy", { x: 5.2, y: 1.57, w: 4.4, h: 0.46, fontSize: 14.5, bold: true, color: C.dark, valign: "middle", fontFace: "Calibri" });
  s.addText([
    bullet("VT 6–8 mL/kg ideal body weight"),
    bullet("Plateau pressure ≤ 30 cmH₂O"),
    bullet("Permissive hypercapnia if needed"),
    bullet("Avoid high FiO₂ (oxygen toxicity)"),
    bullet("Key in ARDS, post-intubation management"),
  ], { x: 5.2, y: 2.1, w: 4.4, h: 3.0, valign: "top", fontFace: "Calibri" });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 9 — Non-Invasive Ventilation
// ═══════════════════════════════════════════════════════════════════
{
  const s = prs.addSlide();
  s.addShape(prs.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.dark } });
  s.addShape(prs.ShapeType.rect, { x: 0, y: 0, w: 0.18, h: 5.625, fill: { color: C.accent } });
  s.addText("NIV", { x: 0.28, y: 0.18, w: 9.5, h: 0.45, fontSize: 10, bold: true, color: C.accent, charSpacing: 3 });
  s.addText("Non-Invasive Ventilation (NIV)", { x: 0.28, y: 0.72, w: 9.5, h: 0.7, fontSize: 28, bold: true, color: C.white, fontFace: "Calibri" });
  s.addShape(prs.ShapeType.rect, { x: 0.28, y: 1.38, w: 1.2, h: 0.06, fill: { color: C.accent } });

  const cards = [
    { title: "CPAP", color: C.accent, pts: ["Continuous Positive Airway Pressure", "Single constant pressure throughout cycle", "Best for: Obstructive sleep apnea, cardiogenic pulmonary edema", "Does NOT provide inspiratory support"] },
    { title: "BiPAP / NPPV", color: C.orange, pts: ["Bi-level Positive Airway Pressure", "Higher pressure on inspiration (IPAP), lower on expiration (EPAP)", "Best for: COPD exacerbation, type 2 respiratory failure", "Reduces intubation rate and mortality"] },
    { title: "Contraindications", color: "E07A5F", pts: ["Respiratory or cardiac arrest", "Inability to protect airway", "Agitation / uncooperative patient", "Copious secretions, massive aspiration", "Facial trauma / burns"] },
  ];

  cards.forEach((c, i) => {
    const x = 0.28 + i * 3.24;
    s.addShape(prs.ShapeType.rect, { x, y: 1.55, w: 3.1, h: 3.7, fill: { color: C.mid }, rectRadius: 0.12 });
    s.addShape(prs.ShapeType.rect, { x, y: 1.55, w: 3.1, h: 0.52, fill: { color: c.color }, rectRadius: 0.12 });
    s.addText(c.title, { x: x + 0.1, y: 1.57, w: 2.9, h: 0.48, fontSize: 14, bold: true, color: C.dark, valign: "middle", fontFace: "Calibri" });
    s.addText(c.pts.map(p => ({ text: p, options: { bullet: { indent: 18 }, fontSize: 13, color: C.light, breakLine: true, paraSpaceAfter: 8 } })),
      { x: x + 0.12, y: 2.15, w: 2.86, h: 2.95, valign: "top", fontFace: "Calibri" });
  });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 10 — Complications & Troubleshooting
// ═══════════════════════════════════════════════════════════════════
{
  const s = prs.addSlide();
  s.addShape(prs.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.lbg } });
  sectionHeader(s, "COMPLICATIONS");
  slideTitle(s, "Complications & Troubleshooting");

  // DOPE mnemonic
  s.addShape(prs.ShapeType.rect, { x: 0.28, y: 1.55, w: 4.55, h: 3.7, fill: { color: C.white }, line: { color: C.accent, pt: 2 }, rectRadius: 0.1 });
  s.addShape(prs.ShapeType.rect, { x: 0.28, y: 1.55, w: 4.55, h: 0.5, fill: { color: C.accent }, rectRadius: 0.1 });
  s.addText("DOPE Mnemonic (Acute Deterioration)", { x: 0.36, y: 1.57, w: 4.35, h: 0.46, fontSize: 13.5, bold: true, color: C.dark, valign: "middle", fontFace: "Calibri" });
  const dope = [
    ["D", "Displacement of ETT (right main-stem or out)"],
    ["O", "Obstruction (mucous plug, biting tube)"],
    ["P", "Pneumothorax (sudden ↑ PIP + hypotension)"],
    ["E", "Equipment failure (check circuit, power)"],
  ];
  dope.forEach(([letter, desc], i) => {
    const y = 2.18 + i * 0.72;
    s.addShape(prs.ShapeType.rect, { x: 0.38, y, w: 0.42, h: 0.52, fill: { color: C.accent }, rectRadius: 0.06 });
    s.addText(letter, { x: 0.38, y, w: 0.42, h: 0.52, fontSize: 18, bold: true, color: C.dark, align: "center", valign: "middle", fontFace: "Calibri" });
    s.addText(desc, { x: 0.88, y: y + 0.05, w: 3.8, h: 0.45, fontSize: 14, color: C.gray, valign: "middle", fontFace: "Calibri" });
  });

  // Other complications
  s.addShape(prs.ShapeType.rect, { x: 5.17, y: 1.55, w: 4.55, h: 3.7, fill: { color: C.white }, line: { color: C.orange, pt: 2 }, rectRadius: 0.1 });
  s.addShape(prs.ShapeType.rect, { x: 5.17, y: 1.55, w: 4.55, h: 0.5, fill: { color: C.orange }, rectRadius: 0.1 });
  s.addText("Other Key Complications", { x: 5.25, y: 1.57, w: 4.35, h: 0.46, fontSize: 13.5, bold: true, color: C.dark, valign: "middle", fontFace: "Calibri" });
  s.addText([
    bullet("Ventilator-induced lung injury (VILI) — from high pressures/volumes"),
    bullet("Auto-PEEP — air trapping in obstructive disease; ↓ rate to fix"),
    bullet("Hypotension — ↑ intrathoracic pressure → ↓ venous return"),
    bullet("Ventilator-associated pneumonia (VAP)"),
    bullet("Patient-ventilator dyssynchrony — requires sedation adjustment"),
  ], { x: 5.25, y: 2.12, w: 4.35, h: 3.0, valign: "top", fontFace: "Calibri" });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 11 — Weaning & Extubation
// ═══════════════════════════════════════════════════════════════════
{
  const s = prs.addSlide();
  s.addShape(prs.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.dark } });
  s.addShape(prs.ShapeType.rect, { x: 0, y: 0, w: 0.18, h: 5.625, fill: { color: C.orange } });
  s.addText("WEANING", { x: 0.28, y: 0.18, w: 9.5, h: 0.45, fontSize: 10, bold: true, color: C.orange, charSpacing: 3 });
  s.addText("Weaning from Mechanical Ventilation", { x: 0.28, y: 0.72, w: 9.5, h: 0.7, fontSize: 26, bold: true, color: C.white, fontFace: "Calibri" });
  s.addShape(prs.ShapeType.rect, { x: 0.28, y: 1.38, w: 1.2, h: 0.06, fill: { color: C.orange } });

  // SBT box
  s.addShape(prs.ShapeType.rect, { x: 0.28, y: 1.55, w: 4.6, h: 3.7, fill: { color: C.mid }, rectRadius: 0.12 });
  s.addShape(prs.ShapeType.rect, { x: 0.28, y: 1.55, w: 4.6, h: 0.52, fill: { color: C.accent }, rectRadius: 0.12 });
  s.addText("Spontaneous Breathing Trial (SBT)", { x: 0.36, y: 1.57, w: 4.4, h: 0.48, fontSize: 13.5, bold: true, color: C.dark, valign: "middle", fontFace: "Calibri" });
  s.addText([
    bullet("Prerequisite: underlying cause resolving"),
    bullet("Patient awake, follows commands"),
    bullet("FiO₂ ≤ 0.4, PEEP ≤ 5 cmH₂O"),
    bullet("Haemodynamically stable, no vasopressors"),
    bullet("Duration: 30 minutes to 2 hours on minimal support"),
    bullet("Pass → proceed to extubation"),
  ], { x: 0.36, y: 2.15, w: 4.4, h: 2.95, valign: "top", fontFace: "Calibri", color: C.light });

  // Extubation readiness
  s.addShape(prs.ShapeType.rect, { x: 5.12, y: 1.55, w: 4.6, h: 3.7, fill: { color: C.mid }, rectRadius: 0.12 });
  s.addShape(prs.ShapeType.rect, { x: 5.12, y: 1.55, w: 4.6, h: 0.52, fill: { color: C.orange }, rectRadius: 0.12 });
  s.addText("Extubation Readiness Criteria", { x: 5.2, y: 1.57, w: 4.4, h: 0.48, fontSize: 13.5, bold: true, color: C.dark, valign: "middle", fontFace: "Calibri" });
  s.addText([
    bullet("Airway reflexes intact (cough, gag)"),
    bullet("Able to clear secretions"),
    bullet("Adequate mental status (GCS ≥ 8–10)"),
    bullet("Passed SBT without deterioration"),
    bullet("SpO₂ adequate on low FiO₂"),
    bullet("No excessive work of breathing or distress"),
  ], { x: 5.2, y: 2.15, w: 4.4, h: 2.95, valign: "top", fontFace: "Calibri", color: C.light });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 12 — Summary / Key Takeaways
// ═══════════════════════════════════════════════════════════════════
{
  const s = prs.addSlide();
  s.addShape(prs.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.dark } });
  s.addShape(prs.ShapeType.rect, { x: 0, y: 0, w: 10, h: 1.2, fill: { color: C.mid } });
  s.addShape(prs.ShapeType.rect, { x: 0, y: 0, w: 0.5, h: 5.625, fill: { color: C.accent } });
  s.addText("KEY TAKEAWAYS", { x: 0.65, y: 0.15, w: 9, h: 0.4, fontSize: 12, bold: true, color: C.accent, charSpacing: 4 });
  s.addText("What to Remember", { x: 0.65, y: 0.55, w: 9, h: 0.55, fontSize: 30, bold: true, color: C.white, fontFace: "Calibri" });

  const points = [
    { n: "01", txt: "MV supports both oxygenation AND ventilation — always address both" },
    { n: "02", txt: "Use lung-protective strategy: VT 6–8 mL/kg IBW, Pplat ≤ 30 cmH₂O" },
    { n: "03", txt: "AC mode is the default starting mode; PSV is used for weaning" },
    { n: "04", txt: "PEEP prevents alveolar collapse — but too much harms haemodynamics" },
    { n: "05", txt: "DOPE = the 4 causes to check in any intubated patient who deteriorates" },
    { n: "06", txt: "Wean daily: perform SBT when the patient meets readiness criteria" },
  ];

  points.forEach((p, i) => {
    const x = i < 3 ? 0.65 : 5.35;
    const y = 1.38 + (i % 3) * 1.35;
    s.addShape(prs.ShapeType.rect, { x, y, w: 4.4, h: 1.22, fill: { color: C.mid }, rectRadius: 0.1 });
    s.addShape(prs.ShapeType.rect, { x, y, w: 0.62, h: 1.22, fill: { color: C.accent }, rectRadius: 0.1 });
    s.addText(p.n, { x, y, w: 0.62, h: 1.22, fontSize: 22, bold: true, color: C.dark, align: "center", valign: "middle", fontFace: "Calibri" });
    s.addText(p.txt, { x: x + 0.68, y: y + 0.08, w: 3.65, h: 1.06, fontSize: 13, color: C.light, valign: "middle", wrap: true, fontFace: "Calibri", lineSpacingMultiple: 1.25 });
  });
}

// ─── Write file ───────────────────────────────────────────────────
prs.writeFile({ fileName: "/home/daytona/workspace/ventilator-ppt/Mechanical_Ventilation.pptx" })
  .then(() => console.log("Done: Mechanical_Ventilation.pptx"))
  .catch(err => console.error("Error:", err));
Running Command

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

Running Command

ls -lh /home/daytona/workspace/ventilator-ppt/Mechanical_Ventilation.pptx

Your presentation is ready!

Mechanical Ventilation

Presentation · PPTX


Here's what's inside — 12 slides with a professional navy + teal color scheme:
SlideTopic
1Title slide
2What is Mechanical Ventilation?
3Indications (two-column card layout)
4Key Physiology (VE, VT, Compliance)
5Airway Pressures table (PIP, Pplat, PEEP, gradient)
6Modes of Ventilation (AC, SIMV, PSV)
7Initial Ventilator Settings — step-by-step table
8PEEP & Lung-Protective Ventilation
9Non-Invasive Ventilation (CPAP vs BiPAP vs Contraindications)
10Complications & DOPE mnemonic
11Weaning & Extubation (SBT + criteria)
12Key Takeaways (numbered summary cards)
Content is sourced from Roberts & Hedges' Clinical Procedures in Emergency, Rosen's Emergency Medicine, and Pfenninger & Fowler's Procedures for Primary Care. Let me know if you'd like any changes to content, design, or slide order!
This is a shared conversation. Sign in to Orris to start your own chat.