Cardiac failure and its management and make ppt

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

ls /home/daytona/workspace/ 2>/dev/null && mkdir -p /home/daytona/workspace/cardiac-failure-ppt

Writing File

~/cardiac-failure-ppt/cardiac_failure.js

const pptxgen = require("pptxgenjs");

const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Cardiac Failure and Its Management";
pres.author = "Medical Education";

// ─── Color Palette ────────────────────────────────────────────────
const DARK_BG   = "0D1B2A";   // deep navy
const MID_BG    = "1B2A3B";   // medium navy
const ACCENT    = "E63946";   // vivid red
const ACCENT2   = "457B9D";   // muted blue
const WHITE     = "FFFFFF";
const LIGHT_TXT = "A8DADC";   // cool mint
const YELLOW    = "F4D35E";   // warm highlight
const GREY_BG   = "1F2F42";   // card background
const LIGHT_BG  = "EBF4FA";   // light slide bg
const DARK_TXT  = "1B2A3B";

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

function addAccentBar(slide, color = ACCENT) {
  slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.12, h: "100%", fill: { color } });
}

function slideTitle(slide, txt, color = WHITE) {
  slide.addText(txt, {
    x: 0.3, y: 0.18, w: 9.4, h: 0.65,
    fontSize: 28, bold: true, color, fontFace: "Calibri", margin: 0
  });
  slide.addShape(pres.ShapeType.line, {
    x: 0.3, y: 0.88, w: 9.4, h: 0,
    line: { color: ACCENT, width: 2.5 }
  });
}

function card(slide, x, y, w, h, bg = GREY_BG) {
  slide.addShape(pres.ShapeType.roundRect, {
    x, y, w, h, rectRadius: 0.08,
    fill: { color: bg }, line: { color: ACCENT2, width: 1 }
  });
}

