Compare information from textbook and the latest guidelines on heart failure with preserved ejection fraction and give weightage to ACC ESC and AHA compare to other societies

Reading File
Finding Sources
Searching PubMed

"heart failure with preserved ejection fraction"[MeSH Terms] AND treatment

Searching the Web

ACC AHA ESC 2022 2023 2024 heart failure preserved ejection fraction HFpEF guidelines recommendations

Reading File
Reading File
Reading File
Searching PubMed

"HFpEF" AND "SGLT2 inhibitor" AND treatment

Reading Web Page

https://www.ahajournals.org/doi/10.1161/CIR.0000000000001063

Reading File
Reading File
Reading Web Page

https://www.escardio.org/guidelines/clinical-practice-guidel…

Searching PubMed

"HFpEF" AND "finerenone" AND "FINEARTS-HF"

Finding Sources
Finding Sources
Searching PubMed

"heart failure preserved ejection fraction" AND "GLP-1" AND "semaglutide"

Reading File
Reading File

Heart Failure with Preserved Ejection Fraction (HFpEF): Textbook vs. Current Guidelines

Guideline Priority Note: Recommendations from ACC/AHA (2022 Joint Guideline) and ESC (2021 Guidelines + 2023 Focused Update) are given highest weighting in this synthesis. HFSA, NICE, CCS, and other society guidance are acknowledged where they diverge but carry subordinate weight.

1. DEFINITION AND EJECTION FRACTION THRESHOLD

