Compare and contrast type 1 and type to diabetes presentation on set progression and path of physiology and pharmacotherapy

Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Finding Sources
Reading File
Reading File
Reading File
Finding Sources
Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Loading Image
Searching PubMed

type 1 type 2 diabetes mellitus comparison pathophysiology treatment

I now have all the material needed for a thorough, well-sourced comparison. Here is the complete answer:

Type 1 vs Type 2 Diabetes Mellitus: A Comprehensive Comparison


1. Epidemiology at a Glance

FeatureType 1 DM (T1DM)Type 2 DM (T2DM)
Proportion of all DM~5-10%~90-95%
Typical age of onsetChildhood/adolescence (peak 11-12 yrs)Adults ≥45 yrs (increasingly younger)
U.S. prevalence~0.2%~10.5% (27% in adults ≥65 yrs)
Global burden (2021)~8.4 million~529 million
Sex distributionSlight male predominanceEqual M:F

2. Presentation and Onset

Type 1 DM

T1DM often presents abruptly, over days to weeks. The classic triad is prominent from the outset because the absolute absence of insulin allows unchecked hyperglycemia and unopposed catabolism:
  • Polyuria and polydipsia - osmotic diuresis from glucosuria
  • Polyphagia with significant weight loss (fat and protein catabolism)
  • Fatigue, blurred vision
  • Up to ~30% present in diabetic ketoacidosis (DKA) - a life-threatening emergency characterized by anion-gap metabolic acidosis, ketones, and dehydration (Tietz Textbook, 7th ed.)
Blood glucose commonly reaches 300-1200 mg/dL in untreated T1DM. The renal threshold for glycosuria (~200 mg/dL) is exceeded, driving massive urinary glucose loss of >100 g/day in severe cases.

Type 2 DM

T2DM onset is insidious. Classic symptoms (polyuria, polydipsia, weight loss) occur only when hyperglycemia is substantial (>180 mg/dL). Most patients with mild-moderate hyperglycemia remain asymptomatic for years and are detected on routine screening. By the time of diagnosis, up to 50% of beta-cell function may already be lost (Goldman-Cecil Medicine). Other presentations include:
  • Recurrent infections (UTIs, candidiasis, skin infections)
  • Acanthosis nigricans (marker of insulin resistance)
  • Incidental finding on metabolic panel or HbA1c screening
  • First presentation as a complication (neuropathy, retinopathy, nephropathy, ASCVD event)

3. Pathophysiology

Type 1 DM - Autoimmune Destruction of Beta Cells

The fundamental defect is absolute insulin deficiency caused by immune-mediated destruction of pancreatic islet beta cells.
Immune Mechanisms: The pathogenesis is driven by a cell-mediated autoimmune attack (Cellular and Molecular Immunology, Elsevier):
  • CD4+ Th1 cells reactive with islet antigens (including insulin itself) initiate inflammation
  • CD8+ cytotoxic T lymphocytes (CTLs) directly lyse beta cells
  • Macrophages infiltrate the islets, producing cytokines (TNF, IL-1) that are directly toxic to beta cells
  • Autoantibodies against islet cell antigens (ICA), GAD65, insulin (IAA), IA-2, and ZnT8 are detectable years before clinical onset
  • The resulting lesion is termed insulitis - lymphocytic infiltration of islets
Genetic Susceptibility:
  • ~60 susceptibility genes identified; HLA genes on chromosome 6p contribute ~50% of genetic risk
  • 90-95% of Caucasians with T1DM carry HLA-DR3 or DR4 (or both); 40-50% are DR3/DR4 heterozygotes vs. only 5% of healthy controls
  • The DR15-DQ6 haplotype is highly protective (found in only 1% of T1DM patients vs 20% of general population)
  • Non-HLA genes include: insulin gene (chromosome 11), IL2, CD25, IFIH1 (innate antiviral immunity)
  • Twin concordance: 30-40% in identical twins - confirming both genetic and environmental contributors (Goldman-Cecil Medicine)
Environmental Triggers: Epidemics of coxsackievirus B4, mumps, rubella and - more recently - SARS-CoV-2 have been linked to new-onset T1DM. Molecular mimicry is a proposed mechanism: viral peptides resembling beta-cell antigens trigger cross-reactive T cells in genetically susceptible individuals.
Timeline: The autoimmune process begins months to years before symptoms. Because 90%+ of islet mass must be destroyed before clinical disease manifests, there is a long pre-clinical window detectable only by autoantibody screening (Tietz Textbook, 7th ed.).
Metabolic Consequences of Absolute Insulin Deficiency (Guyton & Hall):
  • No peripheral glucose uptake → blood glucose 300-1200 mg/100 mL
  • Unopposed glucagon → accelerated gluconeogenesis + glycogenolysis
  • Lipolysis → free fatty acids → hepatic ketogenesis (acetoacetate, beta-hydroxybutyrate) → DKA
  • Protein catabolism → muscle wasting
  • Osmotic diuresis → dehydration, electrolyte losses

Type 2 DM - Insulin Resistance + Progressive Beta-Cell Failure

T2DM results from an interaction of two primary metabolic defects: impaired insulin secretion and insulin resistance in target tissues. The relative contribution varies between individuals and shifts over the disease course (Goldman-Cecil Medicine).
Insulin Resistance:
  • Predominantly affects liver, skeletal muscle, and adipose tissue
  • Adipose tissue in obese individuals releases excess free fatty acids and pro-inflammatory adipokines (TNF-α, IL-6), which impair insulin signaling via IRS-1 serine phosphorylation
  • This leads to: excess hepatic glucose production (failure to suppress gluconeogenesis), reduced muscle glucose uptake, and impaired adipose triglyceride storage
  • Insulin resistance is the precursor state (metabolic syndrome) and precedes beta-cell failure by years
  • Associated with: hypertension, elevated triglycerides, low HDL - all driven by the same insulin-resistant milieu (Medical Physiology, Boron & Boulpaep)
Progressive Beta-Cell Failure:
  • Initially, beta cells compensate by hypersecretion - leading to hyperinsulinemia
  • Over years: pulsatile and oscillatory insulin release is blunted; first-phase insulin secretion is lost
  • Islet amyloid deposits (IAPP) accumulate, impairing beta-cell function and contributing to apoptosis
  • By diagnosis, ~50% of beta-cell mass is already lost; this decline continues progressively
  • DKA is uncommon in T2DM because residual insulin prevents unchecked ketogenesis, although it can occur under severe physiologic stress
Molecular-level insulin resistance (Medical Physiology): Under normal insulin signaling, the liver activates glycogen synthesis, suppresses gluconeogenesis via PEPCK downregulation, activates glycolysis via fructose-2,6-bisphosphate. In T2DM, all these pathways are blunted - resulting in ongoing hepatic glucose output even in the fed state.
Key contrast: T1DM = absent insulin, T2DM = insufficient effective insulin (relative deficiency + resistance).

4. Disease Progression

StageType 1 DMType 2 DM
Pre-clinicalAutoantibody positivity (yrs before symptoms)Metabolic syndrome, prediabetes (IGT/IFG)
Early diseaseRapid beta-cell loss; insulin required immediatelyCompensated hyperinsulinemia; lifestyle + oral agents
Established diseaseNear-total beta-cell loss; full basal-bolus insulin dependencyProgressive beta-cell failure; stepwise therapy escalation
Late diseaseMicrovascular complications; rare hyperosmolar stateMacro- and microvascular complications; often needs insulin
Acute emergenciesDKA (primary)HHS (primary); DKA can occur under stress

5. Shared Complications

Both types share the same chronic complications driven by chronic hyperglycemia:
  • Microvascular: Diabetic retinopathy (leading preventable blindness cause), nephropathy (CKD/ESRD), peripheral neuropathy, autonomic neuropathy
  • Macrovascular: Accelerated atherosclerosis, coronary artery disease, stroke, peripheral arterial disease
  • Mechanisms include: advanced glycation end-products (AGEs), polyol pathway activation, oxidative stress, VEGF upregulation (retinopathy), and epigenetic modifications