function bulletList(slide, items, x, y, w, h, opts = {}) {
  const textItems = items.map((t, i) => ({
    text: t,
    options: { bullet: { indent: 10 }, breakLine: i < items.length - 1, fontSize: opts.fontSize || 13.5, color: opts.color || WHITE, fontFace: "Calibri" }
  }));
  slide.addText(textItems, { x, y, w, h, valign: "top", ...opts });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBackground(s, DARK_BG);

  // Red diagonal stripe top-right
  s.addShape(pres.ShapeType.rect, { x: 7, y: 0, w: 3, h: 5.625, fill: { color: ACCENT }, rotate: 0, transparency: 85 });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 4.8, w: 10, h: 0.825, fill: { color: MID_BG } });

  s.addText("CARDIAC FAILURE", {
    x: 0.5, y: 1.2, w: 9, h: 0.85,
    fontSize: 46, bold: true, color: WHITE, fontFace: "Calibri", align: "center", charSpacing: 4
  });
  s.addText("AND ITS MANAGEMENT", {
    x: 0.5, y: 2.1, w: 9, h: 0.65,
    fontSize: 26, bold: false, color: LIGHT_TXT, fontFace: "Calibri", align: "center", charSpacing: 2
  });

  // Divider
  s.addShape(pres.ShapeType.rect, { x: 3.5, y: 2.85, w: 3, h: 0.06, fill: { color: ACCENT } });

  s.addText("A Comprehensive Clinical Overview", {
    x: 0.5, y: 3.05, w: 9, h: 0.4,
    fontSize: 15, color: YELLOW, fontFace: "Calibri", align: "center", italic: true
  });

  // Bottom strip
  s.addText("Sources: Braunwald's Heart Disease | Harrison's Principles | Textbook of Family Medicine", {
    x: 0.3, y: 4.88, w: 9.4, h: 0.3,
    fontSize: 9, color: LIGHT_TXT, fontFace: "Calibri", align: "right"
  });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 2 — OUTLINE
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBackground(s, DARK_BG);
  addAccentBar(s);
  slideTitle(s, "Table of Contents");

  const topics = [
    ["01", "Definition & Overview"],
    ["02", "Classification (HFrEF / HFpEF / HFmrEF)"],
    ["03", "Epidemiology"],
    ["04", "Etiology & Risk Factors"],
    ["05", "Pathophysiology"],
    ["06", "Clinical Features & Diagnosis"],
    ["07", "Investigations"],
    ["08", "Pharmacological Management"],
    ["09", "Non-Pharmacological & Device Therapy"],
    ["10", "Acute Decompensated Heart Failure"],
  ];

  topics.forEach(([num, title], i) => {
    const col = i < 5 ? 0 : 1;
    const row = i % 5;
    const x = col === 0 ? 0.5 : 5.3;
    const y = 1.1 + row * 0.8;
    card(s, x, y, 4.6, 0.65, GREY_BG);
    s.addText(num, { x: x + 0.1, y: y + 0.08, w: 0.55, h: 0.48, fontSize: 18, bold: true, color: ACCENT, fontFace: "Calibri", align: "center" });
    s.addText(title, { x: x + 0.7, y: y + 0.1, w: 3.8, h: 0.45, fontSize: 13, color: WHITE, fontFace: "Calibri", valign: "middle" });
  });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 3 — DEFINITION
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBackground(s, DARK_BG);
  addAccentBar(s);
  slideTitle(s, "Definition & Overview");

  // Big quote box
  card(s, 0.5, 1.05, 9, 1.5, MID_BG);
  s.addText('"Heart failure is a clinical syndrome resulting from the inability of the heart to meet the metabolic requirements of the body at normal filling pressures."', {
    x: 0.65, y: 1.12, w: 8.7, h: 1.35,
    fontSize: 14.5, italic: true, color: YELLOW, fontFace: "Calibri", valign: "middle", align: "center"
  });

  const points = [
    "HF can arise from LV systolic or diastolic dysfunction",
    "HFpEF (preserved EF >45-50%): impaired LV filling/relaxation",
    "HFrEF (reduced EF <40%): reduced LV contraction",
    "Fluid retention & pulmonary congestion are hallmarks — but may be absent",
    "Term 'heart failure' is preferred over 'congestive heart failure'",
    "Mortality ~50% within 5 years of diagnosis"
  ];
  bulletList(s, points, 0.5, 2.75, 9, 2.6, { fontSize: 13.5 });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 4 — CLASSIFICATION
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBackground(s, DARK_BG);
  addAccentBar(s);
  slideTitle(s, "Classification of Heart Failure");

  const categories = [
    {
      label: "HFrEF",
      sub: "Reduced EF",
      ef: "EF < 40%",
      color: ACCENT,
      points: ["Dilated cardiomyopathy", "Post-MI remodeling", "Volume overload", "Best-studied group", "Responds to neurohormonal blockade"]
    },
    {
      label: "HFmrEF",
      sub: "Mildly Reduced EF",
      ef: "EF 40–49%",
      color: YELLOW,
      points: ["Intermediate phenotype", "Often ischemic etiology", "Emerging evidence for", "same treatments as HFrEF", ""]
    },
    {
      label: "HFpEF",
      sub: "Preserved EF",
      ef: "EF ≥ 50%",
      color: ACCENT2,
      points: ["Hypertension-related", "Elderly / obese", "Impaired relaxation", "Tx targets comorbidities", "SGLT2i showing benefit"]
    }
  ];

  categories.forEach((c, i) => {
    const x = 0.4 + i * 3.2;
    card(s, x, 1.05, 3.0, 4.25, GREY_BG);
    s.addShape(pres.ShapeType.rect, { x, y: 1.05, w: 3.0, h: 0.55, fill: { color: c.color } });
    s.addText(c.label, { x, y: 1.05, w: 3.0, h: 0.55, fontSize: 20, bold: true, color: WHITE, align: "center", valign: "middle", fontFace: "Calibri" });
    s.addText(c.sub, { x, y: 1.62, w: 3.0, h: 0.35, fontSize: 11, color: LIGHT_TXT, align: "center", fontFace: "Calibri" });
    s.addShape(pres.ShapeType.roundRect, { x: x + 0.6, y: 2.0, w: 1.8, h: 0.38, rectRadius: 0.05, fill: { color: c.color }, transparency: 25 });
    s.addText(c.ef, { x: x + 0.6, y: 2.0, w: 1.8, h: 0.38, fontSize: 12, bold: true, color: WHITE, align: "center", valign: "middle", fontFace: "Calibri" });
    c.points.forEach((pt, j) => {
      if (pt) s.addText("• " + pt, { x: x + 0.1, y: 2.5 + j * 0.38, w: 2.8, h: 0.36, fontSize: 11, color: WHITE, fontFace: "Calibri" });
    });
  });

  // Bottom: NYHA
  card(s, 0.4, 5.1, 9.2, 0.38, MID_BG);
  s.addText("NYHA Class: I (No symptoms) → II (Mild) → III (Moderate) → IV (Severe at rest)", {
    x: 0.5, y: 5.13, w: 9, h: 0.32, fontSize: 12, color: YELLOW, fontFace: "Calibri", align: "center"
  });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 5 — EPIDEMIOLOGY
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBackground(s, DARK_BG);
  addAccentBar(s);
  slideTitle(s, "Epidemiology");

  const stats = [
    { icon: "64M+", label: "People affected\nworldwide" },
    { icon: "650K", label: "New cases per year\n(United States)" },
    { icon: "300K", label: "Deaths per year\n(United States)" },
    { icon: "50%", label: "5-year mortality\nrate" },
    { icon: "25%", label: "1-month re-\nhospitalization rate" },
  ];

  stats.forEach((st, i) => {
    const x = 0.4 + i * 1.88;
    card(s, x, 1.1, 1.7, 2.2, MID_BG);
    s.addShape(pres.ShapeType.rect, { x, y: 1.1, w: 1.7, h: 0.08, fill: { color: ACCENT } });
    s.addText(st.icon, { x, y: 1.25, w: 1.7, h: 0.8, fontSize: 22, bold: true, color: YELLOW, align: "center", fontFace: "Calibri" });
    s.addText(st.label, { x, y: 2.08, w: 1.7, h: 1.05, fontSize: 11, color: LIGHT_TXT, align: "center", fontFace: "Calibri" });
  });

  s.addText("Risk Factors", { x: 0.4, y: 3.55, w: 9.2, h: 0.38, fontSize: 16, bold: true, color: WHITE, fontFace: "Calibri" });
  const riskCols = [
    ["Coronary Artery Disease", "Hypertension", "Diabetes Mellitus", "Obesity"],
    ["Valvular Heart Disease", "Cardiomyopathies", "Congenital Heart Defects", "Alcohol / Drug Abuse"],
    ["Atrial Fibrillation", "Renal Failure", "Thyroid Disorders", "Sleep-Disordered Breathing"]
  ];
  riskCols.forEach((col, i) => {
    card(s, 0.4 + i * 3.2, 3.95, 3.0, 1.5, GREY_BG);
    bulletList(s, col, 0.5 + i * 3.2, 3.98, 2.85, 1.45, { fontSize: 11.5 });
  });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 6 — PATHOPHYSIOLOGY
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBackground(s, DARK_BG);
  addAccentBar(s);
  slideTitle(s, "Pathophysiology");

  // Central flow diagram
  const steps = [
    { label: "Precipitating Injury", sub: "CAD, MI, HTN, valvular disease,\nanemia, cardiomyopathy", x: 3.4, y: 1.05, color: ACCENT },
    { label: "LV Remodeling", sub: "Stretching, dilation,\nreduced LV function", x: 3.4, y: 2.1, color: ACCENT2 },
    { label: "Neurohormonal Activation", sub: "RAAS, SNS, Endothelin-1,\nInflammatory cytokines", x: 3.4, y: 3.15, color: "7B2D8B" },
    { label: "Adverse Cardiac Effects", sub: "Apoptosis, fibrosis, hypertrophy,\narrhythmias, further dysfunction", x: 3.4, y: 4.2, color: ACCENT },
  ];

  steps.forEach((st, i) => {
    card(s, st.x, st.y, 3.2, 0.85, GREY_BG);
    s.addShape(pres.ShapeType.rect, { x: st.x, y: st.y, w: 0.08, h: 0.85, fill: { color: st.color } });
    s.addText(st.label, { x: st.x + 0.18, y: st.y + 0.04, w: 3.0, h: 0.35, fontSize: 13, bold: true, color: WHITE, fontFace: "Calibri" });
    s.addText(st.sub, { x: st.x + 0.18, y: st.y + 0.38, w: 3.0, h: 0.45, fontSize: 10, color: LIGHT_TXT, fontFace: "Calibri" });
    if (i < 3) {
      s.addShape(pres.ShapeType.line, { x: 5, y: st.y + 0.85, w: 0, h: 0.22, line: { color: ACCENT, width: 2 } });
    }
  });

  // Right panel: key mediators
  card(s, 7.0, 1.05, 2.7, 4.0, MID_BG);
  s.addText("Key Mediators", { x: 7.05, y: 1.1, w: 2.6, h: 0.35, fontSize: 13, bold: true, color: YELLOW, fontFace: "Calibri" });
  const mediators = [
    "Angiotensin II: apoptosis, hypertrophy, fibrosis",
    "Aldosterone: sodium retention, fibrosis",
    "Catecholamines: receptor downregulation, toxicity",
    "MMP / TIMMP: cardiac fibrosis, collagen deposition",
    "BNP / NT-proBNP: released due to wall stress",
    "Endothelin-1: vasoconstriction"
  ];
  mediators.forEach((m, i) => {
    s.addText("• " + m, { x: 7.1, y: 1.5 + i * 0.55, w: 2.55, h: 0.5, fontSize: 10.5, color: WHITE, fontFace: "Calibri" });
  });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 7 — CLINICAL FEATURES
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBackground(s, DARK_BG);
  addAccentBar(s);
  slideTitle(s, "Clinical Features & Diagnosis");

  const sections = [
    {
      title: "Symptoms", color: ACCENT, x: 0.35, items: [
        "Dyspnea on exertion", "Orthopnoea", "Paroxysmal nocturnal dyspnea", "Fatigue & exercise intolerance",
        "Ankle swelling", "Nocturia", "Anorexia / nausea", "Palpitations"
      ]
    },
    {
      title: "Signs", color: ACCENT2, x: 3.55, items: [
        "Tachycardia, tachypnoea", "Raised JVP", "S3 gallop rhythm", "Displaced apex beat",
        "Pitting oedema", "Pulmonary crackles", "Pleural effusion", "Hepatomegaly / ascites"
      ]
    },
    {
      title: "Diagnostic Criteria\n(Framingham)", color: "2E8B57", x: 6.75, items: [
        "Major: PND, raised JVP, S3, cardiomegaly", "Major: Pulmonary oedema, HJR+", "Minor: Bilateral ankle oedema",
        "Minor: Nocturnal cough", "Minor: Dyspnoea on exertion", "2 major OR 1 major + 2 minor", "to diagnose HF", ""
      ]
    }
  ];

  sections.forEach((sec) => {
    card(s, sec.x, 1.05, 3.05, 4.4, GREY_BG);
    s.addShape(pres.ShapeType.rect, { x: sec.x, y: 1.05, w: 3.05, h: 0.5, fill: { color: sec.color } });
    s.addText(sec.title, { x: sec.x + 0.05, y: 1.05, w: 2.95, h: 0.5, fontSize: 14, bold: true, color: WHITE, align: "center", valign: "middle", fontFace: "Calibri" });
    sec.items.forEach((item, j) => {
      if (item) s.addText("• " + item, { x: sec.x + 0.1, y: 1.65 + j * 0.44, w: 2.85, h: 0.42, fontSize: 11, color: WHITE, fontFace: "Calibri" });
    });
  });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 8 — INVESTIGATIONS
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBackground(s, DARK_BG);
  addAccentBar(s);
  slideTitle(s, "Investigations");

  const groups = [
    {
      title: "Biomarkers", color: ACCENT, items: [
        "BNP >100 pg/mL: suggests HF",
        "NT-proBNP >300 pg/mL: acute HF",
        "Troponin I/T: myocardial injury",
        "Na, K, Cr, eGFR (renal monitoring)",
        "LFTs (hepatic congestion)",
        "TFTs, FBC, HbA1c, Lipids"
      ]
    },
    {
      title: "ECG", color: ACCENT2, items: [
        "LVH pattern",
        "LBBB (CRT candidacy)",
        "Atrial fibrillation",
        "Q waves (prior MI)",
        "ST-T wave changes",
        "QT prolongation"
      ]
    },
    {
      title: "Echocardiography", color: YELLOW, items: [
        "EF measurement (key!)",
        "LV size & wall motion",
        "Diastolic function (E/A, E/e')",
        "Valvular abnormalities",
        "Pericardial effusion",
        "RV function (TAPSE)"
      ]
    },
    {
      title: "Imaging", color: "2E8B57", items: [
        "CXR: cardiomegaly, pulm oedema,\n  Kerley B lines, pleural effusion",
        "MRI: gold standard for structure/function",
        "CTCA: coronary anatomy",
        "Nuclear imaging: viability"
      ]
    }
  ];

  groups.forEach((g, i) => {
    const col = i % 2;
    const row = Math.floor(i / 2);
    const x = 0.35 + col * 4.95;
    const y = 1.05 + row * 2.3;
    card(s, x, y, 4.7, 2.15, GREY_BG);
    s.addShape(pres.ShapeType.rect, { x, y, w: 4.7, h: 0.42, fill: { color: g.color } });
    s.addText(g.title, { x, y, w: 4.7, h: 0.42, fontSize: 14, bold: true, color: WHITE, align: "center", valign: "middle", fontFace: "Calibri" });
    g.items.forEach((item, j) => {
      s.addText("• " + item, { x: x + 0.1, y: y + 0.48 + j * 0.28, w: 4.5, h: 0.28, fontSize: 10.5, color: WHITE, fontFace: "Calibri" });
    });
  });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 9 — PHARMACOLOGICAL MANAGEMENT
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBackground(s, DARK_BG);
  addAccentBar(s);
  slideTitle(s, "Pharmacological Management — HFrEF");

  // Header
  card(s, 0.35, 1.05, 9.3, 0.42, MID_BG);
  s.addText("Guideline-Directed Medical Therapy (GDMT) — The Four Pillars", {
    x: 0.4, y: 1.08, w: 9.2, h: 0.36, fontSize: 13, bold: true, color: YELLOW, align: "center", fontFace: "Calibri"
  });

  const drugs = [
    {
      class: "ACE Inhibitors / ARBs / ARNI",
      color: ACCENT,
      mechanism: "Block RAAS → reduce preload/afterload, reverse remodeling",
      examples: "Enalapril 2.5-20mg BD | Lisinopril 5-40mg OD\nValsartan/Sacubitril (ARNI): 24/26 - 97/103mg BD",
      trial: "CONSENSUS: 40% mortality reduction\nSOLVD, PARADIGM-HF trials"
    },
    {
      class: "Beta-Blockers",
      color: ACCENT2,
      mechanism: "Block SNS activation → reduce HR, BP, reverse remodeling",
      examples: "Carvedilol 3.125-25mg BD\nMetoprolol succinate 12.5-200mg OD\nBisoprolol 1.25-10mg OD",
      trial: "COPERNICUS: 35% mortality reduction\nMERIT-HF, CIBIS-II trials"
    },
    {
      class: "MRA (Aldosterone Antagonists)",
      color: "2E8B57",
      mechanism: "Block aldosterone → reduce fibrosis, K+ retention, diuresis",
      examples: "Spironolactone 12.5-50mg OD\nEplerenone 25-50mg OD",
      trial: "RALES: 30% mortality reduction\nEPHESUS (post-MI), EMPHASIS-HF"
    },
    {
      class: "SGLT2 Inhibitors",
      color: YELLOW,
      mechanism: "Reduce hospitalisation, improve outcomes (all EF types)",
      examples: "Dapagliflozin 10mg OD\nEmpagliflozin 10mg OD",
      trial: "DAPA-HF, EMPEROR-Reduced:\n~25% reduction in HF hospitalisation"
    }
  ];

  drugs.forEach((d, i) => {
    const col = i % 2;
    const row = Math.floor(i / 2);
    const x = 0.35 + col * 4.85;
    const y = 1.6 + row * 2.05;
    card(s, x, y, 4.6, 1.9, GREY_BG);
    s.addShape(pres.ShapeType.rect, { x, y, w: 4.6, h: 0.38, fill: { color: d.color } });
    s.addText(d.class, { x, y, w: 4.6, h: 0.38, fontSize: 12.5, bold: true, color: d.color === YELLOW ? DARK_TXT : WHITE, align: "center", valign: "middle", fontFace: "Calibri" });
    s.addText("MOA: " + d.mechanism, { x: x + 0.1, y: y + 0.42, w: 4.4, h: 0.38, fontSize: 9.5, color: LIGHT_TXT, fontFace: "Calibri" });
    s.addText("Drugs: " + d.examples, { x: x + 0.1, y: y + 0.78, w: 4.4, h: 0.56, fontSize: 9.5, color: WHITE, fontFace: "Calibri" });
    s.addText("Evidence: " + d.trial, { x: x + 0.1, y: y + 1.36, w: 4.4, h: 0.48, fontSize: 9, color: YELLOW, fontFace: "Calibri", italic: true });
  });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 10 — OTHER DRUGS
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBackground(s, DARK_BG);
  addAccentBar(s);
  slideTitle(s, "Additional Pharmacological Agents");

  const rows = [
    ["Diuretics\n(Loop / Thiazide)", "Symptom relief: reduce fluid overload\nFurosemide 20-80mg IV/PO; Bumetanide 0.5-2mg OD\nSpironolactone as K-sparing agent\nDoes NOT improve mortality — symptom benefit only", ACCENT],
    ["Digoxin", "Positive inotrope & vagotonic\n0.125-0.25mg OD (check levels)\nBenefit: reduced HF hospitalisation (DIG trial)\nUse: AF with HF, refractory HFrEF", ACCENT2],
    ["Hydralazine +\nIsosorbide Dinitrate", "Alternative if ACE-i / ARB not tolerated\nReduces preload and afterload\nA-HeFT trial: 43% mortality reduction in Black patients\nHydralazine 25-50mg TID + ISDN 20-40mg TID", "2E8B57"],
    ["Ivabradine", "If-channel blocker — reduces HR without inotropy\n5-7.5mg BD | Use if HR >70 in sinus rhythm on max BB\nSHIFT trial: reduced HF hospitalisation\nContraindicated in AF", YELLOW],
    ["Vericiguat\nOmecamtiv mecarbil", "Soluble guanylate cyclase stimulator (Vericiguat)\nMyosin activator (Omecamtiv mecarbil)\nFor worsening HFrEF; newer agents (2020-2021)\nVICTORIA, GALACTIC-HF trials", "7B2D8B"],
  ];

  rows.forEach((r, i) => {
    const y = 1.1 + i * 0.9;
    card(s, 0.35, y, 9.3, 0.82, GREY_BG);
    s.addShape(pres.ShapeType.rect, { x: 0.35, y, w: 2.2, h: 0.82, fill: { color: r[2], transparency: 15 } });
    s.addText(r[0], { x: 0.4, y, w: 2.1, h: 0.82, fontSize: 12, bold: true, color: WHITE, align: "center", valign: "middle", fontFace: "Calibri" });
    s.addText(r[1], { x: 2.65, y: y + 0.05, w: 6.9, h: 0.73, fontSize: 10.5, color: WHITE, fontFace: "Calibri", valign: "middle" });
  });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 11 — NON-PHARM & DEVICE THERAPY
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBackground(s, DARK_BG);
  addAccentBar(s);
  slideTitle(s, "Non-Pharmacological & Device Therapy");

  // Left: lifestyle
  card(s, 0.35, 1.1, 4.5, 4.3, GREY_BG);
  s.addShape(pres.ShapeType.rect, { x: 0.35, y: 1.1, w: 4.5, h: 0.45, fill: { color: ACCENT2 } });
  s.addText("Lifestyle & Non-Pharmacological", { x: 0.4, y: 1.1, w: 4.4, h: 0.45, fontSize: 13, bold: true, color: WHITE, align: "center", valign: "middle", fontFace: "Calibri" });
  const lifestyle = [
    "Fluid restriction: ~1.5-2 L/day",
    "Sodium restriction: <2g/day",
    "Daily weight monitoring (alert if >2kg in 2 days)",
    "Cardiac rehabilitation program",
    "Regular moderate aerobic exercise (NYHA I-III)",
    "Smoking cessation & alcohol avoidance",
    "Vaccination: influenza & pneumococcal",
    "Sleep-disordered breathing: CPAP if OSA",
    "Patient education & self-management plans",
  ];
  lifestyle.forEach((item, i) => {
    s.addText("• " + item, { x: 0.45, y: 1.65 + i * 0.41, w: 4.3, h: 0.38, fontSize: 11, color: WHITE, fontFace: "Calibri" });
  });

  // Right: devices
  card(s, 5.15, 1.1, 4.5, 4.3, GREY_BG);
  s.addShape(pres.ShapeType.rect, { x: 5.15, y: 1.1, w: 4.5, h: 0.45, fill: { color: ACCENT } });
  s.addText("Device Therapy", { x: 5.2, y: 1.1, w: 4.4, h: 0.45, fontSize: 13, bold: true, color: WHITE, align: "center", valign: "middle", fontFace: "Calibri" });

  const devices = [
    { name: "ICD", detail: "EF <35%, NYHA II-III on optimal therapy\nPrimary prevention of sudden cardiac death\nMUST trial confirmed benefit" },
    { name: "CRT-P/D", detail: "EF <35%, LBBB, QRS >120-150ms\nResynchronizes ventricular contraction\nMARIT-CRT, RAFT, CARE-HF trials" },
    { name: "LVAD", detail: "Advanced HF (NYHA IV) as bridge-to-transplant\nor destination therapy\nHEARTMATE II/3 trials" },
    { name: "Heart\nTransplant", detail: "End-stage HF, refractory to all therapy\n1-year survival ~85%, 5-year ~70%\nCareful patient selection essential" }
  ];

  devices.forEach((d, i) => {
    const y = 1.65 + i * 0.88;
    card(s, 5.2, y, 4.35, 0.78, MID_BG);
    s.addShape(pres.ShapeType.rect, { x: 5.2, y, w: 0.9, h: 0.78, fill: { color: YELLOW, transparency: 20 } });
    s.addText(d.name, { x: 5.2, y, w: 0.9, h: 0.78, fontSize: 12, bold: true, color: DARK_TXT, align: "center", valign: "middle", fontFace: "Calibri" });
    s.addText(d.detail, { x: 6.15, y: y + 0.04, w: 3.32, h: 0.7, fontSize: 9.5, color: WHITE, fontFace: "Calibri" });
  });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 12 — ACUTE DECOMPENSATED HF
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBackground(s, DARK_BG);
  addAccentBar(s);
  slideTitle(s, "Acute Decompensated Heart Failure (ADHF)");

  // Triggers
  card(s, 0.35, 1.1, 9.3, 0.88, MID_BG);
  s.addText("Common Precipitants: ", { x: 0.45, y: 1.12, w: 1.8, h: 0.35, fontSize: 11, bold: true, color: YELLOW, fontFace: "Calibri" });
  s.addText("Non-compliance with medications / diet   |   Infection / sepsis   |   New arrhythmia (AF)   |   ACS / MI   |   Hypertensive emergency   |   Anaemia   |   PE", {
    x: 0.45, y: 1.45, w: 9.1, h: 0.48, fontSize: 10.5, color: WHITE, fontFace: "Calibri"
  });

  // Management steps
  s.addText("ACUTE MANAGEMENT — MEMORIZE", { x: 0.35, y: 2.12, w: 9.3, h: 0.35, fontSize: 12, bold: true, color: ACCENT, fontFace: "Calibri" });

  const steps = [
    { num: "A", label: "Airway & Oxygen", detail: "Supplemental O2 / CPAP / BiPAP if SpO2 <90%\nIntubation if severe respiratory failure" },
    { num: "B", label: "IV Diuretics", detail: "IV Furosemide 40-80mg bolus (or drip)\nRelieve pulmonary oedema — monitor urine output" },
    { num: "C", label: "Vasodilators", detail: "IV GTN (if BP allows) — reduce preload & afterload\nSodium nitroprusside for hypertensive ADHF" },
    { num: "D", label: "Inotropes", detail: "Dobutamine / Milrinone — cardiogenic shock\nLevosimendan: Ca sensitizer, preferred in some guidelines" },
    { num: "E", label: "Treat Cause", detail: "Revascularisation if ACS\nRate control if AF; anticoagulation if thrombus\nCorrecting anaemia, infection, etc." },
  ];

  steps.forEach((st, i) => {
    const col = i < 3 ? 0 : 1;
    const row = i < 3 ? i : i - 3;
    const x = 0.35 + col * 5.0;
    const y = 2.58 + row * 1.0;
    card(s, x, y, 4.7, 0.88, GREY_BG);
    s.addShape(pres.ShapeType.roundRect, { x, y: y + 0.1, w: 0.52, h: 0.68, rectRadius: 0.06, fill: { color: ACCENT } });
    s.addText(st.num, { x, y: y + 0.1, w: 0.52, h: 0.68, fontSize: 17, bold: true, color: WHITE, align: "center", valign: "middle", fontFace: "Calibri" });
    s.addText(st.label, { x: x + 0.58, y: y + 0.06, w: 4.05, h: 0.3, fontSize: 11.5, bold: true, color: YELLOW, fontFace: "Calibri" });
    s.addText(st.detail, { x: x + 0.58, y: y + 0.36, w: 4.05, h: 0.48, fontSize: 9.5, color: WHITE, fontFace: "Calibri" });
  });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 13 — PROGNOSIS & MONITORING
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBackground(s, DARK_BG);
  addAccentBar(s);
  slideTitle(s, "Prognosis, Monitoring & Follow-up");

  const cols = [
    {
      title: "Prognostic Factors",
      color: ACCENT,
      items: [
        "LVEF < 20%: very poor prognosis",
        "NYHA Class IV: 50% 1-year mortality",
        "Elevated BNP / NT-proBNP",
        "Hyponatraemia (Na <130)",
        "Renal impairment (elevated creatinine)",
        "Wide QRS / LBBB on ECG",
        "Frequent HF hospitalizations",
        "Cardiac cachexia (weight loss)"
      ]
    },
    {
      title: "Monitoring Parameters",
      color: ACCENT2,
      items: [
        "Weight: daily — alert if >2kg gain in 2 days",
        "Blood pressure: target <130/80 mmHg",
        "Heart rate: target 50-70 bpm (NYHA II-III)",
        "Electrolytes & renal function (3-6 monthly)",
        "BNP / NT-proBNP: guide titration",
        "Echo: 3-6 months after GDMT optimization",
        "INR if on warfarin",
        "Symptom diary — NYHA class reassessment"
      ]
    },
    {
      title: "When to Refer / Escalate",
      color: YELLOW,
      items: [
        "EF <35%: refer to heart failure specialist",
        "LBBB or QRS >120ms: CRT assessment",
        "Refractory symptoms on max GDMT",
        "Recurrent hospitalizations",
        "Cardiogenic shock / LVAD discussion",
        "Transplant assessment: NYHA IV, <1yr survival",
        "Cardiac surgery: if structural cause",
        "Palliative care if end-stage"
      ]
    }
  ];

  cols.forEach((c, i) => {
    const x = 0.35 + i * 3.2;
    card(s, x, 1.05, 3.0, 4.4, GREY_BG);
    s.addShape(pres.ShapeType.rect, { x, y: 1.05, w: 3.0, h: 0.42, fill: { color: c.color } });
    s.addText(c.title, { x, y: 1.05, w: 3.0, h: 0.42, fontSize: 12.5, bold: true, color: c.color === YELLOW ? DARK_TXT : WHITE, align: "center", valign: "middle", fontFace: "Calibri" });
    c.items.forEach((item, j) => {
      s.addText("• " + item, { x: x + 0.1, y: 1.54 + j * 0.44, w: 2.82, h: 0.42, fontSize: 10, color: WHITE, fontFace: "Calibri" });
    });
  });
}

