I want to make presentation on principle of haemodynamic based on guyton and gk pal look like mbbs 1st year student make thisss

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

mkdir -p /home/daytona/workspace/haemodynamics-pptx && ls /home/daytona/workspace/haemodynamics-pptx

Writing File

~/haemodynamics-pptx/build.js

const pptxgen = require("pptxgenjs");

const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Principles of Haemodynamics";
pres.author = "MBBS 1st Year";

// ─── COLOUR PALETTE ──────────────────────────────────────────────────────────
const C = {
  dark:    "0D1B2A",  // deep navy  (backgrounds)
  mid:     "1B3A5C",  // medium navy
  accent:  "E63946",  // vivid red  (highlights)
  gold:    "F4A261",  // warm gold  (sub-headings)
  light:   "E9F1FA",  // near-white (body text on dark)
  white:   "FFFFFF",
  teal:    "2EC4B6",  // teal       (formula boxes)
  yellow:  "FFD166",  // yellow     (key fact boxes)
};

// ─── HELPERS ─────────────────────────────────────────────────────────────────

function titleSlide(title, subtitle, bgColor) {
  const s = pres.addSlide();
  // Gradient-like effect with two rectangles
  s.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: "100%", h: "100%",
    fill: { color: bgColor || C.dark }
  });
  s.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: "100%", h: 0.08,
    fill: { color: C.accent }
  });
  s.addShape(pres.ShapeType.rect, {
    x: 0, y: 5.545, w: "100%", h: 0.08,
    fill: { color: C.gold }
  });

  s.addText(title, {
    x: 0.5, y: 1.6, w: 9, h: 1.4,
    fontSize: 40, bold: true, color: C.white,
    align: "center", fontFace: "Calibri",
    glow: { size: 8, opacity: 0.3, color: C.accent }
  });
  if (subtitle) {
    s.addText(subtitle, {
      x: 0.5, y: 3.1, w: 9, h: 0.9,
      fontSize: 20, color: C.gold, align: "center",
      italic: true, fontFace: "Calibri"
    });
  }
  // decorative diamond
  s.addShape(pres.ShapeType.diamond, {
    x: 4.7, y: 4.3, w: 0.5, h: 0.5,
    fill: { color: C.accent }, line: { color: C.accent }
  });
  return s;
}

function sectionHeader(title, icon) {
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: "100%", h: "100%",
    fill: { color: C.mid }
  });
  s.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: 0.12, h: "100%",
    fill: { color: C.accent }
  });
  s.addText((icon || "") + "  " + title, {
    x: 0.4, y: 1.8, w: 9.2, h: 2,
    fontSize: 38, bold: true, color: C.white,
    align: "left", fontFace: "Calibri"
  });
  return s;
}

function contentSlide(title, bullets, imgUrl, note) {
  const s = pres.addSlide();
  // Background
  s.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: "100%", h: "100%",
    fill: { color: "F7F9FC" }
  });
  // Title bar
  s.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: "100%", h: 0.7,
    fill: { color: C.dark }
  });
  s.addShape(pres.ShapeType.rect, {
    x: 0, y: 0.7, w: "100%", h: 0.05,
    fill: { color: C.accent }
  });
  s.addText(title, {
    x: 0.2, y: 0.06, w: 9.6, h: 0.58,
    fontSize: 22, bold: true, color: C.white,
    fontFace: "Calibri", valign: "middle", margin: 0
  });
  // Guyton badge
  s.addShape(pres.ShapeType.roundRect, {
    x: 7.8, y: 0.08, w: 2, h: 0.52,
    fill: { color: C.accent }, line: { color: C.accent },
    rectRadius: 0.1
  });
  s.addText("Guyton & Hall", {
    x: 7.8, y: 0.08, w: 2, h: 0.52,
    fontSize: 10, bold: true, color: C.white,
    align: "center", valign: "middle", fontFace: "Calibri", margin: 0
  });

  const contentW = imgUrl ? 5.6 : 9.4;
  const items = bullets.map((b, i) => {
    if (b.startsWith("##")) {
      return { text: b.replace("##", "").trim(), options: { bold: true, color: C.mid, fontSize: 15, breakLine: true, bullet: false } };
    }
    return { text: b, options: { bullet: { type: "bullet", indent: 15 }, fontSize: 13, color: "1A1A2E", breakLine: true } };
  });
  s.addText(items, {
    x: 0.3, y: 0.85, w: contentW, h: 4.6,
    fontFace: "Calibri", valign: "top", lineSpacingMultiple: 1.25
  });

  if (imgUrl) {
    s.addImage({ path: imgUrl, x: 6.1, y: 0.9, w: 3.6, h: 4.5, sizing: { type: "contain", w: 3.6, h: 4.5 } });
  }

  if (note) {
    s.addShape(pres.ShapeType.roundRect, {
      x: 0.3, y: 5.05, w: 9.4, h: 0.46,
      fill: { color: "FFF3CD" }, line: { color: C.gold },
      rectRadius: 0.07
    });
    s.addText("πŸ“Œ  " + note, {
      x: 0.35, y: 5.05, w: 9.3, h: 0.46,
      fontSize: 11, color: "5C4A00", fontFace: "Calibri", valign: "middle"
    });
  }
  return s;
}

function formulaSlide(title, formulaLines, explanation) {
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: "100%", h: "100%",
    fill: { color: "F0F4F8" }
  });
  s.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: "100%", h: 0.7,
    fill: { color: C.dark }
  });
  s.addShape(pres.ShapeType.rect, {
    x: 0, y: 0.7, w: "100%", h: 0.05,
    fill: { color: C.teal }
  });
  s.addText(title, {
    x: 0.2, y: 0.06, w: 9.6, h: 0.58,
    fontSize: 22, bold: true, color: C.white,
    fontFace: "Calibri", valign: "middle", margin: 0
  });

  // Formula box
  s.addShape(pres.ShapeType.roundRect, {
    x: 1.5, y: 1.0, w: 7, h: formulaLines.length * 0.65 + 0.5,
    fill: { color: C.dark }, line: { color: C.teal, w: 2 },
    rectRadius: 0.15
  });
  const fItems = formulaLines.map((f, i) => ({
    text: f,
    options: { fontSize: 22, bold: true, color: C.teal, breakLine: i < formulaLines.length - 1, align: "center" }
  }));
  const fH = formulaLines.length * 0.65 + 0.5;
  s.addText(fItems, {
    x: 1.5, y: 1.0, w: 7, h: fH,
    align: "center", valign: "middle", fontFace: "Courier New"
  });

  // Explanation
  const expItems = explanation.map(e => {
    if (e.startsWith("##")) {
      return { text: e.replace("##", "").trim(), options: { bold: true, color: C.mid, fontSize: 15, breakLine: true, bullet: false } };
    }
    return { text: e, options: { bullet: { type: "bullet" }, fontSize: 13, color: "1A1A2E", breakLine: true } };
  });
  s.addText(expItems, {
    x: 0.5, y: 1.0 + fH + 0.2, w: 9, h: 5.625 - (1.0 + fH + 0.3),
    fontFace: "Calibri", valign: "top", lineSpacingMultiple: 1.25
  });
  return s;
}

function tableSlide(title, headers, rows) {
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: "100%", h: "100%",
    fill: { color: "F7F9FC" }
  });
  s.addShape(pres.ShapeType.rect, {
    x: 0, y: 0, w: "100%", h: 0.7,
    fill: { color: C.dark }
  });
  s.addShape(pres.ShapeType.rect, {
    x: 0, y: 0.7, w: "100%", h: 0.05,
    fill: { color: C.gold }
  });
  s.addText(title, {
    x: 0.2, y: 0.06, w: 9.6, h: 0.58,
    fontSize: 22, bold: true, color: C.white,
    fontFace: "Calibri", valign: "middle", margin: 0
  });
  const colW = 9.4 / headers.length;
  const tableData = [
    headers.map(h => ({ text: h, options: { bold: true, color: C.white, fill: C.mid, align: "center", fontSize: 13 } })),
    ...rows.map((row, ri) =>
      row.map(cell => ({ text: cell, options: { color: "1A1A2E", fill: ri % 2 === 0 ? "EBF4FF" : C.white, fontSize: 12, align: "center" } }))
    )
  ];
  s.addTable(tableData, {
    x: 0.3, y: 0.85, w: 9.4, h: 4.5,
    border: { pt: 1, color: "CCDDEE" },
    fontFace: "Calibri",
    autoPage: false
  });
  return s;
}

// ─── SLIDE 1 β€” TITLE ─────────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:"100%", h:"100%", fill:{color: C.dark} });
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:"100%", h:0.1, fill:{color: C.accent} });
  s.addShape(pres.ShapeType.rect, { x:0, y:5.525, w:"100%", h:0.1, fill:{color: C.gold} });
  // Large circle decoration
  s.addShape(pres.ShapeType.ellipse, { x:7.2, y:-0.8, w:4, h:4, fill:{color: "1B3A5C"}, line:{color:"1B3A5C"} });
  s.addShape(pres.ShapeType.ellipse, { x:7.6, y:-0.4, w:3, h:3, fill:{color: "2A4E6E"}, line:{color:"2A4E6E"} });

  s.addText("PRINCIPLES OF", {
    x:0.5, y:0.9, w:8, h:0.7,
    fontSize:18, color: C.gold, bold:true, charSpacing:8,
    fontFace:"Calibri", align:"left"
  });
  s.addText("HAEMODYNAMICS", {
    x:0.5, y:1.5, w:8, h:1.5,
    fontSize:52, bold:true, color: C.white,
    fontFace:"Calibri", align:"left"
  });
  s.addShape(pres.ShapeType.rect, { x:0.5, y:3.1, w:2.8, h:0.06, fill:{color: C.accent} });
  s.addText("Based on Guyton & Hall | GK Pal", {
    x:0.5, y:3.3, w:7, h:0.5,
    fontSize:16, color: C.light, italic:true, fontFace:"Calibri"
  });
  s.addText("MBBS 1st Year  β€’  Physiology", {
    x:0.5, y:3.9, w:7, h:0.45,
    fontSize:14, color: C.gold, fontFace:"Calibri"
  });
  s.addText("Unit: Cardiovascular Physiology", {
    x:0.5, y:4.5, w:7, h:0.5,
    fontSize:13, color: C.light, fontFace:"Calibri", italic:true
  });
}

// ─── SLIDE 2 β€” OVERVIEW ──────────────────────────────────────────────────────
contentSlide(
  "What is Haemodynamics?",
  [
    "## Definition",
    "Study of the physical principles governing blood flow through the cardiovascular system",
    "From Greek: haima (blood) + dynamis (force/power)",
    "## Why it matters for MBBS?",
    "Foundation for understanding all cardiovascular diseases",
    "Explains hypertension, shock, heart failure & more",
    "## Key Variables",
    "Blood Flow (Q) β€” volume/unit time (mL/min or L/min)",
    "Blood Pressure (P) β€” force exerted per unit area (mmHg)",
    "Vascular Resistance (R) β€” opposition to blood flow",
    "## Normal Cardiac Output",
    "~5–6 L/min at rest in a 70 kg adult",
    "= Stroke Volume Γ— Heart Rate",
  ],
  null,
  "Guyton: 'Blood flow through the circulation can be likened to water flow through pipes' β€” Ch.14"
);

// ─── SLIDE 3 β€” SECTION HEADER ─────────────────────────────────────────────────
sectionHeader("1. Blood Flow", "🩸");