The DCCT trial (T1DM) and the UKPDS (T2DM) both proved that intensive glycemic control (HbA1c ~7%) reduces microvascular complications by ~35% per 1% HbA1c reduction, with legacy effects persisting >10 years (Harrison's Principles, 22e).

6. Pharmacotherapy

Type 1 DM - Insulin is Non-Negotiable

All T1DM patients require lifelong insulin - there is no oral alternative. The beta cells are destroyed; exogenous insulin replacement is the only therapy.
Standard Regimen - Basal-Bolus Insulin:
  • Basal insulin (50% of total daily dose): Long-acting analogues (glargine, detemir, degludec) - covers overnight and fasting glucose
  • Bolus insulin (50% of total daily dose, split across meals): Rapid-acting analogues (lispro, aspart, glulisine) - covers postprandial glucose excursions
Intensive vs. Standard Therapy (DCCT evidence, Lippincott Pharmacology):
  • Intensive = 3+ injections/day + frequent monitoring (or insulin pump/CSII)
  • Target: HbA1c ≤7% (ADA)
  • Intensive therapy reduces retinopathy, nephropathy, and neuropathy significantly
  • Trade-off: 3-fold increase in hypoglycemic episodes
Intensive vs standard therapy: hypoglycemia risk vs complication reduction
Adjunctive Agents for T1DM:
  • Pramlintide (amylin analog): Adjunct to mealtime insulin; delays gastric emptying, reduces postprandial glucagon, improves satiety; requires 50% reduction in mealtime insulin dose to avoid hypoglycemia
  • Off-label SGLT inhibitors (under close monitoring for DKA risk)

Type 2 DM - Stepwise, Individualized, Multi-Drug Approach

The cornerstone is lifestyle modification (diet, exercise, weight loss) + stepwise pharmacotherapy. The ADA recommends metformin as first-line (unless contraindicated), with early combination if needed to achieve HbA1c targets.
Drug Classes (Lippincott Pharmacology + Fuster's Heart):
ClassExamplesMechanismKey Features
BiguanidesMetforminActivates AMPK → reduces hepatic gluconeogenesis, improves peripheral insulin sensitivityFirst-line; no hypoglycemia; weight neutral/loss; ASCVD benefit; hold in AKI (lactic acidosis risk)
Sulfonylureas (SU)Glipizide, glyburide, glimepirideCloses KATP channels on beta cells → insulin secretagogueOlder class; ↓HbA1c 1-2%; hypoglycemia + weight gain risks; accelerates beta-cell decline
MeglitinidesRepaglinide, nateglinideKATP channel closure (shorter-acting than SUs)Postprandial regulators; useful with irregular meal timing; hypoglycemia risk
TZDs (Thiazolidinediones)PioglitazonePPARγ agonist → insulin sensitizer in adipose, liver, musclePioglitazone has CV benefit; weight gain + fluid retention; avoid in CHF; fracture risk
Alpha-glucosidase inhibitorsAcarbose, miglitolInhibits intestinal alpha-glucosidase → slower carb absorptionNo hypoglycemia; GI side effects (flatulence, diarrhea)
DPP-4 inhibitorsSitagliptin, saxagliptinBlock DPP-4 → ↑ GLP-1/GIP levels → glucose-dependent insulin releaseWeight neutral; no hypoglycemia; modest HbA1c reduction
GLP-1 receptor agonistsSemaglutide, liraglutide, dulaglutideMimic GLP-1 → glucose-dependent insulin secretion, suppressed glucagon, delayed gastric emptying, satietyWeight loss; ASCVD + renal protection (dulaglutide, liraglutide, semaglutide); injectable (semaglutide also oral); GI side effects
SGLT2 inhibitorsEmpagliflozin, dapagliflozin, canagliflozinBlock SGLT2 in proximal tubule → glycosuriaWeight loss; BP reduction; HF + renal protection; risk of DKA (rare), UTI/genital infections
InsulinAll typesExogenous replacementAdded when oral/injectable agents fail to control HbA1c; eventually required in many as beta-cell function declines
For T2DM with established ASCVD or HF: GLP-1 agonists (cardiorenal benefit) and SGLT2 inhibitors (heart failure + renal protection) are preferred add-ons regardless of HbA1c. A 2025 network meta-analysis (PMID 39932725) confirms differential SGLT2i vs GLP-1RA benefits based on baseline renal function.

7. Summary Comparison Table

DomainType 1 DMType 2 DM
Core defectAbsolute insulin deficiency (autoimmune)Insulin resistance + progressive relative deficiency
Beta cellsDestroyed (insulitis)Initially hyperplastic, then fail progressively
GeneticsHLA-DR3/DR4; ~60 genes; 30-40% twin concordancePolygenic; strong family history; no HLA link
AutoimmunityYes - T cells, autoantibodies (GAD65, IAA, ICA, IA-2)No (rare LADA exception)
Onset speedAcute (days-weeks)Insidious (years)
AgeUsually <30 yrs (peaks 11-12 yrs)Usually >40 yrs (now younger with obesity)
Body habitusNormal or thinUsually overweight/obese
Acute emergencyDKA (common)HHS (primary); DKA (rare/stress)
C-peptideAbsent/very lowPresent (may be elevated early)
PharmacotherapyInsulin always required + pramlintide adjunctLifestyle → metformin → combinations → insulin
PreventionNo proven primary preventionLifestyle modification prevents/delays T2DM
Ketosis riskHigh (without insulin)Low (residual insulin suppresses ketogenesis)

Sources: Cellular and Molecular Immunology (Elsevier) | Guyton & Hall Textbook of Medical Physiology | Goldman-Cecil Medicine, International Ed. | Lippincott Illustrated Reviews: Pharmacology | Fuster and Hurst's The Heart, 15th Ed. | Harrison's Principles of Internal Medicine, 22e | Tietz Textbook of Laboratory Medicine, 7th Ed. | Medical Physiology (Boron & Boulpaep)

Modified this PDF into more detailed one

Reading File
Reading File
Running Command

python -m markitdown /home/daytona/workspace/attachments/94976a8e-2f77-499c-9bfa…

Reading File
Running Command

pip install markitdown -q 2>&1 | tail -3 && python -m markitdown /home/daytona/w…

Reading File
Running Command

pip install markitdown[pptx] -q 2>&1 | tail -3 && python -m markitdown /home/day…

Running Command

pip install "markitdown[pptx]" -q 2>&1 | tail -3 && python -c " from markitdown …

Finding Sources
Finding Sources
Running Command

mkdir -p /home/daytona/workspace/adhf-pptx && ls /home/daytona/workspace/adhf-pp…

Reading File
Finding Sources
Writing File

~/adhf-pptx/build.js

const pptxgen = require("pptxgenjs");
const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "ADHF Case Presentation – Enhanced";
pres.author = "Juveriya Begum, PharmD Intern";

// ─── COLOUR PALETTE ───────────────────────────────────────────────
const C = {
  navy:    "0A1628",   // dominant dark
  blue:    "1A3F72",   // section bar
  teal:    "0F7EB0",   // accent
  ltBlue:  "D6E9F8",   // light fill
  white:   "FFFFFF",
  offWhite:"F4F8FD",
  red:     "C0392B",
  orange:  "E67E22",
  green:   "1E8449",
  gold:    "D4AC0D",
  text:    "1A1A2E",
  muted:   "5D6D7E",
};

// ─── HELPERS ──────────────────────────────────────────────────────
function titleBar(slide, title, sub) {
  // full-width navy header
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 0.72, fill: { color: C.navy }, line: { color: C.navy } });
  slide.addText(title, { x: 0.3, y: 0, w: 9.4, h: 0.72, fontSize: 20, bold: true, color: C.white, valign: "middle", margin: 0 });
  if (sub) slide.addText(sub, { x: 0.3, y: 0.74, w: 9.4, h: 0.28, fontSize: 9.5, color: C.teal, italic: true, margin: 0 });
  // teal accent line
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0.72, w: 10, h: 0.04, fill: { color: C.teal }, line: { color: C.teal } });
}

function sectionLabel(slide, text, x, y, w, color) {
  slide.addShape(pres.shapes.RECTANGLE, { x, y, w, h: 0.3, fill: { color: color || C.blue }, line: { color: color || C.blue } });
  slide.addText(text, { x, y, w, h: 0.3, fontSize: 9.5, bold: true, color: C.white, valign: "middle", align: "center", margin: 0 });
}

function card(slide, x, y, w, h, fillColor) {
  slide.addShape(pres.shapes.ROUNDED_RECTANGLE, {
    x, y, w, h,
    fill: { color: fillColor || C.white },
    line: { color: "D0DCE8", pt: 0.8 },
    rectRadius: 0.08,
    shadow: { type: "outer", color: "000000", blur: 5, offset: 2, angle: 135, opacity: 0.1 }
  });
}

function bullet(text, lvl, bold, color) {
  return { text, options: { bullet: true, indentLevel: lvl || 0, bold: bold || false, color: color || C.text, breakLine: true, fontSize: 10.5 } };
}

function kv(slide, label, value, x, y, w, bgLabel, bgVal) {
  slide.addShape(pres.shapes.RECTANGLE, { x, y, w: w * 0.38, h: 0.38, fill: { color: bgLabel || C.blue }, line: { color: bgLabel || C.blue } });
  slide.addText(label, { x, y, w: w * 0.38, h: 0.38, fontSize: 9, bold: true, color: C.white, valign: "middle", align: "center", margin: 0 });
  slide.addShape(pres.shapes.RECTANGLE, { x: x + w * 0.38, y, w: w * 0.62, h: 0.38, fill: { color: bgVal || C.offWhite }, line: { color: "D0DCE8" } });
  slide.addText(value, { x: x + w * 0.38, y, w: w * 0.62, h: 0.38, fontSize: 9.5, color: C.text, valign: "middle", margin: [0, 4, 0, 4] });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE
// ═══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  // full-bleed dark background
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.navy }, line: { color: C.navy } });
  // teal accent left bar
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 0.12, h: 5.625, fill: { color: C.teal }, line: { color: C.teal } });
  // gold accent bottom stripe
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 5.3, w: 10, h: 0.325, fill: { color: C.blue }, line: { color: C.blue } });

  // large faded circle decoration
  s.addShape(pres.shapes.OVAL, { x: 6.5, y: -0.5, w: 4.5, h: 4.5, fill: { color: "1A3F72" }, line: { color: "1A3F72" }, transparency: 60 });

  s.addText("CASE PRESENTATION", { x: 0.5, y: 0.8, w: 9, h: 0.5, fontSize: 12, bold: true, color: C.teal, charSpacing: 5, margin: 0 });
  s.addText("Acute Decompensated\nHeart Failure (ADHF)", { x: 0.5, y: 1.4, w: 8.5, h: 1.6, fontSize: 32, bold: true, color: C.white, valign: "top" });
  s.addText("in a Patient with Hypertension & HFrEF", { x: 0.5, y: 3.1, w: 8.5, h: 0.5, fontSize: 14, color: C.ltBlue, italic: true });

  // divider
  s.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: 3.72, w: 4, h: 0.04, fill: { color: C.teal }, line: { color: C.teal } });

  s.addText("Presented By: Juveriya Begum", { x: 0.5, y: 3.85, w: 9, h: 0.32, fontSize: 11, bold: true, color: C.white, margin: 0 });
  s.addText("PharmD Intern  |  ID: 170324882015", { x: 0.5, y: 4.18, w: 9, h: 0.28, fontSize: 9.5, color: C.muted, margin: 0 });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 2 — INTRODUCTION & BACKGROUND
