What is the diagnosis
pericardial effusion water bottle sign chest X-ray
| Finding | Significance |
|---|---|
| Globally enlarged, symmetric cardiac silhouette | Fluid accumulation in pericardial sac |
| Smooth, sharply demarcated borders | Distinguishes it from cardiomegaly due to chamber dilation |
| Hilar vessels obscured | Fluid extends to obscure normal hilar contours |
| Relatively clear lung fields | Unlike CHF, no pulmonary edema — fluid is outside the heart |
| Cardiothoracic ratio > 0.5 | Often dramatically increased |
Goldman-Cecil Medicine: "The posteroanterior radiograph shows the water-bottle sign; the hilar vessels are obscured" in massive pericardial effusion.

Generate me usmle style questions about “magnesium trap” / “the dual rule of Mg and PTH”
The Concept to Know:
- Mild hypomagnesemia → stimulates PTH (like hypocalcemia does)
- Severe/chronic hypomagnesemia → inhibits PTH secretion AND causes end-organ PTH resistance
- Hypocalcemia from severe hypomagnesemia cannot be corrected without first repleting magnesium
| Mg²⁺ Status | PTH Secretion | End-Organ PTH Response | Net Effect on Ca²⁺ |
|---|---|---|---|
| Mild ↓ Mg²⁺ | ↑ (stimulated) | Normal | Ca²⁺ maintained or ↑ |
| Severe ↓ Mg²⁺ (chronic) | ↓↓ (inhibited) | Resistant (↓ cAMP response) | Ca²⁺ ↓↓ — refractory to Ca²⁺ supplementation |
| ↑ Mg²⁺ (hypermagnesemia) | ↓ (inhibited) | Normal | Ca²⁺ ↓ |
Create a PPTX presentation on electrolyte disturbances and Mg-PTH interactions
ls /home/daytona/workspace/ 2>/dev/null && echo "---" && ls /home/daytona/skills…
mkdir -p /home/daytona/workspace/electrolytes-pptx
~/electrolytes-pptx/build.js
const pptxgen = require("pptxgenjs");
const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Electrolyte Disturbances & Mg–PTH Interactions";
pres.author = "Orris Medical";
// ─── COLOR PALETTE ───────────────────────────────────────────────
const C = {
navy: "0B1F3A", // dominant background
teal: "0D9488", // accent / headers
tealLt: "14B8A6", // lighter teal
amber: "F59E0B", // warning / highlight
red: "EF4444", // danger / low values
green: "22C55E", // normal / safe
white: "FFFFFF",
offWht: "E2E8F0",
gray: "94A3B8",
darkCard:"112240", // slightly lighter than navy for cards
midCard: "1E3A5F",
};
// ─── HELPERS ─────────────────────────────────────────────────────
function addSlide(bgColor) {
const s = pres.addSlide();
s.background = { color: bgColor || C.navy };
return s;
}
function sectionHeader(slide, title, subtitle) {
slide.addShape(pres.ShapeType.rect, {
x: 0, y: 0, w: 0.35, h: 5.625, fill: { color: C.teal }
});
slide.addText(title, {
x: 0.6, y: 1.8, w: 8.8, h: 1,
fontSize: 40, bold: true, color: C.white, fontFace: "Calibri"
});
if (subtitle) {
slide.addText(subtitle, {
x: 0.6, y: 2.9, w: 8.8, h: 0.6,
fontSize: 20, color: C.tealLt, fontFace: "Calibri", italic: true
});
}
}
function slideTitle(slide, title) {
slide.addShape(pres.ShapeType.rect, {
x: 0, y: 0, w: 10, h: 0.75, fill: { color: C.teal }
});
slide.addText(title, {
x: 0.3, y: 0, w: 9.4, h: 0.75, margin: 0,
fontSize: 22, bold: true, color: C.white, valign: "middle", fontFace: "Calibri"
});
}
function card(slide, x, y, w, h, color) {
slide.addShape(pres.ShapeType.roundRect, {
x, y, w, h,
fill: { color: color || C.darkCard },
line: { color: C.teal, width: 1.5 },
rectRadius: 0.12
});
}
function footer(slide, txt) {
slide.addText(txt || "Orris Medical | Electrolyte Disturbances", {
x: 0, y: 5.3, w: 10, h: 0.32,
fontSize: 9, color: C.gray, align: "center", fontFace: "Calibri"
});
}
// ══════════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE
// ══════════════════════════════════════════════════════════════════
{
const s = addSlide(C.navy);
// decorative blocks
s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:1.4, fill:{ color:C.teal } });
s.addShape(pres.ShapeType.rect, { x:0, y:4.9, w:10, h:0.725, fill:{ color:C.darkCard } });
s.addShape(pres.ShapeType.rect, { x:0, y:1.4, w:0.5, h:3.5, fill:{ color:C.amber } });
s.addText("ELECTROLYTE DISTURBANCES", {
x:0.7, y:0.08, w:9, h:0.65,
fontSize:30, bold:true, color:C.white, charSpacing:4, fontFace:"Calibri"
});
s.addText("& Mg–PTH Interactions", {
x:0.7, y:0.72, w:9, h:0.55,
fontSize:22, color:C.offWht, fontFace:"Calibri", italic:true
});
s.addText("A Clinical & Physiology Review", {
x:0.8, y:1.9, w:8.5, h:0.6,
fontSize:26, bold:true, color:C.white, fontFace:"Calibri"
});
s.addText([
{ text:"Topics Covered:", options:{ bold:true, breakLine:true, color:C.tealLt } },
{ text:"• Hypo/Hypermagnesemia", options:{ breakLine:true, color:C.offWht } },
{ text:"• Hypo/Hypercalcemia", options:{ breakLine:true, color:C.offWht } },
{ text:"• The Dual Rule of Mg & PTH", options:{ breakLine:true, color:C.offWht } },
{ text:"• Hypo/Hyperkalemia & Mg link", options:{ breakLine:true, color:C.offWht } },
{ text:"• Clinical Scenarios & Pitfalls", options:{ color:C.offWht } },
], {
x:0.8, y:2.6, w:8, h:2.2,
fontSize:16, fontFace:"Calibri", lineSpacingMultiple:1.3
});
s.addText("Sources: Harrison's 22E · Costanzo Physiology 7E · Brenner & Rector · Morgan & Mikhail", {
x:0, y:4.92, w:10, h:0.35,
fontSize:9, color:C.gray, align:"center", fontFace:"Calibri"
});
}
// ══════════════════════════════════════════════════════════════════
// SLIDE 2 — OVERVIEW / OUTLINE
// ══════════════════════════════════════════════════════════════════
{
const s = addSlide(C.navy);
slideTitle(s, "Overview — Key Electrolyte Relationships");
const boxes = [
{ label:"Mg²⁺ & PTH", sub:"The Dual Rule", color:C.teal, x:0.3, y:1.0 },
{ label:"Mg²⁺ & K⁺", sub:"Refractory hypokalemia", color:C.amber, x:3.5, y:1.0 },
{ label:"Mg²⁺ & Ca²⁺", sub:"Hypocalcemia trap", color:C.red, x:6.7, y:1.0 },
{ label:"Hypomagnesemia", sub:"Causes & consequences", color:C.midCard, x:0.3, y:3.2 },
{ label:"Hypermagnesemia", sub:"Toxicity & treatment", color:C.midCard, x:3.5, y:3.2 },
{ label:"Clinical Pitfalls", sub:"Scenarios & corrections", color:C.midCard, x:6.7, y:3.2 },
];
boxes.forEach(b => {
s.addShape(pres.ShapeType.roundRect, {
x:b.x, y:b.y, w:2.9, h:1.85,
fill:{ color:b.color }, line:{ color:C.tealLt, width:1.2 }, rectRadius:0.14
});
s.addText(b.label, {
x:b.x+0.1, y:b.y+0.3, w:2.7, h:0.7,
fontSize:18, bold:true, color:C.white, align:"center", fontFace:"Calibri"
});
s.addText(b.sub, {
x:b.x+0.1, y:b.y+1.0, w:2.7, h:0.5,
fontSize:13, color:C.offWht, align:"center", fontFace:"Calibri", italic:true
});
});
footer(s);
}
// ══════════════════════════════════════════════════════════════════
// SLIDE 3 — SECTION BREAK: MAGNESIUM
// ══════════════════════════════════════════════════════════════════
{
const s = addSlide(C.teal);
s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{ color:C.teal } });
s.addText("SECTION 1", {
x:0.6, y:1.3, w:8, h:0.5,
fontSize:14, color:C.white, charSpacing:6, fontFace:"Calibri", bold:true
});
s.addText("Magnesium", {
x:0.6, y:1.8, w:8, h:1.2,
fontSize:56, bold:true, color:C.white, fontFace:"Calibri"
});
s.addText("Normal: 1.7–2.4 mg/dL | 0.85–1.2 mmol/L | 1.7–2.3 mEq/L", {
x:0.6, y:3.1, w:8.5, h:0.5,
fontSize:16, color:C.offWht, fontFace:"Calibri", italic:true
});
s.addText("60% bone • 20% muscle • <1% extracellular", {
x:0.6, y:3.7, w:8, h:0.4,
fontSize:14, color:C.white, fontFace:"Calibri"
});
}
// ══════════════════════════════════════════════════════════════════
// SLIDE 4 — HYPOMAGNESEMIA: CAUSES
// ══════════════════════════════════════════════════════════════════
{
const s = addSlide(C.navy);
slideTitle(s, "Hypomagnesemia — Causes (< 1.7 mg/dL)");
// 3 columns
const cols = [
{
title: "↓ GI Absorption",
color: C.teal,
items: ["Malabsorption syndromes", "Prolonged diarrhea", "Short bowel syndrome", "Proton pump inhibitors (chronic)", "Nasogastric suction"]
},
{
title: "↑ Renal Losses",
color: C.amber,
items: ["Loop & thiazide diuretics", "Alcoholism", "Cisplatin / aminoglycosides", "Osmotic diuresis (DM)", "CaSR activating mutations"]
},
{
title: "Redistribution / Other",
color: C.red,
items: ["Hungry bone syndrome", "Refeeding syndrome", "Pancreatitis", "Hypoparathyroidism (post-op)", "Excessive sweating"]
}
];
cols.forEach((col, i) => {
const x = 0.2 + i * 3.3;
s.addShape(pres.ShapeType.roundRect, {
x, y:0.85, w:3.15, h:4.55,
fill:{ color:C.darkCard }, line:{ color:col.color, width:2 }, rectRadius:0.12
});
s.addShape(pres.ShapeType.roundRect, {
x, y:0.85, w:3.15, h:0.55,
fill:{ color:col.color }, line:{ color:col.color, width:2 }, rectRadius:0.12
});
s.addText(col.title, {
x:x+0.08, y:0.88, w:3.0, h:0.48,
fontSize:14, bold:true, color:C.white, align:"center", valign:"middle", fontFace:"Calibri"
});
const bullets = col.items.map((t, idx) => ({
text: t,
options: { bullet:{ code:"2022" }, breakLine: idx < col.items.length-1, color:C.offWht }
}));
s.addText(bullets, {
x:x+0.18, y:1.5, w:2.85, h:3.7,
fontSize:13, fontFace:"Calibri", lineSpacingMultiple:1.4
});
});
footer(s);
}
// ══════════════════════════════════════════════════════════════════
// SLIDE 5 — HYPOMAGNESEMIA: CLINICAL FEATURES
// ══════════════════════════════════════════════════════════════════
{
const s = addSlide(C.navy);
slideTitle(s, "Hypomagnesemia — Clinical Features");
// Large left panel
card(s, 0.2, 0.85, 4.6, 4.5, C.darkCard);
s.addText("Neuromuscular", {
x:0.35, y:0.92, w:4.2, h:0.45,
fontSize:15, bold:true, color:C.tealLt, fontFace:"Calibri"
});
s.addText([
{ text:"• Tetany, positive Chvostek/Trousseau", options:{ breakLine:true } },
{ text:"• Muscle cramps, weakness, fasciculations", options:{ breakLine:true } },
{ text:"• Seizures, hyperreflexia", options:{ breakLine:true } },
{ text:"• Ataxia, vertigo, nystagmus", options:{ breakLine:true } },
{ text:"• Depression, irritability, psychosis", options:{ breakLine:true } },
], {
x:0.35, y:1.4, w:4.3, h:1.7,
fontSize:13, color:C.offWht, fontFace:"Calibri", lineSpacingMultiple:1.35
});
s.addText("Cardiac", {
x:0.35, y:3.15, w:4.2, h:0.42,
fontSize:15, bold:true, color:C.amber, fontFace:"Calibri"
});
s.addText([
{ text:"• Prolonged PR / QT, T-wave flattening", options:{ breakLine:true } },
{ text:"• Ventricular arrhythmias, Torsades de Pointes", options:{ breakLine:true } },
{ text:"• ↑ Sensitivity to digoxin toxicity", options:{ breakLine:true } },
{ text:"• Sinus tachycardia, SVT", options:{} },
], {
x:0.35, y:3.6, w:4.3, h:1.55,
fontSize:13, color:C.offWht, fontFace:"Calibri", lineSpacingMultiple:1.35
});
// Right: electrolyte consequences
card(s, 5.05, 0.85, 4.7, 4.5, C.darkCard);
s.addText("Associated Electrolyte Disorders", {
x:5.2, y:0.92, w:4.4, h:0.45,
fontSize:15, bold:true, color:C.red, fontFace:"Calibri"
});
const pills = [
{ label:"Hypocalcemia", note:"↓ PTH secretion + PTH resistance", color:C.red },
{ label:"Hypokalemia", note:"ROMK channel disinhibition → K⁺ wasting", color:C.amber },
{ label:"Hypophosphatemia", note:"Often co-exists; worsens after Mg repletion", color:C.teal },
];
pills.forEach((p, i) => {
const py = 1.5 + i * 1.25;
s.addShape(pres.ShapeType.roundRect, {
x:5.15, y:py, w:4.5, h:1.1,
fill:{ color:p.color + "33" }, line:{ color:p.color, width:1.5 }, rectRadius:0.1
});
s.addText(p.label, {
x:5.28, y:py+0.08, w:4.2, h:0.4,
fontSize:15, bold:true, color:C.white, fontFace:"Calibri"
});
s.addText(p.note, {
x:5.28, y:py+0.52, w:4.2, h:0.45,
fontSize:12, color:C.offWht, fontFace:"Calibri", italic:true
});
});
s.addText("⚠ Both hypokalemia & hypocalcemia may be REFRACTORY until Mg is corrected", {
x:5.15, y:4.9, w:4.5, h:0.38,
fontSize:11.5, bold:true, color:C.amber, align:"center", fontFace:"Calibri"
});
footer(s);
}
// ══════════════════════════════════════════════════════════════════
// SLIDE 6 — THE DUAL RULE OF Mg & PTH (KEY CONCEPT)
// ══════════════════════════════════════════════════════════════════
{
const s = addSlide(C.navy);
slideTitle(s, "The Dual Rule of Mg & PTH — The Magnesium Trap");
// Central concept box
s.addShape(pres.ShapeType.roundRect, {
x:0.2, y:0.85, w:9.6, h:0.75,
fill:{ color:C.teal + "40" }, line:{ color:C.teal, width:2 }, rectRadius:0.1
});
s.addText("Mg²⁺ mirrors Ca²⁺ in controlling PTH — but with a critical paradox at severe deficiency", {
x:0.3, y:0.88, w:9.4, h:0.68,
fontSize:15, color:C.white, align:"center", fontFace:"Calibri", italic:true
});
// Three state boxes
const states = [
{
title: "Mild Hypomagnesemia",
range: "Mg²⁺ 0.8–1.7 mEq/L",
pth: "↑ PTH Secretion",
pthColor: C.green,
mechanism: "Mg²⁺ acts like Ca²⁺ on CaSR: mild deficiency stimulates PTH release — a normal compensatory response",
result: "Ca²⁺ maintained or increased",
resultColor: C.green,
cardColor: C.teal,
x: 0.2
},
{
title: "Severe Hypomagnesemia",
range: "Mg²⁺ < 0.8 mEq/L (chronic)",
pth: "↓↓ PTH Secretion",
pthColor: C.red,
mechanism: "Intracellular Mg²⁺ depletion disrupts Gs-protein/adenylyl cyclase → blocks PTH synthesis, storage & secretion",
result: "Hypocalcemia REFRACTORY to Ca²⁺ supplementation",
resultColor: C.red,
cardColor: C.red,
x: 3.45
},
{
title: "Hypermagnesemia",
range: "Mg²⁺ > 2.3 mEq/L",
pth: "↓ PTH Secretion",
pthColor: C.amber,
mechanism: "Mg²⁺ is a CaSR agonist (less potent than Ca²⁺) — hypermagnesemia activates CaSR → suppresses PTH",
result: "Hypocalcemia (mild)",
resultColor: C.amber,
cardColor: C.amber,
x: 6.7
}
];
states.forEach(st => {
card(s, st.x, 1.75, 3.15, 3.65, C.darkCard);
// top color bar
s.addShape(pres.ShapeType.roundRect, {
x:st.x, y:1.75, w:3.15, h:0.55,
fill:{ color:st.cardColor }, line:{ color:st.cardColor, width:1 }, rectRadius:0.1
});
s.addText(st.title, {
x:st.x+0.08, y:1.78, w:3.0, h:0.48,
fontSize:13, bold:true, color:C.white, align:"center", valign:"middle", fontFace:"Calibri"
});
s.addText(st.range, {
x:st.x+0.1, y:2.35, w:2.95, h:0.38,
fontSize:12, color:C.gray, align:"center", fontFace:"Calibri", italic:true
});
s.addShape(pres.ShapeType.roundRect, {
x:st.x+0.2, y:2.75, w:2.75, h:0.45,
fill:{ color:st.pthColor + "33" }, line:{ color:st.pthColor, width:1.5 }, rectRadius:0.08
});
s.addText(st.pth, {
x:st.x+0.2, y:2.78, w:2.75, h:0.38,
fontSize:15, bold:true, color:st.pthColor, align:"center", fontFace:"Calibri"
});
s.addText(st.mechanism, {
x:st.x+0.1, y:3.28, w:2.95, h:1.1,
fontSize:11.5, color:C.offWht, fontFace:"Calibri", lineSpacingMultiple:1.3
});
s.addText(st.result, {
x:st.x+0.1, y:4.44, w:2.95, h:0.42,
fontSize:11, bold:true, color:st.resultColor, align:"center", fontFace:"Calibri"
});
});
footer(s);
}
// ══════════════════════════════════════════════════════════════════
// SLIDE 7 — TWO MECHANISMS OF HYPOCALCEMIA IN SEVERE HypoMg
// ══════════════════════════════════════════════════════════════════
{
const s = addSlide(C.navy);
slideTitle(s, "Why Severe Hypomagnesemia → Refractory Hypocalcemia");
s.addText("TWO DISTINCT MECHANISMS — Both must be fixed by Mg repletion:", {
x:0.3, y:0.88, w:9.4, h:0.42,
fontSize:14, color:C.tealLt, fontFace:"Calibri", bold:true
});
// Mechanism 1
card(s, 0.2, 1.4, 4.6, 3.8, C.darkCard);
s.addShape(pres.ShapeType.roundRect, {
x:0.2, y:1.4, w:4.6, h:0.55,
fill:{ color:C.red }, line:{ color:C.red, width:1 }, rectRadius:0.1
});
s.addText("① Impaired PTH Secretion", {
x:0.3, y:1.43, w:4.4, h:0.48,
fontSize:14, bold:true, color:C.white, valign:"middle", align:"center", fontFace:"Calibri"
});
s.addText([
{ text:"Mg²⁺ is required intracellularly for Gs-protein function", options:{ breakLine:true } },
{ text:"\nWithout Mg²⁺:", options:{ bold:true, color:C.amber, breakLine:true } },
{ text:"• Gs–adenylyl cyclase coupling fails", options:{ breakLine:true } },
{ text:"• cAMP generation is impaired", options:{ breakLine:true } },
{ text:"• PTH synthesis, storage & exocytosis blocked", options:{ breakLine:true } },
{ text:"\nResult: PTH is UNDETECTABLE despite severe hypocalcemia", options:{ bold:true, color:C.red } },
], {
x:0.35, y:2.05, w:4.3, h:2.9,
fontSize:13, color:C.offWht, fontFace:"Calibri", lineSpacingMultiple:1.3
});
// Mechanism 2
card(s, 5.1, 1.4, 4.6, 3.8, C.darkCard);
s.addShape(pres.ShapeType.roundRect, {
x:5.1, y:1.4, w:4.6, h:0.55,
fill:{ color:C.amber }, line:{ color:C.amber, width:1 }, rectRadius:0.1
});
s.addText("② End-Organ PTH Resistance", {
x:5.2, y:1.43, w:4.4, h:0.48,
fontSize:14, bold:true, color:C.white, valign:"middle", align:"center", fontFace:"Calibri"
});
s.addText([
{ text:"Even if PTH is secreted or given exogenously:", options:{ breakLine:true } },
{ text:"\nBone & kidney fail to respond:", options:{ bold:true, color:C.amber, breakLine:true } },
{ text:"• ↓ Urinary phosphorus excretion", options:{ breakLine:true } },
{ text:"• ↓ Urinary cAMP response", options:{ breakLine:true } },
{ text:"• Ca²⁺ not released from bone", options:{ breakLine:true } },
{ text:"\nResult: Ca²⁺ supplementation FAILS — Mg repletion is the only cure", options:{ bold:true, color:C.amber } },
], {
x:5.25, y:2.05, w:4.3, h:2.9,
fontSize:13, color:C.offWht, fontFace:"Calibri", lineSpacingMultiple:1.3
});
// Bottom banner
s.addShape(pres.ShapeType.roundRect, {
x:0.2, y:5.25, w:9.6, h:0.28,
fill:{ color:C.teal + "30" }, line:{ color:C.teal, width:1 }, rectRadius:0.06
});
s.addText("Harrison's 22E: "PTH levels are undetectable or inappropriately low in severe hypomagnesemia despite the stimulus of severe hypocalcemia"", {
x:0.3, y:5.26, w:9.4, h:0.26,
fontSize:9, color:C.gray, align:"center", fontFace:"Calibri", italic:true
});
footer(s);
}
// ══════════════════════════════════════════════════════════════════
// SLIDE 8 — Mg–PTH VISUAL SUMMARY TABLE
// ══════════════════════════════════════════════════════════════════
{
const s = addSlide(C.navy);
slideTitle(s, "Mg²⁺ & PTH — The Dual Rule at a Glance");
const headers = ["Mg²⁺ Status", "PTH Secretion", "End-Organ Response", "Net Ca²⁺ Effect", "Clinical Action"];
const rows = [
["Mild ↓ Mg²⁺\n(0.8–1.7 mEq/L)", "↑ Stimulated", "Normal", "Ca²⁺ ↔ or ↑", "Oral Mg replacement"],
["Severe ↓ Mg²⁺\n(< 0.8 mEq/L)", "↓↓ INHIBITED", "Resistant (↓ cAMP)", "Ca²⁺ ↓↓ — Refractory", "IV Mg FIRST — then Ca²⁺"],
["↑ Mg²⁺\n(Hypermagnesemia)", "↓ Inhibited (CaSR)", "Normal", "Ca²⁺ ↓ (mild)", "Remove Mg source, Ca gluconate"],
];
const colW = [2.1, 1.9, 2.2, 2.2, 1.4];
const colX = [0.1, 2.25, 4.19, 6.43, 8.69];
const rowH = 1.1;
const startY = 0.95;
// Header row
headers.forEach((h, i) => {
s.addShape(pres.ShapeType.rect, {
x:colX[i], y:startY, w:colW[i]-0.05, h:0.5,
fill:{ color:C.teal }, line:{ color:C.navy, width:0.5 }
});
s.addText(h, {
x:colX[i]+0.05, y:startY, w:colW[i]-0.1, h:0.5,
fontSize:12, bold:true, color:C.white, align:"center", valign:"middle", fontFace:"Calibri"
});
});
const rowColors = [C.teal+"22", C.red+"22", C.amber+"22"];
const textColors = [
[C.offWht, C.green, C.offWht, C.green, C.offWht],
[C.offWht, C.red, C.red, C.red, C.amber],
[C.offWht, C.amber, C.offWht, C.amber, C.offWht],
];
rows.forEach((row, ri) => {
const y = startY + 0.52 + ri * rowH;
row.forEach((cell, ci) => {
s.addShape(pres.ShapeType.rect, {
x:colX[ci], y, w:colW[ci]-0.05, h:rowH-0.06,
fill:{ color:rowColors[ri] }, line:{ color:C.teal+"55", width:0.5 }
});
s.addText(cell, {
x:colX[ci]+0.05, y:y+0.05, w:colW[ci]-0.12, h:rowH-0.15,
fontSize:12, color:textColors[ri][ci], align:"center", valign:"middle",
fontFace:"Calibri", bold: ci === 1 || ci === 3
});
});
});
s.addText("⚠ The KEY Trap: Severe hypomagnesemia silences PTH despite hypocalcemia → Ca²⁺ alone will FAIL", {
x:0.2, y:4.82, w:9.6, h:0.42,
fontSize:13, bold:true, color:C.amber, align:"center", fontFace:"Calibri"
});
footer(s);
}
// ══════════════════════════════════════════════════════════════════
// SLIDE 9 — Mg & POTASSIUM LINK
// ══════════════════════════════════════════════════════════════════
{
const s = addSlide(C.navy);
slideTitle(s, "Hypomagnesemia → Refractory Hypokalemia");
card(s, 0.2, 0.88, 5.9, 4.5, C.darkCard);
s.addText("The Mg²⁺–K⁺ Connection", {
x:0.35, y:0.95, w:5.6, h:0.45,
fontSize:17, bold:true, color:C.amber, fontFace:"Calibri"
});
s.addText([
{ text:"• ~40% of patients with hypomagnesemia have hypokalemia", options:{ breakLine:true } },
{ text:"• Mg²⁺ is required to block the ROMK channel (renal outer medullary K⁺ channel)", options:{ breakLine:true } },
{ text:"• Without intracellular Mg²⁺, ROMK is disinhibited → continuous K⁺ secretion into tubular lumen", options:{ breakLine:true } },
{ text:"• Result: renal K⁺ wasting that CANNOT be corrected with K⁺ supplements alone", options:{ breakLine:true } },
{ text:"\n⚠ Hypokalemia refractory to K⁺ supplementation → ALWAYS suspect hypomagnesemia", options:{ bold:true, color:C.amber } },
], {
x:0.35, y:1.5, w:5.6, h:3.6,
fontSize:13, color:C.offWht, fontFace:"Calibri", lineSpacingMultiple:1.4
});
card(s, 6.3, 0.88, 3.45, 4.5, C.darkCard);
s.addText("Clinical Clues", {
x:6.45, y:0.95, w:3.15, h:0.45,
fontSize:16, bold:true, color:C.tealLt, fontFace:"Calibri"
});
s.addText([
{ text:"Suspect Mg²⁺ deficiency in:", options:{ bold:true, breakLine:true, color:C.offWht } },
{ text:"• Alcoholism", options:{ breakLine:true, color:C.offWht } },
{ text:"• Loop/thiazide diuretics", options:{ breakLine:true, color:C.offWht } },
{ text:"• Cisplatin chemotherapy", options:{ breakLine:true, color:C.offWht } },
{ text:"• Chronic diarrhea / PPI use", options:{ breakLine:true, color:C.offWht } },
{ text:"• Diabetes (osmotic diuresis)", options:{ breakLine:true, color:C.offWht } },
{ text:"\nOrder serum Mg²⁺ with:", options:{ bold:true, breakLine:true, color:C.tealLt } },
{ text:"• Every refractory hypokalemia", options:{ breakLine:true, color:C.offWht } },
{ text:"• Every unexplained hypocalcemia", options:{ breakLine:true, color:C.offWht } },
{ text:"• Torsades de pointes", options:{ color:C.offWht } },
], {
x:6.45, y:1.5, w:3.15, h:3.6,
fontSize:12, fontFace:"Calibri", lineSpacingMultiple:1.35
});
footer(s);
}
// ══════════════════════════════════════════════════════════════════
// SLIDE 10 — TREATMENT: HYPOMAGNESEMIA
// ══════════════════════════════════════════════════════════════════
{
const s = addSlide(C.navy);
slideTitle(s, "Treatment — Hypomagnesemia");
const treats = [
{
title:"Mild / Asymptomatic",
range:"Mg²⁺ > 1.0 mEq/L, no symptoms",
lines:[
"Oral magnesium salts (MgCl₂, MgO, Mg[OH]₂)",
"20–30 mmol/day (40–60 mEq/day) in divided doses",
"Note: diarrhea common at higher oral doses",
"Address underlying cause (diet, PPI, diuretics)"
],
color: C.teal
},
{
title:"Severe / Symptomatic",
range:"Mg²⁺ < 1.0 mEq/L or seizures/arrhythmia",
lines:[
"IV MgCl₂ preferred over MgSO₄ (sulfate binds Ca²⁺)",
"Continuous infusion: 50 mmol/day (100 mEq/day)",
"Reduce by 50–75% if eGFR reduced",
"Monitor serum Mg²⁺ every 12–24 h",
"Replete Ca²⁺, K⁺ and PO₄³⁻ concurrently"
],
color: C.red
},
{
title:"⚠ Critical Pitfall",
range:"Severe HypoMg + hypocalcemia + hypophosphatemia",
lines:[
"IV Mg alone → rapid PTH rebound",
"PTH surge → phosphaturia → worsens hypophosphatemia",
"Risk: neuromuscular symptoms, rhabdomyolysis",
"SOLUTION: give BOTH IV Mg AND IV calcium together",
"Monitor phosphorus closely after Mg repletion"
],
color: C.amber
}
];
treats.forEach((t, i) => {
const x = 0.2 + i * 3.3;
s.addShape(pres.ShapeType.roundRect, {
x, y:0.85, w:3.15, h:4.55,
fill:{ color:C.darkCard }, line:{ color:t.color, width:2 }, rectRadius:0.12
});
s.addShape(pres.ShapeType.roundRect, {
x, y:0.85, w:3.15, h:0.5,
fill:{ color:t.color }, line:{ color:t.color, width:1 }, rectRadius:0.1
});
s.addText(t.title, {
x:x+0.08, y:0.87, w:3.0, h:0.46,
fontSize:13, bold:true, color:C.white, align:"center", valign:"middle", fontFace:"Calibri"
});
s.addText(t.range, {
x:x+0.1, y:1.42, w:2.95, h:0.4,
fontSize:11, color:C.gray, align:"center", fontFace:"Calibri", italic:true
});
const bullets = t.lines.map((line, li) => ({
text:line,
options:{ bullet:{ code:"2022" }, breakLine: li < t.lines.length-1, color:C.offWht }
}));
s.addText(bullets, {
x:x+0.18, y:1.88, w:2.85, h:3.3,
fontSize:12, fontFace:"Calibri", lineSpacingMultiple:1.4
});
});
footer(s);
}
// ══════════════════════════════════════════════════════════════════
// SLIDE 11 — HYPERMAGNESEMIA
// ══════════════════════════════════════════════════════════════════
{
const s = addSlide(C.navy);
slideTitle(s, "Hypermagnesemia (> 2.4 mg/dL / > 2.3 mEq/L)");
card(s, 0.2, 0.88, 4.5, 4.5, C.darkCard);
s.addText("Causes", {
x:0.35, y:0.95, w:4.2, h:0.42,
fontSize:16, bold:true, color:C.amber, fontFace:"Calibri"
});
s.addText([
{ text:"Usually requires renal insufficiency +", options:{ bold:true, breakLine:true } },
{ text:"• Mg-containing antacids / laxatives (large doses)", options:{ breakLine:true } },
{ text:"• IV MgSO₄ for eclampsia/pre-eclampsia", options:{ breakLine:true } },
{ text:"• Intestinal ileus with Mg cathartics retained", options:{ breakLine:true } },
{ text:"• Rhabdomyolysis / extensive tissue necrosis", options:{ breakLine:true } },
{ text:"• FHH (familial hypocalciuric hypercalcemia) — CaSR mutation causes excessive TAL reabsorption of Mg²⁺", options:{ breakLine:true } },
{ text:"• Adrenal insufficiency, hypothyroidism, hypothermia", options:{} },
], {
x:0.35, y:1.45, w:4.3, h:3.8,
fontSize:13, color:C.offWht, fontFace:"Calibri", lineSpacingMultiple:1.35
});
card(s, 5.0, 0.88, 4.75, 4.5, C.darkCard);
s.addText("Clinical Features by Level", {
x:5.15, y:0.95, w:4.4, h:0.42,
fontSize:16, bold:true, color:C.red, fontFace:"Calibri"
});
const levels = [
{ mg:"4–6 mEq/L", fx:"Nausea, vomiting, flushing, hypotension", color:C.tealLt },
{ mg:"6–10 mEq/L", fx:"Loss of deep tendon reflexes, drowsiness, ECG changes (↑PR, wide QRS)", color:C.amber },
{ mg:"> 10 mEq/L", fx:"Respiratory paralysis, complete heart block, cardiac arrest", color:C.red },
];
levels.forEach((lv, i) => {
const py = 1.5 + i * 1.25;
s.addShape(pres.ShapeType.roundRect, {
x:5.15, y:py, w:4.5, h:1.1,
fill:{ color:lv.color+"22" }, line:{ color:lv.color, width:1.5 }, rectRadius:0.09
});
s.addText(lv.mg, {
x:5.28, y:py+0.06, w:1.6, h:0.4,
fontSize:14, bold:true, color:lv.color, fontFace:"Calibri"
});
s.addText(lv.fx, {
x:5.28, y:py+0.52, w:4.2, h:0.5,
fontSize:12, color:C.offWht, fontFace:"Calibri"
});
});
s.addText("Treatment: IV calcium gluconate (antagonizes Mg²⁺), IV fluids + furosemide, dialysis if severe", {
x:5.15, y:4.9, w:4.5, h:0.36,
fontSize:11.5, bold:true, color:C.tealLt, align:"center", fontFace:"Calibri"
});
footer(s);
}
// ══════════════════════════════════════════════════════════════════
// SLIDE 12 — SECTION BREAK: CALCIUM
// ══════════════════════════════════════════════════════════════════
{
const s = addSlide(C.navy);
s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{ color:C.navy } });
s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:0.5, fill:{ color:C.amber } });
s.addShape(pres.ShapeType.rect, { x:0, y:5.125, w:10, h:0.5, fill:{ color:C.amber } });
s.addShape(pres.ShapeType.rect, { x:4.5, y:0.5, w:0.08, h:4.625, fill:{ color:C.amber } });
s.addText("SECTION 2", {
x:5.0, y:1.5, w:4.5, h:0.5,
fontSize:14, bold:true, color:C.amber, charSpacing:5, fontFace:"Calibri"
});
s.addText("Calcium\nDisturbances", {
x:5.0, y:2.0, w:4.5, h:1.8,
fontSize:40, bold:true, color:C.white, fontFace:"Calibri"
});
s.addText("Normal total Ca²⁺: 8.5–10.5 mg/dL\n~50% ionized (active) • ~40% albumin-bound • ~10% complexed", {
x:5.0, y:3.85, w:4.6, h:0.9,
fontSize:13, color:C.offWht, fontFace:"Calibri", italic:true
});
s.addText("Corrected Ca²⁺ = Measured Ca²⁺ + 0.8 × (4 – Albumin)", {
x:0.3, y:1.5, w:3.9, h:0.8,
fontSize:15, bold:true, color:C.amber, align:"center", fontFace:"Calibri"
});
s.addText("for every 1 g/dL ↓ in albumin below 4, add 0.8 to total Ca²⁺", {
x:0.3, y:2.35, w:3.9, h:0.6,
fontSize:12, color:C.offWht, align:"center", fontFace:"Calibri", italic:true
});
}
// ══════════════════════════════════════════════════════════════════
// SLIDE 13 — HYPOCALCEMIA
// ══════════════════════════════════════════════════════════════════
{
const s = addSlide(C.navy);
slideTitle(s, "Hypocalcemia — Causes & Approach");
const groups = [
{
title:"↓ PTH",
items:["Hypoparathyroidism (post-surgical)", "DiGeorge syndrome", "Autoimmune", "Severe Hypomagnesemia ★"],
color:C.red, x:0.15
},
{
title:"PTH Resistance",
items:["Pseudohypoparathyroidism (Albright)", "Severe hypomagnesemia ★", "↓ Mg → Gs protein dysfunction"],
color:C.amber, x:2.65
},
{
title:"↓ Vitamin D",
items:["Nutritional deficiency", "Malabsorption (Crohn, celiac)", "CKD (↓ 1α-hydroxylase)", "Liver disease (↓ 25-OH)"],
color:C.teal, x:5.15
},
{
title:"Other Causes",
items:["Hungry bone syndrome", "Hyperphosphatemia", "Pancreatitis (Ca saponification)", "Citrate toxicity (transfusions)"],
color:C.gray, x:7.65
}
];
groups.forEach(g => {
s.addShape(pres.ShapeType.roundRect, {
x:g.x, y:0.88, w:2.35, h:4.42,
fill:{ color:C.darkCard }, line:{ color:g.color, width:2 }, rectRadius:0.1
});
s.addShape(pres.ShapeType.roundRect, {
x:g.x, y:0.88, w:2.35, h:0.48,
fill:{ color:g.color }, line:{ color:g.color, width:1 }, rectRadius:0.1
});
s.addText(g.title, {
x:g.x+0.05, y:0.9, w:2.25, h:0.44,
fontSize:13, bold:true, color:C.white, align:"center", valign:"middle", fontFace:"Calibri"
});
const bullets = g.items.map((item, idx) => ({
text: item,
options:{ bullet:{ code:"2022" }, breakLine: idx < g.items.length-1, color: item.includes("★") ? C.amber : C.offWht, bold: item.includes("★") }
}));
s.addText(bullets, {
x:g.x+0.1, y:1.44, w:2.15, h:3.7,
fontSize:12, fontFace:"Calibri", lineSpacingMultiple:1.4
});
});
s.addText("★ = Remember: both ↓PTH secretion AND PTH resistance occur in severe hypomagnesemia", {
x:0.2, y:5.28, w:9.6, h:0.28,
fontSize:10, color:C.amber, align:"center", fontFace:"Calibri", italic:true, bold:true
});
footer(s);
}
// ══════════════════════════════════════════════════════════════════
// SLIDE 14 — CLINICAL SCENARIOS (USMLE-STYLE)
// ══════════════════════════════════════════════════════════════════
{
const s = addSlide(C.navy);
slideTitle(s, "Clinical Scenarios — Applying the Dual Rule");
const scenarios = [
{
q:"A 52-year-old alcoholic has Ca²⁺ 6.8, Mg²⁺ 0.5 mEq/L, PTH 9 (inappropriately low). IV calcium given — no improvement. Next step?",
a:"IV Magnesium — PTH secretion is blocked by severe Mg²⁺ deficiency; Ca²⁺ cannot work until Mg²⁺ is repleted",
color:C.red
},
{
q:"Post-parathyroidectomy patient develops hypocalcemia refractory to Ca²⁺ + calcitriol. Mg²⁺ = 0.6 mEq/L. Explanation?",
a:"Hypomagnesemia prevents the remaining parathyroid tissue from secreting PTH. Correct Mg²⁺ first.",
color:C.amber
},
{
q:"Alcoholic patient: K⁺ 2.8 despite IV potassium × 2 days. ECG shows U-waves, QT prolongation. What to check?",
a:"Serum Mg²⁺ — hypomagnesemia causes renal K⁺ wasting via ROMK disinhibition; K⁺ won't correct until Mg²⁺ is repleted",
color:C.teal
},
];
scenarios.forEach((sc, i) => {
const y = 0.95 + i * 1.6;
card(s, 0.2, y, 9.6, 1.48, C.darkCard);
s.addShape(pres.ShapeType.roundRect, {
x:0.2, y, w:0.5, h:1.48,
fill:{ color:sc.color }, line:{ color:sc.color, width:1 }, rectRadius:0.05
});
s.addText(`Q${i+1}`, {
x:0.22, y:y+0.5, w:0.45, h:0.48,
fontSize:13, bold:true, color:C.white, align:"center", fontFace:"Calibri"
});
s.addText(sc.q, {
x:0.82, y:y+0.06, w:8.8, h:0.62,
fontSize:13, color:C.offWht, fontFace:"Calibri", lineSpacingMultiple:1.2
});
s.addText("Answer: " + sc.a, {
x:0.82, y:y+0.73, w:8.8, h:0.62,
fontSize:12, color:sc.color, fontFace:"Calibri", bold:true, lineSpacingMultiple:1.2
});
});
footer(s);
}
// ══════════════════════════════════════════════════════════════════
// SLIDE 15 — SUMMARY / KEY TAKEAWAYS
// ══════════════════════════════════════════════════════════════════
{
const s = addSlide(C.teal);
s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:5.625, fill:{ color:C.navy } });
s.addShape(pres.ShapeType.rect, { x:0, y:0, w:10, h:0.9, fill:{ color:C.teal } });
s.addText("KEY TAKEAWAYS", {
x:0.3, y:0, w:9.4, h:0.9,
fontSize:26, bold:true, color:C.white, valign:"middle", align:"center", charSpacing:5, fontFace:"Calibri"
});
const points = [
{ num:"1", txt:"Mg²⁺ mirrors Ca²⁺ in PTH control: MILD hypomagnesemia stimulates PTH; SEVERE hypomagnesemia INHIBITS it — the paradox", color:C.teal },
{ num:"2", txt:"Severe hypomagnesemia causes hypocalcemia via TWO mechanisms: impaired PTH secretion + end-organ PTH resistance", color:C.red },
{ num:"3", txt:"Hypocalcemia refractory to calcium supplementation → ALWAYS check Mg²⁺ and replete it first", color:C.amber },
{ num:"4", txt:"Hypokalemia refractory to potassium → check Mg²⁺ (ROMK disinhibition drives renal K⁺ wasting)", color:C.tealLt },
{ num:"5", txt:"Post-Mg repletion in severe cases: give Ca²⁺ simultaneously to prevent PTH rebound → worsening hypophosphatemia", color:C.green },
];
points.forEach((p, i) => {
const y = 1.05 + i * 0.9;
s.addShape(pres.ShapeType.ellipse, {
x:0.25, y:y+0.1, w:0.55, h:0.55,
fill:{ color:p.color }, line:{ color:p.color, width:1 }
});
s.addText(p.num, {
x:0.25, y:y+0.1, w:0.55, h:0.55,
fontSize:16, bold:true, color:C.white, align:"center", valign:"middle", fontFace:"Calibri"
});
s.addText(p.txt, {
x:0.95, y:y+0.08, w:8.8, h:0.6,
fontSize:14, color:C.offWht, fontFace:"Calibri", lineSpacingMultiple:1.2
});
});
s.addText("Sources: Harrison's Principles 22E · Costanzo Physiology 7E · Brenner & Rector's The Kidney · Morgan & Mikhail Clinical Anesthesiology 7E", {
x:0, y:5.3, w:10, h:0.32,
fontSize:9, color:C.gray, align:"center", fontFace:"Calibri"
});
}
// ── WRITE FILE ────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/electrolytes-pptx/Electrolyte_Disturbances_Mg_PTH.pptx" })
.then(() => console.log("SUCCESS: Presentation saved."))
.catch(err => console.error("ERROR:", err));
List name of Top usmle concepts i must know
Generate usmle practice ques from congenital heart defect and valvular heart diseases
Contrast: PGE1 is used to KEEP the ductus open in duct-dependent lesions (TGA, critical PS, coarctation). Here, you want to close it.
Ostium primum ASD is associated with Down syndrome and causes left axis deviation + AV block.
Critical: Once Eisenmenger develops, cardiac surgery is contraindicated (removing the defect would further raise RV pressure → fatal RV failure). Lung transplant + repair is the only option.
Contrast with aortic stenosis (crescendo-decrescendo, increases with squatting, decreases with Valsalva/standing).
| Sign | Finding |
|---|---|
| de Musset | Head bobbing with each heartbeat |
| Corrigan/water-hammer pulse | Bounding carotid pulse, rapid collapse |
| Quincke | Nail bed capillary pulsations |
| Duroziez | To-and-fro murmur over femoral artery |
| Hill | Popliteal SBP > brachial SBP by > 20 mmHg |
| Traube | Pistol-shot sounds over femoral artery |
| Müller | Uvular pulsations |
MVP is the exception to the general rule: most murmurs increase with increased preload, but MVP's click moves in the opposite direction from other murmurs.
| Setting | Organism |
|---|---|
| IVDU (tricuspid) | S. aureus |
| Native valve | Strep. viridans |
| Prosthetic valve (early < 60d) | S. aureus, S. epidermidis |
| Prosthetic valve (late > 60d) | Strep. viridans |
| Colorectal cancer | S. bovis (S. gallolyticus) |
| Dental procedure | Strep. viridans |
| GU/GI procedure | Enterococcus |
| Murmur | Location | Maneuver | Effect | |
|---|---|---|---|---|
| A | AS | RUSB | Valsalva | Louder |
| B | MVP | Apex | Squatting | Click moves earlier |
| C | HCM | LLSB | Valsalva | Louder |
| D | MR | Apex | Standing | Louder |
| E | AR | RUSB | Leaning forward | Softer |
| Maneuver | Effect on HCM | Mechanism |
|---|---|---|
| Valsalva (strain) | ↑ Louder | ↓ preload → smaller LV → more obstruction |
| Standing quickly | ↑ Louder | ↓ preload |
| Squatting | ↓ Softer | ↑ preload → less obstruction |
| Isometric handgrip | ↓ Softer | ↑ afterload → less obstruction |
| Defect | Murmur | Key Feature |
|---|---|---|
| VSD | Holosystolic, LLSB | Most common CHD |
| ASD | Fixed split S2 | RBBB, paradoxical emboli |
| PDA | Continuous machine-like | Indomethacin closes |
| TOF | Systolic ejection, LLSB | Boot-shaped heart, tet spells |
| TGA | None / single S2 | Egg on string; PGE1 to keep open |
| Coarctation | Continuous back | Rib notching, bicuspid AoV |
| AS | Crescendo-decrescendo, RUSB → carotids | Pulsus parvus et tardus |
| AR | Decrescendo diastolic, LSB | Wide PP, water hammer pulse |
| MS | Mid-diastolic rumble, apex | Opening snap, loud S1 |
| MR | Holosystolic, apex → axilla | S3, displaced PMI |
| MVP | Midsystolic click + late systolic | Click moves later with squatting |
| HCM | Dynamic LVOT, LLSB | Louder with Valsalva |
Rib notching important causes
rib notching chest X-ray coarctation of aorta