create a PPT file topic is Respiratory distress , add detailed information and do not forget to put main issue , causes , sign and symptoms, investigation , clinical manifestations , investigating criteria , diagnostic tools , treatment and real life cases make this as a medical intern

Reading File
Reading File
Reading File
Finding Sources
Finding Sources
Reading File
Finding Sources
Finding Sources
Reading File
Finding Sources
Finding Sources
Reading File
Finding Sources
Searching Images

acute respiratory distress syndrome ARDS chest X-ray bilateral opacities

Searching Images

respiratory distress clinical signs accessory muscle use tachypnea

Running Command

ls -la /home/daytona/workspace/ 2>/dev/null || echo "workspace does not exist"

Running Command

mkdir -p /home/daytona/workspace/respiratory-distress-ppt

Writing File

~/respiratory-distress-ppt/build.js

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

// --- Fetch images ---
const imageUrls = [
  "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_12a1cb250fa88ebe2207de940afd3ed9bfb5b0060227d83c8998acc2dd75f76b.jpg",  // ARDS CXR
  "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_2915910772fd3b3980e9b3b5f936042c1168bcc760892c686e0d41ac327e3be5.jpg",  // ARDS progression
  "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_abe315d8f08a4df03f9ebbbfec8ea5afc483854ff33ae194bd2ad4b5067056fb.jpg",  // Clinical signs
  "https://cdn.orris.care/cdss_images/pmc_clinical_VQA_4d8986f462f78742b780572d802059ef1270c3a82222fef19debb3c7c2dbf9d9.jpg",  // ARDS Berlin CXR
];

console.log("Fetching images...");
let images = [];
try {
  const raw = execSync(
    `node /home/daytona/skills/shared/scripts/fetch_images.js ${imageUrls.map(u => `"${u}"`).join(" ")}`,
    { timeout: 60000 }
  ).toString();
  images = JSON.parse(raw);
  console.log("Images fetched:", images.map(i => i.error || "OK"));
} catch (e) {
  console.log("Image fetch failed:", e.message);
  images = imageUrls.map(() => ({ base64: null, error: "fetch failed" }));
}

// Color palette  — deep navy + crimson accent + white
const NAVY     = "0D1B2A";
const CRIMSON  = "C0392B";
const TEAL     = "1A7A8A";
const WHITE    = "FFFFFF";
const OFFWHITE = "F2F6FA";
const LTGRAY   = "D0D8E0";
const DARKGRAY = "2C3E50";

const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.author  = "Medical Intern";
pres.title   = "Respiratory Distress — Comprehensive Clinical Review";

// ──────────────────────────────────────────────────
// Helper: add a standard content slide with header bar
// ──────────────────────────────────────────────────
function contentSlide(title, sectionTag) {
  const sl = pres.addSlide();
  // Full background
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: OFFWHITE } });
  // Left accent stripe
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.18, h: 5.625, fill: { color: CRIMSON } });
  // Header bar
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.95, fill: { color: NAVY } });
  // Section tag chip
  sl.addShape(pres.ShapeType.rect, { x: 8.0, y: 0.18, w: 1.78, h: 0.58, fill: { color: CRIMSON }, line: { color: CRIMSON } });
  sl.addText(sectionTag, { x: 8.0, y: 0.18, w: 1.78, h: 0.58, fontSize: 9, bold: true, color: WHITE, align: "center", valign: "middle" });
  // Slide title
  sl.addText(title, { x: 0.35, y: 0.1, w: 7.5, h: 0.78, fontSize: 22, bold: true, color: WHITE, valign: "middle", margin: 0 });
  return sl;
}

// Helper: bullet items array
function bullets(items, opts = {}) {
  return items.map((item, i) => ({
    text: item,
    options: { bullet: { code: "2022" }, fontSize: opts.fontSize || 13, color: opts.color || DARKGRAY, breakLine: i < items.length - 1, bold: opts.bold || false, paraSpaceAfter: 4 }
  }));
}

// Helper: sub-bullet
function subBullets(items, opts = {}) {
  return items.map((item, i) => ({
    text: "  " + item,
    options: { bullet: { code: "25E6" }, fontSize: opts.fontSize || 11.5, color: opts.color || "4A5568", breakLine: i < items.length - 1, paraSpaceAfter: 2 }
  }));
}

// ══════════════════════════════════════════════════
// SLIDE 1 — TITLE
// ══════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  // Full dark background
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: NAVY } });
  // Crimson accent band
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 3.6, w: 10, h: 0.12, fill: { color: CRIMSON } });
  // Decorative circle
  sl.addShape(pres.ShapeType.ellipse, { x: 7.0, y: -1.2, w: 4.5, h: 4.5, fill: { color: TEAL }, line: { color: TEAL }, transparency: 75 });

  sl.addText("RESPIRATORY DISTRESS", {
    x: 0.5, y: 0.9, w: 9, h: 1.2,
    fontSize: 40, bold: true, color: WHITE, align: "center", charSpacing: 3
  });
  sl.addText("A Comprehensive Clinical Review", {
    x: 0.5, y: 2.0, w: 9, h: 0.6,
    fontSize: 20, italic: true, color: LTGRAY, align: "center"
  });
  sl.addText("Causes · Signs & Symptoms · Investigations · Diagnosis · Treatment · Real-Life Cases", {
    x: 0.5, y: 2.62, w: 9, h: 0.45,
    fontSize: 12, color: "8BAACC", align: "center"
  });
  sl.addShape(pres.ShapeType.rect, { x: 3.5, y: 3.25, w: 3, h: 0.03, fill: { color: CRIMSON } });
  sl.addText("Presented by: Medical Intern  |  Department of Medicine", {
    x: 0.5, y: 3.85, w: 9, h: 0.4,
    fontSize: 11, color: LTGRAY, align: "center"
  });
  sl.addText("May 2026", {
    x: 0.5, y: 4.25, w: 9, h: 0.35,
    fontSize: 10, color: "8BAACC", align: "center"
  });
}

