Acute abdomen pdf for neet ss

Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Running Command

mkdir -p /home/daytona/workspace/acute-abdomen-neet

Writing File

~/acute-abdomen-neet/generate_pdf.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, PageBreak
)
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_JUSTIFY
from reportlab.platypus import BaseDocTemplate, PageTemplate, Frame

OUTPUT = "/home/daytona/workspace/acute-abdomen-neet/Acute_Abdomen_NEET_SS.pdf"

# ── colour palette ──────────────────────────────────────────────────
DARK_BLUE   = colors.HexColor("#1a3a5c")
MID_BLUE    = colors.HexColor("#2563a8")
LIGHT_BLUE  = colors.HexColor("#dbeafe")
ACCENT      = colors.HexColor("#e65c00")
YELLOW_HL   = colors.HexColor("#fff9c4")
TABLE_HDR   = colors.HexColor("#1a3a5c")
TABLE_ALT   = colors.HexColor("#f0f4fa")
WHITE       = colors.white
BLACK       = colors.black
GREY        = colors.HexColor("#555555")

# ── styles ───────────────────────────────────────────────────────────
base = getSampleStyleSheet()

def S(name, parent="Normal", **kw):
    return ParagraphStyle(name, parent=base[parent], **kw)

cover_title  = S("CoverTitle",  fontSize=32, textColor=WHITE,  alignment=TA_CENTER, spaceAfter=8,  leading=38, fontName="Helvetica-Bold")
cover_sub    = S("CoverSub",    fontSize=16, textColor=LIGHT_BLUE, alignment=TA_CENTER, spaceAfter=4, fontName="Helvetica")
cover_info   = S("CoverInfo",   fontSize=11, textColor=WHITE,  alignment=TA_CENTER, spaceAfter=3, fontName="Helvetica")

h1 = S("H1", fontSize=15, textColor=WHITE,  spaceAfter=6,  spaceBefore=4,  fontName="Helvetica-Bold", leading=18)
h2 = S("H2", fontSize=12, textColor=DARK_BLUE, spaceAfter=4, spaceBefore=8, fontName="Helvetica-Bold", leading=15)
h3 = S("H3", fontSize=10.5, textColor=MID_BLUE, spaceAfter=3, spaceBefore=5, fontName="Helvetica-Bold", leading=13)

body   = S("Body",   fontSize=9.5, textColor=BLACK, spaceAfter=4,  leading=13, alignment=TA_JUSTIFY)
bullet = S("Bullet", fontSize=9.5, textColor=BLACK, spaceAfter=2,  leading=13, leftIndent=14, firstLineIndent=-10)
mnemo  = S("Mnemo",  fontSize=10,  textColor=ACCENT, spaceAfter=3, fontName="Helvetica-Bold", leading=13, leftIndent=10)
highlt = S("Highlt", fontSize=9.5, textColor=BLACK, spaceAfter=4,  leading=13, backColor=YELLOW_HL, borderPad=4)
note   = S("Note",   fontSize=9,   textColor=GREY,  spaceAfter=3,  leading=12, leftIndent=10, fontName="Helvetica-Oblique")
toc_h  = S("TocH",   fontSize=10,  textColor=DARK_BLUE, spaceAfter=2, fontName="Helvetica-Bold")
toc_e  = S("TocE",   fontSize=9.5, textColor=BLACK, spaceAfter=1, leftIndent=14)

def B(txt): return f"<b>{txt}</b>"
def I(txt): return f"<i>{txt}</i>"
def C(txt, col="#e65c00"): return f'<font color="{col}">{txt}</font>'

# ── helpers ──────────────────────────────────────────────────────────
def section_header(title, story):
    """Blue banner with white heading text."""
    tbl = Table([[Paragraph(title, h1)]], colWidths=[17*cm])
    tbl.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), DARK_BLUE),
        ("TOPPADDING",    (0,0), (-1,-1), 6),
        ("BOTTOMPADDING", (0,0), (-1,-1), 6),
        ("LEFTPADDING",   (0,0), (-1,-1), 10),
        ("ROUNDEDCORNERS", [4]),
    ]))
    story.append(Spacer(1, 6))
    story.append(tbl)
    story.append(Spacer(1, 4))

def sub_header(title, story):
    story.append(Spacer(1, 4))
    story.append(Paragraph(title, h2))
    story.append(HRFlowable(width="100%", thickness=0.5, color=MID_BLUE))
    story.append(Spacer(1, 3))

def bullet_list(items, story, indent=14):
    for item in items:
        story.append(Paragraph(f"• {item}", bullet))

def two_col_table(headers, rows, story, col_widths=None):
    if col_widths is None:
        col_widths = [6*cm, 11*cm]
    data = [[Paragraph(B(h), S("th", fontSize=9, textColor=WHITE, fontName="Helvetica-Bold")) for h in headers]]
    for i, row in enumerate(rows):
        data.append([Paragraph(str(c), S("td", fontSize=9, leading=12)) for c in row])
    t = Table(data, colWidths=col_widths, repeatRows=1)
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,0), TABLE_HDR),
        ("ROWBACKGROUNDS", (0,1), (-1,-1), [WHITE, TABLE_ALT]),
        ("GRID",      (0,0), (-1,-1), 0.3, colors.HexColor("#aaaaaa")),
        ("TOPPADDING",    (0,0), (-1,-1), 4),
        ("BOTTOMPADDING", (0,0), (-1,-1), 4),
        ("LEFTPADDING",   (0,0), (-1,-1), 5),
        ("VALIGN",    (0,0), (-1,-1), "TOP"),
    ]))
    story.append(t)
    story.append(Spacer(1, 6))

def highlight_box(text, story):
    tbl = Table([[Paragraph(text, highlt)]], colWidths=[17*cm])
    tbl.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), YELLOW_HL),
        ("BOX",        (0,0), (-1,-1), 1, ACCENT),
        ("TOPPADDING",    (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
        ("LEFTPADDING",   (0,0), (-1,-1), 8),
        ("ROUNDEDCORNERS", [3]),
    ]))
    story.append(tbl)
    story.append(Spacer(1, 5))

def mnemonic_box(label, text, story):
    tbl = Table([[Paragraph(f"🔑 {label}: {text}", mnemo)]], colWidths=[17*cm])
    tbl.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), colors.HexColor("#fff3e0")),
        ("BOX",        (0,0), (-1,-1), 1.2, ACCENT),
        ("TOPPADDING",    (0,0), (-1,-1), 6),
        ("BOTTOMPADDING", (0,0), (-1,-1), 6),
        ("LEFTPADDING",   (0,0), (-1,-1), 10),
        ("ROUNDEDCORNERS", [4]),
    ]))
    story.append(tbl)
    story.append(Spacer(1, 6))

# ── document ─────────────────────────────────────────────────────────
doc = SimpleDocTemplate(
    OUTPUT,
    pagesize=A4,
    leftMargin=2*cm, rightMargin=2*cm,
    topMargin=2.2*cm, bottomMargin=2*cm,
    title="Acute Abdomen — NEET SS Notes",
    author="Orris Medical"
)