// ─── SLIDE 4 β€” BLOOD FLOW ────────────────────────────────────────────────────
contentSlide(
  "Blood Flow β€” Definition & Types",
  [
    "## Definition (Guyton Ch.14)",
    "Quantity of blood passing a point in the circulation per unit time",
    "Expressed as mL/min or L/min",
    "## Normal Values",
    "Total body (cardiac output): 5000–6000 mL/min at rest",
    "~10–20% greater in men vs women (larger body mass)",
    "## Types of Flow",
    "Laminar Flow β€” concentric rings of blood; outermost layer slowest",
    "Turbulent Flow β€” chaotic; occurs at high velocity, sharp bends, narrowing",
    "## Clinical Significance",
    "Turbulence β†’ Bruits (abnormal sounds heard on auscultation)",
    "Turbulence β†’ ↑ energy expenditure β†’ cardiac strain",
  ],
  null,
  "GK Pal: Laminar flow is silent; Turbulent flow produces audible bruits (bruit = French for 'noise')"
);

// ─── SLIDE 5 β€” POISEUILLE'S LAW ──────────────────────────────────────────────
formulaSlide(
  "Poiseuille's Law β€” Most Important Equation",
  [
    "F = (Ο€ Γ— Ξ”P Γ— r⁴) / (8 Γ— Ξ· Γ— l)",
    "",
    "CO = MAP / TPR"
  ],
  [
    "## Variables",
    "F = Blood flow rate   |   Ξ”P = Pressure difference",
    "r = Radius of vessel  |   Ξ· = Viscosity of blood",
    "l = Length of vessel  |   CO = Cardiac Output",
    "MAP = Mean Arterial Pressure   |   TPR = Total Peripheral Resistance",
    "## Key Insight (Guyton Ch.14)",
    "Flow ∝ r⁴ β€” RADIUS IS THE MOST IMPORTANT FACTOR",
    "Doubling radius β†’ 16Γ— increase in flow (2⁴ = 16)",
    "4-fold ↑ in radius β†’ 256-fold ↑ in flow (4⁴ = 256)",
  ]
);

// ─── SLIDE 6 β€” RESISTANCE ────────────────────────────────────────────────────
sectionHeader("2. Vascular Resistance", "βš™οΈ");

contentSlide(
  "Vascular Resistance",
  [
    "## Definition",
    "Impediment to blood flow; CANNOT be measured directly",
    "Calculated from pressure difference and blood flow",
    "## Unit: PRU (Peripheral Resistance Unit)",
    "1 PRU = pressure diff. of 1 mmHg when flow = 1 mL/sec",
    "## Normal Values (Guyton)",
    "Total Peripheral Resistance (TPR): ~1 PRU",
    "Strong vasoconstriction: up to 4 PRU",
    "Maximal vasodilation: as low as 0.2 PRU",
    "Pulmonary Vascular Resistance: ~0.14 PRU (1/7th of systemic)",
    "## Conductance = 1 / Resistance",
    "Conductance ∝ Diameter⁴ β€” key vasoregulatory principle",
    "Arterioles contribute ~2/3 of total systemic resistance",
  ],
  null,
  "Remember: Arterioles are the 'resistance vessels' β€” their diameter changes regulate organ blood flow"
);

// ─── SLIDE 7 β€” SERIES & PARALLEL ─────────────────────────────────────────────
contentSlide(
  "Series & Parallel Resistance in Circulation",
  [
    "## Vessels in SERIES (e.g., Arteries β†’ Arterioles β†’ Capillaries)",
    "Flow is the SAME through each vessel",
    "R_total = R₁ + Rβ‚‚ + R₃ + ... (resistances ADD UP)",
    "## Vessels in PARALLEL (e.g., Different organs)",
    "Pressure is the SAME across each vessel",
    "1/R_total = 1/R₁ + 1/Rβ‚‚ + 1/R₃ (resistances DECREASE)",
    "Adding more parallel vessels β†’ REDUCES total resistance",
    "## Importance",
    "Each organ gets its own blood supply independently",
    "One organ's vasoconstriction doesn't starve others",
    "Brain (~15%), Kidneys (~20%), Liver/GIT (~25%) simultaneously",
    "## Arteriolar Control",
    "Diameter changes of 4-fold β†’ 256-fold change in flow",
    "Range of 100-fold flow change between max constriction & dilation",
  ],
  null,
  "MBBS Exam Tip: In series β€” resistances add; In parallel β€” reciprocals add (total R decreases)"
);

// ─── SLIDE 8 β€” BLOOD PRESSURE ────────────────────────────────────────────────
sectionHeader("3. Blood Pressure", "πŸ’‰");

contentSlide(
  "Blood Pressure β€” Types & Normal Values",
  [
    "## Systolic BP (SBP)",
    "Peak pressure during ventricular systole",
    "Normal: 120 mmHg",
    "## Diastolic BP (DBP)",
    "Minimum pressure during ventricular diastole",
    "Normal: 80 mmHg (written as 120/80 mmHg)",
    "## Mean Arterial Pressure (MAP)",
    "MAP = DBP + 1/3 (SBP βˆ’ DBP)  OR  MAP = DBP + Pulse Pressure/3",
    "Normal MAP: ~93 mmHg",
    "MAP = Cardiac Output Γ— Total Peripheral Resistance",
    "## Pulse Pressure",
    "Pulse Pressure = SBP βˆ’ DBP = 40 mmHg (normal)",
    "↑ in aortic regurgitation, atherosclerosis, exercise",
    "↓ in aortic stenosis, hypovolaemic shock",
  ],
  null,
  "GK Pal: MAP is the true driving pressure for tissue perfusion β€” memorise MAP = CO Γ— TPR"
);

// ─── SLIDE 9 β€” OHMS LAW ──────────────────────────────────────────────────────
formulaSlide(
  "Ohm's Law Applied to Circulation",
  [
    "Q = Ξ”P / R",
    "",
    "CO = MAP / TPR",
    "",
    "MAP = CO Γ— TPR"
  ],
  [
    "## Analogy with Electrical Circuit (Guyton Ch.14)",
    "Blood Flow (Q)  β†’  Electric Current (I)",
    "Blood Pressure (Ξ”P)  β†’  Voltage (V)",
    "Vascular Resistance (R)  β†’  Electrical Resistance (R)",
    "## Clinical Applications",
    "↑ TPR (vasoconstriction) β†’ ↑ MAP (hypertension)",
    "↓ CO (heart failure) β†’ ↓ MAP (hypotension, shock)",
    "Vasodilator drugs β†’ ↓ TPR β†’ ↓ MAP β†’ ↓ afterload",
    "## Remember for Exams",
    "MAP is maintained by balance of CO and TPR",
    "Baroreceptor reflex uses this equation to stabilise BP",
  ]
);

// ─── SLIDE 10 β€” CARDIAC OUTPUT ───────────────────────────────────────────────
sectionHeader("4. Cardiac Output", "❀️");

contentSlide(
  "Cardiac Output β€” Definition & Determinants",
  [
    "## Definition (Guyton Ch.20)",
    "Volume of blood pumped by the heart per minute",
    "CO = Stroke Volume (SV) Γ— Heart Rate (HR)",
    "## Normal Values",
    "CO at rest: 5 L/min    |    Cardiac Index: 3.2 L/min/mΒ²",
    "SV: ~70 mL/beat        |    HR: ~72 bpm",
    "## Determinants of Stroke Volume",
    "Preload β€” ventricular filling (↑ preload β†’ ↑ SV: Frank-Starling law)",
    "Afterload β€” resistance against which heart pumps (↑ afterload β†’ ↓ SV)",
    "Contractility (Inotropy) β€” intrinsic myocardial strength",
    "## Determinants of Heart Rate",
    "Autonomic NS: SNS ↑ HR; PNS ↓ HR",
    "Hormones: Adrenaline ↑ HR; Hypothyroidism ↓ HR",
  ],
  null,
  "Guyton: CO is the SUM of all local tissue blood flows β€” tissue metabolism is the primary regulator"
);

// ─── SLIDE 11 β€” FRANK-STARLING ───────────────────────────────────────────────
contentSlide(
  "Frank-Starling Law of the Heart",
  [
    "## Principle",
    "Force of cardiac contraction ∝ initial length of myocardial fibres",
    "= The more the heart is filled, the more forcefully it contracts",
    "## Mechanism",
    "↑ Venous Return β†’ ↑ EDV (End-Diastolic Volume)",
    "↑ EDV β†’ ↑ Sarcomere stretch β†’ ↑ Overlap of actin-myosin",
    "β†’ ↑ Cross-bridge formation β†’ ↑ Force β†’ ↑ SV",
    "## Clinical Importance",
    "Explains why both ventricles pump equal volumes",
    "Explains compensation in early heart failure",
    "↑ IV fluids β†’ ↑ Preload β†’ ↑ CO (fluid resuscitation in shock)",
    "## Limits",
    "Over-stretching beyond optimal length β†’ ↓ contractility",
    "Seen in decompensated heart failure (dilated cardiomyopathy)",
  ],
  null,
  "GK Pal: 'The heart pumps all the blood that comes to it' β€” Starling's Law ensures output = venous return"
);

// ─── SLIDE 12 β€” VENOUS RETURN ─────────────────────────────────────────────────
contentSlide(
  "Venous Return & Mean Systemic Filling Pressure",
  [
    "## Venous Return (VR)",
    "Volume of blood flowing from peripheral veins into right atrium per minute",
    "Under steady state: VR = CO (exactly equal)",
    "## Mean Systemic Filling Pressure (MSFP)",
    "Pressure in circulation when heart stops = ~7 mmHg",
    "Determined by blood volume and venous compliance",
    "## Venous Return Curve",
    "VR = (MSFP βˆ’ Right Atrial Pressure) / Venous Resistance",
    "## Factors Increasing VR",
    "↑ Blood volume (fluid loading)",
    "↑ Sympathetic tone β†’ ↑ Venous tone β†’ ↑ MSFP",
    "Muscle pump (exercise)",
    "Respiratory pump (inspiration creates negative intrathoracic pressure)",
    "Gravity (leg elevation in shock)",
  ],
  null,
  "Guyton Ch.20: Right atrial pressure is the pivot around which CO and VR curves intersect"
);

// ─── SLIDE 13 β€” BLOOD VISCOSITY ──────────────────────────────────────────────
sectionHeader("5. Blood Viscosity & Vessel Wall", "πŸ”¬");

contentSlide(
  "Blood Viscosity",
  [
    "## Definition",
    "Resistance to flow due to internal friction between blood layers",
    "## Normal Viscosity",
    "Blood: 3–4Γ— that of water",
    "Plasma: ~1.5Γ— that of water",
    "## Factors Affecting Viscosity",
    "Haematocrit (MOST IMPORTANT): ↑ RBC β†’ ↑ viscosity",
    "Normal haematocrit: 40–45%",
    "Temperature: Cold β†’ ↑ viscosity",
    "Plasma proteins: ↑ fibrinogen β†’ ↑ viscosity",
    "## Fahraeus-Lindqvist Effect",
    "In vessels < 1 mm: viscosity DECREASES (axial streaming of RBCs)",
    "Explained by RBC deformation and plasma sleeve at vessel wall",
    "## Clinical",
    "Polycythaemia: ↑↑ viscosity β†’ ↑↑ resistance β†’ strain on heart",
    "Anaemia: ↓ viscosity β†’ ↓ resistance β†’ ↑ CO (high-output failure)",
  ],
  null,
  "GK Pal: Viscosity is the Ξ· (eta) in Poiseuille's law β€” doubled viscosity halves blood flow"
);

