Kreb cycle

Reading File
Finding Sources
Searching the Web

Krebs cycle steps enzymes NADH FADH2 overview biochemistry

Reading File
Loading Image
Reading File
Here is a thorough breakdown of the Krebs cycle based on Guyton & Hall's Textbook of Medical Physiology.

The Krebs Cycle (Citric Acid Cycle / TCA Cycle)

Named after Hans Krebs who discovered it, the citric acid cycle is also called the tricarboxylic acid (TCA) cycle. It is the second major stage of aerobic cellular respiration, occurring in the mitochondrial matrix.

Entry Point: Acetyl-CoA

Before the cycle begins, pyruvate (from glycolysis) is converted to acetyl-CoA in the mitochondria by pyruvate dehydrogenase. This step releases one CO2 and one NADH per pyruvate. Since glucose yields two pyruvates, two acetyl-CoA molecules enter the cycle per glucose.

The 8 Steps of the Krebs Cycle

Krebs Cycle diagram showing all intermediates, CO2 release, H and ATP production
Figure 68.6 from Guyton & Hall - Chemical reactions of the citric acid cycle
StepReactionEnzymeProducts
1Oxaloacetate + Acetyl-CoA → CitrateCitrate synthaseCoA released
2Citrate → cis-Aconitate → IsocitrateAconitaseH2O removed, then added
3Isocitrate → Oxalosuccinate → α-KetoglutarateIsocitrate dehydrogenase2H (→ NADH), CO2
4α-Ketoglutarate → Succinyl-CoAα-Ketoglutarate dehydrogenase2H (→ NADH), CO2
5Succinyl-CoA → SuccinateSuccinyl-CoA synthaseGTP (= ATP)
6Succinate → FumarateSuccinate dehydrogenase2H (→ FADH2)
7Fumarate → MalateFumaraseH2O added
8Malate → OxaloacetateMalate dehydrogenase2H (→ NADH)
Oxaloacetate is regenerated at step 8, allowing the cycle to continue.

Net Products Per Acetyl-CoA (one turn)

ProductAmountFate
CO22 moleculesExpired via lungs
NADH3 moleculesOxidative phosphorylation → ~7.5 ATP
FADH21 moleculeOxidative phosphorylation → ~1.5 ATP
GTP/ATP1 moleculeDirect energy
Per glucose molecule (2 turns of the cycle):
  • 4 CO2
  • 6 NADH
  • 2 FADH2
  • 2 ATP (from GTP)
  • Total from Krebs alone: ~2 ATP directly; NADH/FADH2 then yield ~20 more ATP via oxidative phosphorylation

Key Regulatory Enzymes

Three enzymes act as major control points, all inhibited by high-energy states:
  1. Citrate synthase - inhibited by ATP, NADH, succinyl-CoA, citrate
  2. Isocitrate dehydrogenase - inhibited by ATP/NADH; activated by ADP/Ca2+
  3. α-Ketoglutarate dehydrogenase - inhibited by succinyl-CoA, NADH; activated by Ca2+

Role of Dehydrogenases and NAD+

As stated in Guyton & Hall: "Twenty of the 24 hydrogen atoms [released per glucose] immediately combine with nicotinamide adenine dinucleotide (NAD+), a derivative of the vitamin niacin."
The remaining 4 hydrogen atoms (released between succinate → fumarate) combine with FAD instead, forming FADH2. All these carriers then feed into the electron transport chain for the bulk of ATP production via oxidative phosphorylation.

Amphibolic Nature (Both Anabolic and Catabolic)

The Krebs cycle is not purely catabolic. Its intermediates serve as precursors for biosynthesis:
  • α-Ketoglutarate → glutamate and other amino acids
  • Succinyl-CoA → heme (porphyrin) synthesis
  • Oxaloacetate → aspartate, gluconeogenesis
  • Citrate → exported to cytoplasm for fatty acid synthesis

Overall Energy Yield from One Glucose Molecule

StageATP yield
Glycolysis2 ATP (net)
Pyruvate → Acetyl-CoA~5 ATP (via 2 NADH)
Krebs cycle (2 turns)~20 ATP (via NADH, FADH2) + 2 GTP
Total~30-32 ATP

Source: Guyton and Hall Textbook of Medical Physiology, Chapter 68 (Metabolism and Temperature Regulation), p. 836.

Create a visual study guide/poster on the 8 Krebs cycle enzymes

Generating Image

A detailed visual study guide poster titled "The 8 Enzymes of the Krebs Cycle" showing a circular biochemical pathway diagram in the center with all 8 steps labeled. The cycle shows: Step 1 - Citrate Synthase (Oxaloacetate + Acetyl-CoA → Citrate), Step 2 - Aconitase (Citrate → Isocitrate via cis-Aconitate), Step 3 - Isocitrate Dehydrogenase (Isocitrate → α-Ketoglutarate, releases CO2, produces NADH), Step 4 - α-Ketoglutarate Dehydrogenase (α-Ketoglutarate → Succinyl-CoA, releases CO2, produces NADH), Step 5 - Succinyl-CoA Synthetase (Succinyl-CoA → Succinate, produces GTP/ATP), Step 6 - Succinate Dehydrogenase (Succinate → Fumarate, produces FADH2), Step 7 - Fumarase (Fumarate → Malate), Step 8 - Malate Dehydrogenase (Malate → Oxaloacetate, produces NADH). Each enzyme has a color-coded callout box with the enzyme name, substrates, products, and cofactors. Energy carriers NADH, FADH2, GTP are highlighted in gold/yellow. CO2 releases marked in red. Regulatory enzymes (Citrate Synthase, Isocitrate Dehydrogenase, α-Ketoglutarate Dehydrogenase) are marked with a star. Location label: Mitochondrial Matrix. Clean dark blue and white scientific poster style, suitable for medical students.

