Currently i prepare for nclex rn
What kind of help are you looking for right now? · Where are you in your prep?
Is ur ai is free?
Give me imp topic for nclex in fundamentals of nursing
NCLEX RN fundamentals of nursing important topics 2025
💡 NCLEX loves asking: "Which action should the nurse take FIRST?" - Always think ABC + Maslow.
| Lab | Normal Range |
|---|---|
| Na+ | 135-145 mEq/L |
| K+ | 3.5-5.0 mEq/L |
| Ca2+ | 8.5-10.5 mg/dL |
| Mg2+ | 1.5-2.5 mEq/L |
| Hgb (male) | 13.5-17.5 g/dL |
| Hgb (female) | 12-16 g/dL |
| Hct | 37-47% (F), 42-52% (M) |
| WBC | 5,000-10,000/mm³ |
| BUN | 10-20 mg/dL |
| Creatinine | 0.5-1.2 mg/dL |
Infection control?
NCLEX RN infection control isolation precautions key topics 2025
Infectious Agent → Reservoir → Portal of Exit → Mode of Transmission
→ Portal of Entry → Susceptible Host
💡 NCLEX tip: To BREAK the chain, identify which link the nursing action targets. Hand hygiene breaks mode of transmission. Covering a cough breaks portal of exit.
| Situation | PPE Required |
|---|---|
| Any contact with blood/body fluids | Gloves |
| Risk of splashing/spraying | Mask + goggles/face shield |
| Clothing contamination risk | Gown |
| Respiratory hygiene | Mask on patient if coughing |
💡 Hand hygiene is the single most effective infection control measure.
| PPE | N95 respirator (must be fit-tested), gown, gloves |
| Room | Negative pressure room (air flows IN, not out) |
| Door | Keep CLOSED |
| Diseases | Measles, Tuberculosis (TB), Varicella (chickenpox), Herpes zoster (shingles - disseminated) |
| Memory trick | "My TV Has Airtime" - Measles, TB, Varicella, Herpes zoster |
| PPE | Surgical mask, gown, gloves |
| Room | Private room preferred; keep door CLOSED |
| Diseases | Influenza, Meningitis (bacterial), Mumps, Rubella, Pertussis (whooping cough), Diphtheria, Strep pharyngitis, COVID-19 |
| Memory trick | "SPIDERMAN" - Sepsis, Pertussis, Influenza, Diphtheria, Epiglottitis, Rubella, Meningitis, Adenovirus, Norovirus |
| PPE | Gloves + gown (put on before entering room) |
| Room | Private room |
| Equipment | Dedicated (do NOT share BP cuff, stethoscope, etc.) |
| Diseases | MRSA, VRE, C. difficile, RSV, wound infections, scabies, lice, impetigo, herpes simplex |
⚠️ C. diff special rule: Use soap and water for hand hygiene - alcohol-based sanitizers do NOT kill C. diff spores!
Memory trick: "Go Make Good Gloves" - Gown, Mask, Goggles, Gloves
Memory trick: "Gloves Go, Goggles Gone, Gown's Gone, Mask's Last"
| Situation | Method |
|---|---|
| Routine care | Alcohol-based hand rub (ABHR) OR soap & water |
| Before eating | Soap and water |
| After using restroom | Soap and water |
| C. difficile | Soap and water ONLY |
| Visibly soiled hands | Soap and water ONLY |
| Medical Asepsis (Clean Technique) | Surgical Asepsis (Sterile Technique) | |
|---|---|---|
| Goal | Reduce number of microorganisms | Eliminate ALL microorganisms |
| Used for | Routine care, oral meds, bathing | Wound care, surgery, inserting catheters |
| Examples | Hand washing, PPE, isolation | Sterile gloves, sterile dressing changes |
| Disease | Precaution |
|---|---|
| TB | Airborne |
| Measles | Airborne |
| Chickenpox | Airborne + Contact |
| Influenza | Droplet |
| Meningitis (bacterial) | Droplet |
| Mumps | Droplet |
| COVID-19 | Droplet + Contact |
| MRSA | Contact |
| C. diff | Contact |
| Scabies | Contact |
| Pneumonia (regular) | Standard |
| HIV/AIDS | Standard |
Create a quick reference PDF on infection control precautions
mkdir -p /home/daytona/workspace/nclex-pdf && ls /home/daytona/workspace/nclex-pdf
~/nclex-pdf/create_pdf.py
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import cm
from reportlab.platypus import (
SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
HRFlowable, KeepTogether
)
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_CENTER, TA_LEFT
from reportlab.platypus import PageBreak
OUTPUT = "/home/daytona/workspace/nclex-pdf/Infection_Control_NCLEX_QuickRef.pdf"
# ── Colors ──────────────────────────────────────────────────────────────
C_NAVY = colors.HexColor("#0D1B2A")
C_BLUE = colors.HexColor("#1565C0")
C_LBLUE = colors.HexColor("#1E88E5")
C_GREEN = colors.HexColor("#2E7D32")
C_LGREEN = colors.HexColor("#E8F5E9")
C_RED = colors.HexColor("#C62828")
C_LRED = colors.HexColor("#FFEBEE")
C_ORANGE = colors.HexColor("#E65100")
C_LORANGE = colors.HexColor("#FFF3E0")
C_PURPLE = colors.HexColor("#6A1B9A")
C_LPURPLE = colors.HexColor("#F3E5F5")
C_TEAL = colors.HexColor("#00695C")
C_LTEAL = colors.HexColor("#E0F2F1")
C_LGRAY = colors.HexColor("#F5F5F5")
C_MGRAY = colors.HexColor("#BDBDBD")
C_WHITE = colors.white
C_YELLOW = colors.HexColor("#FFF9C4")
doc = SimpleDocTemplate(
OUTPUT,
pagesize=A4,
rightMargin=1.5*cm, leftMargin=1.5*cm,
topMargin=1.5*cm, bottomMargin=1.5*cm
)
W = A4[0] - 3*cm # usable width
styles = getSampleStyleSheet()
def style(name, **kw):
s = ParagraphStyle(name, parent=styles["Normal"], **kw)
return s
S_TITLE = style("title", fontSize=22, textColor=C_WHITE, alignment=TA_CENTER,
fontName="Helvetica-Bold", leading=28)
S_SUB = style("sub", fontSize=11, textColor=C_WHITE, alignment=TA_CENTER,
fontName="Helvetica", leading=16)
S_H1 = style("h1", fontSize=13, textColor=C_WHITE, fontName="Helvetica-Bold",
leading=18, leftIndent=6)
S_H2 = style("h2", fontSize=10, textColor=C_NAVY, fontName="Helvetica-Bold",
leading=14, leftIndent=4)
S_BODY = style("body", fontSize=9, textColor=C_NAVY, fontName="Helvetica",
leading=13, leftIndent=4)
S_BULLET = style("bullet", fontSize=9, textColor=C_NAVY, fontName="Helvetica",
leading=13, leftIndent=12, bulletIndent=4)
S_TIP = style("tip", fontSize=9, textColor=C_RED, fontName="Helvetica-Bold",
leading=13, leftIndent=4)
S_MEMO = style("memo", fontSize=9, textColor=C_PURPLE, fontName="Helvetica-BoldOblique",
leading=13, leftIndent=4)
S_CENTER = style("center", fontSize=9, textColor=C_NAVY, fontName="Helvetica",
alignment=TA_CENTER, leading=13)
S_HDRCELL = style("hdrcell", fontSize=9, textColor=C_WHITE, fontName="Helvetica-Bold",
alignment=TA_CENTER, leading=12)
S_CELL = style("cell", fontSize=8.5,textColor=C_NAVY, fontName="Helvetica",
leading=12)
S_CELLB = style("cellb", fontSize=8.5,textColor=C_NAVY, fontName="Helvetica-Bold",
leading=12)
def section_header(text, bg=C_BLUE, emoji=""):
full = f"{emoji} {text}" if emoji else text
tbl = Table([[Paragraph(full, S_H1)]], colWidths=[W])
tbl.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), bg),
("ROUNDEDCORNERS", [4,4,4,4]),
("TOPPADDING", (0,0), (-1,-1), 6),
("BOTTOMPADDING", (0,0), (-1,-1), 6),
("LEFTPADDING", (0,0), (-1,-1), 8),
]))
return tbl
def colored_box(paragraphs_or_table, bg=C_LGRAY, border=C_MGRAY):
inner = paragraphs_or_table if isinstance(paragraphs_or_table, list) else [paragraphs_or_table]
tbl = Table([[ [Spacer(1,2)] + inner + [Spacer(1,2)] ]], colWidths=[W])
tbl.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), bg),
("BOX", (0,0), (-1,-1), 0.8, border),
("TOPPADDING", (0,0),(-1,-1), 4),
("BOTTOMPADDING", (0,0),(-1,-1), 4),
("LEFTPADDING", (0,0),(-1,-1), 8),
("RIGHTPADDING", (0,0),(-1,-1), 8),
]))
return tbl
def make_table(headers, rows, col_widths, header_bg=C_BLUE):
hdr_row = [Paragraph(h, S_HDRCELL) for h in headers]
data = [hdr_row]
for row in rows:
data.append([Paragraph(str(c), S_CELL) for c in row])
tbl = Table(data, colWidths=col_widths)
ts = TableStyle([
("BACKGROUND", (0,0), (-1,0), header_bg),
("ROWBACKGROUNDS",(0,1), (-1,-1), [C_WHITE, C_LGRAY]),
("GRID", (0,0), (-1,-1), 0.4, C_MGRAY),
("TOPPADDING", (0,0), (-1,-1), 5),
("BOTTOMPADDING", (0,0), (-1,-1), 5),
("LEFTPADDING", (0,0), (-1,-1), 6),
("VALIGN", (0,0), (-1,-1), "MIDDLE"),
])
tbl.setStyle(ts)
return tbl
story = []
# ══════════════════════════════════════════════════════════════════════════
# TITLE BLOCK
# ══════════════════════════════════════════════════════════════════════════
title_data = [[
Paragraph("INFECTION CONTROL", S_TITLE),
Paragraph("NCLEX-RN Quick Reference", S_SUB),
Paragraph("Transmission-Based Precautions • PPE • Hand Hygiene • HAI Prevention", S_SUB),
]]
title_tbl = Table(title_data, colWidths=[W])
title_tbl.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), C_NAVY),
("TOPPADDING", (0,0),(-1,-1), 14),
("BOTTOMPADDING", (0,0),(-1,-1), 14),
("LEFTPADDING", (0,0),(-1,-1), 10),
("ROUNDEDCORNERS",[6,6,6,6]),
]))
story.append(title_tbl)
story.append(Spacer(1, 0.3*cm))
# ══════════════════════════════════════════════════════════════════════════
# 1. CHAIN OF INFECTION
# ══════════════════════════════════════════════════════════════════════════
story.append(section_header("1. CHAIN OF INFECTION", C_TEAL, "🔗"))
story.append(Spacer(1, 0.15*cm))
chain_data = [
["Infectious Agent", "Reservoir", "Portal of Exit", "Mode of\nTransmission", "Portal of Entry", "Susceptible\nHost"],
["Bacteria, Virus,\nFungus, Parasite", "Human, Animal,\nEnvironment", "Respiratory,\nGI, Skin, Blood", "Contact, Droplet,\nAirborne, Vector", "Mouth, Nose,\nSkin, GI tract", "Immunocompromised,\nElderly, Newborn"],
]
chain_tbl = Table(chain_data, colWidths=[W/6]*6)
chain_tbl.setStyle(TableStyle([
("BACKGROUND", (0,0),(-1,0), C_TEAL),
("TEXTCOLOR", (0,0),(-1,0), C_WHITE),
("FONTNAME", (0,0),(-1,0), "Helvetica-Bold"),
("FONTSIZE", (0,0),(-1,-1), 8),
("BACKGROUND", (0,1),(-1,1), C_LTEAL),
("GRID", (0,0),(-1,-1), 0.4, C_MGRAY),
("ALIGN", (0,0),(-1,-1), "CENTER"),
("VALIGN", (0,0),(-1,-1), "MIDDLE"),
("TOPPADDING", (0,0),(-1,-1), 5),
("BOTTOMPADDING", (0,0),(-1,-1), 5),
]))
story.append(chain_tbl)
story.append(colored_box([
Paragraph("💡 NCLEX TIP: Hand hygiene breaks the <b>Mode of Transmission</b>. Covering a cough breaks the <b>Portal of Exit</b>. Identify which link each nursing action targets!", S_TIP)
], bg=C_YELLOW, border=C_ORANGE))
story.append(Spacer(1, 0.3*cm))
# ══════════════════════════════════════════════════════════════════════════
# 2. STANDARD PRECAUTIONS
# ══════════════════════════════════════════════════════════════════════════
story.append(section_header("2. STANDARD PRECAUTIONS (Used with EVERY Patient)", C_GREEN, "🛡"))
story.append(Spacer(1, 0.15*cm))
sp_data = [
["What It Covers", "PPE Required"],
["Blood, ALL body fluids (except sweat),\nnon-intact skin, mucous membranes", "Gloves for any contact with blood/body fluids\nMask + goggles if splash/spray risk\nGown if clothing contamination risk"],
]
sp_tbl = Table(sp_data, colWidths=[W*0.45, W*0.55])
sp_tbl.setStyle(TableStyle([
("BACKGROUND", (0,0),(-1,0), C_GREEN),
("TEXTCOLOR", (0,0),(-1,0), C_WHITE),
("FONTNAME", (0,0),(-1,0), "Helvetica-Bold"),
("FONTSIZE", (0,0),(-1,-1), 8.5),
("BACKGROUND", (0,1),(-1,1), C_LGREEN),
("GRID", (0,0),(-1,-1), 0.4, C_MGRAY),
("VALIGN", (0,0),(-1,-1), "MIDDLE"),
("TOPPADDING", (0,0),(-1,-1), 6),
("BOTTOMPADDING", (0,0),(-1,-1), 6),
("LEFTPADDING", (0,0),(-1,-1), 6),
]))
story.append(sp_tbl)
story.append(colored_box([
Paragraph("⭐ Hand hygiene is the SINGLE MOST EFFECTIVE infection control measure!", S_TIP)
], bg=C_LGREEN, border=C_GREEN))
story.append(Spacer(1, 0.3*cm))
# ══════════════════════════════════════════════════════════════════════════
# 3. TRANSMISSION-BASED PRECAUTIONS
# ══════════════════════════════════════════════════════════════════════════
story.append(section_header("3. TRANSMISSION-BASED PRECAUTIONS", C_RED, "⚠"))
story.append(Spacer(1, 0.15*cm))
# AIRBORNE
ab_hdr = Table([[Paragraph("✈ AIRBORNE PRECAUTIONS (Particles < 5 microns)", S_H1)]],
colWidths=[W])
ab_hdr.setStyle(TableStyle([
("BACKGROUND",(0,0),(-1,-1), C_RED),
("TOPPADDING",(0,0),(-1,-1),5), ("BOTTOMPADDING",(0,0),(-1,-1),5),
("LEFTPADDING",(0,0),(-1,-1),8),
]))
story.append(ab_hdr)
ab_rows = [
["PPE", "N95 Respirator (fit-tested), Gown, Gloves"],
["Room", "NEGATIVE PRESSURE room - door must stay CLOSED"],
["Diseases", "Measles | Tuberculosis (TB) | Varicella (Chickenpox) | Herpes Zoster (disseminated)"],
["Memory Trick", '"My TV Has Airtime" - Measles, TB, Varicella, Herpes Zoster'],
]
ab_tbl = Table(ab_rows, colWidths=[W*0.22, W*0.78])
ab_tbl.setStyle(TableStyle([
("BACKGROUND", (0,0),(0,-1), C_LRED),
("FONTNAME", (0,0),(0,-1), "Helvetica-Bold"),
("FONTSIZE", (0,0),(-1,-1), 8.5),
("ROWBACKGROUNDS",(1,0),(1,-1), [C_WHITE, C_LGRAY, C_WHITE, C_LGRAY]),
("GRID", (0,0),(-1,-1), 0.4, C_MGRAY),
("VALIGN", (0,0),(-1,-1), "MIDDLE"),
("TOPPADDING", (0,0),(-1,-1), 5),
("BOTTOMPADDING", (0,0),(-1,-1), 5),
("LEFTPADDING", (0,0),(-1,-1), 6),
]))
story.append(ab_tbl)
story.append(Spacer(1, 0.2*cm))
# DROPLET
dr_hdr = Table([[Paragraph("💧 DROPLET PRECAUTIONS (Particles > 5 microns, travel < 3 ft)", S_H1)]],
colWidths=[W])
dr_hdr.setStyle(TableStyle([
("BACKGROUND",(0,0),(-1,-1), C_LBLUE),
("TOPPADDING",(0,0),(-1,-1),5), ("BOTTOMPADDING",(0,0),(-1,-1),5),
("LEFTPADDING",(0,0),(-1,-1),8),
]))
story.append(dr_hdr)
dr_rows = [
["PPE", "Surgical Mask, Gown, Gloves"],
["Room", "Private room preferred - door CLOSED"],
["Diseases", "Influenza | Meningitis (bacterial) | Mumps | Rubella | Pertussis | Diphtheria | COVID-19 | Strep pharyngitis"],
["Memory Trick", '"SPIDERMAN" - Sepsis, Pertussis, Influenza, Diphtheria, Epiglottitis, Rubella, Meningitis, Adenovirus, Norovirus'],
]
dr_tbl = Table(dr_rows, colWidths=[W*0.22, W*0.78])
dr_tbl.setStyle(TableStyle([
("BACKGROUND", (0,0),(0,-1), colors.HexColor("#E3F2FD")),
("FONTNAME", (0,0),(0,-1), "Helvetica-Bold"),
("FONTSIZE", (0,0),(-1,-1), 8.5),
("ROWBACKGROUNDS",(1,0),(1,-1), [C_WHITE, C_LGRAY, C_WHITE, C_LGRAY]),
("GRID", (0,0),(-1,-1), 0.4, C_MGRAY),
("VALIGN", (0,0),(-1,-1), "MIDDLE"),
("TOPPADDING", (0,0),(-1,-1), 5),
("BOTTOMPADDING", (0,0),(-1,-1), 5),
("LEFTPADDING", (0,0),(-1,-1), 6),
]))
story.append(dr_tbl)
story.append(Spacer(1, 0.2*cm))
# CONTACT
ct_hdr = Table([[Paragraph("🤝 CONTACT PRECAUTIONS (Direct or indirect touch)", S_H1)]],
colWidths=[W])
ct_hdr.setStyle(TableStyle([
("BACKGROUND",(0,0),(-1,-1), C_ORANGE),
("TOPPADDING",(0,0),(-1,-1),5), ("BOTTOMPADDING",(0,0),(-1,-1),5),
("LEFTPADDING",(0,0),(-1,-1),8),
]))
story.append(ct_hdr)
ct_rows = [
["PPE", "Gloves + Gown (don BEFORE entering room)"],
["Room", "Private room - dedicated equipment (no sharing)"],
["Diseases", "MRSA | VRE | C. difficile | RSV | Scabies | Impetigo | Wound infections | Lice | Herpes simplex"],
["Special Rule", "C. diff: Use SOAP & WATER only - alcohol hand sanitizer does NOT kill spores!"],
]
ct_tbl = Table(ct_rows, colWidths=[W*0.22, W*0.78])
ct_tbl.setStyle(TableStyle([
("BACKGROUND", (0,0),(0,-1), C_LORANGE),
("FONTNAME", (0,0),(0,-1), "Helvetica-Bold"),
("FONTSIZE", (0,0),(-1,-1), 8.5),
("ROWBACKGROUNDS",(1,0),(1,-1), [C_WHITE, C_LGRAY, C_WHITE, C_LGRAY]),
("BACKGROUND", (1,3),(-1,3), C_LRED),
("GRID", (0,0),(-1,-1), 0.4, C_MGRAY),
("VALIGN", (0,0),(-1,-1), "MIDDLE"),
("TOPPADDING", (0,0),(-1,-1), 5),
("BOTTOMPADDING", (0,0),(-1,-1), 5),
("LEFTPADDING", (0,0),(-1,-1), 6),
]))
story.append(ct_tbl)
story.append(Spacer(1, 0.3*cm))
# ══════════════════════════════════════════════════════════════════════════
# 4. PPE DONNING & DOFFING
# ══════════════════════════════════════════════════════════════════════════
story.append(section_header("4. PPE — DONNING & DOFFING ORDER", C_PURPLE, "🥼"))
story.append(Spacer(1, 0.15*cm))
ppe_data = [
["Step", "🟢 DONNING (Putting ON)", "Step", "🔴 DOFFING (Taking OFF)"],
["1", "GOWN (first)", "1", "GLOVES (most contaminated — first)"],
["2", "MASK / N95 Respirator", "2", "GOGGLES / Face Shield"],
["3", "GOGGLES / Face Shield", "3", "GOWN"],
["4", "GLOVES (last — over gown cuffs)", "4", "MASK / Respirator (last)"],
["", "", "✋", "Hand hygiene after EACH step!"],
]
ppe_tbl = Table(ppe_data, colWidths=[W*0.07, W*0.38, W*0.07, W*0.48])
ppe_tbl.setStyle(TableStyle([
("BACKGROUND", (0,0),(-1,0), C_PURPLE),
("TEXTCOLOR", (0,0),(-1,0), C_WHITE),
("FONTNAME", (0,0),(-1,0), "Helvetica-Bold"),
("FONTSIZE", (0,0),(-1,-1), 8.5),
("BACKGROUND", (0,1),(1,-1), colors.HexColor("#F0FFF0")),
("BACKGROUND", (2,1),(3,-1), colors.HexColor("#FFF0F0")),
("BACKGROUND", (2,5),(3,5), C_LRED),
("GRID", (0,0),(-1,-1), 0.4, C_MGRAY),
("VALIGN", (0,0),(-1,-1), "MIDDLE"),
("ALIGN", (0,0),(0,-1), "CENTER"),
("ALIGN", (2,0),(2,-1), "CENTER"),
("FONTNAME", (0,1),(0,-1), "Helvetica-Bold"),
("FONTNAME", (2,1),(2,-1), "Helvetica-Bold"),
("TOPPADDING", (0,0),(-1,-1), 5),
("BOTTOMPADDING", (0,0),(-1,-1), 5),
("LEFTPADDING", (0,0),(-1,-1), 6),
]))
story.append(ppe_tbl)
story.append(colored_box([
Paragraph('💜 Memory: <b>DONNING</b> = "Go Make Good Gloves" (Gown, Mask, Goggles, Gloves)', S_MEMO),
Paragraph('💜 Memory: <b>DOFFING</b> = Gloves first (most dirty) → Mask last (cleanest)', S_MEMO),
], bg=C_LPURPLE, border=C_PURPLE))
story.append(Spacer(1, 0.3*cm))
# ══════════════════════════════════════════════════════════════════════════
# 5. HAND HYGIENE
# ══════════════════════════════════════════════════════════════════════════
story.append(section_header("5. HAND HYGIENE", C_TEAL, "🙌"))
story.append(Spacer(1, 0.15*cm))
hh_rows = [
["Situation", "Method"],
["Routine patient care", "Alcohol-Based Hand Rub (ABHR) OR soap & water"],
["Before eating", "Soap and water only"],
["After using restroom", "Soap and water only"],
["C. difficile patient", "SOAP AND WATER ONLY (alcohol does NOT kill spores)"],
["Visibly soiled hands", "Soap and water only"],
]
hh_tbl = Table(hh_rows, colWidths=[W*0.45, W*0.55])
hh_tbl.setStyle(TableStyle([
("BACKGROUND", (0,0),(-1,0), C_TEAL),
("TEXTCOLOR", (0,0),(-1,0), C_WHITE),
("FONTNAME", (0,0),(-1,0), "Helvetica-Bold"),
("FONTSIZE", (0,0),(-1,-1), 8.5),
("ROWBACKGROUNDS",(0,1),(-1,-1), [C_WHITE, C_LTEAL]),
("BACKGROUND", (0,4),(-1,4), C_LRED),
("GRID", (0,0),(-1,-1), 0.4, C_MGRAY),
("VALIGN", (0,0),(-1,-1), "MIDDLE"),
("TOPPADDING", (0,0),(-1,-1), 5),
("BOTTOMPADDING", (0,0),(-1,-1), 5),
("LEFTPADDING", (0,0),(-1,-1), 6),
]))
story.append(hh_tbl)
story.append(colored_box([
Paragraph("Steps: Wet → Apply soap → Scrub <b>20 seconds</b> (sing Happy Birthday twice) → Rinse → Dry → Turn off faucet with paper towel", S_BODY)
], bg=C_LTEAL, border=C_TEAL))
story.append(Spacer(1, 0.3*cm))
# ══════════════════════════════════════════════════════════════════════════
# 6. DISEASE QUICK REFERENCE TABLE
# ══════════════════════════════════════════════════════════════════════════
story.append(section_header("6. DISEASE → PRECAUTION QUICK REFERENCE", C_NAVY, "📋"))
story.append(Spacer(1, 0.15*cm))
disease_rows = [
["Disease/Condition", "Precaution Type", "Key Notes"],
["Tuberculosis (TB)", "AIRBORNE", "N95, negative pressure room"],
["Measles", "AIRBORNE", "N95, negative pressure room"],
["Varicella (Chickenpox)", "AIRBORNE + CONTACT", "N95 + gown + gloves"],
["Herpes Zoster (dissem.)", "AIRBORNE + CONTACT", "Localized = Standard only"],
["Influenza", "DROPLET", "Surgical mask"],
["COVID-19", "DROPLET + CONTACT", "Mask + gown + gloves"],
["Bacterial Meningitis", "DROPLET", "Until 24 hrs on antibiotics"],
["Mumps / Rubella", "DROPLET", "Surgical mask"],
["Pertussis", "DROPLET", "Until 5 days on antibiotics"],
["MRSA", "CONTACT", "Gown + gloves; dedicated equipment"],
["VRE", "CONTACT", "Gown + gloves; dedicated equipment"],
["C. difficile", "CONTACT", "SOAP & WATER only for hand hygiene!"],
["RSV", "CONTACT", "Gown + gloves"],
["Scabies / Lice", "CONTACT", "Gown + gloves"],
["HIV / AIDS", "STANDARD", "No isolation unless other infection"],
["Hepatitis B / C", "STANDARD", "No isolation unless other infection"],
["Pneumonia (community)", "STANDARD", "No isolation"],
]
col_w = [W*0.38, W*0.26, W*0.36]
d_data = [[Paragraph(h, S_HDRCELL) for h in disease_rows[0]]]
for row in disease_rows[1:]:
prec = row[1]
if "AIRBORNE" in prec:
bg = C_LRED
elif "DROPLET" in prec:
bg = colors.HexColor("#E3F2FD")
elif "CONTACT" in prec:
bg = C_LORANGE
else:
bg = C_LGREEN
d_data.append([Paragraph(row[0], S_CELL), Paragraph(f"<b>{row[1]}</b>", S_CELLB), Paragraph(row[2], S_CELL)])
d_tbl = Table(d_data, colWidths=col_w)
ts = TableStyle([
("BACKGROUND", (0,0),(-1,0), C_NAVY),
("GRID", (0,0),(-1,-1), 0.4, C_MGRAY),
("VALIGN", (0,0),(-1,-1), "MIDDLE"),
("TOPPADDING", (0,0),(-1,-1), 4),
("BOTTOMPADDING", (0,0),(-1,-1), 4),
("LEFTPADDING", (0,0),(-1,-1), 6),
])
for i, row in enumerate(disease_rows[1:], 1):
prec = row[1]
if "AIRBORNE" in prec:
bg = C_LRED
elif "DROPLET" in prec:
bg = colors.HexColor("#E3F2FD")
elif "CONTACT" in prec:
bg = C_LORANGE
else:
bg = C_LGREEN
ts.add("BACKGROUND", (1,i), (1,i), bg)
d_tbl.setStyle(ts)
story.append(d_tbl)
story.append(Spacer(1, 0.3*cm))
# ══════════════════════════════════════════════════════════════════════════
# 7. MEDICAL vs SURGICAL ASEPSIS
# ══════════════════════════════════════════════════════════════════════════
story.append(section_header("7. MEDICAL vs SURGICAL ASEPSIS", C_GREEN, "🧤"))
story.append(Spacer(1, 0.15*cm))
asep_rows = [
["", "Medical Asepsis (Clean)", "Surgical Asepsis (Sterile)"],
["Goal", "Reduce microorganisms", "Eliminate ALL microorganisms"],
["Used For", "Routine care, oral meds, bathing","Wound care, surgery, catheters, IV insertion"],
["Examples", "Hand washing, PPE, isolation", "Sterile gloves, sterile dressing changes, ORs"],
]
asep_tbl = Table(asep_rows, colWidths=[W*0.18, W*0.41, W*0.41])
asep_tbl.setStyle(TableStyle([
("BACKGROUND", (0,0),(-1,0), C_GREEN),
("TEXTCOLOR", (0,0),(-1,0), C_WHITE),
("FONTNAME", (0,0),(-1,0), "Helvetica-Bold"),
("BACKGROUND", (0,0),(0,-1), colors.HexColor("#E8F5E9")),
("FONTNAME", (0,0),(0,-1), "Helvetica-Bold"),
("FONTSIZE", (0,0),(-1,-1), 8.5),
("ROWBACKGROUNDS",(0,1),(-1,-1), [C_WHITE, C_LGRAY, C_WHITE]),
("GRID", (0,0),(-1,-1), 0.4, C_MGRAY),
("VALIGN", (0,0),(-1,-1), "MIDDLE"),
("TOPPADDING", (0,0),(-1,-1), 5),
("BOTTOMPADDING", (0,0),(-1,-1), 5),
("LEFTPADDING", (0,0),(-1,-1), 6),
]))
story.append(asep_tbl)
story.append(colored_box([
Paragraph("<b>Sterile Field Rules:</b> Sterile-to-sterile only | 1-inch border = contaminated | Below waist = contaminated | Moisture = contaminated | If in doubt — throw it out!", S_BODY)
], bg=C_LGREEN, border=C_GREEN))
story.append(Spacer(1, 0.3*cm))
# ══════════════════════════════════════════════════════════════════════════
# 8. HAI PREVENTION BUNDLES
# ══════════════════════════════════════════════════════════════════════════
story.append(section_header("8. HAI PREVENTION BUNDLES", C_LBLUE, "🏥"))
story.append(Spacer(1, 0.15*cm))
hai_data = [
["CAUTI\n(Catheter UTI)", "CLABSI\n(Central Line)", "VAP\n(Ventilator)", "SSI\n(Surgical Site)"],
[
"• Maintain closed drainage\n• Bag BELOW bladder\n• Never on floor\n• Perineal care daily\n• Remove ASAP\n• Do NOT clamp tubing",
"• Max sterile barrier on insertion\n• Chlorhexidine skin prep\n• Change dressing q5-7 days\n• Daily necessity assessment",
"• HOB 30-45 degrees\n• Oral care q2-4h (chlorhexidine)\n• Daily sedation vacations\n• Hand hygiene before circuit",
"• Clip (don't shave) hair\n• Antibiotics 1h before incision\n• Maintain normothermia\n• Blood glucose control post-op"
],
]
hai_tbl = Table(hai_data, colWidths=[W*0.25]*4)
hai_tbl.setStyle(TableStyle([
("BACKGROUND", (0,0),(-1,0), C_LBLUE),
("TEXTCOLOR", (0,0),(-1,0), C_WHITE),
("FONTNAME", (0,0),(-1,0), "Helvetica-Bold"),
("FONTSIZE", (0,0),(-1,-1), 8),
("BACKGROUND", (0,1),(-1,1), colors.HexColor("#E3F2FD")),
("GRID", (0,0),(-1,-1), 0.4, C_MGRAY),
("VALIGN", (0,0),(-1,-1), "TOP"),
("ALIGN", (0,0),(-1,0), "CENTER"),
("TOPPADDING", (0,0),(-1,-1), 5),
("BOTTOMPADDING", (0,0),(-1,-1), 5),
("LEFTPADDING", (0,0),(-1,-1), 6),
]))
story.append(hai_tbl)
story.append(Spacer(1, 0.3*cm))
# ══════════════════════════════════════════════════════════════════════════
# 9. PROTECTIVE / NEUTROPENIC PRECAUTIONS
# ══════════════════════════════════════════════════════════════════════════
story.append(section_header("9. PROTECTIVE / NEUTROPENIC PRECAUTIONS (Reverse Isolation)", C_PURPLE, "🔵"))
story.append(Spacer(1, 0.15*cm))
np_items = [
"Used for: Immunocompromised patients (chemotherapy, organ transplant, severe neutropenia)",
"Room: POSITIVE pressure (air flows OUT - keeps pathogens away from patient)",
"Wear a mask when entering the room",
"No fresh flowers or live plants (harbor bacteria and fungi)",
"No raw fruits or vegetables — cooked/processed foods only",
"Screen all visitors for signs of illness before allowing entry",
"Strict hand hygiene by all staff and visitors",
]
np_tbl = Table([[Paragraph("• " + item, S_BODY)] for item in np_items], colWidths=[W])
np_tbl.setStyle(TableStyle([
("ROWBACKGROUNDS", (0,0),(-1,-1), [C_LPURPLE, C_WHITE]),
("GRID", (0,0),(-1,-1), 0.3, C_MGRAY),
("TOPPADDING", (0,0),(-1,-1), 4),
("BOTTOMPADDING", (0,0),(-1,-1), 4),
("LEFTPADDING", (0,0),(-1,-1), 8),
]))
story.append(np_tbl)
story.append(Spacer(1, 0.3*cm))
# ══════════════════════════════════════════════════════════════════════════
# 10. TOP NCLEX TIPS
# ══════════════════════════════════════════════════════════════════════════
story.append(section_header("10. TOP NCLEX EXAM TIPS", C_RED, "⭐"))
story.append(Spacer(1, 0.15*cm))
tips = [
("N95 for airborne ONLY", "A surgical mask is NOT enough for TB, measles, or varicella."),
("Gloves off FIRST", "When doffing PPE, gloves come off first (most contaminated)."),
("Soap & water for C. diff", "Alcohol-based sanitizer does NOT kill C. diff spores."),
("Negative vs. Positive pressure", "Airborne = Negative pressure | Neutropenic = Positive pressure"),
("Never recap needles", "Use safety devices and sharps containers immediately after use."),
("Assess before isolating", "Initiate precautions early when infection is suspected, don't wait for confirmation."),
("Dedicated equipment", "Contact precautions require dedicated BP cuff, stethoscope, thermometer."),
("Remove mask last", "Mask is the last item removed when doffing — it protects your face."),
]
tips_tbl = Table(
[[Paragraph(f"✅ {t}", S_TIP), Paragraph(d, S_BODY)] for t, d in tips],
colWidths=[W*0.35, W*0.65]
)
tips_tbl.setStyle(TableStyle([
("ROWBACKGROUNDS", (0,0),(-1,-1), [C_LRED, C_WHITE]),
("GRID", (0,0),(-1,-1), 0.3, C_MGRAY),
("VALIGN", (0,0),(-1,-1), "MIDDLE"),
("TOPPADDING", (0,0),(-1,-1), 5),
("BOTTOMPADDING", (0,0),(-1,-1), 5),
("LEFTPADDING", (0,0),(-1,-1), 6),
]))
story.append(tips_tbl)
story.append(Spacer(1, 0.3*cm))
# ── Footer ───────────────────────────────────────────────────────────────
story.append(HRFlowable(width=W, color=C_MGRAY))
story.append(Spacer(1, 0.1*cm))
story.append(Paragraph(
"NCLEX-RN Infection Control Quick Reference | Prepared for NCLEX-RN Exam Preparation | July 2026",
style("footer", fontSize=7.5, textColor=C_MGRAY, alignment=TA_CENTER)
))
# ── Build ────────────────────────────────────────────────────────────────
doc.build(story)
print("PDF created:", OUTPUT)
cd /home/daytona/workspace/nclex-pdf && python create_pdf.py
Infection Control NCLEX QuickRef
PDF Document · PDF
| Section | Content |
|---|---|
| 🔗 Chain of Infection | All 6 links with nursing interventions |
| 🛡 Standard Precautions | What they cover + PPE guide |
| ⚠ Transmission-Based Precautions | Airborne, Droplet, Contact - color-coded with memory tricks |
| 🥼 PPE Donning & Doffing | Step-by-step order table |
| 🙌 Hand Hygiene | When to use soap vs. sanitizer |
| 📋 Disease Quick Reference | 17 diseases mapped to precaution type |
| 🧤 Medical vs Surgical Asepsis | Comparison + sterile field rules |
| 🏥 HAI Prevention Bundles | CAUTI, CLABSI, VAP, SSI |
| 🔵 Neutropenic Precautions | Reverse isolation rules |
| ⭐ Top NCLEX Tips | 8 high-yield exam reminders |
Wow thats Soo amezing
| Topic | What's Inside |
|---|---|
| 💊 Fluids & Electrolytes | Hypo/hyperkalemia, IV fluids, signs & symptoms |
| 🩺 Vital Signs | Normal ranges, abnormal findings, nursing actions |
| 💉 Medications (High-Alert) | Insulin, heparin, digoxin, potassium rules |
| 🧠 Maslow + Nursing Process | Priority setting, ADPIE, delegation rules |
| 🫀 Cardiac Basics | Heart rhythms, MI signs, medications |
| 🤰 Maternity / OB | Labor stages, fetal monitoring, postpartum care |
| 👶 Pediatrics | Growth milestones, common illnesses, immunizations |
| 🧬 Lab Values | Complete reference with normal ranges + significance |
Electrolytes pdf proper explain woth memory tricks
~/nclex-pdf/create_electrolytes_pdf.py
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import cm
from reportlab.platypus import (
SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
HRFlowable, PageBreak
)
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_CENTER, TA_LEFT
OUTPUT = "/home/daytona/workspace/nclex-pdf/Electrolytes_NCLEX_QuickRef.pdf"
# ── Colors ─────────────────────────────────────────────────────────────
C_NAVY = colors.HexColor("#0D1B2A")
C_BLUE = colors.HexColor("#1565C0")
C_LBLUE = colors.HexColor("#1E88E5")
C_ELBLUE = colors.HexColor("#E3F2FD")
C_GREEN = colors.HexColor("#2E7D32")
C_LGREEN = colors.HexColor("#E8F5E9")
C_RED = colors.HexColor("#C62828")
C_LRED = colors.HexColor("#FFEBEE")
C_ORANGE = colors.HexColor("#E65100")
C_LORANGE = colors.HexColor("#FFF3E0")
C_PURPLE = colors.HexColor("#6A1B9A")
C_LPURPLE = colors.HexColor("#F3E5F5")
C_TEAL = colors.HexColor("#00695C")
C_LTEAL = colors.HexColor("#E0F2F1")
C_YELLOW = colors.HexColor("#FFF9C4")
C_DYELLOW = colors.HexColor("#F9A825")
C_LGRAY = colors.HexColor("#F5F5F5")
C_MGRAY = colors.HexColor("#BDBDBD")
C_WHITE = colors.white
C_PINK = colors.HexColor("#FCE4EC")
C_DPINK = colors.HexColor("#AD1457")
C_BROWN = colors.HexColor("#4E342E")
C_LBROWN = colors.HexColor("#EFEBE9")
C_INDIGO = colors.HexColor("#283593")
C_LINDIGO = colors.HexColor("#E8EAF6")
doc = SimpleDocTemplate(
OUTPUT, pagesize=A4,
rightMargin=1.4*cm, leftMargin=1.4*cm,
topMargin=1.4*cm, bottomMargin=1.4*cm
)
W = A4[0] - 2.8*cm
styles = getSampleStyleSheet()
def S(name, **kw):
return ParagraphStyle(name, parent=styles["Normal"], **kw)
S_TITLE = S("t", fontSize=22, textColor=C_WHITE, alignment=TA_CENTER, fontName="Helvetica-Bold", leading=28)
S_SUB = S("s", fontSize=10, textColor=colors.HexColor("#B3E5FC"), alignment=TA_CENTER, fontName="Helvetica", leading=14)
S_H1 = S("h1", fontSize=12, textColor=C_WHITE, fontName="Helvetica-Bold", leading=16, leftIndent=6)
S_H2 = S("h2", fontSize=10, textColor=C_NAVY, fontName="Helvetica-Bold", leading=14)
S_BODY = S("b", fontSize=8.5,textColor=C_NAVY, fontName="Helvetica", leading=12)
S_BOLD = S("bb", fontSize=8.5,textColor=C_NAVY, fontName="Helvetica-Bold", leading=12)
S_TRICK = S("tr", fontSize=9, textColor=C_PURPLE, fontName="Helvetica-BoldOblique", leading=13, leftIndent=4)
S_WARN = S("w", fontSize=9, textColor=C_RED, fontName="Helvetica-Bold", leading=13, leftIndent=4)
S_TIP = S("tp", fontSize=9, textColor=C_GREEN, fontName="Helvetica-Bold", leading=13, leftIndent=4)
S_HDR = S("hd", fontSize=9, textColor=C_WHITE, fontName="Helvetica-Bold", alignment=TA_CENTER, leading=12)
S_CELL = S("c", fontSize=8.5,textColor=C_NAVY, fontName="Helvetica", leading=12)
S_CELLB = S("cb", fontSize=8.5,textColor=C_NAVY, fontName="Helvetica-Bold", leading=12)
S_CTR = S("ct", fontSize=8.5,textColor=C_NAVY, fontName="Helvetica", alignment=TA_CENTER, leading=12)
S_FOOTER = S("f", fontSize=7.5,textColor=C_MGRAY, fontName="Helvetica", alignment=TA_CENTER)
def sec_hdr(text, bg=C_BLUE):
t = Table([[Paragraph(text, S_H1)]], colWidths=[W])
t.setStyle(TableStyle([
("BACKGROUND",(0,0),(-1,-1), bg),
("TOPPADDING",(0,0),(-1,-1),6), ("BOTTOMPADDING",(0,0),(-1,-1),6),
("LEFTPADDING",(0,0),(-1,-1),10),
]))
return t
def box(items, bg=C_LGRAY, border=C_MGRAY):
if not isinstance(items, list): items = [items]
t = Table([[items]], colWidths=[W])
t.setStyle(TableStyle([
("BACKGROUND",(0,0),(-1,-1), bg),
("BOX",(0,0),(-1,-1),0.8,border),
("TOPPADDING",(0,0),(-1,-1),5), ("BOTTOMPADDING",(0,0),(-1,-1),5),
("LEFTPADDING",(0,0),(-1,-1),8), ("RIGHTPADDING",(0,0),(-1,-1),8),
]))
return t
def two_col(left_items, right_items, lbg=C_LRED, rbg=C_LGREEN, lborder=C_RED, rborder=C_GREEN):
lw, rw = W*0.495, W*0.495
lt = Table([[left_items]], colWidths=[lw])
rt = Table([[right_items]], colWidths=[rw])
lt.setStyle(TableStyle([("BACKGROUND",(0,0),(-1,-1),lbg),("BOX",(0,0),(-1,-1),0.8,lborder),
("TOPPADDING",(0,0),(-1,-1),5),("BOTTOMPADDING",(0,0),(-1,-1),5),
("LEFTPADDING",(0,0),(-1,-1),7)]))
rt.setStyle(TableStyle([("BACKGROUND",(0,0),(-1,-1),rbg),("BOX",(0,0),(-1,-1),0.8,rborder),
("TOPPADDING",(0,0),(-1,-1),5),("BOTTOMPADDING",(0,0),(-1,-1),5),
("LEFTPADDING",(0,0),(-1,-1),7)]))
outer = Table([[lt, Spacer(W*0.01,1), rt]], colWidths=[lw, W*0.01, rw])
outer.setStyle(TableStyle([("VALIGN",(0,0),(-1,-1),"TOP")]))
return outer
def elec_block(name, normal, fun, hypo_name, hypo_causes, hypo_sx, hypo_tx,
hyper_name, hyper_causes, hyper_sx, hyper_tx,
memory, nclex_tips, accent):
story = []
# Header
hdr = Table([[Paragraph(f"⚡ {name} | Normal: {normal}", S_H1)]], colWidths=[W])
hdr.setStyle(TableStyle([("BACKGROUND",(0,0),(-1,-1),accent),
("TOPPADDING",(0,0),(-1,-1),7),("BOTTOMPADDING",(0,0),(-1,-1),7),
("LEFTPADDING",(0,0),(-1,-1),10)]))
story.append(hdr)
# Function box
story.append(box([Paragraph(f"<b>Function:</b> {fun}", S_BODY)], bg=C_LGRAY, border=accent))
# Memory trick
story.append(box([Paragraph(f"🧠 Memory Trick: {memory}", S_TRICK)], bg=C_LPURPLE, border=C_PURPLE))
# Hypo vs Hyper side by side
def make_side(title, causes, sx, tx, bg, border, title_bg):
hdr_t = Table([[Paragraph(title, S_H1)]], colWidths=[W*0.495])
hdr_t.setStyle(TableStyle([("BACKGROUND",(0,0),(-1,-1),title_bg),
("TOPPADDING",(0,0),(-1,-1),4),("BOTTOMPADDING",(0,0),(-1,-1),4),
("LEFTPADDING",(0,0),(-1,-1),6)]))
rows = [
[Paragraph("<b>Causes:</b>", S_BOLD)],
]
for c in causes:
rows.append([Paragraph(f" • {c}", S_CELL)])
rows.append([Paragraph("<b>Signs & Symptoms:</b>", S_BOLD)])
for s in sx:
rows.append([Paragraph(f" • {s}", S_CELL)])
rows.append([Paragraph("<b>Nursing Interventions:</b>", S_BOLD)])
for t in tx:
rows.append([Paragraph(f" • {t}", S_CELL)])
content_tbl = Table(rows, colWidths=[W*0.495])
content_tbl.setStyle(TableStyle([
("BACKGROUND",(0,0),(-1,-1),bg),
("ROWBACKGROUNDS",(0,0),(-1,-1),[bg, colors.HexColor(bg.hexval().replace("#","#")+"10") if hasattr(bg,"hexval") else bg]),
("TOPPADDING",(0,0),(-1,-1),3),("BOTTOMPADDING",(0,0),(-1,-1),3),
("LEFTPADDING",(0,0),(-1,-1),6),
]))
return [hdr_t, content_tbl]
left_items = make_side(hypo_name, hypo_causes, hypo_sx, hypo_tx, C_LRED, C_RED, C_RED)
right_items = make_side(hyper_name, hyper_causes, hyper_sx, hyper_tx, C_LGREEN, C_GREEN, C_GREEN)
lw = rw = W*0.495
combo = Table([[left_items, Spacer(W*0.01,1), right_items]], colWidths=[lw, W*0.01, rw])
combo.setStyle(TableStyle([("VALIGN",(0,0),(-1,-1),"TOP")]))
story.append(combo)
# NCLEX tips
tip_rows = [[Paragraph(f"✅ {t}", S_TIP)] for t in nclex_tips]
tip_tbl = Table(tip_rows, colWidths=[W])
tip_tbl.setStyle(TableStyle([
("ROWBACKGROUNDS",(0,0),(-1,-1),[C_LGREEN, C_WHITE]),
("GRID",(0,0),(-1,-1),0.3,C_MGRAY),
("TOPPADDING",(0,0),(-1,-1),4),("BOTTOMPADDING",(0,0),(-1,-1),4),
("LEFTPADDING",(0,0),(-1,-1),6),
]))
story.append(tip_tbl)
story.append(Spacer(1, 0.3*cm))
return story
story = []
# ══════ TITLE ══════════════════════════════════════════════════════════
title_tbl = Table([
[Paragraph("⚡ ELECTROLYTES", S_TITLE)],
[Paragraph("NCLEX-RN Complete Quick Reference", S_SUB)],
[Paragraph("Na • K • Ca • Mg • Phosphorus • Chloride | Normal Values • Causes • Signs & Symptoms • Nursing Actions • Memory Tricks", S_SUB)],
], colWidths=[W])
title_tbl.setStyle(TableStyle([
("BACKGROUND",(0,0),(-1,-1),C_NAVY),
("TOPPADDING",(0,0),(-1,-1),4),("BOTTOMPADDING",(0,0),(-1,-1),4),
("LEFTPADDING",(0,0),(-1,-1),10),
("ROWBACKGROUNDS",(0,0),(-1,-1),[C_NAVY]),
]))
story.append(title_tbl)
story.append(Spacer(1,0.25*cm))
# ══════ NORMAL VALUES OVERVIEW ══════════════════════════════════════════
story.append(sec_hdr("📊 NORMAL ELECTROLYTE VALUES — Quick Glance", C_NAVY))
story.append(Spacer(1,0.1*cm))
nv_rows = [
["Electrolyte", "Normal Range", "Critical Low", "Critical High", "Primary Function"],
["Sodium (Na⁺)", "135–145 mEq/L", "< 120 mEq/L", "> 160 mEq/L", "Fluid balance, nerve/muscle function"],
["Potassium (K⁺)", "3.5–5.0 mEq/L", "< 2.5 mEq/L", "> 6.5 mEq/L", "Heart rhythm, muscle contraction"],
["Calcium (Ca²⁺)", "8.5–10.5 mg/dL","< 7.0 mg/dL", "> 13.0 mg/dL","Bone/teeth, clotting, nerve/muscle"],
["Magnesium (Mg²⁺)", "1.5–2.5 mEq/L", "< 1.0 mEq/L", "> 4.0 mEq/L", "Enzyme reactions, nerve/muscle"],
["Phosphorus (PO₄³⁻)","2.5–4.5 mg/dL", "< 1.0 mg/dL", "> 8.0 mg/dL", "Bone formation, energy (ATP)"],
["Chloride (Cl⁻)", "96–106 mEq/L", "< 80 mEq/L", "> 115 mEq/L", "Acid-base balance, fluid balance"],
]
nv_tbl = Table(
[[Paragraph(c, S_HDR if i==0 else (S_CELLB if j==0 else S_CELL))
for j,c in enumerate(row)] for i,row in enumerate(nv_rows)],
colWidths=[W*0.19, W*0.17, W*0.14, W*0.14, W*0.36]
)
nv_tbl.setStyle(TableStyle([
("BACKGROUND",(0,0),(-1,0),C_NAVY),
("ROWBACKGROUNDS",(0,1),(-1,-1),[C_WHITE, C_LGRAY]),
("GRID",(0,0),(-1,-1),0.4,C_MGRAY),
("VALIGN",(0,0),(-1,-1),"MIDDLE"),
("TOPPADDING",(0,0),(-1,-1),5),("BOTTOMPADDING",(0,0),(-1,-1),5),
("LEFTPADDING",(0,0),(-1,-1),5),
]))
story.append(nv_tbl)
story.append(box([Paragraph(
"🧠 Memory: <b>\"Sally Keeps Calcium Manageable Physically with Chloride\"</b> → Na, K, Ca, Mg, PO₄, Cl", S_TRICK)],
bg=C_LPURPLE, border=C_PURPLE))
story.append(Spacer(1,0.25*cm))
# ══════════════════════════════════════════════════════════════════════
# SODIUM
# ══════════════════════════════════════════════════════════════════════
story += elec_block(
name="SODIUM (Na⁺)", normal="135–145 mEq/L",
fun="Controls fluid balance (where sodium goes, water follows); nerve impulse transmission; blood pressure regulation.",
hypo_name="🔵 HYPONATREMIA (Na⁺ < 135)",
hypo_causes=["Excessive water intake (SIADH)","Prolonged vomiting/diarrhea","Heart failure, cirrhosis, renal failure","Excessive hypotonic IV fluids","Diuretic use"],
hypo_sx=["Headache, confusion, lethargy","Nausea & vomiting","Muscle cramps, weakness","Seizures (severe < 120)","Cerebral edema → ↑ ICP"],
hypo_tx=["Restrict fluid intake","Hypertonic saline (3% NaCl) for severe","Monitor neuro status q1-2h","Correct SLOWLY (risk: osmotic demyelination)","Daily weights, strict I&O"],
hyper_name="🔴 HYPERNATREMIA (Na⁺ > 145)",
hyper_causes=["Inadequate water intake","Excessive sodium intake","Diabetes insipidus","Watery diarrhea","Excessive sweating"],
hyper_sx=["Thirst (earliest sign)","Dry sticky mucous membranes","Restlessness, agitation","Decreased LOC (severe)","Seizures, coma (severe)"],
hyper_tx=["Increase water intake (oral or IV)","Hypotonic IV fluids (0.45% NaCl)","Correct SLOWLY (risk: cerebral edema)","Monitor fluid status, daily weights","Treat underlying cause"],
memory="🧂 Sodium = SALT = THIRST. HIGH Na → THIRST (dry), LOW Na → BRAIN SWELLS (neuro sx). Water follows sodium — low sodium = water flooding brain!",
nclex_tips=[
"Thirst is the EARLIEST sign of hypernatremia",
"Correct sodium SLOWLY — rapid correction of hyponatremia → osmotic demyelination; hypernatremia → cerebral edema",
"SIADH causes hyponatremia — treat with fluid restriction",
"Seizure precautions for Na⁺ < 120 mEq/L",
],
accent=C_LBLUE
)
# ══════════════════════════════════════════════════════════════════════
# POTASSIUM
# ══════════════════════════════════════════════════════════════════════
story += elec_block(
name="POTASSIUM (K⁺)", normal="3.5–5.0 mEq/L",
fun="Maintains resting membrane potential; regulates heart rhythm and muscle contraction; acid-base balance.",
hypo_name="🔵 HYPOKALEMIA (K⁺ < 3.5)",
hypo_causes=["Diuretics (loop/thiazide — #1 cause)","Vomiting, diarrhea, NG suction","Insufficient dietary intake","Alkalosis (K⁺ shifts into cells)","Insulin administration"],
hypo_sx=["Muscle weakness, fatigue (legs first)","Leg cramps","Constipation, paralytic ileus","Cardiac dysrhythmias (PVCs, V-fib)","ECG: Flat/inverted T-waves, U-waves"],
hypo_tx=["KCl oral supplement (preferred)","IV KCl — NEVER give IV push (fatal!)","Max IV rate: 10–20 mEq/hr","Increase dietary K⁺ (bananas, oranges)","Monitor cardiac rhythm continuously"],
hyper_name="🔴 HYPERKALEMIA (K⁺ > 5.0)",
hyper_causes=["Renal failure (#1 cause)","Potassium-sparing diuretics","ACE inhibitors","Acidosis (K⁺ shifts out of cells)","Excessive IV potassium","Massive cell destruction (burns, trauma)"],
hyper_sx=["Muscle weakness, fatigue","Nausea, diarrhea","Peaked (tall) T-waves on ECG","Widened QRS, sine wave pattern","Ventricular fibrillation → cardiac arrest"],
hyper_tx=["Calcium gluconate (stabilizes heart — FIRST)","Sodium bicarbonate (shifts K⁺ into cells)","Insulin + dextrose (shifts K⁺ into cells)","Kayexalate (removes K⁺ from body)","Dialysis (severe/renal failure)","Restrict dietary potassium"],
memory="💪 K⁺ = MUSCLES & HEART. LOW K = WEAK (muscles), FLAT T-wave, U-wave. HIGH K = PEAKED T-wave → CARDIAC ARREST. Think: Low K = U see a U-wave!",
nclex_tips=[
"NEVER give IV potassium as IV push or bolus — it is fatal!",
"Max IV KCl rate: 10–20 mEq/hr, always diluted",
"Loop diuretics (furosemide) cause hypoKALEMIA — give K⁺ supplements",
"Peaked T-waves = hyperkalemia; Flat T-wave + U-wave = hypokalemia",
"Calcium gluconate is the FIRST treatment for dangerous hyperkalemia (stabilizes cardiac membrane)",
],
accent=C_GREEN
)
# ══════════════════════════════════════════════════════════════════════
# CALCIUM
# ══════════════════════════════════════════════════════════════════════
story += elec_block(
name="CALCIUM (Ca²⁺)", normal="8.5–10.5 mg/dL (Ionized: 4.5–5.1 mg/dL)",
fun="Bone and teeth formation; muscle contraction and relaxation; blood clotting; nerve transmission.",
hypo_name="🔵 HYPOCALCEMIA (Ca²⁺ < 8.5)",
hypo_causes=["Hypoparathyroidism (post thyroid/parathyroid surgery)","Vitamin D deficiency","Chronic renal failure","Hypomagnesemia","Alkalosis","Pancreatitis"],
hypo_sx=["Trousseau's sign (carpopedal spasm with BP cuff)","Chvostek's sign (facial twitch when tapping CN VII)","Tetany, muscle cramps","Numbness/tingling (perioral, fingers, toes)","Seizures","Prolonged QT interval on ECG"],
hypo_tx=["IV calcium gluconate (emergency)","Oral calcium supplements with Vitamin D","High-calcium diet (dairy, green leafy veggies)","Correct hypomagnesemia","Seizure and safety precautions"],
hyper_name="🔴 HYPERCALCEMIA (Ca²⁺ > 10.5)",
hyper_causes=["Hyperparathyroidism (#1 cause)","Malignancy (bone metastases)","Prolonged immobility","Excess Vitamin D","Thiazide diuretics","Paget's disease"],
hyper_sx=["'Bones, Groans, Moans, Psychic Overtones'","Bone pain, fractures","Nausea, vomiting, constipation","Fatigue, muscle weakness","Confusion, depression, psychosis","Kidney stones, polyuria"],
hyper_tx=["IV normal saline (dilutes calcium — FIRST)","Loop diuretics (furosemide) to excrete Ca²⁺","Bisphosphonates (long-term)","Calcitonin","Corticosteroids","Mobilize patient if possible"],
memory="🦴 Ca = BONES, CLOTS, CONTRACTS. LOW Ca = TWITCHY (Trousseau + Chvostek). HIGH Ca = 'BONES, GROANS, MOANS & PSYCHIC OVERTONES' (bone pain, GI upset, psych sx). TROUSSEAU'S = BP cuff. CHVOSTEK'S = Cheek tap.",
nclex_tips=[
"Check Trousseau's: inflate BP cuff 20 mmHg above systolic for 3 min → carpopedal spasm = positive",
"Check Chvostek's: tap facial nerve in front of ear → facial muscle twitch = positive",
"Post thyroid surgery: monitor for hypocalcemia (removed/damaged parathyroid glands)",
"'Bones, Groans, Moans, Psychic Overtones' = classic hypercalcemia mnemonic",
"First treatment for hypercalcemia = IV Normal Saline (hydration)",
],
accent=C_ORANGE
)
# ══════════════════════════════════════════════════════════════════════
# MAGNESIUM
# ══════════════════════════════════════════════════════════════════════
story += elec_block(
name="MAGNESIUM (Mg²⁺)", normal="1.5–2.5 mEq/L",
fun="Enzyme co-factor for 300+ reactions; nerve/muscle function; regulates calcium and potassium levels; cardiac rhythm.",
hypo_name="🔵 HYPOMAGNESEMIA (Mg²⁺ < 1.5)",
hypo_causes=["Alcoholism (#1 cause)","Prolonged malnutrition/malabsorption","Diarrhea, vomiting, NG suction","Diuretics (loop/thiazide)","Diabetic ketoacidosis (DKA)"],
hypo_sx=["Tremors, muscle twitching","Hyperreflexia (↑ deep tendon reflexes)","Positive Trousseau's & Chvostek's","Cardiac dysrhythmias (torsades de pointes)","Confusion, agitation","Dysphagia"],
hypo_tx=["IV magnesium sulfate (MgSO₄) for severe","Oral magnesium supplements (mild)","High-Mg diet (nuts, whole grains, green veggies)","Correct hypokalemia and hypocalcemia (often coexist)","Monitor DTRs during IV replacement"],
hyper_name="🔴 HYPERMAGNESEMIA (Mg²⁺ > 2.5)",
hyper_causes=["Renal failure (#1 cause)","Excessive Mg antacids or laxatives","Excessive IV magnesium (eclampsia tx)","Adrenal insufficiency"],
hyper_sx=["Flushing, feeling of warmth","Nausea, vomiting","LOSS of deep tendon reflexes (DTRs) — FIRST sign","Hypotension","Respiratory depression","Cardiac arrest (severe)"],
hyper_tx=["Calcium gluconate (antidote — antagonizes Mg)","Stop all Mg-containing medications","IV fluids + diuretics","Dialysis (severe)","Respiratory support if needed"],
memory="🍺 LOW Mg = SHAKY & HYPERACTIVE (tremors, ↑DTRs) — alcoholics! HIGH Mg = EVERYTHING SLOWS DOWN (↓DTRs → resp depression → cardiac arrest). CALCIUM GLUCONATE = antidote for Mg toxicity!",
nclex_tips=[
"Monitor DTRs during IV magnesium — LOSS of DTRs is the FIRST sign of toxicity",
"Calcium gluconate is the antidote for magnesium sulfate toxicity",
"Keep calcium gluconate at bedside when giving IV MgSO₄ (e.g., preeclampsia patients)",
"Hypomagnesemia often coexists with hypokalemia and hypocalcemia — treat all three",
"Normal respiratory rate must be > 12/min before each IV Mg dose",
],
accent=C_TEAL
)
# ══════════════════════════════════════════════════════════════════════
# PHOSPHORUS
# ══════════════════════════════════════════════════════════════════════
story += elec_block(
name="PHOSPHORUS (PO₄³⁻)", normal="2.5–4.5 mg/dL",
fun="Bone and teeth formation; energy production (ATP); cell membrane structure; acid-base balance.",
hypo_name="🔵 HYPOPHOSPHATEMIA (PO₄³⁻ < 2.5)",
hypo_causes=["Malnutrition, anorexia","Refeeding syndrome","Antacid overuse (binds phosphorus)","Hyperparathyroidism","Chronic alcoholism","Respiratory alkalosis"],
hypo_sx=["Muscle weakness (including respiratory muscles)","Fatigue","Confusion, irritability","Bone pain, fractures","Hemolytic anemia","Difficulty weaning from ventilator"],
hypo_tx=["Oral phosphate supplements","IV sodium or potassium phosphate (severe)","Phosphate-rich diet (dairy, meat, nuts)","Stop phosphate-binding antacids","Correct underlying cause"],
hyper_name="🔴 HYPERPHOSPHATEMIA (PO₄³⁻ > 4.5)",
hyper_causes=["Chronic renal failure (#1 cause)","Hypoparathyroidism","Excessive phosphate laxatives/enemas","Tumor lysis syndrome","Rhabdomyolysis"],
hyper_sx=["Hypocalcemia symptoms (calcium-phosphate inverse relationship)","Tetany, muscle cramps","Chvostek's/Trousseau's signs","Calcification of soft tissues","Pruritus (itching)","Bone pain"],
hyper_tx=["Phosphate-restricted diet","Phosphate binders with meals (calcium carbonate, sevelamer)","Dialysis (renal failure)","Correct hypocalcemia","Increase fluid intake"],
memory="⚡ P = POWER (ATP/Energy). LOW P = NO ENERGY (weak muscles, can't breathe). HIGH P = STEALS CALCIUM → tetany. Ca & P are INVERSELY related: ↑P = ↓Ca!",
nclex_tips=[
"Calcium and phosphorus have an INVERSE relationship — high phosphorus causes low calcium symptoms",
"Refeeding syndrome causes dangerous hypophosphatemia — monitor carefully when restarting nutrition",
"Phosphate binders (calcium carbonate) must be given WITH meals to work",
"Chronic renal failure patients are at high risk for hyperphosphatemia",
],
accent=C_DPINK
)
# ══════════════════════════════════════════════════════════════════════
# IV FLUIDS REFERENCE
# ══════════════════════════════════════════════════════════════════════
story.append(sec_hdr("💉 IV FLUID TYPES — NCLEX Quick Reference", C_INDIGO))
story.append(Spacer(1,0.1*cm))
iv_rows = [
["Type", "Examples", "Tonicity", "Effect on Cells", "NCLEX Use"],
["Isotonic","0.9% NaCl (NS)\nLactated Ringer's (LR)\nD5W (acts isotonic in bag)","Same as blood (275–295 mOsm/L)","No shift — cells stay same size","Fluid replacement, hypovolemia, pre/post-op, blood transfusion"],
["Hypotonic","0.45% NaCl (½NS)\n0.33% NaCl\nD2.5W","Lower than blood (< 275 mOsm/L)","Water moves INTO cells → cells SWELL","Cellular dehydration, hypernatremia, DKA maintenance"],
["Hypertonic","3% NaCl\nD5NS\nD5½NS\nD10W","Higher than blood (> 295 mOsm/L)","Water moves OUT of cells → cells SHRINK","Severe hyponatremia, cerebral edema, SIADH"],
]
iv_tbl = Table(
[[Paragraph(c, S_HDR if i==0 else (S_CELLB if j==0 else S_CELL))
for j,c in enumerate(row)] for i,row in enumerate(iv_rows)],
colWidths=[W*0.14, W*0.22, W*0.18, W*0.18, W*0.28]
)
iv_tbl.setStyle(TableStyle([
("BACKGROUND",(0,0),(-1,0),C_INDIGO),
("BACKGROUND",(0,1),(-1,1),C_LGREEN),
("BACKGROUND",(0,2),(-1,2),C_ELBLUE),
("BACKGROUND",(0,3),(-1,3),C_LRED),
("GRID",(0,0),(-1,-1),0.4,C_MGRAY),
("VALIGN",(0,0),(-1,-1),"MIDDLE"),
("TOPPADDING",(0,0),(-1,-1),5),("BOTTOMPADDING",(0,0),(-1,-1),5),
("LEFTPADDING",(0,0),(-1,-1),5),
]))
story.append(iv_tbl)
story.append(box([
Paragraph("🧠 Memory: <b>ISO = same, HYPO = cells swell (water in), HYPER = cells shrink (water out)</b>", S_TRICK),
Paragraph("⚠ Do NOT give hypotonic fluids to head injury patients (increases cerebral edema). Do NOT give hypertonic fluids fast (causes cell dehydration).", S_WARN),
], bg=C_YELLOW, border=C_DYELLOW))
story.append(Spacer(1,0.25*cm))
# ══════════════════════════════════════════════════════════════════════
# ELECTROLYTE INTERACTIONS
# ══════════════════════════════════════════════════════════════════════
story.append(sec_hdr("🔄 KEY ELECTROLYTE INTERACTIONS & RELATIONSHIPS", C_BROWN))
story.append(Spacer(1,0.1*cm))
int_rows = [
["Relationship", "Clinical Significance"],
["Ca²⁺ ↑ ↔ PO₄³⁻ ↓ (Inverse)", "When phosphorus goes up, calcium goes down and vice versa. Seen in renal failure."],
["Mg²⁺ ↓ → K⁺ ↓ and Ca²⁺ ↓", "Hypomagnesemia causes refractory hypokalemia and hypocalcemia. Must correct Mg first!"],
["Acidosis → K⁺ ↑ (Hyperkalemia)", "H⁺ ions move into cells, K⁺ moves out. Every 0.1 pH drop ↑ K⁺ by ~0.5 mEq/L."],
["Alkalosis → K⁺ ↓ (Hypokalemia)", "H⁺ ions move out of cells, K⁺ moves in. Vomiting (alkalosis) causes hypokalemia."],
["Insulin → K⁺ ↓ (shifts into cells)","Used therapeutically in hyperkalemia (insulin + dextrose drives K⁺ into cells)."],
["Loop diuretics → K⁺ ↓, Mg²⁺ ↓", "Furosemide wastes both potassium and magnesium. Monitor both electrolytes."],
]
int_tbl = Table(
[[Paragraph(c, S_HDR if i==0 else (S_CELLB if j==0 else S_CELL))
for j,c in enumerate(row)] for i,row in enumerate(int_rows)],
colWidths=[W*0.38, W*0.62]
)
int_tbl.setStyle(TableStyle([
("BACKGROUND",(0,0),(-1,0),C_BROWN),
("ROWBACKGROUNDS",(0,1),(-1,-1),[C_LBROWN, C_WHITE]),
("GRID",(0,0),(-1,-1),0.4,C_MGRAY),
("VALIGN",(0,0),(-1,-1),"MIDDLE"),
("TOPPADDING",(0,0),(-1,-1),5),("BOTTOMPADDING",(0,0),(-1,-1),5),
("LEFTPADDING",(0,0),(-1,-1),6),
]))
story.append(int_tbl)
story.append(Spacer(1,0.25*cm))
# ══════════════════════════════════════════════════════════════════════
# TOP NCLEX TIPS SUMMARY
# ══════════════════════════════════════════════════════════════════════
story.append(sec_hdr("⭐ TOP NCLEX EXAM TIPS — Electrolytes", C_RED))
story.append(Spacer(1,0.1*cm))
top_tips = [
("NEVER give IV K⁺ push", "Always dilute, max rate 10–20 mEq/hr. IV push = fatal cardiac arrest."),
("Calcium gluconate = universal antidote", "For hyperkalemia (stabilizes heart) AND hypermagnesemia (antagonizes Mg)."),
("Assess DTRs with IV MgSO₄", "Loss of DTRs is the first sign of magnesium toxicity — hold Mg if absent."),
("Keep Ca gluconate at bedside", "Any patient on IV magnesium sulfate (eclampsia/preeclampsia) needs this nearby."),
("Correct electrolytes SLOWLY", "Rapid sodium correction → osmotic demyelination (hypo) or cerebral edema (hyper)."),
("Trousseau's + Chvostek's = low Ca (or Mg)", "Both signs indicate neuromuscular irritability from low calcium or magnesium."),
("Renal failure → high K, high P, low Ca", "Classic triad of chronic renal failure electrolyte imbalances."),
("Diuretics: Loop = wastes K, Mg | Thiazide = wastes K | K-sparing = saves K", "Know which diuretic causes which imbalance."),
("Peaked T-wave on ECG = HYPERKALEMIA", "Flat/inverted T-wave + U-wave = hypokalemia. ECG is key for K⁺ imbalances."),
("Thirst = earliest sign of hypernatremia", "Always assess for thirst and mucous membrane dryness."),
]
tip_data = [[Paragraph(f"✅ {t}", S_WARN), Paragraph(d, S_BODY)] for t,d in top_tips]
tip_tbl = Table(tip_data, colWidths=[W*0.35, W*0.65])
tip_tbl.setStyle(TableStyle([
("ROWBACKGROUNDS",(0,0),(-1,-1),[C_LRED, C_WHITE]),
("GRID",(0,0),(-1,-1),0.3,C_MGRAY),
("VALIGN",(0,0),(-1,-1),"MIDDLE"),
("TOPPADDING",(0,0),(-1,-1),5),("BOTTOMPADDING",(0,0),(-1,-1),5),
("LEFTPADDING",(0,0),(-1,-1),6),
]))
story.append(tip_tbl)
story.append(Spacer(1,0.2*cm))
# ── Footer ─────────────────────────────────────────────────────────────
story.append(HRFlowable(width=W, color=C_MGRAY))
story.append(Spacer(1,0.1*cm))
story.append(Paragraph(
"NCLEX-RN Electrolytes Quick Reference | Prepared for NCLEX-RN Exam Preparation | July 2026 | Na • K • Ca • Mg • PO₄ • Cl",
S_FOOTER
))
doc.build(story)
print("PDF created:", OUTPUT)
cd /home/daytona/workspace/nclex-pdf && python create_electrolytes_pdf.py
make_side helper. Let me fix that:~/nclex-pdf/create_electrolytes_pdf.py
Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/nclex-pdf/create_electrolytes_pdf.py'
~/nclex-pdf/create_electrolytes_pdf.py
Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/nclex-pdf/create_electrolytes_pdf.py'
cd /home/daytona/workspace/nclex-pdf && python create_electrolytes_pdf.py
~/nclex-pdf/create_electrolytes_pdf.py
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import cm
from reportlab.platypus import (
SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, HRFlowable
)
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_CENTER, TA_LEFT
OUTPUT = "/home/daytona/workspace/nclex-pdf/Electrolytes_NCLEX_QuickRef.pdf"
# ── Colors ─────────────────────────────────────────────────────────────
C_NAVY = colors.HexColor("#0D1B2A")
C_BLUE = colors.HexColor("#1565C0")
C_LBLUE = colors.HexColor("#1E88E5")
C_ELBLUE = colors.HexColor("#E3F2FD")
C_GREEN = colors.HexColor("#2E7D32")
C_LGREEN = colors.HexColor("#E8F5E9")
C_RED = colors.HexColor("#C62828")
C_LRED = colors.HexColor("#FFEBEE")
C_ORANGE = colors.HexColor("#E65100")
C_LORANGE = colors.HexColor("#FFF3E0")
C_PURPLE = colors.HexColor("#6A1B9A")
C_LPURPLE = colors.HexColor("#F3E5F5")
C_TEAL = colors.HexColor("#00695C")
C_LTEAL = colors.HexColor("#E0F2F1")
C_YELLOW = colors.HexColor("#FFF9C4")
C_DYELLOW = colors.HexColor("#F9A825")
C_LGRAY = colors.HexColor("#F5F5F5")
C_MGRAY = colors.HexColor("#BDBDBD")
C_WHITE = colors.white
C_DPINK = colors.HexColor("#AD1457")
C_LPINK = colors.HexColor("#FCE4EC")
C_BROWN = colors.HexColor("#4E342E")
C_LBROWN = colors.HexColor("#EFEBE9")
C_INDIGO = colors.HexColor("#283593")
C_LINDIGO = colors.HexColor("#E8EAF6")
doc = SimpleDocTemplate(
OUTPUT, pagesize=A4,
rightMargin=1.4*cm, leftMargin=1.4*cm,
topMargin=1.4*cm, bottomMargin=1.4*cm
)
W = A4[0] - 2.8*cm
styles = getSampleStyleSheet()
def S(name, **kw):
return ParagraphStyle(name, parent=styles["Normal"], **kw)
S_TITLE = S("t", fontSize=22, textColor=C_WHITE, alignment=TA_CENTER, fontName="Helvetica-Bold", leading=28)
S_SUB = S("s", fontSize=10, textColor=colors.HexColor("#B3E5FC"), alignment=TA_CENTER, fontName="Helvetica", leading=14)
S_H1 = S("h1", fontSize=12, textColor=C_WHITE, fontName="Helvetica-Bold", leading=16, leftIndent=4)
S_BODY = S("b", fontSize=8.5,textColor=C_NAVY, fontName="Helvetica", leading=12)
S_BOLD = S("bb", fontSize=8.5,textColor=C_NAVY, fontName="Helvetica-Bold", leading=12)
S_TRICK = S("tr", fontSize=9, textColor=C_PURPLE, fontName="Helvetica-BoldOblique", leading=13)
S_WARN = S("w", fontSize=9, textColor=C_RED, fontName="Helvetica-Bold", leading=13)
S_TIP = S("tp", fontSize=9, textColor=C_GREEN, fontName="Helvetica-Bold", leading=13)
S_HDR = S("hd", fontSize=9, textColor=C_WHITE, fontName="Helvetica-Bold", alignment=TA_CENTER, leading=12)
S_CELL = S("c", fontSize=8.5,textColor=C_NAVY, fontName="Helvetica", leading=12)
S_CELLB = S("cb", fontSize=8.5,textColor=C_NAVY, fontName="Helvetica-Bold", leading=12)
S_FOOTER = S("f", fontSize=7.5,textColor=C_MGRAY, fontName="Helvetica", alignment=TA_CENTER)
def sec_hdr(text, bg=C_BLUE):
t = Table([[Paragraph(text, S_H1)]], colWidths=[W])
t.setStyle(TableStyle([
("BACKGROUND",(0,0),(-1,-1), bg),
("TOPPADDING",(0,0),(-1,-1),7),("BOTTOMPADDING",(0,0),(-1,-1),7),
("LEFTPADDING",(0,0),(-1,-1),10),
]))
return t
def box(paras, bg=C_LGRAY, border=C_MGRAY):
if not isinstance(paras, list): paras = [paras]
rows = [[p] for p in paras]
t = Table(rows, colWidths=[W])
t.setStyle(TableStyle([
("BACKGROUND",(0,0),(-1,-1), bg),
("BOX",(0,0),(-1,-1),0.8,border),
("TOPPADDING",(0,0),(-1,-1),4),("BOTTOMPADDING",(0,0),(-1,-1),4),
("LEFTPADDING",(0,0),(-1,-1),8),("RIGHTPADDING",(0,0),(-1,-1),8),
]))
return t
# Core electrolyte block: flat table with two columns
def elec_block(name, normal, fun, hypo_name, hypo_causes, hypo_sx, hypo_tx,
hyper_name, hyper_causes, hyper_sx, hyper_tx,
memory, nclex_tips, accent):
story = []
# Title header
hdr = Table([[Paragraph(f"⚡ {name} | Normal: {normal}", S_H1)]], colWidths=[W])
hdr.setStyle(TableStyle([
("BACKGROUND",(0,0),(-1,-1),accent),
("TOPPADDING",(0,0),(-1,-1),7),("BOTTOMPADDING",(0,0),(-1,-1),7),
("LEFTPADDING",(0,0),(-1,-1),10),
]))
story.append(hdr)
# Function
story.append(box(Paragraph(f"<b>Function:</b> {fun}", S_BODY), bg=C_LGRAY, border=accent))
# Memory trick
story.append(box(Paragraph(f"🧠 Memory Trick: {memory}", S_TRICK), bg=C_LPURPLE, border=C_PURPLE))
# Build two-column table manually: each section header + items as rows
lw = W * 0.495
rw = W - lw
def col_rows(title, causes, sx, tx, title_bg, row_bg):
rows = []
rows.append((Paragraph(title, S_H1), title_bg, True))
rows.append((Paragraph("<b>Causes:</b>", S_BOLD), row_bg, False))
for c in causes:
rows.append((Paragraph(f" \u2022 {c}", S_CELL), row_bg, False))
rows.append((Paragraph("<b>Signs & Symptoms:</b>", S_BOLD), row_bg, False))
for s in sx:
rows.append((Paragraph(f" \u2022 {s}", S_CELL), row_bg, False))
rows.append((Paragraph("<b>Nursing Interventions:</b>", S_BOLD), row_bg, False))
for t in tx:
rows.append((Paragraph(f" \u2022 {t}", S_CELL), row_bg, False))
return rows
left_rows = col_rows(hypo_name, hypo_causes, hypo_sx, hypo_tx, C_RED, C_LRED)
right_rows = col_rows(hyper_name, hyper_causes, hyper_sx, hyper_tx, C_GREEN, C_LGREEN)
# Pad shorter side
max_len = max(len(left_rows), len(right_rows))
while len(left_rows) < max_len: left_rows.append((Paragraph("", S_CELL), C_LRED, False))
while len(right_rows) < max_len: right_rows.append((Paragraph("", S_CELL), C_LGREEN, False))
data = [[l[0], r[0]] for l, r in zip(left_rows, right_rows)]
combo = Table(data, colWidths=[lw, rw])
ts = TableStyle([
("GRID",(0,0),(-1,-1),0.3,C_MGRAY),
("VALIGN",(0,0),(-1,-1),"MIDDLE"),
("TOPPADDING",(0,0),(-1,-1),3),("BOTTOMPADDING",(0,0),(-1,-1),3),
("LEFTPADDING",(0,0),(-1,-1),6),("RIGHTPADDING",(0,0),(-1,-1),4),
])
for i, (l, r) in enumerate(zip(left_rows, right_rows)):
ts.add("BACKGROUND", (0,i),(0,i), l[1])
ts.add("BACKGROUND", (1,i),(1,i), r[1])
if l[2]: # title row
ts.add("FONTNAME",(0,i),(0,i),"Helvetica-Bold")
if r[2]:
ts.add("FONTNAME",(1,i),(1,i),"Helvetica-Bold")
combo.setStyle(ts)
story.append(combo)
# NCLEX tips
tip_rows = [[Paragraph(f"✅ {t}", S_TIP)] for t in nclex_tips]
tip_tbl = Table(tip_rows, colWidths=[W])
tip_tbl.setStyle(TableStyle([
("ROWBACKGROUNDS",(0,0),(-1,-1),[C_LGREEN, C_WHITE]),
("GRID",(0,0),(-1,-1),0.3,C_MGRAY),
("TOPPADDING",(0,0),(-1,-1),4),("BOTTOMPADDING",(0,0),(-1,-1),4),
("LEFTPADDING",(0,0),(-1,-1),6),
]))
story.append(tip_tbl)
story.append(Spacer(1, 0.3*cm))
return story
story = []
# ══════ TITLE ══════════════════════════════════════════════════════════
title_data = [
[Paragraph("⚡ ELECTROLYTES", S_TITLE)],
[Paragraph("NCLEX-RN Complete Quick Reference", S_SUB)],
[Paragraph("Na \u2022 K \u2022 Ca \u2022 Mg \u2022 Phosphorus \u2022 Chloride | Normal Values \u2022 Causes \u2022 Signs & Symptoms \u2022 Nursing Actions \u2022 Memory Tricks", S_SUB)],
]
title_tbl = Table(title_data, colWidths=[W])
title_tbl.setStyle(TableStyle([
("BACKGROUND",(0,0),(-1,-1),C_NAVY),
("TOPPADDING",(0,0),(-1,-1),5),("BOTTOMPADDING",(0,0),(-1,-1),5),
("LEFTPADDING",(0,0),(-1,-1),10),
]))
story.append(title_tbl)
story.append(Spacer(1,0.25*cm))
# ══════ NORMAL VALUES ══════════════════════════════════════════════════
story.append(sec_hdr("📊 NORMAL ELECTROLYTE VALUES — Quick Glance", C_NAVY))
story.append(Spacer(1,0.1*cm))
nv_rows = [
["Electrolyte", "Normal Range", "Critical Low", "Critical High", "Primary Function"],
["Sodium (Na\u207a)", "135–145 mEq/L","< 120 mEq/L"," > 160 mEq/L","Fluid balance, nerve/muscle function"],
["Potassium (K\u207a)", "3.5–5.0 mEq/L","< 2.5 mEq/L", "> 6.5 mEq/L", "Heart rhythm, muscle contraction"],
["Calcium (Ca\u00b2\u207a)","8.5–10.5 mg/dL","< 7.0 mg/dL", "> 13.0 mg/dL", "Bone/teeth, clotting, nerve/muscle"],
["Magnesium (Mg\u00b2\u207a)","1.5–2.5 mEq/L","< 1.0 mEq/L","> 4.0 mEq/L", "Enzyme reactions, nerve/muscle"],
["Phosphorus (PO4)", "2.5–4.5 mg/dL","< 1.0 mg/dL", "> 8.0 mg/dL", "Bone formation, energy (ATP)"],
["Chloride (Cl\u207b)", "96–106 mEq/L", "< 80 mEq/L", "> 115 mEq/L", "Acid-base balance, fluid balance"],
]
nv_tbl = Table(
[[Paragraph(c, S_HDR if i==0 else (S_CELLB if j==0 else S_CELL))
for j,c in enumerate(row)] for i,row in enumerate(nv_rows)],
colWidths=[W*0.20, W*0.16, W*0.14, W*0.14, W*0.36]
)
nv_tbl.setStyle(TableStyle([
("BACKGROUND",(0,0),(-1,0),C_NAVY),
("ROWBACKGROUNDS",(0,1),(-1,-1),[C_WHITE, C_LGRAY]),
("GRID",(0,0),(-1,-1),0.4,C_MGRAY),
("VALIGN",(0,0),(-1,-1),"MIDDLE"),
("TOPPADDING",(0,0),(-1,-1),5),("BOTTOMPADDING",(0,0),(-1,-1),5),
("LEFTPADDING",(0,0),(-1,-1),5),
]))
story.append(nv_tbl)
story.append(box(Paragraph(
'🧠 Memory: <b>"Sally Keeps Calcium Manageable Physically with Chloride"</b> → Na, K, Ca, Mg, PO4, Cl', S_TRICK),
bg=C_LPURPLE, border=C_PURPLE))
story.append(Spacer(1,0.25*cm))
# ══════ SODIUM ═════════════════════════════════════════════════════════
story += elec_block(
name="SODIUM (Na+)", normal="135–145 mEq/L",
fun="Controls fluid balance (where sodium goes, water follows); nerve impulse transmission; blood pressure regulation.",
hypo_name="HYPONATREMIA (Na+ < 135)",
hypo_causes=["Excessive water intake / SIADH","Prolonged vomiting / diarrhea","Heart failure, cirrhosis, renal failure","Excessive hypotonic IV fluids","Diuretic use"],
hypo_sx=["Headache, confusion, lethargy","Nausea and vomiting","Muscle cramps, weakness","Seizures (severe — Na+ < 120)","Cerebral edema — increased ICP"],
hypo_tx=["Restrict fluid intake","3% NaCl (hypertonic) for severe","Monitor neuro status q1-2h","Correct SLOWLY (risk: osmotic demyelination)","Daily weights, strict I&O"],
hyper_name="HYPERNATREMIA (Na+ > 145)",
hyper_causes=["Inadequate water intake (main cause)","Excessive sodium intake","Diabetes insipidus","Watery diarrhea","Excessive sweating"],
hyper_sx=["Thirst (EARLIEST sign)","Dry sticky mucous membranes","Restlessness, agitation","Decreased LOC (severe)","Seizures, coma (severe)"],
hyper_tx=["Increase water intake (oral or IV)","Hypotonic IV fluids (0.45% NaCl)","Correct SLOWLY (risk: cerebral edema)","Monitor fluid status + daily weights","Treat underlying cause"],
memory="SALT = THIRST. HIGH Na = THIRST (dry). LOW Na = BRAIN SWELLS (neuro sx). Water follows sodium — low sodium = water floods the brain = headache + seizures!",
nclex_tips=[
"Thirst is the EARLIEST sign of hypernatremia",
"Correct sodium SLOWLY — rapid correction of hyponatremia causes osmotic demyelination syndrome",
"SIADH causes hyponatremia — primary treatment is fluid restriction",
"Place on seizure precautions when Na+ < 120 mEq/L",
],
accent=C_LBLUE
)
# ══════ POTASSIUM ══════════════════════════════════════════════════════
story += elec_block(
name="POTASSIUM (K+)", normal="3.5–5.0 mEq/L",
fun="Maintains resting membrane potential; regulates heart rhythm and muscle contraction; acid-base balance.",
hypo_name="HYPOKALEMIA (K+ < 3.5)",
hypo_causes=["Diuretics (loop/thiazide — #1 cause)","Vomiting, diarrhea, NG suction","Insufficient dietary intake","Alkalosis (K+ shifts into cells)","Insulin administration"],
hypo_sx=["Muscle weakness, fatigue (legs first)","Leg cramps","Constipation, paralytic ileus","Cardiac dysrhythmias (PVCs, V-fib)","ECG: Flat/inverted T-waves + U-waves"],
hypo_tx=["KCl oral supplement (preferred)","IV KCl — NEVER give IV push (fatal!)","Max IV rate: 10–20 mEq/hr, always diluted","Increase dietary K+ (bananas, oranges, potatoes)","Continuous cardiac monitoring"],
hyper_name="HYPERKALEMIA (K+ > 5.0)",
hyper_causes=["Renal failure (#1 cause)","Potassium-sparing diuretics","ACE inhibitors","Acidosis (K+ shifts out of cells)","Massive cell destruction (burns, trauma)"],
hyper_sx=["Muscle weakness, fatigue","Nausea, diarrhea, abdominal cramps","ECG: Peaked (tall, narrow) T-waves","Widened QRS, sine wave pattern","Ventricular fibrillation / cardiac arrest"],
hyper_tx=["Calcium gluconate IV (stabilizes heart — FIRST)","Sodium bicarbonate (shifts K+ into cells)","Insulin + dextrose (shifts K+ into cells)","Kayexalate (removes K+ from body)","Dialysis (severe / renal failure)"],
memory="K = MUSCLES & HEART. LOW K = WEAK + FLAT T-wave + U-wave (you SEE a U!). HIGH K = PEAKED T-wave = DANGER. LOW K ladder goes DOWN, HIGH K tent goes UP!",
nclex_tips=[
"NEVER give IV potassium as IV push or bolus — it causes fatal cardiac arrest",
"Max IV KCl rate = 10–20 mEq/hr, always diluted in IV fluid — never run undiluted",
"Loop diuretics (furosemide) cause hypokalemia — always give K+ supplements",
"Peaked T-waves = hyperkalemia | Flat T-wave + U-wave = hypokalemia",
"Calcium gluconate is FIRST treatment in dangerous hyperkalemia (protects the heart)",
],
accent=C_GREEN
)
# ══════ CALCIUM ════════════════════════════════════════════════════════
story += elec_block(
name="CALCIUM (Ca2+)", normal="8.5–10.5 mg/dL",
fun="Bone and teeth formation; muscle contraction and relaxation; blood clotting; nerve transmission.",
hypo_name="HYPOCALCEMIA (Ca2+ < 8.5)",
hypo_causes=["Hypoparathyroidism (post thyroid/parathyroid surgery)","Vitamin D deficiency","Chronic renal failure","Hypomagnesemia","Alkalosis (Ca2+ binds to albumin)","Pancreatitis"],
hypo_sx=["Trousseau's sign (carpopedal spasm with BP cuff)","Chvostek's sign (facial twitch — tap CN VII)","Tetany, muscle cramps","Numbness/tingling (perioral, fingers, toes)","Seizures","Prolonged QT interval on ECG"],
hypo_tx=["IV calcium gluconate (emergency)","Oral calcium supplements + Vitamin D","High-calcium diet (dairy, leafy greens)","Correct hypomagnesemia first","Seizure precautions + padded side rails"],
hyper_name="HYPERCALCEMIA (Ca2+ > 10.5)",
hyper_causes=["Hyperparathyroidism (#1 cause)","Malignancy (bone metastases)","Prolonged immobility","Excess Vitamin D intake","Thiazide diuretics","Paget's disease"],
hyper_sx=["Bone pain, pathologic fractures","Nausea, vomiting, constipation","Fatigue, muscle weakness, flaccidity","Confusion, depression, psychosis","Kidney stones, polyuria, polydipsia","Shortened QT interval on ECG"],
hyper_tx=["IV Normal Saline (dilutes Ca2+ — FIRST)","Loop diuretics (furosemide) to excrete Ca2+","Bisphosphonates (chronic management)","Calcitonin","Limit calcium/Vitamin D intake","Encourage weight-bearing activity"],
memory="LOW Ca = TWITCHY (Trousseau + Chvostek = neuromuscular IRRITABILITY). HIGH Ca = BONES GROANS MOANS & PSYCHIC OVERTONES (bone pain, GI upset, confusion). TROUSSEAU = BP cuff. CHVOSTEK = Cheek tap.",
nclex_tips=[
"Trousseau's sign: inflate BP cuff 20 mmHg above systolic x 3 min — carpopedal spasm = positive (low Ca)",
"Chvostek's sign: tap facial nerve anterior to ear — facial twitch = positive (low Ca)",
"Post thyroid/parathyroid surgery: monitor closely for hypocalcemia (accidental parathyroid removal)",
"'Bones, Groans, Moans, Psychic Overtones' = classic hypercalcemia mnemonic",
"First treatment for hypercalcemia = IV Normal Saline hydration",
],
accent=C_ORANGE
)
# ══════ MAGNESIUM ══════════════════════════════════════════════════════
story += elec_block(
name="MAGNESIUM (Mg2+)", normal="1.5–2.5 mEq/L",
fun="Enzyme co-factor for 300+ reactions; nerve/muscle function; regulates calcium and potassium levels; cardiac rhythm.",
hypo_name="HYPOMAGNESEMIA (Mg2+ < 1.5)",
hypo_causes=["Alcoholism (#1 cause in adults)","Prolonged malnutrition / malabsorption","Diarrhea, vomiting, NG suction","Diuretics (loop / thiazide)","Diabetic ketoacidosis (DKA)"],
hypo_sx=["Tremors, muscle twitching","Hyperreflexia (increased DTRs)","Positive Trousseau's and Chvostek's signs","Cardiac dysrhythmias (torsades de pointes)","Confusion, agitation, insomnia","Dysphagia (difficulty swallowing)"],
hypo_tx=["IV magnesium sulfate (MgSO4) for severe","Oral Mg supplements (mild)","High-Mg diet: nuts, whole grains, green veggies","Correct coexisting hypokalemia and hypocalcemia","Monitor DTRs and respiratory rate during IV replacement"],
hyper_name="HYPERMAGNESEMIA (Mg2+ > 2.5)",
hyper_causes=["Renal failure (#1 cause)","Excessive Mg antacids or laxatives (Milk of Magnesia)","Excessive IV MgSO4 (eclampsia treatment)","Adrenal insufficiency"],
hyper_sx=["Flushing, feeling of warmth (early)","Nausea, vomiting","LOSS of deep tendon reflexes — FIRST SIGN","Hypotension, bradycardia","Respiratory depression — LIFE-THREATENING","Cardiac arrest (very high levels)"],
hyper_tx=["STOP all Mg-containing medications immediately","Calcium gluconate IV (antidote — reverses Mg effects)","IV fluids + loop diuretics to excrete Mg","Dialysis (severe / renal failure)","Respiratory support / mechanical ventilation if needed"],
memory="LOW Mg = SHAKY & HYPERACTIVE (tremors, increased DTRs) — think ALCOHOLICS. HIGH Mg = EVERYTHING SLOWS (DTRs disappear first, then breathing stops). CALCIUM GLUCONATE = ANTIDOTE for Mg toxicity!",
nclex_tips=[
"Monitor DTRs before each IV Mg dose — absent DTRs = HOLD magnesium immediately (toxicity)",
"Calcium gluconate is the antidote for magnesium sulfate toxicity",
"Keep calcium gluconate at the bedside for ALL patients receiving IV MgSO4 (preeclampsia)",
"Respiratory rate must be > 12/min and urine output > 25–30 mL/hr before giving IV Mg",
"Hypomagnesemia causes refractory hypokalemia — treat Mg first, then K+",
],
accent=C_TEAL
)
# ══════ PHOSPHORUS ═════════════════════════════════════════════════════
story += elec_block(
name="PHOSPHORUS (PO4)", normal="2.5–4.5 mg/dL",
fun="Bone and teeth formation; energy production (ATP); cell membrane structure; acid-base balance.",
hypo_name="HYPOPHOSPHATEMIA (PO4 < 2.5)",
hypo_causes=["Malnutrition, anorexia nervosa","Refeeding syndrome (restarting nutrition)","Antacid overuse (aluminum-based binds PO4)","Hyperparathyroidism","Chronic alcoholism","Respiratory alkalosis"],
hypo_sx=["Profound muscle weakness (including respiratory muscles)","Fatigue, bone pain","Confusion, irritability","Hemolytic anemia","Difficulty weaning from ventilator (resp. muscle weakness)","Pathologic fractures"],
hypo_tx=["Oral phosphate supplements (mild)","IV sodium or potassium phosphate (severe)","Phosphate-rich diet: dairy, meat, nuts, legumes","Discontinue phosphate-binding antacids","Monitor for refeeding syndrome when restarting nutrition"],
hyper_name="HYPERPHOSPHATEMIA (PO4 > 4.5)",
hyper_causes=["Chronic renal failure (#1 cause)","Hypoparathyroidism","Excessive phosphate laxatives/enemas","Tumor lysis syndrome","Rhabdomyolysis"],
hyper_sx=["Hypocalcemia symptoms (inverse relationship)","Tetany, muscle cramps","Positive Trousseau's / Chvostek's signs","Soft tissue / vascular calcifications","Pruritus (itching from calcium-phosphate deposits)","Bone pain and joint pain"],
hyper_tx=["Phosphate-restricted diet","Phosphate binders WITH meals (calcium carbonate, sevelamer)","Increase fluid intake","Dialysis for renal failure patients","Correct hypocalcemia as needed"],
memory="P = POWER (ATP = Energy). LOW P = NO ENERGY (weak muscles, can't breathe off vent). HIGH P STEALS CALCIUM (inverse relationship) = tetany + twitching. Ca and P are like a SEESAW: one goes up, the other goes down!",
nclex_tips=[
"Calcium and phosphorus are INVERSELY related — high phosphorus = low calcium signs (tetany, twitching)",
"Refeeding syndrome causes dangerous hypophosphatemia — monitor carefully when restarting nutrition in malnourished patients",
"Phosphate binders must be given WITH meals (not between meals) to be effective",
"Chronic renal failure patients: high phosphorus, low calcium, high PTH — the classic triad",
],
accent=C_DPINK
)
# ══════ IV FLUIDS ══════════════════════════════════════════════════════
story.append(sec_hdr("💉 IV FLUID TYPES — NCLEX Quick Reference", C_INDIGO))
story.append(Spacer(1,0.1*cm))
iv_rows = [
["Type", "Examples", "Tonicity", "Cell Effect", "NCLEX Use"],
["ISOTONIC", "0.9% NaCl (NS)\nLactated Ringer's\nD5W (isotonic in bag)", "275–295 mOsm/L\n(same as blood)", "Cells stay\nSAME SIZE", "Fluid replacement\nHypovolemia\nPre/post-op\nBlood transfusion compatible"],
["HYPOTONIC", "0.45% NaCl (1/2 NS)\n0.33% NaCl\nD2.5W", "< 275 mOsm/L\n(less than blood)", "Water moves IN\ncells SWELL", "Cellular dehydration\nHypernatremia\nDKA maintenance"],
["HYPERTONIC", "3% NaCl\nD5NS\nD5 1/2NS\nD10W", "> 295 mOsm/L\n(more than blood)", "Water moves OUT\ncells SHRINK", "Severe hyponatremia\nCerebral edema\nSIADH"],
]
iv_tbl = Table(
[[Paragraph(c, S_HDR if i==0 else (S_CELLB if j==0 else S_CELL))
for j,c in enumerate(row)] for i,row in enumerate(iv_rows)],
colWidths=[W*0.14, W*0.25, W*0.18, W*0.16, W*0.27]
)
iv_ts = TableStyle([
("BACKGROUND",(0,0),(-1,0),C_INDIGO),
("BACKGROUND",(0,1),(-1,1),C_LGREEN),
("BACKGROUND",(0,2),(-1,2),C_ELBLUE),
("BACKGROUND",(0,3),(-1,3),C_LRED),
("GRID",(0,0),(-1,-1),0.4,C_MGRAY),
("VALIGN",(0,0),(-1,-1),"MIDDLE"),
("TOPPADDING",(0,0),(-1,-1),5),("BOTTOMPADDING",(0,0),(-1,-1),5),
("LEFTPADDING",(0,0),(-1,-1),5),
])
iv_tbl.setStyle(iv_ts)
story.append(iv_tbl)
story.append(box([
Paragraph("🧠 Memory: <b>ISO = same size, HYPO = cells swell (water rushes in), HYPER = cells shrink (water pulled out)</b>", S_TRICK),
Paragraph("⚠ Do NOT give hypotonic fluids to head-injury patients (worsens cerebral edema). Do NOT infuse hypertonic saline rapidly.", S_WARN),
], bg=C_YELLOW, border=C_DYELLOW))
story.append(Spacer(1,0.25*cm))
# ══════ ELECTROLYTE INTERACTIONS ═══════════════════════════════════════
story.append(sec_hdr("🔄 KEY ELECTROLYTE INTERACTIONS", C_BROWN))
story.append(Spacer(1,0.1*cm))
int_rows = [
["Relationship", "Clinical Significance"],
["Ca2+ UP <--> PO4 DOWN (Inverse)", "When phosphorus rises, calcium falls. Classic in chronic renal failure."],
["Mg2+ LOW causes K+ LOW and Ca2+ LOW", "Hypomagnesemia makes hypokalemia and hypocalcemia resistant to treatment. Fix Mg first!"],
["Acidosis (pH down) --> K+ UP", "H+ ions shift into cells, K+ shifts out. Every 0.1 pH drop raises K+ ~0.5 mEq/L."],
["Alkalosis (pH up) --> K+ DOWN", "H+ shifts out of cells, K+ shifts in. Vomiting causes alkalosis and hypokalemia."],
["Insulin --> K+ DOWN (shifts into cells)", "Used therapeutically in hyperkalemia. Insulin + dextrose drives K+ into cells."],
["Loop diuretics --> K+ DOWN + Mg2+ DOWN", "Furosemide wastes both potassium AND magnesium. Monitor both levels."],
]
int_tbl = Table(
[[Paragraph(c, S_HDR if i==0 else (S_CELLB if j==0 else S_CELL))
for j,c in enumerate(row)] for i,row in enumerate(int_rows)],
colWidths=[W*0.40, W*0.60]
)
int_tbl.setStyle(TableStyle([
("BACKGROUND",(0,0),(-1,0),C_BROWN),
("ROWBACKGROUNDS",(0,1),(-1,-1),[C_LBROWN, C_WHITE]),
("GRID",(0,0),(-1,-1),0.4,C_MGRAY),
("VALIGN",(0,0),(-1,-1),"MIDDLE"),
("TOPPADDING",(0,0),(-1,-1),5),("BOTTOMPADDING",(0,0),(-1,-1),5),
("LEFTPADDING",(0,0),(-1,-1),6),
]))
story.append(int_tbl)
story.append(Spacer(1,0.25*cm))
# ══════ TOP NCLEX TIPS ═════════════════════════════════════════════════
story.append(sec_hdr("⭐ TOP NCLEX EXAM TIPS — Electrolytes", C_RED))
story.append(Spacer(1,0.1*cm))
top_tips = [
("NEVER IV push potassium", "IV K+ push = fatal cardiac arrest. Always dilute, max 10–20 mEq/hr."),
("Calcium gluconate = antidote x2", "Treats both hyperkalemia (heart protection) AND hypermagnesemia (Mg reversal)."),
("DTRs = Mg toxicity warning", "Loss of DTRs is the FIRST sign of Mg toxicity — hold Mg, give calcium gluconate."),
("Keep Ca gluconate at bedside", "Mandatory for ALL patients on IV MgSO4 (preeclampsia, eclampsia)."),
("Correct electrolytes SLOWLY", "Rapid Na+ correction = osmotic demyelination (hypo) or cerebral edema (hyper)."),
("Trousseau + Chvostek = low Ca/Mg","Both signs = neuromuscular irritability from low calcium OR low magnesium."),
("Renal failure triad", "Chronic renal failure = HIGH K+, HIGH PO4, LOW Ca2+. Always expect these."),
("Know your diuretics", "Loop = wastes K+, Mg2+ | Thiazide = wastes K+ | K-sparing = saves K+ (raises it)."),
("ECG + K+ go together", "Peaked T-wave = hyperkalemia. Flat T-wave + U-wave = hypokalemia."),
("Thirst = earliest hypernatremia", "Ask about thirst + check mucous membranes for dryness first."),
]
tip_data = [[Paragraph(f"✅ {t}", S_WARN), Paragraph(d, S_BODY)] for t,d in top_tips]
tip_tbl = Table(tip_data, colWidths=[W*0.35, W*0.65])
tip_tbl.setStyle(TableStyle([
("ROWBACKGROUNDS",(0,0),(-1,-1),[C_LRED, C_WHITE]),
("GRID",(0,0),(-1,-1),0.3,C_MGRAY),
("VALIGN",(0,0),(-1,-1),"MIDDLE"),
("TOPPADDING",(0,0),(-1,-1),5),("BOTTOMPADDING",(0,0),(-1,-1),5),
("LEFTPADDING",(0,0),(-1,-1),6),
]))
story.append(tip_tbl)
story.append(Spacer(1,0.2*cm))
# ── Footer ─────────────────────────────────────────────────────────────
story.append(HRFlowable(width=W, color=C_MGRAY))
story.append(Spacer(1,0.1*cm))
story.append(Paragraph(
"NCLEX-RN Electrolytes Quick Reference | NCLEX-RN Exam Preparation | July 2026 | Na \u2022 K \u2022 Ca \u2022 Mg \u2022 PO4 \u2022 Cl",
S_FOOTER
))
doc.build(story)
print("PDF created:", OUTPUT)
cat > /home/daytona/workspace/nclex-pdf/create_electrolytes_pdf.py << 'PYEOF' from reportlab.lib.pagesizes import A4 from reportlab.lib import colors from reportlab.lib.units import cm from reportlab.platypus import ( SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, HRFlowable ) from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.lib.enums import TA_CENTER, TA_LEFT OUTPUT = "/home/daytona/workspace/nclex-pdf/Electrolytes_NCLEX_QuickRef.pdf" C_NAVY=colors.HexColor("#0D1B2A"); C_BLUE=colors.HexColor("#1565C0") C_LBLUE=colors.HexColor("#1E88E5"); C_ELBLUE=colors.HexColor("#E3F2FD") C_GREEN=colors.HexColor("#2E7D32"); C_LGREEN=colors.HexColor("#E8F5E9") C_RED=colors.HexColor("#C62828"); C_LRED=colors.HexColor("#FFEBEE") C_ORANGE=colors.HexColor("#E65100"); C_LORANGE=colors.HexColor("#FFF3E0") C_PURPLE=colors.HexColor("#6A1B9A"); C_LPURPLE=colors.HexColor("#F3E5F5") C_TEAL=colors.HexColor("#00695C"); C_LTEAL=colors.HexColor("#E0F2F1") C_YELLOW=colors.HexColor("#FFF9C4"); C_DYELLOW=colors.HexColor("#F9A825") C_LGRAY=colors.HexColor("#F5F5F5"); C_MGRAY=colors.HexColor("#BDBDBD") C_WHITE=colors.white; C_DPINK=colors.HexColor("#AD1457") C_LPINK=colors.HexColor("#FCE4EC"); C_BROWN=colors.HexColor("#4E342E") C_LBROWN=colors.HexColor("#EFEBE9"); C_INDIGO=colors.HexColor("#283593") doc = SimpleDocTemplate(OUTPUT, pagesize=A4, rightMargin=1.4*cm, leftMargin=1.4*cm, topMargin=1.4*cm, bottomMargin=1.4*cm) W = A4[0] - 2.8*cm styles = getSampleStyleSheet() def S(name, **kw): return ParagraphStyle(name, parent=styles["Normal"], **kw) S_TITLE=S("t", fontSize=22, textColor=C_WHITE, alignment=TA_CENTER, fontName="Helvetica-Bold", leading=28) S_SUB=S("s", fontSize=10, textColor=colors.HexColor("#B3E5FC"), alignment=TA_CENTER, fontName="Helvetica", leading=14) S_H1=S("h1", fontSize=12, textColor=C_WHITE, fontName="Helvetica-Bold", leading=16, leftIndent=4) S_BODY=S("b", fontSize=8.5, textColor=C_NAVY, fontName="Helvetica", leading=12) S_BOLD=S("bb", fontSize=8.5, textColor=C_NAVY, fontName="Helvetica-Bold", leading=12) S_TRICK=S("tr", fontSize=9, textColor=C_PURPLE, fontName="Helvetica-BoldOblique", leading=13) S_WARN=S("w", fontSize=9, textColor=C_RED, fontName="Helvetica-Bold", leading=13) S_TIP=S("tp", fontSize=9, textColor=C_GREEN, fontName="Helvetica-Bold", leading=13) S_HDR=S("hd", fontSize=9, textColor=C_WHITE, fontName="Helvetica-Bold", alignment=TA_CENTER, leading=12) S_CELL=S("c", fontSize=8.5, textColor=C_NAVY, fontName="Helvetica", leading=12) S_CELLB=S("cb", fontSize=8.5, textColor=C_NAVY, fontName="Helvetica-Bold", leading=12) S_FOOTER=S("f", fontSize=7.5, textColor=C_MGRAY, fontName="Helvetica", alignment=TA_CENTER) def sec_hdr(text, bg=C_BLUE): t = Table([[Paragraph(text, S_H1)]], colWidths=[W]) t.setStyle(TableStyle([("BACKGROUND",(0,0),(-1,-1),bg), ("TOPPADDING",(0,0),(-1,-1),7),("BOTTOMPADDING",(0,0),(-1,-1),7), ("LEFTPADDING",(0,0),(-1,-1),10)])) return t def box(paras, bg=C_LGRAY, border=C_MGRAY): if not isinstance(paras, list): paras=[paras] rows=[[p] for p in paras] t=Table(rows, colWidths=[W]) t.setStyle(TableStyle([("BACKGROUND",(0,0),(-1,-1),bg),("BOX",(0,0),(-1,-1),0.8,border), ("TOPPADDING",(0,0),(-1,-1),4),("BOTTOMPADDING",(0,0),(-1,-1),4), ("LEFTPADDING",(0,0),(-1,-1),8),("RIGHTPADDING",(0,0),(-1,-1),8)])) return t def elec_block(name, normal, fun, hypo_name, hypo_causes, hypo_sx, hypo_tx, hyper_name, hyper_causes, hyper_sx, hyper_tx, memory, nclex_tips, accent): story=[] hdr=Table([[Paragraph(f" {name} | Normal: {normal}", S_H1)]], colWidths=[W]) hdr.setStyle(TableStyle([("BACKGROUND",(0,0),(-1,-1),accent), ("TOPPADDING",(0,0),(-1,-1),7),("BOTTOMPADDING",(0,0),(-1,-1),7), ("LEFTPADDING",(0,0),(-1,-1),10)])) story.append(hdr) story.append(box(Paragraph(f"<b>Function:</b> {fun}", S_BODY), bg=C_LGRAY, border=accent)) story.append(box(Paragraph(f"Memory Trick: {memory}", S_TRICK), bg=C_LPURPLE, border=C_PURPLE)) lw = W*0.49 rw = W - lw def build_col(title, causes, sx, tx, title_bg, row_bg): rows=[] rows.append((Paragraph(title, S_H1), title_bg, True)) rows.append((Paragraph("<b>Causes:</b>", S_BOLD), row_bg, False)) for c in causes: rows.append((Paragraph(f" - {c}", S_CELL), row_bg, False)) rows.append((Paragraph("<b>Signs & Symptoms:</b>", S_BOLD), row_bg, False)) for s in sx: rows.append((Paragraph(f" - {s}", S_CELL), row_bg, False)) rows.append((Paragraph("<b>Nursing Actions:</b>", S_BOLD), row_bg, False)) for t in tx: rows.append((Paragraph(f" - {t}", S_CELL), row_bg, False)) return rows L=build_col(hypo_name, hypo_causes, hypo_sx, hypo_tx, C_RED, C_LRED) R=build_col(hyper_name, hyper_causes, hyper_sx, hyper_tx, C_GREEN, C_LGREEN) mx=max(len(L),len(R)) while len(L)<mx: L.append((Paragraph("", S_CELL), C_LRED, False)) while len(R)<mx: R.append((Paragraph("", S_CELL), C_LGREEN, False)) data=[[l[0], r[0]] for l,r in zip(L,R)] combo=Table(data, colWidths=[lw, rw]) ts=TableStyle([("GRID",(0,0),(-1,-1),0.3,C_MGRAY),("VALIGN",(0,0),(-1,-1),"MIDDLE"), ("TOPPADDING",(0,0),(-1,-1),3),("BOTTOMPADDING",(0,0),(-1,-1),3), ("LEFTPADDING",(0,0),(-1,-1),6),("RIGHTPADDING",(0,0),(-1,-1),4)]) for i,(l,r) in enumerate(zip(L,R)): ts.add("BACKGROUND",(0,i),(0,i),l[1]) ts.add("BACKGROUND",(1,i),(1,i),r[1]) if l[2]: ts.add("FONTNAME",(0,i),(0,i),"Helvetica-Bold") if r[2]: ts.add("FONTNAME",(1,i),(1,i),"Helvetica-Bold") combo.setStyle(ts) story.append(combo) tip_tbl=Table([[Paragraph(f" {t}", S_TIP)] for t in nclex_tips], colWidths=[W]) tip_tbl.setStyle(TableStyle([("ROWBACKGROUNDS",(0,0),(-1,-1),[C_LGREEN,C_WHITE]), ("GRID",(0,0),(-1,-1),0.3,C_MGRAY),("TOPPADDING",(0,0),(-1,-1),4), ("BOTTOMPADDING",(0,0),(-1,-1),4),("LEFTPADDING",(0,0),(-1,-1),6)])) story.append(tip_tbl) story.append(Spacer(1,0.3*cm)) return story story=[] # TITLE td=[[Paragraph("ELECTROLYTES", S_TITLE)], [Paragraph("NCLEX-RN Complete Quick Reference", S_SUB)], [Paragraph("Na - K - Ca - Mg - Phosphorus | Normal Values - Causes - Signs & Symptoms - Nursing Actions - Memory Tricks", S_SUB)]] ttbl=Table(td, colWidths=[W]) ttbl.setStyle(TableStyle([("BACKGROUND",(0,0),(-1,-1),C_NAVY), ("TOPPADDING",(0,0),(-1,-1),5),("BOTTOMPADDING",(0,0),(-1,-1),5), ("LEFTPADDING",(0,0),(-1,-1),10)])) story.append(ttbl); story.append(Spacer(1,0.25*cm)) # NORMAL VALUES story.append(sec_hdr("NORMAL ELECTROLYTE VALUES -- Quick Glance", C_NAVY)); story.append(Spacer(1,0.1*cm)) nv=[["Electrolyte","Normal Range","Critical Low","Critical High","Primary Function"], ["Sodium (Na+)","135-145 mEq/L","< 120 mEq/L","> 160 mEq/L","Fluid balance, nerve/muscle function"], ["Potassium (K+)","3.5-5.0 mEq/L","< 2.5 mEq/L","> 6.5 mEq/L","Heart rhythm, muscle contraction"], ["Calcium (Ca2+)","8.5-10.5 mg/dL","< 7.0 mg/dL","> 13.0 mg/dL","Bone/teeth, clotting, nerve/muscle"], ["Magnesium (Mg2+)","1.5-2.5 mEq/L","< 1.0 mEq/L","> 4.0 mEq/L","Enzyme reactions, nerve/muscle"], ["Phosphorus","2.5-4.5 mg/dL","< 1.0 mg/dL","> 8.0 mg/dL","Bone formation, energy (ATP)"], ["Chloride (Cl-)","96-106 mEq/L","< 80 mEq/L","> 115 mEq/L","Acid-base balance, fluid balance"]] nvt=Table([[Paragraph(c,S_HDR if i==0 else (S_CELLB if j==0 else S_CELL)) for j,c in enumerate(row)] for i,row in enumerate(nv)], colWidths=[W*0.20,W*0.16,W*0.14,W*0.14,W*0.36]) nvt.setStyle(TableStyle([("BACKGROUND",(0,0),(-1,0),C_NAVY),("ROWBACKGROUNDS",(0,1),(-1,-1),[C_WHITE,C_LGRAY]), ("GRID",(0,0),(-1,-1),0.4,C_MGRAY),("VALIGN",(0,0),(-1,-1),"MIDDLE"), ("TOPPADDING",(0,0),(-1,-1),5),("BOTTOMPADDING",(0,0),(-1,-1),5),("LEFTPADDING",(0,0),(-1,-1),5)])) story.append(nvt) story.append(box(Paragraph('Memory: "Sally Keeps Calcium Manageable Physically with Chloride" = Na, K, Ca, Mg, PO4, Cl', S_TRICK), bg=C_LPURPLE, border=C_PURPLE)) story.append(Spacer(1,0.25*cm)) # SODIUM story += elec_block("SODIUM (Na+)","135-145 mEq/L", "Controls fluid balance (where Na goes, water follows); nerve impulse transmission; blood pressure regulation.", "HYPONATREMIA (Na+ < 135)", ["Excessive water intake / SIADH","Prolonged vomiting or diarrhea","Heart failure, cirrhosis, renal failure","Excessive hypotonic IV fluids","Diuretic use"], ["Headache, confusion, lethargy","Nausea and vomiting","Muscle cramps, weakness","Seizures (severe - Na+ < 120)","Cerebral edema, increased ICP"], ["Restrict fluid intake","3% NaCl (hypertonic) for severe cases","Monitor neuro status every 1-2h","Correct SLOWLY (risk: osmotic demyelination)","Daily weights, strict I&O"], "HYPERNATREMIA (Na+ > 145)", ["Inadequate water intake (main cause)","Excessive sodium intake","Diabetes insipidus","Watery diarrhea / excessive sweating"], ["THIRST (earliest sign)","Dry sticky mucous membranes","Restlessness, agitation","Decreased LOC (severe)","Seizures, coma (severe)"], ["Increase water intake (oral or IV)","Hypotonic IV fluids (0.45% NaCl)","Correct SLOWLY (risk: cerebral edema)","Monitor fluid status, daily weights","Treat underlying cause"], "SALT = THIRST. HIGH Na = THIRST (dry body). LOW Na = BRAIN SWELLS (headache, seizures). Water follows sodium -- low Na = water floods the brain!", ["Thirst is the EARLIEST sign of hypernatremia", "Correct sodium SLOWLY -- rapid correction of hyponatremia causes osmotic demyelination syndrome", "SIADH causes hyponatremia -- primary treatment is FLUID RESTRICTION", "Place on seizure precautions when Na+ < 120 mEq/L"], C_LBLUE) # POTASSIUM story += elec_block("POTASSIUM (K+)","3.5-5.0 mEq/L", "Maintains resting membrane potential; regulates heart rhythm and muscle contraction; acid-base balance.", "HYPOKALEMIA (K+ < 3.5)", ["Loop/thiazide diuretics (#1 cause)","Vomiting, diarrhea, NG suction","Insufficient dietary intake","Alkalosis (K+ shifts into cells)","Insulin administration"], ["Muscle weakness, fatigue (legs first)","Leg cramps","Constipation, paralytic ileus","Cardiac dysrhythmias (PVCs, V-fib)","ECG: Flat/inverted T-waves + U-waves"], ["KCl oral supplement (preferred)","IV KCl -- NEVER give IV push (FATAL)","Max IV rate: 10-20 mEq/hr, always diluted","Increase dietary K+ (bananas, oranges, potatoes)","Continuous cardiac monitoring"], "HYPERKALEMIA (K+ > 5.0)", ["Renal failure (#1 cause)","Potassium-sparing diuretics","ACE inhibitors","Acidosis (K+ shifts out of cells)","Massive cell destruction (burns, trauma)"], ["Muscle weakness, fatigue","Nausea, diarrhea, abdominal cramps","ECG: Peaked (tall, narrow) T-waves","Widened QRS, sine wave pattern","Ventricular fibrillation / cardiac arrest"], ["Calcium gluconate IV (stabilizes heart -- FIRST)","Sodium bicarbonate (shifts K+ into cells)","Insulin + dextrose (shifts K+ into cells)","Kayexalate (removes K+ from body)","Dialysis (severe / renal failure)"], "K = MUSCLES & HEART. LOW K = WEAK + FLAT T-wave + U-wave (you SEE a U!). HIGH K = PEAKED T-wave = DANGER. Think: LOW K ladder goes DOWN, HIGH K tent PEAKS UP!", ["NEVER give IV potassium as IV push or bolus -- it causes fatal cardiac arrest", "Max IV KCl rate = 10-20 mEq/hr, always diluted -- never run undiluted", "Loop diuretics (furosemide) cause hypokalemia -- give K+ supplements", "Peaked T-waves = hyperkalemia | Flat T-wave + U-wave = hypokalemia", "Calcium gluconate is FIRST treatment for dangerous hyperkalemia (cardiac membrane stabilizer)"], C_GREEN) # CALCIUM story += elec_block("CALCIUM (Ca2+)","8.5-10.5 mg/dL", "Bone and teeth formation; muscle contraction and relaxation; blood clotting; nerve transmission.", "HYPOCALCEMIA (Ca2+ < 8.5)", ["Hypoparathyroidism (post thyroid/parathyroid surgery)","Vitamin D deficiency","Chronic renal failure","Hypomagnesemia","Alkalosis","Pancreatitis"], ["Trousseau's sign (carpopedal spasm with BP cuff)","Chvostek's sign (facial twitch -- tap CN VII area)","Tetany, muscle cramps","Numbness/tingling (perioral, fingers, toes)","Seizures","Prolonged QT interval on ECG"], ["IV calcium gluconate (emergency)","Oral calcium + Vitamin D supplements","High-calcium diet (dairy, leafy greens)","Correct hypomagnesemia first","Seizure precautions + padded side rails"], "HYPERCALCEMIA (Ca2+ > 10.5)", ["Hyperparathyroidism (#1 cause)","Malignancy / bone metastases","Prolonged immobility","Excess Vitamin D","Thiazide diuretics","Paget's disease"], ["Bone pain, pathologic fractures","Nausea, vomiting, constipation","Fatigue, muscle weakness","Confusion, depression, psychosis","Kidney stones, polyuria","Shortened QT on ECG"], ["IV Normal Saline (dilutes Ca2+ -- FIRST)","Loop diuretics (furosemide) to excrete Ca2+","Bisphosphonates (chronic management)","Calcitonin","Limit calcium and Vitamin D intake","Encourage weight-bearing activity"], "LOW Ca = TWITCHY (Trousseau + Chvostek). HIGH Ca = BONES GROANS MOANS & PSYCHIC OVERTONES (bone pain, GI upset, confusion). TROUSSEAU = BP cuff spasm. CHVOSTEK = Cheek tap facial twitch.", ["Trousseau's: inflate BP cuff 20 mmHg above systolic x 3 min -- carpopedal spasm = positive (low Ca)", "Chvostek's: tap facial nerve anterior to ear -- facial muscle twitch = positive (low Ca)", "Post thyroid/parathyroid surgery: monitor closely for hypocalcemia (accidental parathyroid removal)", "'Bones, Groans, Moans, Psychic Overtones' = classic hypercalcemia mnemonic", "First treatment for hypercalcemia = IV Normal Saline hydration"], C_ORANGE) # MAGNESIUM story += elec_block("MAGNESIUM (Mg2+)","1.5-2.5 mEq/L", "Enzyme co-factor for 300+ reactions; nerve/muscle function; regulates calcium and potassium; cardiac rhythm.", "HYPOMAGNESEMIA (Mg2+ < 1.5)", ["Alcoholism (#1 cause in adults)","Prolonged malnutrition / malabsorption","Diarrhea, vomiting, NG suction","Diuretics (loop / thiazide)","Diabetic ketoacidosis (DKA)"], ["Tremors, muscle twitching","Hyperreflexia (INCREASED deep tendon reflexes)","Positive Trousseau's and Chvostek's","Cardiac dysrhythmias (torsades de pointes)","Confusion, agitation, insomnia","Dysphagia (difficulty swallowing)"], ["IV magnesium sulfate (MgSO4) for severe","Oral Mg supplements (mild)","High-Mg diet: nuts, whole grains, green veggies","Correct coexisting hypokalemia and hypocalcemia","Monitor DTRs + respiratory rate during IV replacement"], "HYPERMAGNESEMIA (Mg2+ > 2.5)", ["Renal failure (#1 cause)","Excessive Mg antacids / laxatives (Milk of Magnesia)","Excessive IV MgSO4 (eclampsia treatment)","Adrenal insufficiency"], ["Flushing, feeling of warmth (early)","Nausea, vomiting","LOSS of deep tendon reflexes (DTRs) -- FIRST SIGN","Hypotension, bradycardia","Respiratory depression -- LIFE-THREATENING","Cardiac arrest (very high Mg levels)"], ["STOP all Mg-containing medications immediately","Calcium gluconate IV (antidote -- reverses Mg effects)","IV fluids + loop diuretics to excrete Mg","Dialysis (severe / renal failure)","Respiratory support / ventilation if needed"], "LOW Mg = SHAKY & HYPERACTIVE (tremors, increased DTRs) -- think ALCOHOLICS. HIGH Mg = EVERYTHING SLOWS (DTRs disappear FIRST, then breathing stops). CALCIUM GLUCONATE = ANTIDOTE for Mg toxicity!", ["Monitor DTRs before each IV Mg dose -- absent DTRs = HOLD magnesium (sign of toxicity)", "Calcium gluconate is the antidote for magnesium sulfate toxicity", "Keep calcium gluconate at bedside for ALL patients receiving IV MgSO4", "Respiratory rate must be > 12/min and urine output > 25-30 mL/hr before giving IV Mg", "Hypomagnesemia causes refractory hypokalemia -- treat Mg first, then K+"], C_TEAL) # PHOSPHORUS story += elec_block("PHOSPHORUS (PO4)","2.5-4.5 mg/dL", "Bone and teeth formation; energy production (ATP); cell membrane structure; acid-base balance.", "HYPOPHOSPHATEMIA (PO4 < 2.5)", ["Malnutrition, anorexia nervosa","Refeeding syndrome (restarting nutrition)","Antacid overuse (aluminum-based binds PO4)","Hyperparathyroidism","Chronic alcoholism","Respiratory alkalosis"], ["Profound muscle weakness (including respiratory)","Fatigue, bone pain","Confusion, irritability","Hemolytic anemia","Difficulty weaning from ventilator","Pathologic fractures"], ["Oral phosphate supplements (mild)","IV sodium or potassium phosphate (severe)","Phosphate-rich diet: dairy, meat, nuts, legumes","Discontinue phosphate-binding antacids","Monitor for refeeding syndrome when restarting nutrition"], "HYPERPHOSPHATEMIA (PO4 > 4.5)", ["Chronic renal failure (#1 cause)","Hypoparathyroidism","Excessive phosphate laxatives/enemas","Tumor lysis syndrome","Rhabdomyolysis"], ["Hypocalcemia symptoms (inverse relationship)","Tetany, muscle cramps","Positive Trousseau's / Chvostek's signs","Soft tissue / vascular calcifications","Pruritus (itching)","Bone and joint pain"], ["Phosphate-restricted diet","Phosphate binders WITH meals (calcium carbonate, sevelamer)","Increase fluid intake","Dialysis for renal failure patients","Correct hypocalcemia as needed"], "P = POWER (ATP = Energy). LOW P = NO ENERGY (weak muscles, can't breathe off vent). HIGH P STEALS CALCIUM -- Ca and P are like a SEESAW: one goes UP, the other goes DOWN!", ["Calcium and phosphorus are INVERSELY related -- high P = low Ca signs (tetany, twitching)", "Refeeding syndrome causes dangerous hypophosphatemia -- monitor in malnourished patients restarting nutrition", "Phosphate binders must be given WITH meals (not between meals) to bind dietary phosphorus", "Chronic renal failure: HIGH K+, HIGH PO4, LOW Ca2+ -- classic triad"], C_DPINK) # IV FLUIDS story.append(sec_hdr("IV FLUID TYPES -- NCLEX Quick Reference", C_INDIGO)); story.append(Spacer(1,0.1*cm)) ivr=[["Type","Examples","Tonicity","Cell Effect","NCLEX Use"], ["ISOTONIC","0.9% NaCl (NS)\nLactated Ringer's\nD5W (acts isotonic in bag)","275-295 mOsm/L\n(same as blood)","Cells stay\nSAME SIZE","Fluid replacement, hypovolemia\nPre/post-op, blood transfusion compatible"], ["HYPOTONIC","0.45% NaCl (1/2 NS)\n0.33% NaCl\nD2.5W","< 275 mOsm/L\n(less than blood)","Water moves IN\nCells SWELL","Cellular dehydration\nHypernatremia\nDKA maintenance"], ["HYPERTONIC","3% NaCl\nD5NS | D5 1/2NS\nD10W"," > 295 mOsm/L\n(more than blood)","Water moves OUT\nCells SHRINK","Severe hyponatremia\nCerebral edema\nSIADH"]] ivt=Table([[Paragraph(c,S_HDR if i==0 else (S_CELLB if j==0 else S_CELL)) for j,c in enumerate(row)] for i,row in enumerate(ivr)], colWidths=[W*0.13,W*0.25,W*0.17,W*0.16,W*0.29]) ivt.setStyle(TableStyle([("BACKGROUND",(0,0),(-1,0),C_INDIGO), ("BACKGROUND",(0,1),(-1,1),C_LGREEN),("BACKGROUND",(0,2),(-1,2),colors.HexColor("#E3F2FD")), ("BACKGROUND",(0,3),(-1,3),C_LRED),("GRID",(0,0),(-1,-1),0.4,C_MGRAY), ("VALIGN",(0,0),(-1,-1),"MIDDLE"),("TOPPADDING",(0,0),(-1,-1),5), ("BOTTOMPADDING",(0,0),(-1,-1),5),("LEFTPADDING",(0,0),(-1,-1),5)])) story.append(ivt) story.append(box([ Paragraph("Memory: ISO = same size, HYPO = cells swell (water rushes in), HYPER = cells shrink (water pulled out)", S_TRICK), Paragraph("WARNING: Do NOT give hypotonic fluids to head-injury patients (worsens cerebral edema). Do NOT infuse hypertonic saline rapidly.", S_WARN)], bg=C_YELLOW, border=C_DYELLOW)) story.append(Spacer(1,0.25*cm)) # INTERACTIONS story.append(sec_hdr("KEY ELECTROLYTE INTERACTIONS", C_BROWN)); story.append(Spacer(1,0.1*cm)) intr=[["Relationship","Clinical Significance"], ["Ca2+ UP <--> PO4 DOWN (Inverse)","When phosphorus rises, calcium falls. Classic in chronic renal failure."], ["Mg2+ LOW causes K+ LOW and Ca2+ LOW","Hypomagnesemia makes hypokalemia and hypocalcemia resistant to treatment. Fix Mg FIRST!"], ["Acidosis (pH down) --> K+ UP","H+ ions shift into cells, K+ shifts out. Every 0.1 pH drop raises K+ by ~0.5 mEq/L."], ["Alkalosis (pH up) --> K+ DOWN","H+ shifts out of cells, K+ shifts in. Vomiting causes alkalosis and hypokalemia."], ["Insulin --> K+ DOWN (shifts into cells)","Used therapeutically for hyperkalemia. Insulin + dextrose drives K+ into cells."], ["Loop diuretics --> K+ DOWN + Mg2+ DOWN","Furosemide wastes both potassium AND magnesium. Monitor both electrolyte levels."]] intt=Table([[Paragraph(c,S_HDR if i==0 else (S_CELLB if j==0 else S_CELL)) for j,c in enumerate(row)] for i,row in enumerate(intr)], colWidths=[W*0.38,W*0.62]) intt.setStyle(TableStyle([("BACKGROUND",(0,0),(-1,0),C_BROWN), ("ROWBACKGROUNDS",(0,1),(-1,-1),[C_LBROWN,C_WHITE]),("GRID",(0,0),(-1,-1),0.4,C_MGRAY), ("VALIGN",(0,0),(-1,-1),"MIDDLE"),("TOPPADDING",(0,0),(-1,-1),5), ("BOTTOMPADDING",(0,0),(-1,-1),5),("LEFTPADDING",(0,0),(-1,-1),6)])) story.append(intt); story.append(Spacer(1,0.25*cm)) # TOP TIPS story.append(sec_hdr("TOP NCLEX EXAM TIPS -- Electrolytes", C_RED)); story.append(Spacer(1,0.1*cm)) tips=[("NEVER IV push potassium","IV K+ push = fatal cardiac arrest. Always dilute, max 10-20 mEq/hr."), ("Calcium gluconate = antidote x2","Treats both hyperkalemia (heart protection) AND hypermagnesemia (Mg reversal)."), ("DTRs = Mg toxicity warning","Loss of DTRs is FIRST sign of Mg toxicity -- hold Mg, give calcium gluconate."), ("Keep Ca gluconate at bedside","Mandatory for ALL patients on IV MgSO4 (preeclampsia, eclampsia)."), ("Correct electrolytes SLOWLY","Rapid Na+ correction = osmotic demyelination (hypo) or cerebral edema (hyper)."), ("Trousseau + Chvostek = low Ca/Mg","Both signs = neuromuscular irritability from low calcium OR low magnesium."), ("Renal failure triad","Chronic renal failure = HIGH K+, HIGH PO4, LOW Ca2+. Always expect these three."), ("Know your diuretics","Loop = wastes K+, Mg | Thiazide = wastes K+ | K-sparing = SAVES K+ (can raise it too high)."), ("ECG + K+ go together","Peaked T-wave = hyperkalemia. Flat T-wave + U-wave = hypokalemia."), ("Thirst = earliest hypernatremia","Ask about thirst + check mucous membranes for dryness first.")] ttips=Table([[Paragraph(f" {t}",S_WARN),Paragraph(d,S_BODY)] for t,d in tips], colWidths=[W*0.35,W*0.65]) ttips.setStyle(TableStyle([("ROWBACKGROUNDS",(0,0),(-1,-1),[C_LRED,C_WHITE]), ("GRID",(0,0),(-1,-1),0.3,C_MGRAY),("VALIGN",(0,0),(-1,-1),"MIDDLE"), ("TOPPADDING",(0,0),(-1,-1),5),("BOTTOMPADDING",(0,0),(-1,-1),5),("LEFTPADDING",(0,0),(-1,-1),6)])) story.append(ttips); story.append(Spacer(1,0.2*cm)) # FOOTER story.append(HRFlowable(width=W, color=C_MGRAY)); story.append(Spacer(1,0.1*cm)) story.append(Paragraph("NCLEX-RN Electrolytes Quick Reference | NCLEX-RN Exam Preparation | July 2026 | Na - K - Ca - Mg - PO4 - Cl", S_FOOTER)) doc.build(story) print("PDF created:", OUTPUT) PYEOF echo "Script written OK"