// ══════════════════════════════════════════════════════════════════
// SLIDE 14 — SUMMARY
// ══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  addBackground(s, DARK_BG);

  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 1.5, fill: { color: ACCENT } });
  s.addText("KEY TAKEAWAYS", {
    x: 0.3, y: 0.35, w: 9.4, h: 0.8,
    fontSize: 32, bold: true, color: WHITE, align: "center", fontFace: "Calibri", charSpacing: 3
  });

  const takeaways = [
    "HF is defined by inability to meet metabolic demands; classified by EF (HFrEF / HFmrEF / HFpEF)",
    "Pathophysiology centers on LV remodeling driven by RAAS and sympathetic neurohormonal activation",
    "GDMT for HFrEF: Four Pillars — ACEi/ARB/ARNI + Beta-blocker + MRA + SGLT2 inhibitor",
    "BNP / NT-proBNP and Echo are key diagnostic and monitoring tools",
    "ICD for EF <35%; CRT for EF <35% + LBBB; LVAD/Transplant for end-stage disease",
    "ADHF management: oxygen, IV diuretics, vasodilators, inotropes, treat precipitant",
    "Mortality remains ~50% at 5 years — aggressive GDMT and close monitoring improve outcomes"
  ];

  takeaways.forEach((t, i) => {
    card(s, 0.35, 1.65 + i * 0.55, 9.3, 0.5, i % 2 === 0 ? GREY_BG : MID_BG);
    s.addText((i + 1) + ". " + t, { x: 0.5, y: 1.68 + i * 0.55, w: 9.1, h: 0.44, fontSize: 11.5, color: WHITE, fontFace: "Calibri", valign: "middle" });
  });
}