// ═══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.offWhite }, line: { color: C.offWhite } });
  titleBar(s, "Introduction — Heart Failure & ADHF", "Definitions, Classification, and Clinical Context");

  // Left column – definitions
  card(s, 0.18, 1.1, 4.55, 4.1, C.white);
  sectionLabel(s, "HEART FAILURE — DEFINITIONS", 0.18, 1.1, 4.55, C.navy);
  s.addText([
    bullet("Heart failure (HF) is a clinical syndrome in which the heart cannot pump sufficient blood to meet metabolic demands, or does so only at elevated filling pressures.", 0, false),
    bullet("HFrEF (Heart Failure with reduced Ejection Fraction): EF ≤ 40%; reflects systolic dysfunction — the ventricle contracts poorly.", 0, false),
    bullet("HFpEF (Heart Failure with preserved EF): EF ≥ 50%; diastolic dysfunction predominates — stiff ventricle, impaired relaxation.", 0, false),
    bullet("HFmrEF: EF 41–49%; intermediate/borderline category.", 0, false),
    bullet("ADHF: Sudden or gradual worsening of HF signs/symptoms — dyspnea, orthopnea, volume overload — necessitating urgent/emergent hospital care.", 0, true, C.blue),
    bullet("ADHF accounts for >1 million hospitalizations per year in the United States.", 0, false),
    bullet("30-day readmission rate: ~25%; 1-year mortality: ~20%.", 0, false, C.red),
  ], { x: 0.25, y: 1.45, w: 4.4, h: 3.65, fontSize: 10, color: C.text, valign: "top" });

  // Right column
  card(s, 4.9, 1.1, 4.95, 1.85, C.white);
  sectionLabel(s, "NYHA FUNCTIONAL CLASSIFICATION", 4.9, 1.1, 4.95, C.teal);
  const nyha = [
    ["I", "No symptoms with ordinary activity"],
    ["II", "Slight limitation; comfortable at rest"],
    ["III", "Marked limitation; comfortable only at rest"],
    ["IV", "Symptoms at rest; unable to perform any activity"],
  ];
  nyha.forEach(([cls, desc], i) => {
    const clsColor = ["1E8449", "D4AC0D", "E67E22", "C0392B"][i];
    s.addShape(pres.shapes.RECTANGLE, { x: 4.9, y: 1.43 + i * 0.37, w: 0.45, h: 0.35, fill: { color: clsColor }, line: { color: clsColor } });
    s.addText(`Class ${cls}`, { x: 4.9, y: 1.43 + i * 0.37, w: 0.45, h: 0.35, fontSize: 7.5, bold: true, color: C.white, align: "center", valign: "middle", margin: 0 });
    s.addText(desc, { x: 5.38, y: 1.43 + i * 0.37, w: 4.4, h: 0.35, fontSize: 9.5, color: C.text, valign: "middle", margin: [0, 2] });
  });

  card(s, 4.9, 3.08, 4.95, 2.12, C.white);
  sectionLabel(s, "COMMON PRECIPITATING FACTORS", 4.9, 3.08, 4.95, C.orange);
  s.addText([
    bullet("Medication / dietary non-adherence ← THIS CASE", 0, true, C.red),
    bullet("Uncontrolled hypertension", 0),
    bullet("Acute coronary syndrome / ischemia", 0),
    bullet("Arrhythmias (AF, VT)", 0),
    bullet("Infection (pneumonia, sepsis)", 0),
    bullet("Renal dysfunction / volume overload", 0),
    bullet("NSAIDs, TZDs, certain antidepressants, cancer therapies", 0, false, C.orange),
  ], { x: 4.97, y: 3.41, w: 4.8, h: 1.72, fontSize: 9.5, color: C.text, valign: "top" });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 3 — PATHOPHYSIOLOGY OF HFrEF
// ═══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.offWhite }, line: { color: C.offWhite } });
  titleBar(s, "Pathophysiology of HFrEF & ADHF", "Neurohormonal Activation, Hemodynamic Derangement, and Congestion");

  // three column flow
  const cols = [
    { x: 0.18, color: C.navy, title: "CARDIAC REMODELING", items: [
      "Initial insult (HTN, IHD, idiopathic) → myocyte injury",
      "Compensatory ventricular hypertrophy & dilation",
      "↓ Contractility → ↓ EF → ↓ Stroke Volume (SV)",
      "Frank-Starling mechanism initially compensates",
      "↑ End-diastolic volume → ↑ wall stress → further injury",
      "Mitral annular dilation → functional MR → worsens CO",
    ]},
    { x: 3.44, color: C.blue, title: "NEUROHORMONAL ACTIVATION", items: [
      "↓ CO → baroreceptor-mediated SNS activation",
      "RAAS: ↑ renin → ↑ Ang II → vasoconstriction + aldosterone",
      "Aldosterone: Na⁺/H₂O retention → volume overload",
      "ADH (vasopressin): free water retention → hyponatremia",
      "Natriuretic peptides (BNP, NT-proBNP): counter-regulatory — ↑ in HF, useful as biomarkers",
      "Endothelin-1, cytokines (TNF-α, IL-6): maladaptive — promote fibrosis & apoptosis",
    ]},
    { x: 6.7, color: C.teal, title: "ACUTE DECOMPENSATION", items: [
      "Precipitant (non-adherence here) overwhelms compensation",
      "Abrupt ↑ preload / afterload → ↑ filling pressures",
      "Pulmonary venous congestion → pulmonary edema",
      "Systemic venous congestion → JVP ↑, peripheral edema",
      "Reduced organ perfusion → ↑ creatinine, hepatic congestion",
      "Cardiorenal syndrome: worsening renal function → loop diuretic resistance",
    ]},
  ];

  cols.forEach(({ x, color, title, items }) => {
    card(s, x, 1.1, 3.1, 4.1, C.white);
    sectionLabel(s, title, x, 1.1, 3.1, color);
    s.addText(
      items.map((t, i) => ({ text: `${i + 1}. ${t}`, options: { breakLine: true, fontSize: 9.5, color: C.text } })),
      { x: x + 0.08, y: 1.45, w: 2.94, h: 3.65, valign: "top" }
    );
  });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 4 — PATIENT PROFILE (Subjective)
// ═══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.offWhite }, line: { color: C.offWhite } });
  titleBar(s, "Subjective Data — Patient Profile", "Demographic Information and Case Context");

  const demo = [
    ["Patient Name", "K RAMCHANDER"],
    ["Age", "60 Years 5 Months 16 Days"],
    ["Gender", "Male (Adult)"],
    ["Date of Admission", "17 / 06 / 2026"],
    ["Department", "General Medicine – Unit III"],
    ["Referral", "Cardiology"],
    ["Weight", "Not recorded in chart"],
  ];

  card(s, 0.18, 1.05, 5.5, 4.25, C.white);
  sectionLabel(s, "DEMOGRAPHIC DETAILS", 0.18, 1.05, 5.5, C.navy);
  demo.forEach(([lbl, val], i) => {
    kv(s, lbl, val, 0.25, 1.42 + i * 0.52, 5.35, C.blue, C.offWhite);
  });

  card(s, 5.85, 1.05, 3.98, 4.25, C.white);
  sectionLabel(s, "CHIEF COMPLAINTS & HPI", 5.85, 1.05, 3.98, C.red);
  s.addText([
    bullet("Shortness of breath (SOB) — gradual onset, 2 days prior to admission", 0, true, C.red),
    bullet("Chest pain — since morning of admission day", 0, true, C.red),
    { text: "", options: { breakLine: true } },
    bullet("HPI: Apparently asymptomatic 2 days before admission; developed insidious-onset, progressively worsening breathlessness", 0),
    bullet("Orthopnea present (unable to lie flat)", 0),
    bullet("Bilateral pedal edema and facial puffiness", 0),
    bullet("No ↓ urine output, no cough, no loose stools, no vomiting", 0),
    { text: "", options: { breakLine: true } },
    bullet("CLINICAL SIGNIFICANCE: Classic ADHF presentation — congestion-forward phenotype with high preload and preserved BP.", 0, true, C.teal),
  ], { x: 5.92, y: 1.42, w: 3.82, h: 3.78, fontSize: 9.5, color: C.text, valign: "top" });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 5 — PAST HISTORY / PMH
