Vomiting in Neonate & Infant • Diagnostic & therapeutic approach to a neonate/infant with persistent vomiting give me notes of it in pdf
mkdir -p /tmp/workspace/neonatal-vomiting && ls /tmp/workspace/
~/neonatal-vomiting/generate_pdf.py
from reportlab.lib.pagesizes import A4
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm
from reportlab.lib.colors import HexColor, black, white
from reportlab.platypus import (
SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
HRFlowable, KeepTogether
)
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_JUSTIFY
# ── Color palette ──────────────────────────────────────────────────────────────
DARK_BLUE = HexColor("#1A3C5E")
MID_BLUE = HexColor("#2E6DA4")
LIGHT_BLUE = HexColor("#D6E8F5")
ACCENT_TEAL = HexColor("#0D7377")
WARN_RED = HexColor("#C0392B")
WARN_LIGHT = HexColor("#FDECEA")
GREEN_DARK = HexColor("#1E6E3A")
GREEN_LIGHT = HexColor("#E8F8EE")
ORANGE = HexColor("#E67E22")
ORANGE_LIGHT= HexColor("#FEF3E7")
GREY_BG = HexColor("#F5F7FA")
GREY_LINE = HexColor("#D0D8E4")
TEXT_DARK = HexColor("#1C1C2E")
TEXT_MED = HexColor("#3D4764")
doc = SimpleDocTemplate(
"/tmp/workspace/neonatal-vomiting/Vomiting_Neonate_Infant_Notes.pdf",
pagesize=A4,
leftMargin=2*cm, rightMargin=2*cm,
topMargin=2*cm, bottomMargin=2*cm
)
styles = getSampleStyleSheet()
# ── Custom styles ──────────────────────────────────────────────────────────────
def S(name, **kw):
return ParagraphStyle(name, **kw)
H1 = S("H1", fontSize=20, leading=26, textColor=white,
fontName="Helvetica-Bold", spaceAfter=4, alignment=TA_CENTER)
H2 = S("H2", fontSize=13, leading=17, textColor=white,
fontName="Helvetica-Bold", spaceAfter=2)
H3 = S("H3", fontSize=11, leading=15, textColor=DARK_BLUE,
fontName="Helvetica-Bold", spaceBefore=6, spaceAfter=3)
H4 = S("H4", fontSize=10, leading=13, textColor=ACCENT_TEAL,
fontName="Helvetica-Bold", spaceBefore=4, spaceAfter=2)
BODY = S("Body", fontSize=9.5, leading=14, textColor=TEXT_DARK,
fontName="Helvetica", spaceAfter=3, alignment=TA_JUSTIFY)
BODY_B = S("BodyB", fontSize=9.5, leading=14, textColor=TEXT_DARK,
fontName="Helvetica-Bold", spaceAfter=2)
BULLET = S("Bullet", fontSize=9.5, leading=14, textColor=TEXT_DARK,
fontName="Helvetica", leftIndent=14, bulletIndent=0,
spaceAfter=2)
SUB_BULLET = S("SubBullet", fontSize=9, leading=13, textColor=TEXT_MED,
fontName="Helvetica", leftIndent=28, bulletIndent=14,
spaceAfter=2)
WARN = S("Warn", fontSize=9.5, leading=14, textColor=WARN_RED,
fontName="Helvetica-Bold", spaceAfter=3)
NOTE = S("Note", fontSize=9, leading=13, textColor=GREEN_DARK,
fontName="Helvetica-Oblique", spaceAfter=3)
SMALL = S("Small", fontSize=8.5, leading=12, textColor=TEXT_MED,
fontName="Helvetica", spaceAfter=2)
CAPTION = S("Caption", fontSize=8, leading=11, textColor=TEXT_MED,
fontName="Helvetica-Oblique", alignment=TA_CENTER)
def section_header(title, color=MID_BLUE):
"""Colored full-width section banner."""
tbl = Table([[Paragraph(title, H2)]], colWidths=[17*cm])
tbl.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), color),
("ROUNDEDCORNERS", [4,4,4,4]),
("TOPPADDING", (0,0), (-1,-1), 6),
("BOTTOMPADDING", (0,0), (-1,-1), 6),
("LEFTPADDING", (0,0), (-1,-1), 10),
]))
return tbl
def key_box(title, items, bg=LIGHT_BLUE, title_color=DARK_BLUE):
"""Highlighted box with a title and bullet list."""
content = [Paragraph(f"<b>{title}</b>", S("BT", fontSize=9.5,
leading=14, textColor=title_color, fontName="Helvetica-Bold"))]
for item in items:
content.append(Paragraph(f"• {item}", S("BI", fontSize=9, leading=13,
textColor=TEXT_DARK, fontName="Helvetica",
leftIndent=8)))
tbl = Table([[content]], colWidths=[17*cm])
tbl.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), bg),
("BOX", (0,0), (-1,-1), 0.8, title_color),
("TOPPADDING", (0,0), (-1,-1), 6),
("BOTTOMPADDING", (0,0), (-1,-1), 6),
("LEFTPADDING", (0,0), (-1,-1), 8),
("RIGHTPADDING", (0,0), (-1,-1), 8),
]))
return tbl
def warn_box(text, bg=WARN_LIGHT, border=WARN_RED):
tbl = Table([[Paragraph(f"⚠ {text}", S("W2", fontSize=9.5, leading=14,
textColor=WARN_RED, fontName="Helvetica-Bold",
leftIndent=4))]], colWidths=[17*cm])
tbl.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), bg),
("BOX", (0,0), (-1,-1), 1, border),
("TOPPADDING", (0,0), (-1,-1), 6),
("BOTTOMPADDING", (0,0), (-1,-1), 6),
("LEFTPADDING", (0,0), (-1,-1), 8),
]))
return tbl
def note_box(text, bg=GREEN_LIGHT, border=GREEN_DARK):
tbl = Table([[Paragraph(f"📌 {text}", S("N2", fontSize=9, leading=13,
textColor=GREEN_DARK, fontName="Helvetica-Oblique",
leftIndent=4))]], colWidths=[17*cm])
tbl.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),
]))
return tbl
def two_col_table(headers, rows, col_widths=None):
if col_widths is None:
col_widths = [5*cm, 12*cm]
data = [[Paragraph(h, S("TH", fontSize=9, leading=13, textColor=white,
fontName="Helvetica-Bold")) for h in headers]]
for row in rows:
data.append([Paragraph(str(c), S("TD", fontSize=9, leading=13,
textColor=TEXT_DARK, fontName="Helvetica")) for c in row])
tbl = Table(data, colWidths=col_widths)
tbl.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), DARK_BLUE),
("BACKGROUND", (0,1), (-1,-1), white),
("ROWBACKGROUNDS",(0,1), (-1,-1), [white, GREY_BG]),
("BOX", (0,0), (-1,-1), 0.5, GREY_LINE),
("INNERGRID", (0,0), (-1,-1), 0.3, GREY_LINE),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING", (0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 6),
("VALIGN", (0,0), (-1,-1), "TOP"),
]))
return tbl
# ══════════════════════════════════════════════════════════════════════════════
# BUILD DOCUMENT
# ══════════════════════════════════════════════════════════════════════════════
story = []
# ── COVER BANNER ──────────────────────────────────────────────────────────────
cover = Table([
[Paragraph("VOMITING IN NEONATE & INFANT", H1)],
[Paragraph("Diagnostic & Therapeutic Approach | Clinical Notes", S("Sub",
fontSize=11, leading=16, textColor=LIGHT_BLUE, fontName="Helvetica",
alignment=TA_CENTER))],
[Paragraph("Paediatric Surgery & Neonatology", S("Sub2",
fontSize=9, leading=13, textColor=HexColor("#A8C8E8"),
fontName="Helvetica-Oblique", alignment=TA_CENTER))],
], colWidths=[17*cm])
cover.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), DARK_BLUE),
("TOPPADDING", (0,0), (-1,-1), 12),
("BOTTOMPADDING", (0,0), (-1,-1), 10),
("LEFTPADDING", (0,0), (-1,-1), 14),
("ROUNDEDCORNERS",[6,6,6,6]),
]))
story.append(cover)
story.append(Spacer(1, 0.4*cm))
# ══════════════════════════════════════════════════════════════════════════════
# SECTION 1 — OVERVIEW
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_header("1. OVERVIEW"))
story.append(Spacer(1, 0.2*cm))
story.append(Paragraph(
"All infants vomit to some degree. The key clinical task is to differentiate <b>normal/benign vomiting</b> "
"(e.g., gastroesophageal reflux after feeds) from <b>pathological vomiting</b> that signals a serious "
"underlying surgical or medical condition. Two critical questions guide the initial assessment:", BODY))
story.append(key_box("Two Diagnostic Questions", [
"What does the vomit look like? (colour, consistency, relationship to feeds)",
"How sick does the baby look? (hydration, weight loss, irritability, haemodynamic status)"
], bg=LIGHT_BLUE, title_color=DARK_BLUE))
story.append(Spacer(1, 0.3*cm))
# ── Character of vomit table ──
story.append(Paragraph("Character of Vomitus — Immediate Diagnostic Clue", H3))
story.append(two_col_table(
["Vomit Character", "Likely Cause / Action"],
[
["Milk/feed, immediately after feeds", "Gastroesophageal reflux (GER) — usually benign; assess for failure to thrive"],
["Projectile, non-bilious; occurs slightly after feeding", "Hypertrophic Pyloric Stenosis (HPS) — gastric outlet obstruction"],
["Bilious (green)", "SURGICAL EMERGENCY until proven otherwise — consider malrotation/volvulus, intestinal atresia, Hirschsprung's"],
["Blood-streaked / haematemesis", "Oesophagitis, Mallory-Weiss tear, NEC (in preterm), or haemorrhagic disease of newborn"],
["Faeculent", "Distal obstruction (low small bowel or colonic) — Hirschsprung's, meconium ileus"],
],
col_widths=[6*cm, 11*cm]
))
story.append(Spacer(1, 0.3*cm))
story.append(warn_box(
"Bilious vomiting in any neonate = surgical emergency. Obtain immediate paediatric surgical consultation "
"even before diagnostic studies are complete. Midgut volvulus can infarct the entire midgut within hours."
))
story.append(Spacer(1, 0.4*cm))
# ══════════════════════════════════════════════════════════════════════════════
# SECTION 2 — DIFFERENTIAL DIAGNOSIS
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_header("2. DIFFERENTIAL DIAGNOSIS"))
story.append(Spacer(1, 0.2*cm))
story.append(Paragraph("A. Non-Bilious Vomiting", H3))
story.append(two_col_table(
["Condition", "Key Features"],
[
["Gastroesophageal Reflux (GER/GERD)", "Most common; milk vomiting immediately post-feed; effortless; no weight loss in uncomplicated cases"],
["Hypertrophic Pyloric Stenosis (HPS)", "3–6 weeks old; projectile non-bilious vomiting; hungry after vomiting; hypochloraemic hypokalaemic metabolic alkalosis; 'olive' mass RUQ; male:female 5:1"],
["Overfeeding", "Benign; resolves with feeding adjustment"],
["Cow's Milk Protein Allergy", "Blood/mucus in stool; atopic history; responds to elimination"],
["Inborn Errors of Metabolism", "Lethargy, altered sensorium, abnormal odour; not purely GI"],
["Raised Intracranial Pressure", "Bulging fontanelle, sunset sign, macrocephaly — vomiting non-projectile or early morning"],
["Sepsis / Meningitis", "Toxic baby, fever, poor perfusion — vomiting secondary to systemic illness"],
["Adrenal Crisis (CAH)", "Salt-wasting, ambiguous genitalia in females, electrolyte derangements"],
],
col_widths=[5.5*cm, 11.5*cm]
))
story.append(Spacer(1, 0.3*cm))
story.append(Paragraph("B. Bilious Vomiting — Surgical Causes", H3))
story.append(two_col_table(
["Condition", "Key Features & Imaging"],
[
["Malrotation + Midgut Volvulus", "MOST URGENT; any age; sudden bilious vomiting; UGIS: corkscrew duodenum, bird-beak at obstruction; 'whirlpool sign' on Doppler USS"],
["Duodenal Atresia / Stenosis", "Neonate Day 1; 'double bubble' on AXR; associated with Down syndrome (30%); 85% bilious"],
["Jejunoileal Atresia", "Progressive abdominal distension; multiple air-fluid levels on AXR; microcolon on contrast enema"],
["Hirschsprung's Disease", "Failure to pass meconium >48 h; distal colonic obstruction; contrast enema: transition zone; rectal biopsy: absent ganglion cells"],
["Meconium Ileus", "Cystic fibrosis association; 'ground-glass' appearance on AXR; contrast enema therapeutic"],
["Meconium Plug Syndrome", "Term/near-term; delayed passage; contrast enema diagnostic and therapeutic"],
["Incarcerated Inguinal Hernia", "Groin swelling + bilious vomiting; irreducible tender lump"],
["Necrotising Enterocolitis (NEC)", "Preterm; feeding intolerance, bloody stools, pneumatosis intestinalis on AXR; sepsis"],
["Annular Pancreas", "Double bubble + gastric/duodenal web; surgical repair required"],
],
col_widths=[5.5*cm, 11.5*cm]
))
story.append(Spacer(1, 0.4*cm))
# ══════════════════════════════════════════════════════════════════════════════
# SECTION 3 — INITIAL ASSESSMENT
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_header("3. INITIAL ASSESSMENT"))
story.append(Spacer(1, 0.2*cm))
story.append(Paragraph("A. History", H3))
story.append(two_col_table(
["Domain", "Key Questions"],
[
["Onset & Age", "Day of onset; gestational age; birth weight; mode of delivery"],
["Character", "Colour (bilious?), projectile vs effortless, volume, frequency"],
["Relationship to feeds", "Immediately after vs. 30–60 min later; undigested vs. curdled milk"],
["Associated symptoms", "Abdominal distension, blood in stool, fever, lethargy, poor feeding, weight loss, wet diapers reduced"],
["Prenatal history", "Polyhydramnios (suggests upper GI obstruction); antenatal USS anomalies"],
["Meconium passage", "Normal = within 24–48 h; delayed suggests Hirschsprung's or distal obstruction"],
["Family history", "Pyloric stenosis (strong familial link); CF; metabolic disorders"],
["Medications", "Erythromycin (motilin agonist → pyloric hypertrophy risk)"],
],
col_widths=[4.5*cm, 12.5*cm]
))
story.append(Spacer(1, 0.3*cm))
story.append(Paragraph("B. Physical Examination", H3))
story.append(two_col_table(
["Finding", "Significance"],
[
["Visible gastric peristalsis, RUQ 'olive' mass", "Hypertrophic Pyloric Stenosis"],
["Scaphoid (flat) abdomen + bilious vomiting", "Proximal intestinal obstruction (duodenal atresia, malrotation)"],
["Grossly distended abdomen + bilious vomiting", "Distal obstruction (jejunoileal atresia, Hirschsprung's, NEC)"],
["Abdominal tenderness, peritonism, discolouration", "Volvulus, NEC with perforation — immediate surgery"],
["Empty rectum on PR exam", "Hirschsprung's disease"],
["Bilious fluid on NG tube aspiration (>20–25 mL)", "Surgical obstruction strongly suspected"],
["Dehydration signs (sunken fontanelle, poor turgor, dry mucosa)", "Assess severity; guides resuscitation"],
["Jaundice (unconjugated)", "May coexist with HPS"],
["Groin lump", "Incarcerated hernia"],
],
col_widths=[6*cm, 11*cm]
))
story.append(Spacer(1, 0.4*cm))
# ══════════════════════════════════════════════════════════════════════════════
# SECTION 4 — INVESTIGATIONS
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_header("4. INVESTIGATIONS"))
story.append(Spacer(1, 0.2*cm))
story.append(Paragraph("A. Laboratory", H3))
story.append(two_col_table(
["Test", "Rationale / Expected Finding"],
[
["Serum electrolytes (Na, K, Cl, HCO3)", "HPS: hypochloraemia, hypokalaemia, metabolic alkalosis; NEC/sepsis: hyponatraemia, acidosis"],
["Blood glucose", "Hypoglycaemia in metabolic disease, sepsis, adrenal crisis"],
["Arterial/venous blood gas", "Metabolic alkalosis (HPS); metabolic acidosis (volvulus, NEC, sepsis)"],
["FBC / CRP / Blood culture", "Infection/sepsis screening; NEC workup (thrombocytopenia, raised CRP)"],
["Urine electrolytes & pH", "HPS: paradoxical aciduria (urine pH falls as severity worsens)"],
["Serum ammonia, lactate, amino acids", "Inborn errors of metabolism if suspicion"],
["17-hydroxyprogesterone", "Congenital Adrenal Hyperplasia (CAH) in salt-wasting crisis"],
["Sweat chloride / CFTR mutation", "Cystic fibrosis (if meconium ileus)"],
["LFTs, bilirubin fractionation", "Conjugated hyperbilirubinaemia → biliary atresia, Alagille, PFIC"],
],
col_widths=[5.5*cm, 11.5*cm]
))
story.append(Spacer(1, 0.3*cm))
story.append(Paragraph("B. Imaging", H3))
story.append(two_col_table(
["Investigation", "Findings & Use"],
[
["Abdominal X-ray (supine + upright/lateral decubitus)",
"First-line for all bilious vomiting\n"
"• 'Double bubble' → duodenal obstruction\n"
"• Multiple air-fluid levels → distal obstruction\n"
"• Paucity of bowel gas → proximal obstruction / volvulus\n"
"• Pneumatosis intestinalis → NEC\n"
"• Free air under diaphragm → perforation"],
["Abdominal Ultrasound (USS)",
"• HPS: pyloric channel length >16 mm, wall thickness >4 mm (95% accuracy)\n"
"• Volvulus: 'whirlpool sign' on colour Doppler of SMV around SMA\n"
"• Intussusception: 'target sign'\n"
"• Groin: irreducible bowel in hernia sac"],
["Upper GI Series (UGIS / contrast study)",
"• GOLD STANDARD for malrotation/volvulus: 'corkscrew' duodenum, D-J junction not at left of spine\n"
"• Also confirms duodenal atresia / webs if AXR equivocal\n"
"• HPS: string sign, shoulder sign (if USS equivocal)"],
["Contrast Enema",
"• Microcolon → jejunoileal atresia or meconium ileus\n"
"• Transition zone → Hirschsprung's disease\n"
"• Normal calibre colon with empty left → meconium plug, small left colon syndrome"],
["Rectal suction biopsy", "Definitive for Hirschsprung's: absent ganglion cells on H&E + AChE staining"],
["CT Abdomen", "Rarely needed in neonates; reserved for complex or post-operative cases"],
],
col_widths=[5*cm, 12*cm]
))
story.append(Spacer(1, 0.4*cm))
# ══════════════════════════════════════════════════════════════════════════════
# SECTION 5 — DIAGNOSTIC ALGORITHM
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_header("5. DIAGNOSTIC ALGORITHM"))
story.append(Spacer(1, 0.2*cm))
algo_data = [
[Paragraph("<b>NEONATE / INFANT WITH PERSISTENT VOMITING</b>", S("AlgoTop",
fontSize=10, leading=13, textColor=white, fontName="Helvetica-Bold",
alignment=TA_CENTER))],
[Paragraph("↓\nIs the vomiting BILIOUS (green)?", S("AlgoQ",
fontSize=9.5, leading=14, textColor=DARK_BLUE, fontName="Helvetica-Bold",
alignment=TA_CENTER))],
]
algo_tbl = Table(algo_data, colWidths=[17*cm])
algo_tbl.setStyle(TableStyle([
("BACKGROUND", (0,0), (0,0), DARK_BLUE),
("BACKGROUND", (0,1), (0,1), LIGHT_BLUE),
("BOX", (0,0), (-1,-1), 1, MID_BLUE),
("INNERGRID", (0,0), (-1,-1), 0.5, GREY_LINE),
("TOPPADDING", (0,0), (-1,-1), 6),
("BOTTOMPADDING", (0,0), (-1,-1), 6),
("LEFTPADDING", (0,0), (-1,-1), 8),
]))
story.append(algo_tbl)
story.append(Spacer(1, 0.2*cm))
# YES / NO branches as two-column table
branch_data = [
[Paragraph("<b>YES — BILIOUS</b>", S("YB", fontSize=9.5, leading=14,
textColor=WARN_RED, fontName="Helvetica-Bold")),
Paragraph("<b>NO — NON-BILIOUS</b>", S("NB", fontSize=9.5, leading=14,
textColor=GREEN_DARK, fontName="Helvetica-Bold"))],
[Paragraph(
"• <b>Immediate surgical consult</b><br/>"
"• NPO, IV access, OGT to decompress<br/>"
"• Bloods + blood culture<br/>"
"• AXR (supine + upright)<br/>"
"• UGIS if stable → malrotation/volvulus?<br/>"
"• If double bubble → duodenal obstruction<br/>"
"• If distended + multiple loops → distal obstruction → contrast enema<br/>"
"• Volvulus confirmed → <b>emergency laparotomy / Ladd's procedure</b>",
S("BrL", fontSize=9, leading=13, textColor=TEXT_DARK, fontName="Helvetica")),
Paragraph(
"Step 1: Projectile vomiting, 3–6 wk, male?<br/>"
"→ USS pylorus → HPS → Pyloromyotomy<br/><br/>"
"Step 2: Immediately after feeds, effortless?<br/>"
"→ GER — clinical diagnosis → conservative Rx<br/><br/>"
"Step 3: Toxic baby + fever?<br/>"
"→ Sepsis/meningitis workup<br/><br/>"
"Step 4: Metabolic/endocrine screen if atypical<br/>"
"(CAH, IEM, raised ICP)<br/><br/>"
"Step 5: Cow's milk allergy, overfeeding",
S("BrR", fontSize=9, leading=13, textColor=TEXT_DARK, fontName="Helvetica"))],
]
branch_tbl = Table(branch_data, colWidths=[8.5*cm, 8.5*cm])
branch_tbl.setStyle(TableStyle([
("BACKGROUND", (0,0), (0,0), WARN_LIGHT),
("BACKGROUND", (1,0), (1,0), GREEN_LIGHT),
("BACKGROUND", (0,1), (0,1), HexColor("#FFF5F5")),
("BACKGROUND", (1,1), (1,1), HexColor("#F5FFF8")),
("BOX", (0,0), (-1,-1), 1, GREY_LINE),
("INNERGRID", (0,0), (-1,-1), 0.5, GREY_LINE),
("TOPPADDING", (0,0), (-1,-1), 6),
("BOTTOMPADDING", (0,0), (-1,-1), 6),
("LEFTPADDING", (0,0), (-1,-1), 8),
("VALIGN", (0,0), (-1,-1), "TOP"),
]))
story.append(branch_tbl)
story.append(Spacer(1, 0.4*cm))
# ══════════════════════════════════════════════════════════════════════════════
# SECTION 6 — SPECIFIC CONDITIONS
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_header("6. MANAGEMENT OF SPECIFIC CONDITIONS"))
story.append(Spacer(1, 0.2*cm))
# HPS
story.append(Paragraph("6.1 Hypertrophic Pyloric Stenosis (HPS)", H3))
story.append(Paragraph(
"Incidence: 1:300 live births. Peak: 3–6 weeks of age. Male:female = 5:1. "
"Cause of progressive gastric outlet obstruction due to hypertrophy of the pyloric musculature.", BODY))
story.append(key_box("Clinical Features", [
"Nonbilious projectile vomiting after feeds, progressively worsening over days–weeks",
"Hungry infant — feeds eagerly immediately after vomiting",
"Visible gastric peristalsis (left to right) in thin infants",
"Palpable 'olive' mass in right upper quadrant (now rarely relied upon — USS preferred)",
"Progressive dehydration, weight loss, reduced wet diapers",
"Jaundice (indirect hyperbilirubinaemia in some cases)",
]))
story.append(Spacer(1, 0.2*cm))
story.append(key_box("Metabolic Derangement", [
"Hypochloraemic, hypokalaemic metabolic alkalosis (loss of HCl from gastric juice)",
"Paradoxical aciduria: urine pH falls as hypochloraemia worsens → H+ exchanged for Na+ in distal tubule",
"Severity: serum Cl typically <100 mEq/L, HCO3 >30 mEq/L",
], bg=ORANGE_LIGHT, title_color=ORANGE))
story.append(Spacer(1, 0.2*cm))
story.append(Paragraph("Diagnosis", H4))
story.append(Paragraph(
"<b>Ultrasound (gold standard):</b> pyloric channel length >16 mm, pyloric wall thickness >4 mm. "
"Accuracy ~95%. Note: premature infants may have lower normal values — correlate clinically. "
"If USS equivocal: upper GI contrast study → delayed gastric emptying, 'string sign', 'shoulder sign'.", BODY))
story.append(Paragraph("Treatment", H4))
story.append(Paragraph(
"<b>NOT a surgical emergency initially</b> — resuscitate first:", BODY_B))
story.append(two_col_table(
["Step", "Action"],
[
["1. Fluid & electrolyte resuscitation", "IV 5% dextrose + 0.45% NaCl + KCl 2–4 mEq/kg per 24 h at 150–175 mL/kg/24 h. Target: urine output >2 mL/kg/h. Correct alkalosis before surgery."],
["2. Confirm correction", "Repeat electrolytes; target Cl >100, HCO3 <26 before anaesthesia"],
["3. Fredet-Ramstedt Pyloromyotomy", "Open (umbilical or RUQ transverse incision) or laparoscopic. Equally safe; laparoscopic preferred for cosmesis. Incision through pyloric muscle, mucosa left intact."],
["4. Post-op feeding", "IV fluids → Pedialyte → formula/breast milk, gradually increase to 60 mL q3h. Discharge in 24–48 h. Ad lib feeds also well tolerated."],
["5. Complications (~1–3%)", "Mucosal perforation (repair with stitch), inadequate myotomy (recurrent symptoms), wound infection"],
],
col_widths=[4.5*cm, 12.5*cm]
))
story.append(Spacer(1, 0.4*cm))
# Intestinal Obstruction
story.append(Paragraph("6.2 Neonatal Intestinal Obstruction", H3))
story.append(Paragraph(
"Incidence: 1:2000 live births. Cardinal symptom = bilious emesis. Determine level of obstruction "
"(proximal vs. distal to ligament of Treitz). Neonatal bowel lacks haustra/plica circulares — "
"cannot differentiate small vs. large bowel on plain films.", BODY))
story.append(key_box("Proximal Obstruction Characteristics", [
"Bilious vomiting with MINIMAL abdominal distension",
"Scaphoid (flat or concave) abdomen",
"Paucity of bowel gas on AXR",
"Examples: Duodenal atresia, Malrotation/Volvulus, Annular pancreas",
]))
story.append(Spacer(1, 0.2*cm))
story.append(key_box("Distal Obstruction Characteristics", [
"Bilious vomiting WITH significant abdominal distension",
"Meconium passage may be delayed or absent (normal = within 24–48 h)",
"Multiple dilated loops / air-fluid levels on AXR",
"Examples: Jejunoileal atresia, Hirschsprung's, Meconium ileus, Meconium plug syndrome",
], bg=ORANGE_LIGHT, title_color=ORANGE))
story.append(Spacer(1, 0.3*cm))
story.append(Paragraph("6.2a Malrotation & Midgut Volvulus", H4))
story.append(warn_box(
"TRUE SURGICAL EMERGENCY. Volvulus can cause complete midgut infarction within hours. "
"Immediate paediatric surgical consultation for ANY neonate with bilious vomiting."
))
story.append(Spacer(1, 0.2*cm))
story.append(two_col_table(
["Feature", "Details"],
[
["Pathology", "Failure of normal gut rotation & fixation → narrow mesenteric base → clockwise rotation of midgut"],
["Presentation", "Sudden onset bilious vomiting; may progress to haematochezia, peritonism, cardiovascular collapse"],
["AXR", "May be normal early; gasless abdomen; 'double bubble' variant if duodenum obstructed"],
["UGIS (diagnostic)", "D-J junction NOT at left of L1 vertebral body; 'corkscrew' duodenum; 'bird-beak' obstruction"],
["USS", "'Whirlpool sign' — SMV wrapping around SMA on colour Doppler; inversion of SMA/SMV relationship"],
["Surgery", "Ladd's procedure: detorsion, division of Ladd's bands, widening mesenteric base, appendicectomy"],
],
col_widths=[4.5*cm, 12.5*cm]
))
story.append(Spacer(1, 0.3*cm))
story.append(Paragraph("6.2b Duodenal Obstruction (Atresia / Stenosis / Web)", H4))
story.append(two_col_table(
["Feature", "Details"],
[
["Associations", "Down syndrome (30%), cardiac anomalies, oesophageal atresia, annular pancreas"],
["AXR", "'Double bubble' sign — dilated stomach + dilated proximal duodenum, gasless distal bowel"],
["Bilious vs. non-bilious", "85% bilious (bile duct entry proximal to obstruction); 15% non-bilious (supra-ampullary obstruction)"],
["Management", "OGT decompression + IV fluids → duodenoduodenostomy (diamond-shaped anastomosis) once stabilised"],
],
col_widths=[4.5*cm, 12.5*cm]
))
story.append(Spacer(1, 0.3*cm))
story.append(Paragraph("6.2c Hirschsprung's Disease", H4))
story.append(two_col_table(
["Feature", "Details"],
[
["Pathology", "Failure of neural crest cell migration → aganglionic distal colon → functional obstruction"],
["Presentation", "Delayed meconium (>48 h), abdominal distension, bilious vomiting; explosive faecal release on PR exam"],
["Contrast enema", "Transition zone between ganglionic and aganglionic bowel; may be absent in total colonic aganglionosis"],
["Diagnosis", "Rectal suction biopsy: absent ganglion cells on H&E; increased AChE staining"],
["Complication", "Hirschsprung-associated enterocolitis (HAEC): explosive foul-smelling diarrhoea, toxaemia → emergency rectal washouts, IV antibiotics"],
["Surgery", "Transanal endorectal pull-through (Swenson/Soave/Duhamel) — definitive correction"],
],
col_widths=[4.5*cm, 12.5*cm]
))
story.append(Spacer(1, 0.3*cm))
story.append(Paragraph("6.2d Necrotising Enterocolitis (NEC)", H4))
story.append(two_col_table(
["Feature", "Details"],
[
["At-risk population", "Premature infants (<32 weeks); low birth weight; enteral feeds after stress"],
["Risk factors", "Prematurity + enteral feeding (consistent); birth asphyxia, PDA, cyanotic heart disease, bacterial colonisation"],
["Bell Staging", "Stage I: feeding intolerance, vomiting (mild)\nStage II: pneumatosis on AXR, metabolic acidosis (moderate)\nStage III: portal venous gas, perforation, shock (severe)"],
["AXR findings", "Pneumatosis intestinalis (pathognomonic), portal venous gas, pneumoperitoneum (perforation)"],
["Medical Rx (Stage I–II)", "NPO, OGT decompression, IV antibiotics (broad spectrum: ampicillin + gentamicin ± metronidazole), TPN, strict fluid balance"],
["Surgical Rx (Stage III / perforation)", "Exploratory laparotomy: resection of necrotic bowel ± stoma; peritoneal drainage for extremely premature infants"],
],
col_widths=[4.5*cm, 12.5*cm]
))
story.append(Spacer(1, 0.3*cm))
story.append(Paragraph("6.2e Meconium Ileus", H4))
story.append(Paragraph(
"Associated with <b>Cystic Fibrosis</b> in 90% of cases. Inspissated meconium obstructs the terminal ileum.", BODY))
story.append(key_box("Key Points", [
"Abdominal distension from birth; failure to pass meconium; bilious vomiting",
"AXR: 'ground-glass' (soap-bubble) appearance in RIF; calcifications if in utero perforation occurred",
"Contrast enema: microcolon + pellets of meconium in terminal ileum",
"Non-operative Rx: Gastrografin enema (hyperosmolar — draws fluid to liquefy meconium); requires IV rehydration",
"Surgical Rx: if enema fails or complications (atresia, perforation) → enterotomy/irrigation ± stoma",
"All infants require CFTR/sweat chloride testing",
]))
story.append(Spacer(1, 0.4*cm))
# ══════════════════════════════════════════════════════════════════════════════
# SECTION 7 — GER / GERD
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_header("7. GASTROESOPHAGEAL REFLUX IN INFANTS"))
story.append(Spacer(1, 0.2*cm))
story.append(Paragraph(
"<b>GER</b> (physiological) is universal in infants — immature lower oesophageal sphincter (LOS) tone, "
"short intraabdominal oesophagus, horizontal stomach, and liquid diet. "
"<b>GERD</b> = reflux causing symptoms/complications (weight loss, oesophagitis, apnoea, recurrent aspiration).", BODY))
story.append(key_box("Conservative (Step-Up) Management of GER/GERD", [
"Step 1: Parental reassurance if thriving; upright positioning after feeds 30 min; smaller, more frequent feeds",
"Step 2: Thickened feeds (rice starch, carob bean gum) — reduces visible regurgitation",
"Step 3: Cow's milk protein exclusion trial (2 weeks) — if allergy suspected",
"Step 4: Pharmacotherapy: H2-blocker (ranitidine — though FDA concern re NDMA) or PPI (omeprazole) for GERD with oesophagitis",
"Step 5: Surgical — Nissen fundoplication for severe, refractory GERD (especially in neurologically impaired children)",
"Note: Prokinetics (metoclopramide, domperidone) not routinely recommended due to adverse effect profiles",
], bg=GREEN_LIGHT, title_color=GREEN_DARK))
story.append(Spacer(1, 0.4*cm))
# ══════════════════════════════════════════════════════════════════════════════
# SECTION 8 — EMERGENCY MANAGEMENT PRINCIPLES
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_header("8. EMERGENCY MANAGEMENT PRINCIPLES"))
story.append(Spacer(1, 0.2*cm))
story.append(two_col_table(
["Priority", "Action"],
[
["1. Airway / Breathing / Circulation", "Assess for haemodynamic compromise; O2 if needed; establish IV/IO access"],
["2. NPO + Orogastric / Nasogastric Tube", "Decompress stomach; measure aspirate; bilious aspirate → surgical emergency"],
["3. IV Fluid Resuscitation", "Isotonic crystalloid (0.9% NaCl or Ringer's lactate) 10–20 mL/kg bolus if haemodynamically unstable; then maintenance with appropriate replacement of ongoing losses"],
["4. Electrolyte Correction", "Particularly for HPS: correct hypokalaemia and alkalosis BEFORE surgery"],
["5. Bloods & Imaging", "As per investigation section; AXR always first-line for bilious vomiting"],
["6. Surgical Consultation", "Immediate for bilious vomiting, peritonism, haemodynamic instability, suspected volvulus"],
["7. Antibiotic Therapy", "Start if NEC, sepsis, or perforated viscus suspected (ampicillin + gentamicin ± metronidazole)"],
["8. Monitoring", "Strict fluid balance, urine output (target >1–2 mL/kg/h in neonate), serial AXR in NEC"],
],
col_widths=[5*cm, 12*cm]
))
story.append(Spacer(1, 0.4*cm))
# ══════════════════════════════════════════════════════════════════════════════
# SECTION 9 — SUMMARY TABLE
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_header("9. QUICK SUMMARY — DIAGNOSIS AT A GLANCE"))
story.append(Spacer(1, 0.2*cm))
story.append(two_col_table(
["Condition", "Age / Clue / Investigation / Treatment"],
[
["GER/GERD", "Any age | effortless regurgitation | clinical | conservative → PPI → Nissen"],
["Hypertrophic Pyloric Stenosis", "3–6 wk | projectile non-bilious, hungry, hypochloraemic alkalosis | USS (>16 mm length, >4 mm thickness) | rehydrate → pyloromyotomy"],
["Malrotation + Volvulus", "Any neonatal age | sudden bilious vomiting → catastrophic | UGIS (corkscrew) / USS (whirlpool) | EMERGENCY Ladd's procedure"],
["Duodenal Atresia", "Day 1 | bilious vomiting, no distension, Down's | AXR double bubble | duodenoduodenostomy"],
["Jejunoileal Atresia", "Day 1–2 | bilious + distension, multiple loops | AXR + contrast enema (microcolon) | resection + anastomosis"],
["Hirschsprung's", "Day 1–2 | delayed meconium + distension | biopsy (no ganglion cells) | pull-through surgery"],
["Meconium Ileus", "Day 1 | ground-glass AXR, CF | Gastrografin enema | surgical if fails"],
["NEC", "Preterm day 10+ | bloody stools + pneumatosis | AXR | NPO + antibiotics; surgery if Stage III"],
["Incarcerated Hernia", "Any infant | groin lump + bilious | clinical ± USS | reduction / emergency surgery"],
["Sepsis / Meningitis", "Any age | toxic infant, fever | bloods + LP + culture | antibiotics"],
["CAH (salt-wasting)", "Day 5–14 | hyponatraemia, hyperkalaemia, ambiguous genitalia | 17-OHP elevated | hydrocortisone + fludrocortisone"],
],
col_widths=[5*cm, 12*cm]
))
story.append(Spacer(1, 0.4*cm))
# ══════════════════════════════════════════════════════════════════════════════
# FOOTER NOTE
# ══════════════════════════════════════════════════════════════════════════════
story.append(HRFlowable(width="100%", thickness=0.5, color=GREY_LINE))
story.append(Spacer(1, 0.15*cm))
story.append(Paragraph(
"Sources: Schwartz's Principles of Surgery 11th Ed. (pp. 1748–1760) | Rosen's Emergency Medicine | "
"Tintinalli's Emergency Medicine | Current Surgical Therapy 14e",
SMALL))
story.append(Paragraph(
"These notes are for educational purposes. Always apply clinical judgement and refer to current institutional protocols.",
S("Disc", fontSize=7.5, leading=11, textColor=HexColor("#888888"),
fontName="Helvetica-Oblique")))
doc.build(story)
print("PDF generated successfully!")
cd /tmp/workspace/neonatal-vomiting && python generate_pdf.py 2>&1
ls -lh /tmp/workspace/neonatal-vomiting/
Vomiting Neonate Infant Notes
PDF Document · PDF