The 8 Enzymes of the Krebs Cycle - Visual Study Guide
Here's a quick reference summary to go along with the poster:
#EnzymeSubstrate → ProductCofactor/ProductNotes
1Citrate SynthaseOxaloacetate + Acetyl-CoA → CitrateCoA released⭐ Regulatory; inhibited by ATP, NADH, citrate
2AconitaseCitrate → Isocitrate-Goes via cis-Aconitate intermediate
3Isocitrate DehydrogenaseIsocitrate → α-KetoglutarateNADH, CO2⭐ Regulatory; activated by ADP/Ca2+
4α-Ketoglutarate Dehydrogenaseα-Ketoglutarate → Succinyl-CoANADH, CO2⭐ Regulatory; requires B vitamins (thiamine, lipoate)
5Succinyl-CoA SynthetaseSuccinyl-CoA → SuccinateGTPOnly step producing direct ATP equivalent
6Succinate DehydrogenaseSuccinate → FumarateFADH2Embedded in inner mitochondrial membrane; also Complex II of ETC
7FumaraseFumarate → MalateH2O addedSimple hydration reaction
8Malate DehydrogenaseMalate → OxaloacetateNADHRegenerates oxaloacetate to restart the cycle
Memory tip for the 8 enzymes in order:
Citrus Are In A Sunny South Florida Most days (Citrate synthase - Aconitase - Isocitrate DH - Alpha-KG DH - Succinyl-CoA synthetase - Succinate DH - Fumarase - Malate DH)

Regulation of blood ph biochemistry

Finding Sources
Finding Sources
Searching the Web

regulation of blood pH biochemistry buffer systems bicarbonate respiratory renal

Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Finding Sources
Reading File
Reading File
Reading File
Reading File
Loading Image
Loading Image
Here is a thorough biochemistry overview of blood pH regulation, drawn from Basic Medical Biochemistry (6e), Lippincott's Illustrated Biochemistry (8e), and Ganong's Review of Medical Physiology (26e).

Regulation of Blood pH

Normal Blood pH

ParameterNormal Value
Arterial blood pH7.36 - 7.44 (mean 7.40)
[H+] at pH 7.4~40 nEq/L (4 × 10⁻⁸ mol/L)
Compatible range for life6.8 - 7.8
Intracellular pH~7.1 (range 6.9 - 7.4)
Metabolism produces roughly 22,000 mEq of acid per day. Without buffering, this would drop blood pH to < 1. Three lines of defense maintain pH within the narrow normal range.

Line 1: Chemical Buffer Systems (Immediate - seconds)

A buffer resists pH change when acid or base is added by converting strong acids/bases into weak ones. Maximum buffering occurs at a pH ± 1 unit of the pKa.

The Henderson-Hasselbalch Equation

$$\text{pH} = \text{pKa} + \log\frac{[\text{A}^-]}{[\text{HA}]}$$
For the bicarbonate system specifically:
$$\text{pH} = 6.1 + \log\frac{[\text{HCO}3^-]}{0.03 \times P{aCO_2}}$$
At normal values: pH = 6.1 + log(24 / 1.2) = 6.1 + log(20) = 6.1 + 1.3 = 7.4

A. Bicarbonate-Carbonic Acid Buffer System (ECF - most important)

Bicarbonate buffer system: CO2 + H2O ⇌ H2CO3 ⇌ HCO3- + H+ via carbonic anhydrase
Figure 4.8, Basic Medical Biochemistry 6e - The bicarbonate buffer system
The central reaction:
CO₂ + H₂O ⇌ H₂CO₃ ⇌ HCO₃⁻ + H⁺
Catalyzed by carbonic anhydrase (CA). This system is uniquely powerful because:
  • CO₂ is controlled by the lungs (volatile acid)
  • HCO₃⁻ is controlled by the kidneys
  • Both components can be independently regulated, giving far more flexibility than a simple chemical buffer
Although the pKa is 6.1 (not ideal for buffering at pH 7.4), the open system keeps the ratio [HCO₃⁻]/[CO₂] = 20:1 and maintains pH at 7.4.

B. Hemoglobin Buffer System (RBCs - very important)

Buffering systems showing cooperation between hepatic cells, blood, and red blood cells
Figure 4.9, Basic Medical Biochemistry 6e - Integrated buffering systems of the body
  • CO₂ from the TCA cycle diffuses into RBCs
  • Carbonic anhydrase (high in RBCs) converts CO₂ → H₂CO₃ → HCO₃⁻ + H⁺
  • H⁺ is buffered by histidine residues on hemoglobin (pKa 6.7) → forms HbH
  • HCO₃⁻ is exported to plasma in exchange for Cl⁻ (chloride shift)
  • In the lungs, the process reverses: HbH releases H⁺, HCO₃⁻ re-enters RBCs, CO₂ is exhaled
Deoxyhemoglobin is a better buffer than oxyhemoglobin (Bohr effect).

C. Phosphate Buffer System (ICF and Urine)

HPO₄²⁻ / H₂PO₄⁻ system, pKa = 6.8. More effective intracellularly and in urine than in blood (low phosphate concentration in plasma limits its role there).

D. Protein Buffer System

Plasma proteins and intracellular proteins buffer via ionizable amino acid side chains (especially histidine). Accounts for a large fraction of intracellular buffering.

Line 2: Respiratory Regulation (Minutes - hours)

