Known case of hypertension Dm ii cva stroke admitted with empyema of gall bladder has severe hypocalcemia hypokalemia hypo magnesemia with normal phosphorous and pth levels . What are the causes
hypocalcemia AND hypomagnesemia AND hypokalemia
What is the IV magnesium and calcium replacement protocol here?
IV magnesium replacement protocol hypomagnesemia critically ill 2 g magnesium sulfate over hours; calcium gluconate infusion hypocalcemia guideline
Causes of hypo magnesia
Make flowchart
ls -la /tmp/workspace/ && python3 -c "import matplotlib; print(matplotlib.__version__)"
mkdir -p /tmp/workspace/hypomg-flowchart/output && cat > /tmp/workspace/hypomg-flowchart/make.py << 'EOF' import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt from matplotlib.patches import FancyBboxPatch, FancyArrowPatch fig, ax = plt.subplots(figsize=(16, 20)) ax.set_xlim(0, 100); ax.set_ylim(0, 125); ax.axis("off") C = {"start":"#1F4E79","step":"#DDEBF7","dec":"#FFF2CC","renal":"#FCE4D6","gi":"#E2EFDA","shift":"#EDEDED","tx":"#D9D2E9"} def box(x, y, w, h, text, fc, fs=10.5, bold=False, ec="#333333", tc="black"): p = FancyBboxPatch((x-w/2, y-h/2), w, h, boxstyle="round,pad=0.3,rounding_size=1.2", fc=fc, ec=ec, lw=1.4) ax.add_patch(p) ax.text(x, y, text, ha="center", va="center", fontsize=fs, fontweight="bold" if bold else "normal", color=tc, wrap=True) def arrow(x1, y1, x2, y2, label=None, lx=0, ly=0): ax.add_patch(FancyArrowPatch((x1,y1),(x2,y2), arrowstyle="-|>", mutation_scale=16, lw=1.5, color="#333333")) if label: ax.text((x1+x2)/2+lx, (y1+y2)/2+ly, label, fontsize=10, fontweight="bold", color="#C00000", ha="center", va="center", bbox=dict(fc="white", ec="none", pad=1)) ax.text(50, 123, "Approach to Hypomagnesemia (with associated hypocalcemia and hypokalemia)", ha="center", fontsize=16, fontweight="bold") box(50, 116, 52, 5, "Serum Mg < 1.7 mg/dL (0.7 mmol/L)\nor refractory low K / low Ca with normal PTH + phosphate", C["start"], 11, True, tc="white") arrow(50,113.3,50,110.7) box(50, 107.5, 70, 6, "Step 1: Exclude pseudo-causes and check context\nAlbumin / ionized Ca, creatinine + eGFR, glucose / ketones, ABG,\nphosphate, lipase, 25-OH vit D, ECG (QTc), full drug chart", C["step"], 10.5) arrow(50,104.4,50,101.7) box(50, 98.5, 62, 6, "Step 2: Look for obvious cause\nPPI, loop / thiazide diuretics, aminoglycosides, amphotericin B,\ncisplatin, alcohol, diarrhea / drain output, poor intake, DM osmotic diuresis", C["step"], 10.5) arrow(50,95.4,50,92.7) box(50, 89.5, 62, 6, "Step 3: Spot urine Mg and creatinine (serum Mg + Cr)\nFEMg = (UMg x SCr) / (0.7 x SMg x UCr) x 100\n(or 24-h urine Mg)", C["dec"], 10.5, True) # branches arrow(40,86.4,22,80.8,"FEMg > 2%\n(24-h urine Mg > 24 mg)",lx=-5,ly=1.5) arrow(60,86.4,78,80.8,"FEMg < 2%\n(24-h urine Mg < 24 mg)",lx=5,ly=1.5) box(22, 76.5, 40, 8, "RENAL Mg WASTING", C["renal"], 12, True) box(78, 76.5, 40, 8, "EXTRARENAL (GI / intake / shift)", C["gi"], 12, True) # renal details arrow(22,72.2,22,68.7) box(22, 62, 41, 12, "Drugs: loop / thiazide diuretics,\naminoglycosides, amphotericin B, cisplatin,\ncarboplatin, pentamidine, foscarnet,\ncalcineurin inhibitors, EGFR inhibitors\n\nMetabolic: uncontrolled diabetes / osmotic\ndiuresis, hypercalcemia, volume expansion,\nhyperaldosteronism, post-ATN / post-obstructive\ndiuresis, post-transplant", C["renal"], 9.8) arrow(22,55.8,22,52.7) box(22, 49, 41, 7, "Genetic tubular disorders (if no cause found)\nGitelman, Bartter, CLDN16 / CLDN19, CNNM2, EGF,\nKCNA1. Hypokalemia + hypocalciuria + alkalosis\nsuggests Gitelman", C["renal"], 9.8) # GI details arrow(78,72.2,78,68.7) box(78, 62, 41, 12, "Intake / absorption: malnutrition, alcoholism,\nTPN or IV fluids without Mg, malabsorption,\nsteatorrhea, biliary disease, PPI, vitamin D\ndeficiency\n\nGI loss: chronic diarrhea, laxatives, vomiting,\nNG suction, intestinal / biliary fistula,\nacute pancreatitis", C["gi"], 9.8) arrow(78,55.8,78,52.7) box(78, 49, 41, 7, "Redistribution: refeeding syndrome, hungry bone,\ninsulin / catecholamines, massive transfusion\n(citrate), burns, cardiopulmonary bypass", C["shift"], 9.8) # merge arrow(22,45.4,40,40.8) arrow(78,45.4,60,40.8) box(50, 37, 66, 7, "Step 4: Look for secondary effects\nHypokalemia (renal K wasting), hypocalcemia (PTH failure / resistance),\nQT prolongation, torsades, arrhythmia, tetany, seizures", C["dec"], 10.5, True) arrow(50,33.4,50,30.7) box(50, 25, 80, 10, "Step 5: Treat\n" "Symptomatic / severe: MgSO4 1-2 g IV over 10-60 min (torsades or seizure: 1-4 g), then 4-8 g over 12-24 h\n" "Replace K and Ca together; Ca and K often will not correct until Mg is replaced\n" "Renal impairment: reduce dose 25-50%. Monitor reflexes, RR, BP, ECG, Mg q4-6 h\n" "Continue repletion 3-5 days (slow intracellular refill)", C["tx"], 10.2) arrow(50,19.9,50,17.2) box(50, 13, 80, 7.5, "Step 6: Treat the cause\nStop / swap offending drugs (PPI, diuretics, nephrotoxins), control glucose,\nrestore nutrition (watch refeeding), source control of gallbladder empyema,\noral Mg once stable (diarrhea limits dose)", C["step"], 10.2) ax.text(50, 6, "Sources: Harrison's 22E (Hypomagnesemia, Table 421-4); Goldman-Cecil (Magnesium Deficiency); Morgan and Mikhail's 7e;\nTintinalli's Emergency Medicine. Educational aid. Verify doses against local protocol.", ha="center", fontsize=9, style="italic", color="#444444") plt.savefig("/tmp/workspace/hypomg-flowchart/output/hypomagnesemia_flowchart.png", dpi=150, bbox_inches="tight", facecolor="white") EOF python3 /tmp/workspace/hypomg-flowchart/make.py && ls -la /tmp/workspace/hypomg-flowchart/output
cd /tmp/workspace/hypomg-flowchart && cat > check.py << 'EOF' import re src = open("make.py").read() src = src.replace('plt.savefig(', 'fig.canvas.draw()\nrend=fig.canvas.get_renderer()\nbad=0\nfor t in ax.texts:\n pass\nplt.savefig(') exec(compile(src.split("plt.savefig(")[0], "m", "exec")) fig.canvas.draw() r = fig.canvas.get_renderer() inv = ax.transData.inverted() from matplotlib.patches import FancyBboxPatch boxes = [p for p in ax.patches if isinstance(p, FancyBboxPatch)] texts = [t for t in ax.texts if t.get_bbox_patch() is None] for t in texts: bb = t.get_window_extent(r) (x0,y0),(x1,y1) = inv.transform((bb.x0,bb.y0)), inv.transform((bb.x1,bb.y1)) cx, cy = (x0+x1)/2, (y0+y1)/2 for p in boxes: bx0,by0,bw,bh = p.get_x(),p.get_y(),p.get_width(),p.get_height() if bx0<=cx<=bx0+bw and by0<=cy<=by0+bh: if x0<bx0+0.3 or x1>bx0+bw-0.3 or y0<by0+0.3 or y1>by0+bh-0.3: print("OVERFLOW:", t.get_text()[:40].replace("\n"," "), round(x0,1),round(x1,1),"box",round(bx0,1),round(bx0+bw,1), round(y0,1),round(y1,1),"box",round(by0,1),round(by0+bh,1)) print("done") EOF python3 check.py
cd /tmp/workspace/hypomg-flowchart && sed -i 's/C\["renal"\], 9.8)/C["renal"], 9.3)/; s/C\["gi"\], 9.8)/C["gi"], 9.3)/' make.py && python3 check.py && python3 make.py && ls -la output
hypomagnesemia flowchart
Image · PNG