// ═══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.offWhite }, line: { color: C.offWhite } });
  titleBar(s, "Medical History & Background", "Past History, Personal History, and Clinical Relevance");

  card(s, 0.18, 1.05, 4.65, 4.25, C.white);
  sectionLabel(s, "PAST MEDICAL HISTORY", 0.18, 1.05, 4.65, C.navy);
  const pmh = [
    ["Hypertension (HTN)", "Known for 6–7 years; a major driver of HFrEF development via pressure overload and LV remodeling."],
    ["HFrEF (EF 32%)", "Severely reduced EF; Class III–IV symptom burden expected. EF <35% meets criteria for ICD/CRT consideration."],
    ["Drug Non-Adherence", "Identified as the precipitating cause of current ADHF decompensation — critical pharmacist intervention point."],
    ["Non-Diabetic", "Absence of T2DM simplifies glycemic management; however SGLT2i (Dapagliflozin) still indicated for HFrEF mortality benefit."],
    ["Non-Hypothyroid", "Thyroid dysfunction excluded as contributor to HF."],
    ["NKDA", "No Known Drug Allergies."],
  ];
  pmh.forEach(([cond, detail], i) => {
    s.addShape(pres.shapes.RECTANGLE, { x: 0.25, y: 1.44 + i * 0.61, w: 1.5, h: 0.52, fill: { color: i < 3 ? C.red : C.blue }, line: { color: i < 3 ? C.red : C.blue } });
    s.addText(cond, { x: 0.25, y: 1.44 + i * 0.61, w: 1.5, h: 0.52, fontSize: 8.5, bold: true, color: C.white, align: "center", valign: "middle", margin: 2 });
    s.addText(detail, { x: 1.82, y: 1.44 + i * 0.61, w: 2.95, h: 0.52, fontSize: 8.5, color: C.text, valign: "middle", margin: [0, 3] });
  });

  card(s, 5.0, 1.05, 4.82, 2.0, C.white);
  sectionLabel(s, "PERSONAL / SOCIAL HISTORY", 5.0, 1.05, 4.82, C.teal);
  const social = [
    ["Alcohol", "Non-alcoholic"],
    ["Smoking", "Non-smoker"],
    ["Addictions", "None"],
    ["Diet Adherence", "Likely poor (precipitated ADHF)"],
  ];
  social.forEach(([lbl, val], i) => {
    kv(s, lbl, val, 5.07, 1.42 + i * 0.39, 4.67, C.teal);
  });

  card(s, 5.0, 3.2, 4.82, 2.1, C.white);
  sectionLabel(s, "CLINICAL SIGNIFICANCE", 5.0, 3.2, 4.82, C.orange);
  s.addText([
    bullet("HTN + poor medication adherence = classic driver of ADHF in HFrEF patients.", 0, true, C.orange),
    bullet("EF 32% places this patient in the highest-risk HFrEF stratum. GDMT (ACEI + MRA + SGLT2i ± beta-blocker) is essential to slow progression and reduce mortality.", 0),
    bullet("Non-diabetic status: Dapagliflozin is still guideline-indicated for HFrEF regardless of diabetes status (DAPA-HF trial, 2019).", 0, false, C.teal),
    bullet("Adherence counseling at discharge is a priority intervention — directly addresses the precipitating cause.", 0, false, C.red),
  ], { x: 5.07, y: 3.55, w: 4.67, h: 1.65, fontSize: 9, color: C.text, valign: "top" });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 6 — OBJECTIVE DATA (Vitals + O/E)
// ═══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.offWhite }, line: { color: C.offWhite } });
  titleBar(s, "Objective Data — Vitals & Examination", "Hospital Course Day 1–5 and Clinical Findings on Admission");

  // Admission O/E
  card(s, 0.18, 1.05, 4.55, 2.55, C.white);
  sectionLabel(s, "ON EXAMINATION — ADMISSION (Day 1)", 0.18, 1.05, 4.55, C.navy);
  const oe = [
    ["Sensorium", "Conscious, oriented"],
    ["BP", "160/90 mmHg — HYPERTENSIVE URGENCY"],
    ["SpO2", "94% on room air → hypoxemic"],
    ["CVS", "S1 S2 audible (+)"],
    ["RS", "Bilateral basal crepitations — pulmonary congestion"],
    ["Abdomen", "Soft, non-tender"],
    ["CNS", "Pupils 3mm, bilaterally equal, reactive"],
    ["Extremities", "Bilateral pedal edema (+) — venous congestion"],
  ];
  oe.forEach(([lbl, val], i) => {
    const isAbnormal = ["BP","SpO2","RS","Extremities"].includes(lbl);
    kv(s, lbl, val, 0.25, 1.42 + i * 0.27, 4.4, isAbnormal ? C.red : C.blue, isAbnormal ? "FEF0EF" : C.offWhite);
  });

  // Serial vitals
  card(s, 0.18, 3.73, 9.64, 1.65, C.white);
  sectionLabel(s, "SERIAL VITALS — HOSPITAL COURSE (Days 1–5)", 0.18, 3.73, 9.64, C.teal);

  const headers = ["Vitals", "Day 1 (17/6)", "Day 2 (18/6)", "Day 3 (19/6)", "Day 4 (20/6)", "Day 5 (21/6)"];
  const rows = [
    ["Temperature", "Afebrile", "Afebrile", "Afebrile", "Afebrile", "Afebrile"],
    ["BP (mmHg)", "160/90 ⬆", "NR", "120/80 ✓", "120/80 ✓", "NR"],
    ["SpO2 (% RA)", "94 ⬇", "97", "92 ⬇", "99(?)", "97"],
    ["RS Findings", "RAE+, bibasal crepts", "BAE+", "BAE+", "BAE+, clearing", "RAE+, bibasal crepts, ↓ L sounds"],
  ];

  const colW = [1.55, 1.42, 1.42, 1.42, 1.42, 1.45];
  const startX = 0.2;
  let cx = startX;
  // header row
  headers.forEach((h, i) => {
    s.addShape(pres.shapes.RECTANGLE, { x: cx, y: 4.06, w: colW[i], h: 0.28, fill: { color: C.navy }, line: { color: C.navy } });
    s.addText(h, { x: cx, y: 4.06, w: colW[i], h: 0.28, fontSize: 8, bold: true, color: C.white, align: "center", valign: "middle", margin: 0 });
    cx += colW[i];
  });
  // data rows
  rows.forEach((row, ri) => {
    cx = startX;
    row.forEach((cell, ci) => {
      const isAbnormal = cell.includes("⬆") || cell.includes("⬇") || cell.includes("crepts") || cell.includes("↓");
      s.addShape(pres.shapes.RECTANGLE, { x: cx, y: 4.37 + ri * 0.28, w: colW[ci], h: 0.26, fill: { color: isAbnormal ? "FEF0EF" : (ri % 2 === 0 ? C.offWhite : C.white) }, line: { color: "D0DCE8" } });
      s.addText(cell, { x: cx, y: 4.37 + ri * 0.28, w: colW[ci], h: 0.26, fontSize: 7.5, color: isAbnormal ? C.red : C.text, align: "center", valign: "middle", margin: 0 });
      cx += colW[ci];
    });
  });

  // Right — clinical interpretation
  card(s, 4.9, 1.05, 4.92, 2.55, C.white);
  sectionLabel(s, "CLINICAL INTERPRETATION", 4.9, 1.05, 4.92, C.orange);
  s.addText([
    bullet("BP 160/90: Elevated afterload worsens cardiac output; urgent BP control with ACEI/vasodilators is key.", 0, true, C.red),
    bullet("SpO2 94% RA: Indicative of pulmonary venous congestion / mild pulmonary edema. Supplemental O2 + IV diuresis warranted.", 0),
    bullet("Bibasal creptitations: Consistent with bilateral pulmonary congestion from elevated LV filling pressures.", 0),
    bullet("Pedal edema: Systemic venous congestion; raised JVP expected. Right-heart involvement.", 0),
    bullet("Afebrile: Infectious precipitant less likely, although Augmentin prescribed for possible respiratory infection.", 0, false, C.muted),
    bullet("Day 3 SpO2 dip (92%): Suggests ongoing or worsening congestion despite therapy — diuretic dose may need upward titration.", 0, false, C.orange),
    bullet("Day 5 RS findings: Persistent crepts + ↓ L breath sounds → possible developing pleural effusion; needs imaging review.", 0, false, C.red),
  ], { x: 4.97, y: 1.42, w: 4.78, h: 2.1, fontSize: 9, color: C.text, valign: "top" });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 7 — LAB INVESTIGATIONS
// ═══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.offWhite }, line: { color: C.offWhite } });
  titleBar(s, "Laboratory Investigations", "Sampled 17/6/2026 – 19/6/2026 | Interpretation & Clinical Relevance");

  const labs = [
    ["Hemoglobin (Hb)", "16 g/dL", "13.0–17.0 g/dL", "Normal", C.green, "Normal; no anemia-driven HF exacerbation."],
    ["Total WBC Count", "10.2 ×10³/µL", "4–11 ×10³/µL", "Normal", C.green, "No leukocytosis; low-grade infection still possible."],
    ["MCV", "89.4 fL", "83–101 fL", "Normal", C.green, "Normocytic; no nutritional deficiency."],
    ["Platelet Count", "1.73 lakh/µL", "1.5–4.5 lakh/µL", "Normal", C.green, "Adequate; bleeding risk from heparin manageable."],
    ["Serum Na⁺", "135 mEq/L", "136–145 mEq/L", "Low-normal", C.orange, "At lower limit; hyponatremia in HF signals poor prognosis. Monitor with diuresis."],
    ["Serum K⁺", "4.99 mEq/L", "3.5–5.0 mEq/L", "Upper-normal ⚠", C.orange, "High-normal with ACEI + MRA combo. Risk of hyperkalemia — monitor every 48–72h."],
    ["Serum Cl⁻", "109 mEq/L", "98–106 mEq/L", "Slightly high", C.orange, "Mild hyperchloremia; consistent with volume state."],
    ["Blood Urea", "35.5 mg/dL", "15–40 mg/dL", "Normal", C.green, "Within range; no overt uremia. Elevated BUN:Cr would suggest pre-renal AKI."],
    ["Serum Creatinine", "1.65 mg/dL", "0.6–1.2 mg/dL", "HIGH ⬆", C.red, "Mildly elevated → CKD or pre-renal AKI. Impacts dosing of Dapagliflozin, Heparin, Augmentin."],
    ["Serum Albumin", "3.5 g/dL", "3.5–5.5 g/dL", "Low-normal", C.orange, "Borderline; hypoalbuminemia worsens edema and drug protein binding."],
    ["SGOT", "16 U/L", "< 40 U/L", "Normal", C.green, "No hepatic congestion suggested."],
  ];

  // header
  card(s, 0.18, 1.05, 9.64, 4.35, C.white);
  const hdrCols = [["TEST", 2.3], ["RESULT", 1.0], ["REFERENCE", 1.2], ["STATUS", 1.0], ["CLINICAL SIGNIFICANCE", 3.94]];
  let hx = 0.25;
  hdrCols.forEach(([h, w]) => {
    s.addShape(pres.shapes.RECTANGLE, { x: hx, y: 1.1, w, h: 0.3, fill: { color: C.navy }, line: { color: C.navy } });
    s.addText(h, { x: hx, y: 1.1, w, h: 0.3, fontSize: 8.5, bold: true, color: C.white, align: "center", valign: "middle", margin: 0 });
    hx += w;
  });

  labs.forEach(([test, result, ref, status, statusColor, sig], ri) => {
    const y = 1.43 + ri * 0.35;
    const rowBg = ri % 2 === 0 ? C.offWhite : C.white;
    const widths = [2.3, 1.0, 1.2, 1.0, 3.94];
    const values = [test, result, ref, status, sig];
    let rx = 0.25;
    widths.forEach((w, ci) => {
      const bg = ci === 3 ? undefined : rowBg;
      s.addShape(pres.shapes.RECTANGLE, { x: rx, y, w, h: 0.32, fill: { color: ci === 3 ? statusColor + "22" : bg }, line: { color: "E0E0E0" } });
      s.addText(values[ci], { x: rx, y, w, h: 0.32, fontSize: ci === 4 ? 8 : 8.5, color: ci === 3 ? statusColor : (ci === 1 && statusColor === C.red ? C.red : C.text), bold: ci === 3, align: ci === 4 ? "left" : "center", valign: "middle", margin: [0, ci === 4 ? 4 : 0] });
      rx += w;
    });
  });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 8 — ECG FINDINGS