The lungs regulate CO₂, which directly shifts the bicarbonate equilibrium:
  • Acidosis (↓ pH): Peripheral chemoreceptors detect ↑ H⁺/CO₂ → stimulate respiratory center → hyperventilation → blows off CO₂ → pH rises
  • Alkalosis (↑ pH): Respiratory center is depressed → hypoventilation → CO₂ retained → pH falls
This can correct pH changes 10-75× faster than renal compensation, but cannot fully compensate for metabolic disorders.
ConditionLungs respond by
Metabolic acidosisHyperventilation (↓ PaCO₂)
Metabolic alkalosisHypoventilation (↑ PaCO₂)

Line 3: Renal Regulation (Hours - days, most powerful long-term)

The kidneys regulate pH by:
  1. Reabsorbing HCO₃⁻ (80% reabsorbed in proximal tubule)
  2. Secreting H⁺ into tubular lumen
  3. Excreting titratable acid (phosphate buffers) and ammonium (NH₄⁺)

Renal H⁺ Secretion Mechanisms

LocationTransporterDetails
Proximal tubuleNa⁺-H⁺ exchanger (NHE3)Secondary active; driven by Na⁺ gradient from Na/K ATPase
Distal tubule / Collecting ductH⁺-ATPase (proton pump)Primary active; Na⁺-independent; stimulated by aldosterone
Inside tubular cells, carbonic anhydrase II forms H₂CO₃ from CO₂ + H₂O → dissociates to H⁺ (secreted into lumen) + HCO₃⁻ (enters blood). Net effect: for every H⁺ secreted, one HCO₃⁻ is added back to blood.

Summary: The Four Acid-Base Disorders

DisorderPrimary ChangeCompensation
Metabolic Acidosis↓ HCO₃⁻↑ Ventilation (↓ PaCO₂)
Metabolic Alkalosis↑ HCO₃⁻↓ Ventilation (↑ PaCO₂)
Respiratory Acidosis↑ PaCO₂Kidneys retain HCO₃⁻, excrete H⁺
Respiratory Alkalosis↓ PaCO₂Kidneys excrete HCO₃⁻, retain H⁺

Quick Comparison of Buffer Systems

Buffer SystemLocationpKaRegulated By
Bicarbonate/H₂CO₃ECF/blood6.1Lungs + Kidneys
HemoglobinRBCs6.7O₂/CO₂ exchange
PhosphateICF, urine6.8Kidneys
ProteinsICF, plasma~6-7Metabolism

Sources:
  • Basic Medical Biochemistry: A Clinical Approach, 6e, Chapter 4, pp. 96-98
  • Lippincott's Illustrated Biochemistry, 8e, Chapter 1, pp. 33-34
  • Ganong's Review of Medical Physiology, 26e, Chapter 39, pp. 711-712

Generate a clinical practice guide on ABG interpretation

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

ls -la /home/daytona/workspace/ 2>/dev/null && mkdir -p /home/daytona/workspace/abg-guide

Writing File

~/abg-guide/abg_guide.js

const pptxgen = require("pptxgenjs");

let pres = new pptxgen();
pres.layout = 'LAYOUT_16x9';
pres.title = 'ABG Interpretation Clinical Practice Guide';
pres.author = 'Orris Clinical Reference';

// Color palette
const C = {
  darkBlue:   "0D2137",  // dominant dark
  midBlue:    "1A3A5C",
  accent:     "00C9A7",  // teal accent
  accentWarm: "FF6B6B",  // red for acidosis
  accentAlk:  "4FC3F7",  // blue for alkalosis
  yellow:     "FFD93D",  // highlight
  white:      "FFFFFF",
  lightGray:  "E8F0F7",
  textDark:   "1A1A2E",
  textMid:    "334155",
  green:      "22C55E",
  orange:     "F97316",
};

// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 1: Title
// ─────────────────────────────────────────────────────────────────────────────
let s1 = pres.addSlide();
s1.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.darkBlue } });
// accent bar
s1.addShape(pres.ShapeType.rect, { x: 0, y: 4.8, w: 10, h: 0.825, fill: { color: C.accent } });

s1.addText("ABG INTERPRETATION", {
  x: 0.5, y: 0.6, w: 9, h: 1.1,
  fontSize: 44, bold: true, color: C.white,
  fontFace: "Calibri", align: "center", charSpacing: 5,
});
s1.addText("Clinical Practice Guide", {
  x: 0.5, y: 1.65, w: 9, h: 0.7,
  fontSize: 26, color: C.accent, fontFace: "Calibri", align: "center",
});
s1.addText("Arterial Blood Gas  •  Acid-Base Disorders  •  Compensation  •  Clinical Cases", {
  x: 0.5, y: 2.4, w: 9, h: 0.5,
  fontSize: 14, color: "A0BACE", fontFace: "Calibri", align: "center",
});

// decorative circles
s1.addShape(pres.ShapeType.ellipse, { x: 7.8, y: 0.2, w: 2.2, h: 2.2, fill: { color: "1A3A5C" }, line: { color: C.accent, width: 2 } });
s1.addShape(pres.ShapeType.ellipse, { x: 8.2, y: 0.6, w: 1.4, h: 1.4, fill: { color: C.accent } });

s1.addText("Reference • Rosen's Emergency Medicine 10e • Frameworks for Internal Medicine\nGanong's Medical Physiology 26e • Basic Medical Biochemistry 6e", {
  x: 0.5, y: 4.9, w: 9, h: 0.6,
  fontSize: 9, color: C.darkBlue, fontFace: "Calibri", align: "center",
});


// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 2: Normal ABG Values + Key Parameters
// ─────────────────────────────────────────────────────────────────────────────
let s2 = pres.addSlide();
s2.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.lightGray } });
// header bar
s2.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.75, fill: { color: C.darkBlue } });
s2.addText("NORMAL ABG VALUES & KEY PARAMETERS", {
  x: 0.3, y: 0.05, w: 9.4, h: 0.65, fontSize: 18, bold: true, color: C.accent,
  fontFace: "Calibri", valign: "middle",
});

// 6 parameter cards
const params = [
  { label: "pH", normal: "7.35 – 7.45", acidosis: "< 7.35", alkalosis: "> 7.45", color: C.midBlue },
  { label: "PaCO₂", normal: "35 – 45 mmHg", acidosis: "> 45 (resp. acid)", alkalosis: "< 35 (resp. alk)", color: C.midBlue },
  { label: "HCO₃⁻", normal: "22 – 26 mEq/L", acidosis: "< 22 (met. acid)", alkalosis: "> 26 (met. alk)", color: C.midBlue },
  { label: "PaO₂", normal: "80 – 100 mmHg", acidosis: "< 80: hypoxemia", alkalosis: "", color: C.midBlue },
  { label: "SaO₂", normal: "95 – 100%", acidosis: "< 90%: critical", alkalosis: "", color: C.midBlue },
  { label: "Base Excess", normal: "-2 to +2 mEq/L", acidosis: "< -2: acidosis", alkalosis: "> +2: alkalosis", color: C.midBlue },
];

params.forEach((p, i) => {
  const col = i % 3;
  const row = Math.floor(i / 3);
  const x = 0.25 + col * 3.25;
  const y = 1.0 + row * 2.15;

  s2.addShape(pres.ShapeType.rect, { x, y, w: 3.1, h: 1.9, fill: { color: C.white }, line: { color: C.accent, width: 1.5 }, shadow: { type: "outer", blur: 4, offset: 2, angle: 45, color: "AAAAAA", opacity: 0.3 } });
  s2.addShape(pres.ShapeType.rect, { x, y, w: 3.1, h: 0.4, fill: { color: p.color }, line: { color: p.color, width: 0 } });
  s2.addText(p.label, { x, y, w: 3.1, h: 0.4, fontSize: 14, bold: true, color: C.white, align: "center", valign: "middle", fontFace: "Calibri" });

  s2.addText([
    { text: "Normal: ", options: { bold: true, color: C.green } },
    { text: p.normal + "\n", options: { color: C.textDark } },
    { text: p.acidosis ? "↓  " + p.acidosis + "\n" : "", options: { color: C.accentWarm } },
    { text: p.alkalosis ? "↑  " + p.alkalosis : "", options: { color: C.accentAlk } },
  ], { x: x + 0.1, y: y + 0.44, w: 2.9, h: 1.42, fontSize: 10.5, fontFace: "Calibri", valign: "top" });
});

// Henderson-Hasselbalch box
s2.addShape(pres.ShapeType.rect, { x: 0.25, y: 4.65, w: 9.5, h: 0.75, fill: { color: C.darkBlue }, line: { color: C.accent, width: 1 } });
s2.addText([
  { text: "Henderson-Hasselbalch:  ", options: { bold: true, color: C.accent } },
  { text: "pH = 6.1 + log([HCO₃⁻] / 0.03 × PaCO₂)     ", options: { color: C.white } },
  { text: "Normal ratio HCO₃⁻ : PaCO₂ = 20:1  →  pH 7.4", options: { color: C.yellow } },
], { x: 0.4, y: 4.7, w: 9.2, h: 0.6, fontSize: 12, fontFace: "Calibri", align: "center", valign: "middle" });


// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 3: 5-Step ABG Interpretation Method
// ─────────────────────────────────────────────────────────────────────────────
let s3 = pres.addSlide();
s3.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.darkBlue } });
s3.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.75, fill: { color: C.accent } });
s3.addText("5-STEP ABG INTERPRETATION METHOD", {
  x: 0.3, y: 0.05, w: 9.4, h: 0.65, fontSize: 18, bold: true, color: C.darkBlue,
  fontFace: "Calibri", valign: "middle",
});

const steps = [
  {
    num: "1", title: "Assess pH",
    desc: "pH < 7.35  →  Acidemia\npH 7.35–7.45  →  Normal (may still have disorder)\npH > 7.45  →  Alkalemia",
  },
  {
    num: "2", title: "Identify Primary Disorder",
    desc: "PaCO₂ ↑ + pH ↓  →  Respiratory Acidosis\nPaCO₂ ↓ + pH ↑  →  Respiratory Alkalosis\nHCO₃⁻ ↓ + pH ↓  →  Metabolic Acidosis\nHCO₃⁻ ↑ + pH ↑  →  Metabolic Alkalosis",
  },
  {
    num: "3", title: "Check Compensation",
    desc: "Is the secondary parameter moving in the expected\ndirection? (See compensation formulas on next slide)\nIf not → mixed disorder present",
  },
  {
    num: "4", title: "Calculate Anion Gap (if met. acidosis)",
    desc: "AG = Na⁺ – (Cl⁻ + HCO₃⁻)\nNormal: 9–15 mEq/L\nHigh AG (>15): MUDPILES | Normal AG: HARDUPS",
  },
  {
    num: "5", title: "Assess Oxygenation",
    desc: "PaO₂ 80–100 mmHg = Normal\nA-a gradient = PAO₂ – PaO₂  (normal < 15 mmHg)\nLow PaO₂ + high A-a → intrinsic lung disease",
  },
];