Textbooks

  • HFpEF is defined by HF symptoms/signs plus LVEF >40–50%, depending on the textbook and era. Many trials and older editions use LVEF ≥40%. (Braunwald's Heart Disease; Harrison's 22E)
  • The spectrum is increasingly divided: HFpEF (LVEF ≥50%) and HFmrEF (LVEF 40–49%), with the understanding that many trial datasets overlap. (Braunwald's; Harrison's)
  • HFpEF is no longer viewed as purely a "diastolic disorder"—it is a multifactorial systemic illness involving aging, inflammation, multimorbidity, and metabolic dysregulation. (Braunwald's, p.1035)

⭐ ACC/AHA 2022 Guideline (Highest Weight)

  • HFpEF = LVEF ≥50% (Table 4, 2022 AHA/ACC/HFSA Guideline for Management of Heart Failure). This is the authoritative modern threshold.
  • HFmrEF = LVEF 41–49%

⭐ ESC 2021/2023 Guideline (Highest Weight)

  • Aligned: HFpEF = LVEF ≥50%, HFmrEF = 41–49%
  • The 2023 Focused Update explicitly extends some HFpEF recommendations down to EF ≥40% for SGLT2 inhibitors.
Comparison: Textbooks lag slightly—older editions accept EF ≥40% as HFpEF. Both ACC/AHA and ESC have standardized ≥50% as the threshold, but pharmacological trials (DELIVER, EMPEROR-Preserved) enrolled EF ≥40%, creating a practical gray zone that all three sources acknowledge.

2. PATHOPHYSIOLOGY

Textbooks (Fuster & Hurst's 15th Ed., Braunwald's, Harrison's 22E)

The mechanisms described are extensive and multilayered:
MechanismDetail
Diastolic dysfunctionImpaired LV relaxation (active) and increased chamber stiffness (passive), elevated LVEDP
Systolic reserve limitationResting systolic function "preserved," but systolic augmentation during exercise is impaired
Ventricular-arterial couplingBoth Ea (arterial stiffness) and Ees (ventricular stiffness) increase — Ea/Ees ratio maintained at rest but reserve is lost; leads to BP lability
Chronotropic incompetenceInability to augment heart rate with exercise — major contributor to exercise intolerance
Inflammation & fibrosisSystemic pro-inflammatory milieu drives myocardial fibrosis; titin modifications increase passive stiffness
Comorbidity burdenHypertension (60–80%), obesity, AF, CKD, T2DM, CAD, pulmonary hypertension, OSA all contribute independently
Obesity phenotypeIn obese HFpEF: RV sarcomere contractility depressed ~40% (BMI inversely correlated), distinct from hypertensive-LVH phenotype (Fuster & Hurst's)
Pulmonary hypertensionRV dysfunction from pulmonary venous hypertension worsens prognosis

⭐ ACC/AHA & ESC Guidelines

  • Both guidelines reinforce the multimorbidity model and frame HFpEF management around targeting underlying phenotypes (obesity, HTN, AF, CKD)
  • The ESC 2021 guidelines introduced the HFA-PEFF algorithm for structured diagnosis incorporating phenotyping
Comparison: Textbooks provide richer mechanistic depth (e.g., titin biology, VV coupling mechanics, sarcomere-level differences by phenotype). Guidelines translate this into actionable diagnostic criteria and phenotype-directed therapy.

3. DIAGNOSIS

Textbooks

  • Requires: (1) clinical HF diagnosis (symptoms + signs) + (2) LVEF ≥50% (or ≥40% in some frameworks)
  • Supporting evidence: elevated BNP/NT-proBNP, echocardiographic diastolic dysfunction markers (E/e' ratio, LA enlargement, dilated IVC), elevated PCWP on invasive hemodynamics
  • Pitfall: Up to 30–40% of HFpEF patients (especially obese) have BNP below typical thresholds — diagnosis can be missed (Braunwald's, p.2763)
  • Two validated scoring tools: H₂FPEF score and HFA-PEFF score (Braunwald's)
  • Echo alone unreliable: diastolic dysfunction is necessary but not sufficient; E/e' often indeterminate (8–15 range); exercise hemodynamics (PCWP ≥25 mmHg with PLR or exercise) may be required (Braunwald's)
  • Must exclude mimics: obesity, COPD, CKD, pericardial disease, pulmonary arterial hypertension, HCM, infiltrative disease (amyloidosis, hemochromatosis) (Harrison's 22E)

⭐ ACC/AHA 2022

  • Affirms LVEF ≥50% threshold; recognizes diagnostic challenge in obese patients
  • Recommends exercise stress testing and invasive hemodynamics when diagnosis is uncertain (Class I, C-EO for hemodynamic evaluation)
  • Supports H₂FPEF and HFA-PEFF scores as aids

⭐ ESC 2021/2023

  • Endorses the 4-step HFA-PEFF diagnostic algorithm: Pre-test assessment → Echocardiography/BNP → Functional testing → Final aetiology
  • Recommends exercise testing with echo or invasive hemodynamics when resting criteria are indeterminate (Class IIa)
Comparison: Strong concordance between textbooks and ACC/AHA/ESC on the diagnostic challenge. The HFA-PEFF algorithm is an ESC construct that has been widely adopted in textbooks. ACC/AHA slightly de-emphasizes the formal algorithm but validates the same diagnostic pathway.

4. PHARMACOLOGICAL TREATMENT — DETAILED COMPARISON

4a. SGLT2 Inhibitors ⭐ [Major Update]

SourceRecommendationEvidence Basis
ACC/AHA 2022Class IIa, B-R — SGLT2i can be beneficial in decreasing HF hospitalizations and CV mortalityEMPEROR-Preserved (empagliflozin), DELIVER (dapagliflozin)
ESC 2023 Focused UpdateClass IIa, A — Empagliflozin/dapagliflozin recommended to reduce HF hospitalizations in HFpEF/HFmrEF (EF ≥40%)EMPEROR-Preserved + DELIVER pooled analysis
Textbooks (Harrison's 22E)"SGLT-2 inhibitors (reduce HF hospitalization)" — listed as novel therapy; pooled analysis confirms CV death + HF hospitalization reduction (Harrison's 22E, p.2031)RCT data
Textbooks (Braunwald's)EMPEROR-Preserved: empagliflozin reduced first HFH or CV death; recognized as foundational therapyEMPEROR-Preserved trial
ACC 2025 Expert PerspectiveSGLT2i remain cornerstone, Class 2a; benefit driven mainly by HFH reductionsUpdated review
Key trial data: DELIVER (dapagliflozin) and EMPEROR-Preserved (empagliflozin) — both showed ~18–21% relative risk reduction in composite CV death/HFH. The ESC upgraded to Class IIa, A (the strongest HFpEF drug recommendation).
Textbook vs. Guideline gap: Braunwald's (2022 edition) and Fuster & Hurst's (15th Ed.) acknowledge the EMPEROR-Preserved data but note guidelines were "not yet updated at time of writing." Harrison's 22E (2025) fully incorporates SGLT2i as foundational therapy. Both ACC/AHA and ESC now rate SGLT2i as the strongest pharmacological recommendation for HFpEF — this is the most significant divergence between older textbooks and current guidelines.

4b. Diuretics (Loop + Thiazides)

SourceRecommendation
ACC/AHA 2022Class I — indicated for volume overload/symptom relief (no mortality benefit)
ESC 2021Class I, C — to relieve congestion and improve symptoms
All TextbooksUniversally recommended for euvolemia; must be used judiciously to avoid prerenal azotemia; excessive preload reduction poorly tolerated in stiff ventricle (Braunwald's, Harrison's)
Full concordance across all sources. Diuretics remain the cornerstone of symptom management with no mortality benefit.

4c. MRA (Spironolactone / Finerenone) ⭐ [Emerging Update]

SourceRecommendationEvidence
ACC/AHA 2022Class IIb, B-R — MRAs "may be considered" to decrease hospitalizations, especially LVEF at lower end of HFpEF spectrumTOPCAT (Americas subgroup)
ESC 2021Class IIb, B-R — Spironolactone/eplerenone may be consideredTOPCAT
TextbooksTOPCAT showed reduction in HFH (17% overall, significant Americas subgroup); ALDO-DHF improved echo parameters but not QOL/functional capacity; regional enrollment issues cloud interpretation (Harrison's 22E; Braunwald's)TOPCAT
2025 Emerging DataFINEARTS-HF (n=7,400): Finerenone (nonsteroidal MRA) reduced CV death + HF events even with background SGLT2i use [PMID: 38733212]. May upgrade MRA recommendation to IIaFINEARTS-HF (published 2024)
Critical gap: Textbooks reflect the spironolactone-TOPCAT era data (IIb). The FINEARTS-HF trial data with finerenone (published 2024, after the 2022 ACC/AHA guideline) represents a post-guideline advance — current ACC/AHA and ESC are anticipated to upgrade MRA class from IIb to IIa in the next update cycle.

4d. ARB / ACEI

SourceRecommendation
ACC/AHA 2022Class IIb, B-R — ARB "may be considered" to decrease HFH, especially lower EF spectrum
ESC 2021Class IIb — ARB can be considered to reduce hospitalizations
All TextbooksCHARM-Preserved (candesartan): reduced HFH, no mortality benefit. I-PRESERVE (irbesartan): no benefit. ACEI (perindopril, PEP-CHF): early benefit attenuated over time. No ACEi recommended for HFpEF per se (Harrison's 22E; Braunwald's)
Concordance: All sources agree — ARBs have limited, inconsistent benefit. ACEi have no clear HFpEF indication. ACC/AHA and ESC provide weak (IIb) endorsement of ARBs.

4e. ARNi (Sacubitril/Valsartan)

SourceRecommendation
ACC/AHA 2022Class IIb, B-R — ARNi "may be considered" to decrease HFH, especially lower EF spectrum
ESC 2021/2023Class IIb — can be considered for HFmrEF; limited data for strict HFpEF
TextbooksPARAGON-HF: 13% reduction in composite endpoint (CV death + HFH) — not statistically significant (p=0.06). Subgroup benefit in women and EF <57%. Sacubitril/valsartan FDA-approved across EF spectrum, benefit greatest at lower EF (Braunwald's; Harrison's 22E; Fuster & Hurst's)
PARAGLIDE-HF (acute setting, EF >40%) showed NT-proBNP reduction; clinical benefits confined to EF ≤60%. All sources agree ARNi is a second-line, selected-patient option for HFpEF.

4f. Beta-Blockers

SourceRecommendation
ACC/AHA 2022No recommendation for HFpEF per se; indicated for rate control in AF, post-MI
ESC 2021No specific HFpEF indication; Class I for AF rate control
TextbooksSENIORS (nebivolol): no significant mortality/CV mortality benefit in HFpEF subgroup. "Ineffective" for HFpEF as primary therapy; useful for preventing tachycardia in AF (Harrison's 22E)
Concordance: No beta-blocker recommendation for HFpEF as primary therapy across all sources.

4g. Blood Pressure Control

SourceRecommendation
ACC/AHA 2022Class I, C-LD — Treat to guideline BP targets to prevent morbidity
ESC 2021Class I — BP control to standard targets
All TextbooksHypertension present in 60–80% of HFpEF; BP control is cornerstone of disease-modifying therapy (Braunwald's; Harrison's)
Full concordance — aggressive BP control is the strongest preventive/therapeutic intervention.

4h. GLP-1 Agonists (Semaglutide) [Post-Guideline Emerging Therapy]

SourceRecommendation
ACC/AHA 2022Not covered (guideline predates trial data)
ESC 2023 Focused UpdateNot formally incorporated; acknowledged in context of obesity management
Textbooks (Harrison's 22E, 2025)STEP-HFpEF: Semaglutide in obese HFpEF (BMI ≥30, no DM) — significant improvement in QOL and functional capacity with ~13% weight loss. SUMMIT trial: GLP-1 reduced CV death + HF events (Harrison's 22E)
ACC 2025 Perspective"Anti-obesity therapies will be recommended to treat HFpEF" in next guideline cycle; STEP-HFpEF and SUMMIT data compelling
Important gap: Harrison's 22E (2025) is the first major textbook to fully incorporate GLP-1 data. The 2022 ACC/AHA guideline predates this evidence entirely. ESC 2023 update touched on it only indirectly. This is the frontier of HFpEF pharmacotherapy.

4i. Nitrates / PDE5 Inhibitors

SourceRecommendation
ACC/AHA 2022Class III (No Benefit), B-R — Routine use of nitrates or PDE5i to increase activity or QOL is ineffective
ESC 2021Not recommended for routine HFpEF management
TextbooksSildenafil ineffective (Harrison's 22E); supported by RELAX trial data
Concordance: Explicit guideline prohibition (Class III) aligned with textbook evidence.

5. NON-PHARMACOLOGICAL MANAGEMENT

InterventionTextbook EvidenceACC/AHA 2022ESC 2021/2023
Aerobic exerciseImproves exercise tolerance and QOL (Braunwald's; Harrison's)Class IIa — cardiac rehabilitationClass IIa, B
Dietary sodium/fluid restrictionRecommended to maintain euvolemiaClass I (avoid excess intake)Class I
Weight loss (obesity)Caloric restriction + aerobic exercise improve hemodynamics and exercise capacityStrongly recommendedRecommended; SGLT2i may mediate benefit partly via plasma volume reduction
AF managementRate control + anticoagulation + early rhythm control consideration (Harrison's)Class IIa, C-EO (AF management beneficial for symptoms)Class I for anticoagulation; rate/rhythm control as appropriate
CardioMEMS (PA pressure monitoring)Not covered in all textbooksClass IIb (upgraded from no recommendation)IIb
Comorbidity managementCKD, OSA, anemia, iron deficiency — all contribute (Harrison's 22E)Covered in comorbidity sectionsAddressed in focused updates

6. DIAGNOSTIC SCORING TOOLS

ToolSourceRole
H₂FPEF ScoreDeveloped at Mayo Clinic; validated in multiple cohortsPre-test probability for HFpEF in dyspnea
HFA-PEFF ScoreESC-endorsed 4-step algorithmFormal diagnostic pathway; widely adopted in European practice
Textbooks (Braunwald's) describe both tools. ACC/AHA 2022 references them as useful aids. ESC 2021/2023 formally endorses HFA-PEFF as the structured diagnostic pathway.

7. SUMMARY COMPARISON TABLE

DomainTextbooks⭐ ACC/AHA 2022⭐ ESC 2021/2023Current Evidence Gap
EF Threshold≥40–50% (variably defined)≥50% (HFpEF); 41–49% (HFmrEF)≥50%; trials include ≥40%Practical overlap; trial data from EF ≥40%
DiagnosisSymptoms + EF + exclude mimics; scoring toolsH₂FPEF/HFA-PEFF; invasive hemodynamics if uncertainHFA-PEFF 4-step algorithmObesity blunts BNP; provocative testing underutilized
DiureticsFoundational; use judiciouslyClass IClass INo mortality benefit in any source
SGLT2iEmerging → foundational (Harrison's 22E)Class IIa, B-RClass IIa, A (strongest HFpEF Rx)ESC stronger than ACC; both stronger than older textbooks
MRA (spironolactone)IIb based on TOPCAT AmericasClass IIb, B-RClass IIb, B-RFINEARTS-HF (finerenone) may upgrade to IIa — POST-guideline
ARBModest HFH benefit; no mortalityClass IIbClass IIbConsistent weak recommendation
ARNiBorderline (PARAGON p=0.06); women/lower EF benefitClass IIbClass IIbRole may narrow with SGLT2i dominance
Beta-blockersNot effective for HFpEF per seNo HFpEF indicationNo HFpEF indicationRate control in AF only
ACEiIneffectiveNot recommendedNot recommendedFull concordance
GLP-1 agonistsSTEP-HFpEF + SUMMIT: QOL + outcomes benefit in obese (Harrison's 2025)Not covered (pre-2022 data)Acknowledged post-2023Frontier therapy — not yet in any formal guideline
Nitrates/PDE5iIneffectiveClass III — No BenefitNot recommendedExplicit contraindication (ACC/AHA)
BP ControlCornerstoneClass IClass IFull concordance
Exercise/RehabImproves QOL/functional capacityClass IIaClass IIa, BConsistent recommendation
Cardiac amyloidosisIncreasingly recognized cause; ATTRwt in elderly (Braunwald's)Specific diagnostic algorithmSeparate algorithmTafamidis evidence for ATTR-CM (separate from HFpEF management)

8. KEY TENSIONS AND CLINICAL IMPLICATIONS

  1. SGLT2 inhibitors are now the pharmacological anchor of HFpEF therapy. ESC 2023 rates them Class IIa, A — the strongest evidence class for any drug in HFpEF. ACC/AHA 2022 also IIa. Harrison's 22E fully endorses this. Older textbook editions that describe SGLT2i as "novel" or "emerging" are now outdated.
  2. Finerenone (FINEARTS-HF, 2024) may change the MRA story. The nonsteroidal MRA showed benefit even on background SGLT2i — this post-guideline trial [PMID: 38733212] is likely to upgrade MRA from Class IIb to IIa in the next ACC/AHA/ESC update cycle. Current guidelines and all textbooks pre-date this data.
  3. GLP-1 agonists in obese HFpEF — STEP-HFpEF and SUMMIT trials have established meaningful QOL and outcome benefits. Harrison's 22E (2025) is the first major textbook to incorporate this. No formal guideline recommendation exists yet; ACC has signaled forthcoming inclusion. This represents the largest pending therapeutic recommendation.
  4. Nitrates and PDE5i — ACC/AHA explicitly labels these Class III (harm/no benefit). Not all textbook editions are as strong in this language. Clinicians should follow the guideline prohibition.
  5. Diagnostic threshold mismatch — The ≥50% EF cutoff in guidelines vs. ≥40% in many trials creates patient identification challenges in clinical practice. Provocative hemodynamic testing (exercise PCWP ≥25 mmHg) and scoring tools are underutilized, particularly in obese patients where BNP is suppressed.

Sources: Braunwald's Heart Disease (p.1035, p.2763), Harrison's Principles of Internal Medicine 22E (2025), Fuster & Hurst's The Heart 15th Ed., Goldman-Cecil Medicine; 2022 AHA/ACC/HFSA Heart Failure Guideline; ESC 2023 Focused Update on Heart Failure; ACC HFpEF 2025 Expert Perspective; PMID: 38733212 (FINEARTS-HF); PMID: 39046727 (DELIVER RV analysis); PMID: 38572654 (EMPULSE trial).

Now Create a 10 page ppt on this topic

Reading File
Reading File
Reading File
Running Command

ls -la /home/daytona/workspace/ 2>/dev/null && mkdir -p /home/daytona/workspace/hfpef-ppt

Writing File

~/hfpef-ppt/create_hfpef_ppt.js

const pptxgen = require("pptxgenjs");
const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "HFpEF: Textbook vs Current Guidelines";
pres.author = "Orris Medical AI";

// ─── Color Palette ───────────────────────────────────────────────────────────
const C = {
  navy:    "0D2B55",   // dominant dark background
  midblue: "1A4A8A",   // secondary
  accent:  "2196F3",   // bright blue accent
  gold:    "F59E0B",   // ACC/AHA/ESC highlight
  red:     "E53935",   // warning / Class III
  green:   "2E7D32",   // Class I (strong rec)
  teal:    "00838F",   // Class IIa
  orange:  "EF6C00",   // Class IIb
  white:   "FFFFFF",
  offwhite:"F0F4FA",
  lightblue:"BBDEFB",
  gray:    "B0BEC5",
  darkgray:"37474F",
};

// ─── Helper functions ─────────────────────────────────────────────────────────
function slideBg(slide) {
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.navy }, line: { color: C.navy } });
}
function accentBar(slide, color = C.accent) {
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 0.08, fill: { color: color }, line: { color: color } });
}
function footerBar(slide) {
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 5.38, w: 10, h: 0.245, fill: { color: C.midblue }, line: { color: C.midblue } });
  slide.addText("ACC/AHA 2022 · ESC 2021/2023 · Braunwald's · Harrison's 22E · Fuster & Hurst's 15th Ed.", {
    x: 0.2, y: 5.39, w: 9.6, h: 0.22, fontSize: 7, color: C.gray, align: "left", margin: 0
  });
}
function sectionTitle(slide, title) {
  slide.addText(title, {
    x: 0.4, y: 0.12, w: 9.2, h: 0.55, fontSize: 20, bold: true, color: C.white,
    fontFace: "Calibri", align: "left", margin: 0
  });
  slide.addShape(pres.shapes.RECTANGLE, { x: 0.4, y: 0.68, w: 1.2, h: 0.055, fill: { color: C.gold }, line: { color: C.gold } });
}
function card(slide, x, y, w, h, fillColor, title, bullets, titleColor, textColor) {
  slide.addShape(pres.shapes.RECTANGLE, {
    x, y, w, h,
    fill: { color: fillColor },
    line: { color: "FFFFFF", width: 0.5, transparency: 80 },
    shadow: { type: "outer", color: "000000", blur: 5, offset: 2, angle: 135, opacity: 0.18 }
  });
  slide.addText(title, {
    x: x + 0.12, y: y + 0.08, w: w - 0.24, h: 0.35,
    fontSize: 10, bold: true, color: titleColor || C.gold, fontFace: "Calibri", margin: 0
  });
  const bulletItems = bullets.map((b, i) => ({
    text: b, options: { bullet: { code: "2022" }, breakLine: i < bullets.length - 1, fontSize: 8.5, color: textColor || C.white, fontFace: "Calibri" }
  }));
  slide.addText(bulletItems, { x: x + 0.12, y: y + 0.44, w: w - 0.24, h: h - 0.55 });
}
function classTag(slide, x, y, label, color) {
  slide.addShape(pres.shapes.ROUNDED_RECTANGLE, { x, y, w: 1.1, h: 0.28, fill: { color }, line: { color }, rectRadius: 0.05 });
  slide.addText(label, { x, y: y + 0.02, w: 1.1, h: 0.26, fontSize: 8, bold: true, color: C.white, align: "center", margin: 0 });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  slideBg(s);
  // decorative circles
  s.addShape(pres.shapes.OVAL, { x: 7.2, y: -0.8, w: 4, h: 4, fill: { color: C.midblue }, line: { color: C.midblue }, transparency: 60 });
  s.addShape(pres.shapes.OVAL, { x: 7.8, y: 2.8, w: 2.5, h: 2.5, fill: { color: C.accent }, line: { color: C.accent }, transparency: 75 });
  accentBar(s, C.gold);

  s.addText("HFpEF", {
    x: 0.5, y: 0.55, w: 7, h: 1.4, fontSize: 64, bold: true, color: C.gold, fontFace: "Calibri", margin: 0
  });
  s.addText("Heart Failure with Preserved Ejection Fraction", {
    x: 0.5, y: 1.85, w: 8.5, h: 0.65, fontSize: 22, bold: false, color: C.lightblue, fontFace: "Calibri", margin: 0
  });
  s.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: 2.58, w: 5.5, h: 0.055, fill: { color: C.accent }, line: { color: C.accent } });
  s.addText("Textbook Knowledge vs. Current Clinical Guidelines", {
    x: 0.5, y: 2.72, w: 7.5, h: 0.45, fontSize: 16, italic: true, color: C.offwhite, fontFace: "Calibri", margin: 0
  });
  s.addText([
    { text: "ACC/AHA 2022  ", options: { bold: true, color: C.gold, fontSize: 11 } },
    { text: " · ", options: { color: C.gray, fontSize: 11 } },
    { text: "ESC 2021/2023  ", options: { bold: true, color: C.gold, fontSize: 11 } },
    { text: " · ", options: { color: C.gray, fontSize: 11 } },
    { text: "Braunwald's  ·  Harrison's 22E  ·  Fuster & Hurst's 15th", options: { color: C.lightblue, fontSize: 11 } },
  ], { x: 0.5, y: 3.28, w: 9, h: 0.45 });

  // slide number badges
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 5.38, w: 10, h: 0.245, fill: { color: C.midblue }, line: { color: C.midblue } });
  s.addText("Comparative Review  |  May 2026", {
    x: 0.3, y: 5.39, w: 9.4, h: 0.22, fontSize: 8, color: C.gray, align: "left", margin: 0
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 2 — OVERVIEW & AGENDA
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  slideBg(s);
  accentBar(s, C.accent);
  sectionTitle(s, "Overview & Slide Agenda");
  footerBar(s);

  const topics = [
    ["01", "Definition & EF Threshold", "Textbook variability vs. guideline standardization"],
    ["02", "Pathophysiology", "Multifactorial systemic disease model"],
    ["03", "Diagnosis", "HFA-PEFF, H₂FPEF scores, invasive hemodynamics"],
    ["04", "Pharmacotherapy — SGLT2i & MRAs", "New cornerstone therapies"],
    ["05", "RAAS Blockers, ARNi, Beta-blockers", "Evidence gaps and weak recommendations"],
    ["06", "Emerging Therapies", "GLP-1, finerenone, anti-obesity agents"],
    ["07", "Non-Pharmacological Management", "Exercise, BP, AF, comorbidities"],
    ["08", "Drug Comparison Table", "Class of Recommendation by society"],
    ["09", "Key Textbook vs. Guideline Gaps", "What's changed, what's pending"],
    ["10", "Clinical Takeaways", "Practice-ready decision support"],
  ];

  topics.forEach(([num, title, sub], i) => {
    const col = i < 5 ? 0 : 1;
    const row = i % 5;
    const x = col === 0 ? 0.35 : 5.2;
    const y = 0.88 + row * 0.88;

    s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
      x, y, w: 4.55, h: 0.75,
      fill: { color: C.midblue },
      line: { color: C.accent, width: 0.5 },
      rectRadius: 0.08
    });
    s.addShape(pres.shapes.RECTANGLE, { x, y, w: 0.38, h: 0.75, fill: { color: C.accent }, line: { color: C.accent } });
    s.addText(num, { x, y: y + 0.18, w: 0.38, h: 0.38, fontSize: 12, bold: true, color: C.white, align: "center", margin: 0 });
    s.addText(title, { x: x + 0.44, y: y + 0.06, w: 4.0, h: 0.32, fontSize: 10, bold: true, color: C.white, fontFace: "Calibri", margin: 0 });
    s.addText(sub, { x: x + 0.44, y: y + 0.36, w: 4.0, h: 0.28, fontSize: 8, color: C.gray, fontFace: "Calibri", margin: 0 });
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 3 — DEFINITION & PATHOPHYSIOLOGY
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  slideBg(s);
  accentBar(s, C.teal);
  sectionTitle(s, "Definition, EF Threshold & Pathophysiology");
  footerBar(s);

  // EF boxes
  const efData = [
    { label: "HFrEF", ef: "EF < 40%", col: C.red },
    { label: "HFmrEF", ef: "EF 41–49%", col: C.orange },
    { label: "HFpEF", ef: "EF ≥ 50%", col: C.teal },
  ];
  efData.forEach(({ label, ef, col }, i) => {
    const x = 0.35 + i * 3.08;
    s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x, y: 0.82, w: 2.7, h: 0.75, fill: { color: col }, line: { color: col }, rectRadius: 0.1 });
    s.addText(label, { x, y: 0.86, w: 2.7, h: 0.35, fontSize: 13, bold: true, color: C.white, align: "center", margin: 0 });
    s.addText(ef, { x, y: 1.18, w: 2.7, h: 0.28, fontSize: 9, color: C.white, align: "center", margin: 0 });
  });
  s.addText("ACC/AHA 2022 & ESC 2021 standardized HFpEF as LVEF ≥ 50% (older texts accepted ≥ 40%)", {
    x: 0.35, y: 1.65, w: 9.3, h: 0.28, fontSize: 8.5, italic: true, color: C.gold, fontFace: "Calibri", margin: 0
  });

  // Pathophysiology cards
  const mechs = [
    ["Diastolic Dysfunction", "Impaired LV relaxation + ↑ chamber stiffness\n→ Elevated LVEDP"],
    ["Systolic Reserve Loss", "Resting EF normal; exercise augmentation blunted\n→ Exertional intolerance"],
    ["VV Coupling Defect", "↑ Ea & ↑ Ees → BP lability with small preload shifts\n→ Diuretic sensitivity"],
    ["Chronotropic Incompetence", "Failure to augment HR with exercise\n→ Major driver of ↓ VO₂max"],
    ["Inflammation & Fibrosis", "Systemic pro-inflammatory state → myocardial fibrosis\n→ Titin modifications, ↑ passive stiffness"],
    ["Comorbidity Burden", "HTN 60–80% · Obesity · AF · CKD · T2DM\n→ Multifactorial systemic disease"],
  ];
  mechs.forEach(([title, body], i) => {
    const col = i % 3;
    const row = Math.floor(i / 3);
    const x = 0.35 + col * 3.08;
    const y = 2.02 + row * 1.55;
    s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
      x, y, w: 2.88, h: 1.42,
      fill: { color: "112244" },
      line: { color: C.teal, width: 0.8 },
      rectRadius: 0.08
    });
    s.addShape(pres.shapes.RECTANGLE, { x, y, w: 2.88, h: 0.28, fill: { color: C.teal }, line: { color: C.teal } });
    s.addText(title, { x: x + 0.08, y: y + 0.02, w: 2.72, h: 0.24, fontSize: 8.5, bold: true, color: C.white, margin: 0 });
    s.addText(body, { x: x + 0.1, y: y + 0.32, w: 2.68, h: 1.0, fontSize: 8, color: C.offwhite, fontFace: "Calibri", margin: 0 });
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 4 — DIAGNOSIS
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  slideBg(s);
  accentBar(s, C.gold);
  sectionTitle(s, "Diagnosis of HFpEF");
  footerBar(s);

  // Left column — diagnostic criteria
  s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x: 0.35, y: 0.85, w: 4.4, h: 4.4, fill: { color: "112244" }, line: { color: C.gold, width: 0.8 }, rectRadius: 0.08 });
  s.addShape(pres.shapes.RECTANGLE, { x: 0.35, y: 0.85, w: 4.4, h: 0.32, fill: { color: C.gold }, line: { color: C.gold } });
  s.addText("Diagnostic Requirements", { x: 0.47, y: 0.87, w: 4.16, h: 0.28, fontSize: 10, bold: true, color: C.navy, margin: 0 });

  const diagItems = [
    ["1", "Clinical HF diagnosis", "Symptoms (dyspnea, orthopnea) + signs (elevated JVP, edema)"],
    ["2", "LVEF ≥ 50%", "Per ACC/AHA 2022 & ESC 2021 — older texts used ≥ 40%"],
    ["3", "Elevated filling pressures", "↑ E/e' ratio, LA enlargement, dilated IVC on echo\nOR elevated PCWP on cath"],
    ["4", "Elevated natriuretic peptides", "BNP/NT-proBNP — NOTE: may be falsely low in obese patients (30–40%)"],
    ["5", "Exclude mimics", "Obesity, COPD, CKD, amyloidosis, HCM, pericardial disease, PAH"],
  ];
  diagItems.forEach(([num, title, body], i) => {
    const y = 1.26 + i * 0.8;
    s.addShape(pres.shapes.OVAL, { x: 0.45, y: y + 0.04, w: 0.28, h: 0.28, fill: { color: C.gold }, line: { color: C.gold } });
    s.addText(num, { x: 0.45, y: y + 0.05, w: 0.28, h: 0.26, fontSize: 8, bold: true, color: C.navy, align: "center", margin: 0 });
    s.addText(title, { x: 0.82, y: y + 0.02, w: 3.8, h: 0.22, fontSize: 9, bold: true, color: C.white, fontFace: "Calibri", margin: 0 });
    s.addText(body, { x: 0.82, y: y + 0.24, w: 3.8, h: 0.45, fontSize: 7.5, color: C.gray, fontFace: "Calibri", margin: 0 });
  });

  // Right column — scoring algorithms
  s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x: 5.05, y: 0.85, w: 4.6, h: 2.0, fill: { color: "112244" }, line: { color: C.teal, width: 0.8 }, rectRadius: 0.08 });
  s.addShape(pres.shapes.RECTANGLE, { x: 5.05, y: 0.85, w: 4.6, h: 0.32, fill: { color: C.teal }, line: { color: C.teal } });
  s.addText("Diagnostic Scoring Tools", { x: 5.17, y: 0.87, w: 4.36, h: 0.28, fontSize: 10, bold: true, color: C.white, margin: 0 });
  const scoreItems = [
    { text: "H₂FPEF Score — Mayo Clinic", options: { bold: true, breakLine: true, color: C.gold, fontSize: 9 } },
    { text: "BMI, AF, ≥2 antihypertensives, echo E/e', LA vol, age >60\nValidated pre-test probability tool (ACC/AHA referenced)\n", options: { color: C.offwhite, fontSize: 8, breakLine: true } },
    { text: "HFA-PEFF Score — ESC Endorsed", options: { bold: true, breakLine: true, color: C.gold, fontSize: 9 } },
    { text: "4-step algorithm: Pre-test → Echo/BNP → Functional testing → Aetiology\nFormal ESC diagnostic pathway; adopted in European practice", options: { color: C.offwhite, fontSize: 8 } },
  ];
  s.addText(scoreItems, { x: 5.17, y: 1.22, w: 4.36, h: 1.5 });

  // When to use invasive hemodynamics
  s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x: 5.05, y: 2.98, w: 4.6, h: 2.27, fill: { color: "112244" }, line: { color: C.accent, width: 0.8 }, rectRadius: 0.08 });
  s.addShape(pres.shapes.RECTANGLE, { x: 5.05, y: 2.98, w: 4.6, h: 0.32, fill: { color: C.accent }, line: { color: C.accent } });
  s.addText("When to Escalate to Invasive Hemodynamics", { x: 5.17, y: 3.0, w: 4.36, h: 0.28, fontSize: 9.5, bold: true, color: C.white, margin: 0 });
  const invasiveItems = [
    { text: "Diagnosis uncertain after rest echo + BNP", options: { bullet: { code: "2022" }, breakLine: true, color: C.white, fontSize: 8.5 } },
    { text: "Obese patients (BNP often below threshold)", options: { bullet: { code: "2022" }, breakLine: true, color: C.white, fontSize: 8.5 } },
    { text: "Exercise PCWP ≥ 25 mmHg confirms elevated filling pressures", options: { bullet: { code: "2022" }, breakLine: true, color: C.white, fontSize: 8.5 } },
    { text: "Passive leg raise PCWP ≥ 25 mmHg also diagnostic", options: { bullet: { code: "2022" }, breakLine: true, color: C.white, fontSize: 8.5 } },
    { text: "Class IIa (ACC/AHA) · Class IIa (ESC) for provocative testing", options: { bullet: { code: "2022" }, color: C.gold, fontSize: 8.5 } },
  ];
  s.addText(invasiveItems, { x: 5.17, y: 3.35, w: 4.36, h: 1.75 });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 5 — SGLT2i & MRAs (Key Pharmacotherapy)
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  slideBg(s);
  accentBar(s, C.teal);
  sectionTitle(s, "Pharmacotherapy — SGLT2 Inhibitors & MRAs");
  footerBar(s);

  // SGLT2 section
  s.addShape(pres.shapes.RECTANGLE, { x: 0.35, y: 0.85, w: 9.3, h: 0.3, fill: { color: C.teal }, line: { color: C.teal } });
  s.addText("SGLT2 Inhibitors — Cornerstone of HFpEF Therapy", { x: 0.45, y: 0.87, w: 9.1, h: 0.26, fontSize: 10.5, bold: true, color: C.white, margin: 0 });

  const sglt2Cols = [
    { title: "ACC/AHA 2022", tag: "Class IIa · B-R", tagColor: C.teal, points: ["Empagliflozin / Dapagliflozin", "↓ HF hospitalizations + CV mortality", "First society to formally recommend", "Driven by EMPEROR-Preserved data"] },
    { title: "ESC 2023 Update", tag: "Class IIa · A", tagColor: C.green, points: ["Upgraded from no recommendation", "Strongest HFpEF drug evidence class", "Applies to EF ≥ 40% (HFmrEF + HFpEF)", "EMPEROR-Preserved + DELIVER pooled"] },
    { title: "Textbook View", tag: "Harrison's 22E (2025)", tagColor: C.accent, points: ["Fully incorporates as foundational Rx", "~18–21% RRR in CV death/HFH", "Older editions label as 'emerging'", "DELIVER + EMPEROR-Pres both cited"] },
  ];
  sglt2Cols.forEach(({ title, tag, tagColor, points }, i) => {
    const x = 0.35 + i * 3.1;
    s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x, y: 1.22, w: 2.9, h: 2.35, fill: { color: "0a2040" }, line: { color: tagColor, width: 0.8 }, rectRadius: 0.08 });
    s.addText(title, { x: x + 0.1, y: 1.27, w: 2.7, h: 0.28, fontSize: 9.5, bold: true, color: C.white, margin: 0 });
    s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x: x + 0.1, y: 1.57, w: 2.1, h: 0.22, fill: { color: tagColor }, line: { color: tagColor }, rectRadius: 0.04 });
    s.addText(tag, { x: x + 0.1, y: 1.58, w: 2.1, h: 0.2, fontSize: 7.5, bold: true, color: C.white, align: "center", margin: 0 });
    const pItems = points.map((p, j) => ({ text: p, options: { bullet: { code: "2022" }, breakLine: j < points.length - 1, color: C.offwhite, fontSize: 8 } }));
    s.addText(pItems, { x: x + 0.1, y: 1.86, w: 2.7, h: 1.6 });
  });

  s.addText("KEY TRIAL DATA  |  EMPEROR-Preserved: empagliflozin RRR 21% (CV death + HFH) · DELIVER: dapagliflozin RRR 18% · Pooled analysis confirms class effect", {
    x: 0.35, y: 3.63, w: 9.3, h: 0.28, fontSize: 8, italic: true, color: C.gold, fontFace: "Calibri", margin: 0
  });

  // MRA section
  s.addShape(pres.shapes.RECTANGLE, { x: 0.35, y: 4.0, w: 9.3, h: 0.28, fill: { color: C.orange }, line: { color: C.orange } });
  s.addText("MRAs (Spironolactone / Finerenone)  —  Class IIb → Potential IIa Upgrade", { x: 0.45, y: 4.01, w: 9.1, h: 0.24, fontSize: 9.5, bold: true, color: C.white, margin: 0 });

  const mraData = [
    { src: "ACC/AHA 2022 / ESC 2021", txt: "Class IIb · TOPCAT Americas subgroup: 17% ↓ HFH\nSpironolactone 'may be considered' for selected patients" },
    { src: "FINEARTS-HF 2024 (post-guideline)", txt: "Finerenone (nonsteroidal MRA): ↓ CV death + HF events in 7,400 pts\nEffect seen even with background SGLT2i use — likely Class IIa upgrade" },
    { src: "Textbooks", txt: "TOPCAT: regional enrollment concerns; Americas benefit real\nALDO-DHF: improved echo but not QOL; FINEARTS data in Harrison's 22E" },
  ];
  mraData.forEach(({ src, txt }, i) => {
    const x = 0.35 + i * 3.1;
    s.addShape(pres.shapes.RECTANGLE, { x, y: 4.33, w: 2.9, h: 0.95, fill: { color: "1a1a3a" }, line: { color: C.orange, width: 0.5 } });
    s.addText(src, { x: x + 0.1, y: 4.35, w: 2.7, h: 0.22, fontSize: 8, bold: true, color: C.gold, margin: 0 });
    s.addText(txt, { x: x + 0.1, y: 4.59, w: 2.7, h: 0.64, fontSize: 7.5, color: C.offwhite, fontFace: "Calibri", margin: 0 });
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 6 — RAAS, ARNi, Beta-blockers
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  slideBg(s);
  accentBar(s, C.orange);
  sectionTitle(s, "RAAS Blockers, ARNi, Beta-Blockers — Evidence Review");
  footerBar(s);

  const drugs = [
    {
      name: "ARBs (Candesartan, Irbesartan)",
      acc: "Class IIb · B-R", accColor: C.orange,
      esc: "Class IIb · B-R", escColor: C.orange,
      trial: "CHARM-Preserved: ↓ HFH, no mortality benefit\nI-PRESERVE (irbesartan): No benefit",
      text: "Weak, inconsistent evidence. Considered only when SGLT2i unavailable or for lower-EF HFpEF.",
      tag: "WEAK RECOMMENDATION"
    },
    {
      name: "ACE Inhibitors (Perindopril)",
      acc: "Not Recommended", accColor: C.darkgray,
      esc: "Not Recommended", escColor: C.darkgray,
      trial: "PEP-CHF: Early HFH benefit attenuated over time\nNo current HFpEF-specific indication",
      text: "No guideline recommendation for HFpEF per se. Full concordance across all sources.",
      tag: "NO INDICATION"
    },
    {
      name: "ARNi (Sacubitril/Valsartan)",
      acc: "Class IIb · B-R", accColor: C.orange,
      esc: "Class IIb", escColor: C.orange,
      trial: "PARAGON-HF: 13% ↓ composite (p=0.06 — not significant)\nBenefit in women & EF < 57% subgroups",
      text: "FDA-approved across EF spectrum. Greatest benefit at lower EF. Role narrowing with SGLT2i dominance.",
      tag: "SELECTED PATIENTS"
    },
    {
      name: "Beta-Blockers (Nebivolol)",
      acc: "No HFpEF indication", accColor: C.darkgray,
      esc: "No HFpEF indication", escColor: C.darkgray,
      trial: "SENIORS HFpEF subgroup: No mortality benefit\nUseful for rate control in AF only",
      text: "Not recommended as primary HFpEF therapy. Indicated for AF rate control, post-MI across all sources.",
      tag: "AF / POST-MI ONLY"
    },
    {
      name: "Nitrates / PDE5 Inhibitors",
      acc: "Class III · B-R", accColor: C.red,
      esc: "Not Recommended", escColor: C.red,
      trial: "RELAX trial (sildenafil): No benefit in exercise capacity\nRutine nitrate use shown ineffective",
      text: "ACC/AHA explicitly prohibits routine use (Class III — No Benefit). Avoid in standard HFpEF management.",
      tag: "AVOID — CLASS III"
    },
  ];

  drugs.forEach(({ name, acc, accColor, esc, escColor, trial, text, tag }, i) => {
    const col = i < 3 ? 0 : 1;
    const row = i < 3 ? i : i - 3;
    const x = col === 0 ? 0.35 : 5.15;
    const y = col === 0 ? 0.88 + row * 1.52 : 0.88 + row * 1.52;
    const boxH = 1.4;
    const boxW = 4.55;

    s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x, y, w: boxW, h: boxH, fill: { color: "0a1a35" }, line: { color: accColor, width: 0.7 }, rectRadius: 0.07 });
    s.addShape(pres.shapes.RECTANGLE, { x, y, w: boxW, h: 0.27, fill: { color: accColor }, line: { color: accColor } });
    s.addText(name, { x: x + 0.08, y: y + 0.02, w: boxW - 0.48, h: 0.22, fontSize: 9, bold: true, color: C.white, margin: 0 });

    // tag
    s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x: x + boxW - 1.42, y: y + 0.02, w: 1.35, h: 0.22, fill: { color: C.navy }, line: { color: C.white, width: 0.3 }, rectRadius: 0.03 });
    s.addText(tag, { x: x + boxW - 1.42, y: y + 0.03, w: 1.35, h: 0.2, fontSize: 6.5, bold: true, color: C.white, align: "center", margin: 0 });

    // ACC/ESC badges
    s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x: x + 0.08, y: y + 0.33, w: 1.0, h: 0.22, fill: { color: accColor }, line: { color: accColor }, rectRadius: 0.04 });
    s.addText("ACC/AHA", { x: x + 0.08, y: y + 0.34, w: 1.0, h: 0.1, fontSize: 6, bold: true, color: C.white, align: "center", margin: 0 });
    s.addText(acc, { x: x + 0.08, y: y + 0.44, w: 1.0, h: 0.1, fontSize: 6, color: C.white, align: "center", margin: 0 });

    s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x: x + 1.14, y: y + 0.33, w: 0.9, h: 0.22, fill: { color: escColor }, line: { color: escColor }, rectRadius: 0.04 });
    s.addText("ESC", { x: x + 1.14, y: y + 0.34, w: 0.9, h: 0.1, fontSize: 6, bold: true, color: C.white, align: "center", margin: 0 });
    s.addText(esc, { x: x + 1.14, y: y + 0.44, w: 0.9, h: 0.1, fontSize: 6, color: C.white, align: "center", margin: 0 });

    s.addText(trial, { x: x + 0.08, y: y + 0.62, w: boxW - 0.16, h: 0.38, fontSize: 7.5, color: C.lightblue, fontFace: "Calibri", margin: 0 });
    s.addText(text, { x: x + 0.08, y: y + 1.02, w: boxW - 0.16, h: 0.34, fontSize: 7.5, italic: true, color: C.gray, fontFace: "Calibri", margin: 0 });
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 7 — EMERGING THERAPIES
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  slideBg(s);
  accentBar(s, C.gold);
  sectionTitle(s, "Emerging Therapies — The Frontier of HFpEF Treatment");
  footerBar(s);

  // Header banner
  s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x: 0.35, y: 0.85, w: 9.3, h: 0.38, fill: { color: "1a3a00" }, line: { color: C.gold, width: 0.6 }, rectRadius: 0.06 });
  s.addText("These therapies have emerged AFTER the ACC/AHA 2022 and ESC 2021 guidelines — formal recommendations are pending", {
    x: 0.5, y: 0.87, w: 9.0, h: 0.33, fontSize: 9, italic: true, color: C.gold, align: "center", margin: 0
  });

  const emerging = [
    {
      name: "GLP-1 Receptor Agonists (Semaglutide)",
      trials: "STEP-HFpEF + STEP-HFpEF DM + SUMMIT",
      result: "STEP-HFpEF: Significant ↑ KCCQ score + ↓ 6MWT deficit with 13% weight loss in obese HFpEF (BMI ≥30, no DM)\nSUMMIT: ↓ CV death + HF events in obese HFpEF",
      acc: "Not in 2022 guideline\n(ACC 2025 signals forthcoming rec)",
      esc: "Mentioned post-2023\n(not formally classified)",
      text: "Mechanism: Weight reduction → ↓ plasma volume, ↓ inflammation, ↑ functional capacity. Harrison's 22E (2025) is first textbook to fully incorporate.",
      color: C.green, tag: "ANTICIPATED RECOMMENDATION"
    },
    {
      name: "Finerenone (Nonsteroidal MRA)",
      trials: "FINEARTS-HF (n = 7,400)",
      result: "Significant ↓ CV death + HF events vs placebo\nEffect maintained even with background SGLT2i use\nBetter tolerability than spironolactone (less hyperkalemia)",
      acc: "Not in 2022 guideline\nExpected Class IIa upgrade",
      esc: "Not in 2021/2023\nExpected Class IIa upgrade",
      text: "This is the highest-impact post-guideline RCT in HFpEF. Likely to change the MRA recommendation from IIb → IIa in the next full guideline update cycle.",
      color: C.teal, tag: "POST-GUIDELINE RCT"
    },
    {
      name: "Tirzepatide / Dual GLP-1·GIP Agonists",
      trials: "SUMMIT (tirzepatide, 2024)",
      result: "Significant ↓ composite CV death + HF events (HR 0.62, p=0.026)\nWeight loss ~20% — largest in any HFpEF trial\nImproved 6MWT and KCCQ",
      acc: "Not yet in guidelines",
      esc: "Not yet in guidelines",
      text: "The SUMMIT trial (tirzepatide) showed the most striking weight-loss driven benefit in obese HFpEF. GLP-1/GIP dual agonism may be superior to GLP-1 monotherapy.",
      color: C.accent, tag: "LANDMARK TRIAL 2024"
    },
  ];

  emerging.forEach(({ name, trials, result, acc, esc, text, color, tag }, i) => {
    const y = 1.33 + i * 1.32;
    s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x: 0.35, y, w: 9.3, h: 1.22, fill: { color: "0a1a35" }, line: { color: color, width: 0.8 }, rectRadius: 0.07 });
    s.addShape(pres.shapes.RECTANGLE, { x: 0.35, y, w: 0.22, h: 1.22, fill: { color: color }, line: { color: color } });

    // Tag
    s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x: 7.8, y: y + 0.04, w: 1.78, h: 0.22, fill: { color: color }, line: { color: color }, rectRadius: 0.04 });
    s.addText(tag, { x: 7.8, y: y + 0.05, w: 1.78, h: 0.2, fontSize: 7, bold: true, color: C.white, align: "center", margin: 0 });

    s.addText(name, { x: 0.65, y: y + 0.04, w: 7.05, h: 0.25, fontSize: 10, bold: true, color: C.white, margin: 0 });
    s.addText("Trials: " + trials, { x: 0.65, y: y + 0.3, w: 9.0, h: 0.18, fontSize: 8, color: C.gold, margin: 0 });
    s.addText(result, { x: 0.65, y: y + 0.49, w: 5.9, h: 0.44, fontSize: 7.8, color: C.offwhite, fontFace: "Calibri", margin: 0 });

    // ACC / ESC boxes
    s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x: 6.65, y: y + 0.32, w: 1.3, h: 0.66, fill: { color: "0d2b55" }, line: { color: C.gold, width: 0.4 }, rectRadius: 0.04 });
    s.addText("ACC/AHA", { x: 6.65, y: y + 0.34, w: 1.3, h: 0.18, fontSize: 7, bold: true, color: C.gold, align: "center", margin: 0 });
    s.addText(acc, { x: 6.65, y: y + 0.52, w: 1.3, h: 0.42, fontSize: 7, color: C.gray, align: "center", fontFace: "Calibri", margin: 0 });

    s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x: 8.05, y: y + 0.32, w: 1.28, h: 0.66, fill: { color: "0d2b55" }, line: { color: C.teal, width: 0.4 }, rectRadius: 0.04 });
    s.addText("ESC", { x: 8.05, y: y + 0.34, w: 1.28, h: 0.18, fontSize: 7, bold: true, color: C.teal, align: "center", margin: 0 });
    s.addText(esc, { x: 8.05, y: y + 0.52, w: 1.28, h: 0.42, fontSize: 7, color: C.gray, align: "center", fontFace: "Calibri", margin: 0 });

    s.addText(text, { x: 0.65, y: y + 0.98, w: 7.9, h: 0.2, fontSize: 7.5, italic: true, color: C.gray, fontFace: "Calibri", margin: 0 });
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 8 — NON-PHARMACOLOGICAL MANAGEMENT
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  slideBg(s);
  accentBar(s, C.accent);
  sectionTitle(s, "Non-Pharmacological Management");
  footerBar(s);

  const pillars = [
    { icon: "🩺", title: "Blood Pressure Control", body: "HTN in 60–80% of HFpEF patients\nBP to guideline targets = primary prevention\nACC/AHA Class I · C-LD\nESC Class I", color: C.green },
    { icon: "🏃", title: "Exercise & Cardiac Rehab", body: "Aerobic exercise improves VO₂max & KCCQ\nExercise training reduces congestion & weight\nACC/AHA Class IIa · ESC Class IIa · B\nBoth textbooks & guidelines endorse", color: C.teal },
    { icon: "🫀", title: "Atrial Fibrillation Management", body: "AF worsens HFpEF outcomes significantly\nAnticoagulation: Class I (stroke prevention)\nRate control + early rhythm control\nACC/AHA Class IIa for AF symptom control", color: C.accent },
    { icon: "⚖️", title: "Weight Loss (Obesity)", body: "Caloric restriction + exercise = hemodynamic benefit\nBariatric surgery: improves PCWP & exercise capacity\nGLP-1 agonists emerging as pharmacological option\nStrongest in obese HFpEF phenotype", color: C.orange },
    { icon: "💊", title: "Diuretics (Symptom Control)", body: "Loop diuretics for volume overload\nClass I indication (ACC/AHA & ESC)\nJudicious use — avoid over-diuresis\nPreload-dependent ventricle → azotemia risk", color: C.midblue },
    { icon: "📡", title: "PA Pressure Monitoring", body: "CardioMEMS: ACC/AHA Class IIb\nCHAMPION + MONITOR-HF: ↓ HFH\nGuide-directed diuresis via remote monitoring\nFDA approved; underutilized in practice", color: C.darkgray },
  ];

  pillars.forEach(({ icon, title, body, color }, i) => {
    const col = i % 3;
    const row = Math.floor(i / 3);
    const x = 0.35 + col * 3.08;
    const y = 0.88 + row * 2.25;

    s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x, y, w: 2.88, h: 2.12, fill: { color: "0a1a35" }, line: { color: color, width: 0.8 }, rectRadius: 0.1 });
    s.addShape(pres.shapes.RECTANGLE, { x, y, w: 2.88, h: 0.44, fill: { color: color }, line: { color: color } });
    s.addText(icon + "  " + title, { x: x + 0.1, y: y + 0.06, w: 2.68, h: 0.3, fontSize: 9.5, bold: true, color: C.white, margin: 0 });
    s.addText(body, { x: x + 0.1, y: y + 0.5, w: 2.68, h: 1.55, fontSize: 8, color: C.offwhite, fontFace: "Calibri", margin: 0 });
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 9 — DRUG COMPARISON TABLE (Class of Recommendation)
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  slideBg(s);
  accentBar(s, C.gold);
  sectionTitle(s, "Comparative Drug Table — Class of Recommendation by Society");
  footerBar(s);

  // Table header
  const headers = ["Drug / Class", "ACC/AHA 2022", "ESC 2021/2023", "Textbook Consensus", "Key Trial(s)"];
  const colW = [2.2, 1.45, 1.45, 2.0, 2.55];
  const startX = 0.25;
  const startY = 0.88;

  let cx = startX;
  headers.forEach((h, i) => {
    s.addShape(pres.shapes.RECTANGLE, { x: cx, y: startY, w: colW[i], h: 0.32, fill: { color: C.gold }, line: { color: C.gold } });
    s.addText(h, { x: cx + 0.05, y: startY + 0.02, w: colW[i] - 0.1, h: 0.28, fontSize: 9, bold: true, color: C.navy, align: "center", margin: 0 });
    cx += colW[i];
  });

  const rows = [
    ["Loop Diuretics", "Class I", "Class I", "Universal — 1st line for congestion", "No major RCT (standard of care)"],
    ["SGLT2i (Empa/Dapa)", "Class IIa · B-R", "Class IIa · A ⭐", "Foundational (Harrison's 22E)", "EMPEROR-Preserved, DELIVER"],
    ["MRA (Spironolactone)", "Class IIb · B-R", "Class IIb · B-R", "Weak rec; TOPCAT regional issues", "TOPCAT, ALDO-DHF"],
    ["Finerenone (MRA)", "Not yet included", "Not yet included", "Harrison's 22E acknowledges", "FINEARTS-HF (2024) ⭐"],
    ["ARB (Candesartan)", "Class IIb · B-R", "Class IIb · B-R", "Limited benefit; no mortality effect", "CHARM-Preserved, I-PRESERVE"],
    ["ACE Inhibitor", "Not recommended", "Not recommended", "No HFpEF indication (consensus)", "PEP-CHF (attenuated benefit)"],
    ["ARNi (Sacu/Valsar)", "Class IIb · B-R", "Class IIb", "Borderline (p=0.06 in PARAGON)", "PARAGON-HF, PARAGLIDE-HF"],
    ["Beta-blockers", "No HFpEF indication", "No HFpEF indication", "Ineffective; AF rate control only", "SENIORS (subgroup)"],
    ["GLP-1 Agonists", "Not in guideline", "Not in guideline", "STEP-HFpEF / SUMMIT cited ⭐", "STEP-HFpEF, SUMMIT (2024)"],
    ["Nitrates / PDE5i", "Class III (No Benefit)", "Not recommended", "Consistently shown ineffective", "RELAX trial"],
  ];

  const rowColors = [
    C.green,    // I — Diuretics
    C.teal,     // IIa — SGLT2i
    C.orange,   // IIb — spiro
    "1a6060",   // post-guideline finerenone
    C.orange,   // IIb — ARB
    C.darkgray, // not rec — ACEi
    C.orange,   // IIb — ARNi
    C.darkgray, // no indication
    "1a4a00",   // not yet — GLP1
    C.red,      // Class III
  ];

  rows.forEach((row, ri) => {
    const y = startY + 0.32 + ri * 0.47;
    const bgC = ri % 2 === 0 ? "0e2040" : "0a1830";
    cx = startX;

    colW.forEach((cw, ci) => {
      s.addShape(pres.shapes.RECTANGLE, { x: cx, y, w: cw, h: 0.45, fill: { color: bgC }, line: { color: "1a3a6a", width: 0.3 } });
      if (ci === 0) {
        // drug name with color bar
        s.addShape(pres.shapes.RECTANGLE, { x: cx, y: y + 0.08, w: 0.1, h: 0.28, fill: { color: rowColors[ri] }, line: { color: rowColors[ri] } });
        s.addText(row[ci], { x: cx + 0.16, y: y + 0.08, w: cw - 0.2, h: 0.3, fontSize: 8.5, bold: true, color: C.white, margin: 0 });
      } else {
        const isStrong = row[ci].includes("Class I") && !row[ci].includes("IIa") && !row[ci].includes("IIb");
        const isIIa = row[ci].includes("IIa");
        const isIIb = row[ci].includes("IIb");
        const isIII = row[ci].includes("III") || row[ci].includes("Not recommended");
        const textCol = isStrong ? C.green : isIIa ? C.teal : isIIb ? C.orange : isIII ? "#E57373" : C.offwhite;
        s.addText(row[ci], { x: cx + 0.05, y: y + 0.06, w: cw - 0.1, h: 0.35, fontSize: 8, color: textCol, align: "center", fontFace: "Calibri", margin: 0 });
      }
      cx += cw;
    });
  });

  // Legend
  const legend = [
    { col: C.green, label: "Class I" },
    { col: C.teal, label: "Class IIa" },
    { col: C.orange, label: "Class IIb" },
    { col: C.red, label: "Class III" },
    { col: C.darkgray, label: "No Indication" },
  ];
  let lx = 0.25;
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 5.18, w: 10, h: 0.18, fill: { color: "06111a" }, line: { color: "06111a" } });
  legend.forEach(({ col, label }) => {
    s.addShape(pres.shapes.RECTANGLE, { x: lx, y: 5.2, w: 0.14, h: 0.14, fill: { color: col }, line: { color: col } });
    s.addText(label, { x: lx + 0.17, y: 5.19, w: 1.2, h: 0.16, fontSize: 7.5, color: C.gray, margin: 0 });
    lx += 1.55;
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 10 — KEY GAPS & CLINICAL TAKEAWAYS
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  slideBg(s);
  accentBar(s, C.gold);
  sectionTitle(s, "Key Textbook vs. Guideline Gaps & Clinical Takeaways");
  footerBar(s);

  // Left: Key Gaps
  s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x: 0.35, y: 0.85, w: 4.5, h: 4.43, fill: { color: "0a1a35" }, line: { color: C.gold, width: 0.8 }, rectRadius: 0.08 });
  s.addShape(pres.shapes.RECTANGLE, { x: 0.35, y: 0.85, w: 4.5, h: 0.32, fill: { color: C.gold }, line: { color: C.gold } });
  s.addText("Textbook vs. Guideline Gaps", { x: 0.47, y: 0.87, w: 4.26, h: 0.28, fontSize: 10.5, bold: true, color: C.navy, margin: 0 });

  const gaps = [
    ["EF Threshold", "Older texts: HFpEF ≥ 40%\nGuidelines (ACC/AHA & ESC): ≥ 50%\nTrial evidence often uses ≥ 40% cutoff"],
    ["SGLT2 Inhibitors", "Older textbook editions label as 'emerging'\nHarrison's 22E (2025) = foundational therapy\nESC 2023 gives strongest drug class evidence (IIa, A)"],
    ["Finerenone / MRAs", "All textbooks reflect spironolactone/TOPCAT data\nFINEARTS-HF (2024) is entirely post-guideline\nExpected IIb → IIa upgrade in next update"],
    ["GLP-1 Agonists", "2022 ACC/AHA guideline predates STEP-HFpEF\nHarrison's 22E first to incorporate fully\nNo formal class exists yet — frontier therapy"],
    ["Nitrates/PDE5i", "Some texts are descriptively cautious\nACC/AHA = explicit Class III prohibition\nClinical guidance: follow guideline prohibition"],
  ];

  gaps.forEach(([title, body], i) => {
    const y = 1.26 + i * 0.82;
    s.addShape(pres.shapes.OVAL, { x: 0.45, y: y + 0.06, w: 0.22, h: 0.22, fill: { color: C.gold }, line: { color: C.gold } });
    s.addText((i + 1).toString(), { x: 0.45, y: y + 0.07, w: 0.22, h: 0.2, fontSize: 7, bold: true, color: C.navy, align: "center", margin: 0 });
    s.addText(title, { x: 0.74, y: y + 0.02, w: 3.98, h: 0.22, fontSize: 9, bold: true, color: C.gold, fontFace: "Calibri", margin: 0 });
    s.addText(body, { x: 0.74, y: y + 0.24, w: 3.98, h: 0.52, fontSize: 7.8, color: C.offwhite, fontFace: "Calibri", margin: 0 });
  });

  // Right: Clinical Takeaways
  s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x: 5.15, y: 0.85, w: 4.5, h: 4.43, fill: { color: "001a0d" }, line: { color: C.green, width: 0.8 }, rectRadius: 0.08 });
  s.addShape(pres.shapes.RECTANGLE, { x: 5.15, y: 0.85, w: 4.5, h: 0.32, fill: { color: C.green }, line: { color: C.green } });
  s.addText("Practice-Ready Clinical Takeaways", { x: 5.27, y: 0.87, w: 4.26, h: 0.28, fontSize: 10.5, bold: true, color: C.white, margin: 0 });

  const takeaways = [
    ["Diagnose rigorously", "HFpEF ≥ 50%; use H₂FPEF or HFA-PEFF scoring; obtain exercise hemodynamics in obese or equivocal cases. Exclude mimics."],
    ["Start SGLT2i first", "Empagliflozin or dapagliflozin are the only Class IIa, Level A drugs for HFpEF (ESC 2023). Initiate regardless of diabetes status."],
    ["Control BP aggressively", "Class I across all sources. Target standard guideline BP goals — most impactful disease-modifying strategy available."],
    ["Manage AF actively", "AF worsens HFpEF outcomes. Anticoagulate, rate control, and consider rhythm control early per ACC/AHA IIa."],
    ["Diurese to euvolemia", "Class I for symptoms — use judiciously. Stiff ventricle poorly tolerates over-diuresis → monitor renal function."],
    ["Watch for FINEARTS update", "Finerenone data (2024) will likely upgrade MRA to IIa. Anticipate guideline revision in 2025–2026 update cycle."],
    ["Address obesity", "GLP-1 agonists (semaglutide, tirzepatide) — not yet in guidelines but compelling RCT data. Use shared decision-making in obese HFpEF."],
    ["Avoid nitrates/PDE5i", "ACC/AHA Class III (No Benefit). Do not prescribe nitrates or sildenafil for activity improvement in HFpEF."],
  ];

  takeaways.forEach(([title, body], i) => {
    const y = 1.26 + i * 0.51;
    s.addShape(pres.shapes.ROUNDED_RECTANGLE, { x: 5.25, y, w: 4.3, h: 0.46, fill: { color: "001505" }, line: { color: C.green, width: 0.3 }, rectRadius: 0.05 });
    s.addShape(pres.shapes.RECTANGLE, { x: 5.25, y, w: 0.16, h: 0.46, fill: { color: C.green }, line: { color: C.green } });
    s.addText(title, { x: 5.47, y: y + 0.02, w: 4.0, h: 0.2, fontSize: 8.5, bold: true, color: C.gold, fontFace: "Calibri", margin: 0 });
    s.addText(body, { x: 5.47, y: y + 0.22, w: 4.0, h: 0.2, fontSize: 7.5, color: C.offwhite, fontFace: "Calibri", margin: 0 });
  });
}

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