// ═══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.offWhite }, line: { color: C.offWhite } });
  titleBar(s, "ECG Findings", "Electrocardiographic Interpretation and Clinical Correlation");

  // ECG summary card
  card(s, 0.18, 1.05, 3.8, 4.25, C.white);
  sectionLabel(s, "ECG PARAMETERS", 0.18, 1.05, 3.8, C.navy);
  const ecgParams = [
    ["Heart Rate", "64 bpm"],
    ["Rhythm", "Sinus rhythm"],
    ["PR Interval", "Normal"],
    ["QRS Complex", "Widened (>120 ms)"],
    ["Axis", "Left axis deviation"],
    ["ST-T Changes", "Secondary to LBBB"],
    ["Diagnosis", "Complete LBBB"],
    ["Minnesota Code", "7-1-0 (I, V1, V6)"],
  ];
  ecgParams.forEach(([lbl, val], i) => {
    const isKey = ["Diagnosis","QRS Complex"].includes(lbl);
    kv(s, lbl, val, 0.25, 1.42 + i * 0.46, 3.66, isKey ? C.red : C.navy, isKey ? "FEF0EF" : C.offWhite);
  });

  card(s, 4.15, 1.05, 5.68, 4.25, C.white);
  sectionLabel(s, "LBBB — PATHOPHYSIOLOGY & CLINICAL SIGNIFICANCE", 4.15, 1.05, 5.68, C.red);
  s.addText([
    { text: "What is Complete LBBB?", options: { bold: true, color: C.navy, breakLine: true, fontSize: 10.5 } },
    bullet("Normal conduction: Impulse from AV node travels simultaneously down left and right bundle branches.", 0),
    bullet("LBBB: Left bundle branch blocked → LV activated abnormally, late, and via slower cell-to-cell conduction (not fast Purkinje system).", 0),
    bullet("Result: Widened QRS (>120 ms), characteristic M-shaped notching in V5–V6, broad S in V1.", 0, false, C.teal),
    { text: "", options: { breakLine: true } },
    { text: "Clinical Significance in This Patient:", options: { bold: true, color: C.navy, breakLine: true, fontSize: 10.5 } },
    bullet("Consistent with known HFrEF (EF 32%) — LBBB commonly seen with structural heart disease and dilated cardiomyopathy.", 0),
    bullet("LBBB causes ventricular dyssynchrony — LV and RV contract out of phase, reducing mechanical efficiency → further ↓ EF.", 0, false, C.red),
    bullet("LBBB + EF ≤ 35% + NYHA II–III: Patient meets criteria for Cardiac Resynchronization Therapy (CRT) evaluation — should be discussed with cardiology.", 0, true, C.orange),
    bullet("LBBB masks ischemic ST-T changes — serial ECGs and troponin levels are essential to rule out concurrent ACS.", 0, false, C.red),
    bullet("Rate of 64 bpm appropriate — chronotropic incompetence and bradycardia can worsen CO in HFrEF.", 0),
  ], { x: 4.22, y: 1.42, w: 5.52, h: 3.78, fontSize: 9.5, color: C.text, valign: "top" });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 9 — ASSESSMENT
// ═══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.offWhite }, line: { color: C.offWhite } });
  titleBar(s, "Assessment — Clinical Summary", "Diagnosis, Problem List, and Severity Stratification");

  // Summary box
  card(s, 0.18, 1.05, 9.64, 1.0, C.navy);
  s.addText(
    "60-year-old male | Known HTN (6–7 yrs) | Known HFrEF (EF 32%) | LBBB on ECG | Creatinine 1.65 mg/dL | Admitted with ADHF secondary to DRUG NON-ADHERENCE",
    { x: 0.28, y: 1.1, w: 9.44, h: 0.85, fontSize: 10, color: C.white, bold: false, valign: "middle", italic: false }
  );

  // Problem list
  card(s, 0.18, 2.15, 4.55, 3.15, C.white);
  sectionLabel(s, "PROBLEM LIST", 0.18, 2.15, 4.55, C.red);
  const problems = [
    ["P1", "ADHF (acute decompensation)", C.red, "Primary admitting diagnosis"],
    ["P2", "HFrEF — EF 32%", C.red, "Chronic, underlying structural HF"],
    ["P3", "Hypertension", C.orange, "BP 160/90 on admission — poorly controlled"],
    ["P4", "LBBB (Complete)", C.orange, "Ventricular dyssynchrony; CRT candidate?"],
    ["P5", "Mild Renal Impairment", C.orange, "Cr 1.65 — pre-renal vs CKD; drug dosing impact"],
    ["P6", "Hyperkalemia Risk", C.orange, "K⁺ 4.99 on ACEI + MRA — monitor closely"],
    ["P7", "Drug Non-Adherence", C.red, "Precipitating cause of this admission"],
    ["P8", "Possible Resp. Infection", C.muted, "Augmentin prescribed; clinical correlation needed"],
  ];
  problems.forEach(([code, prob, col, note], i) => {
    s.addShape(pres.shapes.RECTANGLE, { x: 0.25, y: 2.52 + i * 0.34, w: 0.38, h: 0.3, fill: { color: col }, line: { color: col } });
    s.addText(code, { x: 0.25, y: 2.52 + i * 0.34, w: 0.38, h: 0.3, fontSize: 8, bold: true, color: C.white, align: "center", valign: "middle", margin: 0 });
    s.addText(`${prob}`, { x: 0.66, y: 2.52 + i * 0.34, w: 2.0, h: 0.3, fontSize: 8.5, bold: true, color: C.text, valign: "middle", margin: [0, 2] });
    s.addText(note, { x: 2.7, y: 2.52 + i * 0.34, w: 1.96, h: 0.3, fontSize: 7.5, color: C.muted, valign: "middle", italic: true, margin: [0, 2] });
  });

  // Risk stratification
  card(s, 4.9, 2.15, 4.92, 3.15, C.white);
  sectionLabel(s, "RISK STRATIFICATION & PROGNOSIS", 4.9, 2.15, 4.92, C.teal);
  s.addText([
    { text: "MAGGIC Risk Score Factors Present:", options: { bold: true, color: C.navy, breakLine: true, fontSize: 10 } },
    bullet("Age ≥ 60 ✓", 0, false, C.red),
    bullet("EF < 35% ✓ (EF 32%)", 0, false, C.red),
    bullet("NYHA Class III–IV symptoms ✓", 0, false, C.red),
    bullet("Not on Beta-Blocker (not listed in Rx)", 0, false, C.orange),
    bullet("Creatinine elevation ✓ (1.65 mg/dL)", 0, false, C.orange),
    { text: "", options: { breakLine: true } },
    { text: "Poor Prognostic Indicators:", options: { bold: true, color: C.red, breakLine: true, fontSize: 10 } },
    bullet("LBBB + EF ≤ 35% → ventricular dyssynchrony; CRT evaluation required", 0, false, C.red),
    bullet("Non-adherence → high re-admission risk without intervention", 0, false, C.red),
    bullet("Persistent bilateral crepts + ↓ L breath sounds Day 5 → possible evolving pleural effusion", 0, false, C.orange),
    { text: "", options: { breakLine: true } },
    { text: "Notable Omission:", options: { bold: true, color: C.orange, breakLine: true, fontSize: 10 } },
    bullet("Beta-blocker (Carvedilol/Bisoprolol) not prescribed despite HFrEF — a key GDMT pillar. Contraindicated in acute decompensation; should be initiated/resumed once euvolemic.", 0, true, C.orange),
  ], { x: 4.97, y: 2.52, w: 4.78, h: 2.72, fontSize: 9, color: C.text, valign: "top" });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 10 — MANAGEMENT PLAN