steps.forEach((st, i) => {
  const y = 0.9 + i * 0.9;
  // number circle
  s3.addShape(pres.ShapeType.ellipse, { x: 0.25, y: y + 0.05, w: 0.65, h: 0.65, fill: { color: C.accent } });
  s3.addText(st.num, { x: 0.25, y: y + 0.05, w: 0.65, h: 0.65, fontSize: 18, bold: true, color: C.darkBlue, align: "center", valign: "middle", fontFace: "Calibri" });
  // step content box
  s3.addShape(pres.ShapeType.rect, { x: 1.05, y, w: 8.7, h: 0.78, fill: { color: C.midBlue }, line: { color: C.accent, width: 0.75 } });
  s3.addText([
    { text: "STEP " + st.num + " — " + st.title + ":  ", options: { bold: true, color: C.yellow } },
    { text: st.desc, options: { color: C.white } },
  ], { x: 1.15, y: y + 0.03, w: 8.5, h: 0.72, fontSize: 10.5, fontFace: "Calibri", valign: "middle" });
});


// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 4: Compensation Formulas
// ─────────────────────────────────────────────────────────────────────────────
let s4 = pres.addSlide();
s4.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.lightGray } });
s4.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.75, fill: { color: C.midBlue } });
s4.addText("COMPENSATION FORMULAS (Expected Values)", {
  x: 0.3, y: 0.05, w: 9.4, h: 0.65, fontSize: 18, bold: true, color: C.accent,
  fontFace: "Calibri", valign: "middle",
});

const compRows = [
  { disorder: "Metabolic Acidosis", formula: "Expected PaCO₂ = (1.5 × HCO₃⁻) + 8 ± 2  [Winter's Formula]", note: "PaCO₂ > expected → concomitant resp. acidosis\nPaCO₂ < expected → concomitant resp. alkalosis", type: "acid" },
  { disorder: "Metabolic Alkalosis", formula: "Expected PaCO₂ = (0.7 × HCO₃⁻) + 21 ± 2", note: "Compensation limited — PaCO₂ rarely exceeds 55 mmHg", type: "alk" },
  { disorder: "Respiratory Acidosis (Acute)", formula: "Expected HCO₃⁻ = 24 + 0.1 × (PaCO₂ – 40)  [↑ 1 per 10 CO₂]", note: "Acute = minutes-hours; kidney not yet compensated", type: "acid" },
  { disorder: "Respiratory Acidosis (Chronic)", formula: "Expected HCO₃⁻ = 24 + 0.35 × (PaCO₂ – 40)  [↑ 3.5 per 10 CO₂]", note: "Chronic = days; full renal compensation", type: "acid" },
  { disorder: "Respiratory Alkalosis (Acute)", formula: "Expected HCO₃⁻ = 24 – 0.2 × (40 – PaCO₂)  [↓ 2 per 10 CO₂]", note: "Acute hyperventilation (anxiety, pain, altitude)", type: "alk" },
  { disorder: "Respiratory Alkalosis (Chronic)", formula: "Expected HCO₃⁻ = 24 – 0.5 × (40 – PaCO₂)  [↓ 5 per 10 CO₂]", note: "Chronic: pregnancy, high altitude acclimatization", type: "alk" },
];

compRows.forEach((row, i) => {
  const y = 0.9 + i * 0.77;
  const bgColor = row.type === "acid" ? "FFF0EE" : "EBF5FF";
  const labelColor = row.type === "acid" ? C.accentWarm : C.accentAlk;
  s4.addShape(pres.ShapeType.rect, { x: 0.2, y, w: 9.6, h: 0.68, fill: { color: bgColor }, line: { color: row.type === "acid" ? C.accentWarm : C.accentAlk, width: 1 } });
  s4.addText([
    { text: row.disorder + "  |  ", options: { bold: true, color: labelColor } },
    { text: row.formula + "\n", options: { bold: false, color: C.textDark } },
    { text: row.note, options: { italic: true, color: C.textMid, fontSize: 9 } },
  ], { x: 0.35, y: y + 0.04, w: 9.3, h: 0.6, fontSize: 10.5, fontFace: "Calibri", valign: "top" });
});


// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 5: Anion Gap + MUDPILES / HARDUPS
// ─────────────────────────────────────────────────────────────────────────────
let s5 = pres.addSlide();
s5.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.darkBlue } });
s5.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.75, fill: { color: C.accentWarm } });
s5.addText("METABOLIC ACIDOSIS — ANION GAP ANALYSIS", {
  x: 0.3, y: 0.05, w: 9.4, h: 0.65, fontSize: 18, bold: true, color: C.white,
  fontFace: "Calibri", valign: "middle",
});

// AG formula box
s5.addShape(pres.ShapeType.rect, { x: 0.3, y: 0.85, w: 9.4, h: 0.65, fill: { color: C.midBlue }, line: { color: C.yellow, width: 1.5 } });
s5.addText([
  { text: "Anion Gap = Na⁺ – (Cl⁻ + HCO₃⁻)   ", options: { bold: true, color: C.yellow } },
  { text: "Normal: 9–15 mEq/L   ", options: { color: C.white } },
  { text: "Corrected AG = AG + 2.5 × (4 – albumin g/dL)", options: { color: "A0BACE", fontSize: 10 } },
], { x: 0.4, y: 0.88, w: 9.2, h: 0.55, fontSize: 12, fontFace: "Calibri", align: "center", valign: "middle" });