story = []

# ══════════════════════════════════════════════════════════════════════
# COVER PAGE
# ══════════════════════════════════════════════════════════════════════
cover_bg = Table(
    [[Paragraph("ACUTE ABDOMEN", cover_title)],
     [Paragraph("Comprehensive NEET SS Notes", cover_sub)],
     [Spacer(1, 10)],
     [Paragraph("General Surgery · Superspecialty Entrance", cover_info)],
     [Paragraph("Sources: Sabiston Textbook of Surgery (21e) · Schwartz's Principles of Surgery (11e)", cover_info)],
     [Spacer(1, 20)],
     [Paragraph("Orris Medical  |  May 2026", cover_info)],
    ],
    colWidths=[17*cm]
)
cover_bg.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,-1), DARK_BLUE),
    ("TOPPADDING",    (0,0), (-1,-1), 18),
    ("BOTTOMPADDING", (0,0), (-1,-1), 18),
    ("LEFTPADDING",   (0,0), (-1,-1), 20),
    ("RIGHTPADDING",  (0,0), (-1,-1), 20),
    ("ROUNDEDCORNERS", [8]),
]))
story.append(Spacer(1, 40))
story.append(cover_bg)
story.append(PageBreak())

# ══════════════════════════════════════════════════════════════════════
# TABLE OF CONTENTS
# ══════════════════════════════════════════════════════════════════════
story.append(Paragraph("TABLE OF CONTENTS", h1))
story.append(HRFlowable(width="100%", thickness=1, color=DARK_BLUE))
story.append(Spacer(1, 6))
toc_items = [
    ("1", "Definition & Overview"),
    ("2", "Anatomy Relevant to Acute Abdomen"),
    ("3", "Physiology of Abdominal Pain"),
    ("4", "Differential Diagnosis"),
    ("5", "History Taking — High-Yield Points"),
    ("6", "Physical Examination"),
    ("7", "Signs in Acute Abdomen"),
    ("8", "Investigations"),
    ("9", "Imaging in Acute Abdomen"),
    ("10", "Key Pathologies — Rapid Review"),
    ("11", "Special Populations"),
    ("12", "Management Principles"),
    ("13", "High-Yield NEET SS Points"),
    ("14", "MCQ Practice"),
]
for num, item in toc_items:
    story.append(Paragraph(f"{num}.  {item}", toc_e))
story.append(PageBreak())

# ══════════════════════════════════════════════════════════════════════
# SECTION 1: DEFINITION
# ══════════════════════════════════════════════════════════════════════
section_header("1. Definition & Overview", story)
story.append(Paragraph(
    "Acute abdomen is <b>not a specific diagnosis</b> but a clinical syndrome — a collection of symptoms, "
    "physical examination findings, and diagnostic workup findings that suggest an <b>acute process within "
    "(or external to) the abdominal cavity</b> that frequently requires operative management.",
    body))
highlight_box(
    "⏱ Threshold: Pain onset &lt; 1 week (arbitrary cut-off distinguishing acute from subacute/chronic). "
    "Any abdominal pain of &lt; 1 week duration in the appropriate clinical context constitutes an acute abdomen until proven otherwise.",
    story)
story.append(Paragraph("Common Aetiologies by Category:", h3))
two_col_table(
    ["Category", "Examples"],
    [
        ["Inflammatory/Infectious", "Appendicitis, Cholecystitis, Pancreatitis, Diverticulitis, PID"],
        ["Obstruction",             "Small bowel obstruction (adhesions, hernia), Large bowel obstruction (carcinoma), Volvulus"],
        ["Perforation",             "Perforated peptic ulcer, Perforated appendix, Perforated diverticulum"],
        ["Ischaemia/Vascular",      "Mesenteric ischaemia (SMA embolus/thrombosis), Ruptured AAA, Ischaemic colitis"],
        ["Haemorrhage",             "Ruptured ectopic pregnancy, Ruptured AAA, Splenic rupture, Haemoperitoneum"],
        ["Gynaecological",          "Ruptured ectopic pregnancy, Ovarian torsion, Ruptured ovarian cyst, PID"],
        ["Metabolic/Medical",       "DKA, Addisonian crisis, Sickle-cell crisis, Hypercalcaemia, Porphyria"],
        ["Others",                  "Trauma, Hernia strangulation, Retroperitoneal haematoma"],
    ],
    story,
    col_widths=[5*cm, 12*cm]
)

# ══════════════════════════════════════════════════════════════════════
# SECTION 2: ANATOMY
# ══════════════════════════════════════════════════════════════════════
section_header("2. Anatomy Relevant to Acute Abdomen", story)
sub_header("Peritoneal Compartments", story)
two_col_table(
    ["Compartment", "Contents"],
    [
        ["Intraperitoneal", "Stomach, small intestine (jejunum/ileum), transverse colon, liver, spleen, appendix, sigmoid colon"],
        ["Retroperitoneal (PRIMARY)", "Kidneys, adrenals, abdominal aorta, IVC, oesophagus (abdominal), pancreas (body/tail), ureters"],
        ["Retroperitoneal (SECONDARY)", "Duodenum (D2–D4), ascending colon, descending colon, pancreas (head), rectum (upper 2/3)"],
    ],
    story, col_widths=[5*cm, 12*cm]
)
mnemonic_box("SADPUCKER", "Secondary retroperitoneal: Suprarenal, Aorta/IVC, Duodenum (2nd–4th), Pancreas, Ureters, Colon (ascending/descending), Kidneys, Oesophagus, Rectum", story)

sub_header("Vascular Supply — High-Yield", story)
bullet_list([
    "Celiac trunk (T12): Foregut — Stomach, liver, spleen, pancreas (head), duodenum (D1)",
    "Superior Mesenteric Artery / SMA (L1): Midgut — Duodenum (D2–D4), small bowel, right colon to splenic flexure",
    "Inferior Mesenteric Artery / IMA (L3): Hindgut — Splenic flexure to upper rectum",
    "Watershed zones: Griffith's point (splenic flexure) — SMA/IMA, and Sudeck's point (rectosigmoid) — IMA/internal iliac",
    "Portal vein: Formed by SMV + splenic vein behind neck of pancreas",
], story)

sub_header("Peritoneal Innervation — Pain Mechanism", story)
two_col_table(
    ["Peritoneum Type", "Innervation", "Pain Character", "Clinical relevance"],
    [
        ["Visceral", "Autonomic (sympathetic T5–L2)", "Dull, poorly localised, crampy, midline", "Early appendicitis — periumbilical pain"],
        ["Parietal",  "Somatic (spinal nerves, dermatomal)", "Sharp, well-localised, aggravated by movement", "Late appendicitis — RLQ pain with rigidity"],
    ],
    story, col_widths=[3.5*cm, 4*cm, 4.5*cm, 5*cm]
)
highlight_box(
    "Classic example — Appendicitis: Visceral pain (periumbilical, dull) → Parietal pain (RLQ, sharp) as "
    "inflammation reaches parietal peritoneum. This shift of pain from central to RLQ is called MIGRATION OF PAIN.",
    story)