// ═══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.offWhite }, line: { color: C.offWhite } });
  titleBar(s, "Management Plan", "Evidence-Based Therapeutic Goals and Interventional Strategy");

  const planItems = [
    {
      icon: "①", color: C.navy, title: "O₂ Supplementation",
      text: "4–6 L/min via nasal cannula SOS. Target SpO2 >95%. Corrects hypoxemia from pulmonary congestion. Avoids hypercapnia risk in COPD overlap."
    },
    {
      icon: "②", color: C.blue, title: "IV Loop Diuretic (Decongestion)",
      text: "Inj. Furosemide 40 mg IV BD. First-line for ADHF. Reduces preload via natriuresis/diuresis. Hold if SBP <100 mmHg. Monitor electrolytes — risk of hypokalemia."
    },
    {
      icon: "③", color: C.teal, title: "GDMT — Neurohormonal Blockade",
      text: "ACEI (Enalapril 2.5 mg OD) + MRA (Spironolactone 25–50 mg) + SGLT2i (Dapagliflozin 10 mg). Reduces LV remodeling, mortality & re-hospitalization. Beta-blocker to add once euvolemic."
    },
    {
      icon: "④", color: C.orange, title: "DVT Prophylaxis",
      text: "Inj. Heparin 5000 IU SC QID. Indicated for reduced mobility. Monitor for HIT (platelet count) and bleeding. Renal adjustment may be needed (Cr 1.65)."
    },
    {
      icon: "⑤", color: C.green, title: "Electrolyte & Renal Monitoring",
      text: "K⁺ 4.99 + ACEI + MRA = hyperkalemia risk. Monitor K⁺ and Cr every 48–72h. Adjust doses if K⁺ >5.5 or Cr worsens."
    },
    {
      icon: "⑥", color: C.red, title: "Adherence Counseling",
      text: "Drug non-adherence precipitated this admission. Comprehensive medication education, pill organizer, family involvement, follow-up scheduling — essential before discharge."
    },
    {
      icon: "⑦", color: C.muted, title: "Antibiotic Cover",
      text: "Inj. Augmentin (Amoxicillin-Clavulanate) 1.2 g IV BD. Covers suspected respiratory infection. Note: mildly elevated Cr — monitor renal function."
    },
    {
      icon: "⑧", color: C.blue, title: "Cardiology Referral",
      text: "2D-Echo re-evaluation of EF and LV dimensions. Assess for CRT eligibility (LBBB + EF ≤35%). ICD consideration for primary prevention of SCD."
    },
  ];

  const cols2 = [0.18, 5.08];
  planItems.forEach((item, i) => {
    const col = Math.floor(i / 4);
    const row = i % 4;
    const x = cols2[col];
    const y = 1.08 + row * 1.12;
    card(s, x, y, 4.75, 1.04, C.white);
    s.addShape(pres.shapes.OVAL, { x: x + 0.1, y: y + 0.12, w: 0.52, h: 0.52, fill: { color: item.color }, line: { color: item.color } });
    s.addText(item.icon, { x: x + 0.1, y: y + 0.12, w: 0.52, h: 0.52, fontSize: 13, bold: true, color: C.white, align: "center", valign: "middle", margin: 0 });
    s.addText(item.title, { x: x + 0.7, y: y + 0.1, w: 4.0, h: 0.3, fontSize: 9.5, bold: true, color: item.color, margin: 0 });
    s.addText(item.text, { x: x + 0.7, y: y + 0.4, w: 3.98, h: 0.6, fontSize: 8.5, color: C.text, valign: "top", margin: 0 });
  });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 11 — TREATMENT Rx (Detailed)
// ═══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.offWhite }, line: { color: C.offWhite } });
  titleBar(s, "Treatment — Prescription (Rx)", "Drug Details, Mechanisms, Doses, and ADR Profile");

  const drugs = [
    ["O₂ Supp.", "4–6 L/min SOS", "Correct hypoxemia", "SpO2 <88%", "None significant", C.teal],
    ["Furosemide", "40 mg IV BD", "Loop diuretic — inhibits NKCC2 in thick ascending limb → natriuresis/diuresis → ↓ preload", "SBP <100 mmHg, severe hypovolemia", "Hypokalemia ⚠, hyponatremia, hypotension, ototoxicity (high IV dose)", C.blue],
    ["Enalapril", "2.5 mg PO OD", "ACE inhibitor — ↓ Ang II → ↓ vasoconstriction, ↓ aldosterone → ↓ preload/afterload; ↓ LV remodeling", "Bilateral RAS, angioedema, pregnancy, K⁺>5.5, Cr↑↑", "Dry cough ⚠, hyperkalemia ⚠, first-dose hypotension, AKI (with dehydration)", C.navy],
    ["Spironolactone", "25–50 mg PO OD", "MRA — blocks aldosterone receptor → K⁺ retention, Na⁺ excretion; anti-fibrotic cardiac benefit (RALES trial: 30% ↓ mortality)", "K⁺>5.0, Cr>2.5 (relative), severe hepatic disease", "Hyperkalemia ⚠ (esp. with ACEI), gynecomastia, menstrual irregularity", C.blue],
    ["Dapagliflozin", "10 mg PO OD", "SGLT2 inhibitor — glucosuria → osmotic diuresis; ↓ LV filling pressures; ↓ cardiac fibrosis. DAPA-HF: ↓ CV death/HF events regardless of DM status", "eGFR <25 mL/min/1.73m² — reduced efficacy; DKA risk if very low EF", "Genital mycotic infection, UTI, volume depletion, euglycemic DKA (rare)", C.teal],
    ["Heparin", "5000 IU SC QID", "UFH — indirect thrombin inhibitor via antithrombin III; DVT prophylaxis for immobile HF patient", "Active bleeding, thrombocytopenia, Cr-adjusted caution", "Bleeding ⚠, HIT (platelet check d/3, d/7), injection site bruising", C.muted],
    ["Augmentin", "1.2 g IV BD", "Amoxicillin-Clavulanate — beta-lactam + BLI; covers respiratory pathogens. Dose adjustment for Cr 1.65 (eGFR ~40-50)", "Penicillin allergy (NKDA here — safe)", "GI upset, diarrhea, cholestatic hepatitis (prolonged use), C. diff", C.orange],
    ["Aspirin", "75 mg PO OD", "Antiplatelet — COX-1 inhibitor; secondary CV prevention. Note: can blunt diuretic response (COX inhibition → reduced PG-mediated diuresis)", "Active GI bleed, allergy", "GI irritation, antiplatelet effect — bleeding caution with heparin co-use", C.red],
    ["Duolin Neb.", "TID", "Ipratropium + Levosalbutamol — bronchodilation; manages bronchospasm/wheeze component of pulmonary congestion", "Severe tachycardia (salbutamol)", "Tremor, palpitations, urinary retention (anticholinergic)", C.green],
    ["Pantoprazole", "40 mg IV OD", "PPI — gastric acid suppression; gastroprotection during stress hospitalization and aspirin use", "Nil significant", "Headache, hypomagnesemia (chronic), C. diff (long-term)", C.muted],
    ["Ondansetron", "4 mg IV BD", "5-HT3 antagonist — antiemetic; manages nausea from pulmonary congestion, medications, or post-procedure", "QT prolongation (caution)", "Headache, constipation, QT interval prolongation (monitor ECG)", C.muted],
    ["IFA (Iron-Folate)", "200 mg PO OD", "Iron + Folic Acid supplement — general nutritional support; iron deficiency worsens HF symptoms even without frank anemia", "Hemochromatosis", "GI intolerance, constipation, dark stools", C.green],
  ];

  card(s, 0.18, 1.05, 9.64, 4.35, C.white);
  const hdrs2 = [["Drug", 1.1], ["Dose", 0.9], ["Mechanism & Rationale", 2.8], ["Contraindications", 1.5], ["ADRs to Monitor", 2.74]];
  let hx2 = 0.25;
  hdrs2.forEach(([h, w]) => {
    s.addShape(pres.shapes.RECTANGLE, { x: hx2, y: 1.1, w, h: 0.28, fill: { color: C.navy }, line: { color: C.navy } });
    s.addText(h, { x: hx2, y: 1.1, w, h: 0.28, fontSize: 8.5, bold: true, color: C.white, align: "center", valign: "middle", margin: 0 });
    hx2 += w;
  });
  drugs.forEach(([drug, dose, mech, ci, adr, color], ri) => {
    const y = 1.41 + ri * 0.33;
    const widths2 = [1.1, 0.9, 2.8, 1.5, 2.74];
    const vals = [drug, dose, mech, ci, adr];
    let rx2 = 0.25;
    widths2.forEach((w, ci2) => {
      const bg = ci2 === 0 ? color + "22" : (ri % 2 === 0 ? C.offWhite : C.white);
      s.addShape(pres.shapes.RECTANGLE, { x: rx2, y, w, h: 0.31, fill: { color: bg }, line: { color: "E0E0E0" } });
      s.addText(vals[ci2], { x: rx2, y, w, h: 0.31, fontSize: ci2 === 2 ? 7.5 : 8, color: ci2 === 0 ? color : (adr.includes("⚠") && ci2 === 4 ? C.red : C.text), bold: ci2 === 0, align: ci2 === 2 || ci2 === 3 || ci2 === 4 ? "left" : "center", valign: "middle", margin: [0, ci2 > 1 ? 3 : 0] });
      rx2 += w;
    });
  });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 12 — PHARMACIST INTERVENTIONS (Detailed)