// ══════════════════════════════════════════════════
// SLIDE 2 — TABLE OF CONTENTS
// ══════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: OFFWHITE } });
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.95, fill: { color: NAVY } });
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.18, h: 5.625, fill: { color: TEAL } });
  sl.addText("TABLE OF CONTENTS", { x: 0.35, y: 0.1, w: 9.4, h: 0.78, fontSize: 22, bold: true, color: WHITE, valign: "middle", margin: 0 });

  const sections = [
    ["01", "Overview & Main Issue", "What is Respiratory Distress?"],
    ["02", "Causes & Pathophysiology", "Pulmonary, Cardiac, Neuromuscular & More"],
    ["03", "Signs & Symptoms", "Clinical Presentation & Red Flags"],
    ["04", "Clinical Manifestations", "ARDS, Acute Respiratory Failure & Subtypes"],
    ["05", "Investigations", "Labs, Imaging, ABG & Bedside Tests"],
    ["06", "Diagnostic Criteria", "Berlin Definition · ARDS Severity Grading"],
    ["07", "Diagnostic Tools", "CXR, CT, Echocardiography, Spirometry"],
    ["08", "Treatment", "Oxygen, Ventilation, Pharmacology & ECMO"],
    ["09", "Real-Life Cases", "Three Clinical Scenarios"],
    ["10", "Summary & Key Takeaways", ""],
  ];

  const cols = 2, rows = 5;
  const cw = 4.6, rh = 0.84, sx = 0.35, sy = 1.05;

  sections.forEach(([num, title, sub], idx) => {
    const col = idx % cols;
    const row = Math.floor(idx / cols);
    const bx = sx + col * (cw + 0.2);
    const by = sy + row * rh;

    sl.addShape(pres.ShapeType.rect, { x: bx, y: by, w: cw, h: 0.72, fill: { color: WHITE }, line: { color: LTGRAY, pt: 1 }, shadow: { type: "outer", blur: 3, offset: 1, angle: 45, color: "AAAAAA", opacity: 0.2 } });
    sl.addShape(pres.ShapeType.rect, { x: bx, y: by, w: 0.42, h: 0.72, fill: { color: CRIMSON } });
    sl.addText(num, { x: bx, y: by, w: 0.42, h: 0.72, fontSize: 11, bold: true, color: WHITE, align: "center", valign: "middle", margin: 0 });
    sl.addText(title, { x: bx + 0.48, y: by + 0.05, w: cw - 0.54, h: 0.35, fontSize: 11.5, bold: true, color: NAVY, margin: 0, valign: "top" });
    if (sub) sl.addText(sub, { x: bx + 0.48, y: by + 0.38, w: cw - 0.54, h: 0.28, fontSize: 9, color: "667788", margin: 0, valign: "top" });
  });
}

// ══════════════════════════════════════════════════
// SLIDE 3 — OVERVIEW & MAIN ISSUE
// ══════════════════════════════════════════════════
{
  const sl = contentSlide("Overview & Main Issue", "OVERVIEW");

  // Definition box
  sl.addShape(pres.ShapeType.rect, { x: 0.35, y: 1.05, w: 9.3, h: 1.05, fill: { color: "EBF4FA" }, line: { color: TEAL, pt: 1.5 } });
  sl.addShape(pres.ShapeType.rect, { x: 0.35, y: 1.05, w: 0.08, h: 1.05, fill: { color: TEAL } });
  sl.addText([
    { text: "DEFINITION  ", options: { bold: true, color: TEAL, fontSize: 12 } },
    { text: "Respiratory distress is the physician-recognized combination of a patient's subjective sensation of dyspnea with objective signs of difficulty breathing — including tachypnea, accessory muscle use, nasal flaring, and hypoxemia. It represents a spectrum from mild breathlessness to life-threatening ventilatory failure.", options: { color: DARKGRAY, fontSize: 12 } }
  ], { x: 0.52, y: 1.08, w: 9.05, h: 1.0, valign: "middle", margin: 4 });

  // Main Issue stats
  sl.addText("WHY IT MATTERS", { x: 0.35, y: 2.2, w: 4.4, h: 0.3, fontSize: 11, bold: true, color: CRIMSON, margin: 0 });
  sl.addText([
    { text: "Respiratory distress is the #1 reason for emergency department presentation.\n", options: { bold: true, color: DARKGRAY, fontSize: 12, breakLine: true } },
    ...bullets([
      "Affects ~10% of all ICU admissions worldwide",
      "ARDS alone carries a 35–46% mortality (mild to severe)",
      "Delays in recognition of cause lead to preventable deaths",
      "Requires rapid systematic assessment — every minute counts",
      "Etiology spans pulmonary, cardiac, neuromuscular, metabolic & toxicological origins",
    ])
  ], { x: 0.35, y: 2.5, w: 5.5, h: 2.85, valign: "top", margin: 4 });

  // Spectrum diagram
  sl.addShape(pres.ShapeType.rect, { x: 6.1, y: 2.2, w: 3.55, h: 3.15, fill: { color: WHITE }, line: { color: LTGRAY, pt: 1 } });
  sl.addText("SEVERITY SPECTRUM", { x: 6.1, y: 2.2, w: 3.55, h: 0.35, fontSize: 10, bold: true, color: NAVY, align: "center", valign: "middle" });
  const levels = [
    ["Mild Dyspnea", "E8F4FD", "SpO₂ 94–98%"],
    ["Moderate Distress", "FFF3CD", "SpO₂ 88–93%"],
    ["Severe Distress", "FCE4E4", "SpO₂ < 88%"],
    ["Respiratory Failure", CRIMSON, "Intubation needed"],
  ];
  levels.forEach(([label, color, detail], i) => {
    sl.addShape(pres.ShapeType.rect, { x: 6.2, y: 2.62 + i * 0.63, w: 3.35, h: 0.52, fill: { color }, line: { color: LTGRAY, pt: 0.5 } });
    sl.addText(label, { x: 6.22, y: 2.64 + i * 0.63, w: 1.9, h: 0.48, fontSize: 10.5, bold: true, color: color === CRIMSON ? WHITE : NAVY, valign: "middle", margin: 2 });
    sl.addText(detail, { x: 8.14, y: 2.64 + i * 0.63, w: 1.35, h: 0.48, fontSize: 9.5, color: color === CRIMSON ? WHITE : "556677", valign: "middle", align: "right", margin: 2 });
  });
}