// ══════════════════════════════════════════════════════════════════
// WRITE FILE
// ══════════════════════════════════════════════════════════════════
pres.writeFile({ fileName: "/home/daytona/workspace/cardiac-failure-ppt/Cardiac_Failure_and_Management.pptx" })
  .then(() => console.log("SUCCESS: Cardiac_Failure_and_Management.pptx saved"))
  .catch(err => console.error("ERROR:", err));
Running Command

cd /home/daytona/workspace/cardiac-failure-ppt && node cardiac_failure.js

Your presentation is ready! Here's the download link:

Cardiac Failure and Management

Presentation · PPTX


What's Inside (14 Slides)

The deck uses a deep navy + vivid red + gold color palette with card-based layouts throughout:
#SlideHighlights
1Title SlideBold design with subtitle and source credits
2Table of Contents10 numbered topics with card layout
3Definition & OverviewTextbook definition, HFrEF vs HFpEF, key facts
4ClassificationHFrEF / HFmrEF / HFpEF side-by-side with EF cutoffs + NYHA class bar
5Epidemiology5 stat cards (64M worldwide, 50% 5-yr mortality) + risk factor grid
6PathophysiologyFlowchart: injury → remodeling → neurohormonal → adverse effects + key mediators panel
7Clinical FeaturesSymptoms / Signs / Framingham criteria in 3 columns
8InvestigationsBiomarkers, ECG, Echo, Imaging in 4 cards
9Pharmacological ManagementThe Four GDMT Pillars - ACEi/ARNI, BB, MRA, SGLT2i with trial evidence
10Additional DrugsDiuretics, Digoxin, Hydralazine+ISDN, Ivabradine, Vericiguat
11Device & Non-Pharm TherapyLifestyle measures + ICD/CRT/LVAD/Transplant with indications
12Acute Decompensated HFPrecipitants + A-E management steps
13Prognosis & MonitoringPrognostic factors, monitoring targets, escalation criteria
14Key Takeaways7 concise summary points
Content sourced from Braunwald's Heart Disease, Harrison's Principles of Internal Medicine 22E, and Textbook of Family Medicine.