# ══════════════════════════════════════════════════════════════════════
# SECTION 3: PHYSIOLOGY OF PAIN
# ══════════════════════════════════════════════════════════════════════
section_header("3. Physiology of Abdominal Pain", story)
two_col_table(
    ["Pain Type", "Mechanism", "Character", "Example"],
    [
        ["Visceral",   "Hollow viscus distension/ischaemia; afferents travel with sympathetics", "Dull, colicky, midline, poorly localised", "Intestinal colic, early appendicitis"],
        ["Parietal",   "Parietal peritoneum irritation by inflammation/pus/blood; somatic afferents", "Sharp, localised, worse with movement/cough", "Peritonitis, late appendicitis"],
        ["Referred",   "Convergence of visceral and somatic afferents at same spinal level", "Felt at skin distant from origin", "Diaphragm → shoulder tip (C3,4,5); Ureter → groin"],
    ],
    story, col_widths=[3*cm, 5*cm, 4*cm, 5*cm]
)
sub_header("Referred Pain Patterns — NEET Favourite", story)
two_col_table(
    ["Source", "Referred To", "Nerve/Level"],
    [
        ["Diaphragm irritation (subphrenic abscess, haemoperitoneum)", "Shoulder tip (ipsilateral)", "Phrenic nerve C3,4,5"],
        ["Appendix (early)", "Periumbilical region", "T10 dermatome"],
        ["Gallbladder", "Right shoulder / right infrascapular", "T5–T9"],
        ["Pancreatitis", "Back (band-like)", "Splanchnic nerves T5–L1"],
        ["Renal colic", "Groin / genitalia", "T10–L1"],
        ["Ureteric colic", "Testes / labia", "L1"],
        ["Myocardial infarction", "Epigastrium / jaw", "T1–T4"],
    ],
    story, col_widths=[6*cm, 5.5*cm, 5.5*cm]
)

# ══════════════════════════════════════════════════════════════════════
# SECTION 4: DIFFERENTIAL DIAGNOSIS
# ══════════════════════════════════════════════════════════════════════
section_header("4. Differential Diagnosis", story)
sub_header("By Quadrant / Location", story)
two_col_table(
    ["Location", "Key Diagnoses"],
    [
        ["RUQ",     "Acute cholecystitis, Cholangitis, Hepatitis, Liver abscess, Peptic ulcer (perforated), Pneumonia (right base), Budd-Chiari"],
        ["LUQ",     "Splenic rupture, Gastric ulcer, Pancreatitis (tail), Pneumonia (left base), Splenic infarct"],
        ["RLQ",     "Appendicitis ★, Meckel's diverticulitis, Ectopic pregnancy (right), Ovarian torsion/cyst, Mesenteric adenitis, Crohn's ileitis, Psoas abscess"],
        ["LLQ",     "Diverticulitis ★, Ectopic pregnancy (left), Ovarian torsion/cyst, Sigmoid volvulus, Colon carcinoma, IBD"],
        ["Epigastric", "PUD, Pancreatitis, Gastritis, MI (referred), Aortic dissection, GORD"],
        ["Periumbilical", "Early appendicitis, Small bowel obstruction, Hernia (umbilical), Mesenteric ischaemia"],
        ["Suprapubic", "UTI, Cystitis, Urinary retention, Gynaecological (PID, ovarian), Uterine pathology"],
        ["Generalised/Diffuse", "Generalised peritonitis (perforation), Mesenteric ischaemia, Bowel obstruction, DKA, Ruptured AAA"],
    ],
    story, col_widths=[3.5*cm, 13.5*cm]
)

sub_header("By Age Group", story)
two_col_table(
    ["Age Group", "Common Causes"],
    [
        ["Neonates (0–1 mo)", "Malrotation/volvulus, Hirschsprung disease, Necrotising enterocolitis (NEC), Meconium ileus, Imperforate anus"],
        ["Infants (1 mo – 2 yr)", "Intussusception ★ (3 mo–3 yr), Hirschsprung, Incarcerated hernia, Malrotation"],
        ["Children (2–12 yr)", "Appendicitis ★, Intussusception, Mesenteric adenitis, Meckel's diverticulitis"],
        ["Adolescents", "Appendicitis ★, Ectopic pregnancy (females), Ovarian torsion, Testicular torsion (males), PID"],
        ["Adults (20–60 yr)", "Appendicitis, PUD, Cholecystitis, Pancreatitis, Diverticulitis, Ectopic pregnancy, Hernia strangulation"],
        ["Elderly (>60 yr)", "Diverticulitis ★, Bowel obstruction, Mesenteric ischaemia, Cholecystitis, Colorectal carcinoma, Ruptured AAA"],
    ],
    story, col_widths=[4*cm, 13*cm]
)

sub_header("Surgical vs Medical Causes", story)
two_col_table(
    ["SURGICAL (needs operation)", "MEDICAL (managed conservatively)"],
    [
        ["Appendicitis (complicated)", "DKA / Addisonian crisis"],
        ["Perforated viscus", "Sickle-cell crisis"],
        ["Strangulated hernia", "Mesenteric adenitis"],
        ["Mesenteric ischaemia", "Acute porphyria"],
        ["Ruptured ectopic", "Henoch–Schönlein purpura"],
        ["Ruptured AAA", "Pneumonia (referred pain)"],
        ["Bowel obstruction (complete/strangulated)", "Rectus sheath haematoma"],
        ["Volvulus", "Inferior MI (referred epigastric pain)"],
    ],
    story, col_widths=[8.5*cm, 8.5*cm]
)

# ══════════════════════════════════════════════════════════════════════
# SECTION 5: HISTORY
# ══════════════════════════════════════════════════════════════════════
section_header("5. History Taking — High-Yield Points", story)
sub_header("SOCRATES Pain Analysis", story)
two_col_table(
    ["Component", "Key Points"],
    [
        ["Site",        "Where did it start? Has it moved? (Appendicitis: periumbilical → RLQ)"],
        ["Onset",       "Sudden (perforation, rupture, colic, torsion) vs Gradual (inflammation)"],
        ["Character",   "Colicky = obstruction/colic; Constant = inflammation/ischaemia; Burning = ulcer"],
        ["Radiation",   "Shoulder tip = diaphragm; Back = pancreatitis/AAA; Groin = ureteric colic"],
        ["Associations","Nausea/vomiting, fever, jaundice, PR bleeding, urinary symptoms, LMP"],
        ["Timing",      "Constant vs intermittent; duration; progression"],
        ["Exacerbating/relieving", "Movement worsens peritonitis; bending forward relieves pancreatitis; nil relieves ischaemia"],
        ["Severity",    "1–10 scale; inability to find comfortable position = colic; still patient = peritonitis"],
    ],
    story, col_widths=[4*cm, 13*cm]
)