// ══════════════════════════════════════════════════
// SLIDE 4 — CAUSES & PATHOPHYSIOLOGY
// ══════════════════════════════════════════════════
{
  const sl = contentSlide("Causes & Pathophysiology", "ETIOLOGY");

  const categories = [
    { title: "PULMONARY", color: TEAL, items: ["Pneumonia (bacterial/viral/fungal)", "Acute Respiratory Distress Syndrome (ARDS)", "Asthma / COPD exacerbation", "Pulmonary embolism", "Pneumothorax", "Pleural effusion"] },
    { title: "CARDIAC", color: "1A6B3A", items: ["Acute decompensated heart failure", "Cardiogenic pulmonary edema", "Myocardial infarction", "Cardiac tamponade", "Arrhythmias"] },
    { title: "UPPER AIRWAY", color: CRIMSON, items: ["Foreign body obstruction", "Angioedema / anaphylaxis", "Epiglottitis", "Croup", "Tracheal compression (goiter/mass)"] },
    { title: "NEUROMUSCULAR", color: "7B3FA0", items: ["Guillain-Barré syndrome", "Myasthenia gravis", "Diaphragmatic paralysis", "Botulism / spinal cord injury"] },
    { title: "METABOLIC / TOXIC", color: "C07A00", items: ["Severe metabolic acidosis (Kussmaul)", "Drug overdose (opioids, benzodiazepines)", "Sepsis-induced ARDS", "Carbon monoxide poisoning"] },
    { title: "NEONATAL / PEDIATRIC", color: "1A5B8A", items: ["Neonatal RDS (surfactant deficiency)", "Transient tachypnea of newborn", "Bronchiolitis (RSV)", "Meconium aspiration"] },
  ];

  const cw = 2.95, rh = 1.9, sx = 0.35, sy = 1.06;
  categories.forEach(({ title, color, items }, idx) => {
    const col = idx % 3, row = Math.floor(idx / 3);
    const bx = sx + col * (cw + 0.18);
    const by = sy + row * rh;

    sl.addShape(pres.ShapeType.rect, { x: bx, y: by, w: cw, h: rh - 0.1, fill: { color: WHITE }, line: { color: LTGRAY, pt: 1 } });
    sl.addShape(pres.ShapeType.rect, { x: bx, y: by, w: cw, h: 0.34, fill: { color } });
    sl.addText(title, { x: bx, y: by, w: cw, h: 0.34, fontSize: 10, bold: true, color: WHITE, align: "center", valign: "middle", margin: 0 });
    sl.addText(bullets(items, { fontSize: 10.5 }), { x: bx + 0.08, y: by + 0.38, w: cw - 0.12, h: rh - 0.52, valign: "top", margin: 2 });
  });
}

// ══════════════════════════════════════════════════
// SLIDE 5 — SIGNS & SYMPTOMS
// ══════════════════════════════════════════════════
{
  const sl = contentSlide("Signs & Symptoms", "CLINICAL FEATURES");

  // Left column: Signs
  sl.addShape(pres.ShapeType.rect, { x: 0.35, y: 1.05, w: 4.4, h: 0.36, fill: { color: NAVY } });
  sl.addText("⚠  OBJECTIVE SIGNS", { x: 0.35, y: 1.05, w: 4.4, h: 0.36, fontSize: 11, bold: true, color: WHITE, align: "center", valign: "middle", margin: 0 });

  const signGroups = [
    { label: "Respiratory", color: TEAL, items: ["Tachypnea (RR > 20 breaths/min)", "Use of accessory muscles (SCM, intercostals)", "Nasal flaring", "Paradoxical abdominal movement (diaphragmatic fatigue)", "Pursed-lip breathing", "Grunting (neonates)", "Stridor or wheeze"] },
    { label: "Cardiovascular", color: "1A6B3A", items: ["Tachycardia", "Hypotension (late sign)", "Pulsus paradoxus (tamponade/asthma)", "Jugular venous distension"] },
    { label: "Neurological / Systemic", color: CRIMSON, items: ["Agitation or confusion (hypoxemia)", "Decreased consciousness (hypercapnia)", "Diaphoresis", "Cyanosis (central/peripheral)", "Inability to speak in full sentences"] },
  ];

  let curY = 1.47;
  signGroups.forEach(({ label, color, items }) => {
    sl.addShape(pres.ShapeType.rect, { x: 0.35, y: curY, w: 0.12, h: items.length * 0.26 + 0.12, fill: { color } });
    sl.addText(label.toUpperCase(), { x: 0.52, y: curY + 0.02, w: 4.1, h: 0.24, fontSize: 10, bold: true, color, margin: 0 });
    curY += 0.28;
    items.forEach(item => {
      sl.addText([{ text: item, options: { bullet: { code: "2022" }, fontSize: 11, color: DARKGRAY } }], { x: 0.55, y: curY, w: 4.1, h: 0.25, margin: 0, valign: "middle" });
      curY += 0.26;
    });
    curY += 0.06;
  });

  // Right column: Symptoms (subjective) + image
  sl.addShape(pres.ShapeType.rect, { x: 4.9, y: 1.05, w: 4.75, h: 0.36, fill: { color: NAVY } });
  sl.addText("💬  SUBJECTIVE SYMPTOMS", { x: 4.9, y: 1.05, w: 4.75, h: 0.36, fontSize: 11, bold: true, color: WHITE, align: "center", valign: "middle", margin: 0 });
  sl.addText(bullets([
    "Dyspnea — 'can't get enough air'",
    "Chest tightness or pressure",
    "Breathlessness worse on exertion (or at rest)",
    "Orthopnea (heart failure)",
    "Paroxysmal nocturnal dyspnea",
    "Cough — dry or productive",
    "Pleuritic chest pain (PE, pneumonia)",
    "Hemoptysis (TB, PE, lung Ca)",
    "Wheezing (asthma, COPD, cardiac)",
    "Fatigue & decreased exercise tolerance",
  ], { fontSize: 11.5 }), { x: 4.9, y: 1.47, w: 4.75, h: 2.4, valign: "top", margin: 4 });

  // Image of clinical signs
  if (images[2] && !images[2].error) {
    sl.addImage({ data: images[2].base64, x: 4.9, y: 3.95, w: 2.4, h: 1.48 });
    sl.addText("Cardinal signs of respiratory distress in a pediatric patient", { x: 7.35, y: 3.98, w: 2.3, h: 1.45, fontSize: 9, color: "667788", italic: true, valign: "middle", margin: 2 });
  }
}

