Prepare ppt on topic chemical regulation of respiration
mkdir -p /home/daytona/workspace/chemical-regulation-respiration && ls /home/daytona/workspace/chemical-regulation-respiration/
~/chemical-regulation-respiration/build.js
const pptxgen = require("pptxgenjs");
const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Chemical Regulation of Respiration";
pres.author = "Medical Physiology";
// ─── Color Palette ───
const DEEP_NAVY = "0D1B2A";
const TEAL_DARK = "1B4F72";
const TEAL_MID = "1A6B8A";
const TEAL_LIGHT = "2E9DC7";
const ACCENT = "27AE60";
const ACCENT2 = "E67E22";
const WHITE = "FFFFFF";
const LIGHT_GRAY = "ECF0F1";
const DARK_TEXT = "1C2833";
const SOFT_WHITE = "F0F4F8";
// ─── Helper: Section accent bar ───
function addAccentBar(slide, color) {
slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 0.12, h: 5.625, fill: { color } });
}
// ─── Slide 1: Title Slide ───
{
const slide = pres.addSlide();
// Full dark background
slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: DEEP_NAVY } });
// Decorative teal gradient shapes
slide.addShape(pres.ShapeType.rect, { x: 0, y: 3.8, w: 10, h: 1.825, fill: { color: TEAL_DARK } });
slide.addShape(pres.ShapeType.rect, { x: 0, y: 4.5, w: 10, h: 1.125, fill: { color: TEAL_MID } });
// Accent circle (decorative)
slide.addShape(pres.ShapeType.ellipse, { x: 7.5, y: -0.8, w: 3.5, h: 3.5, fill: { color: TEAL_LIGHT }, line: { color: TEAL_LIGHT } });
slide.addShape(pres.ShapeType.ellipse, { x: 7.9, y: -0.4, w: 2.5, h: 2.5, fill: { color: TEAL_MID }, line: { color: TEAL_MID } });
// Main Title
slide.addText("Chemical Regulation", {
x: 0.5, y: 1.1, w: 7, h: 0.9,
fontSize: 40, bold: true, color: WHITE, fontFace: "Calibri", margin: 0
});
slide.addText("of Respiration", {
x: 0.5, y: 1.95, w: 7, h: 0.85,
fontSize: 40, bold: true, color: TEAL_LIGHT, fontFace: "Calibri", margin: 0
});
// Subtitle
slide.addText("Central & Peripheral Chemoreceptors | CO₂, O₂ & H⁺ | Ventilatory Control", {
x: 0.5, y: 2.9, w: 8.5, h: 0.5,
fontSize: 14, color: LIGHT_GRAY, fontFace: "Calibri", italic: true, margin: 0
});
// Source tag
slide.addText("Source: Guyton & Hall Textbook of Medical Physiology", {
x: 0.5, y: 5.1, w: 9, h: 0.35,
fontSize: 11, color: LIGHT_GRAY, fontFace: "Calibri", italic: true, margin: 0
});
}
// ─── Slide 2: Overview / Why Regulate? ───
{
const slide = pres.addSlide();
slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: SOFT_WHITE } });
addAccentBar(slide, TEAL_MID);
slide.addText("Why Does Respiration Need Chemical Regulation?", {
x: 0.3, y: 0.15, w: 9.5, h: 0.65,
fontSize: 22, bold: true, color: TEAL_DARK, fontFace: "Calibri", margin: 0
});
slide.addShape(pres.ShapeType.line, { x: 0.3, y: 0.88, w: 9.4, h: 0, line: { color: TEAL_LIGHT, width: 1.5 } });
// Goal box
slide.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.0, w: 9.4, h: 0.95, fill: { color: TEAL_DARK }, line: { color: TEAL_DARK } });
slide.addText("The ultimate goal of respiration is to maintain proper concentrations of O₂, CO₂, and H⁺ in the tissues.", {
x: 0.35, y: 1.02, w: 9.2, h: 0.9,
fontSize: 14, bold: true, color: WHITE, fontFace: "Calibri", italic: true, valign: "middle", margin: 5
});
const items = [
{ icon: "🫁", title: "O₂ Delivery", body: "Adequate oxygen must reach every tissue cell for aerobic metabolism." },
{ icon: "💨", title: "CO₂ Removal", body: "CO₂ is produced continuously and must be exhaled to prevent acidosis." },
{ icon: "⚗️", title: "H⁺ / pH Balance", body: "H⁺ concentration must stay within narrow limits (pH 7.35–7.45) for enzyme function." },
];
items.forEach((item, i) => {
const x = 0.25 + i * 3.2;
slide.addShape(pres.ShapeType.rect, { x, y: 2.1, w: 3.0, h: 2.8, fill: { color: WHITE }, line: { color: TEAL_LIGHT, width: 1 } });
slide.addText(item.icon, { x, y: 2.15, w: 3.0, h: 0.7, fontSize: 28, align: "center", margin: 0 });
slide.addText(item.title, { x, y: 2.82, w: 3.0, h: 0.4, fontSize: 14, bold: true, color: TEAL_DARK, align: "center", fontFace: "Calibri", margin: 0 });
slide.addText(item.body, { x: x + 0.1, y: 3.25, w: 2.8, h: 1.55, fontSize: 11.5, color: DARK_TEXT, fontFace: "Calibri", valign: "top", align: "left", margin: 3 });
});
slide.addText("Guyton & Hall, Ch. 42", { x: 0.2, y: 5.3, w: 4, h: 0.25, fontSize: 9, italic: true, color: "888888", margin: 0 });
}
// ─── Slide 3: Overview – Two-System Framework ───
{
const slide = pres.addSlide();
slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: DEEP_NAVY } });
slide.addText("Two Major Chemical Control Systems", {
x: 0.4, y: 0.2, w: 9.2, h: 0.6,
fontSize: 24, bold: true, color: WHITE, fontFace: "Calibri", align: "center", margin: 0
});
slide.addShape(pres.ShapeType.line, { x: 1, y: 0.88, w: 8, h: 0, line: { color: TEAL_LIGHT, width: 1.5 } });
// Central box
slide.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.05, w: 4.3, h: 3.8, fill: { color: TEAL_DARK }, line: { color: TEAL_LIGHT, width: 1.5 } });
slide.addText("CENTRAL\nChemoreceptors", { x: 0.35, y: 1.1, w: 4.2, h: 0.75, fontSize: 15, bold: true, color: WHITE, align: "center", fontFace: "Calibri", margin: 0 });
slide.addShape(pres.ShapeType.line, { x: 0.5, y: 1.88, w: 3.9, h: 0, line: { color: TEAL_LIGHT, width: 0.8 } });
const centralPoints = [
"Located in ventrolateral medulla (retrotrapezoid nucleus)",
"Sensitive to CO₂ and H⁺ in CSF",
"CO₂ crosses blood-brain barrier → forms H⁺ locally",
"H⁺ directly stimulates chemosensitive neurons",
"Major driver of resting ventilation",
"Response attenuates after 1–2 days (renal compensation)"
];
slide.addText(centralPoints.map(p => ({ text: p, options: { bullet: true, breakLine: true } })), {
x: 0.45, y: 1.95, w: 4.05, h: 2.8,
fontSize: 11.5, color: LIGHT_GRAY, fontFace: "Calibri", valign: "top"
});
// Peripheral box
slide.addShape(pres.ShapeType.rect, { x: 5.4, y: 1.05, w: 4.3, h: 3.8, fill: { color: "1A4A3C" }, line: { color: ACCENT, width: 1.5 } });
slide.addText("PERIPHERAL\nChemoreceptors", { x: 5.45, y: 1.1, w: 4.2, h: 0.75, fontSize: 15, bold: true, color: WHITE, align: "center", fontFace: "Calibri", margin: 0 });
slide.addShape(pres.ShapeType.line, { x: 5.55, y: 1.88, w: 3.9, h: 0, line: { color: ACCENT, width: 0.8 } });
const periphPoints = [
"Carotid bodies (at carotid bifurcation) — most important",
"Aortic bodies (in aortic arch) — less important in humans",
"Respond to ↓PO₂, ↑PCO₂, ↑H⁺",
"Critical when PaO₂ < 60 mmHg (hypoxic drive)",
"Signal via CN IX (carotid) & CN X (aortic)",
"Fast response — seconds; important in exercise & altitude"
];
slide.addText(periphPoints.map(p => ({ text: p, options: { bullet: true, breakLine: true } })), {
x: 5.55, y: 1.95, w: 4.05, h: 2.8,
fontSize: 11.5, color: LIGHT_GRAY, fontFace: "Calibri", valign: "top"
});
// vs arrow
slide.addShape(pres.ShapeType.ellipse, { x: 4.6, y: 2.3, w: 0.8, h: 0.8, fill: { color: ACCENT2 }, line: { color: ACCENT2 } });
slide.addText("VS", { x: 4.6, y: 2.35, w: 0.8, h: 0.7, fontSize: 14, bold: true, color: WHITE, align: "center", margin: 0 });
}
// ─── Slide 4: Central Chemoreceptors – Deep Dive ───
{
const slide = pres.addSlide();
slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: SOFT_WHITE } });
addAccentBar(slide, TEAL_DARK);
slide.addText("Central Chemoreceptors", {
x: 0.3, y: 0.15, w: 9.5, h: 0.6,
fontSize: 24, bold: true, color: TEAL_DARK, fontFace: "Calibri", margin: 0
});
slide.addShape(pres.ShapeType.line, { x: 0.3, y: 0.82, w: 9.4, h: 0, line: { color: TEAL_LIGHT, width: 1.5 } });
// Location box
slide.addShape(pres.ShapeType.rect, { x: 0.3, y: 0.95, w: 4.5, h: 1.15, fill: { color: TEAL_DARK }, line: { color: TEAL_DARK } });
slide.addText([
{ text: "Location: ", options: { bold: true } },
{ text: "Retrotrapezoid nuclei, ventrolateral medulla — only 0.2 mm beneath the ventral surface of rostral medulla" }
], { x: 0.35, y: 0.98, w: 4.4, h: 1.08, fontSize: 12, color: WHITE, fontFace: "Calibri", valign: "middle", margin: 5 });
// Mechanism diagram (text-based)
slide.addShape(pres.ShapeType.rect, { x: 5.1, y: 0.95, w: 4.6, h: 4.35, fill: { color: WHITE }, line: { color: TEAL_LIGHT, width: 1 } });
slide.addText("Mechanism of CO₂ Stimulation", { x: 5.15, y: 0.98, w: 4.5, h: 0.4, fontSize: 13, bold: true, color: TEAL_DARK, align: "center", fontFace: "Calibri", margin: 0 });
const mech = [
"↑ Blood PCO₂",
"↓",
"CO₂ crosses Blood-Brain Barrier freely",
"↓",
"CO₂ + H₂O → H₂CO₃ (carbonic acid)",
"↓",
"H₂CO₃ → H⁺ + HCO₃⁻",
"↓",
"H⁺ stimulates chemosensitive neurons",
"↓",
"↑ Ventilation (rate & depth)"
];
mech.forEach((line, i) => {
const isArrow = line === "↓";
slide.addText(line, {
x: 5.2, y: 1.44 + i * 0.29, w: 4.4, h: 0.3,
fontSize: isArrow ? 14 : 11.5,
bold: !isArrow && (line.includes("↑") || line.includes("PCO₂")),
color: isArrow ? TEAL_LIGHT : DARK_TEXT,
align: "center", fontFace: "Calibri", margin: 0
});
});
// Key points
const points = [
{ label: "Key Insight", text: "CO₂ is a MORE potent stimulus than blood H⁺ because CO₂ freely crosses the BBB while H⁺ does not." },
{ label: "Adaptation", text: "The stimulatory effect of CO₂ decreases over 1–2 days as kidneys increase HCO₃⁻ to buffer H⁺." },
{ label: "H⁺ direct effect", text: "H⁺ directly stimulates chemosensitive neurons but blood H⁺ crosses the BBB much less efficiently." },
];
points.forEach((pt, i) => {
slide.addShape(pres.ShapeType.rect, { x: 0.3, y: 2.2 + i * 1.1, w: 4.6, h: 1.0, fill: { color: WHITE }, line: { color: TEAL_LIGHT, width: 0.8 } });
slide.addShape(pres.ShapeType.rect, { x: 0.3, y: 2.2 + i * 1.1, w: 1.4, h: 0.35, fill: { color: TEAL_MID }, line: { color: TEAL_MID } });
slide.addText(pt.label, { x: 0.32, y: 2.21 + i * 1.1, w: 1.38, h: 0.33, fontSize: 10, bold: true, color: WHITE, fontFace: "Calibri", align: "center", margin: 0 });
slide.addText(pt.text, { x: 0.35, y: 2.57 + i * 1.1, w: 4.5, h: 0.6, fontSize: 11, color: DARK_TEXT, fontFace: "Calibri", valign: "top", margin: 3 });
});
slide.addText("Guyton & Hall, Ch. 42", { x: 0.2, y: 5.3, w: 4, h: 0.25, fontSize: 9, italic: true, color: "888888", margin: 0 });
}
// ─── Slide 5: Peripheral Chemoreceptors ───
{
const slide = pres.addSlide();
slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: "071A14" } });
slide.addText("Peripheral Chemoreceptors", {
x: 0.4, y: 0.18, w: 9.2, h: 0.6,
fontSize: 24, bold: true, color: WHITE, fontFace: "Calibri", margin: 0
});
slide.addShape(pres.ShapeType.line, { x: 0.4, y: 0.83, w: 9.2, h: 0, line: { color: ACCENT, width: 1.5 } });
// Two columns
// Carotid body
slide.addShape(pres.ShapeType.rect, { x: 0.3, y: 0.98, w: 4.4, h: 4.3, fill: { color: "0F2B21" }, line: { color: ACCENT, width: 1.2 } });
slide.addShape(pres.ShapeType.rect, { x: 0.3, y: 0.98, w: 4.4, h: 0.5, fill: { color: ACCENT }, line: { color: ACCENT } });
slide.addText("🔴 Carotid Bodies", { x: 0.35, y: 0.99, w: 4.3, h: 0.47, fontSize: 14, bold: true, color: WHITE, fontFace: "Calibri", valign: "middle", margin: 3 });
const carotid = [
"Located at bifurcation of common carotid arteries",
"Glomus (type I) cells: O₂-sensing cells",
"Most important peripheral chemoreceptors in humans",
"Signal travels via carotid sinus nerve → CN IX → brain stem",
"Respond to: ↓PaO₂, ↑PaCO₂, ↑H⁺ (acidosis), ↓blood flow",
"Strongly activated when PaO₂ drops below 60 mmHg",
"Critical for hypoxic ventilatory drive"
];
slide.addText(carotid.map(p => ({ text: p, options: { bullet: true, breakLine: true } })), {
x: 0.45, y: 1.55, w: 4.1, h: 3.65,
fontSize: 11.5, color: LIGHT_GRAY, fontFace: "Calibri", valign: "top"
});
// Aortic body
slide.addShape(pres.ShapeType.rect, { x: 5.3, y: 0.98, w: 4.4, h: 4.3, fill: { color: "0F1D2B" }, line: { color: TEAL_LIGHT, width: 1.2 } });
slide.addShape(pres.ShapeType.rect, { x: 5.3, y: 0.98, w: 4.4, h: 0.5, fill: { color: TEAL_LIGHT }, line: { color: TEAL_LIGHT } });
slide.addText("🔵 Aortic Bodies", { x: 5.35, y: 0.99, w: 4.3, h: 0.47, fontSize: 14, bold: true, color: DEEP_NAVY, fontFace: "Calibri", valign: "middle", margin: 3 });
const aortic = [
"Located in aortic arch",
"Less important than carotid bodies in humans",
"Signal travels via vagus nerve (CN X) → brain stem",
"Respond to similar stimuli: ↓PaO₂, ↑PaCO₂, ↑H⁺",
"Primarily important for cardiovascular reflex responses",
"Both carotid and aortic bodies increase ventilation and heart rate",
"Aortic bodies may have greater role in neonates"
];
slide.addText(aortic.map(p => ({ text: p, options: { bullet: true, breakLine: true } })), {
x: 5.45, y: 1.55, w: 4.1, h: 3.65,
fontSize: 11.5, color: LIGHT_GRAY, fontFace: "Calibri", valign: "top"
});
}
// ─── Slide 6: Role of CO₂ – The Primary Regulator ───
{
const slide = pres.addSlide();
slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: SOFT_WHITE } });
addAccentBar(slide, TEAL_DARK);
slide.addText("CO₂: The Primary Regulator of Ventilation", {
x: 0.3, y: 0.15, w: 9.5, h: 0.6,
fontSize: 22, bold: true, color: TEAL_DARK, fontFace: "Calibri", margin: 0
});
slide.addShape(pres.ShapeType.line, { x: 0.3, y: 0.82, w: 9.4, h: 0, line: { color: TEAL_LIGHT, width: 1.5 } });
// Key fact highlight
slide.addShape(pres.ShapeType.rect, { x: 0.3, y: 0.95, w: 9.4, h: 0.7, fill: { color: TEAL_DARK }, line: { color: TEAL_DARK } });
slide.addText("PCO₂ change from 35→75 mmHg causes a MASSIVE increase in ventilation — CO₂ is by far the dominant chemical stimulus at rest.", {
x: 0.35, y: 0.97, w: 9.3, h: 0.66,
fontSize: 13, bold: true, color: WHITE, fontFace: "Calibri", italic: false, valign: "middle", margin: 5
});
// Three mechanisms
const cols = [
{
title: "Mechanism 1\nCO₂ → H⁺ in CSF",
color: TEAL_MID,
points: [
"CO₂ freely crosses BBB",
"Reacts with H₂O → carbonic acid",
"Releases H⁺ into medullary interstitium",
"H⁺ directly activates chemosensitive neurons"
]
},
{
title: "Mechanism 2\nCO₂ at Peripheral Receptors",
color: ACCENT,
points: [
"↑PCO₂ also stimulates carotid & aortic bodies",
"Peripheral response is FAST (seconds)",
"Carotid bodies: sensitive to all 3 stimuli",
"Signals sent via CN IX to respiratory center"
]
},
{
title: "Mechanism 3\nAcute vs Chronic",
color: ACCENT2,
points: [
"Acute: very strong ventilatory response",
"Chronic (1–2 days): response decreases",
"Kidneys raise HCO₃⁻ → buffer H⁺",
"HCO₃⁻ crosses BBB → normalizes CSF H⁺"
]
}
];
cols.forEach((col, i) => {
const x = 0.25 + i * 3.2;
slide.addShape(pres.ShapeType.rect, { x, y: 1.78, w: 3.0, h: 3.6, fill: { color: WHITE }, line: { color: col.color, width: 1.2 } });
slide.addShape(pres.ShapeType.rect, { x, y: 1.78, w: 3.0, h: 0.65, fill: { color: col.color }, line: { color: col.color } });
slide.addText(col.title, { x: x + 0.05, y: 1.79, w: 2.9, h: 0.62, fontSize: 11.5, bold: true, color: WHITE, fontFace: "Calibri", align: "center", margin: 0 });
slide.addText(col.points.map(p => ({ text: p, options: { bullet: true, breakLine: true } })), {
x: x + 0.1, y: 2.49, w: 2.8, h: 2.82,
fontSize: 11, color: DARK_TEXT, fontFace: "Calibri", valign: "top"
});
});
slide.addText("Guyton & Hall, Ch. 42", { x: 0.2, y: 5.3, w: 4, h: 0.25, fontSize: 9, italic: true, color: "888888", margin: 0 });
}
// ─── Slide 7: Role of O₂ (Hypoxic Drive) ───
{
const slide = pres.addSlide();
slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: DEEP_NAVY } });
slide.addText("Role of O₂ — Hypoxic Drive", {
x: 0.4, y: 0.18, w: 9.2, h: 0.6,
fontSize: 24, bold: true, color: WHITE, fontFace: "Calibri", margin: 0
});
slide.addShape(pres.ShapeType.line, { x: 0.4, y: 0.83, w: 9.2, h: 0, line: { color: ACCENT, width: 1.5 } });
// Important note
slide.addShape(pres.ShapeType.rect, { x: 0.3, y: 0.98, w: 9.4, h: 0.65, fill: { color: ACCENT2 }, line: { color: ACCENT2 } });
slide.addText("⚠️ O₂ does NOT directly stimulate the medullary respiratory center — it acts ONLY via peripheral chemoreceptors.", {
x: 0.35, y: 1.0, w: 9.3, h: 0.61,
fontSize: 13, bold: true, color: WHITE, fontFace: "Calibri", valign: "middle", margin: 5
});
const rows = [
{ head: "Normal Range (PaO₂ > 100 mmHg)", text: "Very little hypoxic stimulation. Hemoglobin is nearly fully saturated. Changes in PaO₂ cause minimal change in ventilation due to the flat upper part of the O₂-Hb dissociation curve." },
{ head: "Mild Hypoxia (PaO₂ 60–100 mmHg)", text: "Moderate stimulation begins. Carotid bodies start increasing their firing rate. Clinically, patients may not notice hypoxia in this range without pulse oximetry." },
{ head: "Significant Hypoxia (PaO₂ < 60 mmHg)", text: "Strong activation of carotid bodies. Steep portion of dissociation curve — small ↓PaO₂ → large ↓SaO₂. Ventilation increases markedly (hyperventilation)." },
{ head: "Chronic Hypoxia (High Altitude, COPD)", text: "Sustained hypoxic drive. In COPD patients who retain CO₂, supplemental O₂ must be given carefully — removing hypoxic drive can suppress ventilation." },
];
rows.forEach((row, i) => {
slide.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.75 + i * 0.92, w: 9.4, h: 0.85, fill: { color: i % 2 === 0 ? "0D2740" : "0D3320" }, line: { color: "FFFFFF20" } });
slide.addText(row.head, { x: 0.4, y: 1.77 + i * 0.92, w: 3.2, h: 0.8, fontSize: 11.5, bold: true, color: ACCENT, fontFace: "Calibri", valign: "middle", margin: 3 });
slide.addText(row.text, { x: 3.65, y: 1.77 + i * 0.92, w: 5.9, h: 0.8, fontSize: 11, color: LIGHT_GRAY, fontFace: "Calibri", valign: "middle", margin: 3 });
});
}
// ─── Slide 8: Role of H⁺ and pH ───
{
const slide = pres.addSlide();
slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: SOFT_WHITE } });
addAccentBar(slide, ACCENT2);
slide.addText("Role of H⁺ and pH in Ventilatory Control", {
x: 0.3, y: 0.15, w: 9.5, h: 0.6,
fontSize: 22, bold: true, color: TEAL_DARK, fontFace: "Calibri", margin: 0
});
slide.addShape(pres.ShapeType.line, { x: 0.3, y: 0.82, w: 9.4, h: 0, line: { color: ACCENT2, width: 1.5 } });
// Normal pH info
slide.addShape(pres.ShapeType.rect, { x: 0.3, y: 0.95, w: 9.4, h: 0.65, fill: { color: TEAL_DARK }, line: { color: TEAL_DARK } });
slide.addText("Normal arterial pH: 7.35–7.45 | Changes in this range alter ventilation by <10% compared to CO₂ changes — but metabolic acidosis/alkalosis has major clinical significance.", {
x: 0.35, y: 0.97, w: 9.3, h: 0.61,
fontSize: 12, color: WHITE, fontFace: "Calibri", valign: "middle", margin: 5
});
// Two column layout
const left = [
{ label: "Metabolic Acidosis → ↑ Ventilation", items: [
"↑ H⁺ (↓ pH) stimulates central & peripheral chemoreceptors",
"Results in hyperventilation — Kussmaul breathing",
"Blows off CO₂ to compensate: ↓PCO₂ → ↑pH",
"Classic example: diabetic ketoacidosis (DKA)",
"Compensation is respiratory: rapid and deep breaths"
]},
{ label: "Metabolic Alkalosis → ↓ Ventilation", items: [
"↓ H⁺ (↑ pH) reduces respiratory drive",
"Hypoventilation — CO₂ retained",
"↑PCO₂ → ↓pH → partially compensates",
"Example: vomiting (loss of HCl)",
"Limitation: hypoxia eventually overrides hypoventilation"
]}
];
left.forEach((block, bi) => {
const y = 1.72 + bi * 1.82;
slide.addShape(pres.ShapeType.rect, { x: 0.3, y, w: 9.4, h: 1.72, fill: { color: WHITE }, line: { color: bi === 0 ? ACCENT2 : TEAL_LIGHT, width: 1 } });
slide.addShape(pres.ShapeType.rect, { x: 0.3, y, w: 9.4, h: 0.38, fill: { color: bi === 0 ? ACCENT2 : TEAL_MID }, line: { color: "transparent" } });
slide.addText(block.label, { x: 0.35, y: y + 0.02, w: 9.3, h: 0.35, fontSize: 13, bold: true, color: WHITE, fontFace: "Calibri", margin: 3 });
slide.addText(block.items.map(p => ({ text: p, options: { bullet: true, breakLine: true } })), {
x: 0.4, y: y + 0.42, w: 9.1, h: 1.25,
fontSize: 11.5, color: DARK_TEXT, fontFace: "Calibri", valign: "top"
});
});
slide.addText("Guyton & Hall, Ch. 42", { x: 0.2, y: 5.3, w: 4, h: 0.25, fontSize: 9, italic: true, color: "888888", margin: 0 });
}
// ─── Slide 9: Interactions – CO₂, O₂, H⁺ Together ───
{
const slide = pres.addSlide();
slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: DEEP_NAVY } });
slide.addText("How CO₂, O₂, and H⁺ Interact", {
x: 0.4, y: 0.18, w: 9.2, h: 0.6,
fontSize: 24, bold: true, color: WHITE, fontFace: "Calibri", margin: 0
});
slide.addShape(pres.ShapeType.line, { x: 0.4, y: 0.83, w: 9.2, h: 0, line: { color: TEAL_LIGHT, width: 1.5 } });
// Summary table
const headers = ["Stimulus", "Receptor Site", "Relative Potency", "Response", "Clinical Relevance"];
const tableRows = [
headers,
["↑PCO₂", "Central (mainly) + Peripheral", "★★★★★ Very strong", "↑ Rate & Depth of breathing", "COPD, respiratory acidosis"],
["↓PaO₂", "Peripheral only (carotid/aortic)", "★★ Weak until <60 mmHg", "↑ Ventilation (hypoxic drive)", "High altitude, severe COPD"],
["↑H⁺ (↓pH)", "Central + Peripheral", "★★★ Moderate (metabolic)", "Hyperventilation (Kussmaul)", "DKA, lactic acidosis"],
["↓PCO₂", "Central + Peripheral", "Inhibitory", "↓ Ventilation (hypoventilation)", "Over-ventilation, anxiety"],
];
slide.addTable(tableRows, {
x: 0.25, y: 1.0, w: 9.5, h: 4.3,
fontSize: 11,
fontFace: "Calibri",
color: DARK_TEXT,
border: { type: "solid", color: "CCCCCC", pt: 0.5 },
rowH: 0.72,
fill: WHITE,
colW: [1.4, 2.2, 1.9, 2.2, 1.8],
valign: "middle",
firstRowFill: TEAL_DARK,
firstRowColor: WHITE,
firstRowBold: true,
firstRowFontSize: 12,
});
}
// ─── Slide 10: Feedback Loop – Putting It All Together ───
{
const slide = pres.addSlide();
slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: SOFT_WHITE } });
addAccentBar(slide, TEAL_MID);
slide.addText("The Complete Feedback Loop", {
x: 0.3, y: 0.15, w: 9.5, h: 0.6,
fontSize: 24, bold: true, color: TEAL_DARK, fontFace: "Calibri", margin: 0
});
slide.addShape(pres.ShapeType.line, { x: 0.3, y: 0.82, w: 9.4, h: 0, line: { color: TEAL_LIGHT, width: 1.5 } });
// Flow diagram using shapes and text
const boxes = [
{ x: 0.5, y: 1.1, w: 2.5, h: 0.75, color: TEAL_DARK, text: "Metabolic Activity\n(exercise, disease)" },
{ x: 0.5, y: 2.2, w: 2.5, h: 0.75, color: TEAL_MID, text: "↑CO₂, ↓O₂, ↑H⁺\nin blood/tissues" },
{ x: 0.5, y: 3.3, w: 2.5, h: 0.75, color: "1A6B40", text: "Chemoreceptors\nActivated" },
{ x: 3.5, y: 2.2, w: 2.5, h: 0.75, color: TEAL_DARK, text: "Medullary\nRespiratory Center" },
{ x: 6.5, y: 1.1, w: 2.8, h: 0.75, color: ACCENT2, text: "↑ Ventilation\n(rate & depth)" },
{ x: 6.5, y: 2.2, w: 2.8, h: 0.75, color: TEAL_MID, text: "↓PCO₂, ↑PO₂\n↑pH (↓H⁺)" },
{ x: 6.5, y: 3.3, w: 2.8, h: 0.75, color: "1A6B40", text: "Homeostasis\nRestored" },
];
boxes.forEach(b => {
slide.addShape(pres.ShapeType.roundRect, { x: b.x, y: b.y, w: b.w, h: b.h, fill: { color: b.color }, line: { color: b.color }, rectRadius: 0.08 });
slide.addText(b.text, { x: b.x, y: b.y, w: b.w, h: b.h, fontSize: 11.5, bold: true, color: WHITE, align: "center", valign: "middle", fontFace: "Calibri", margin: 2 });
});
// Arrows
const arrowOpts = { line: { color: TEAL_LIGHT, width: 2 }, arrowType: "triangle" };
// Down arrows on left
slide.addShape(pres.ShapeType.line, { x: 1.75, y: 1.85, w: 0, h: 0.35, ...arrowOpts });
slide.addShape(pres.ShapeType.line, { x: 1.75, y: 2.95, w: 0, h: 0.35, ...arrowOpts });
// Arrow from left column to center
slide.addShape(pres.ShapeType.line, { x: 3.0, y: 3.67, w: 0.5, h: 0, ...arrowOpts });
// Arrow from center up
slide.addShape(pres.ShapeType.line, { x: 4.75, y: 2.2, w: 0, h: -0.6, ...arrowOpts });
// Arrow from center to right
slide.addShape(pres.ShapeType.line, { x: 6.0, y: 2.57, w: 0.5, h: 0, ...arrowOpts });
// Down arrows on right
slide.addShape(pres.ShapeType.line, { x: 7.9, y: 1.85, w: 0, h: 0.35, ...arrowOpts });
slide.addShape(pres.ShapeType.line, { x: 7.9, y: 2.95, w: 0, h: 0.35, ...arrowOpts });
// Feedback label
slide.addText("NEGATIVE FEEDBACK", {
x: 3.5, y: 4.35, w: 3.0, h: 0.4,
fontSize: 12, bold: true, color: ACCENT, align: "center", fontFace: "Calibri", margin: 0
});
// Clinical applications
slide.addShape(pres.ShapeType.rect, { x: 0.25, y: 4.25, w: 3.0, h: 1.1, fill: { color: WHITE }, line: { color: TEAL_LIGHT, width: 0.8 } });
slide.addText([
{ text: "Clinical Note: ", options: { bold: true } },
{ text: "In COPD with CO₂ retention, the CNS adapts and O₂ becomes the primary drive. Excess O₂ can suppress ventilation." }
], { x: 0.3, y: 4.28, w: 2.9, h: 1.0, fontSize: 10, color: DARK_TEXT, fontFace: "Calibri", valign: "middle", margin: 3 });
slide.addShape(pres.ShapeType.rect, { x: 6.75, y: 4.25, w: 3.0, h: 1.1, fill: { color: WHITE }, line: { color: ACCENT2, width: 0.8 } });
slide.addText([
{ text: "Exercise: ", options: { bold: true } },
{ text: "Ventilation can increase 20× normal, largely driven by CO₂ production; anticipatory neural signals also play a role." }
], { x: 6.8, y: 4.28, w: 2.9, h: 1.0, fontSize: 10, color: DARK_TEXT, fontFace: "Calibri", valign: "middle", margin: 3 });
}
// ─── Slide 11: Clinical Applications ───
{
const slide = pres.addSlide();
slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: DEEP_NAVY } });
slide.addText("Clinical Applications", {
x: 0.4, y: 0.18, w: 9.2, h: 0.6,
fontSize: 24, bold: true, color: WHITE, fontFace: "Calibri", margin: 0
});
slide.addShape(pres.ShapeType.line, { x: 0.4, y: 0.83, w: 9.2, h: 0, line: { color: ACCENT, width: 1.5 } });
const cases = [
{
title: "COPD & Hypercapnic Respiratory Failure",
color: ACCENT2,
text: "Chronic CO₂ retention → central chemoreceptors desensitized → patient relies on hypoxic drive from carotid bodies. Giving high-flow O₂ may eliminate hypoxic drive → respiratory depression → worsening hypercapnia."
},
{
title: "High Altitude Acclimatization",
color: TEAL_LIGHT,
text: "↓PaO₂ → carotid bodies activated → hyperventilation → ↓PCO₂ → respiratory alkalosis. Over days, kidneys excrete HCO₃⁻ to restore pH. Acetazolamide forces renal HCO₃⁻ loss to allow further hyperventilation."
},
{
title: "Diabetic Ketoacidosis (DKA)",
color: ACCENT,
text: "Severe metabolic acidosis (↑H⁺) stimulates peripheral and central chemoreceptors → Kussmaul breathing (deep, rapid, sighing respirations) — a respiratory compensation to blow off CO₂ and raise pH."
},
{
title: "Opioid Overdose",
color: "C0392B",
text: "Opioids suppress the medullary respiratory center and reduce chemoreceptor sensitivity to CO₂. Result: hypoventilation, CO₂ retention, respiratory acidosis. Naloxone reverses this effect."
},
];
cases.forEach((c, i) => {
const x = i < 2 ? 0.3 : 0.3;
const y = 1.0 + (i % 2) * 2.25;
const xi = i < 2 ? 0.3 : 5.15;
const yi = Math.floor(i / 2) * 2.25 + 1.0;
slide.addShape(pres.ShapeType.rect, { x: xi, y: yi, w: 4.45, h: 2.05, fill: { color: "0D2035" }, line: { color: c.color, width: 1.5 } });
slide.addShape(pres.ShapeType.rect, { x: xi, y: yi, w: 4.45, h: 0.42, fill: { color: c.color }, line: { color: c.color } });
slide.addText(c.title, { x: xi + 0.05, y: yi + 0.02, w: 4.35, h: 0.38, fontSize: 12, bold: true, color: WHITE, fontFace: "Calibri", valign: "middle", margin: 4 });
slide.addText(c.text, { x: xi + 0.1, y: yi + 0.48, w: 4.25, h: 1.5, fontSize: 11, color: LIGHT_GRAY, fontFace: "Calibri", valign: "top", margin: 3 });
});
}
// ─── Slide 12: Summary ───
{
const slide = pres.addSlide();
slide.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: TEAL_DARK } });
slide.addShape(pres.ShapeType.rect, { x: 0, y: 4.3, w: 10, h: 1.325, fill: { color: DEEP_NAVY } });
slide.addText("Key Takeaways", {
x: 0.4, y: 0.18, w: 9.2, h: 0.7,
fontSize: 28, bold: true, color: WHITE, fontFace: "Calibri", align: "center", margin: 0
});
slide.addShape(pres.ShapeType.line, { x: 1.5, y: 0.93, w: 7, h: 0, line: { color: WHITE, width: 1 } });
const points = [
{ num: "1", text: "CO₂ is the most potent chemical regulator of respiration, acting via H⁺ formed in the CSF through the blood-brain barrier." },
{ num: "2", text: "Central chemoreceptors (retrotrapezoid nucleus) detect CO₂/H⁺ in CSF; peripheral chemoreceptors (carotid/aortic bodies) detect O₂, CO₂ & H⁺ in blood." },
{ num: "3", text: "Oxygen acts exclusively via peripheral chemoreceptors; significant ventilatory response requires PaO₂ < 60 mmHg." },
{ num: "4", text: "H⁺ (metabolic acidosis) stimulates hyperventilation; metabolic alkalosis suppresses ventilation." },
{ num: "5", text: "The system operates as a negative feedback loop maintaining normal blood gas homeostasis; chronic adaptation involves renal compensation." },
];
points.forEach((pt, i) => {
slide.addShape(pres.ShapeType.ellipse, { x: 0.3, y: 1.07 + i * 0.63, w: 0.45, h: 0.45, fill: { color: ACCENT }, line: { color: ACCENT } });
slide.addText(pt.num, { x: 0.3, y: 1.07 + i * 0.63, w: 0.45, h: 0.45, fontSize: 14, bold: true, color: WHITE, align: "center", valign: "middle", margin: 0 });
slide.addText(pt.text, { x: 0.85, y: 1.1 + i * 0.63, w: 8.8, h: 0.55, fontSize: 12.5, color: WHITE, fontFace: "Calibri", valign: "middle", margin: 0 });
});
slide.addText("Chemical Regulation of Respiration | Source: Guyton & Hall Textbook of Medical Physiology", {
x: 0.4, y: 4.45, w: 9.2, h: 0.5,
fontSize: 11, color: LIGHT_GRAY, fontFace: "Calibri", align: "center", italic: true, margin: 0
});
slide.addText("Medullary Chemoreceptors · Carotid & Aortic Bodies · CO₂ · O₂ · H⁺ · Feedback Control", {
x: 0.4, y: 4.95, w: 9.2, h: 0.45,
fontSize: 10.5, color: TEAL_LIGHT, fontFace: "Calibri", align: "center", margin: 0
});
}
// ─── Write File ───
pres.writeFile({ fileName: "/home/daytona/workspace/chemical-regulation-respiration/Chemical_Regulation_of_Respiration.pptx" })
.then(() => console.log("Done: Chemical_Regulation_of_Respiration.pptx"))
.catch(err => { console.error(err); process.exit(1); });
cd /home/daytona/workspace/chemical-regulation-respiration && node build.js 2>&1
ls -lh /home/daytona/workspace/chemical-regulation-respiration/
Chemical Regulation of Respiration
Presentation · PPTX
| Slide | Content |
|---|---|
| 1 | Title slide |
| 2 | Why chemical regulation is needed (O₂, CO₂, H⁺ goals) |
| 3 | Two-system framework: Central vs Peripheral chemoreceptors |
| 4 | Central chemoreceptors - retrotrapezoid nucleus, CO₂ → H⁺ mechanism |
| 5 | Peripheral chemoreceptors - carotid bodies vs aortic bodies |
| 6 | CO₂ as primary regulator - 3 mechanisms, acute vs chronic adaptation |
| 7 | Role of O₂ - hypoxic drive, PaO₂ thresholds |
| 8 | Role of H⁺/pH - metabolic acidosis & alkalosis effects |
| 9 | Interaction table - CO₂, O₂, H⁺ compared (potency, site, response) |
| 10 | Complete negative feedback loop diagram + COPD/exercise notes |
| 11 | Clinical applications - COPD, altitude, DKA, opioid overdose |
| 12 | 5 key takeaways summary |