cd /home/daytona/workspace/hfpef-ppt && node create_hfpef_ppt.js 2>&1

Running Command

ls -lh /home/daytona/workspace/hfpef-ppt/HFpEF_Textbook_vs_Guidelines.pptx

Your presentation is ready (425 KB, 10 slides):

HFpEF Textbook vs Guidelines

Presentation · PPTX


What's in each slide

#SlideContent
1TitleBold HFpEF cover with society logos and source list
2AgendaNumbered topic cards for all 10 slides
3Definition & PathophysiologyEF threshold comparison (ACC/AHA vs textbooks) + 6 mechanism cards (diastolic dysfunction, VV coupling, chronotropic incompetence, inflammation, etc.)
4Diagnosis5-step diagnostic criteria, H₂FPEF vs HFA-PEFF scoring tools, when to escalate to invasive hemodynamics
5SGLT2i & MRAsThree-column comparison (ACC/AHA · ESC · Textbook) for SGLT2i with trial data; MRA section with FINEARTS-HF post-guideline update
6RAAS, ARNi, Beta-blockersFive drug classes with ACC/AHA class badges, ESC class, trial data, and clinical notes
7Emerging TherapiesGLP-1 agonists (STEP-HFpEF, SUMMIT), finerenone (FINEARTS-HF), tirzepatide — all post-guideline
8Non-PharmacologicalSix pillars: BP control, exercise, AF management, weight loss, diuretics, CardioMEMS — each with class of recommendation
9Drug Comparison TableFull 10-drug comparison table with color-coded ACC/AHA · ESC · Textbook classes and key trial references
10Gaps & Takeaways5 key textbook-vs-guideline gaps (left) + 8 practice-ready clinical takeaways (right)
Design: Deep navy background with blue/teal/gold accents — distinct from a generic template. ACC/AHA and ESC are highlighted in gold throughout as the primary authoritative sources.