// ══════════════════════════════════════════════════
// SLIDE 6 — CLINICAL MANIFESTATIONS
// ══════════════════════════════════════════════════
{
  const sl = contentSlide("Clinical Manifestations", "MANIFESTATIONS");

  const manifests = [
    {
      title: "Acute Respiratory Failure",
      color: CRIMSON,
      body: "Inability to maintain adequate oxygenation (PaO₂ < 60 mmHg on room air) or CO₂ elimination (PaCO₂ > 50 mmHg). Type 1 = hypoxemic; Type 2 = hypercapnic.",
      sub: ["Tachypnea, accessory muscle use, confusion", "ABG: low PaO₂ ± elevated PaCO₂", "Triggers: pneumonia, PE, ARDS, COPD exac."],
    },
    {
      title: "ARDS (Acute Respiratory Distress Syndrome)",
      color: NAVY,
      body: "Diffuse alveolar damage with non-cardiogenic pulmonary edema. Three phases: exudative (0–7d), proliferative (7–21d), fibrotic (>21d).",
      sub: ["Bilateral infiltrates on CXR/CT", "PaO₂/FiO₂ ≤ 300 (Berlin criteria)", "Mortality 35% mild → 46% severe"],
    },
    {
      title: "Cardiogenic Pulmonary Edema",
      color: TEAL,
      body: "Left ventricular failure raises pulmonary capillary wedge pressure > 18 mmHg, forcing fluid into alveoli. Causes hypoxemia and pink frothy sputum.",
      sub: ["S3 gallop, JVD, peripheral edema", "CXR: butterfly pattern, Kerley B lines", "BNP > 500 pg/mL is diagnostic"],
    },
    {
      title: "Obstructive Airway Disease",
      color: "1A6B3A",
      body: "Asthma / COPD exacerbation — bronchospasm, mucus plugging, and hyperinflation limit airflow and increase work of breathing.",
      sub: ["Expiratory wheeze, prolonged I:E ratio", "PEFR < 50% predicted = severe", "ABG: early respiratory alkalosis"],
    },
    {
      title: "Upper Airway Obstruction",
      color: "C07A00",
      body: "Stridor, drooling, muffled voice. Life-threatening: foreign body, angioedema, epiglottitis. Immediate airway management is priority.",
      sub: ["Inspiratory stridor (extrathoracic obstruction)", "Lateral neck X-ray / nasopharyngoscopy", "NEVER perform oral exam if epiglottitis suspected"],
    },
    {
      title: "Tension Pneumothorax",
      color: "7B3FA0",
      body: "Air under pressure in the pleural space collapses the ipsilateral lung and shifts mediastinum, causing obstructive shock. Clinical diagnosis — do not wait for CXR.",
      sub: ["Absent breath sounds, tracheal deviation", "Distended neck veins + hypotension", "Immediate needle decompression (2nd ICS, MCL)"],
    },
  ];

  const cw = 3.0, rh = 1.82, sx = 0.35, sy = 1.05;
  manifests.forEach(({ title, color, body, sub }, idx) => {
    const col = idx % 3, row = Math.floor(idx / 3);
    const bx = sx + col * (cw + 0.18);
    const by = sy + row * rh;
    sl.addShape(pres.ShapeType.rect, { x: bx, y: by, w: cw, h: rh - 0.1, fill: { color: WHITE }, line: { color: LTGRAY, pt: 0.8 } });
    sl.addShape(pres.ShapeType.rect, { x: bx, y: by, w: cw, h: 0.32, fill: { color } });
    sl.addText(title, { x: bx + 0.05, y: by, w: cw - 0.1, h: 0.32, fontSize: 9.5, bold: true, color: WHITE, valign: "middle", margin: 2 });
    sl.addText(body, { x: bx + 0.06, y: by + 0.34, w: cw - 0.1, h: 0.58, fontSize: 9.5, color: DARKGRAY, valign: "top", margin: 2 });
    sl.addText(subBullets(sub, { fontSize: 9.5 }), { x: bx + 0.06, y: by + 0.95, w: cw - 0.1, h: rh - 1.1, valign: "top", margin: 2 });
  });
}

// ══════════════════════════════════════════════════
// SLIDE 7 — INVESTIGATIONS
// ══════════════════════════════════════════════════
{
  const sl = contentSlide("Investigations", "WORKUP");

  // Two column layout
  const leftItems = [
    { cat: "ARTERIAL BLOOD GAS (ABG)", color: CRIMSON, items: [
      "PaO₂: oxygenation status (normal 80–100 mmHg)",
      "PaCO₂: ventilatory status (normal 35–45 mmHg)",
      "pH: acid-base balance (7.35–7.45)",
      "HCO₃⁻: metabolic component (22–26 mEq/L)",
      "A-a gradient: alveolar-arterial O₂ difference",
      "P/F ratio: PaO₂/FiO₂ (ARDS severity marker)",
    ]},
    { cat: "PULSE OXIMETRY & SPIROMETRY", color: TEAL, items: [
      "SpO₂ — rapid, non-invasive; insensitive for hypoventilation",
      "Peak expiratory flow (PEFR) — asthma severity",
      "Negative inspiratory force (NIF) — neuromuscular strength",
      "FEV₁/FVC ratio — obstructive vs restrictive pattern",
    ]},
    { cat: "LABORATORY TESTS", color: NAVY, items: [
      "CBC: leukocytosis (infection), anaemia (↓O₂ carrying capacity)",
      "BNP / NT-proBNP: heart failure (>500 pg/mL diagnostic)",
      "D-dimer: PE screening (high sensitivity, low specificity)",
      "CRP / PCT: infection/sepsis markers",
      "Troponin: myocardial ischemia",
      "Lactate: tissue hypoperfusion / sepsis",
      "Blood cultures + sputum culture: infectious aetiology",
    ]},
  ];
  const rightItems = [
    { cat: "IMAGING", color: "1A6B3A", items: [
      "Chest X-ray (CXR): first-line — infiltrates, effusion, PTX, cardiomegaly",
      "HRCT chest: ARDS pattern, interstitial disease, PE",
      "CT pulmonary angiography (CTPA): gold standard for PE",
      "Lung ultrasound (LUS): B-lines (pulmonary edema), A-lines (normal/PTX)",
    ]},
    { cat: "CARDIAC INVESTIGATIONS", color: "7B3FA0", items: [
      "ECG: arrhythmia, myocardial ischemia, right heart strain (PE)",
      "Echocardiography: EF, wall motion, pericardial effusion, PASP",
      "Right heart catheterization: PCWP (cardiogenic vs ARDS)",
    ]},
    { cat: "BEDSIDE PROCEDURES", color: "C07A00", items: [
      "Point-of-care ultrasound (POCUS): RUSH protocol",
      "Thoracentesis: large pleural effusion",
      "Bronchoscopy + BAL: ARDS, diffuse alveolar damage, atypical infection",
      "Nasopharyngoscopy: upper airway obstruction assessment",
    ]},
  ];

  const cw = 4.45;
  [leftItems, rightItems].forEach((col, ci) => {
    let curY = 1.05;
    col.forEach(({ cat, color, items }) => {
      const bh = 0.28 + items.length * 0.27;
      sl.addShape(pres.ShapeType.rect, { x: 0.35 + ci * (cw + 0.35), y: curY, w: cw, h: bh, fill: { color: WHITE }, line: { color: LTGRAY, pt: 0.8 } });
      sl.addShape(pres.ShapeType.rect, { x: 0.35 + ci * (cw + 0.35), y: curY, w: cw, h: 0.28, fill: { color } });
      sl.addText(cat, { x: 0.35 + ci * (cw + 0.35) + 0.06, y: curY, w: cw - 0.1, h: 0.28, fontSize: 10, bold: true, color: WHITE, valign: "middle", margin: 2 });
      sl.addText(bullets(items, { fontSize: 10.2 }), { x: 0.35 + ci * (cw + 0.35) + 0.06, y: curY + 0.3, w: cw - 0.12, h: bh - 0.32, valign: "top", margin: 2 });
      curY += bh + 0.1;
    });
  });
}