It is not opened in files

Running Command

ls -lh /home/daytona/workspace/cardiac-failure-ppt/ && file /home/daytona/workspace/cardiac-failure-ppt/Cardiac_Failure_and_Management.pptx

Running Command

cd /home/daytona/workspace/cardiac-failure-ppt && libreoffice --headless --convert-to pdf Cardiac_Failure_and_Management.pptx 2>&1

Running Command

libreoffice --headless --convert-to pdf /home/daytona/workspace/cardiac-failure-ppt/Cardiac_Failure_and_Management.pptx --outdir /home/daytona/workspace/cardiac-failure-ppt/ 2>&1; ls -lh /home/daytona/workspace/cardiac-failure-ppt/

Running Command

libreoffice --headless --convert-to pdf /home/daytona/workspace/cardiac-failure-ppt/Cardiac_Failure_and_Management.pptx --outdir /tmp/ 2>&1 && cp /tmp/Cardiac_Failure_and_Management.pdf /home/daytona/workspace/cardiac-failure-ppt/ && ls -lh /home/daytona/workspace/cardiac-failure-ppt/

Both files are ready. The PDF was successfully generated (187KB). You can download either:
PowerPoint (editable):

Cardiac Failure and Management

Presentation · PPTX

PDF (view immediately in any browser/reader):

Cardiac Failure and Management

PDF Document · PDF

The PDF opens in any browser - just click the link above. The PPTX needs Microsoft PowerPoint, LibreOffice Impress, or Google Slides to open. If you're using Google Slides, upload the .pptx file directly and it will render correctly.
This is a shared conversation. Sign in to Orris to start your own chat.