Explain How you did it

Here's a full walkthrough of exactly what happened, in order.

Phase 1 — Reading the Skill Instructions

Before doing anything else, I read the PPTX skill file at /home/daytona/skills/pptx/SKILL.md, then the detailed pptxgenjs.md tutorial inside it.
This told me:
  • Use PptxGenJS (a Node.js library) to build the file programmatically
  • Coordinate system is in inches on a 10" × 5.625" canvas (16:9)
  • How to add shapes, text boxes, bullets, images, shadows, rounded rectangles
  • Critical pitfalls: shadow offsets must be non-negative, charSpacing not letterSpacing, margin: 0 needed for precise alignment
  • Design philosophy: don't make boring slides — pick a bold palette, use dominance, avoid plain bullets on white

Phase 2 — Design Decisions (Before Writing Any Code)

I chose a deep navy + teal/gold/blue accent palette specifically for a cardiology/clinical topic:
  • #0D2B55 (navy) as the dominant background (~65% visual weight)
  • #F59E0B (gold) for ACC/AHA/ESC authority markers
  • #2196F3 (bright blue) as the primary accent
  • #2E7D32 (green) for Class I recommendations
  • #00838F (teal) for Class IIa
  • #EF6C00 (orange) for Class IIb
  • #E53935 (red) for Class III / No Benefit