// ══════════════════════════════════════════════════
// SLIDE 8 — DIAGNOSTIC CRITERIA (ARDS Berlin + ABG)
// ══════════════════════════════════════════════════
{
  const sl = contentSlide("Investigating Criteria & Diagnostic Criteria", "CRITERIA");

  // Berlin definition box
  sl.addShape(pres.ShapeType.rect, { x: 0.35, y: 1.06, w: 5.2, h: 0.34, fill: { color: NAVY } });
  sl.addText("BERLIN DEFINITION OF ARDS (2012)", { x: 0.35, y: 1.06, w: 5.2, h: 0.34, fontSize: 11, bold: true, color: WHITE, align: "center", valign: "middle", margin: 0 });

  const berlinCriteria = [
    ["Timing", "Onset within 1 week of clinical insult OR new/worsening respiratory symptoms"],
    ["Imaging", "Bilateral opacities — not fully explained by effusions, lobar/lung collapse, or nodules"],
    ["Origin of edema", "Not fully explained by cardiac failure or fluid overload (echo may be needed)"],
    ["P/F Ratio", "Mild: 201–300 mmHg, Moderate: 101–200 mmHg, Severe: ≤100 mmHg (with PEEP ≥5)"],
  ];

  berlinCriteria.forEach(([crit, detail], i) => {
    const by = 1.46 + i * 0.58;
    sl.addShape(pres.ShapeType.rect, { x: 0.35, y: by, w: 5.2, h: 0.52, fill: { color: i % 2 === 0 ? "F0F5FF" : WHITE }, line: { color: LTGRAY, pt: 0.5 } });
    sl.addText(crit, { x: 0.38, y: by + 0.04, w: 1.1, h: 0.44, fontSize: 10.5, bold: true, color: NAVY, valign: "middle", margin: 2 });
    sl.addText(detail, { x: 1.52, y: by + 0.04, w: 3.98, h: 0.44, fontSize: 10.5, color: DARKGRAY, valign: "middle", margin: 2 });
  });

  // Severity table
  sl.addShape(pres.ShapeType.rect, { x: 0.35, y: 3.8, w: 5.2, h: 0.28, fill: { color: CRIMSON } });
  sl.addText("SEVERITY GRADING BY PaO₂/FiO₂", { x: 0.35, y: 3.8, w: 5.2, h: 0.28, fontSize: 10, bold: true, color: WHITE, align: "center", valign: "middle", margin: 0 });
  const sevRows = [
    ["Mild", "201–300 mmHg", "CPAP/PEEP > 5 cmH₂O", "~27%"],
    ["Moderate", "101–200 mmHg", "PEEP ≥ 5 cmH₂O", "~32%"],
    ["Severe", "≤ 100 mmHg", "PEEP ≥ 5 cmH₂O", "~45%"],
  ];
  const sevColors = ["E8F4FD", "FFF3CD", "FCE4E4"];
  const hdrs = ["Severity", "PaO₂/FiO₂", "Ventilation", "Mortality"];
  sl.addShape(pres.ShapeType.rect, { x: 0.35, y: 4.08, w: 5.2, h: 0.28, fill: { color: DARKGRAY } });
  [0, 1, 2, 3].forEach(ci => {
    const cwidths = [0.78, 1.38, 1.88, 1.08];
    const cstarts = [0.37, 1.15, 2.53, 4.41];
    sl.addText(hdrs[ci], { x: cstarts[ci], y: 4.1, w: cwidths[ci], h: 0.24, fontSize: 9.5, bold: true, color: WHITE, align: "center", valign: "middle", margin: 0 });
  });
  sevRows.forEach((row, ri) => {
    sl.addShape(pres.ShapeType.rect, { x: 0.35, y: 4.36 + ri * 0.33, w: 5.2, h: 0.32, fill: { color: sevColors[ri] }, line: { color: LTGRAY, pt: 0.3 } });
    const cstarts = [0.37, 1.15, 2.53, 4.41];
    const cwidths = [0.76, 1.36, 1.86, 1.06];
    row.forEach((cell, ci) => {
      sl.addText(cell, { x: cstarts[ci], y: 4.38 + ri * 0.33, w: cwidths[ci], h: 0.28, fontSize: 9.5, color: DARKGRAY, align: "center", valign: "middle", margin: 0 });
    });
  });

  // Right: ABG interpretation + Resp failure criteria
  sl.addShape(pres.ShapeType.rect, { x: 5.75, y: 1.06, w: 3.9, h: 0.34, fill: { color: TEAL } });
  sl.addText("ABG INTERPRETATION CRITERIA", { x: 5.75, y: 1.06, w: 3.9, h: 0.34, fontSize: 11, bold: true, color: WHITE, align: "center", valign: "middle", margin: 0 });
  sl.addText(bullets([
    "pH < 7.35 → Acidosis (respiratory if ↑PaCO₂)",
    "pH > 7.45 → Alkalosis (respiratory if ↓PaCO₂)",
    "PaO₂ < 60 mmHg → Hypoxemic resp. failure",
    "PaCO₂ > 50 mmHg → Hypercapnic resp. failure",
    "A-a gradient > 10–15 mmHg → V/Q mismatch or shunt",
    "Lactate > 2 mmol/L → Tissue hypoperfusion",
  ], { fontSize: 11 }), { x: 5.78, y: 1.45, w: 3.84, h: 1.8, valign: "top", margin: 4 });

  sl.addShape(pres.ShapeType.rect, { x: 5.75, y: 3.35, w: 3.9, h: 0.34, fill: { color: CRIMSON } });
  sl.addText("RESP. FAILURE DIAGNOSTIC CRITERIA", { x: 5.75, y: 3.35, w: 3.9, h: 0.34, fontSize: 10.5, bold: true, color: WHITE, align: "center", valign: "middle", margin: 0 });
  sl.addText(bullets([
    "Type 1 (Hypoxemic): PaO₂ < 60 on room air, normal/low PaCO₂",
    "Type 2 (Hypercapnic): PaCO₂ > 45 + respiratory acidosis",
    "Type 3 (Peri-operative): atelectasis-related",
    "Type 4 (Shock-related): ↓perfusion of resp. muscles",
    "Indices: APACHE II, SOFA, Murray Lung Injury Score",
  ], { fontSize: 11 }), { x: 5.78, y: 3.72, w: 3.84, h: 1.68, valign: "top", margin: 4 });
}