sub_header("Critical History Points by Diagnosis", story)
two_col_table(
    ["Diagnosis", "Classic History"],
    [
        ["Appendicitis",       "Central pain → RLQ, anorexia, low-grade fever, nausea, vomiting after pain"],
        ["Cholecystitis",      "RUQ pain post-fatty meal, Murphy's positive, fever, prior biliary colic"],
        ["Pancreatitis",       "Epigastric pain radiating to back, relieved by leaning forward, alcohol/gallstones"],
        ["Perforated PUD",     "Sudden severe epigastric pain (like a knife), history of PUD/NSAIDs"],
        ["SBO",                "Colicky central pain, vomiting (bilious), distension, constipation, prior surgery/hernia"],
        ["Mesenteric ischaemia", "Pain out of proportion to signs ★, AF/post-MI, elderly, post-prandial pain"],
        ["Ruptured AAA",       "Sudden severe back/loin/abdominal pain, collapse, pulsatile mass, shocked elderly man"],
        ["Ectopic pregnancy",  "Missed period, shoulder tip pain, syncope, positive βhCG, amenorrhoea"],
        ["Ovarian torsion",    "Sudden severe unilateral lower abdominal pain, nausea/vomiting, adnexal mass"],
        ["Intussusception",    "Infant 3 mo–3 yr, colicky pain, red-currant jelly stool, sausage-shaped RUQ mass"],
    ],
    story, col_widths=[4.5*cm, 12.5*cm]
)

# ══════════════════════════════════════════════════════════════════════
# SECTION 6: PHYSICAL EXAMINATION
# ══════════════════════════════════════════════════════════════════════
section_header("6. Physical Examination", story)
sub_header("General Inspection", story)
bullet_list([
    "Appearance: Lying still (peritonitis) vs writhing (colic)",
    "Vital signs: Tachycardia + hypotension = shock (haemorrhage, sepsis, late obstruction)",
    "Pallor, diaphoresis (haemodynamic compromise)",
    "Jaundice (biliary obstruction, cholangitis)",
    "Abdominal distension (obstruction, ascites, ileus)",
    "Visible peristalsis (high SBO in thin patients)",
    "Hernial orifices MUST be inspected and palpated",
], story)

sub_header("Abdominal Examination Sequence", story)
bullet_list([
    "Inspection → Auscultation → Percussion → Palpation (always in this order)",
    "Auscultation BEFORE palpation (international standard)",
    "Bowel sounds: Absent = ileus/peritonitis; Tinkling/high-pitched = obstruction",
    "Percussion: Dullness (fluid/mass); Tympany (gas); Shifting dullness (ascites); Loss of liver dullness (pneumoperitoneum)",
    "Palpation: Tenderness, guarding (voluntary vs involuntary), rigidity (board-like = generalised peritonitis)",
    "Rebound tenderness (Blumberg's sign): Remove hand rapidly — pain = peritoneal irritation",
    "Always examine hernial orifices, perform PR examination and vaginal examination when indicated",
], story)

# ══════════════════════════════════════════════════════════════════════
# SECTION 7: CLINICAL SIGNS
# ══════════════════════════════════════════════════════════════════════
section_header("7. Clinical Signs in Acute Abdomen", story)
two_col_table(
    ["Sign", "Technique / Finding", "Significance"],
    [
        ["Murphy's sign",        "Press RUQ during deep inspiration → arrest of inspiration due to pain", "Acute cholecystitis (95% specific)"],
        ["McBurney's point tenderness", "Point 1/3 from ASIS to umbilicus", "Appendicitis"],
        ["Rovsing's sign",       "Pressure on LLQ causes pain in RLQ", "Appendicitis (peritoneal irritation)"],
        ["Psoas sign",           "Pain on right hip extension (passive) OR active flexion against resistance", "Retrocaecal appendicitis, Psoas abscess"],
        ["Obturator sign",       "Pain on internal rotation of flexed right hip", "Pelvic appendicitis, Pelvic abscess"],
        ["Blumberg's / Rebound", "Sudden release of deep pressure causes more pain than pressure itself", "Peritoneal irritation"],
        ["Carnett's sign",       "Tenderness increases when abdominal muscles contracted (head lift)", "Abdominal wall origin of pain (not visceral)"],
        ["Grey Turner's sign",   "Ecchymosis of flanks", "Retroperitoneal haemorrhage (pancreatitis, AAA)"],
        ["Cullen's sign",        "Periumbilical ecchymosis", "Intraperitoneal haemorrhage (pancreatitis, ectopic)"],
        ["Dance's sign",         "Empty RIF on palpation", "Intussusception (caecum displaced)"],
        ["Cope's sign",          "Hyperextension of right thigh causes pain", "Appendicitis (iliopsoas irritation)"],
        ["Kehr's sign",          "Shoulder tip pain (left) on lying flat / raising legs", "Splenic rupture (diaphragm irritation)"],
        ["Ten Horn's sign",      "Pain on traction of right testis", "Appendicitis"],
        ["Aure-Rozanova sign",   "Tenderness at Petit's triangle", "Retrocaecal appendicitis"],
        ["Dunphy's sign",        "Increased pain on coughing", "Peritonitis / appendicitis"],
        ["Aaron's sign",         "Referred pain at McBurney's point on pressure at epigastrium", "Appendicitis"],
        ["Mannkopf's sign",      "Pulse rate increases on pressure over painful area", "True pain (not simulated)"],
        ["Lanz point",           "Tenderness at junction of right 1/3 and left 2/3 of line joining ASIS", "Appendicitis"],
        ["Sitkovskiy's sign",    "Pain in RIF when patient turns to left lateral position", "Appendicitis"],
        ["Bartomier-Michelson",  "More tenderness in RIF in left lateral decubitus", "Appendicitis"],
        ["Shamov's sign",        "Crepitus over right iliac fossa", "Gangrenous appendix"],
        ["Bassler's sign",       "Pain on pinching appendix between abdominal wall and iliacus", "Chronic appendicitis"],
    ],
    story, col_widths=[4*cm, 6.5*cm, 6.5*cm]
)

# ══════════════════════════════════════════════════════════════════════
# SECTION 8: INVESTIGATIONS
# ══════════════════════════════════════════════════════════════════════
section_header("8. Investigations", story)
sub_header("Laboratory Tests", story)
two_col_table(
    ["Test", "Significance / Interpretation"],
    [
        ["FBC (CBC)",            "Leucocytosis → infection/inflammation; Anaemia → haemorrhage/chronic; Thrombocytopenia → DIC/sepsis"],
        ["CRP / ESR",            "Elevated in inflammation; CRP rises faster (6–12h); CRP >200 suggests severe sepsis"],
        ["Serum amylase / lipase", "Pancreatitis (amylase >3× normal); Lipase more specific (remains elevated longer)"],
        ["LFTs / Bilirubin",     "Cholestasis (cholangitis, choledocholithiasis); Hepatocellular injury"],
        ["Serum lactate",        "Elevated in mesenteric ischaemia, septic shock; >4 mmol/L = severe sepsis"],
        ["Urea, creatinine, electrolytes", "Renal function; uraemia causes ileus; K⁺ imbalance in obstruction/vomiting"],
        ["Blood glucose",        "DKA (hyperglycaemia); Addisonian crisis (hypoglycaemia)"],
        ["Serum calcium",        "Hypercalcaemia causes acute abdomen; low calcium in severe pancreatitis (bad prognosis)"],
        ["Coagulation (PT/APTT)", "DIC in sepsis; clotting for surgery prep"],
        ["Blood group & crossmatch", "MANDATORY before any emergency laparotomy"],
        ["Urine dipstick + MC&S", "UTI, renal colic (haematuria); glycosuria (DKA); ketonuria"],
        ["Urine βhCG",           "MUST be checked in all women of reproductive age with acute abdomen"],
        ["ABG",                  "Metabolic acidosis → ischaemia/sepsis; respiratory compensation"],
        ["Serum troponin",       "Exclude MI as cause of epigastric pain in elderly"],
    ],
    story, col_widths=[5*cm, 12*cm]
)

