GIVE ME PPT OF METABOLIC ACIDOSIS PATHOPHYSIOLOGY MANAGEMENT
mkdir -p /home/daytona/workspace/metabolic-acidosis-ppt && ls /home/daytona/work…
~/metabolic-acidosis-ppt/build.js
const pptxgen = require("pptxgenjs");
const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Metabolic Acidosis: Pathophysiology & Management";
pres.author = "Orris Medical";
// ─── COLOUR PALETTE ───────────────────────────────────────────────
const C = {
navy: "0D2B55", // dominant dark
teal: "1A7A8A", // supporting
accent: "E8A020", // warm amber accent
lightBg: "EEF4F7", // slide body background
white: "FFFFFF",
textDark: "1C2B3A",
textMid: "3D5166",
textLight: "FFFFFF",
red: "C0392B",
green: "1E8449",
orange: "D35400",
purple: "6C3483",
cardBlue: "1B4F72",
cardTeal: "148F77",
cardPurp: "7D3C98",
cardRed: "A93226",
cardOrange:"B7770D",
};
// ─── HELPERS ──────────────────────────────────────────────────────
function addSlideHeader(slide, title, subtitle, dark) {
const bg = dark ? C.navy : C.lightBg;
slide.background = { color: bg };
// top accent bar
slide.addShape(pres.ShapeType.rect, {
x: 0, y: 0, w: "100%", h: 0.08,
fill: { color: C.accent }, line: { color: C.accent }
});
// section label pill
if (subtitle) {
slide.addShape(pres.ShapeType.rect, {
x: 0.4, y: 0.15, w: 2.2, h: 0.32,
fill: { color: C.teal }, line: { color: C.teal },
rectRadius: 0.06
});
slide.addText(subtitle.toUpperCase(), {
x: 0.4, y: 0.15, w: 2.2, h: 0.32,
fontSize: 7.5, bold: true, color: C.white,
align: "center", valign: "middle", margin: 0
});
}
slide.addText(title, {
x: 0.4, y: subtitle ? 0.52 : 0.2, w: 9.2, h: 0.55,
fontSize: 22, bold: true,
color: dark ? C.white : C.navy,
fontFace: "Calibri"
});
// horizontal rule
slide.addShape(pres.ShapeType.line, {
x: 0.4, y: subtitle ? 1.08 : 0.82, w: 9.2, h: 0,
line: { color: C.accent, width: 2 }
});
}
function addCard(slide, x, y, w, h, color, title, bullets) {
slide.addShape(pres.ShapeType.rect, {
x, y, w, h,
fill: { color },
line: { color },
shadow: { type: "outer", blur: 4, offset: 2, angle: 45, color: "888888", opacity: 0.3 }
});
slide.addText(title, {
x: x + 0.12, y: y + 0.05, w: w - 0.24, h: 0.32,
fontSize: 10, bold: true, color: C.white, fontFace: "Calibri", margin: 0
});
const items = bullets.map((b, i) => ({
text: b,
options: { bullet: { type: "bullet" }, breakLine: i < bullets.length - 1,
fontSize: 8.5, color: "DDECF5", fontFace: "Calibri" }
}));
slide.addText(items, {
x: x + 0.12, y: y + 0.40, w: w - 0.24, h: h - 0.48,
valign: "top", margin: 0
});
}
// ═══════════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE
// ═══════════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
s.background = { color: C.navy };
// large decorative rect right side
s.addShape(pres.ShapeType.rect, {
x: 7.0, y: 0, w: 3.0, h: 5.625,
fill: { color: C.teal }, line: { color: C.teal }
});
// accent strip
s.addShape(pres.ShapeType.rect, {
x: 6.85, y: 0, w: 0.15, h: 5.625,
fill: { color: C.accent }, line: { color: C.accent }
});
s.addText("METABOLIC", {
x: 0.5, y: 0.55, w: 6.2, h: 0.9,
fontSize: 48, bold: true, color: C.accent, fontFace: "Calibri", charSpacing: 8
});
s.addText("ACIDOSIS", {
x: 0.5, y: 1.3, w: 6.2, h: 0.9,
fontSize: 48, bold: true, color: C.white, fontFace: "Calibri", charSpacing: 8
});
s.addShape(pres.ShapeType.line, {
x: 0.5, y: 2.25, w: 5.5, h: 0,
line: { color: C.accent, width: 3 }
});
s.addText("Pathophysiology & Management", {
x: 0.5, y: 2.4, w: 6.2, h: 0.5,
fontSize: 18, color: "A8C8D8", fontFace: "Calibri", italic: true
});
s.addText([
{ text: "Harrison's Principles of Internal Medicine 22E • ", options: { italic: true } },
{ text: "NKF Primer on Kidney Diseases 8E • ", options: { italic: true } },
{ text: "Brenner & Rector's The Kidney", options: { italic: true } }
], {
x: 0.5, y: 5.0, w: 6.2, h: 0.45,
fontSize: 8, color: "8AAABB", fontFace: "Calibri"
});
// icons on right panel
s.addText("pH < 7.35", {
x: 7.1, y: 1.1, w: 2.7, h: 0.45,
fontSize: 14, bold: true, color: C.white, align: "center", fontFace: "Calibri"
});
s.addText("HCO₃⁻ < 22 mEq/L", {
x: 7.1, y: 1.7, w: 2.7, h: 0.45,
fontSize: 12, color: "D5EEF5", align: "center", fontFace: "Calibri"
});
s.addText("↓ PaCO₂\n(compensation)", {
x: 7.1, y: 2.3, w: 2.7, h: 0.6,
fontSize: 11, color: "A8D4E0", align: "center", fontFace: "Calibri"
});
}
// ═══════════════════════════════════════════════════════════════════
// SLIDE 2 — DEFINITION & OVERVIEW
// ═══════════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
addSlideHeader(s, "Definition & Overview", "INTRODUCTION");
// Definition box
s.addShape(pres.ShapeType.rect, {
x: 0.4, y: 1.2, w: 9.2, h: 0.85,
fill: { color: C.navy }, line: { color: C.navy }
});
s.addText("Metabolic acidosis is a primary acid-base disorder characterised by a reduction in serum bicarbonate [HCO₃⁻], leading to a fall in arterial pH below 7.35.", {
x: 0.55, y: 1.25, w: 8.9, h: 0.75,
fontSize: 12, color: C.white, fontFace: "Calibri", italic: true, valign: "middle"
});
// 3 feature cards
const cards = [
{ x: 0.4, color: C.cardBlue, title: "ABG Hallmarks", pts: ["pH < 7.35", "↓ HCO₃⁻ (primary)", "↓ PaCO₂ (compensation)", "Base excess < −2 mEq/L"] },
{ x: 3.6, color: C.cardTeal, title: "Compensatory Response", pts: ["Kussmaul breathing", "Hyperventilation within 1 h", "Full compensation in 12–36 h", "Expected PaCO₂ = 1.5×[HCO₃⁻]+8±2"] },
{ x: 6.8, color: C.cardPurp, title: "Clinical Impact", pts: ["Impaired cardiac contractility", "Vasodilation → hypotension", "Hyperkalaemia", "Altered mental status"] },
];
cards.forEach(c => addCard(s, c.x, 2.15, 3.0, 3.1, c.color, c.title, c.pts));
}
// ═══════════════════════════════════════════════════════════════════
// SLIDE 3 — PATHOPHYSIOLOGY
// ═══════════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
addSlideHeader(s, "Pathophysiology", "MECHANISM");
// Flow diagram boxes
const boxes = [
{ x: 0.3, y: 1.2, label: "↑ Acid Production\nor Ingestion", color: C.cardRed },
{ x: 2.7, y: 1.2, label: "↓ Renal Acid\nExcretion", color: C.cardOrange },
{ x: 5.1, y: 1.2, label: "Excess GI / Renal\nHCO₃⁻ Loss", color: C.cardBlue },
{ x: 7.5, y: 1.2, label: "Exogenous\nToxins", color: C.cardPurp },
];
boxes.forEach(b => {
s.addShape(pres.ShapeType.rect, {
x: b.x, y: b.y, w: 2.2, h: 0.75,
fill: { color: b.color }, line: { color: b.color }
});
s.addText(b.label, {
x: b.x, y: b.y, w: 2.2, h: 0.75,
fontSize: 9.5, bold: true, color: C.white,
align: "center", valign: "middle", fontFace: "Calibri"
});
});
// Down arrows → HCO3 box
[0.3, 2.7, 5.1, 7.5].forEach(x => {
s.addShape(pres.ShapeType.line, {
x: x + 1.1, y: 1.95, w: 0, h: 0.45,
line: { color: C.accent, width: 2 }
});
// arrowhead (small triangle at bottom)
s.addText("▼", { x: x + 0.9, y: 2.3, w: 0.4, h: 0.2, fontSize: 9, color: C.accent });
});
// Central result box
s.addShape(pres.ShapeType.rect, {
x: 1.5, y: 2.55, w: 7.0, h: 0.6,
fill: { color: C.navy }, line: { color: C.accent, width: 2 }
});
s.addText("↓ Serum HCO₃⁻ → ↓ Blood pH → Metabolic Acidosis", {
x: 1.5, y: 2.55, w: 7.0, h: 0.6,
fontSize: 13, bold: true, color: C.accent,
align: "center", valign: "middle", fontFace: "Calibri"
});
// Buffering section
s.addText("Buffering & Compensation", {
x: 0.4, y: 3.3, w: 5.0, h: 0.35,
fontSize: 12, bold: true, color: C.navy, fontFace: "Calibri"
});
const bufferItems = [
{ text: "Immediate: Extracellular bicarbonate buffer (H⁺ + HCO₃⁻ → H₂CO₃ → CO₂ + H₂O)", options: { bullet: true, breakLine: true, fontSize: 9.5, color: C.textDark } },
{ text: "Minutes: Intracellular proteins and haemoglobin accept H⁺", options: { bullet: true, breakLine: true, fontSize: 9.5, color: C.textDark } },
{ text: "Hours: Respiratory – Kussmaul breathing blows off CO₂; PaCO₂ falls proportionally to ↓HCO₃⁻", options: { bullet: true, breakLine: true, fontSize: 9.5, color: C.textDark } },
{ text: "Days: Renal – Increased NH₄⁺ excretion; regeneration of HCO₃⁻", options: { bullet: true, fontSize: 9.5, color: C.textDark } },
];
s.addText(bufferItems, {
x: 0.4, y: 3.7, w: 9.2, h: 1.65,
valign: "top", fontFace: "Calibri"
});
}
// ═══════════════════════════════════════════════════════════════════
// SLIDE 4 — ANION GAP CLASSIFICATION
// ═══════════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
addSlideHeader(s, "Anion Gap Classification", "DIAGNOSIS");
// AG formula box
s.addShape(pres.ShapeType.rect, {
x: 0.4, y: 1.2, w: 9.2, h: 0.6,
fill: { color: C.teal }, line: { color: C.teal }
});
s.addText("Anion Gap (AG) = Na⁺ − (Cl⁻ + HCO₃⁻) | Normal = 8–12 mEq/L | Correct for albumin: +2.5 mEq/L per 1 g/dL ↓ albumin", {
x: 0.4, y: 1.2, w: 9.2, h: 0.6,
fontSize: 10.5, bold: true, color: C.white,
align: "center", valign: "middle", fontFace: "Calibri"
});
// Two columns
// High AG column
s.addShape(pres.ShapeType.rect, {
x: 0.3, y: 1.95, w: 4.4, h: 0.45,
fill: { color: C.cardRed }, line: { color: C.cardRed }
});
s.addText("HIGH Anion Gap Acidosis (AG > 12)", {
x: 0.3, y: 1.95, w: 4.4, h: 0.45,
fontSize: 11, bold: true, color: C.white,
align: "center", valign: "middle", fontFace: "Calibri"
});
const highAG = [
["Lactic Acidosis", "Sepsis, shock, cardiac failure, ischaemia, drugs (metformin), cancer"],
["Diabetic Ketoacidosis", "Insulin deficiency → ↑ β-hydroxybutyrate + acetoacetate"],
["Alcoholic Ketoacidosis", "Alcohol binge + starvation; ↑ β-hydroxybutyrate"],
["Starvation Ketoacidosis", "Prolonged fasting; mild-moderate elevation"],
["Renal Failure", "Accumulation of sulphate, phosphate, organic anions"],
["Toxins", "Ethylene glycol, methanol, salicylates, propylene glycol"],
];
highAG.forEach(([title, desc], i) => {
const y = 2.48 + i * 0.45;
s.addShape(pres.ShapeType.rect, {
x: 0.3, y, w: 4.4, h: 0.42,
fill: { color: i % 2 === 0 ? "FDECEA" : "FAD7D3" },
line: { color: "E5A09C" }
});
s.addText([
{ text: title + ": ", options: { bold: true, fontSize: 8.5, color: C.cardRed } },
{ text: desc, options: { fontSize: 8, color: C.textDark } }
], { x: 0.42, y: y + 0.03, w: 4.16, h: 0.36, valign: "middle", fontFace: "Calibri" });
});
// Normal AG column
s.addShape(pres.ShapeType.rect, {
x: 5.1, y: 1.95, w: 4.5, h: 0.45,
fill: { color: C.cardBlue }, line: { color: C.cardBlue }
});
s.addText("NORMAL Anion Gap (Hyperchloraemic) Acidosis", {
x: 5.1, y: 1.95, w: 4.5, h: 0.45,
fontSize: 11, bold: true, color: C.white,
align: "center", valign: "middle", fontFace: "Calibri"
});
const normalAG = [
["Diarrhoea", "Most common GI cause; HCO₃⁻ loss in stool; UAG negative"],
["GI Fistulae", "Biliary, pancreatic, or small bowel fistulae"],
["Proximal RTA (Type 2)", "↓ HCO₃⁻ reabsorption; Fanconi syndrome; UAG positive"],
["Distal RTA (Type 1)", "↓ H⁺ secretion in collecting duct; hypokalaemia; UAG positive"],
["Hyperkalemic RTA (Type 4)", "Hypoaldosteronism; impaired NH₄⁺ excretion; hyperkalaemia"],
["Exogenous acids / Saline", "NH₄Cl, HCl, large-volume normal saline infusion"],
];
normalAG.forEach(([title, desc], i) => {
const y = 2.48 + i * 0.45;
s.addShape(pres.ShapeType.rect, {
x: 5.1, y, w: 4.5, h: 0.42,
fill: { color: i % 2 === 0 ? "EAF4FB" : "D6EAF8" },
line: { color: "9DC3E6" }
});
s.addText([
{ text: title + ": ", options: { bold: true, fontSize: 8.5, color: C.cardBlue } },
{ text: desc, options: { fontSize: 8, color: C.textDark } }
], { x: 5.22, y: y + 0.03, w: 4.26, h: 0.36, valign: "middle", fontFace: "Calibri" });
});
}
// ═══════════════════════════════════════════════════════════════════
// SLIDE 5 — CLINICAL FEATURES
// ═══════════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
addSlideHeader(s, "Clinical Features", "PRESENTATION");
const systems = [
{ sys: "Respiratory", color: C.teal, icon: "🫁", pts: ["Kussmaul breathing (deep, rapid, sighing)", "Compensatory hyperventilation", "Dyspnoea, air hunger", "Respiratory muscle fatigue in severe acidosis"] },
{ sys: "Cardiovascular", color: C.cardRed, icon: "❤️", pts: ["↓ Cardiac contractility", "Peripheral vasodilation", "Hypotension, impaired perfusion", "Arrhythmias, V-fib risk (pH < 7.1)"] },
{ sys: "Neurological", color: C.cardPurp, icon: "🧠", pts: ["Headache, confusion", "Lethargy, stupor → coma", "↑ Intracranial pressure (severe)", "Impaired cerebral function"] },
{ sys: "Metabolic / Electrolyte", color: C.cardOrange, icon: "⚗️", pts: ["Hyperkalaemia (H⁺/K⁺ exchange)", "Hyponatraemia (dilutional)", "Bone demineralisation (chronic)", "Muscle catabolism, growth retardation"] },
{ sys: "Renal", color: C.cardBlue, icon: "🫘", pts: ["↑ NH₄⁺ production & excretion", "Nephrolithiasis (chronic RTA)", "Nephrocalcinosis", "Progressive CKD acceleration"] },
{ sys: "GI / Other", color: C.navy, icon: "🔬", pts: ["Nausea, vomiting", "Abdominal pain (DKA)", "Fruity breath (ketosis)", "Oxalate crystals in urine (ethylene glycol)"] },
];
systems.forEach((sys, i) => {
const col = i % 3;
const row = Math.floor(i / 3);
const x = 0.3 + col * 3.25;
const y = 1.2 + row * 2.1;
s.addShape(pres.ShapeType.rect, {
x, y, w: 3.1, h: 1.95,
fill: { color: sys.color },
line: { color: sys.color }
});
s.addText(sys.sys, {
x: x + 0.1, y: y + 0.05, w: 2.9, h: 0.35,
fontSize: 10.5, bold: true, color: C.white, fontFace: "Calibri"
});
const bullets = sys.pts.map((p, idx) => ({
text: p,
options: { bullet: true, breakLine: idx < sys.pts.length - 1, fontSize: 8.2, color: "D5EEF5" }
}));
s.addText(bullets, {
x: x + 0.1, y: y + 0.42, w: 2.9, h: 1.45,
valign: "top", fontFace: "Calibri"
});
});
}
// ═══════════════════════════════════════════════════════════════════
// SLIDE 6 — DIAGNOSIS: STEPWISE APPROACH
// ═══════════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
addSlideHeader(s, "Stepwise Diagnostic Approach", "DIAGNOSIS");
const steps = [
{ n: "1", label: "Obtain ABG + electrolytes simultaneously", detail: "Measure pH, PaCO₂, HCO₃⁻ from ABG; compare calculated vs. measured HCO₃⁻ (should agree ±2 mEq/L)" },
{ n: "2", label: "Confirm metabolic acidosis", detail: "pH < 7.35 with ↓ HCO₃⁻; primary disturbance = metabolic if HCO₃⁻ is the driver" },
{ n: "3", label: "Calculate Anion Gap", detail: "AG = Na⁺ − (Cl⁻ + HCO₃⁻); correct for albumin (+2.5 per 1 g/dL drop below 4 g/dL)" },
{ n: "4", label: "High AG → MUDPILES / Normal AG → UAG", detail: "High AG: MUDPILES. Normal AG: Urine AG = (Na⁺+K⁺)u − Cl⁻u; negative = GI loss; positive = RTA" },
{ n: "5", label: "Assess respiratory compensation", detail: "Expected PaCO₂ = (1.5 × HCO₃⁻) + 8 ±2 (Winter's formula); deviation = mixed disorder" },
{ n: "6", label: "Delta-Delta ratio (high-AG only)", detail: "ΔAG / ΔHCO₃⁻ ratio: 1–2 = pure high-AG; < 1 = mixed high + normal AG; > 2 = mixed high-AG + metabolic alkalosis" },
{ n: "7", label: "Identify underlying cause", detail: "History, exam, BUN/creatinine, glucose, lactate, ketones, osmol gap, drug/toxin screen, urine studies" },
];
steps.forEach((st, i) => {
const y = 1.15 + i * 0.61;
// number circle
s.addShape(pres.ShapeType.ellipse, {
x: 0.3, y: y + 0.05, w: 0.42, h: 0.42,
fill: { color: i < 3 ? C.teal : i < 5 ? C.accent : C.navy },
line: { color: "FFFFFF" }
});
s.addText(st.n, {
x: 0.3, y: y + 0.05, w: 0.42, h: 0.42,
fontSize: 11, bold: true, color: C.white,
align: "center", valign: "middle", fontFace: "Calibri", margin: 0
});
// label
s.addText(st.label, {
x: 0.85, y: y + 0.04, w: 3.5, h: 0.25,
fontSize: 9.5, bold: true, color: C.navy, fontFace: "Calibri"
});
// detail
s.addText(st.detail, {
x: 0.85, y: y + 0.29, w: 8.7, h: 0.28,
fontSize: 8, color: C.textMid, fontFace: "Calibri"
});
// divider
if (i < steps.length - 1) {
s.addShape(pres.ShapeType.line, {
x: 0.85, y: y + 0.59, w: 8.7, h: 0,
line: { color: "CCDDEE", width: 0.5 }
});
}
});
}
// ═══════════════════════════════════════════════════════════════════
// SLIDE 7 — MANAGEMENT: OVERVIEW
// ═══════════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
addSlideHeader(s, "Management Overview", "TREATMENT");
// 2-column layout
// Left: General Principles
s.addShape(pres.ShapeType.rect, {
x: 0.3, y: 1.2, w: 4.6, h: 0.42,
fill: { color: C.navy }, line: { color: C.navy }
});
s.addText("GENERAL PRINCIPLES", {
x: 0.3, y: 1.2, w: 4.6, h: 0.42,
fontSize: 11, bold: true, color: C.accent,
align: "center", valign: "middle", fontFace: "Calibri"
});
const genPrinciples = [
"Identify and TREAT the underlying cause (primary goal)",
"Assess severity: pH, HCO₃⁻, clinical features",
"Monitor ABG, electrolytes, lactate, urine output closely",
"Correct associated electrolyte disorders (especially K⁺)",
"Alkali therapy: Reserved for specific indications (see next slides)",
"Haemodialysis if refractory or toxin-induced",
"ICU/HDU care for pH < 7.20 or haemodynamic instability",
];
const genItems = genPrinciples.map((p, i) => ({
text: p,
options: { bullet: { type: "bullet" }, breakLine: i < genPrinciples.length - 1, fontSize: 9, color: C.textDark }
}));
s.addText(genItems, {
x: 0.3, y: 1.68, w: 4.6, h: 3.7,
valign: "top", fontFace: "Calibri",
fill: { color: "F0F6FA" }, line: { color: "C0D8E8" }
});
// Right: NaHCO3 guidance
s.addShape(pres.ShapeType.rect, {
x: 5.1, y: 1.2, w: 4.5, h: 0.42,
fill: { color: C.teal }, line: { color: C.teal }
});
s.addText("SODIUM BICARBONATE THERAPY", {
x: 5.1, y: 1.2, w: 4.5, h: 0.42,
fontSize: 11, bold: true, color: C.white,
align: "center", valign: "middle", fontFace: "Calibri"
});
const bicarb = [
{ title: "Indications", color: C.cardRed, pts: ["Non-AG (hyperchloraemic) acidosis", "Uremic acidosis (non-metabolisable anions)", "Severe acidaemia pH < 7.10–7.20 (individualise)", "DKA only if pH < 7.00 with shock"] },
{ title: "Contraindications / Caution", color: C.cardOrange, pts: ["Lactic acidosis from tissue hypoxia (may worsen)", "DKA (not routine; risk of hypokalaemia, cerebral oedema)", "Respiratory compromise (CO₂ load)", "Overcorrection → paradoxical CNS acidosis"] },
{ title: "Dosing Guidance", color: C.cardBlue, pts: ["Target: ↑ HCO₃⁻ to 10–12 mmol/L (DKA) or 22 mmol/L (CKD)", "50 mEq NaHCO₃ in 300 mL saline over 30–45 min IV (DKA)", "PO: NaHCO₃ tablets 650 mg (7.8 mEq) or Shohl's solution", "Monitor K⁺ carefully during correction"] },
];
let yb = 1.68;
bicarb.forEach(b => {
s.addShape(pres.ShapeType.rect, {
x: 5.1, y: yb, w: 4.5, h: 0.28,
fill: { color: b.color }, line: { color: b.color }
});
s.addText(b.title, {
x: 5.1, y: yb, w: 4.5, h: 0.28,
fontSize: 9, bold: true, color: C.white,
align: "center", valign: "middle", fontFace: "Calibri"
});
yb += 0.28;
const bItems = b.pts.map((p, i) => ({
text: p,
options: { bullet: true, breakLine: i < b.pts.length - 1, fontSize: 8, color: C.textDark }
}));
s.addText(bItems, {
x: 5.22, y: yb, w: 4.26, h: b.pts.length * 0.3,
valign: "top", fontFace: "Calibri"
});
yb += b.pts.length * 0.3 + 0.1;
});
}
// ═══════════════════════════════════════════════════════════════════
// SLIDE 8 — MANAGEMENT BY CAUSE
// ═══════════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
addSlideHeader(s, "Cause-Specific Management", "TREATMENT");
const causes = [
{
title: "Lactic Acidosis (Type A)",
color: C.cardRed,
x: 0.3, y: 1.2, w: 3.0,
pts: ["Restore tissue perfusion urgently", "IV fluids, vasopressors for septic shock", "Treat infection (antibiotics)", "Oxygen / mechanical ventilation", "Avoid NaHCO₃ (may worsen intracellular acidosis)", "Consider renal replacement therapy if severe"]
},
{
title: "Diabetic Ketoacidosis",
color: C.cardOrange,
x: 3.55, y: 1.2, w: 3.0,
pts: ["IV fluids (normal saline initially)", "Insulin infusion 0.1 U/kg/h", "Potassium replacement (K⁺ < 3.5 → hold insulin)", "NaHCO₃ only if pH < 7.00 with shock", "Target HCO₃⁻ 10–12 mmol/L (not normal)", "Monitor glucose, K⁺, pH hourly"]
},
{
title: "Renal Tubular Acidosis",
color: C.cardBlue,
x: 6.8, y: 1.2, w: 2.9,
pts: ["Type 1 (distal): NaHCO₃ 1–3 mEq/kg/day; K⁺ citrate", "Type 2 (proximal): Large alkali doses; K⁺ supplement", "Type 4: Fludrocortisone (if hypoaldosteronism)", "Remove offending drugs (carbonic anhydrase inhibitors)"]
},
{
title: "CKD / Uraemic Acidosis",
color: C.cardTeal,
x: 0.3, y: 3.6, w: 3.0,
pts: ["Oral NaHCO₃ 1–1.5 mEq/kg/day", "Target HCO₃⁻ > 22 mmol/L", "Fruits & vegetables (citrate) as alternative", "Slows CKD progression", "Dialysis for end-stage / refractory cases"]
},
{
title: "Toxic Ingestions",
color: C.cardPurp,
x: 3.55, y: 3.6, w: 3.0,
pts: ["Ethylene glycol / Methanol: Fomepizole (4-MP) 15 mg/kg IV", "Correct osmol gap; urgent haemodialysis", "Salicylates: Urinary alkalinisation, HD if severe", "Activated charcoal if early presentation"]
},
{
title: "GI Losses (Diarrhoea)",
color: C.navy,
x: 6.8, y: 3.6, w: 2.9,
pts: ["IV/PO fluid replacement", "Treat underlying GI cause", "Correct associated hypokalaemia", "Oral rehydration salts", "Alkali rarely needed if cause treated"]
},
];
causes.forEach(c => {
s.addShape(pres.ShapeType.rect, {
x: c.x, y: c.y, w: c.w, h: 1.95,
fill: { color: c.color }, line: { color: c.color }
});
s.addText(c.title, {
x: c.x + 0.1, y: c.y + 0.04, w: c.w - 0.2, h: 0.32,
fontSize: 9.5, bold: true, color: C.white, fontFace: "Calibri"
});
const items = c.pts.map((p, i) => ({
text: p,
options: { bullet: true, breakLine: i < c.pts.length - 1, fontSize: 7.8, color: "D5EEF5" }
}));
s.addText(items, {
x: c.x + 0.1, y: c.y + 0.38, w: c.w - 0.2, h: 1.5,
valign: "top", fontFace: "Calibri"
});
});
}
// ═══════════════════════════════════════════════════════════════════
// SLIDE 9 — HIGH-AG ACIDOSIS: MUDPILES MNEMONIC
// ═══════════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
addSlideHeader(s, "High AG Acidosis: MUDPILES Mnemonic", "MEMORY AID");
s.background = { color: "0A1A30" };
const letters = [
{ L: "M", word: "Methanol", detail: "Causes formate accumulation → optic nerve damage; high osmol gap" },
{ L: "U", word: "Uraemia", detail: "CKD → retained sulphates, phosphates, organic acids" },
{ L: "D", word: "DKA / Alcoholic KA", detail: "β-hydroxybutyrate + acetoacetate; blood glucose + ketones ↑" },
{ L: "P", word: "Propylene glycol / Pyroglutamic acid", detail: "IV lorazepam vehicle (PG); paracetamol/5-oxoproline (PGA)" },
{ L: "I", word: "Iron / INH / Isoniazid", detail: "Mitochondrial toxicity; lactic acidosis; seizures" },
{ L: "L", word: "Lactic acidosis", detail: "Type A (tissue hypoxia) vs Type B (mitochondrial, drugs)" },
{ L: "E", word: "Ethylene glycol", detail: "Oxalate crystals in urine; renal failure; osmol gap" },
{ L: "S", word: "Salicylates", detail: "Mixed HAGMA + respiratory alkalosis; tinnitus" },
];
letters.forEach((item, i) => {
const col = i % 2;
const row = Math.floor(i / 2);
const x = col === 0 ? 0.3 : 5.1;
const y = 1.15 + row * 1.1;
s.addShape(pres.ShapeType.rect, {
x, y, w: 4.6, h: 1.0,
fill: { color: "122040" }, line: { color: C.teal, width: 1 }
});
// Big letter
s.addShape(pres.ShapeType.rect, {
x: x + 0.06, y: y + 0.06, w: 0.7, h: 0.88,
fill: { color: C.accent }, line: { color: C.accent }
});
s.addText(item.L, {
x: x + 0.06, y: y + 0.06, w: 0.7, h: 0.88,
fontSize: 28, bold: true, color: C.navy,
align: "center", valign: "middle", fontFace: "Calibri", margin: 0
});
s.addText(item.word, {
x: x + 0.85, y: y + 0.06, w: 3.6, h: 0.38,
fontSize: 11, bold: true, color: C.white, fontFace: "Calibri"
});
s.addText(item.detail, {
x: x + 0.85, y: y + 0.45, w: 3.6, h: 0.48,
fontSize: 8.5, color: "8AAABB", fontFace: "Calibri", italic: true
});
});
}
// ═══════════════════════════════════════════════════════════════════
// SLIDE 10 — SUMMARY & KEY TAKE-AWAYS
// ═══════════════════════════════════════════════════════════════════
{
const s = pres.addSlide();
s.background = { color: C.navy };
s.addShape(pres.ShapeType.rect, {
x: 0, y: 0, w: "100%", h: 0.08,
fill: { color: C.accent }, line: { color: C.accent }
});
s.addText("Key Take-Aways", {
x: 0.5, y: 0.2, w: 9.0, h: 0.55,
fontSize: 26, bold: true, color: C.accent, fontFace: "Calibri"
});
s.addShape(pres.ShapeType.line, {
x: 0.5, y: 0.78, w: 9.0, h: 0,
line: { color: C.teal, width: 2 }
});
const takeaways = [
{ n: "01", text: "Metabolic acidosis = ↓ HCO₃⁻ + ↓ pH, compensated by hyperventilation (↓ PaCO₂)." },
{ n: "02", text: "Always calculate the Anion Gap and correct for albumin; it splits causes into High-AG (MUDPILES) vs Normal-AG (GI loss / RTA)." },
{ n: "03", text: "Winter's formula checks adequacy of respiratory compensation: expected PaCO₂ = 1.5×HCO₃⁻ + 8 ±2." },
{ n: "04", text: "Treat the underlying cause — this is the primary and most effective management strategy." },
{ n: "05", text: "NaHCO₃ is indicated for hyperchloraemic acidosis and uremic acidosis (target HCO₃⁻ ≥ 22); use with caution in lactic acidosis." },
{ n: "06", text: "In DKA, NaHCO₃ only for pH < 7.00 with shock; target HCO₃⁻ 10–12 mmol/L — never overcorrect." },
{ n: "07", text: "Toxin ingestion: fomepizole for methanol/ethylene glycol + urgent haemodialysis; urinary alkalinisation for salicylates." },
{ n: "08", text: "Chronic metabolic acidosis in CKD accelerates bone loss and CKD progression; treat with oral alkali to maintain HCO₃⁻ > 22 mmol/L." },
];
takeaways.forEach((t, i) => {
const y = 0.88 + i * 0.58;
s.addShape(pres.ShapeType.ellipse, {
x: 0.4, y: y + 0.04, w: 0.38, h: 0.38,
fill: { color: C.teal }, line: { color: C.teal }
});
s.addText(t.n, {
x: 0.4, y: y + 0.04, w: 0.38, h: 0.38,
fontSize: 8, bold: true, color: C.white,
align: "center", valign: "middle", fontFace: "Calibri", margin: 0
});
s.addText(t.text, {
x: 0.9, y: y, w: 8.7, h: 0.5,
fontSize: 9.5, color: "C8DCE8", fontFace: "Calibri", valign: "middle"
});
});
s.addText("Sources: Harrison's Principles of Internal Medicine 22E (2025) • NKF Primer on Kidney Diseases 8E • Brenner & Rector's The Kidney", {
x: 0.5, y: 5.35, w: 9.0, h: 0.22,
fontSize: 6.5, color: "557799", fontFace: "Calibri", italic: true
});
}
// ─── WRITE FILE ───────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/metabolic-acidosis-ppt/Metabolic_Acidosis.pptx" })
.then(() => console.log("SUCCESS: Metabolic_Acidosis.pptx created"))
.catch(e => { console.error("ERROR:", e); process.exit(1); });
cd /home/daytona/workspace/metabolic-acidosis-ppt && node build.js 2>&1
ls -lh /home/daytona/workspace/metabolic-acidosis-ppt/Metabolic_Acidosis.pptx