Currently i prepare for nclex rn
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-pβ¦
~/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
~/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' frβ¦