sub_header("Scoring Systems", story)
story.append(Paragraph(B("Alvarado Score (MANTRELS) — Appendicitis:"), h3))
two_col_table(
    ["Feature", "Score"],
    [
        ["Migration of pain to RIF", "1"],
        ["Anorexia",                 "1"],
        ["Nausea / Vomiting",        "1"],
        ["Tenderness in RIF",        "2"],
        ["Rebound tenderness",       "1"],
        ["Elevated temperature (>37.3°C)", "1"],
        ["Leucocytosis (WBC >10,000)", "2"],
        ["Shift to left (neutrophilia)", "1"],
        [B("Total"), B("10")],
    ],
    story, col_widths=[12*cm, 5*cm]
)
highlight_box("Score ≥7 = Appendicitis likely (operate); 5–6 = Equivocal (observe/CT); <5 = Unlikely", story)

story.append(Paragraph(B("Ranson's Criteria — Pancreatitis Severity:"), h3))
two_col_table(
    ["On Admission", "At 48 Hours"],
    [
        ["Age >55 yrs", "Haematocrit fall >10%"],
        ["WBC >16,000/mm³", "BUN rise >5 mg/dL"],
        ["Blood glucose >200 mg/dL", "Ca²⁺ <8 mg/dL"],
        ["LDH >350 IU/L", "PaO₂ <60 mmHg"],
        ["AST >250 IU/L", "Base deficit >4 mEq/L"],
        ["", "Fluid sequestration >6L"],
    ],
    story, col_widths=[8.5*cm, 8.5*cm]
)
highlight_box("Score ≥3 = Severe pancreatitis. Mortality: 0–2 = <1%; 3–4 = 15%; 5–6 = 40%; >6 = ~100%", story)

story.append(Paragraph(B("Charcot's Triad and Reynolds' Pentad — Cholangitis:"), h3))
bullet_list([
    "Charcot's Triad: RUQ pain + Fever/rigors + Jaundice → Acute cholangitis",
    "Reynolds' Pentad: Charcot's triad + Hypotension + Mental confusion → Suppurative (toxic) cholangitis",
], story)

# ══════════════════════════════════════════════════════════════════════
# SECTION 9: IMAGING
# ══════════════════════════════════════════════════════════════════════
section_header("9. Imaging in Acute Abdomen", story)
two_col_table(
    ["Investigation", "Findings / Uses"],
    [
        ["Erect CXR",
         "FREE GAS under diaphragm (pneumoperitoneum) → perforated viscus\n"
         "• Most common cause: perforated peptic ulcer\n"
         "• Right dome → peptic ulcer; Left dome → less common\n"
         "• May be absent in 30% of perforations\n"
         "• Also: mediastinal widening (aortic dissection)"],
        ["Supine AXR",
         "• Dilated bowel loops: SBO (central, valvulae conniventes) vs LBO (peripheral, haustra)\n"
         "• 3-6-9 rule: SB <3cm, LB <6cm, caecum <9cm normal\n"
         "• Gas pattern: Rigler's sign (gas both sides bowel wall = pneumoperitoneum)\n"
         "• Thumbprinting = ischaemic colitis / intramural haemorrhage\n"
         "• Psoas shadow obliteration = retroperitoneal pathology\n"
         "• Air in biliary tree = Rigler's triad (pneumobilia + SBO + ectopic gallstone) = Gallstone ileus"],
        ["Erect AXR",
         "Air-fluid levels → obstruction or ileus; Multiple fluid levels = SBO"],
        ["Ultrasound",
         "First-line for RUQ pain, suspected gallstones, appendicitis (children/pregnant)\n"
         "• Murphy's sign on USS (sonographic Murphy's) specific for cholecystitis\n"
         "• FAST scan (Focused Assessment Sonography in Trauma) for haemoperitoneum\n"
         "• Ectopic pregnancy: transvaginal USS; Ovarian pathology"],
        ["CT Abdomen/Pelvis (contrast)",
         "Gold standard for most acute abdominal conditions\n"
         "• Appendicitis: >6mm diameter, periappendiceal fat stranding, appendicolith\n"
         "• Diverticulitis: pericolic fat stranding, wall thickening, abscess\n"
         "• AAA: aneurysm >5.5cm, retroperitoneal haematoma\n"
         "• Mesenteric ischaemia: pneumatosis intestinalis, portal venous gas, bowel wall thickening\n"
         "• Pancreatitis: CT Severity Index (Balthazar grading)"],
        ["MRI",
         "Preferred in pregnancy (avoid radiation); MRCP for biliary tree\n"
         "• Superior soft tissue contrast; No radiation"],
        ["CT Angiography",
         "Investigation of choice for suspected mesenteric ischaemia and ruptured AAA"],
        ["Diagnostic Laparoscopy",
         "When imaging inconclusive; also therapeutic (appendicectomy, adhesiolysis)"],
    ],
    story, col_widths=[4.5*cm, 12.5*cm]
)

sub_header("Pneumoperitoneum — High-Yield Signs", story)
two_col_table(
    ["Sign", "Description", "View"],
    [
        ["Rigler's sign (Double wall sign)", "Gas on both sides of bowel wall", "Supine AXR"],
        ["Football sign",          "Large oval collection of free gas outlining peritoneal cavity", "Supine AXR (infants)"],
        ["Cupola sign",            "Gas under central tendon of diaphragm", "Supine AXR"],
        ["Falciform ligament sign","Gas outlining falciform ligament", "Supine AXR"],
        ["Free gas under diaphragm", "Crescent of gas under right hemidiaphragm", "Erect CXR"],
    ],
    story, col_widths=[5*cm, 8*cm, 4*cm]
)

# ══════════════════════════════════════════════════════════════════════
# SECTION 10: KEY PATHOLOGIES
# ══════════════════════════════════════════════════════════════════════
section_header("10. Key Pathologies — Rapid Review", story)