// ══════════════════════════════════════════════════
// SLIDE 9 — DIAGNOSTIC TOOLS
// ══════════════════════════════════════════════════
{
  const sl = contentSlide("Diagnostic Tools", "DIAGNOSTICS");

  const tools = [
    { name: "Chest X-Ray (CXR)", icon: "🫁", color: NAVY, body: "First-line imaging. Portable AP in ICU. Identifies bilateral infiltrates (ARDS), consolidation (PNA), pleural effusion, cardiomegaly, pneumothorax, Kerley B lines." },
    { name: "CT Chest / CTPA", icon: "🔬", color: TEAL, body: "Gold standard for PE (CTPA). HRCT for interstitial disease. CT detects occult pneumothorax, small effusions, mediastinal pathology, lung parenchymal detail." },
    { name: "Echocardiography", icon: "❤️", color: CRIMSON, body: "Differentiates cardiac from non-cardiac pulmonary edema. Assesses LV/RV function, PASP, pericardial effusion, valvular disease. PCWP > 18 = cardiogenic." },
    { name: "Lung Ultrasound (LUS)", icon: "📡", color: "1A6B3A", body: "B-lines → alveolar-interstitial syndrome (pulmonary edema). A-lines → normal lung or pneumothorax. Lung point sign = PTX. Consolidation with air bronchograms = PNA." },
    { name: "Spirometry / PEFR", icon: "💨", color: "C07A00", body: "FEV₁/FVC < 0.7 → obstructive (asthma, COPD). TLC normal/↑ = obstructive. FVC ↓ with normal ratio = restrictive. PEFR < 50% predicted = severe asthma exacerbation." },
    { name: "Bronchoscopy + BAL", icon: "🔍", color: "7B3FA0", body: "Direct visualisation of airways. BAL for culture, cytology, diffuse alveolar haemorrhage (hemosiderin-laden macrophages). Indicated when non-invasive workup is inconclusive." },
  ];

  tools.forEach(({ name, icon, color, body }, idx) => {
    const col = idx % 3, row = Math.floor(idx / 3);
    const bx = 0.35 + col * 3.18, by = 1.05 + row * 2.22;
    const bw = 3.0, bh = 2.12;
    sl.addShape(pres.ShapeType.rect, { x: bx, y: by, w: bw, h: bh, fill: { color: WHITE }, line: { color: LTGRAY, pt: 0.8 } });
    sl.addShape(pres.ShapeType.rect, { x: bx, y: by, w: bw, h: 0.36, fill: { color } });
    sl.addText(`${icon}  ${name}`, { x: bx + 0.05, y: by, w: bw - 0.1, h: 0.36, fontSize: 10, bold: true, color: WHITE, valign: "middle", margin: 2 });
    sl.addText(body, { x: bx + 0.08, y: by + 0.4, w: bw - 0.14, h: bh - 0.46, fontSize: 10.5, color: DARKGRAY, valign: "top", margin: 2, wrap: true });
  });

  // ARDS CXR image
  if (images[0] && !images[0].error) {
    // Replace middle of bottom row with image
    sl.addShape(pres.ShapeType.rect, { x: 6.84, y: 3.27, w: 2.8, h: 2.12, fill: { color: WHITE }, line: { color: LTGRAY, pt: 0.8 } });
    sl.addImage({ data: images[0].base64, x: 6.84, y: 3.27, w: 2.8, h: 2.12 });
  }
}

// ══════════════════════════════════════════════════
// SLIDE 10 — TREATMENT
// ══════════════════════════════════════════════════
{
  const sl = contentSlide("Treatment", "MANAGEMENT");

  const txBlocks = [
    { title: "IMMEDIATE STABILISATION (ABC)", color: CRIMSON, items: [
      "Airway: position, jaw thrust, suction, adjuncts",
      "Breathing: supplemental O₂ (target SpO₂ 94–98%, or 88–92% in COPD)",
      "Circulation: IV access, fluid resuscitation (cautious in ARDS)",
      "Position: head-of-bed 30–45° to reduce aspiration",
      "Continuous monitoring: SpO₂, RR, HR, BP, GCS",
    ]},
    { title: "OXYGEN THERAPY", color: TEAL, items: [
      "Nasal cannula: 2–6 L/min → SpO₂ 90–95%",
      "Simple face mask: 6–10 L/min → ~40–60% FiO₂",
      "Non-rebreather mask: 10–15 L/min → ~60–90% FiO₂",
      "High-flow nasal cannula (HFNC): up to 60 L/min, heated/humidified",
      "Non-invasive ventilation (NIV/BiPAP): AECOPD, cardiogenic edema",
    ]},
    { title: "MECHANICAL VENTILATION (ARDS)", color: NAVY, items: [
      "Lung-protective strategy: TV 4–8 mL/kg predicted body weight",
      "Plateau pressure ≤ 30 cmH₂O",
      "PEEP titrated to oxygenation (ARDSNet table)",
      "PaO₂ target 55–80 mmHg; SpO₂ 88–95%",
      "Permissive hypercapnia: pH 7.30–7.45 tolerated",
      "Prone positioning (>16 h/day) → ↓mortality in severe ARDS (P/F < 150)",
    ]},
    { title: "PHARMACOLOGICAL THERAPY", color: "1A6B3A", items: [
      "Bronchospasm: β₂-agonist (salbutamol), ipratropium, IV Mg²⁺",
      "Cardiac edema: IV furosemide, vasodilators (GTN), inotropes",
      "Infection: empiric antibiotics (CURB-65 guided)",
      "PE: anticoagulation (LMWH/UFH); thrombolytics if haemodynamically unstable",
      "Corticosteroids (ARDS): dexamethasone 6 mg/day improves outcomes",
      "Sepsis: early antibiotics + source control within 1 hour",
    ]},
    { title: "ADVANCED / RESCUE THERAPIES", color: "7B3FA0", items: [
      "Neuromuscular blockade (cisatracurium): moderate-severe ARDS, 48h",
      "Inhaled NO / inhaled prostacyclin: pulmonary vasodilation",
      "Recruitment manoeuvres: sustained inflation to re-open collapsed alveoli",
      "ECMO (veno-venous): refractory ARDS failing all conventional measures",
      "Tracheostomy: prolonged ventilation > 7–10 days anticipated",
    ]},
    { title: "AETIOLOGY-SPECIFIC TREATMENT", color: "C07A00", items: [
      "Foreign body: Heimlich manoeuvre / bronchoscopic retrieval",
      "Anaphylaxis: IM adrenaline 0.5 mg (1:1000) + antihistamine + steroids",
      "Tension PTX: immediate needle decompression → chest tube",
      "Cardiac tamponade: pericardiocentesis",
      "Neuromuscular (MG/GBS): IVIG, plasmapheresis",
      "Neonatal RDS: exogenous surfactant replacement therapy",
    ]},
  ];

  const cw = 3.0, rh = 1.85, sx = 0.35, sy = 1.05;
  txBlocks.forEach(({ title, color, items }, idx) => {
    const col = idx % 3, row = Math.floor(idx / 3);
    const bx = sx + col * (cw + 0.18);
    const by = sy + row * rh;
    sl.addShape(pres.ShapeType.rect, { x: bx, y: by, w: cw, h: rh - 0.1, fill: { color: WHITE }, line: { color: LTGRAY, pt: 0.8 } });
    sl.addShape(pres.ShapeType.rect, { x: bx, y: by, w: cw, h: 0.3, fill: { color } });
    sl.addText(title, { x: bx + 0.05, y: by, w: cw - 0.08, h: 0.3, fontSize: 9, bold: true, color: WHITE, valign: "middle", margin: 2 });
    sl.addText(bullets(items, { fontSize: 10 }), { x: bx + 0.05, y: by + 0.32, w: cw - 0.1, h: rh - 0.44, valign: "top", margin: 2 });
  });
}