This color coding mirrors clinical convention — green = strong, amber = moderate, red = avoid — making the slides immediately intuitive for a clinician.

Phase 3 — Architecture of the JavaScript File

I wrote a single Node.js script (create_hfpef_ppt.js) with this structure:

Helper Functions (reusable building blocks)

slideBg()     → Fills the entire slide with navy
accentBar()   → Thin colored stripe at the very top of every slide
footerBar()   → Dark blue footer with source citations
sectionTitle()→ Slide title + gold underline bar
card()        → Generic content card (shape + title + bullets)
classTag()    → Rounded pill badge (e.g. "Class IIa · B-R")
These ensured visual consistency across all 10 slides without repeating code.

Each Slide Block

Every slide followed the same pattern:
  1. slideBg(s) — paint the background
  2. accentBar(s, color) — top stripe in a slide-specific accent color
  3. sectionTitle(s, "Title") — heading + gold rule
  4. Content (shapes, text, tables, cards) built with exact x/y/w/h coordinates
  5. footerBar(s) — source citations at the bottom

Phase 4 — Slide-by-Slide Content Logic

Each slide was structured around the clinical content from the research phase:
SlideLayout Strategy
1 — TitleLarge bold "HFpEF" text + decorative circles (using OVAL shapes with transparency) + source badges
2 — Agenda10 numbered cards in 2 columns, each with an accent-colored number block
3 — PathophysiologyEF threshold comparison boxes (3 colored rectangles) + 6 mechanism cards in a 2×3 grid
4 — DiagnosisLeft column = 5 numbered diagnostic steps; Right = two separate panels for scoring tools and hemodynamic escalation
5 — SGLT2i/MRAsHorizontal 3-column comparison (ACC/AHA · ESC · Textbook) for SGLT2i; separate MRA strip below with 3 boxes
6 — RAAS/ARNi5 drug cards with per-card colored top bars; ACC + ESC badge pills inside each card
7 — Emerging3 horizontal rows, each spanning full width, with a left-side color bar; ACC/ESC status boxes on the right
8 — Non-Pharm6-cell grid (2 rows × 3 cols), each cell an icon + title + body
9 — Drug TableProgrammatically generated table: header row in gold, alternating row backgrounds, color-coded text per recommendation class, left-side color bar per row
10 — Gaps/TakeawaysSplit: left panel = 5 gap items with numbered circles; right panel = 8 clinical takeaway cards with green left-border bars