sub_header("Appendicitis", story)
two_col_table(
    ["Feature", "Details"],
    [
        ["Incidence",       "Most common surgical emergency; Peak: 10–30 yrs; M > F"],
        ["Cause",           "Luminal obstruction (faecolith 40%, lymphoid hyperplasia 60% in children, tumour in elderly)"],
        ["Path progression","Obstruction → Distension → Ischaemia → Bacterial translocation → Gangrene → Perforation"],
        ["Pain",            "Periumbilical (visceral, T10) → RLQ (parietal) over 4–6h"],
        ["Key signs",       "McBurney's tenderness, Rovsing's, Psoas sign, Obturator sign, Dunphy's sign"],
        ["Investigations",  "Alvarado score; CT (gold standard in adults); USS (children/pregnancy)"],
        ["Complications",   "Perforation (15–20%), Peritonitis, Appendicular abscess/mass, Portal pyaemia (rare)"],
        ["Appendicular mass","Palpable RIF mass, conservative (Ochsner-Sherren regimen); interval appendicectomy at 6–8 weeks"],
        ["Surgery",         "Laparoscopic appendicectomy (preferred); Open grid-iron/Lanz incision"],
        ["Positions of appendix", "Retrocaecal (75%) — most common; Pelvic (20%); Subcaecal; Pre/post-ileal"],
    ],
    story, col_widths=[4*cm, 13*cm]
)

sub_header("Acute Cholecystitis", story)
bullet_list([
    "5 F's: Fat, Female, Fertile (40s), Fair, Flatulent — classic patient",
    "Caused by gallstone impaction in cystic duct in 90% (acalculous 10% — ICU/trauma patients)",
    "Murphy's sign positive; USS: gallstones + thickened wall >3mm + pericholecystic fluid",
    "Charcot's triad = cholangitis (add fever); Reynolds' pentad = suppurative cholangitis",
    "Treatment: NBM, IV fluids, analgesia, antibiotics; Laparoscopic cholecystectomy (within 72h preferred)",
    "Mirizzi syndrome: gallstone in Hartmann's pouch compressing CBD externally",
    "Courvoisier's law: palpable non-tender gallbladder + jaundice → malignant obstruction (not gallstones)",
], story)

sub_header("Acute Pancreatitis", story)
two_col_table(
    ["Feature", "Details"],
    [
        ["Causes (GET SMASHED)",  "Gallstones (40%), Ethanol (35%), Trauma, Steroids, Mumps/viruses, Autoimmune, Scorpion sting, Hypercalcaemia/Hyperlipidaemia/Hypothermia, ERCP/Drugs"],
        ["Diagnosis",             "Lipase >3× ULN (preferred) or Amylase >3× ULN + clinical features"],
        ["Severity scoring",      "Ranson, Glasgow (PANCREAS), APACHE-II, CT Severity Index (Balthazar)"],
        ["Balthazar Grade",       "A=Normal, B=Focal enlargement, C=Peri-pancreatic inflammation, D=Single fluid collection, E=Multiple collections/gas"],
        ["CT Severity Index",     "Balthazar grade (0–4) + Necrosis score (0–4): Total ≥7 = severe"],
        ["Complications (Local)", "Pseudocyst (>6wk), Necrosis, Abscess, Haemorrhage, Fistula, Chronic pancreatitis"],
        ["Complications (Systemic)", "ARDS, AKI, DIC, Shock, Hypocalcaemia, Hyperglycaemia"],
        ["Management",            "Aggressive IV fluid resuscitation (Lactated Ringer's preferred), analgesia, NBM initially, ERCP if CBD stone with cholangitis, Surgery only for infected necrosis"],
    ],
    story, col_widths=[4.5*cm, 12.5*cm]
)
mnemonic_box("GET SMASHED", "Gallstones, Ethanol, Trauma, Steroids, Mumps, Autoimmune, Scorpion, Hyperlipidaemia/Hypercalcaemia/Hypothermia, ERCP/Drugs", story)

sub_header("Bowel Obstruction", story)
two_col_table(
    ["Feature", "Small Bowel Obstruction (SBO)", "Large Bowel Obstruction (LBO)"],
    [
        ["Common causes", "Adhesions (60%), Hernia (20%), Intussusception, Tumour", "Carcinoma (60%), Diverticulitis, Volvulus"],
        ["Pain",          "Colicky, central/umbilical", "Colicky, peripheral/lower abdomen"],
        ["Vomiting",      "Early, profuse, bilious", "Late, faeculent"],
        ["Distension",    "Central (small bowel pattern)", "Peripheral (large bowel, haustra)"],
        ["AXR",           "Central dilated loops, valvulae conniventes", "Peripheral dilated loops, haustra"],
        ["Strangulation", "Tachycardia, fever, constant pain, peritonism — urgent surgery", "Same"],
    ],
    story, col_widths=[4*cm, 6.5*cm, 6.5*cm]
)

sub_header("Intestinal Volvulus", story)
two_col_table(
    ["Type", "Key Features", "AXR Finding"],
    [
        ["Sigmoid volvulus",  "Elderly, constipated, psychiatric patients; accounts for 80% of volvuli in India; Rx: flexible sigmoidoscopy decompression first", "Omega/coffee-bean sign pointing to RUQ"],
        ["Caecal volvulus",   "Younger patients, mobile caecum; can mimic SBO; requires right hemicolectomy", "Ectopic gas shadow in LUQ"],
        ["Gastric volvulus",  "Associated with diaphragmatic defects; Borchardt's triad: epigastric pain, retching without vomiting, inability to pass NGT", "Retrogastric gas"],
    ],
    story, col_widths=[4*cm, 8*cm, 5*cm]
)

sub_header("Mesenteric Ischaemia", story)
bullet_list([
    "PAIN OUT OF PROPORTION TO PHYSICAL SIGNS — classic teaching point",
    "SMA embolus (50%): sudden onset, AF/cardiac source; SMA thrombosis (25%): chronic mesenteric angina background",
    "Non-occlusive mesenteric ischaemia (NOMI, 20%): low-flow state, vasopressors, ICU patients",
    "Mesenteric venous thrombosis (5%): younger patients, hypercoagulable state",
    "Serum lactate elevated; CT angiography — investigation of choice",
    "Management: Urgent surgery (embolectomy/resection) for arterial occlusion; anticoagulation for venous thrombosis",
    "Pneumatosis intestinalis + portal venous gas on CT = bowel infarction → immediate surgery",
], story)

sub_header("Perforated Peptic Ulcer", story)
bullet_list([
    "Sudden onset epigastric pain like a knife/explosion; History of PUD, NSAID/steroid use, H. pylori",
    "Board-like rigidity, peritonism, absent bowel sounds — signs of generalised peritonitis",
    "Erect CXR: free gas under right hemidiaphragm (absent in 30% → CT confirms)",
    "Resuscitation + IV PPI + antibiotics → Emergency surgery: Graham's patch repair (omental patch)",
    "Duodenal ulcer perforates anteriorly (into peritoneum); Posterior DU erodes into gastroduodenal artery → haemorrhage",
], story)