// ══════════════════════════════════════════════════
// SLIDE 11 — REAL-LIFE CASES
// ══════════════════════════════════════════════════
{
  const sl = contentSlide("Real-Life Clinical Cases", "CASE STUDIES");

  const cases = [
    {
      num: "01",
      color: CRIMSON,
      title: "Case 1: 68 y/o with ARDS post-Sepsis",
      hx: "68M, DM, HTN. Admitted with 5-day fever, productive cough, confusion. BP 85/50, RR 32, SpO₂ 82% on room air, T 39.1°C.",
      invest: "ABG: pH 7.28, PaO₂ 52, PaCO₂ 38, PaO₂/FiO₂ = 120. CXR: bilateral alveolar infiltrates. Cultures: Klebsiella pneumoniae sepsis.",
      dx: "Sepsis-induced ARDS (moderate — Berlin PaO₂/FiO₂ 120)",
      tx: "ICU admission. Intubation. Lung-protective ventilation (TV 6 mL/kg PBW, PEEP 12, Pplat ≤30). Prone positioning 18 h/day. Piperacillin-tazobactam. Dexamethasone 6 mg/d. Noradrenaline vasopressor. Survived after 12-day ICU course.",
    },
    {
      num: "02",
      color: TEAL,
      title: "Case 2: 45 y/o with Acute Severe Asthma",
      hx: "45F, known asthma, ran out of preventer inhaler. Sudden onset SOB, unable to complete sentences, expiratory wheeze bilaterally, SpO₂ 89%, PEFR 35% predicted.",
      invest: "ABG early: pH 7.48, PaCO₂ 30 (respiratory alkalosis = early). ECG: sinus tachycardia. CXR: hyperinflation, no consolidation.",
      dx: "Acute severe asthma exacerbation (near-fatal features: PEFR < 33%, silent chest = imminent arrest)",
      tx: "Continuous nebulised salbutamol 5 mg. Ipratropium 0.5 mg. IV MgSO₄ 2 g over 20 min. IV hydrocortisone 200 mg. HFNC oxygen. Admitted to HDU; avoided intubation. Stepped down to ward in 48 h with step-up preventer therapy.",
    },
    {
      num: "03",
      color: NAVY,
      title: "Case 3: 72 y/o with Cardiogenic Pulmonary Edema",
      hx: "72M, IHD, non-compliant with diuretics. Orthopnea, PND, bilateral crackles to mid-zones, S3 gallop, JVD, peripheral oedema, SpO₂ 86% on air, HR 110, BP 160/95.",
      invest: "BNP: 2,400 pg/mL. Echo: LVEF 25%, dilated LV, MR. CXR: bilateral pleural effusions, Kerley B lines, cardiomegaly, bat-wing infiltrates. ABG: PaO₂ 58, PaCO₂ 36.",
      dx: "Acute decompensated heart failure / cardiogenic pulmonary edema",
      tx: "IV furosemide 80 mg bolus → 10 mg/h infusion. GTN infusion 0.5–2 mcg/kg/min. BiPAP CPAP 10 cmH₂O (averted intubation). Fluid restriction. Fluid balance -2.5 L by day 2. Initiated sacubitril/valsartan on discharge. SpO₂ 97% on day 3.",
    },
  ];

  const rh = 1.48, sy = 1.05, sw = 9.28;
  cases.forEach(({ num, color, title, hx, invest, dx, tx }, idx) => {
    const by = sy + idx * (rh + 0.06);
    sl.addShape(pres.ShapeType.rect, { x: 0.35, y: by, w: sw, h: rh, fill: { color: WHITE }, line: { color: LTGRAY, pt: 0.8 } });
    // Left badge
    sl.addShape(pres.ShapeType.rect, { x: 0.35, y: by, w: 0.55, h: rh, fill: { color } });
    sl.addText(`CASE\n${num}`, { x: 0.35, y: by, w: 0.55, h: rh, fontSize: 9.5, bold: true, color: WHITE, align: "center", valign: "middle", margin: 0 });
    // Title
    sl.addShape(pres.ShapeType.rect, { x: 0.9, y: by, w: sw - 0.55, h: 0.28, fill: { color: color === CRIMSON ? "FEF0EF" : color === TEAL ? "EBF8FA" : "EEF2F8" } });
    sl.addText(title, { x: 0.95, y: by, w: sw - 0.6, h: 0.28, fontSize: 10.5, bold: true, color, valign: "middle", margin: 2 });
    // Content columns
    const cols = [
      { label: "HX & EXAM", val: hx },
      { label: "INVESTIGATIONS", val: invest },
      { label: "Dx / Tx", val: `Dx: ${dx}\n\nTx: ${tx}` },
    ];
    cols.forEach(({ label, val }, ci) => {
      const cw = (sw - 0.58) / 3;
      const cx = 0.9 + ci * (cw + 0.04);
      sl.addText(label, { x: cx, y: by + 0.3, w: cw, h: 0.22, fontSize: 8.5, bold: true, color, valign: "top", margin: 2 });
      sl.addText(val, { x: cx, y: by + 0.52, w: cw, h: rh - 0.55, fontSize: 9, color: DARKGRAY, valign: "top", margin: 2, wrap: true });
    });
  });

  // ARDS CXR image beside cases (bottom right)
  if (images[1] && !images[1].error) {
    // Just add a visual note since space is tight
  }
}

