What type of bilirubin is present in... Patient with physiological jaundice, baby.
| Feature | Unconjugated (Indirect) | Conjugated (Direct) |
|---|---|---|
| Water solubility | Low (lipid-soluble) | High |
| Crosses blood-brain barrier | Yes - toxic | No |
| Urine bilirubin | Absent | Present |
| Cause in physiological jaundice | Yes | No |
| van den Bergh reaction | Indirect positive | Direct positive |
Create a study guide comparing physiological vs pathological neonatal jaundice
mkdir -p /tmp/workspace/neonatal-jaundice && ls /tmp/workspace/
~/neonatal-jaundice/generate_study_guide.py
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm, mm
from reportlab.platypus import (
SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
HRFlowable, KeepTogether
)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.platypus import PageBreak
OUTPUT = "/tmp/workspace/neonatal-jaundice/Neonatal_Jaundice_Study_Guide.pdf"
# ── Colours ──────────────────────────────────────────────────────────────────
NAVY = colors.HexColor("#1a2e5a")
TEAL = colors.HexColor("#007B82")
GOLD = colors.HexColor("#E8A020")
LIGHT_BLUE = colors.HexColor("#D6EAF8")
LIGHT_RED = colors.HexColor("#FDEDEC")
LIGHT_GRN = colors.HexColor("#E9F7EF")
YELLOW_BG = colors.HexColor("#FEF9E7")
LIGHT_GREY = colors.HexColor("#F2F3F4")
WHITE = colors.white
RED = colors.HexColor("#C0392B")
GREEN = colors.HexColor("#1E8449")
# ── Document ─────────────────────────────────────────────────────────────────
doc = SimpleDocTemplate(
OUTPUT, pagesize=A4,
rightMargin=1.8*cm, leftMargin=1.8*cm,
topMargin=2*cm, bottomMargin=2*cm
)
# ── Styles ────────────────────────────────────────────────────────────────────
styles = getSampleStyleSheet()
def style(name, **kw):
s = ParagraphStyle(name, **kw)
return s
title_style = style("MyTitle",
fontName="Helvetica-Bold", fontSize=22, textColor=WHITE,
alignment=TA_CENTER, spaceAfter=4)
subtitle_style = style("MySubtitle",
fontName="Helvetica", fontSize=11, textColor=LIGHT_BLUE,
alignment=TA_CENTER, spaceAfter=2)
h1 = style("H1",
fontName="Helvetica-Bold", fontSize=14, textColor=WHITE,
spaceBefore=10, spaceAfter=6, leftIndent=0)
h2 = style("H2",
fontName="Helvetica-Bold", fontSize=11, textColor=NAVY,
spaceBefore=8, spaceAfter=4)
body = style("Body",
fontName="Helvetica", fontSize=9.5, textColor=colors.black,
leading=14, spaceAfter=4, alignment=TA_JUSTIFY)
body_sm = style("BodySm",
fontName="Helvetica", fontSize=8.8, textColor=colors.black,
leading=13, spaceAfter=3, alignment=TA_JUSTIFY)
bullet = style("Bullet",
fontName="Helvetica", fontSize=9.2, textColor=colors.black,
leading=13, spaceAfter=3, leftIndent=14, firstLineIndent=-10)
bold_b = style("BoldBullet",
fontName="Helvetica-Bold", fontSize=9.2, textColor=NAVY,
leading=13, spaceAfter=3, leftIndent=14, firstLineIndent=-10)
caption = style("Caption",
fontName="Helvetica-Oblique", fontSize=8, textColor=colors.grey,
alignment=TA_CENTER, spaceAfter=4)
note_style = style("Note",
fontName="Helvetica-Oblique", fontSize=8.5, textColor=colors.HexColor("#555555"),
leading=12, spaceAfter=3, leftIndent=6)
warning_style = style("Warning",
fontName="Helvetica-Bold", fontSize=9, textColor=RED,
leading=13, spaceAfter=3, leftIndent=6)
cell_hdr = style("CellHdr",
fontName="Helvetica-Bold", fontSize=9, textColor=WHITE,
alignment=TA_CENTER, leading=12)
cell_body = style("CellBody",
fontName="Helvetica", fontSize=8.8, textColor=colors.black,
leading=12, alignment=TA_LEFT)
cell_body_c = style("CellBodyC",
fontName="Helvetica", fontSize=8.8, textColor=colors.black,
leading=12, alignment=TA_CENTER)
cell_green = style("CellGreen",
fontName="Helvetica", fontSize=8.8, textColor=GREEN,
leading=12, alignment=TA_CENTER, fontName="Helvetica-Bold")
cell_red = style("CellRed",
fontName="Helvetica", fontSize=8.8, textColor=RED,
leading=12, alignment=TA_CENTER, fontName="Helvetica-Bold")
story = []
# ═════════════════════════════════════════════════════════════════════════════
# TITLE BANNER
# ═════════════════════════════════════════════════════════════════════════════
title_data = [[
Paragraph("NEONATAL JAUNDICE", title_style),
]]
title_sub_data = [[
Paragraph("Physiological vs Pathological — Complete Study Guide", subtitle_style),
]]
banner = Table(title_data, colWidths=[17.4*cm])
banner.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), NAVY),
("ROUNDEDCORNERS", [8]),
("TOPPADDING", (0,0), (-1,-1), 14),
("BOTTOMPADDING", (0,0), (-1,-1), 6),
("LEFTPADDING", (0,0), (-1,-1), 10),
("RIGHTPADDING", (0,0), (-1,-1), 10),
]))
sub_banner = Table(title_sub_data, colWidths=[17.4*cm])
sub_banner.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), TEAL),
("TOPPADDING", (0,0), (-1,-1), 6),
("BOTTOMPADDING", (0,0), (-1,-1), 8),
("LEFTPADDING", (0,0), (-1,-1), 10),
("RIGHTPADDING", (0,0), (-1,-1), 10),
]))
story.append(banner)
story.append(sub_banner)
story.append(Spacer(1, 0.4*cm))
# Source line
story.append(Paragraph(
"Sources: Robbins & Kumar Basic Pathology · Harper's Illustrated Biochemistry 32e · "
"Rosen's Emergency Medicine · Tietz Textbook of Laboratory Medicine · "
"Creasy & Resnik's Maternal-Fetal Medicine · Harrison's Principles 22e",
caption))
story.append(Spacer(1, 0.3*cm))
# ═════════════════════════════════════════════════════════════════════════════
# SECTION 1 – BILIRUBIN METABOLISM (quick recap)
# ═════════════════════════════════════════════════════════════════════════════
def section_header(text, color=TEAL):
data = [[Paragraph(text, h1)]]
t = Table(data, colWidths=[17.4*cm])
t.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), color),
("TOPPADDING", (0,0), (-1,-1), 6),
("BOTTOMPADDING", (0,0), (-1,-1), 6),
("LEFTPADDING", (0,0), (-1,-1), 10),
("ROUNDEDCORNERS", [4]),
]))
return t
story.append(section_header("1. Bilirubin Metabolism — Quick Recap"))
story.append(Spacer(1, 0.2*cm))
meta_data = [
[Paragraph("<b>Step</b>", cell_hdr), Paragraph("<b>Process</b>", cell_hdr), Paragraph("<b>Key Enzyme / Carrier</b>", cell_hdr)],
[Paragraph("1", cell_body_c), Paragraph("RBC breakdown → haem → biliverdin → <b>unconjugated bilirubin</b> (UCB)", cell_body), Paragraph("Haem oxygenase, Biliverdin reductase", cell_body)],
[Paragraph("2", cell_body_c), Paragraph("UCB carried in blood bound to <b>albumin</b> (lipid-soluble, insoluble in water)", cell_body), Paragraph("Albumin transport", cell_body)],
[Paragraph("3", cell_body_c), Paragraph("Hepatocyte uptake → conjugation with glucuronate → <b>conjugated bilirubin</b> (CB, water-soluble)", cell_body), Paragraph("UDP-glucuronosyltransferase (UGT1A1)", cell_body)],
[Paragraph("4", cell_body_c), Paragraph("CB excreted into bile → gut → urobilinogen → stercobilin (stool colour)", cell_body), Paragraph("Canalicular MRP2 transporter", cell_body)],
]
meta_table = Table(meta_data, colWidths=[1.0*cm, 10.8*cm, 5.6*cm])
meta_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), NAVY),
("ROWBACKGROUNDS",(0,1), (-1,-1), [LIGHT_GREY, WHITE]),
("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#CCCCCC")),
("TOPPADDING", (0,0), (-1,-1), 5),
("BOTTOMPADDING", (0,0), (-1,-1), 5),
("LEFTPADDING", (0,0), (-1,-1), 6),
("VALIGN", (0,0), (-1,-1), "MIDDLE"),
]))
story.append(meta_table)
story.append(Spacer(1, 0.4*cm))
# ═════════════════════════════════════════════════════════════════════════════
# SECTION 2 – MASTER COMPARISON TABLE
# ═════════════════════════════════════════════════════════════════════════════
story.append(section_header("2. Physiological vs Pathological — Master Comparison"))
story.append(Spacer(1, 0.25*cm))
comp_hdr_style = style("CompHdr",
fontName="Helvetica-Bold", fontSize=9, textColor=WHITE,
alignment=TA_CENTER, leading=12)
comp_feat_style = style("CompFeat",
fontName="Helvetica-Bold", fontSize=8.8, textColor=NAVY,
leading=12, alignment=TA_LEFT)
comp_phys_style = style("CompPhys",
fontName="Helvetica", fontSize=8.8, textColor=colors.HexColor("#1A5276"),
leading=12, alignment=TA_LEFT)
comp_path_style = style("CompPath",
fontName="Helvetica", fontSize=8.8, textColor=colors.HexColor("#7B241C"),
leading=12, alignment=TA_LEFT)
rows = [
# Header
[Paragraph("Feature", comp_hdr_style),
Paragraph("Physiological Jaundice", comp_hdr_style),
Paragraph("Pathological Jaundice", comp_hdr_style)],
# Rows
[Paragraph("Also called", comp_feat_style),
Paragraph("Neonatal / physiologic jaundice of the newborn", comp_phys_style),
Paragraph("Neonatal hyperbilirubinemia (pathologic)", comp_path_style)],
[Paragraph("Onset", comp_feat_style),
Paragraph("Day 2–3 of life", comp_phys_style),
Paragraph("<b>First 24 hours</b> (always pathologic if day 1)", comp_path_style)],
[Paragraph("Duration", comp_feat_style),
Paragraph("Resolves by 2 weeks (term); up to 3 weeks in preterm", comp_phys_style),
Paragraph("Persists beyond 2 weeks (term) / 3 weeks (preterm)", comp_path_style)],
[Paragraph("Type of bilirubin", comp_feat_style),
Paragraph("<b>Unconjugated (indirect)</b> only", comp_phys_style),
Paragraph("Unconjugated (most causes) OR <b>conjugated</b> — conjugated is ALWAYS pathological", comp_path_style)],
[Paragraph("Bilirubin level", comp_feat_style),
Paragraph("Term: peaks 5–6 mg/dL (day 3–4)\nPreterm: peaks ~10–12 mg/dL", comp_phys_style),
Paragraph(">12 mg/dL in term; >15 mg/dL in preterm; rising >5 mg/dL/day is a red flag", comp_path_style)],
[Paragraph("Rate of rise", comp_feat_style),
Paragraph("Gradual, <5 mg/dL/day", comp_phys_style),
Paragraph("><b>5 mg/dL/day</b> (or any rise in first 24 h)", comp_path_style)],
[Paragraph("Cause / mechanism", comp_feat_style),
Paragraph("1. Immature UDP-glucuronosyltransferase\n2. Accelerated HbF breakdown\n3. Increased enterohepatic resorption", comp_phys_style),
Paragraph("Hemolysis (ABO/Rh incompatibility, G6PD, spherocytosis), sepsis, TORCH infections, biliary atresia, metabolic disorders (hypothyroidism, galactosemia)", comp_path_style)],
[Paragraph("Bilirubin in urine", comp_feat_style),
Paragraph("Absent (unconjugated is not excreted in urine)", comp_phys_style),
Paragraph("Present if conjugated hyperbilirubinemia", comp_path_style)],
[Paragraph("Stool colour", comp_feat_style),
Paragraph("Normal (yellow/brown)", comp_phys_style),
Paragraph("Pale/acholic stools suggest biliary obstruction", comp_path_style)],
[Paragraph("General condition", comp_feat_style),
Paragraph("Baby looks well, feeds normally", comp_phys_style),
Paragraph("Baby may appear sick, lethargic, poor feeding", comp_path_style)],
[Paragraph("Haemoglobin / haematocrit", comp_feat_style),
Paragraph("Normal", comp_phys_style),
Paragraph("May be low (haemolytic causes)", comp_path_style)],
[Paragraph("Direct Coombs test", comp_feat_style),
Paragraph("Negative", comp_phys_style),
Paragraph("Positive in isoimmune haemolytic disease (ABO, Rh)", comp_path_style)],
[Paragraph("Risk of kernicterus", comp_feat_style),
Paragraph("Very low (bilirubin rarely reaches toxic levels)", comp_phys_style),
Paragraph("<b>HIGH</b> — unconjugated bilirubin >20–25 mg/dL can cross BBB", comp_path_style)],
[Paragraph("Treatment needed", comp_feat_style),
Paragraph("Usually none; adequate feeding;\nphototherapy if levels approach threshold", comp_phys_style),
Paragraph("Phototherapy, exchange transfusion; treat underlying cause", comp_path_style)],
[Paragraph("Prognosis", comp_feat_style),
Paragraph("Excellent — self-limiting", comp_phys_style),
Paragraph("Depends on cause; kernicterus is largely preventable with early treatment", comp_path_style)],
]
col_w = [3.6*cm, 6.7*cm, 7.1*cm]
comp_table = Table(rows, colWidths=col_w, repeatRows=1)
comp_table.setStyle(TableStyle([
# Header row
("BACKGROUND", (0,0), (-1,0), NAVY),
("BACKGROUND", (1,1), (1,-1), colors.HexColor("#EBF5FB")), # physio col
("BACKGROUND", (2,1), (2,-1), colors.HexColor("#FDEDEC")), # patho col
("BACKGROUND", (0,1), (0,-1), LIGHT_GREY), # feature col
# Grid
("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#BBBBBB")),
("TOPPADDING", (0,0), (-1,-1), 5),
("BOTTOMPADDING", (0,0), (-1,-1), 5),
("LEFTPADDING", (0,0), (-1,-1), 6),
("RIGHTPADDING", (0,0), (-1,-1), 6),
("VALIGN", (0,0), (-1,-1), "TOP"),
# Alternate row shading on feature column
]))
story.append(comp_table)
story.append(Spacer(1, 0.4*cm))
# ═════════════════════════════════════════════════════════════════════════════
# SECTION 3 – CAUSES OF PATHOLOGICAL JAUNDICE
# ═════════════════════════════════════════════════════════════════════════════
story.append(section_header("3. Causes of Pathological Neonatal Jaundice", color=colors.HexColor("#8E44AD")))
story.append(Spacer(1, 0.2*cm))
cause_data = [
[Paragraph("<b>Category</b>", cell_hdr),
Paragraph("<b>Unconjugated Hyperbilirubinemia</b>", cell_hdr),
Paragraph("<b>Conjugated Hyperbilirubinemia</b>", cell_hdr)],
[Paragraph("Haemolytic", cell_body_c),
Paragraph("ABO incompatibility, Rh incompatibility (erythroblastosis fetalis), G6PD deficiency, hereditary spherocytosis, pyruvate kinase deficiency, thalassemia, sickle cell", cell_body),
Paragraph("—", cell_body_c)],
[Paragraph("Infectious", cell_body_c),
Paragraph("TORCH infections, UTI, sepsis", cell_body),
Paragraph("TORCH infections, gram-negative sepsis, hepatitis B, varicella, CMV, HIV", cell_body)],
[Paragraph("Obstructive", cell_body_c),
Paragraph("Meconium ileus, Hirschsprung disease, pyloric stenosis", cell_body),
Paragraph("<b>Biliary atresia</b>, choledochal cyst, Alagille syndrome, neonatal hepatitis, inspissated bile syndrome", cell_body)],
[Paragraph("Metabolic / Genetic", cell_body_c),
Paragraph("Crigler-Najjar syndrome type I & II, Gilbert syndrome, congenital hypothyroidism, galactosemia", cell_body),
Paragraph("Galactosemia, α1-antitrypsin deficiency, tyrosinemia, cystic fibrosis, Niemann-Pick, Gaucher, Dubin-Johnson, Rotor syndrome", cell_body)],
[Paragraph("Breast milk jaundice", cell_body_c),
Paragraph("Mild unconjugated hyperbilirubinemia; peaks later than physiologic jaundice; may persist weeks to months; hormonally mediated or increased enterohepatic resorption", cell_body),
Paragraph("—", cell_body_c)],
[Paragraph("Miscellaneous", cell_body_c),
Paragraph("Prematurity, cephalhematoma, polycythemia, dehydration", cell_body),
Paragraph("Parenteral nutrition, drugs, toxins", cell_body)],
]
cause_table = Table(cause_data, colWidths=[2.6*cm, 7.4*cm, 7.4*cm], repeatRows=1)
cause_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), colors.HexColor("#8E44AD")),
("ROWBACKGROUNDS",(0,1), (-1,-1), [LIGHT_GREY, WHITE]),
("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#CCCCCC")),
("TOPPADDING", (0,0), (-1,-1), 5),
("BOTTOMPADDING", (0,0), (-1,-1), 5),
("LEFTPADDING", (0,0), (-1,-1), 6),
("VALIGN", (0,0), (-1,-1), "TOP"),
("ALIGN", (0,0), (0,-1), "CENTER"),
]))
story.append(cause_table)
story.append(Spacer(1, 0.4*cm))
# ═════════════════════════════════════════════════════════════════════════════
# SECTION 4 – KERNICTERUS
# ═════════════════════════════════════════════════════════════════════════════
story.append(section_header("4. Kernicterus (Bilirubin Encephalopathy)", color=RED))
story.append(Spacer(1, 0.2*cm))
kern_data = [
[Paragraph("<b>Aspect</b>", cell_hdr), Paragraph("<b>Details</b>", cell_hdr)],
[Paragraph("Definition", cell_body_c),
Paragraph("Neurologic syndrome from deposition of <b>unconjugated bilirubin</b> in the basal ganglia and brainstem nuclei, causing neuronal necrosis", cell_body)],
[Paragraph("Threshold risk", cell_body_c),
Paragraph("Unconjugated bilirubin >20–25 mg/dL saturates albumin; free bilirubin crosses blood-brain barrier. In Rh haemolytic disease: kernicterus in 8% at 19–24 mg/dL, 33% at 25–29 mg/dL, 73% at 30–40 mg/dL", cell_body)],
[Paragraph("Risk factors", cell_body_c),
Paragraph("Prematurity, hypoalbuminaemia, acidosis, hypoxia, infection, blood-brain barrier disruption", cell_body)],
[Paragraph("Acute features", cell_body_c),
Paragraph("Phase 1: Poor feeding, lethargy, hypotonia, high-pitched cry\nPhase 2: Hypertonia, retrocollis, opisthotonos, seizures, fever\nPhase 3 (late): Irreversible hypotonia, developmental delay", cell_body)],
[Paragraph("Chronic sequelae", cell_body_c),
Paragraph("Choreoathetosis, spastic quadriplegia, mental retardation, sensorineural hearing loss, upward gaze palsy (Parinaud syndrome). 70% of affected infants die in first week.", cell_body)],
[Paragraph("Imaging (MRI)", cell_body_c),
Paragraph("Symmetric T1 hyperintensity of the globi pallidi (classic finding on MRI)", cell_body)],
[Paragraph("Prevention", cell_body_c),
Paragraph("Phototherapy + exchange transfusion; routine risk assessment before discharge; close follow-up; kernicterus is largely <b>preventable</b>", cell_body)],
]
kern_table = Table(kern_data, colWidths=[3.2*cm, 14.2*cm], repeatRows=1)
kern_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), RED),
("ROWBACKGROUNDS",(0,1), (-1,-1), [colors.HexColor("#FEF9F9"), WHITE]),
("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#CCCCCC")),
("TOPPADDING", (0,0), (-1,-1), 5),
("BOTTOMPADDING", (0,0), (-1,-1), 5),
("LEFTPADDING", (0,0), (-1,-1), 6),
("VALIGN", (0,0), (-1,-1), "TOP"),
("ALIGN", (0,0), (0,-1), "CENTER"),
]))
story.append(kern_table)
story.append(Spacer(1, 0.4*cm))
# ═════════════════════════════════════════════════════════════════════════════
# SECTION 5 – TREATMENT
# ═════════════════════════════════════════════════════════════════════════════
story.append(section_header("5. Management & Treatment", color=GREEN))
story.append(Spacer(1, 0.2*cm))
tx_data = [
[Paragraph("<b>Modality</b>", cell_hdr),
Paragraph("<b>Mechanism</b>", cell_hdr),
Paragraph("<b>Indication</b>", cell_hdr),
Paragraph("<b>Notes</b>", cell_hdr)],
[Paragraph("Phototherapy\n(Blue light 430–490 nm)", cell_body_c),
Paragraph("Converts unconjugated bilirubin to water-soluble lumirubin photoisomers excreted in bile and urine without conjugation", cell_body),
Paragraph("First-line when bilirubin approaches threshold levels; guided by AAP nomogram", cell_body),
Paragraph("Phenobarbital may be used adjunctively to induce UGT1A1", cell_body)],
[Paragraph("Exchange transfusion", cell_body_c),
Paragraph("Removes bilirubin-laden RBCs and free unconjugated bilirubin from circulation", cell_body),
Paragraph("Severe hyperbilirubinemia (>25 mg/dL term), acute bilirubin encephalopathy, failing phototherapy", cell_body),
Paragraph("Double-volume exchange; guided by gestational age + risk factors (AAP guidelines)", cell_body)],
[Paragraph("Adequate feeding / hydration", cell_body_c),
Paragraph("Increases gut motility, reduces enterohepatic resorption", cell_body),
Paragraph("All neonates — first-line supportive measure", cell_body),
Paragraph("Breastfeeding should not be stopped; supplement if dehydrated", cell_body)],
[Paragraph("Treat underlying cause", cell_body_c),
Paragraph("Varies by aetiology", cell_body),
Paragraph("Pathological jaundice only", cell_body),
Paragraph("e.g., IV immunoglobulin for isoimmune haemolysis, thyroid hormone for hypothyroidism", cell_body)],
[Paragraph("Liver transplant", cell_body_c),
Paragraph("Provides functional UGT1A1 enzyme", cell_body),
Paragraph("Crigler-Najjar syndrome type I (definitive treatment)", cell_body),
Paragraph("Phototherapy 12–16 h/day until transplant", cell_body)],
]
tx_table = Table(tx_data, colWidths=[3.5*cm, 4.8*cm, 5.0*cm, 4.1*cm], repeatRows=1)
tx_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), GREEN),
("ROWBACKGROUNDS",(0,1), (-1,-1), [LIGHT_GRN, WHITE]),
("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#CCCCCC")),
("TOPPADDING", (0,0), (-1,-1), 5),
("BOTTOMPADDING", (0,0), (-1,-1), 5),
("LEFTPADDING", (0,0), (-1,-1), 6),
("VALIGN", (0,0), (-1,-1), "TOP"),
("ALIGN", (0,0), (0,-1), "CENTER"),
]))
story.append(tx_table)
story.append(Spacer(1, 0.4*cm))
# ═════════════════════════════════════════════════════════════════════════════
# SECTION 6 – HIGH-YIELD MNEMONICS & EXAM TIPS
# ═════════════════════════════════════════════════════════════════════════════
story.append(section_header("6. High-Yield Exam Points & Mnemonics", color=GOLD))
story.append(Spacer(1, 0.2*cm))
# Two-column layout: mnemonics left, exam tips right
mnem_block = [
Paragraph("<b>Remember: \"JAUNDICE\" (Pathological Flags)</b>", h2),
Paragraph("<b>J</b>aundice within first 24 hours — always pathological", bullet),
Paragraph("<b>A</b>lways check if conjugated — conjugated = always pathological", bullet),
Paragraph("<b>U</b>nconjugated >12 mg/dL in term = investigate", bullet),
Paragraph("<b>N</b>ot resolving by 2 weeks = pathological", bullet),
Paragraph("<b>D</b>irect Coombs positive = haemolytic disease", bullet),
Paragraph("<b>I</b>nfection (sepsis, TORCH) as cause", bullet),
Paragraph("<b>C</b>holestasis (pale stools, dark urine) = surgical emergency", bullet),
Paragraph("<b>E</b>xchange transfusion if bilirubin >25 mg/dL or BIND", bullet),
Spacer(1, 0.3*cm),
Paragraph("<b>Physiological Jaundice — '2-2-2 Rule'</b>", h2),
Paragraph("Appears day <b>2</b>", bullet),
Paragraph("Peaks day <b>2–5</b>", bullet),
Paragraph("Resolves by <b>2</b> weeks (term)", bullet),
]
exam_tips = [
Paragraph("<b>Key Exam Facts</b>", h2),
Paragraph("• Conjugated hyperbilirubinemia is <b>ALWAYS</b> pathological in neonates (Rosen's EM)", bullet),
Paragraph("• Physiological jaundice = <b>unconjugated only</b>", bullet),
Paragraph("• Jaundice visible when bilirubin >5 mg/dL", bullet),
Paragraph("• Breast milk jaundice: peaks later than physiological, persists weeks; do NOT stop breastfeeding", bullet),
Paragraph("• Crigler-Najjar type I = absent UGT1A1 = fatal without liver transplant", bullet),
Paragraph("• Crigler-Najjar type II = reduced UGT1A1 = responds to phenobarbital", bullet),
Paragraph("• Gilbert syndrome = mildly reduced UGT1A1 = benign, fluctuating, no treatment needed", bullet),
Paragraph("• MRI in kernicterus: T1 hyperintensity of globi pallidi", bullet),
Paragraph("• Phototherapy converts bilirubin to lumirubin (excreted without conjugation)", bullet),
Paragraph("• Rh incompatibility more severe than ABO; ABO more common", bullet),
]
two_col = Table([[mnem_block, exam_tips]], colWidths=[8.5*cm, 8.9*cm])
two_col.setStyle(TableStyle([
("VALIGN", (0,0), (-1,-1), "TOP"),
("LEFTPADDING", (0,0), (-1,-1), 4),
("RIGHTPADDING", (0,0), (-1,-1), 4),
("BACKGROUND", (0,0), (0,0), YELLOW_BG),
("BACKGROUND", (1,0), (1,0), LIGHT_BLUE),
("GRID", (0,0), (-1,-1), 0.5, colors.HexColor("#DDDDDD")),
("TOPPADDING", (0,0), (-1,-1), 8),
("BOTTOMPADDING", (0,0), (-1,-1), 8),
]))
story.append(two_col)
story.append(Spacer(1, 0.4*cm))
# ═════════════════════════════════════════════════════════════════════════════
# SECTION 7 – QUICK REFERENCE FLOWCHART (text-based)
# ═════════════════════════════════════════════════════════════════════════════
story.append(section_header("7. Clinical Decision Approach (Simplified)", color=NAVY))
story.append(Spacer(1, 0.2*cm))
flow_data = [
[Paragraph("<b>Neonate with jaundice</b>", style("FlowHdr", fontName="Helvetica-Bold", fontSize=10, textColor=WHITE, alignment=TA_CENTER)), "", ""],
[Paragraph("When did it appear?", comp_feat_style),
Paragraph("Day 1 (< 24 h)\n→ PATHOLOGICAL\n→ Check Coombs, blood group, haemolysis screen", comp_path_style),
Paragraph("Day 2–3\n→ Likely PHYSIOLOGICAL\n→ Monitor levels, feed well", comp_phys_style)],
[Paragraph("Type of bilirubin?", comp_feat_style),
Paragraph("Conjugated present (direct > 1 mg/dL or > 20% total)\n→ ALWAYS PATHOLOGICAL\n→ Workup: liver function, biliary atresia screen, metabolic screen", comp_path_style),
Paragraph("Unconjugated only\n→ May be physiological or pathological depending on level and timeline", comp_phys_style)],
[Paragraph("Duration?", comp_feat_style),
Paragraph("Still jaundiced after 2 weeks (term)\n→ PATHOLOGICAL\n→ Thyroid screen, urine reducing substances, LFTs, consider biliary atresia", comp_path_style),
Paragraph("Resolved by 2 weeks\n→ PHYSIOLOGICAL", comp_phys_style)],
[Paragraph("Level / rate of rise?", comp_feat_style),
Paragraph("Rising >5 mg/dL/day or >12 mg/dL (term)\n→ PATHOLOGICAL threshold\n→ Phototherapy ± exchange transfusion per AAP nomogram", comp_path_style),
Paragraph("Gradual rise, peak <12 mg/dL (term)\n→ PHYSIOLOGICAL range", comp_phys_style)],
]
flow_table = Table(flow_data, colWidths=[3.3*cm, 7.1*cm, 7.0*cm])
flow_table.setStyle(TableStyle([
("SPAN", (0,0), (-1,0)),
("BACKGROUND", (0,0), (-1,0), NAVY),
("ROWBACKGROUNDS",(0,1), (-1,-1), [LIGHT_GREY, WHITE, LIGHT_GREY, WHITE]),
("BACKGROUND", (1,1), (1,-1), colors.HexColor("#FDEDEC")),
("BACKGROUND", (2,1), (2,-1), colors.HexColor("#EBF5FB")),
("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#BBBBBB")),
("TOPPADDING", (0,0), (-1,-1), 6),
("BOTTOMPADDING", (0,0), (-1,-1), 6),
("LEFTPADDING", (0,0), (-1,-1), 6),
("VALIGN", (0,0), (-1,-1), "TOP"),
("ALIGN", (0,0), (-1,0), "CENTER"),
]))
story.append(flow_table)
story.append(Spacer(1, 0.5*cm))
# Footer note
story.append(HRFlowable(width="100%", thickness=0.5, color=TEAL))
story.append(Spacer(1, 0.15*cm))
story.append(Paragraph(
"Study guide compiled from: Robbins & Kumar Basic Pathology (9780323790185) · Harper's Illustrated Biochemistry 32e (9781260469943) · "
"Rosen's Emergency Medicine (9780323757898) · Tietz Textbook of Laboratory Medicine 7e (9780323775724) · "
"Creasy & Resnik's Maternal-Fetal Medicine (9780323828499) · Harrison's Principles 22e (9781265977061) · "
"Bradley & Daroff's Neurology (9780323642613)",
caption))
# ─── Build ────────────────────────────────────────────────────────────────────
doc.build(story)
print(f"PDF created: {OUTPUT}")
cd /tmp/workspace/neonatal-jaundice && python generate_study_guide.py 2>&1
~/neonatal-jaundice/generate_study_guide.py
Successfully replaced 1 instance(s) of the string in '/tmp/workspace/neonatal-jaundice/generate_study_guide.py'
cd /tmp/workspace/neonatal-jaundice && python generate_study_guide.py 2>&1
Neonatal Jaundice Study Guide
PDF Document · PDF
| Section | Contents |
|---|---|
| 1. Bilirubin Metabolism | Step-by-step table from RBC breakdown to excretion, key enzymes |
| 2. Master Comparison Table | 15 features compared side-by-side (onset, duration, bilirubin type, levels, causes, Coombs, kernicterus risk, treatment) |
| 3. Causes of Pathological Jaundice | Full differential - haemolytic, infectious, obstructive, metabolic/genetic, breast milk, miscellaneous; split by unconjugated vs conjugated |
| 4. Kernicterus | Definition, bilirubin thresholds, risk factors, acute/chronic phases, MRI findings, prevention |
| 5. Management | Phototherapy, exchange transfusion, feeding, treating underlying cause, liver transplant |
| 6. Exam Points & Mnemonics | "JAUNDICE" mnemonic for pathological flags, the "2-2-2 Rule" for physiological jaundice, 10 high-yield facts |
| 7. Clinical Decision Flowchart | When-type-duration-level decision tree in colour-coded table |