sub_header("Ruptured AAA", story)
bullet_list([
    "Classic triad: Severe back/abdominal pain + Haemodynamic shock + Pulsatile abdominal mass",
    "Risk factors: Smoking (strongest), HTN, male, age >65, family history",
    "If unstable: straight to theatre (no time for CT); If stable: CT angiography first",
    "Repair: EVAR (endovascular) preferred if anatomy suitable; Open repair if unsuitable",
    "30-day mortality: EVAR ~2%, Open ~5% (elective); Ruptured: 50% overall mortality",
    "Aorto-enteric fistula: herald bleed → catastrophic GI haemorrhage (complication of aortic graft)",
], story)

# ══════════════════════════════════════════════════════════════════════
# SECTION 11: SPECIAL POPULATIONS
# ══════════════════════════════════════════════════════════════════════
section_header("11. Special Populations", story)
sub_header("Acute Abdomen in Pregnancy", story)
bullet_list([
    "Appendicitis most common non-obstetric surgical emergency in pregnancy; presentation atypical in late pregnancy (appendix displaced upward and laterally)",
    "RLQ tenderness may be higher than usual; WBC physiologically elevated in pregnancy (up to 16,000)",
    "USS first-line imaging; MRI if USS inconclusive; CT used if life-threatening emergency (radiation risk acceptable)",
    "Alvarado score less reliable in pregnancy; maintain high suspicion",
    "Always exclude ectopic pregnancy (βhCG + TVUSS)",
    "Ovarian torsion: more common in first trimester (corpus luteum cyst); severe unilateral pain + nausea/vomiting",
    "Ruptured ectopic: haemoperitoneum, shoulder tip pain, positive βhCG — immediate surgery",
    "HELLP syndrome / pre-eclampsia: epigastric/RUQ pain from hepatic capsule distension",
], story)

sub_header("Immunocompromised Patients", story)
bullet_list([
    "Signs and symptoms may be masked due to blunted inflammatory response",
    "WBC may not be elevated; Fever may be absent",
    "Low threshold for CT imaging and early surgical consultation",
    "Neutropaenic typhlitis (right colonic inflammation) in chemotherapy patients — CT diagnosis; conservative if stable",
    "CMV colitis, Cryptosporidium, Clostridium difficile in HIV/transplant patients",
], story)

sub_header("Elderly Patients", story)
bullet_list([
    "Presentation often atypical or delayed; higher perforation rate at presentation",
    "Diverticulitis and vascular pathology more common",
    "Comorbidities mask physiological response: normal HR/BP despite significant pathology",
    "Lower threshold for imaging and senior surgical review",
    "Mesenteric ischaemia: always consider in elderly with AF and severe abdominal pain",
], story)

# ══════════════════════════════════════════════════════════════════════
# SECTION 12: MANAGEMENT
# ══════════════════════════════════════════════════════════════════════
section_header("12. Management Principles", story)
sub_header("Initial Resuscitation (ABCDE + Surgery)", story)
bullet_list([
    "A: Airway — assess patency, NGT if vomiting/distension",
    "B: Breathing — O₂ supplementation, pulse oximetry",
    "C: Circulation — IV access × 2, bloods (FBC, U&E, LFT, amylase, coag, G&S), IV fluids (crystalloid), Foley catheter for urine output monitoring",
    "D: Disability — GCS, glucose, analgesia (opioid — does NOT mask signs, give early)",
    "E: Exposure — full abdominal exam, PR exam, hernial orifices",
    "Analgesia: Titrated IV opioid (morphine/fentanyl) — DOES NOT worsen diagnostic accuracy (evidence-based)",
    "NBM if surgery likely; NGT if obstruction/vomiting",
    "Antibiotics if infection/perforation: broad-spectrum (e.g. piperacillin-tazobactam or cephalosporin + metronidazole)",
], story)

sub_header("Indications for Emergency Surgery", story)
two_col_table(
    ["Condition", "Operation"],
    [
        ["Perforated peptic ulcer", "Laparotomy + Graham's omental patch"],
        ["Perforated diverticulitis (Hinchey III/IV)", "Hartmann's procedure (sigmoid colectomy + end colostomy)"],
        ["Strangulated hernia", "Hernia repair + bowel resection if necrotic"],
        ["Ruptured AAA", "EVAR or open aortic repair"],
        ["Ruptured ectopic pregnancy", "Laparoscopic salpingectomy (or salpingotomy if contralateral tube absent)"],
        ["Appendicitis (perforated/gangrenous)", "Laparoscopic appendicectomy"],
        ["Bowel obstruction with strangulation", "Laparotomy + resection + anastomosis"],
        ["Mesenteric ischaemia", "Embolectomy + bowel resection"],
        ["Sigmoid volvulus (failed endoscopy)", "Hartmann's or sigmoid colectomy"],
    ],
    story, col_widths=[6*cm, 11*cm]
)

sub_header("Hinchey Classification — Diverticulitis", story)
two_col_table(
    ["Stage", "Finding", "Management"],
    [
        ["I",   "Pericolic abscess", "IV antibiotics ± percutaneous drainage"],
        ["II",  "Pelvic/distant abscess", "IV antibiotics + percutaneous drainage"],
        ["III", "Purulent peritonitis (no communication with colon)", "Surgery: Hartmann's or primary anastomosis with defunctioning stoma"],
        ["IV",  "Faecal peritonitis", "Surgery: Hartmann's (high risk), primary anastomosis (low risk centres)"],
    ],
    story, col_widths=[1.5*cm, 7*cm, 8.5*cm]
)

# ══════════════════════════════════════════════════════════════════════
# SECTION 13: HIGH-YIELD NEET SS POINTS
# ══════════════════════════════════════════════════════════════════════
section_header("13. High-Yield NEET SS One-Liners", story)

highlight_box("These are repeatedly tested in NEET SS General Surgery / Surgery Superspecialty papers.", story)