// ─── SLIDE 14 β€” AUTOREGULATION ────────────────────────────────────────────────
contentSlide(
  "Autoregulation of Blood Flow",
  [
    "## Definition (Guyton Ch.14)",
    "Ability of tissue to maintain constant blood flow despite changes in arterial pressure",
    "Operates between MAP 70–175 mmHg",
    "## Mechanism β€” Two Theories",
    "Myogenic theory: ↑ stretch β†’ smooth muscle contracts β†’ ↓ flow",
    "Metabolic theory: ↓ Oβ‚‚ / ↑ COβ‚‚, H⁺, adenosine β†’ vasodilation β†’ ↑ flow",
    "## Organs with Strong Autoregulation",
    "Brain (must maintain ~750 mL/min)",
    "Kidneys (GFR protection)",
    "Heart (maintains coronary flow)",
    "## Sympathetic Override",
    "Noradrenaline, Angiotensin II, Vasopressin β†’ vasoconstriction",
    "But autoregulation overcomes these within a few hours",
    "Critical closing pressure β€” below this, vessels collapse completely",
  ],
  null,
  "Guyton: 'Each tissue controls its own blood flow in proportion to its metabolic needs'"
);

// ─── SLIDE 15 β€” CAPILLARY & STARLING ─────────────────────────────────────────
sectionHeader("6. Capillary Exchange & Starling Forces", "πŸ’§");

contentSlide(
  "Starling Forces β€” Capillary Fluid Exchange",
  [
    "## Starling's Law of Capillaries",
    "Net Filtration Pressure = (Pc + Ο€i) βˆ’ (Pi + Ο€c)",
    "Pc = capillary hydrostatic pressure",
    "Pi = interstitial fluid hydrostatic pressure",
    "Ο€c = plasma oncotic pressure (main force retaining fluid)",
    "Ο€i = interstitial oncotic pressure",
    "## Normal Values (Guyton)",
    "Arterial end Pc: ~32 mmHg  |  Venous end Pc: ~15 mmHg",
    "Plasma oncotic (Ο€c): ~28 mmHg",
    "Net: Filtration at arterial end; Absorption at venous end",
    "## Causes of Oedema (↑ filtration)",
    "↑ Pc (heart failure, venous obstruction)",
    "↓ Ο€c (hypoalbuminaemia, malnutrition, liver disease)",
    "↑ Capillary permeability (inflammation, sepsis)",
    "Lymphatic obstruction (filariasis β€” elephantiasis)",
  ],
  null,
  "MBBS Must Know: Hypoalbuminaemia β†’ ↓ oncotic pressure β†’ oedema (nephrotic syndrome, cirrhosis)"
);

// ─── SLIDE 16 β€” TABLE NORMAL VALUES ──────────────────────────────────────────
tableSlide(
  "Normal Haemodynamic Values β€” Quick Reference",
  ["Parameter", "Normal Value", "Unit", "Clinical Note"],
  [
    ["Cardiac Output (CO)", "5 – 6", "L/min", "↑ in exercise, fever, anaemia"],
    ["Cardiac Index (CI)", "3.2", "L/min/mΒ²", "Better than CO β€” corrects for BSA"],
    ["Stroke Volume (SV)", "70", "mL/beat", "CO = SV Γ— HR"],
    ["Heart Rate (HR)", "60 – 100", "beats/min", "SNS ↑, PNS ↓"],
    ["Systolic BP", "120", "mmHg", "< 90 = hypotension"],
    ["Diastolic BP", "80", "mmHg", "> 90 = hypertension (Stage 1)"],
    ["Mean Arterial Pressure", "93", "mmHg", "DBP + 1/3 Pulse Pressure"],
    ["Total Peripheral Resistance", "~1", "PRU", "Arterioles control it"],
    ["Blood Viscosity", "3 – 4Γ—", "water = 1", "↑ in polycythaemia"],
    ["Pulm. Vasc. Resistance", "~0.14", "PRU", "1/7th of systemic"],
  ]
);

// ─── SLIDE 17 β€” CLINICAL APPLICATIONS ───────────────────────────────────────
sectionHeader("7. Clinical Applications", "πŸ₯");

contentSlide(
  "Haemodynamics in Clinical Medicine",
  [
    "## Hypertension",
    "↑ TPR (mainly arteriolar) β†’ ↑ MAP β†’ ↑ afterload β†’ LVH",
    "Treatment: ACE inhibitors, Ca²⁺ channel blockers β†’ ↓ TPR",
    "## Cardiogenic Shock",
    "↓↓ CO β†’ ↓ MAP β†’ inadequate tissue perfusion",
    "Signs: cold extremities, ↓ BP, ↑ HR, ↓ urine output",
    "## Heart Failure",
    "↓ SV β†’ Frank-Starling compensation β†’ oedema when fails",
    "## Anaemia & Polycythaemia",
    "Anaemia: ↓ viscosity β†’ ↑ CO β†’ high-output heart failure if severe",
    "Polycythaemia: ↑ viscosity β†’ ↑ resistance β†’ ↑ cardiac work",
    "## Haemorrhage",
    "↓ Blood vol. β†’ ↓ VR β†’ ↓ CO β†’ Baroreceptor reflex β†’ ↑ HR + ↑ TPR",
  ],
  null,
  "GK Pal: Understanding Ohm's Law (MAP = CO Γ— TPR) unlocks treatment of every cardiovascular disease"
);

// ─── SLIDE 18 β€” MNEMONICS ────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:"100%", h:"100%", fill:{color: C.dark} });
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:"100%", h:0.7, fill:{color: C.mid} });
  s.addShape(pres.ShapeType.rect, { x:0, y:0.7, w:"100%", h:0.05, fill:{color: C.accent} });
  s.addText("Mnemonics & Exam Tips", {
    x:0.2, y:0.06, w:9.6, h:0.58,
    fontSize:22, bold:true, color:C.white, fontFace:"Calibri", valign:"middle", margin:0
  });

  const boxes = [
    { x:0.2, y:0.9, text:"MAP Formula\nMAP = DBP + β…“(PP)\nOR\nCO Γ— TPR", color: C.accent },
    { x:3.4, y:0.9, text:"Poiseuille Key\nFlow ∝ r⁴\nDouble radius\nβ†’ 16Γ— flow", color: C.teal },
    { x:6.6, y:0.9, text:"Ohm's Law\nQ = Ξ”P / R\nCO = MAP / TPR\nMAP = CO Γ— TPR", color: C.gold },
    { x:0.2, y:2.9, text:"Frank-Starling\nMore FILL\n→ More FORCE\n→ More FLOW", color: "8338EC" },
    { x:3.4, y:2.9, text:"Viscosity Rule\n↑ HCT = ↑ Viscosity\n↑ Viscosity = ↑ R\n↑ R = ↓ Flow", color: "FF6B6B" },
    { x:6.6, y:2.9, text:"Starling Forces\nOedema = ↑Pc OR\n↓Albumin OR\n↑Permeability", color: "06D6A0" },
  ];

  boxes.forEach(b => {
    s.addShape(pres.ShapeType.roundRect, {
      x:b.x, y:b.y, w:3, h:1.7,
      fill:{color: b.color}, line:{color:b.color},
      rectRadius:0.15
    });
    s.addText(b.text, {
      x:b.x+0.1, y:b.y+0.05, w:2.8, h:1.6,
      fontSize:13, bold:true, color:C.white,
      fontFace:"Calibri", align:"center", valign:"middle"
    });
  });

  s.addText("All formulas based on Guyton & Hall, Textbook of Medical Physiology + GK Pal Textbook of Medical Physiology", {
    x:0.2, y:5.1, w:9.6, h:0.4,
    fontSize:10, color: C.gold, italic:true, fontFace:"Calibri", align:"center"
  });
}

// ─── SLIDE 19 β€” SUMMARY ──────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:"100%", h:"100%", fill:{color: "F0F4F8"} });
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:"100%", h:0.7, fill:{color: C.dark} });
  s.addShape(pres.ShapeType.rect, { x:0, y:0.7, w:"100%", h:0.05, fill:{color: C.accent} });
  s.addText("Summary β€” Take Home Messages", {
    x:0.2, y:0.06, w:9.6, h:0.58,
    fontSize:22, bold:true, color:C.white, fontFace:"Calibri", valign:"middle", margin:0
  });

  const summary = [
    "1.  Blood flow = Cardiac Output = ~5 L/min at rest",
    "2.  Poiseuille's Law: Flow ∝ r⁴ β€” vessel radius is the master regulator",
    "3.  Ohm's Law: MAP = CO Γ— TPR β€” the central haemodynamic equation",
    "4.  Resistance in series ADDS; in parallel DECREASES total resistance",
    "5.  Frank-Starling: More venous return β†’ more cardiac output (within limits)",
    "6.  Autoregulation maintains organ perfusion between MAP 70–175 mmHg",
    "7.  Starling Forces: Oedema occurs when filtration exceeds lymphatic drainage",
    "8.  Arterioles are the 'resistance vessels' β€” key targets for antihypertensives",
    "9.  Blood viscosity ∝ Haematocrit β€” impacts vascular resistance",
    "10. All cardiovascular pharmacology is based on manipulating CO and TPR",
  ];
  s.addText(summary.join("\n"), {
    x:0.4, y:0.9, w:9.2, h:4.5,
    fontSize:13.5, color:"1A1A2E", fontFace:"Calibri",
    lineSpacingMultiple:1.35, valign:"top"
  });
}

// ─── SLIDE 20 β€” THANK YOU ────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:"100%", h:"100%", fill:{color: C.dark} });
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:"100%", h:0.08, fill:{color: C.accent} });
  s.addShape(pres.ShapeType.rect, { x:0, y:5.545, w:"100%", h:0.08, fill:{color: C.gold} });
  s.addShape(pres.ShapeType.ellipse, { x:-1, y:3, w:5, h:5, fill:{color:"1B3A5C"}, line:{color:"1B3A5C"} });

  s.addText("Thank You!", {
    x:1, y:1.3, w:8, h:1.2,
    fontSize:52, bold:true, color:C.white,
    fontFace:"Calibri", align:"center"
  });
  s.addText("Questions & Discussion", {
    x:1, y:2.7, w:8, h:0.6,
    fontSize:22, color:C.gold, italic:true,
    fontFace:"Calibri", align:"center"
  });
  s.addShape(pres.ShapeType.rect, { x:3, y:3.5, w:4, h:0.05, fill:{color:C.accent} });
  s.addText("References", {
    x:1, y:3.7, w:8, h:0.4,
    fontSize:14, bold:true, color:C.light, fontFace:"Calibri", align:"center"
  });
  s.addText(
    "Guyton AC, Hall JE. Textbook of Medical Physiology, 14th Ed. Elsevier.\n" +
    "Pal GK, Pal P. Textbook of Medical Physiology, 3rd Ed. Orient Blackswan.",
    {
      x:1, y:4.1, w:8, h:0.9,
      fontSize:12, color:C.light, italic:true,
      fontFace:"Calibri", align:"center", lineSpacingMultiple:1.4
    }
  );
}

// ─── WRITE FILE ──────────────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/haemodynamics-pptx/Principles_of_Haemodynamics.pptx" })
  .then(() => console.log("βœ… Saved: Principles_of_Haemodynamics.pptx"))
  .catch(e => { console.error("❌ Error:", e); process.exit(1); });
Running Command

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

Running Command

ls -lh /home/daytona/workspace/haemodynamics-pptx/

Your presentation is ready! πŸŽ‰

Principles of Haemodynamics

Presentation Β· PPTX


What's inside β€” 20 slides, fully MBBS 1st Year style