// ═══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.offWhite }, line: { color: C.offWhite } });
  titleBar(s, "Pharmacist Interventions", "Clinical Pharmacy Role in Optimizing ADHF Management");

  const interventions = [
    {
      num: "I", color: C.red, title: "Hyperkalemia Risk: ACEI + MRA Combination",
      bullets: [
        "Patient is on Enalapril (ACEI) + Spironolactone (MRA) — both retain potassium by different mechanisms.",
        "Current K⁺: 4.99 mEq/L — upper limit of normal. One step from dangerous hyperkalemia (>5.5 mEq/L).",
        "Compounded by mildly impaired renal function (Cr 1.65 mg/dL) — reduced K⁺ excretion.",
        "Intervention: Monitor K⁺ and Cr every 48–72h. If K⁺ >5.5 or Cr rises → hold/reduce ACEI or MRA.",
        "Consider low-potassium diet counseling. Avoid K⁺-sparing supplements (potassium salts).",
      ],
    },
    {
      num: "II", color: C.orange, title: "Dapagliflozin Appropriateness — Renal Function Review",
      bullets: [
        "Dapagliflozin efficacy is reduced at eGFR <25 mL/min/1.73m² (estimated eGFR ~42 for this patient).",
        "At current eGFR, the glycosuric/diuretic effect is diminished, but cardio-renal benefits may persist.",
        "Intervention: Continue for now per ADA/HFA guidelines (SGLT2i HFrEF benefit extends to eGFR ≥25).",
        "Re-assess if creatinine rises further. Do NOT initiate if eGFR falls below 20.",
        "Monitor for volume depletion — synergistic with furosemide (two diuretic mechanisms).",
      ],
    },
    {
      num: "III", color: C.blue, title: "Heparin Dosing — Renal Adjustment Check",
      bullets: [
        "UFH (unfractionated heparin) used here — appropriate choice as it is not renally eliminated (unlike LMWH).",
        "5000 IU SC QID is standard DVT prophylaxis dose — no renal adjustment needed for UFH.",
        "If LMWH (Enoxaparin) had been prescribed instead, dose reduction would be required for Cr elevation.",
        "Monitor: anti-Xa levels if therapeutic dosing; platelet count every 3–5 days for HIT surveillance.",
      ],
    },
    {
      num: "IV", color: C.navy, title: "Augmentin Dose — Renal Function Consideration",
      bullets: [
        "Amoxicillin-Clavulanate (Augmentin) is renally cleared. Standard dose 1.2 g IV BD.",
        "At estimated eGFR ~42, dose adjustment may be considered (standard dose generally acceptable for eGFR ≥30).",
        "Monitor renal function during antibiotic course. If eGFR falls to <30 → reduce frequency to OD.",
        "Clavulanate component carries hepatotoxicity risk with prolonged use — monitor LFTs.",
      ],
    },
    {
      num: "V", color: C.green, title: "Medication Adherence Counseling (Primary Prevention of Re-Admission)",
      bullets: [
        "Drug non-adherence was the precipitating cause of this ADHF admission — must be addressed at discharge.",
        "Recommended interventions: Simplified once-daily regimen wherever possible, pill organizer, family member involvement.",
        "Educate on: What each drug does, consequences of stopping, sodium restriction (<2 g/day), daily weight monitoring.",
        "Set follow-up within 1–2 weeks post-discharge (adherence + electrolyte check).",
        "Consider pharmacist-led heart failure clinic follow-up — evidence shows ↓ 30-day readmission rates.",
      ],
    },
    {
      num: "VI", color: C.teal, title: "Beta-Blocker Initiation Flag",
      bullets: [
        "Carvedilol or Bisoprolol (beta-blockers) are NOT in current prescription — a GDMT gap.",
        "Contraindicated DURING acute decompensation (ADHF) due to negative inotropy risk.",
        "Once euvolemic and stable (typically before discharge), beta-blocker should be initiated at low dose.",
        "COPERNICUS / MERIT-HF evidence: Beta-blockers reduce mortality by 34% in HFrEF.",
        "Recommendation: Flag for cardiology team — plan BB initiation at stabilization.",
      ],
    },
  ];

  const colsX = [0.18, 5.08];
  interventions.forEach((intv, i) => {
    const col = Math.floor(i / 3);
    const row = i % 3;
    const x = colsX[col];
    const y = 1.05 + row * 1.48;
    card(s, x, y, 4.76, 1.42, C.white);
    s.addShape(pres.shapes.OVAL, { x: x + 0.1, y: y + 0.08, w: 0.36, h: 0.36, fill: { color: intv.color }, line: { color: intv.color } });
    s.addText(`${intv.num}`, { x: x + 0.1, y: y + 0.08, w: 0.36, h: 0.36, fontSize: 10, bold: true, color: C.white, align: "center", valign: "middle", margin: 0 });
    s.addText(intv.title, { x: x + 0.52, y: y + 0.08, w: 4.16, h: 0.34, fontSize: 9, bold: true, color: intv.color, margin: 0 });
    s.addText(
      intv.bullets.map((b, bi) => ({ text: `• ${b}`, options: { breakLine: true, fontSize: 7.8, color: C.text } })),
      { x: x + 0.15, y: y + 0.46, w: 4.53, h: 0.88, valign: "top" }
    );
  });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 13 — GDMT OVERVIEW
// ═══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.offWhite }, line: { color: C.offWhite } });
  titleBar(s, "Guideline-Directed Medical Therapy (GDMT) for HFrEF", "Evidence Base, Drug Classes, Mortality Benefit, and Application to This Case");

  const gdmt = [
    {
      drug: "ACE Inhibitor / ARB\n(Enalapril — Prescribed ✓)", color: C.navy,
      mechanism: "↓ Ang II → vasodilation + ↓ aldosterone → ↓ preload & afterload; attenuates LV remodeling",
      evidence: "SOLVD trial: 16% ↓ mortality; 26% ↓ hospitalization",
      note: "Dry cough in ~15% (ACEi) → switch to ARB (Losartan/Valsartan). Monitor K⁺ + Cr.",
    },
    {
      drug: "Beta-Blocker\n(NOT yet prescribed ⚠)", color: C.red,
      mechanism: "↓ SNS activation → ↓ HR, ↑ EF over time; anti-arrhythmic; anti-remodeling",
      evidence: "MERIT-HF (Metoprolol): 34% ↓ all-cause mortality; COPERNICUS (Carvedilol): 35% ↓ mortality",
      note: "Contraindicated in acute decompensation. MUST initiate at stabilization — Carvedilol or Bisoprolol preferred.",
    },
    {
      drug: "MRA — Aldosterone Antagonist\n(Spironolactone — Prescribed ✓)", color: C.blue,
      mechanism: "Blocks aldosterone receptor → K⁺ retention + anti-fibrotic myocardial benefit",
      evidence: "RALES trial: 30% ↓ mortality in severe HFrEF; EMPHASIS-HF (Eplerenone): 37% ↓ CV death",
      note: "Hyperkalemia risk — K⁺ 4.99 here is at limit. Monitor every 48–72h with ACEI.",
    },
    {
      drug: "SGLT2 Inhibitor\n(Dapagliflozin — Prescribed ✓)", color: C.teal,
      mechanism: "Glycosuria → osmotic natriuresis; ↓ LV filling pressures; reduces cardiac fibrosis and inflammation",
      evidence: "DAPA-HF: 26% ↓ CV death/worsening HF regardless of DM status. EMPEROR-Reduced (Empagliflozin): 25% ↓ events",
      note: "Effective down to eGFR 25. Monitor for volume depletion with furosemide co-use.",
    },
    {
      drug: "ARNI — Sacubitril/Valsartan\n(Not prescribed — consider upgrade)", color: C.gold,
      mechanism: "Neprilysin inhibitor + ARB → ↑ natriuretic peptide activity + ↓ Ang II; superior to ACEI alone",
      evidence: "PARADIGM-HF: 20% ↓ CV death vs. Enalapril; 21% ↓ HF hospitalization",
      note: "Not in current Rx — consider upgrading Enalapril to Sacubitril/Valsartan once stable (36-hour washout from ACEI required).",
    },
    {
      drug: "Ivabradine\n(Potential future addition)", color: C.muted,
      mechanism: "Selective If channel inhibitor → ↓ HR in sinus rhythm without negative inotropy",
      evidence: "SHIFT trial: 18% ↓ CV death/HF hospitalization in HR >70 bpm on max BB",
      note: "Consider if HR remains >70 bpm once on maximally-tolerated beta-blocker. Current HR 64 bpm — not indicated now.",
    },
  ];

  card(s, 0.18, 1.05, 9.64, 4.35, C.white);
  const g_hdr = [["Drug / Status", 2.0], ["Mechanism", 2.3], ["Key Evidence", 2.3], ["Notes for This Case", 2.84]];
  let ghx = 0.25;
  g_hdr.forEach(([h, w]) => {
    s.addShape(pres.shapes.RECTANGLE, { x: ghx, y: 1.1, w, h: 0.28, fill: { color: C.navy }, line: { color: C.navy } });
    s.addText(h, { x: ghx, y: 1.1, w, h: 0.28, fontSize: 8.5, bold: true, color: C.white, align: "center", valign: "middle", margin: 0 });
    ghx += w;
  });
  gdmt.forEach(({ drug, color, mechanism, evidence, note }, ri) => {
    const y = 1.41 + ri * 0.655;
    const gWidths = [2.0, 2.3, 2.3, 2.84];
    const gVals = [drug, mechanism, evidence, note];
    let grx = 0.25;
    gWidths.forEach((w, ci) => {
      const bg = ci === 0 ? color + "22" : (ri % 2 === 0 ? C.offWhite : C.white);
      s.addShape(pres.shapes.RECTANGLE, { x: grx, y, w, h: 0.62, fill: { color: bg }, line: { color: "E0E0E0" } });
      s.addText(gVals[ci], { x: grx, y, w, h: 0.62, fontSize: ci === 0 ? 8 : 7.8, color: ci === 0 ? color : C.text, bold: ci === 0, align: ci === 0 ? "center" : "left", valign: "middle", margin: [0, ci > 0 ? 3 : 0] });
      grx += w;
    });
  });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 14 — DISCHARGE PLANNING + FOLLOW-UP