// ══════════════════════════════════════════════════
// SLIDE 12 — CXR IMAGING SLIDE
// ══════════════════════════════════════════════════
{
  const sl = contentSlide("Radiological Evidence — ARDS on CXR", "IMAGING");

  sl.addText("Classic ARDS Chest X-Ray Appearances", { x: 0.35, y: 1.08, w: 9.3, h: 0.3, fontSize: 13, bold: true, color: NAVY, margin: 0 });

  const imgSlots = [images[0], images[1], images[3]];
  const captions = [
    "Bilateral diffuse opacities — ARDS in ICU patient on mechanical ventilation (endotracheal tube visible)",
    "ARDS before/after CENPV treatment — progressive bilateral alveolar infiltrates and resolution",
    "Classic ARDS pattern: bilateral patchy alveolar opacities, Berlin definition — non-cardiogenic pulmonary edema",
  ];

  imgSlots.forEach((img, i) => {
    const bx = 0.35 + i * 3.2;
    if (img && !img.error) {
      sl.addImage({ data: img.base64, x: bx, y: 1.45, w: 3.05, h: 2.2 });
    } else {
      sl.addShape(pres.ShapeType.rect, { x: bx, y: 1.45, w: 3.05, h: 2.2, fill: { color: LTGRAY } });
      sl.addText("Image unavailable", { x: bx, y: 1.45, w: 3.05, h: 2.2, fontSize: 10, color: DARKGRAY, align: "center", valign: "middle" });
    }
    sl.addShape(pres.ShapeType.rect, { x: bx, y: 3.68, w: 3.05, h: 0.54, fill: { color: "F0F5FF" }, line: { color: LTGRAY, pt: 0.5 } });
    sl.addText(captions[i], { x: bx + 0.04, y: 3.7, w: 2.97, h: 0.5, fontSize: 8.5, italic: true, color: "556677", valign: "middle", margin: 2 });
  });

  // Key radiological findings
  sl.addShape(pres.ShapeType.rect, { x: 0.35, y: 4.3, w: 9.28, h: 0.28, fill: { color: NAVY } });
  sl.addText("KEY RADIOLOGICAL FINDINGS IN ARDS", { x: 0.35, y: 4.3, w: 9.28, h: 0.28, fontSize: 10.5, bold: true, color: WHITE, align: "center", valign: "middle", margin: 0 });
  sl.addText([
    { text: "Bilateral opacities  ", options: { bold: true, color: CRIMSON } },
    { text: "not fully explained by effusions or collapse  |  ", options: { color: DARKGRAY } },
    { text: "Normal cardiac size  ", options: { bold: true, color: TEAL } },
    { text: "(unlike cardiogenic edema)  |  ", options: { color: DARKGRAY } },
    { text: "Air bronchograms  ", options: { bold: true, color: NAVY } },
    { text: "visible in consolidation  |  ", options: { color: DARKGRAY } },
    { text: "Ground-glass opacities  ", options: { bold: true, color: "7B3FA0" } },
    { text: "= early diffuse alveolar damage", options: { color: DARKGRAY } },
  ], { x: 0.38, y: 4.6, w: 9.22, h: 0.75, fontSize: 10, valign: "middle", margin: 4 });
}

// ══════════════════════════════════════════════════
// SLIDE 13 — KEY TAKEAWAYS / SUMMARY
// ══════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: NAVY } });
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.18, h: 5.625, fill: { color: CRIMSON } });
  sl.addShape(pres.ShapeType.rect, { x: 0, y: 3.5, w: 10, h: 0.08, fill: { color: CRIMSON } });

  sl.addText("KEY TAKEAWAYS", { x: 0.35, y: 0.15, w: 9.3, h: 0.58, fontSize: 26, bold: true, color: WHITE, charSpacing: 2 });
  sl.addText("What every medical intern must remember about Respiratory Distress", { x: 0.35, y: 0.72, w: 9.3, h: 0.3, fontSize: 13, italic: true, color: LTGRAY });

  const takeaways = [
    ["01", "Respiratory distress is a CLINICAL diagnosis — act on clinical signs, don't wait for labs.", CRIMSON],
    ["02", "The 5-second ARDS Berlin criteria: <1 week onset | bilateral opacities | non-cardiogenic | P/F ≤300.", TEAL],
    ["03", "Lung-protective ventilation (4–8 mL/kg PBW, Pplat ≤30) saves lives in ARDS.", "1A6B3A"],
    ["04", "Prone positioning >16 h/day reduces ARDS mortality in severe disease (P/F <150).", "C07A00"],
    ["05", "Always differentiate cardiac from non-cardiac pulmonary edema — treatment is opposite!", "7B3FA0"],
    ["06", "Tension pneumothorax → clinical diagnosis → immediate needle decompression — never wait for CXR.", CRIMSON],
    ["07", "In sepsis-induced ARDS: early antibiotics + source control within 1 hour of recognition.", TEAL],
  ];

  takeaways.forEach(([num, text, color], i) => {
    const by = 1.12 + i * 0.33;
    sl.addShape(pres.ShapeType.rect, { x: 0.35, y: by, w: 9.28, h: 0.28, fill: { color: "0A2035" }, line: { color: color, pt: 0.8 } });
    sl.addShape(pres.ShapeType.rect, { x: 0.35, y: by, w: 0.38, h: 0.28, fill: { color } });
    sl.addText(num, { x: 0.35, y: by, w: 0.38, h: 0.28, fontSize: 9.5, bold: true, color: WHITE, align: "center", valign: "middle", margin: 0 });
    sl.addText(text, { x: 0.78, y: by, w: 8.8, h: 0.28, fontSize: 11, color: WHITE, valign: "middle", margin: 4 });
  });

  sl.addText("Sources: Tintinalli's Emergency Medicine · Current Surgical Therapy 14e · Murray & Nadel's Textbook of Respiratory Medicine", {
    x: 0.35, y: 5.1, w: 9.28, h: 0.3,
    fontSize: 8, color: "8BAACC", italic: true
  });
}

// ══════════════════════════════════════════════════
// WRITE FILE
// ══════════════════════════════════════════════════
const outPath = "/home/daytona/workspace/respiratory-distress-ppt/Respiratory_Distress_Medical_Intern.pptx";
pres.writeFile({ fileName: outPath }).then(() => {
  console.log("✅ Presentation saved to:", outPath);
}).catch(err => {
  console.error("❌ Error saving:", err);
  process.exit(1);
});
Running Command

cd /home/daytona/workspace/respiratory-distress-ppt && node build.js 2>&1

Your credits are exhausted. Your daily credits reset tomorrow, or you can purchase a top-up for more.
This is a shared conversation. Sign in to Orris to start your own chat.