// Two columns: MUDPILES vs HARDUPS
// MUDPILES
s5.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.6, w: 4.5, h: 3.75, fill: { color: C.midBlue }, line: { color: C.accentWarm, width: 1.5 } });
s5.addShape(pres.ShapeType.rect, { x: 0.3, y: 1.6, w: 4.5, h: 0.45, fill: { color: C.accentWarm } });
s5.addText("HIGH ANION GAP — MUDPILES", { x: 0.3, y: 1.6, w: 4.5, h: 0.45, fontSize: 12, bold: true, color: C.white, align: "center", valign: "middle", fontFace: "Calibri" });

const mudpiles = [
  ["M", "Methanol / Metformin / Muscle injury"],
  ["U", "Uremia (renal failure)"],
  ["D", "DKA, alcoholic ketoacidosis, starvation"],
  ["P", "Propylene glycol / Paraldehyde"],
  ["I", "Isoniazid / Iron poisoning"],
  ["L", "Lactic acidosis (type A/B)"],
  ["E", "Ethylene glycol / Ethanol"],
  ["S", "Salicylates / Short gut syndrome"],
];
mudpiles.forEach(([letter, desc], i) => {
  const y = 2.13 + i * 0.38;
  s5.addShape(pres.ShapeType.rect, { x: 0.45, y, w: 0.38, h: 0.3, fill: { color: C.accentWarm } });
  s5.addText(letter, { x: 0.45, y, w: 0.38, h: 0.3, fontSize: 12, bold: true, color: C.white, align: "center", valign: "middle", fontFace: "Calibri" });
  s5.addText(desc, { x: 0.9, y, w: 3.8, h: 0.3, fontSize: 10, color: C.white, valign: "middle", fontFace: "Calibri" });
});

// HARDUPS (Normal AG)
s5.addShape(pres.ShapeType.rect, { x: 5.2, y: 1.6, w: 4.5, h: 3.75, fill: { color: C.midBlue }, line: { color: C.accentAlk, width: 1.5 } });
s5.addShape(pres.ShapeType.rect, { x: 5.2, y: 1.6, w: 4.5, h: 0.45, fill: { color: "1565C0" } });
s5.addText("NORMAL ANION GAP — HARDUPS", { x: 5.2, y: 1.6, w: 4.5, h: 0.45, fontSize: 12, bold: true, color: C.white, align: "center", valign: "middle", fontFace: "Calibri" });

const hardups = [
  ["H", "Hyperalimentation / Hyperchloremia"],
  ["A", "Addison's disease (adrenal insufficiency)"],
  ["R", "Renal tubular acidosis (RTA types 1,2,4)"],
  ["D", "Diarrhea (GI HCO₃⁻ loss)"],
  ["U", "Ureteral diversion (ileal conduit)"],
  ["P", "Pancreatic fistula / Post-transplant"],
  ["S", "Saline infusion (hyperchloremic)"],
];
hardups.forEach(([letter, desc], i) => {
  const y = 2.13 + i * 0.43;
  s5.addShape(pres.ShapeType.rect, { x: 5.35, y, w: 0.38, h: 0.32, fill: { color: "1565C0" } });
  s5.addText(letter, { x: 5.35, y, w: 0.38, h: 0.32, fontSize: 12, bold: true, color: C.white, align: "center", valign: "middle", fontFace: "Calibri" });
  s5.addText(desc, { x: 5.8, y, w: 3.8, h: 0.32, fontSize: 10, color: C.white, valign: "middle", fontFace: "Calibri" });
});


// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 6: Causes of the 4 Disorders
// ─────────────────────────────────────────────────────────────────────────────
let s6 = pres.addSlide();
s6.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.lightGray } });
s6.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.75, fill: { color: C.midBlue } });
s6.addText("CAUSES OF THE FOUR ACID-BASE DISORDERS", {
  x: 0.3, y: 0.05, w: 9.4, h: 0.65, fontSize: 18, bold: true, color: C.accent,
  fontFace: "Calibri", valign: "middle",
});

const quadrants = [
  {
    title: "METABOLIC ACIDOSIS", color: C.accentWarm, textColor: C.white, x: 0.2, y: 0.85,
    causes: ["↑ acid production: DKA, lactic acidosis, toxins", "↓ acid excretion: renal failure, RTA", "↑ HCO₃⁻ loss: diarrhea, GI fistula, RTA type 2"],
  },
  {
    title: "METABOLIC ALKALOSIS", color: "1565C0", textColor: C.white, x: 5.1, y: 0.85,
    causes: ["H⁺ loss: vomiting, NG suction, diuretics", "HCO₃⁻ retention: antacid excess, milk-alkali", "Volume contraction (↑ aldosterone, Cl⁻ responsive)"],
  },
  {
    title: "RESPIRATORY ACIDOSIS", color: "7B341E", textColor: C.white, x: 0.2, y: 3.15,
    causes: ["Central hypoventilation: opioids, CNS injury, obesity-hypoventilation", "Neuromuscular: GBS, MG, ALS", "Obstructive: COPD, severe asthma", "Restrictive/mechanical: PTX, flail chest"],
  },
  {
    title: "RESPIRATORY ALKALOSIS", color: "0D5C8C", textColor: C.white, x: 5.1, y: 3.15,
    causes: ["Hypoxemia (altitude, PE, pneumonia)", "Anxiety / pain / hyperventilation", "Pregnancy (progesterone effect)", "Salicylate toxicity (early), hepatic failure, sepsis"],
  },
];

quadrants.forEach((q) => {
  s6.addShape(pres.ShapeType.rect, { x: q.x, y: q.y, w: 4.7, h: 2.15, fill: { color: q.color }, line: { color: C.white, width: 0 } });
  s6.addText(q.title, { x: q.x + 0.1, y: q.y + 0.05, w: 4.5, h: 0.38, fontSize: 12, bold: true, color: C.white, fontFace: "Calibri", charSpacing: 1 });
  q.causes.forEach((c, i) => {
    s6.addText("• " + c, { x: q.x + 0.15, y: q.y + 0.48 + i * 0.5, w: 4.4, h: 0.45, fontSize: 10, color: C.white, fontFace: "Calibri" });
  });
});


// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 7: Worked Clinical Examples
// ─────────────────────────────────────────────────────────────────────────────
let s7 = pres.addSlide();
s7.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: "0B1E33" } });
s7.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.75, fill: { color: C.yellow } });
s7.addText("WORKED CLINICAL EXAMPLES", {
  x: 0.3, y: 0.05, w: 9.4, h: 0.65, fontSize: 18, bold: true, color: C.darkBlue,
  fontFace: "Calibri", valign: "middle",
});

const cases = [
  {
    label: "Case 1: DKA", bg: "1A2F1F",
    abg: "pH 7.18  |  PaCO₂ 22 mmHg  |  HCO₃⁻ 8 mEq/L  |  Na 138  |  Cl 100",
    ans: [
      "pH 7.18 → Acidemia",
      "HCO₃⁻ ↓ → Primary Metabolic Acidosis",
      "Winter's: PaCO₂ expected = (1.5×8)+8±2 = 18–22 ✓ Appropriate compensation",
      "AG = 138–(100+8) = 30 → High AG Metabolic Acidosis",
      "Diagnosis: High AG Metabolic Acidosis (DKA) + appropriate respiratory compensation",
    ],
    color: C.green,
  },
  {
    label: "Case 2: COPD Exacerbation", bg: "2A1515",
    abg: "pH 7.28  |  PaCO₂ 70 mmHg  |  HCO₃⁻ 32 mEq/L",
    ans: [
      "pH 7.28 → Acidemia",
      "PaCO₂ ↑ → Primary Respiratory Acidosis",
      "HCO₃⁻ ↑ 32 → Chronic compensation: expected HCO₃⁻ = 24 + 0.35×(70–40) = 34.5 ≈ ✓",
      "Diagnosis: Chronic Respiratory Acidosis (COPD) with appropriate metabolic compensation",
    ],
    color: C.accentWarm,
  },
  {
    label: "Case 3: Vomiting + Hypokalemia", bg: "0D1E33",
    abg: "pH 7.52  |  PaCO₂ 48 mmHg  |  HCO₃⁻ 38 mEq/L",
    ans: [
      "pH 7.52 → Alkalemia",
      "HCO₃⁻ ↑ → Primary Metabolic Alkalosis",
      "Expected PaCO₂ = (0.7×38)+21±2 = 47–51 ✓ Appropriate compensation",
      "Diagnosis: Metabolic Alkalosis from vomiting (H⁺/Cl⁻ loss) + appropriate hypoventilation",
    ],
    color: C.accentAlk,
  },
];

cases.forEach((c, i) => {
  const y = 0.88 + i * 1.55;
  s7.addShape(pres.ShapeType.rect, { x: 0.2, y, w: 9.6, h: 1.42, fill: { color: c.bg }, line: { color: c.color, width: 1.5 } });
  s7.addText(c.label, { x: 0.3, y: y + 0.04, w: 3, h: 0.32, fontSize: 11, bold: true, color: c.color, fontFace: "Calibri" });
  s7.addText("ABG: " + c.abg, { x: 0.3, y: y + 0.35, w: 9.3, h: 0.25, fontSize: 10, color: C.yellow, fontFace: "Calibri", italic: true });
  s7.addText(c.ans.map((a, j) => (j + 1) + ". " + a).join("   "), {
    x: 0.35, y: y + 0.63, w: 9.25, h: 0.7, fontSize: 9.5, color: C.white, fontFace: "Calibri", valign: "top",
  });
});


// ─────────────────────────────────────────────────────────────────────────────
// SLIDE 8: Quick Reference Summary Card
// ─────────────────────────────────────────────────────────────────────────────
let s8 = pres.addSlide();
s8.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.lightGray } });
s8.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 10, h: 0.75, fill: { color: C.darkBlue } });
s8.addText("QUICK REFERENCE SUMMARY CARD", {
  x: 0.3, y: 0.05, w: 9.4, h: 0.65, fontSize: 18, bold: true, color: C.accent,
  fontFace: "Calibri", valign: "middle",
});

// Table
const tHeaders = ["Disorder", "pH", "PaCO₂", "HCO₃⁻", "Compensation", "Key Causes"];
const tRows = [
  ["Met. Acidosis",   "↓ <7.35", "↓ (comp.)", "↓ PRIMARY", "↓ PaCO₂ (Winter's)", "DKA, lactic acidosis, renal failure, diarrhea"],
  ["Met. Alkalosis",  "↑ >7.45", "↑ (comp.)", "↑ PRIMARY", "↑ PaCO₂ (hypovent.)", "Vomiting, diuretics, Conn syndrome"],
  ["Resp. Acidosis",  "↓ <7.35", "↑ PRIMARY", "↑ (comp.)", "↑ HCO₃⁻ (renal)",    "COPD, opioids, neuromuscular disease"],
  ["Resp. Alkalosis", "↑ >7.45", "↓ PRIMARY", "↓ (comp.)", "↓ HCO₃⁻ (renal)",    "Anxiety, pregnancy, PE, altitude, sepsis"],
];