// ═══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.offWhite }, line: { color: C.offWhite } });
  titleBar(s, "Discharge Planning & Follow-Up", "Outpatient Strategy, Patient Education, and Monitoring Plan");

  const dischargeItems = [
    { x: 0.18, y: 1.05, w: 4.75, h: 2.05, color: C.navy, title: "DISCHARGE MEDICATIONS (Expected)", points: [
      "Continue: Enalapril, Spironolactone, Dapagliflozin, Aspirin, IFA",
      "Transition: IV Furosemide → Oral Furosemide (dose based on daily weight/edema)",
      "Initiate: Carvedilol 3.125 mg BD (start low, titrate slowly) once euvolemic",
      "Consider: Sacubitril/Valsartan upgrade from Enalapril (PARADIGM-HF evidence)",
      "Stop: IV Augmentin, IV Pantoprazole (if no ongoing indication), IV Heparin",
    ]},
    { x: 5.08, y: 1.05, w: 4.75, h: 2.05, color: C.red, title: "MONITORING PLAN (Post-Discharge)", points: [
      "Serum K⁺ and Creatinine: 1–2 weeks post-discharge (ACEI + MRA risk)",
      "Daily weight monitoring at home: >2 kg in 2 days → contact physician",
      "BP monitoring: Target <130/80 mmHg (AHA/ACC)",
      "HbA1c / glucose: Dapagliflozin initiated — baseline glucose check useful",
      "ECG at 4–6 weeks: Assess for LBBB morphology change with GDMT",
      "2D-Echo repeat: 3–6 months to reassess EF response to GDMT",
    ]},
    { x: 0.18, y: 3.22, w: 4.75, h: 2.1, color: C.teal, title: "PATIENT EDUCATION — KEY POINTS", points: [
      "Take ALL medications even when feeling well — previous non-adherence caused this admission",
      "Sodium restriction: <2 g/day (avoid processed foods, salty snacks)",
      "Fluid restriction: ~1.5–2 L/day (if persistent congestion)",
      "Recognize warning signs: increasing SOB, leg swelling, weight gain, fatigue → seek care early",
      "Avoid NSAIDs (blunt diuretic effect, worsen renal function and HF)",
      "Regular exercise (cardiac rehab referral) once euvolemic and stable",
    ]},
    { x: 5.08, y: 3.22, w: 4.75, h: 2.1, color: C.orange, title: "SPECIALIST REFERRAL & ADVANCED THERAPY", points: [
      "Cardiology: 2D-Echo re-evaluation, CRT/ICD eligibility (LBBB + EF ≤35%)",
      "HF Clinic: Pharmacist-led adherence program — reduces 30-day readmission",
      "CRT evaluation: LBBB + EF ≤35% + NYHA II–III = Class I indication (ESC/ACC guidelines)",
      "ICD: EF ≤35% on optimal GDMT for ≥3 months + expected survival >1 year",
      "Future: If refractory ADHF → consider LVAD or transplant evaluation",
    ]},
  ];

  dischargeItems.forEach(({ x, y, w, h, color, title, points }) => {
    card(s, x, y, w, h, C.white);
    sectionLabel(s, title, x, y, w, color);
    s.addText(
      points.map(p => ({ text: p, options: { bullet: true, breakLine: true, fontSize: 8.5, color: C.text } })),
      { x: x + 0.1, y: y + 0.34, w: w - 0.15, h: h - 0.4, valign: "top" }
    );
  });
}

// ═══════════════════════════════════════════════════════════════════
// SLIDE 15 — THANK YOU
// ═══════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.navy }, line: { color: C.navy } });
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 0.12, h: 5.625, fill: { color: C.teal }, line: { color: C.teal } });
  s.addShape(pres.shapes.OVAL, { x: 6.8, y: 2.5, w: 4, h: 4, fill: { color: "1A3F72" }, line: { color: "1A3F72" } });
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 5.3, w: 10, h: 0.325, fill: { color: C.blue }, line: { color: C.blue } });

  s.addText("THANK YOU", { x: 0.5, y: 1.5, w: 9, h: 1.0, fontSize: 44, bold: true, color: C.white, align: "center" });
  s.addShape(pres.shapes.RECTANGLE, { x: 3.5, y: 2.65, w: 3, h: 0.05, fill: { color: C.teal }, line: { color: C.teal } });
  s.addText("Juveriya Begum  |  PharmD Intern  |  ID: 170324882015", { x: 0.5, y: 2.85, w: 9, h: 0.4, fontSize: 11, color: C.ltBlue, align: "center" });
  s.addText("Case Presentation — Acute Decompensated Heart Failure (ADHF)", { x: 0.5, y: 3.35, w: 9, h: 0.35, fontSize: 10, color: C.muted, align: "center", italic: true });

  // Reference strip
  s.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: 4.1, w: 9, h: 0.9, fill: { color: "0F1E3A" }, line: { color: "0F1E3A" } });
  s.addText("Key References: Harrison's Principles of Internal Medicine 22e | Braunwald's Heart Disease | ACC/AHA HF Guidelines 2022 | ESC HF Guidelines 2023 | DAPA-HF Trial (NEJM 2019) | RALES Trial | PARADIGM-HF Trial | COPERNICUS/MERIT-HF Trials", {
    x: 0.6, y: 4.15, w: 8.8, h: 0.8, fontSize: 7.5, color: C.muted, valign: "middle", italic: true
  });
}

// ─── WRITE FILE ───────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/adhf-pptx/ADHF_Enhanced_Detailed.pptx" })
  .then(() => console.log("SUCCESS: /home/daytona/workspace/adhf-pptx/ADHF_Enhanced_Detailed.pptx"))
  .catch(e => { console.error("FAILED:", e); process.exit(1); });
Running Command

cd /home/daytona/workspace/adhf-pptx && node build.js 2>&1

Running Command

cd /home/daytona/workspace/adhf-pptx && sed -i "s/color + \"22\"/color === C.red…

Running Command

ls -lh /home/daytona/workspace/adhf-pptx/ADHF_Enhanced_Detailed.pptx && python -…

Your enhanced presentation is ready:

ADHF Enhanced Detailed

Presentation · PPTX


What was expanded and added (12 → 15 slides)

SlideOriginalEnhanced Version
1TitleFull-bleed dark title with presenter info
2Intro + HF basicsAdded NYHA classification table, HFrEF vs HFpEF vs HFmrEF definitions, epidemiology stats, expanded precipitating factors list
3NEWPathophysiology of HFrEF & ADHF — 3-column deep-dive: Cardiac Remodeling → Neurohormonal Activation (RAAS, SNS, ADH, natriuretic peptides) → Acute Decompensation mechanism
4Subjective dataExpanded with HPI clinical significance, "congestion-forward phenotype" interpretation
5HistoryAdded PMH with clinical significance per condition, DAPA-HF trial mention for Dapa in non-diabetics
6Objective/VitalsAdded color-coded abnormal vitals, clinical interpretation of each finding, Day 5 pleural effusion flag
7Lab investigationsFull table with reference ranges + clinical significance for every value, creatinine implications highlighted
8ECGAdded LBBB pathophysiology explanation, CRT eligibility criteria, ACS masking warning
9AssessmentFull problem list (P1–P8), MAGGIC risk factors, missing beta-blocker flagged
10Plan8-item plan with mechanistic rationale for each decision
11Treatment RxExpanded to include drug mechanism, contraindications, and ADR column for all 12 medications
12Pharmacist InterventionExpanded to 6 interventions: hyperkalemia, Dapa-renal check, heparin dosing, Augmentin dose, adherence counseling, beta-blocker initiation flag
13NEWGDMT Overview — full table with all 6 drug pillars, landmark trial evidence (RALES, PARADIGM-HF, DAPA-HF, COPERNICUS), application to this patient
14NEWDischarge Planning — discharge Rx, monitoring plan, patient education, specialist referrals (CRT/ICD criteria)
15Thank YouDark-themed closing with full reference list

Why I am not able to download the PDF

The file I created is a .pptx (PowerPoint), not a PDF. The download link should work directly — click it and it will download the .pptx file.
If you're having trouble downloading it, a few possible reasons:
  1. Browser blocking the download — your browser may be blocking file downloads from this domain. Check for a blocked download notification in the address bar or downloads panel.
  2. You want a PDF specifically — if you'd like the presentation as a PDF instead, I can convert it for you right now.
  3. Link not clickable — try right-clicking the link and selecting "Save link as..."
Would you like me to convert the PPTX to a PDF so you can download that instead? Just say yes and I'll do it immediately.

Convert the PPTX to PDF and provide download link

Running Command

libreoffice --headless --convert-to pdf /home/daytona/workspace/adhf-pptx/ADHF_E…

Running Command

mkdir -p /home/daytona/workspace/adhf-pptx/output && libreoffice --headless --co…

Running Command

cp /home/daytona/workspace/adhf-pptx/ADHF_Enhanced_Detailed.pptx /tmp/adhf_temp.…

Running Command

cp /tmp/adhf_temp.pdf /home/daytona/workspace/adhf-pptx/ADHF_Enhanced_Detailed.p…

Your PDF is ready — 15 slides, 451 KB:

ADHF Enhanced Detailed

PDF Document · PDF

This is a shared conversation. Sign in to Orris to start your own chat.