one_liners = [
    "Most common cause of acute abdomen overall: Appendicitis",
    "Most common cause of SBO: Adhesions (post-operative)",
    "Most common cause of LBO: Carcinoma of colon",
    "Most common site of intestinal obstruction: Terminal ileum",
    "Most common position of appendix: Retrocaecal (75%)",
    "Pain out of proportion to signs: Mesenteric ischaemia",
    "Perforated peptic ulcer: free gas under right hemidiaphragm on erect CXR",
    "Coffee-bean / omega sign: Sigmoid volvulus on AXR",
    "Rigler's sign (double wall sign): Pneumoperitoneum on supine AXR",
    "Cullen's sign: Periumbilical ecchymosis → haemoperitoneum (pancreatitis, ectopic)",
    "Grey Turner's sign: Flank ecchymosis → retroperitoneal haemorrhage",
    "Kehr's sign: Left shoulder tip pain → splenic rupture",
    "Dance's sign: Empty RIF → intussusception",
    "Borchardt's triad: Epigastric pain + dry retching + can't pass NGT → Gastric volvulus",
    "Rigler's triad: Pneumobilia + SBO + ectopic gallstone → Gallstone ileus",
    "Charcot's triad: RUQ pain + fever + jaundice → Cholangitis",
    "Reynolds' pentad: Charcot's triad + shock + confusion → Suppurative cholangitis",
    "Courvoisier's law: Palpable non-tender GB + jaundice → malignant obstruction",
    "Mirizzi syndrome: Gallstone in Hartmann's pouch → external CBD compression",
    "Most common cause of pancreatitis in India: Gallstones; worldwide #2: Alcohol",
    "Most specific enzyme for pancreatitis: Lipase (> amylase)",
    "ERCP indicated in pancreatitis when: CBD stone + cholangitis/biliary obstruction",
    "Balthazar Grade E pancreatitis = ≥2 fluid collections ± gas in pancreas → CTSI ≥7 = severe",
    "Ochsner-Sherren regimen: Conservative management of appendicular mass (NBM, IV fluids, antibiotics, monitor)",
    "Interval appendicectomy: 6–8 weeks after appendicular mass resolution",
    "Graham's patch: Omental patch repair for perforated DU",
    "Hartmann's procedure: Resection + end colostomy (no primary anastomosis) for perforated diverticulitis",
    "Most common cause of peritonitis in children: Appendicitis",
    "Pneumatosis intestinalis + portal venous gas: Bowel infarction (emergency surgery)",
    "Investigation of choice for mesenteric ischaemia: CT angiography",
    "FAST scan: Haemoperitoneum in trauma",
    "Serum lactate: Best marker of tissue ischaemia in acute abdomen",
    "βhCG MUST be tested in all women of reproductive age with acute abdomen",
    "3-6-9 rule on AXR: SB >3cm, LB >6cm, Caecum >9cm = abnormal",
    "SMA embolus: Sudden onset, cardiac source (AF/MI), requires emergency surgery",
    "Hepatorenal syndrome: Dilated hepatic sinusoids + bile duct proliferation is NOT this — it is a complication of cirrhosis causing AKI",
    "Obturator sign: Pelvic appendicitis; Psoas sign: Retrocaecal appendicitis",
    "Laparoscopy is both diagnostic AND therapeutic in acute abdomen",
    "Surgical principle: When in doubt, look (exploratory laparotomy/laparoscopy)",
]

for idx, item in enumerate(one_liners):
    colour = MID_BLUE if idx % 2 == 0 else DARK_BLUE
    parts = item.split(":")
    if len(parts) >= 2:
        key = parts[0].strip()
        val = ":".join(parts[1:]).strip()
        story.append(Paragraph(f'<font color="{colour.hexval()}"><b>{key}:</b></font> {val}', body))
    else:
        story.append(Paragraph(f"• {item}", bullet))

# ══════════════════════════════════════════════════════════════════════
# SECTION 14: MCQ PRACTICE
# ══════════════════════════════════════════════════════════════════════
section_header("14. MCQ Practice", story)
mcqs = [
    {
        "q": "1. A 35-year-old male presents with sudden severe epigastric pain that became generalised over 2 hours. O/E: Board-like rigidity, absent bowel sounds, guarding. Erect CXR shows free gas under the right hemidiaphragm. The most appropriate immediate management is:",
        "opts": ["A. IV omeprazole and observation", "B. Emergency laparotomy + Graham's patch repair", "C. Endoscopy", "D. CT scan and surgical consult"],
        "ans": "B — Perforated peptic ulcer with pneumoperitoneum requires emergency surgery (Graham's omental patch)."
    },
    {
        "q": "2. A 70-year-old man with known AF presents with severe central abdominal pain. Examination shows minimal tenderness. Vitals: HR 110, BP 100/60. Serum lactate is 6.8 mmol/L. The most likely diagnosis is:",
        "opts": ["A. Acute pancreatitis", "B. Sigmoid volvulus", "C. Acute mesenteric ischaemia", "D. Perforated DU"],
        "ans": "C — Pain out of proportion to signs + AF + elevated lactate = mesenteric ischaemia (SMA embolus from AF)."
    },
    {
        "q": "3. On AXR, a coffee-bean shaped gas shadow pointing to the right upper quadrant is seen. The diagnosis is:",
        "opts": ["A. Caecal volvulus", "B. Sigmoid volvulus", "C. Gallstone ileus", "D. Gastric volvulus"],
        "ans": "B — The omega/coffee-bean sign pointing to RUQ is pathognomonic of sigmoid volvulus."
    },
    {
        "q": "4. A 6-month-old infant presents with intermittent colicky crying, draws up knees, passes red-currant jelly stool. Examination reveals a sausage-shaped mass in RUQ and emptiness in RIF. The diagnosis is:",
        "opts": ["A. Appendicitis", "B. Intussusception", "C. Hirschsprung disease", "D. Meckel's diverticulum"],
        "ans": "B — Classic intussusception: infant, colicky pain, red-currant jelly stool, sausage mass RUQ, Dance's sign (empty RIF)."
    },
    {
        "q": "5. Which of the following is NOT a component of Ranson's criteria assessed at admission?",
        "opts": ["A. Age >55 years", "B. WBC >16,000/mm³", "C. Serum calcium <8 mg/dL", "D. Blood glucose >200 mg/dL"],
        "ans": "C — Calcium <8 mg/dL is assessed at 48 hours, not on admission."
    },
    {
        "q": "6. A woman of 28 years with 6 weeks amenorrhoea presents with sudden severe right iliac fossa pain, shoulder tip pain, and syncope. βhCG is positive. Vitals: BP 80/50, HR 130. Immediate management:",
        "opts": ["A. Transvaginal USS and wait", "B. MRI pelvis", "C. Resuscitation + Emergency laparoscopy/laparotomy", "D. Methotrexate injection"],
        "ans": "C — Ruptured ectopic pregnancy with haemodynamic instability requires immediate surgical intervention."
    },
    {
        "q": "7. An 80-year-old woman with palpable non-tender gallbladder and jaundice. Courvoisier's law predicts:",
        "opts": ["A. Gallstone obstruction of CBD", "B. Malignant obstruction (pancreatic head / cholangiocarcinoma)", "C. Acute cholecystitis", "D. Hepatocellular carcinoma"],
        "ans": "B — Courvoisier's law: non-tender palpable GB + jaundice = malignant obstruction (gallstones cause fibrotic, non-distensible GB)."
    },
    {
        "q": "8. Alvarado score of 8 in a 22-year-old male with RIF pain. Next step:",
        "opts": ["A. Observe for 24 hours", "B. USS abdomen", "C. Proceed to appendicectomy", "D. Discharge with analgesia"],
        "ans": "C — Score ≥7 indicates high probability of appendicitis; proceed to surgery."
    },
]

for mcq in mcqs:
    story.append(Spacer(1, 4))
    story.append(Paragraph(mcq["q"], body))
    for opt in mcq["opts"]:
        story.append(Paragraph(f"    {opt}", bullet))
    highlight_box(f"✅ Answer: {mcq['ans']}", story)
    story.append(Spacer(1, 4))

# ── build ─────────────────────────────────────────────────────────────
doc.build(story)
print(f"PDF generated: {OUTPUT}")
Running Command

cd /home/daytona/workspace/acute-abdomen-neet && python generate_pdf.py 2>&1

Your credits are exhausted. Your daily credits reset tomorrow, or you can purchase a top-up for more.
This is a shared conversation. Sign in to Orris to start your own chat.