// header row
const colW = [1.6, 0.75, 0.9, 0.85, 1.85, 3.05];
const colX = [0.2, 1.8, 2.55, 3.45, 4.3, 6.15];
tHeaders.forEach((h, j) => {
  s8.addShape(pres.ShapeType.rect, { x: colX[j], y: 0.85, w: colW[j], h: 0.38, fill: { color: C.midBlue }, line: { color: C.white, width: 0.5 } });
  s8.addText(h, { x: colX[j], y: 0.85, w: colW[j], h: 0.38, fontSize: 9.5, bold: true, color: C.white, align: "center", valign: "middle", fontFace: "Calibri" });
});

const rowColors = ["FFF0EE", "EBF5FF", "FFF0EE", "EBF5FF"];
tRows.forEach((row, i) => {
  row.forEach((cell, j) => {
    s8.addShape(pres.ShapeType.rect, { x: colX[j], y: 1.23 + i * 0.48, w: colW[j], h: 0.46, fill: { color: rowColors[i] }, line: { color: "CCCCCC", width: 0.5 } });
    const isBold = j === 0;
    const cellColor = (cell.includes("↓") && (j === 1 || j === 2 || j === 3)) ? C.accentWarm : (cell.includes("↑") && (j === 1 || j === 2 || j === 3)) ? "1565C0" : C.textDark;
    s8.addText(cell, { x: colX[j] + 0.05, y: 1.25 + i * 0.48, w: colW[j] - 0.1, h: 0.42, fontSize: 9, bold: isBold, color: cellColor, fontFace: "Calibri", valign: "middle", align: j === 0 ? "left" : "center", wrap: true });
  });
});

// Oxygenation section
s8.addShape(pres.ShapeType.rect, { x: 0.2, y: 3.22, w: 9.6, h: 0.55, fill: { color: C.midBlue }, line: { color: C.accent, width: 1 } });
s8.addText([
  { text: "OXYGENATION:  ", options: { bold: true, color: C.yellow } },
  { text: "PAO₂ = (FiO₂ × [Patm – PH₂O]) – (PaCO₂/0.8)   |   ", options: { color: C.white } },
  { text: "A-a gradient = PAO₂ – PaO₂   Normal: < 15 mmHg (↑ with age: age/4 + 4)", options: { color: "A0BACE" } },
], { x: 0.3, y: 3.25, w: 9.4, h: 0.46, fontSize: 10, fontFace: "Calibri", valign: "middle" });

// Delta-delta box
s8.addShape(pres.ShapeType.rect, { x: 0.2, y: 3.85, w: 9.6, h: 0.9, fill: { color: "FFFDE7" }, line: { color: C.yellow, width: 1.5 } });
s8.addText([
  { text: "DELTA-DELTA RATIO (AG gap / HCO₃ gap):  ", options: { bold: true, color: C.textDark } },
  { text: "Δ-Δ = (AG – 12) / (24 – HCO₃⁻)\n", options: { color: C.textDark } },
  { text: "< 1 = Mixed high AG + normal AG metabolic acidosis   |   ", options: { color: C.textMid, fontSize: 9 } },
  { text: "1–2 = Pure high AG metabolic acidosis   |   ", options: { color: C.textMid, fontSize: 9 } },
  { text: "> 2 = High AG metabolic acidosis + metabolic alkalosis", options: { color: C.textMid, fontSize: 9 } },
], { x: 0.35, y: 3.88, w: 9.3, h: 0.84, fontSize: 10.5, fontFace: "Calibri", valign: "top" });

// VBG vs ABG note
s8.addShape(pres.ShapeType.rect, { x: 0.2, y: 4.83, w: 9.6, h: 0.62, fill: { color: C.darkBlue } });
s8.addText([
  { text: "VBG vs ABG:  ", options: { bold: true, color: C.accent } },
  { text: "VBG pH ≈ ABG pH – 0.03   |   VBG PvCO₂ ≈ PaCO₂ + 5–9 mmHg   |   PvCO₂ < 45 mmHg rules out hypercapnia with ~100% NPV   |   PvO₂ does NOT correlate with PaO₂", options: { color: C.white } },
], { x: 0.35, y: 4.86, w: 9.3, h: 0.55, fontSize: 9.5, fontFace: "Calibri", valign: "middle" });

// Save
pres.writeFile({ fileName: "/home/daytona/workspace/abg-guide/ABG_Clinical_Practice_Guide.pptx" })
  .then(() => console.log("PPTX created successfully"))
  .catch(err => console.error("Error:", err));
Running Command

cd /home/daytona/workspace/abg-guide && node abg_guide.js

Running Command

ls -lh /home/daytona/workspace/abg-guide/

Your ABG Clinical Practice Guide is ready:

ABG Clinical Practice Guide

Presentation · PPTX


What's Inside (8 Slides)

SlideContent
1 - TitleCover slide with sources cited
2 - Normal ValuesReference cards for pH, PaCO₂, HCO₃⁻, PaO₂, SaO₂, Base Excess + Henderson-Hasselbalch equation
3 - 5-Step MethodSystematic step-by-step ABG interpretation framework
4 - Compensation FormulasAll 6 formulas: Winter's, metabolic alkalosis, acute/chronic resp. acidosis/alkalosis
5 - Anion Gap AnalysisAG formula + full MUDPILES vs HARDUPS mnemonics
6 - CausesAll 4 disorders in a color-coded quad layout with key etiologies
7 - Worked Cases3 clinical examples (DKA, COPD exacerbation, vomiting) with step-by-step analysis
8 - Quick ReferenceMaster summary table + A-a gradient formula + Delta-Delta ratio + VBG vs ABG comparison
Sources: Rosen's Emergency Medicine 10e, Frameworks for Internal Medicine, Ganong's Medical Physiology 26e, Basic Medical Biochemistry 6e, Current Surgical Therapy 14e
This is a shared conversation. Sign in to Orris to start your own chat.