Phase 5 — The Drug Comparison Table (Slide 9)

This was the most algorithmically complex slide. Rather than hardcoding a table, I:
  1. Defined column widths as an array [2.2, 1.45, 1.45, 2.0, 2.55]
  2. Looped over header cells to draw gold-filled header rectangles
  3. Defined 10 data rows as a 2D array
  4. Looped over rows, calculating y position from startY + rowIndex × 0.47
  5. Applied conditional text coloring: parsed each cell string to detect "Class I", "IIa", "IIb", "III", "Not recommended" → applied the corresponding color from the palette
  6. Added a left-side color bar per row using the row's own color in a rowColors[] array

Phase 6 — Execution

node create_hfpef_ppt.js
PptxGenJS compiled all the slides and wrote the binary .pptx file directly to disk. The entire 10-slide presentation rendered in under 2 seconds, producing a 425 KB file.

What PptxGenJS Actually Does Under the Hood

A .pptx file is a ZIP archive containing XML files. PptxGenJS generates the correct OpenXML markup for each shape, text run, and slide, then packages it into the ZIP format that PowerPoint, Google Slides, and LibreOffice can open. Every addShape(), addText(), and addImage() call is translated into XML elements like <p:sp>, <a:r>, <a:rPr> etc.

Summary

StepWhat happened
Read SKILL.mdLearned the correct tool, API, and design principles
Designed paletteChose colors clinically meaningful for cardiology + recommendation classes
Built helper functionsEnsured consistent headers, footers, and backgrounds across all slides
Wrote 10 slide blocksEach block used exact inch-based coordinates for precise layout
Algorithmic tableDrug comparison table generated by loop, not hardcoded
Ran Node.jspptxgenjs compiled to binary .pptx in ~1 second
The entire script is ~450 lines of JavaScript — all coordinate math, no templates, built from scratch.
This is a shared conversation. Sign in to Orris to start your own chat.