#SlideContent
1TitleDark navy + red accent, "MBBS 1st Year β€’ Physiology"
2What is Haemodynamics?Definition, key variables, normal CO
3Section headerBlood Flow
4Blood FlowLaminar vs turbulent, normal values, bruits
5Poiseuille's LawFull formula box, r⁴ rule explained
6Section headerVascular Resistance
7ResistancePRU, conductance, arteriolar control
8Series & Parallel circuitsHow organs share circulation
9Section headerBlood Pressure
10Blood Pressure typesSBP/DBP/MAP/Pulse Pressure + normal values
11Ohm's LawQ=Ξ”P/R, MAP=COΓ—TPR formula slides
12Section headerCardiac Output
13Cardiac OutputSVΓ—HR, preload/afterload/contractility
14Frank-Starling LawMechanism, clinical uses
15Venous ReturnMSFP, factors, CO-VR equality
16Blood ViscosityFahraeus-Lindqvist, polycythaemia/anaemia
17Autoregulation70–175 mmHg, myogenic + metabolic theories
18Starling Capillary ForcesOedema causes, normal values
19Normal Values TableCO, SV, HR, MAP, TPR, PVR β€” all in one table
20Clinical ApplicationsHTN, shock, heart failure, anaemia
21Mnemonics6 colourful boxes for exam revision
22Summary10 take-home messages
23Thank You + ReferencesGuyton 14th Ed + GK Pal 3rd Ed
Design: Deep navy background, red + gold accents, formula boxes in teal β€” looks professional but student-friendly. Every slide has a Guyton/GK Pal citation note at the bottom.

Try again

Asking for Preferences
Reading File
Finding Sources
Writing File

~/haemodynamics-pptx/build2.js

const pptxgen = require("pptxgenjs");
const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Principles of Haemodynamics";

// ── PALETTE ──────────────────────────────────────────────────────────────────
const P = {
  bg:      "FFFFFF",
  navy:    "1A3C5E",
  blue:    "2563EB",
  lblue:   "DBEAFE",
  red:     "DC2626",
  lred:    "FEE2E2",
  green:   "059669",
  lgreen:  "D1FAE5",
  orange:  "EA580C",
  lorange: "FFEDD5",
  purple:  "7C3AED",
  lpurple: "EDE9FE",
  yellow:  "F59E0B",
  lyellow: "FEF3C7",
  gray:    "374151",
  lgray:   "F3F4F6",
  white:   "FFFFFF",
  dark:    "111827",
};

// ── REUSABLE HELPERS ─────────────────────────────────────────────────────────

function bg(s) {
  s.addShape(pres.ShapeType.rect, { x:0,y:0,w:"100%",h:"100%", fill:{color:P.bg} });
}

function titleBar(s, title, subtitle) {
  // Full-width coloured header band
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:"100%", h:1.15, fill:{color:P.navy} });
  s.addShape(pres.ShapeType.rect, { x:0, y:1.15, w:"100%", h:0.07, fill:{color:P.blue} });
  s.addText(title, {
    x:0.25, y:0.05, w:9.5, h:0.72,
    fontSize:25, bold:true, color:P.white, fontFace:"Calibri", valign:"bottom", margin:0
  });
  if (subtitle) {
    s.addText(subtitle, {
      x:0.25, y:0.77, w:9.5, h:0.32,
      fontSize:13, color:"93C5FD", fontFace:"Calibri", italic:true, valign:"top", margin:0
    });
  }
}

function pill(s, x, y, w, h, text, bg, fg) {
  s.addShape(pres.ShapeType.roundRect, { x,y,w,h, fill:{color:bg}, line:{color:bg}, rectRadius:0.12 });
  s.addText(text, { x,y,w,h, fontSize:11, bold:true, color:fg||P.white, align:"center", valign:"middle", fontFace:"Calibri", margin:0 });
}

function infoBox(s, x, y, w, h, label, value, accent) {
  s.addShape(pres.ShapeType.roundRect, { x,y,w,h, fill:{color:accent+"22"||P.lblue}, line:{color:accent, pt:1.5}, rectRadius:0.1 });
  s.addText(label, { x:x+0.1, y:y+0.08, w:w-0.2, h:0.28, fontSize:10, bold:true, color:accent, fontFace:"Calibri", margin:0 });
  s.addText(value, { x:x+0.1, y:y+0.32, w:w-0.2, h:h-0.42, fontSize:13, bold:true, color:P.dark, fontFace:"Calibri", valign:"middle", margin:0 });
}

function formulaBox(s, x, y, w, h, formula, accent) {
  s.addShape(pres.ShapeType.roundRect, { x,y,w,h, fill:{color:accent}, line:{color:accent}, rectRadius:0.15 });
  s.addText(formula, { x:x+0.15,y,w:w-0.3,h, fontSize:20, bold:true, color:P.white, align:"center", valign:"middle", fontFace:"Courier New", margin:0 });
}

function sectionDivider(title, subtitle, color) {
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0,y:0,w:"100%",h:"100%", fill:{color:color} });
  s.addShape(pres.ShapeType.rect, { x:0,y:0,w:0.15,h:"100%", fill:{color:P.white+"33"} });
  // Large circle decoration
  s.addShape(pres.ShapeType.ellipse, { x:6.5, y:-1.5, w:5.5, h:5.5, fill:{color:P.white+"18"}, line:{color:P.white+"18"} });
  s.addShape(pres.ShapeType.ellipse, { x:7.2, y:-0.8, w:4, h:4, fill:{color:P.white+"18"}, line:{color:P.white+"18"} });
  s.addText(subtitle || "", { x:0.5, y:1.6, w:7, h:0.5, fontSize:16, color:P.white+"BB", fontFace:"Calibri", bold:false, italic:true });
  s.addText(title, { x:0.5, y:2.1, w:7.5, h:1.6, fontSize:44, bold:true, color:P.white, fontFace:"Calibri" });
  return s;
}

// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 1 β€” COVER
// ─────────────────────────────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  // Left half navy, right half gradient effect
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:"100%", h:"100%", fill:{color:P.navy} });
  s.addShape(pres.ShapeType.rect, { x:5.8, y:0, w:4.2, h:"100%", fill:{color:"0F2845"} });
  // Decorative circles
  s.addShape(pres.ShapeType.ellipse, { x:6.2, y:-0.5, w:4.5, h:4.5, fill:{color:P.blue+"33"}, line:{color:P.blue+"33"} });
  s.addShape(pres.ShapeType.ellipse, { x:7.0, y:2.0, w:3.5, h:3.5, fill:{color:P.blue+"22"}, line:{color:P.blue+"22"} });
  s.addShape(pres.ShapeType.ellipse, { x:5.5, y:1.5, w:1.2, h:1.2, fill:{color:P.red}, line:{color:P.red} });
  // Bottom accent bar
  s.addShape(pres.ShapeType.rect, { x:0, y:5.3, w:"100%", h:0.325, fill:{color:P.blue} });

  s.addText("PRINCIPLES OF", {
    x:0.5, y:0.7, w:7, h:0.55,
    fontSize:17, bold:true, color:"93C5FD", charSpacing:7, fontFace:"Calibri"
  });
  s.addText("HAEMODYNAMICS", {
    x:0.5, y:1.2, w:7.5, h:1.8,
    fontSize:54, bold:true, color:P.white, fontFace:"Calibri"
  });
  s.addShape(pres.ShapeType.rect, { x:0.5, y:3.1, w:3.2, h:0.07, fill:{color:P.red} });
  s.addText("Guyton & Hall  Β·  GK Pal", {
    x:0.5, y:3.25, w:7, h:0.48,
    fontSize:17, color:"93C5FD", italic:true, fontFace:"Calibri"
  });
  s.addText("MBBS 1st Year  |  Physiology  |  Cardiovascular System", {
    x:0.5, y:3.85, w:7, h:0.4,
    fontSize:13, color:P.white+"AA", fontFace:"Calibri"
  });
  // Stats boxes bottom
  const stats = [
    {x:0.5, label:"Cardiac Output", val:"5 L/min"},
    {x:2.9, label:"Normal BP", val:"120/80"},
    {x:5.3, label:"Heart Rate", val:"72 bpm"},
  ];
  stats.forEach(st => {
    s.addShape(pres.ShapeType.roundRect, { x:st.x, y:4.6, w:2.0, h:0.58, fill:{color:P.blue+"55"}, line:{color:P.blue}, rectRadius:0.08 });
    s.addText(st.label + "\n" + st.val, {
      x:st.x+0.05, y:4.6, w:1.9, h:0.58,
      fontSize:11, bold:true, color:P.white, align:"center", valign:"middle", fontFace:"Calibri", margin:0
    });
  });
}

// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 2 β€” LEARNING OBJECTIVES
// ─────────────────────────────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  bg(s);
  titleBar(s, "Learning Objectives", "By the end of this session, you should be able to:");

  const objs = [
    { num:"01", text:"Define blood flow, pressure & vascular resistance", color:P.blue },
    { num:"02", text:"Apply Poiseuille's Law & Ohm's Law to circulation", color:P.red },
    { num:"03", text:"Explain cardiac output and its regulation", color:P.green },
    { num:"04", text:"Describe Frank-Starling mechanism", color:P.orange },
    { num:"05", text:"Understand capillary exchange (Starling Forces)", color:P.purple },
    { num:"06", text:"Correlate haemodynamics with clinical conditions", color:P.yellow },
  ];

  objs.forEach((obj, i) => {
    const x = i < 3 ? 0.3 : 5.2;
    const y = 1.4 + (i % 3) * 1.3;
    s.addShape(pres.ShapeType.roundRect, { x, y, w:4.5, h:1.1, fill:{color:obj.color+"11"}, line:{color:obj.color, pt:1.5}, rectRadius:0.12 });
    s.addShape(pres.ShapeType.roundRect, { x:x+0.12, y:y+0.2, w:0.5, h:0.5, fill:{color:obj.color}, line:{color:obj.color}, rectRadius:0.06 });
    s.addText(obj.num, { x:x+0.12, y:y+0.2, w:0.5, h:0.5, fontSize:15, bold:true, color:P.white, align:"center", valign:"middle", fontFace:"Calibri", margin:0 });
    s.addText(obj.text, { x:x+0.75, y:y+0.12, w:3.65, h:0.78, fontSize:13, color:P.dark, fontFace:"Calibri", valign:"middle" });
  });
}

// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 3 β€” SECTION: BLOOD FLOW
// ─────────────────────────────────────────────────────────────────────────────
sectionDivider("Blood Flow", "Topic 1  Β·  Guyton & Hall Ch. 14", P.blue);

// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 4 β€” BLOOD FLOW BASICS
// ─────────────────────────────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  bg(s);
  titleBar(s, "Blood Flow", "Guyton Ch.14 β€” Definition, Types & Measurement");

  // Left column β€” content
  const items = [
    ["Definition", "Volume of blood passing a given point per unit time", P.blue],
    ["Unit", "mL/min or L/min", P.blue],
    ["Normal (adult)", "5,000–6,000 mL/min = Cardiac Output", P.green],
    ["Men vs Women", "CO ~10–20% higher in men (larger body mass)", P.green],
  ];

  items.forEach(([label,val,col], i) => {
    infoBox(s, 0.3, 1.35 + i*0.95, 5.5, 0.82, label, val, col);
  });

  // Right column β€” Flow types visual
  s.addShape(pres.ShapeType.roundRect, { x:6.1, y:1.35, w:3.6, h:4.1, fill:{color:P.lgray}, line:{color:"D1D5DB"}, rectRadius:0.15 });
  s.addText("TYPES OF FLOW", { x:6.1, y:1.4, w:3.6, h:0.4, fontSize:13, bold:true, color:P.navy, align:"center", fontFace:"Calibri", margin:0 });

  // Laminar
  s.addShape(pres.ShapeType.rect, { x:6.3, y:1.9, w:3.2, h:0.07, fill:{color:P.blue+"44"} });
  s.addShape(pres.ShapeType.rect, { x:6.3, y:2.0, w:3.2, h:0.07, fill:{color:P.blue+"77"} });
  s.addShape(pres.ShapeType.rect, { x:6.3, y:2.1, w:3.2, h:0.07, fill:{color:P.blue+"AA"} });
  s.addShape(pres.ShapeType.rect, { x:6.3, y:2.2, w:3.2, h:0.07, fill:{color:P.blue} });
  s.addShape(pres.ShapeType.rect, { x:6.3, y:2.3, w:3.2, h:0.07, fill:{color:P.blue+"AA"} });
  s.addShape(pres.ShapeType.rect, { x:6.3, y:2.4, w:3.2, h:0.07, fill:{color:P.blue+"77"} });
  s.addShape(pres.ShapeType.rect, { x:6.3, y:2.5, w:3.2, h:0.07, fill:{color:P.blue+"44"} });
  s.addText("LAMINAR  (silent, normal)", { x:6.1, y:2.62, w:3.6, h:0.32, fontSize:11, color:P.blue, bold:true, align:"center", fontFace:"Calibri", margin:0 });
  s.addText("Concentric rings; centre fastest", { x:6.1, y:2.9, w:3.6, h:0.25, fontSize:10, color:P.gray, align:"center", fontFace:"Calibri", italic:true, margin:0 });

  // Turbulent
  s.addShape(pres.ShapeType.roundRect, { x:6.3, y:3.3, w:3.2, h:0.7, fill:{color:P.red+"22"}, line:{color:P.red}, rectRadius:0.1 });
  s.addText("β‰ˆβ‰ˆ TURBULENT β‰ˆβ‰ˆ\n(chaotic β†’ bruits)", { x:6.3, y:3.3, w:3.2, h:0.7, fontSize:12, bold:true, color:P.red, align:"center", valign:"middle", fontFace:"Calibri", margin:0 });
  s.addText("High velocity, bifurcations, stenosis", { x:6.1, y:4.1, w:3.6, h:0.25, fontSize:10, color:P.gray, align:"center", fontFace:"Calibri", italic:true, margin:0 });

  // Reynolds number
  pill(s, 6.3, 4.42, 3.2, 0.4, "Reynolds No. > 2000 β†’ Turbulence", P.orange, P.white);

  // Bottom bar
  s.addShape(pres.ShapeType.rect, { x:0, y:5.32, w:"100%", h:0.305, fill:{color:P.lgray} });
  s.addText("GK Pal: Turbulent flow = Bruits on auscultation  |  Laminar flow = Silent  |  Guyton Ch.14", {
    x:0.2, y:5.33, w:9.6, h:0.28, fontSize:10, color:P.gray, italic:true, fontFace:"Calibri", margin:0
  });
}

// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 5 β€” POISEUILLE'S LAW
// ─────────────────────────────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  bg(s);
  titleBar(s, "Poiseuille's Law", "The most important equation in haemodynamics");

  // Central formula
  s.addShape(pres.ShapeType.roundRect, { x:0.5, y:1.35, w:9, h:1.2, fill:{color:P.navy}, line:{color:P.navy}, rectRadius:0.15 });
  s.addText("F  =  Ο€ Γ— Ξ”P Γ— r⁴  /  8 Γ— Ξ· Γ— l", {
    x:0.5, y:1.35, w:9, h:1.2,
    fontSize:30, bold:true, color:P.white, align:"center", valign:"middle", fontFace:"Courier New", margin:0
  });

  // Variables grid
  const vars = [
    {sym:"F",  meaning:"Flow rate", unit:"mL/min", col:P.blue},
    {sym:"Ξ”P", meaning:"Pressure difference", unit:"mmHg", col:P.red},
    {sym:"r",  meaning:"Radius of vessel ⭐", unit:"cm", col:P.orange},
    {sym:"Ξ·",  meaning:"Blood viscosity", unit:"poise", col:P.purple},
    {sym:"l",  meaning:"Length of vessel", unit:"cm", col:P.green},
    {sym:"Ο€/8", meaning:"Mathematical constant", unit:"β€”", col:P.gray},
  ];

  vars.forEach((v, i) => {
    const x = 0.3 + (i % 3) * 3.2;
    const y = 2.75 + Math.floor(i / 3) * 0.85;
    s.addShape(pres.ShapeType.roundRect, { x, y, w:3.1, h:0.72, fill:{color:v.col+"18"}, line:{color:v.col, pt:1.5}, rectRadius:0.1 });
    s.addShape(pres.ShapeType.roundRect, { x:x+0.1, y:y+0.12, w:0.5, h:0.48, fill:{color:v.col}, line:{color:v.col}, rectRadius:0.07 });
    s.addText(v.sym, { x:x+0.1, y:y+0.12, w:0.5, h:0.48, fontSize:13, bold:true, color:P.white, align:"center", valign:"middle", fontFace:"Courier New", margin:0 });
    s.addText(v.meaning, { x:x+0.68, y:y+0.06, w:2.35, h:0.33, fontSize:11, bold:true, color:P.dark, fontFace:"Calibri", margin:0 });
    s.addText(v.unit, { x:x+0.68, y:y+0.37, w:2.35, h:0.25, fontSize:10, color:P.gray, fontFace:"Calibri", italic:true, margin:0 });
  });

  // Key insight banner
  s.addShape(pres.ShapeType.rect, { x:0, y:5.28, w:"100%", h:0.345, fill:{color:P.orange} });
  s.addText("⭐  KEY:  Flow ∝ r⁴  |  Double radius β†’ 16Γ— flow  |  4Γ— radius β†’ 256Γ— flow  |  Arterioles are the master regulators!", {
    x:0.2, y:5.28, w:9.6, h:0.34, fontSize:12, bold:true, color:P.white, align:"center", fontFace:"Calibri", valign:"middle", margin:0
  });
}

// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 6 β€” SECTION: VASCULAR RESISTANCE
// ─────────────────────────────────────────────────────────────────────────────
sectionDivider("Vascular Resistance", "Topic 2  Β·  Guyton & Hall Ch. 14", P.red);

// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 7 β€” RESISTANCE & OHM'S LAW
// ─────────────────────────────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  bg(s);
  titleBar(s, "Vascular Resistance & Ohm's Law", "Guyton Ch.14 β€” The governing principle of circulation");

  // Ohm's analogy β€” two column layout
  s.addShape(pres.ShapeType.roundRect, { x:0.3, y:1.3, w:4.4, h:4.1, fill:{color:P.lblue}, line:{color:P.blue, pt:1.5}, rectRadius:0.15 });
  s.addText("⚑  ELECTRICAL", { x:0.3, y:1.35, w:4.4, h:0.45, fontSize:14, bold:true, color:P.blue, align:"center", fontFace:"Calibri", margin:0 });
  const elec = ["Current (I)", "Voltage (V)", "Resistance (R)", "I = V / R"];
  elec.forEach((t, i) => {
    s.addText((i < 3 ? "β–Έ  " : "➀  ") + t, {
      x:0.5, y:1.85 + i*0.45, w:4.0, h:0.4,
      fontSize: i === 3 ? 18 : 14, bold: i===3, color: i===3 ? P.blue : P.dark,
      fontFace: i===3 ? "Courier New" : "Calibri", margin:0
    });
  });

  s.addShape(pres.ShapeType.roundRect, { x:5.3, y:1.3, w:4.4, h:4.1, fill:{color:P.lred}, line:{color:P.red, pt:1.5}, rectRadius:0.15 });
  s.addText("🩸  CIRCULATION", { x:5.3, y:1.35, w:4.4, h:0.45, fontSize:14, bold:true, color:P.red, align:"center", fontFace:"Calibri", margin:0 });
  const circ = ["Blood Flow (Q)", "Pressure (Ξ”P)", "Resistance (R)", "Q = Ξ”P / R"];
  circ.forEach((t, i) => {
    s.addText((i < 3 ? "β–Έ  " : "➀  ") + t, {
      x:5.5, y:1.85 + i*0.45, w:4.0, h:0.4,
      fontSize: i === 3 ? 18 : 14, bold: i===3, color: i===3 ? P.red : P.dark,
      fontFace: i===3 ? "Courier New" : "Calibri", margin:0
    });
  });

  // Equals arrow between
  s.addShape(pres.ShapeType.rect, { x:4.72, y:2.9, w:0.56, h:0.07, fill:{color:P.gray} });
  s.addText("=", { x:4.7, y:2.72, w:0.6, h:0.5, fontSize:28, bold:true, color:P.gray, align:"center", fontFace:"Calibri", margin:0 });

  // Normal resistance values
  const rvals = [
    ["TPR (normal)", "~1 PRU", P.navy],
    ["Strong vasoconstriction", "4 PRU", P.red],
    ["Max vasodilation", "0.2 PRU", P.green],
    ["Pulmonary VR", "~0.14 PRU", P.blue],
  ];
  rvals.forEach((rv, i) => {
    const x = 0.3 + (i % 2) * 4.7;
    const y = 3.5 + Math.floor(i / 2) * 0.55;
    s.addShape(pres.ShapeType.roundRect, { x, y, w:4.3, h:0.44, fill:{color:rv[2]+"18"}, line:{color:rv[2]}, rectRadius:0.08 });
    s.addText(rv[0] + "  β†’  " + rv[1], { x:x+0.1, y, w:4.1, h:0.44, fontSize:12, bold:true, color:rv[2], fontFace:"Calibri", valign:"middle", margin:0 });
  });

  s.addShape(pres.ShapeType.rect, { x:0, y:5.28, w:"100%", h:0.345, fill:{color:P.lgray} });
  s.addText("PRU = Peripheral Resistance Unit  |  1 PRU = 1 mmHg / 1 mL·sec⁻¹  |  Arterioles contribute ~2/3 of TPR", {
    x:0.2, y:5.3, w:9.6, h:0.3, fontSize:10, color:P.gray, italic:true, fontFace:"Calibri", margin:0
  });
}

// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 8 β€” SERIES & PARALLEL
// ─────────────────────────────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  bg(s);
  titleBar(s, "Series & Parallel Vascular Circuits", "Guyton Ch.14 β€” How organs share the circulation");

  // Series box
  s.addShape(pres.ShapeType.roundRect, { x:0.3, y:1.3, w:4.4, h:3.8, fill:{color:P.lyellow}, line:{color:P.yellow, pt:2}, rectRadius:0.15 });
  s.addText("IN SERIES", { x:0.3, y:1.35, w:4.4, h:0.5, fontSize:18, bold:true, color:P.orange, align:"center", fontFace:"Calibri", margin:0 });
  s.addText("Arteries β†’ Arterioles β†’ Capillaries β†’ Venules β†’ Veins", {
    x:0.45, y:1.88, w:4.1, h:0.4, fontSize:10, color:P.gray, italic:true, fontFace:"Calibri", margin:0
  });
  // Series resistor diagram
  ["R₁", "Rβ‚‚", "R₃"].forEach((r, i) => {
    s.addShape(pres.ShapeType.rect, { x:0.6 + i*1.3, y:2.45, w:0.9, h:0.45, fill:{color:P.orange}, line:{color:P.orange}, rectRadius:0 });
    s.addText(r, { x:0.6 + i*1.3, y:2.45, w:0.9, h:0.45, fontSize:13, bold:true, color:P.white, align:"center", valign:"middle", fontFace:"Courier New", margin:0 });
    if (i < 2) s.addShape(pres.ShapeType.rect, { x:1.5 + i*1.3, y:2.63, w:0.4, h:0.07, fill:{color:P.orange} });
  });
  s.addText("R_total = R₁ + Rβ‚‚ + R₃ + ...", {
    x:0.45, y:3.1, w:4.1, h:0.5, fontSize:14, bold:true, color:P.orange, align:"center", fontFace:"Courier New", margin:0
  });
  const sFacts = ["Flow is SAME through each segment", "Total resistance is SUM of all", "Analogy: Single road, multiple checkpoints"];
  sFacts.forEach((f, i) => {
    s.addText("βœ“  " + f, { x:0.45, y:3.75 + i*0.38, w:4.1, h:0.35, fontSize:11, color:P.dark, fontFace:"Calibri", margin:0 });
  });

  // Parallel box
  s.addShape(pres.ShapeType.roundRect, { x:5.3, y:1.3, w:4.4, h:3.8, fill:{color:P.lgreen}, line:{color:P.green, pt:2}, rectRadius:0.15 });
  s.addText("IN PARALLEL", { x:5.3, y:1.35, w:4.4, h:0.5, fontSize:18, bold:true, color:P.green, align:"center", fontFace:"Calibri", margin:0 });
  s.addText("Brain, Heart, Kidneys, Liver, Muscle β€” all simultaneously", {
    x:5.45, y:1.88, w:4.1, h:0.4, fontSize:10, color:P.gray, italic:true, fontFace:"Calibri", margin:0
  });
  // Parallel resistor diagram
  ["R₁", "Rβ‚‚", "R₃"].forEach((r, i) => {
    s.addShape(pres.ShapeType.rect, { x:6.5, y:2.35 + i*0.32, w:0.9, h:0.25, fill:{color:P.green}, line:{color:P.green} });
    s.addText(r, { x:6.5, y:2.35 + i*0.32, w:0.9, h:0.25, fontSize:10, bold:true, color:P.white, align:"center", valign:"middle", fontFace:"Courier New", margin:0 });
    s.addShape(pres.ShapeType.rect, { x:6.1, y:2.44 + i*0.32, w:0.4, h:0.07, fill:{color:P.green} });
    s.addShape(pres.ShapeType.rect, { x:7.4, y:2.44 + i*0.32, w:0.4, h:0.07, fill:{color:P.green} });
  });
  s.addText("1/R_total = 1/R₁ + 1/Rβ‚‚ + 1/R₃", {
    x:5.45, y:3.38, w:4.1, h:0.5, fontSize:13, bold:true, color:P.green, align:"center", fontFace:"Courier New", margin:0
  });
  const pFacts = ["Pressure is SAME across each organ", "Adding organs DECREASES total resistance", "Analogy: Multiple lanes on a highway"];
  pFacts.forEach((f, i) => {
    s.addText("βœ“  " + f, { x:5.45, y:3.98 + i*0.36, w:4.1, h:0.33, fontSize:11, color:P.dark, fontFace:"Calibri", margin:0 });
  });

  s.addShape(pres.ShapeType.rect, { x:0, y:5.28, w:"100%", h:0.345, fill:{color:P.lgray} });
  s.addText("EXAM TIP: Arteries→capillaries = Series (R adds)  |  Brain, kidney, liver = Parallel (R decreases)  |  Guyton Ch.14", {
    x:0.2, y:5.3, w:9.6, h:0.3, fontSize:10, color:P.gray, italic:true, fontFace:"Calibri", margin:0
  });
}

// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 9 β€” SECTION: BLOOD PRESSURE
// ─────────────────────────────────────────────────────────────────────────────
sectionDivider("Blood Pressure", "Topic 3  Β·  Guyton & Hall Ch. 15", P.green);

// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 10 β€” BLOOD PRESSURE TYPES
// ─────────────────────────────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  bg(s);
  titleBar(s, "Blood Pressure β€” Types & Formulae", "Guyton Ch.15 β€” Normal values you MUST memorise");

  // BP gauge visual β€” left side
  s.addShape(pres.ShapeType.ellipse, { x:0.3, y:1.45, w:3.5, h:3.5, fill:{color:P.lgray}, line:{color:"D1D5DB", pt:2} });
  // SBP arc
  s.addShape(pres.ShapeType.roundRect, { x:0.6, y:1.7, w:3.0, h:0.6, fill:{color:P.red}, line:{color:P.red}, rectRadius:0.08 });
  s.addText("SYSTOLIC  120 mmHg", { x:0.6, y:1.7, w:3.0, h:0.6, fontSize:14, bold:true, color:P.white, align:"center", valign:"middle", fontFace:"Calibri", margin:0 });
  // MAP bar
  s.addShape(pres.ShapeType.roundRect, { x:0.6, y:2.5, w:3.0, h:0.55, fill:{color:P.orange}, line:{color:P.orange}, rectRadius:0.08 });
  s.addText("MAP  ~93 mmHg", { x:0.6, y:2.5, w:3.0, h:0.55, fontSize:14, bold:true, color:P.white, align:"center", valign:"middle", fontFace:"Calibri", margin:0 });
  // DBP bar
  s.addShape(pres.ShapeType.roundRect, { x:0.6, y:3.25, w:3.0, h:0.55, fill:{color:P.blue}, line:{color:P.blue}, rectRadius:0.08 });
  s.addText("DIASTOLIC  80 mmHg", { x:0.6, y:3.25, w:3.0, h:0.55, fontSize:14, bold:true, color:P.white, align:"center", valign:"middle", fontFace:"Calibri", margin:0 });
  // Pulse pressure
  s.addShape(pres.ShapeType.roundRect, { x:0.6, y:4.0, w:3.0, h:0.55, fill:{color:P.purple}, line:{color:P.purple}, rectRadius:0.08 });
  s.addText("PULSE PRESSURE  40 mmHg", { x:0.6, y:4.0, w:3.0, h:0.55, fontSize:13, bold:true, color:P.white, align:"center", valign:"middle", fontFace:"Calibri", margin:0 });

  // Right side β€” formulae
  const formulas = [
    { f:"MAP  =  DBP  +  ¹⁄₃(SBPβˆ’DBP)", c:P.orange, label:"Mean Arterial Pressure" },
    { f:"PP  =  SBP βˆ’ DBP  =  40", c:P.purple, label:"Pulse Pressure" },
    { f:"MAP  =  CO  Γ—  TPR", c:P.red, label:"Haemodynamic equation" },
  ];
  formulas.forEach((fm, i) => {
    s.addShape(pres.ShapeType.roundRect, { x:4.05, y:1.45 + i*1.35, w:5.7, h:1.15, fill:{color:fm.c+"15"}, line:{color:fm.c, pt:1.5}, rectRadius:0.12 });
    s.addText(fm.label, { x:4.2, y:1.5 + i*1.35, w:5.4, h:0.3, fontSize:11, bold:true, color:fm.c, fontFace:"Calibri", margin:0 });
    s.addText(fm.f, { x:4.2, y:1.78 + i*1.35, w:5.4, h:0.65, fontSize:18, bold:true, color:P.dark, fontFace:"Courier New", valign:"middle", margin:0 });
  });

  s.addShape(pres.ShapeType.rect, { x:0, y:5.28, w:"100%", h:0.345, fill:{color:P.lgray} });
  s.addText("↑ PP in: aortic regurgitation, atherosclerosis  |  ↓ PP in: aortic stenosis, cardiogenic shock  |  GK Pal", {
    x:0.2, y:5.3, w:9.6, h:0.3, fontSize:10, color:P.gray, italic:true, fontFace:"Calibri", margin:0
  });
}

// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 11 β€” SECTION: CARDIAC OUTPUT
// ─────────────────────────────────────────────────────────────────────────────
sectionDivider("Cardiac Output", "Topic 4  Β·  Guyton & Hall Ch. 20", P.orange);

// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 12 β€” CARDIAC OUTPUT DETERMINANTS
// ─────────────────────────────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  bg(s);
  titleBar(s, "Cardiac Output β€” Definition & Determinants", "Guyton Ch.20 β€” CO = SV Γ— HR = ~5 L/min at rest");

  // Central formula big box
  s.addShape(pres.ShapeType.roundRect, { x:2.5, y:1.3, w:5, h:0.9, fill:{color:P.navy}, line:{color:P.navy}, rectRadius:0.15 });
  s.addText("CO  =  SV  Γ—  HR", { x:2.5, y:1.3, w:5, h:0.9, fontSize:26, bold:true, color:P.white, align:"center", valign:"middle", fontFace:"Courier New", margin:0 });

  // Three determinants of SV
  const svDets = [
    { title:"PRELOAD", icon:"⬆", desc:"Ventricular filling\n(EDV)", detail:"↑ Preload β†’ ↑ SV\n(Frank-Starling Law)", col:P.blue },
    { title:"AFTERLOAD", icon:"⬇", desc:"Resistance to ejection\n(Aortic pressure)", detail:"↑ Afterload β†’ ↓ SV\n(↑ BP β†’ harder pumping)", col:P.red },
    { title:"CONTRACTILITY", icon:"πŸ’ͺ", desc:"Intrinsic myocardial\nstrength (inotropy)", detail:"↑ Inotropy β†’ ↑ SV\n(Adrenaline, digoxin)", col:P.green },
  ];
  svDets.forEach((d, i) => {
    const x = 0.3 + i * 3.25;
    s.addShape(pres.ShapeType.roundRect, { x, y:2.4, w:3.1, h:2.8, fill:{color:d.col+"15"}, line:{color:d.col, pt:2}, rectRadius:0.15 });
    s.addShape(pres.ShapeType.ellipse, { x:x+1.1, y:2.38, w:0.9, h:0.65, fill:{color:d.col}, line:{color:d.col} });
    s.addText(d.icon, { x:x+1.1, y:2.38, w:0.9, h:0.65, fontSize:13, align:"center", valign:"middle", fontFace:"Calibri", margin:0 });
    s.addText(d.title, { x:x+0.1, y:3.08, w:2.9, h:0.42, fontSize:14, bold:true, color:d.col, align:"center", fontFace:"Calibri", margin:0 });
    s.addText(d.desc, { x:x+0.1, y:3.52, w:2.9, h:0.6, fontSize:11, color:P.dark, align:"center", fontFace:"Calibri", italic:true, margin:0 });
    s.addShape(pres.ShapeType.rect, { x:x+0.3, y:4.15, w:2.5, h:0.04, fill:{color:d.col+"77"} });
    s.addText(d.detail, { x:x+0.1, y:4.22, w:2.9, h:0.72, fontSize:11, color:d.col, align:"center", fontFace:"Calibri", bold:true, margin:0 });
  });

  // Normal values strip
  s.addShape(pres.ShapeType.rect, { x:0, y:5.28, w:"100%", h:0.345, fill:{color:P.orange+"EE"} });
  s.addText("CO=5 L/min  |  CI=3.2 L/min/mΒ²  |  SV=70 mL  |  HR=72 bpm  |  EDV=120 mL  |  ESV=50 mL  |  EF=60%", {
    x:0.2, y:5.28, w:9.6, h:0.345, fontSize:12, bold:true, color:P.white, align:"center", valign:"middle", fontFace:"Calibri", margin:0
  });
}

// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 13 β€” FRANK-STARLING
// ─────────────────────────────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  bg(s);
  titleBar(s, "Frank-Starling Law of the Heart", "Guyton Ch.20 β€” 'The more you fill, the more it pumps'");

  // Law statement box
  s.addShape(pres.ShapeType.roundRect, { x:0.3, y:1.3, w:9.4, h:0.65, fill:{color:P.blue}, line:{color:P.blue}, rectRadius:0.1 });
  s.addText("Force of contraction  ∝  Initial fibre length  (within physiological limits)", {
    x:0.3, y:1.3, w:9.4, h:0.65, fontSize:16, bold:true, color:P.white, align:"center", valign:"middle", fontFace:"Calibri", margin:0
  });

  // Step-by-step chain
  const steps = [
    { label:"↑ Venous Return", col:P.blue },
    { label:"↑ EDV (Preload)", col:P.blue },
    { label:"↑ Sarcomere Stretch", col:P.orange },
    { label:"↑ Actin-Myosin Overlap", col:P.orange },
    { label:"↑ Crossbridge Formation", col:P.red },
    { label:"↑ Stroke Volume", col:P.green },
  ];
  steps.forEach((st, i) => {
    const x = 0.3 + (i % 3) * 3.2;
    const y = 2.2 + Math.floor(i / 3) * 1.4;
    s.addShape(pres.ShapeType.roundRect, { x, y, w:3.0, h:0.72, fill:{color:st.col}, line:{color:st.col}, rectRadius:0.1 });
    s.addText(st.label, { x, y, w:3.0, h:0.72, fontSize:14, bold:true, color:P.white, align:"center", valign:"middle", fontFace:"Calibri", margin:0 });
    // Arrow
    if (i % 3 < 2) {
      s.addShape(pres.ShapeType.rect, { x:x+3.0, y:y+0.3, w:0.2, h:0.1, fill:{color:P.gray} });
    }
  });

  // Clinical box
  s.addShape(pres.ShapeType.roundRect, { x:0.3, y:4.75, w:9.4, h:0.42, fill:{color:P.lgreen}, line:{color:P.green, pt:1.5}, rectRadius:0.08 });
  s.addText("Clinical: IV fluids in shock β†’ ↑ preload β†’ ↑ CO  |  Decompensated HF: over-stretching β†’ ↓ contractility (descending limb)", {
    x:0.4, y:4.75, w:9.2, h:0.42, fontSize:11, color:P.green, bold:true, fontFace:"Calibri", valign:"middle", margin:0
  });

  s.addShape(pres.ShapeType.rect, { x:0, y:5.28, w:"100%", h:0.345, fill:{color:P.lgray} });
  s.addText("GK Pal: 'The heart pumps all the blood that comes to it'  |  Both ventricles pump equal volumes via Frank-Starling", {
    x:0.2, y:5.3, w:9.6, h:0.3, fontSize:10, color:P.gray, italic:true, fontFace:"Calibri", margin:0
  });
}

// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 14 β€” SECTION: REGULATION
// ─────────────────────────────────────────────────────────────────────────────
sectionDivider("Autoregulation & Venous Return", "Topic 5  Β·  Guyton & Hall Ch. 17, 20", P.purple);

// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 15 β€” AUTOREGULATION
// ─────────────────────────────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  bg(s);
  titleBar(s, "Autoregulation of Blood Flow", "Guyton Ch.17 β€” Each tissue controls its own blood supply");

  s.addShape(pres.ShapeType.roundRect, { x:0.3, y:1.3, w:9.4, h:0.65, fill:{color:P.purple}, line:{color:P.purple}, rectRadius:0.1 });
  s.addText("Autoregulation: Maintain CONSTANT flow despite changes in arterial pressure (70–175 mmHg)", {
    x:0.3, y:1.3, w:9.4, h:0.65, fontSize:14, bold:true, color:P.white, align:"center", valign:"middle", fontFace:"Calibri", margin:0
  });

  // Two mechanisms
  s.addShape(pres.ShapeType.roundRect, { x:0.3, y:2.1, w:4.5, h:2.5, fill:{color:P.lpurple}, line:{color:P.purple, pt:1.5}, rectRadius:0.12 });
  s.addText("MYOGENIC THEORY", { x:0.3, y:2.15, w:4.5, h:0.4, fontSize:14, bold:true, color:P.purple, align:"center", fontFace:"Calibri", margin:0 });
  const myoSteps = ["↑ Arterial pressure", "β†’ ↑ Wall stretch", "β†’ Smooth muscle contracts", "β†’ Vasoconstriction", "β†’ ↓ Flow back to normal"];
  myoSteps.forEach((st, i) => {
    s.addText((i===0?"":"  ") + st, { x:0.45, y:2.62 + i*0.37, w:4.2, h:0.34, fontSize:12, color:P.dark, fontFace:"Calibri", margin:0 });
  });

  s.addShape(pres.ShapeType.roundRect, { x:5.2, y:2.1, w:4.5, h:2.5, fill:{color:P.lyellow}, line:{color:P.yellow, pt:1.5}, rectRadius:0.12 });
  s.addText("METABOLIC THEORY", { x:5.2, y:2.15, w:4.5, h:0.4, fontSize:14, bold:true, color:P.orange, align:"center", fontFace:"Calibri", margin:0 });
  const metSteps = ["↑ Tissue metabolism", "β†’ ↓ Oβ‚‚, ↑ COβ‚‚, ↑ H⁺, ↑ Adenosine", "β†’ Local vasodilators released", "β†’ Vasodilation", "β†’ ↑ Flow to meet demand"];
  metSteps.forEach((st, i) => {
    s.addText((i===0?"":"  ") + st, { x:5.35, y:2.62 + i*0.37, w:4.2, h:0.34, fontSize:12, color:P.dark, fontFace:"Calibri", margin:0 });
  });

  // Organs
  pill(s, 0.3, 4.75, 1.8, 0.4, "🧠 Brain", P.purple, P.white);
  pill(s, 2.2, 4.75, 1.8, 0.4, "❀️ Heart", P.red, P.white);
  pill(s, 4.1, 4.75, 1.8, 0.4, "🫘 Kidney", P.blue, P.white);
  pill(s, 6.0, 4.75, 1.8, 0.4, "πŸ’ͺ Muscle", P.green, P.white);
  pill(s, 7.9, 4.75, 1.8, 0.4, "⭐ Strong", P.orange, P.white);

  s.addShape(pres.ShapeType.rect, { x:0, y:5.28, w:"100%", h:0.345, fill:{color:P.lgray} });
  s.addText("Critical closing pressure: below this, vessels collapse  |  Sympathetic vasoconstrictors overridden by autoregulation within hours", {
    x:0.2, y:5.3, w:9.6, h:0.3, fontSize:10, color:P.gray, italic:true, fontFace:"Calibri", margin:0
  });
}

// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 16 β€” SECTION: CAPILLARY EXCHANGE
// ─────────────────────────────────────────────────────────────────────────────
sectionDivider("Capillary Exchange & Starling Forces", "Topic 6  Β·  Guyton & Hall Ch. 16", "059669");

// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 17 β€” STARLING FORCES
// ─────────────────────────────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  bg(s);
  titleBar(s, "Starling Forces β€” Capillary Exchange", "Guyton Ch.16 β€” Filtration vs Absorption at the capillary");

  // Formula
  s.addShape(pres.ShapeType.roundRect, { x:0.3, y:1.3, w:9.4, h:0.8, fill:{color:P.green+"CC"}, line:{color:P.green}, rectRadius:0.12 });
  s.addText("Net Filtration = (Pc + Ο€i) βˆ’ (Pi + Ο€c)", {
    x:0.3, y:1.3, w:9.4, h:0.8, fontSize:22, bold:true, color:P.white, align:"center", valign:"middle", fontFace:"Courier New", margin:0
  });

  // Four forces grid
  const forces = [
    { name:"Pc", full:"Capillary Hydrostatic Pressure", val:"Arterial end: 32 mmHg\nVenous end: 15 mmHg", dir:"FAVOURS FILTRATION", col:P.red },
    { name:"Ο€c", full:"Plasma Oncotic Pressure", val:"~28 mmHg\n(Albumin is key)", dir:"OPPOSES FILTRATION", col:P.blue },
    { name:"Pi", full:"Interstitial Hydrostatic Pressure", val:"~βˆ’3 mmHg\n(slightly negative)", dir:"FAVOURS FILTRATION", col:P.orange },
    { name:"Ο€i", full:"Interstitial Oncotic Pressure", val:"~8 mmHg\n(lymph proteins)", dir:"OPPOSES FILTRATION", col:P.purple },
  ];
  forces.forEach((f, i) => {
    const x = 0.3 + (i % 2) * 4.7;
    const y = 2.3 + Math.floor(i / 2) * 1.35;
    s.addShape(pres.ShapeType.roundRect, { x, y, w:4.4, h:1.15, fill:{color:f.col+"18"}, line:{color:f.col, pt:1.5}, rectRadius:0.1 });
    s.addShape(pres.ShapeType.roundRect, { x:x+0.1, y:y+0.12, w:0.5, h:0.85, fill:{color:f.col}, line:{color:f.col}, rectRadius:0.07 });
    s.addText(f.name, { x:x+0.1, y:y+0.12, w:0.5, h:0.85, fontSize:16, bold:true, color:P.white, align:"center", valign:"middle", fontFace:"Courier New", margin:0 });
    s.addText(f.full, { x:x+0.7, y:y+0.08, w:3.6, h:0.3, fontSize:11, bold:true, color:f.col, fontFace:"Calibri", margin:0 });
    s.addText(f.val, { x:x+0.7, y:y+0.38, w:3.6, h:0.45, fontSize:11, color:P.dark, fontFace:"Calibri", margin:0 });
    pill(s, x+0.7, y+0.84, 3.4, 0.24, f.dir, f.col, P.white);
  });

  s.addShape(pres.ShapeType.rect, { x:0, y:5.28, w:"100%", h:0.345, fill:{color:P.lgray} });
  s.addText("Oedema causes: ↑Pc (heart failure) | ↓πc (nephrotic syndrome, cirrhosis) | ↑ Permeability (sepsis) | Lymph block (filariasis)", {
    x:0.2, y:5.3, w:9.6, h:0.3, fontSize:10, color:P.gray, italic:true, fontFace:"Calibri", margin:0
  });
}

// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 18 β€” NORMAL VALUES TABLE
// ─────────────────────────────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  bg(s);
  titleBar(s, "Normal Haemodynamic Values β€” Quick Reference", "Memorise these for MBBS theory & viva examinations");

  const headers = [
    { text:"Parameter", options:{bold:true, color:P.white, fill:P.navy, fontSize:13, align:"center"} },
    { text:"Normal Value", options:{bold:true, color:P.white, fill:P.navy, fontSize:13, align:"center"} },
    { text:"Unit", options:{bold:true, color:P.white, fill:P.navy, fontSize:13, align:"center"} },
    { text:"Clinical Note", options:{bold:true, color:P.white, fill:P.navy, fontSize:13, align:"center"} },
  ];
  const rows = [
    ["Cardiac Output (CO)", "5–6", "L/min", "↑ exercise, fever, anaemia"],
    ["Cardiac Index (CI)", "3.2", "L/min/mΒ²", "Corrects CO for body size"],
    ["Stroke Volume (SV)", "70", "mL/beat", "CO = SV Γ— HR"],
    ["Heart Rate (HR)", "60–100", "beats/min", "SNS ↑ HR; PNS ↓ HR"],
    ["Systolic BP", "120", "mmHg", "< 90 = hypotension"],
    ["Diastolic BP", "80", "mmHg", "> 90 = HTN Stage 1"],
    ["MAP", "~93", "mmHg", "DBP + β…“ Pulse Pressure"],
    ["TPR (Total Peripheral R)", "~1", "PRU", "Arterioles are the key"],
    ["Pulmonary VR", "~0.14", "PRU", "1/7th of systemic"],
    ["Blood Viscosity", "3–4Γ—", "(relative to water)", "↑ in polycythaemia"],
  ];

  const rowColors = ["EBF5FF", "F0FFF4", "FFF7ED", "F5F3FF", "FEF9C3",
                     "EBF5FF", "F0FFF4", "FFF7ED", "F5F3FF", "FEF9C3"];

  const tableData = [
    headers.map(h => h),
    ...rows.map((row, ri) =>
      row.map((cell, ci) => ({
        text: cell,
        options: {
          color: P.dark, fill: rowColors[ri], fontSize: 11.5, align: ci === 0 ? "left" : "center",
          bold: ci === 1
        }
      }))
    )
  ];

  s.addTable(tableData, {
    x:0.3, y:1.3, w:9.4, h:4.1,
    border:{pt:0.5, color:"D1D5DB"},
    fontFace:"Calibri",
  });

  s.addShape(pres.ShapeType.rect, { x:0, y:5.28, w:"100%", h:0.345, fill:{color:P.lgray} });
  s.addText("PRU = Peripheral Resistance Unit  |  Values from Guyton & Hall, Textbook of Medical Physiology 14th Ed.", {
    x:0.2, y:5.3, w:9.6, h:0.3, fontSize:10, color:P.gray, italic:true, fontFace:"Calibri", margin:0
  });
}

// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 19 β€” CLINICAL CORRELATIONS
// ─────────────────────────────────────────────────────────────────────────────
sectionDivider("Clinical Correlations", "Topic 7  Β·  Applying Haemodynamics", "DC2626");

{
  const s = pres.addSlide();
  bg(s);
  titleBar(s, "Haemodynamics in Clinical Practice", "MAP = CO Γ— TPR β€” the equation behind every cardiovascular disease");

  const cases = [
    { title:"Hypertension", icon:"πŸ“ˆ", problem:"↑ TPR (arteriolar constriction)", consequence:"↑ MAP β†’ LV hypertrophy β†’ HF", rx:"ACE inhibitors, CCBs β†’ ↓ TPR", col:P.red },
    { title:"Cardiogenic Shock", icon:"πŸ“‰", problem:"↓↓ CO (pump failure)", consequence:"↓ MAP β†’ end-organ damage", rx:"Inotropes, fluid resus, IABP", col:P.orange },
    { title:"Anaemia", icon:"🩸", problem:"↓ viscosity, ↓ Oβ‚‚ carrying", consequence:"↑ CO (compensatory high-output)", rx:"Treat cause; transfusion if severe", col:P.blue },
    { title:"Haemorrhage", icon:"⚑", problem:"↓ Blood volume β†’ ↓ VR β†’ ↓ CO", consequence:"↓ MAP β†’ Baroreceptor reflex β†’ ↑ HR + ↑ TPR", rx:"IV fluids, blood transfusion", col:P.purple },
    { title:"Heart Failure", icon:"πŸ’”", problem:"↓ SV β†’ Frank-Starling fails", consequence:"↑ LVEDP β†’ pulmonary oedema", rx:"Diuretics (↓ preload), ACEi (↓ afterload)", col:P.green },
    { title:"Polycythaemia", icon:"πŸ”¬", problem:"↑ Haematocrit β†’ ↑ viscosity", consequence:"↑ TPR β†’ ↑ cardiac work", rx:"Venesection; hydroxycarbamide", col:P.yellow },
  ];

  cases.forEach((c, i) => {
    const x = 0.3 + (i % 3) * 3.25;
    const y = 1.3 + Math.floor(i / 3) * 2.0;
    s.addShape(pres.ShapeType.roundRect, { x, y, w:3.1, h:1.7, fill:{color:c.col+"12"}, line:{color:c.col, pt:1.5}, rectRadius:0.12 });
    s.addText(c.icon + " " + c.title, { x:x+0.1, y:y+0.06, w:2.9, h:0.38, fontSize:14, bold:true, color:c.col, fontFace:"Calibri", margin:0 });
    s.addText("Problem: " + c.problem, { x:x+0.12, y:y+0.44, w:2.86, h:0.3, fontSize:10, color:P.dark, fontFace:"Calibri", margin:0 });
    s.addText("Effect: " + c.consequence, { x:x+0.12, y:y+0.74, w:2.86, h:0.35, fontSize:10, color:P.dark, fontFace:"Calibri", margin:0 });
    s.addText("Rx: " + c.rx, { x:x+0.12, y:y+1.08, w:2.86, h:0.5, fontSize:10, bold:true, color:c.col, fontFace:"Calibri", margin:0 });
  });

  s.addShape(pres.ShapeType.rect, { x:0, y:5.28, w:"100%", h:0.345, fill:{color:P.lgray} });
  s.addText("GK Pal: 'Understanding Ohm's Law (MAP = CO Γ— TPR) is the key to cardiovascular pharmacology'", {
    x:0.2, y:5.3, w:9.6, h:0.3, fontSize:10, color:P.gray, italic:true, fontFace:"Calibri", margin:0
  });
}

// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 20 β€” MNEMONICS BOARD
// ─────────────────────────────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  bg(s);
  titleBar(s, "Mnemonics & Exam Revision Board", "Memorise these before your MBBS viva and theory papers");

  const mnems = [
    { title:"Poiseuille r⁴ Rule", body:"Double r β†’ 16Γ— flow\n4Γ— r β†’ 256Γ— flow\nFlow ∝ r⁴", col:P.orange },
    { title:"Ohm's Law", body:"MAP = CO Γ— TPR\nCO = MAP Γ· TPR\nQ = Ξ”P Γ· R", col:P.blue },
    { title:"MAP Formula", body:"MAP = DBP + β…“PP\nPP = SBP βˆ’ DBP\nNormal MAP β‰ˆ 93", col:P.red },
    { title:"Frank-Starling", body:"More FILL\n→ More FORCE\n→ More FLOW", col:P.green },
    { title:"Series vs Parallel", body:"Series β†’ R adds up\nParallel β†’ R decreases\nOrgans = Parallel", col:P.purple },
    { title:"Oedema Causes", body:"↑ Pc (HF)\n↓ Ο€c (Nephrotic)\n↑ Perm (Sepsis)", col:"059669" },
  ];

  mnems.forEach((m, i) => {
    const x = 0.3 + (i % 3) * 3.25;
    const y = 1.3 + Math.floor(i / 3) * 2.05;
    s.addShape(pres.ShapeType.roundRect, { x, y, w:3.1, h:1.85, fill:{color:m.col}, line:{color:m.col}, rectRadius:0.18 });
    s.addShape(pres.ShapeType.roundRect, { x:x+0.1, y:y+0.08, w:2.9, h:0.45, fill:{color:P.white+"33"}, line:{color:P.white+"00"}, rectRadius:0.08 });
    s.addText(m.title, { x:x+0.1, y:y+0.08, w:2.9, h:0.45, fontSize:14, bold:true, color:P.white, align:"center", valign:"middle", fontFace:"Calibri", margin:0 });
    s.addText(m.body, { x:x+0.12, y:y+0.62, w:2.86, h:1.1, fontSize:13, bold:true, color:P.white, align:"center", valign:"top", fontFace:"Courier New", margin:0 });
  });
}

// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 21 β€” SUMMARY
// ─────────────────────────────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  bg(s);
  titleBar(s, "Summary β€” 10 Things You Must Know", "Guyton & Hall Β· GK Pal Β· MBBS 1st Year Physiology");

  const pts = [
    ["1", "Blood flow = ~5 L/min = Cardiac Output at rest", P.blue],
    ["2", "Poiseuille's Law: Flow ∝ r⁴ β€” vessel radius is the most important factor", P.red],
    ["3", "Ohm's Law of circulation: MAP = CO Γ— TPR", P.orange],
    ["4", "Arterioles contribute ~β…” of total peripheral resistance", P.purple],
    ["5", "Laminar flow is silent; Turbulent flow creates bruits", P.green],
    ["6", "Frank-Starling: ↑ preload β†’ ↑ SV (within limits)", P.blue],
    ["7", "Series resistance ADDS; parallel resistance DECREASES total R", P.red],
    ["8", "Autoregulation maintains organ flow between MAP 70–175 mmHg", P.purple],
    ["9", "Starling forces: oedema when filtration > lymphatic drainage", P.green],
    ["10","Haematocrit ↑ viscosity ↑ TPR β€” polycythaemia strains the heart", P.orange],
  ];

  pts.forEach((pt, i) => {
    const x = 0.3 + (i < 5 ? 0 : 4.9);
    const y = 1.3 + (i % 5) * 0.8;
    s.addShape(pres.ShapeType.roundRect, { x, y, w:0.45, h:0.6, fill:{color:pt[2]}, line:{color:pt[2]}, rectRadius:0.07 });
    s.addText(pt[0], { x, y, w:0.45, h:0.6, fontSize:14, bold:true, color:P.white, align:"center", valign:"middle", fontFace:"Calibri", margin:0 });
    s.addText(pt[1], { x:x+0.55, y:y+0.05, w:4.1, h:0.52, fontSize:12, color:P.dark, fontFace:"Calibri", valign:"middle" });
  });

  s.addShape(pres.ShapeType.rect, { x:0, y:5.28, w:"100%", h:0.345, fill:{color:P.navy} });
  s.addText("Guyton AC, Hall JE. Textbook of Medical Physiology 14th Ed.  |  Pal GK, Pal P. Textbook of Medical Physiology 3rd Ed.", {
    x:0.2, y:5.3, w:9.6, h:0.3, fontSize:10, color:"93C5FD", italic:true, fontFace:"Calibri", margin:0, align:"center"
  });
}

// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 22 β€” THANK YOU
// ─────────────────────────────────────────────────────────────────────────────
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:"100%", h:"100%", fill:{color:P.navy} });
  s.addShape(pres.ShapeType.ellipse, { x:6, y:-2, w:7, h:7, fill:{color:P.blue+"33"}, line:{color:P.blue+"33"} });
  s.addShape(pres.ShapeType.ellipse, { x:7.5, y:2, w:4, h:4, fill:{color:P.blue+"22"}, line:{color:P.blue+"22"} });
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:"100%", h:0.1, fill:{color:P.blue} });
  s.addShape(pres.ShapeType.rect, { x:0, y:5.525, w:"100%", h:0.1, fill:{color:P.green} });
  s.addText("Thank You!", {
    x:0.5, y:1.0, w:8, h:1.5, fontSize:56, bold:true, color:P.white, align:"center", fontFace:"Calibri"
  });
  s.addText("Questions & Discussion Welcome", {
    x:0.5, y:2.6, w:9, h:0.6, fontSize:22, color:"93C5FD", italic:true, align:"center", fontFace:"Calibri"
  });
  s.addShape(pres.ShapeType.rect, { x:3.0, y:3.35, w:4, h:0.07, fill:{color:P.green} });
  s.addText("References", {
    x:0.5, y:3.55, w:9, h:0.38, fontSize:14, bold:true, color:P.white, align:"center", fontFace:"Calibri"
  });
  s.addText(
    "1. Guyton AC, Hall JE. Textbook of Medical Physiology. 14th Ed. Elsevier, 2021.\n" +
    "2. Pal GK, Pal P. Textbook of Medical Physiology. 3rd Ed. Orient Blackswan.\n" +
    "3. Costanzo LS. Physiology. 7th Ed. Elsevier.",
    {
      x:0.5, y:4.0, w:9, h:1.1, fontSize:12, color:"D1D5DB", italic:true,
      fontFace:"Calibri", align:"center", lineSpacingMultiple:1.4
    }
  );
}

// ─────────────────────────────────────────────────────────────────────────────
// WRITE
// ─────────────────────────────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/haemodynamics-pptx/Haemodynamics_v2.pptx" })
  .then(() => console.log("βœ… Done: Haemodynamics_v2.pptx"))
  .catch(e => { console.error("❌", e); process.exit(1); });
Your credits are exhausted. Your daily credits reset tomorrow, or you can purchase a top-up for more.

Not make a presentation just give me content in written form

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