Inguinal canal

| Wall | Structure |
|---|---|
| Anterior | Aponeurosis of external oblique (entire length); reinforced laterally by lower fibers of internal oblique (covering the deep ring) |
| Posterior | Transversalis fascia (entire length); reinforced medially by conjoint tendon (inguinal falx) along the medial one-third |
| Roof (Superior) | Arching fibers of transversus abdominis and internal oblique muscles |
| Floor (Inferior) | Medial half of the inguinal ligament (rolled-under free margin of external oblique aponeurosis); lacunar ligament reinforces the medial part |

| Layer | Derived From |
|---|---|
| Internal spermatic fascia | Transversalis fascia (at deep ring) |
| Cremasteric fascia + cremaster muscle | Internal oblique |
| External spermatic fascia | External oblique aponeurosis (at superficial ring) |

Create a study guide on inguinal hernia types and clinical recognition
| Fact | Detail |
|---|---|
| Male : Female ratio | 10:1 |
| Right > Left | Relates to later descent of right testis |
| Indirect : Direct ratio | ~2:1 |
| Lifetime risk | ~25% in males; ~5% in females |
| Peak incidence | Bimodal - ages 0-5 years AND 70-80 years |
| Most common type in women | Indirect inguinal (5x more common than femoral in women) |

Indirect hernia = lateral to inferior epigastric vessels (through deep ring) Direct hernia = medial to inferior epigastric vessels (through Hesselbach's triangle) Femoral hernia = below the inguinal ligament

| Type | Mechanism |
|---|---|
| Congenital | Persistence of processus vaginalis; all paediatric inguinal hernias are indirect |
| Acquired | Deep inguinal ring stretched over time under chronic raised intra-abdominal pressure |

| Border | Structure |
|---|---|
| Lateral | Inferior epigastric vessels |
| Medial | Lateral border of rectus abdominis |
| Inferior | Inguinal ligament |
| Feature | Indirect | Direct |
|---|---|---|
| Entry point | Deep inguinal ring (lateral to IEV) | Posterior wall (medial to IEV) |
| Origin | Congenital or acquired | Always acquired |
| Path | Oblique through canal | Direct anteriorly |
| Descent to scrotum | Yes - can | No |
| Age | Any (peaks in infants + adults) | Older adults |
| Sex | M > F | Almost exclusively male |
| Neck of sac | Narrow (at deep ring) | Wide (diffuse bulge) |
| Incarceration risk | Higher | Lower |
| Strangulation risk | Higher (narrow neck) | Lower |
| Ring occlusion test | Controlled | NOT controlled (bulges medially) |
| Finger impulse direction | Tip of finger | Pulp of finger |
| Shape at rest | May be elongated/tubular | Rounded, diffuse |

| Stage | Definition | Features |
|---|---|---|
| Reducible | Contents return to abdomen spontaneously or with pressure | Soft, non-tender, cough impulse |
| Irreducible | Cannot be reduced without surgical intervention; not yet compromised | Firm, no cough impulse |
| Incarcerated | Irreducible + associated swelling/oedema of contents | Pain, unable to reduce, no cough impulse |
| Strangulated | Incarcerated + vascular compromise/ischaemia of contents | Acutely tender, overlying erythema, systemic toxicity, obstruction |
| Type | Description |
|---|---|
| I | Indirect - normal-sized internal ring; typically infants, children, small adults |
| II | Indirect - dilated internal ring; posterior wall intact; inferior epigastric vessels not displaced; does not extend to scrotum |
| IIIA | Direct - posterior wall defect; size not taken into account |
| IIIB | Indirect - dilated ring encroaching on Hesselbach's triangle (massive scrotal, sliding, or pantaloon type) |
| IIIC | Femoral hernia |
| IVA | Recurrent direct |
| IVB | Recurrent indirect |
| IVC | Recurrent femoral |
| IVD | Recurrent combined |
| Condition | Key Distinguishing Features |
|---|---|
| Indirect inguinal hernia | Above inguinal ligament, lateral, cough impulse, may reach scrotum |
| Direct inguinal hernia | Above inguinal ligament, medial, rounded, doesn't reach scrotum |
| Femoral hernia | Below inguinal ligament, lateral to pubic tubercle, more common in females |
| Hydrocele | Transilluminates brightly; can get above it on palpation; no cough impulse |
| Communicating hydrocele | Transilluminates; fluctuates in size with posture (connected to peritoneum) |
| Encysted hydrocele of cord | Descends with traction on testis; transilluminates |
| Varicocele | "Bag of worms" feel; does not transilluminate; left > right |
| Lymphadenopathy | Firm/rubbery; no cough impulse; look for primary source (foot, leg, genitalia) |
| Saphena varix | Below inguinal ligament; has cough impulse; compressible; blue skin tinge; often with varicose veins below |
| Femoral artery aneurysm | Expansile pulsatile swelling; moves side-to-side; may have bruit |
| Lipoma of cord | Soft; no cough impulse; found in cord during surgery |
| Psoas abscess | Fluctuant; no cough impulse; usually midline origin with lateral tracking |
Generate a quick reference cheat sheet PDF for exams
ls -la /home/daytona/workspace/ 2>/dev/null || mkdir -p /home/daytona/workspace
mkdir -p /home/daytona/workspace/inguinal-hernia && python3 -c "from reportlab.l…
~/inguinal-hernia/build_cheatsheet.py
"""
Inguinal Hernia Quick Reference Cheat Sheet
Generates a 2-page A4 PDF optimised for exam revision.
"""
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import mm, cm
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_RIGHT
from reportlab.platypus import (
SimpleDocTemplate, Paragraph, Table, TableStyle, Spacer,
HRFlowable, KeepTogether
)
from reportlab.platypus.flowables import HRFlowable
from reportlab.lib.colors import HexColor, white, black
# ── Colour palette ────────────────────────────────────────────────────────────
C_DARK = HexColor("#1a2b4a") # navy - main headers
C_BLUE = HexColor("#2563eb") # blue - section bars
C_TEAL = HexColor("#0891b2") # teal - sub-headers
C_RED = HexColor("#dc2626") # red - danger / strangulation
C_AMBER = HexColor("#d97706") # amber - incarceration / caution
C_GREEN = HexColor("#16a34a") # green - reducible / normal
C_LGREY = HexColor("#f1f5f9") # light grey - alt table rows
C_MGREY = HexColor("#e2e8f0") # medium grey - table header bg
C_TEXT = HexColor("#1e293b") # near-black body text
C_MUTED = HexColor("#64748b") # muted grey footnotes
OUTPUT = "/home/daytona/workspace/inguinal-hernia/Inguinal_Hernia_Cheatsheet.pdf"
# ── Document ──────────────────────────────────────────────────────────────────
doc = SimpleDocTemplate(
OUTPUT,
pagesize=A4,
leftMargin=12*mm,
rightMargin=12*mm,
topMargin=12*mm,
bottomMargin=10*mm,
title="Inguinal Hernia Quick Reference",
author="Orris Medical Study Guides",
)
W, H = A4
USABLE_W = W - 24*mm # total usable width
# ── Styles ────────────────────────────────────────────────────────────────────
styles = getSampleStyleSheet()
def style(name, **kw):
base = styles["Normal"]
return ParagraphStyle(name, parent=base, **kw)
S_TITLE = style("Title", fontName="Helvetica-Bold", fontSize=18, textColor=white,
leading=22, alignment=TA_CENTER, spaceAfter=2)
S_SUBTITLE= style("Sub", fontName="Helvetica", fontSize=9, textColor=HexColor("#cbd5e1"),
leading=11, alignment=TA_CENTER, spaceAfter=0)
S_SEC = style("Sec", fontName="Helvetica-Bold", fontSize=9, textColor=white,
leading=11, alignment=TA_LEFT, spaceBefore=2, spaceAfter=1)
S_BODY = style("Body", fontName="Helvetica", fontSize=7.5, textColor=C_TEXT,
leading=10.5, spaceAfter=1)
S_BOLD = style("Bold", fontName="Helvetica-Bold", fontSize=7.5, textColor=C_TEXT,
leading=10.5)
S_SMALL = style("Small", fontName="Helvetica", fontSize=6.5, textColor=C_MUTED,
leading=9, alignment=TA_CENTER)
S_TH = style("TH", fontName="Helvetica-Bold", fontSize=7, textColor=C_DARK,
leading=9, alignment=TA_CENTER)
S_TD = style("TD", fontName="Helvetica", fontSize=7, textColor=C_TEXT,
leading=9.5)
S_TDC = style("TDC", fontName="Helvetica", fontSize=7, textColor=C_TEXT,
leading=9.5, alignment=TA_CENTER)
S_TDB = style("TDB", fontName="Helvetica-Bold", fontSize=7, textColor=C_TEXT,
leading=9.5)
S_WARN = style("Warn", fontName="Helvetica-Bold", fontSize=7.5, textColor=C_RED,
leading=10)
S_MNEM = style("Mnem", fontName="Helvetica-Oblique", fontSize=7.5, textColor=C_DARK,
leading=10.5, leftIndent=4)
S_NOTE = style("Note", fontName="Helvetica-Oblique", fontSize=6.5, textColor=C_MUTED,
leading=9)
def P(text, s=S_BODY): return Paragraph(text, s)
def PB(text): return Paragraph(text, S_BOLD)
def PW(text): return Paragraph(text, S_WARN)
def section_bar(title, color=C_BLUE):
"""Coloured section header bar."""
t = Table([[P(title, S_SEC)]], colWidths=[USABLE_W])
t.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), color),
("LEFTPADDING", (0,0), (-1,-1), 5),
("RIGHTPADDING", (0,0), (-1,-1), 5),
("TOPPADDING", (0,0), (-1,-1), 3),
("BOTTOMPADDING",(0,0), (-1,-1), 3),
("ROUNDEDCORNERS", [3]),
]))
return t
def h_rule():
return HRFlowable(width="100%", thickness=0.5, color=C_MGREY, spaceAfter=2, spaceBefore=2)
def table_style(header_color=C_MGREY, alt=True):
cmds = [
("BACKGROUND", (0,0), (-1,0), header_color),
("GRID", (0,0), (-1,-1), 0.4, HexColor("#cbd5e1")),
("LEFTPADDING", (0,0), (-1,-1), 4),
("RIGHTPADDING", (0,0), (-1,-1), 4),
("TOPPADDING", (0,0), (-1,-1), 2),
("BOTTOMPADDING",(0,0), (-1,-1), 2),
("ROWBACKGROUNDS",(0,1),(-1,-1), [white, C_LGREY] if alt else [white]),
("VALIGN", (0,0), (-1,-1), "MIDDLE"),
]
return TableStyle(cmds)
# ══════════════════════════════════════════════════════════════════════════════
story = []
# ── PAGE HEADER ───────────────────────────────────────────────────────────────
header = Table(
[[P("INGUINAL HERNIA", S_TITLE),
P("Quick Reference Cheat Sheet | Surgery & Clinical Anatomy | Exam Edition", S_SUBTITLE)]],
colWidths=[USABLE_W]
)
header.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), C_DARK),
("TOPPADDING", (0,0), (-1,-1), 8),
("BOTTOMPADDING",(0,0), (-1,-1), 6),
("LEFTPADDING", (0,0), (-1,-1), 10),
]))
story.append(header)
story.append(Spacer(1, 3*mm))
# ══════════════════════════════════════════════════════════════════════════════
# SECTION 1 – EPIDEMIOLOGY (two mini-tables side by side)
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_bar("1 EPIDEMIOLOGY & RISK FACTORS"))
story.append(Spacer(1, 1*mm))
epi_data = [
[P("Parameter", S_TH), P("Value", S_TH)],
[P("% of all hernias", S_TDC), P("75% inguinal | 5% femoral | 15% incisional/umbilical", S_TD)],
[P("Indirect : Direct", S_TDC), P("2 : 1", S_TDC)],
[P("Male : Female", S_TDC), P("10 : 1", S_TDC)],
[P("Lifetime risk", S_TDC), P("~25% males | ~5% females", S_TDC)],
[P("Peak ages", S_TDC), P("0–5 yrs AND 70–80 yrs (bimodal)", S_TD)],
[P("Right > Left", S_TDC), P("Due to later descent of right testis", S_TD)],
[P("Most common in women", S_TDC), P("Indirect inguinal (5× > femoral)", S_TD)],
]
epi_t = Table(epi_data, colWidths=[USABLE_W*0.28, USABLE_W*0.72])
epi_t.setStyle(table_style())
story.append(epi_t)
story.append(Spacer(1, 2*mm))
# ══════════════════════════════════════════════════════════════════════════════
# SECTION 2 – TYPE COMPARISON (full-width)
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_bar("2 INDIRECT vs DIRECT vs FEMORAL — COMPARISON"))
story.append(Spacer(1, 1*mm))
CW = USABLE_W / 4
comp_data = [
[P("Feature", S_TH), P("INDIRECT", S_TH), P("DIRECT", S_TH), P("FEMORAL", S_TH)],
[P("Entry point", S_TDB),
P("Deep inguinal ring — lateral to IEV", S_TD),
P("Posterior wall (Hesselbach's △) — medial to IEV", S_TD),
P("Femoral canal — below inguinal lig.", S_TD)],
[P("Relation to IEV", S_TDB),
P("Lateral", S_TDC), P("Medial", S_TDC), P("Below lig.", S_TDC)],
[P("Relation to pubic tubercle", S_TDB),
P("Above & lateral", S_TDC), P("Above & medial", S_TDC), P("Below & lateral", S_TDC)],
[P("Aetiology", S_TDB),
P("Congenital (patent PV) or acquired", S_TD),
P("Always acquired", S_TD),
P("Acquired (raised IAP in women)", S_TD)],
[P("Descends to scrotum?", S_TDB),
P("YES", S_TDC), P("NO", S_TDC), P("NO", S_TDC)],
[P("Neck of sac", S_TDB),
P("Narrow", S_TDC), P("Wide (diffuse)", S_TDC), P("Very narrow", S_TDC)],
[P("Strangulation risk", S_TDB),
P("Moderate", S_TDC),
P("Low", S_TDC),
P("HIGH (40% present as emergency)", S_TDC)],
[P("Ring occlusion test", S_TDB),
P("Controlled (no bulge)", S_TDC),
P("NOT controlled (medial bulge)", S_TDC),
P("N/A", S_TDC)],
[P("Finger tip/pulp", S_TDB),
P("TIP of finger", S_TDC), P("PULP of finger", S_TDC), P("—", S_TDC)],
[P("Sex predominance", S_TDB),
P("M >> F", S_TDC), P("Almost exclusively M", S_TDC), P("F > M", S_TDC)],
]
comp_t = Table(comp_data, colWidths=[CW*0.85, CW*1.05, CW*1.05, CW*1.05])
ts = table_style(header_color=HexColor("#dbeafe"))
ts.add("BACKGROUND", (1,0), (1,0), HexColor("#dbeafe"))
ts.add("BACKGROUND", (2,0), (2,0), HexColor("#fce7f3"))
ts.add("BACKGROUND", (3,0), (3,0), HexColor("#fef3c7"))
comp_t.setStyle(ts)
story.append(comp_t)
story.append(Spacer(1, 2*mm))
# ══════════════════════════════════════════════════════════════════════════════
# SECTION 3 + 4 side by side: Hesselbach's Triangle | Clinical Exam
# ══════════════════════════════════════════════════════════════════════════════
HALF = (USABLE_W - 4*mm) / 2
# --- Hesselbach's triangle ---
hess_items = [
section_bar("3 HESSELBACH'S TRIANGLE", color=C_TEAL),
Spacer(1, 1*mm),
Table([
[P("Border", S_TH), P("Structure", S_TH)],
[P("Lateral", S_TDC), P("Inferior epigastric vessels (IEV)", S_TD)],
[P("Medial", S_TDC), P("Lateral border of rectus abdominis", S_TD)],
[P("Inferior", S_TDC), P("Inguinal ligament", S_TD)],
], colWidths=[HALF*0.3, HALF*0.7], style=table_style(alt=False)),
Spacer(1, 1.5*mm),
P("<b>Direct hernia</b> occurs here — posterior wall weakness allows peritoneum to balloon forward.", S_BODY),
Spacer(1, 1.5*mm),
section_bar("4 DEEP INGUINAL RING LOCATION", color=C_TEAL),
Spacer(1, 1*mm),
P("Midpoint between <b>ASIS</b> and <b>pubic symphysis</b>, just above inguinal ligament, immediately <b>lateral to IEV</b>.", S_BODY),
Spacer(1, 1.5*mm),
P("• Normal ring = triangular slit admitting only fingertip", S_BODY),
P("• If >1 finger enters easily = abnormally enlarged", S_BODY),
]
# --- Clinical examination ---
exam_items = [
section_bar("5 CLINICAL EXAMINATION STEPS", color=C_TEAL),
Spacer(1, 1*mm),
P("<b>1. Inspect</b> standing — look for groin swelling with cough/Valsalva", S_BODY),
P("<b>2. Invagination technique</b> (males):", S_BODY),
P(" • Invaginate scrotal skin with index finger", S_BODY),
P(" • Follow spermatic cord up to external ring", S_BODY),
P(" • Ask patient to cough", S_BODY),
P(" → Impulse on <b>TIP</b> = <b>INDIRECT</b>", S_BODY),
P(" → Impulse on <b>PULP</b> = <b>DIRECT</b>", S_BODY),
Spacer(1, 1.5*mm),
P("<b>3. Ring Occlusion Test</b> (after reduction):", S_BODY),
P(" • Press thumb on deep ring (½\" above mid-inguinal point)", S_BODY),
P(" • Ask to cough", S_BODY),
P(" → Controlled = <b>INDIRECT</b> | Medial bulge = <b>DIRECT</b>", S_BODY),
Spacer(1, 1.5*mm),
P("<b>4. Percussion:</b> Resonant = bowel (enterocele) | Dull = omentum/fat", S_BODY),
P("<b>5. Can you get above the swelling?</b>", S_BODY),
P(" → Yes = hydrocele | No = hernia (descends from abdomen)", S_BODY),
P("<b>6. Transillumination:</b> Positive = hydrocele | Negative = hernia", S_BODY),
]
two_col = Table(
[[hess_items, exam_items]],
colWidths=[HALF, HALF],
)
two_col.setStyle(TableStyle([
("VALIGN", (0,0), (-1,-1), "TOP"),
("LEFTPADDING", (0,0), (-1,-1), 0),
("RIGHTPADDING", (0,0), (-1,-1), 0),
("TOPPADDING", (0,0), (-1,-1), 0),
("BOTTOMPADDING",(0,0), (-1,-1), 0),
("INNERGRID", (0,0), (-1,-1), 0, white),
("RIGHTPADDING", (0,0), (0,-1), 4),
]))
story.append(two_col)
story.append(Spacer(1, 2*mm))
# ══════════════════════════════════════════════════════════════════════════════
# SECTION 6 – COMPLICATIONS LADDER
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_bar("6 COMPLICATIONS — REDUCIBLE → STRANGULATED", color=C_RED))
story.append(Spacer(1, 1*mm))
comp2_data = [
[P("Stage", S_TH), P("Definition", S_TH), P("Clinical Signs", S_TH), P("Action", S_TH)],
[P("Reducible", S_TDC),
P("Contents return spontaneously", S_TD),
P("Soft, non-tender, cough impulse present", S_TD),
P("Elective repair", S_TDC)],
[P("Irreducible", S_TDC),
P("Cannot be manually reduced; no vascular compromise", S_TD),
P("Firm, no cough impulse", S_TD),
P("Urgent review", S_TDC)],
[P("Incarcerated", S_TDC),
P("Irreducible + oedema of contents", S_TD),
P("Pain, swelling, tender; no cough impulse", S_TD),
P("Attempt taxis (careful reduction); if fails → surgery", S_TDC)],
[P("STRANGULATED", S_TDB),
P("Incarcerated + vascular compromise → ischaemia/gangrene", S_TD),
P("Acutely tender, erythema, systemic toxicity, bowel obstruction", S_TD),
P("EMERGENCY surgery", S_TDC)],
]
comp2_t = Table(comp2_data, colWidths=[USABLE_W*0.13, USABLE_W*0.28, USABLE_W*0.33, USABLE_W*0.26])
comp2_ts = table_style(header_color=HexColor("#fee2e2"))
comp2_ts.add("BACKGROUND", (0,4), (-1,4), HexColor("#fef2f2"))
comp2_ts.add("TEXTCOLOR", (0,4), (-1,4), C_RED)
comp2_t.setStyle(comp2_ts)
story.append(comp2_t)
story.append(Spacer(1, 2*mm))
# ══════════════════════════════════════════════════════════════════════════════
# SECTION 7 – NYHUS + 8 – SPECIAL TYPES side by side
# ══════════════════════════════════════════════════════════════════════════════
nyhus_items = [
section_bar("7 NYHUS CLASSIFICATION", color=HexColor("#7c3aed")),
Spacer(1, 1*mm),
Table([
[P("Type", S_TH), P("Description", S_TH)],
[P("I", S_TDC), P("Indirect — normal-sized ring (infants, children)", S_TD)],
[P("II", S_TDC), P("Indirect — dilated ring; posterior wall intact; not scrotal", S_TD)],
[P("IIIA",S_TDC), P("Direct — posterior wall defect", S_TD)],
[P("IIIB",S_TDC), P("Indirect — ring encroaches on Hesselbach's △ (scrotal/sliding/pantaloon)", S_TD)],
[P("IIIC",S_TDC), P("Femoral", S_TD)],
[P("IV", S_TDC), P("Recurrent (A=direct, B=indirect, C=femoral, D=combined)", S_TD)],
], colWidths=[HALF*0.18, HALF*0.82], style=table_style(alt=True)),
Spacer(1, 1.5*mm),
P("<b>EHS Classification:</b> Location (M/L/F) + Size (1/2/3 fingers) + Status (P/R)", S_BODY),
]
special_items = [
section_bar("8 SPECIAL HERNIA TYPES", color=HexColor("#7c3aed")),
Spacer(1, 1*mm),
PB("Sliding hernia"),
P("Part of sac wall IS the viscus (sigmoid left, caecum right). Risk of bowel injury on opening sac.", S_BODY),
Spacer(1, 1*mm),
PB("Pantaloon (Saddle-bag) hernia"),
P("Direct + indirect components straddle the IEV. Both sacs present simultaneously = Nyhus IIIB.", S_BODY),
Spacer(1, 1*mm),
PB("Richter hernia"),
P("Only antimesenteric wall of bowel trapped. NO obstruction/vomiting initially. High strangulation risk.", S_BODY),
Spacer(1, 1*mm),
PB("Maydl hernia (hernia-en-W)"),
P("Two loops herniate; intervening loop remains in abdomen and strangulates without external signs.", S_BODY),
]
two_col2 = Table(
[[nyhus_items, special_items]],
colWidths=[HALF, HALF],
)
two_col2.setStyle(TableStyle([
("VALIGN", (0,0), (-1,-1), "TOP"),
("LEFTPADDING", (0,0), (-1,-1), 0),
("RIGHTPADDING", (0,0), (-1,-1), 0),
("TOPPADDING", (0,0), (-1,-1), 0),
("BOTTOMPADDING",(0,0), (-1,-1), 0),
("RIGHTPADDING", (0,0), (0,-1), 4),
]))
story.append(two_col2)
story.append(Spacer(1, 2*mm))
# ══════════════════════════════════════════════════════════════════════════════
# SECTION 9 – DIFFERENTIAL DIAGNOSIS TABLE
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_bar("9 DIFFERENTIAL DIAGNOSIS OF A GROIN SWELLING", color=HexColor("#0f766e")))
story.append(Spacer(1, 1*mm))
dd_data = [
[P("Condition", S_TH), P("Position", S_TH), P("Cough Impulse", S_TH), P("Transilluminates", S_TH), P("Key Feature", S_TH)],
[P("Indirect inguinal hernia", S_TD), P("Above lig., lateral", S_TDC), P("Yes", S_TDC), P("No", S_TDC), P("May descend to scrotum", S_TD)],
[P("Direct inguinal hernia", S_TD), P("Above lig., medial", S_TDC), P("Yes", S_TDC), P("No", S_TDC), P("Rounded, does not reach scrotum", S_TD)],
[P("Femoral hernia", S_TD), P("Below lig., lateral to PT", S_TDC), P("Rarely", S_TDC), P("No", S_TDC), P("F>M; HIGH strangulation risk", S_TD)],
[P("Hydrocele", S_TD), P("Scrotum", S_TDC), P("No", S_TDC), P("YES brightly", S_TDC), P("Can get above it", S_TD)],
[P("Communicating hydrocele", S_TD), P("Scrotum/cord", S_TDC), P("No", S_TDC), P("Yes", S_TDC), P("Fluctuates in size with posture", S_TD)],
[P("Encysted hydrocele cord", S_TD), P("Cord, inguinal", S_TDC), P("No", S_TDC), P("Yes", S_TDC), P("Descends + fixes with testicular traction", S_TD)],
[P("Varicocele", S_TD), P("Cord/scrotum", S_TDC), P("No", S_TDC), P("No", S_TDC), P("\"Bag of worms\"; L > R", S_TD)],
[P("Lymphadenopathy", S_TD), P("Below lig. (femoral)", S_TDC), P("No", S_TDC), P("No", S_TDC), P("Firm/rubbery; seek primary source", S_TD)],
[P("Saphena varix", S_TD), P("Below lig.", S_TDC), P("Yes", S_TDC), P("No", S_TDC), P("Blue tinge; compressible; disappears lying down", S_TD)],
[P("Femoral artery aneurysm", S_TD), P("Below lig.", S_TDC), P("No", S_TDC), P("No", S_TDC), P("Expansile pulsation; side-to-side movement", S_TD)],
[P("Psoas abscess", S_TD), P("Below lig., lateral", S_TDC), P("No", S_TDC), P("No", S_TDC), P("Fluctuant; tracks from spine/hip pathology", S_TD)],
]
CW2 = [USABLE_W*0.22, USABLE_W*0.17, USABLE_W*0.11, USABLE_W*0.12, USABLE_W*0.38]
dd_t = Table(dd_data, colWidths=CW2)
dd_t.setStyle(table_style(header_color=HexColor("#ccfbf1")))
story.append(dd_t)
story.append(Spacer(1, 2*mm))
# ══════════════════════════════════════════════════════════════════════════════
# SECTION 10 – MNEMONICS BANNER
# ══════════════════════════════════════════════════════════════════════════════
story.append(section_bar("10 EXAM MNEMONICS & HIGH-YIELD PEARLS", color=HexColor("#b45309")))
story.append(Spacer(1, 1*mm))
mem_left = [
PB("INDIRECT vs DIRECT — remember by age:"),
P(""Young MALE gets Indirect (congenital/lateral), OLD MALE gets Direct (acquired/medial)"", S_MNEM),
Spacer(1, 2),
PB("Finger impulse direction:"),
P("d<b>I</b>rect → t<b>I</b>p of finger | <b>D</b>irect → pul<b>P</b> of finger", S_MNEM),
Spacer(1, 2),
PB("Relation to pubic tubercle (PT):"),
P("Inguinal hernia = <b>above & medial</b> to PT", S_MNEM),
P("Femoral hernia = <b>below & lateral</b> to PT", S_MNEM),
]
mem_right = [
PB("Ring Occlusion Test:"),
P("Blocking deep ring STOPS indirect (sac exits here)", S_MNEM),
P("Blocking deep ring FAILS to stop direct (sac exits medially)", S_MNEM),
Spacer(1, 2),
PB("Richter hernia warning:"),
P("NO bowel obstruction/vomiting despite strangulation → diagnosis easily missed!", S_MNEM),
Spacer(1, 2),
PB("Femoral = most dangerous groin hernia:"),
P("40% of femoral hernias present as emergencies. Always repair.", S_MNEM),
]
mnem_t = Table([[mem_left, mem_right]], colWidths=[HALF, HALF])
mnem_t.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), HexColor("#fffbeb")),
("VALIGN", (0,0), (-1,-1), "TOP"),
("LEFTPADDING", (0,0), (-1,-1), 6),
("RIGHTPADDING", (0,0), (-1,-1), 6),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING",(0,0), (-1,-1), 4),
("LINEBEFORE", (1,0), (1,-1), 0.5, HexColor("#fde68a")),
("BOX", (0,0), (-1,-1), 0.5, HexColor("#fde68a")),
]))
story.append(mnem_t)
story.append(Spacer(1, 2*mm))
# ══════════════════════════════════════════════════════════════════════════════
# FOOTER
# ══════════════════════════════════════════════════════════════════════════════
story.append(h_rule())
story.append(P(
"Sources: Gray's Anatomy for Students | Bailey & Love's Short Practice of Surgery 28e | "
"Schwartz's Principles of Surgery 11e | Tintinalli's Emergency Medicine | "
"Mulholland & Greenfield's Surgery 7e | S Das Manual on Clinical Surgery 13e | Fischer's Mastery of Surgery 8e",
S_SMALL
))
# ── BUILD ─────────────────────────────────────────────────────────────────────
doc.build(story)
print(f"PDF written to: {OUTPUT}")
cd /home/daytona/workspace/inguinal-hernia && python3 build_cheatsheet.py 2>&1
~/inguinal-hernia/build_cheatsheet.py
Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/inguinal-hernia/build_cheatsheet.py'
cd /home/daytona/workspace/inguinal-hernia && python3 build_cheatsheet.py 2>&1
ls -lh /home/daytona/workspace/inguinal-hernia/Inguinal_Hernia_Cheatsheet.pdf
Inguinal Hernia Cheatsheet
PDF Document · PDF
| Section | Content |
|---|---|
| 1. Epidemiology | Key stats - ratios, lifetime risk, bimodal age peaks |
| 2. Comparison table | Indirect vs Direct vs Femoral across 10 features |
| 3. Hesselbach's Triangle | Borders with structures |
| 4. Deep ring location | Anatomical landmarks |
| 5. Clinical Examination | Step-by-step invagination + ring occlusion test |
| 6. Complications ladder | Reducible → Irreducible → Incarcerated → Strangulated with actions |
| 7. Nyhus Classification | All types I–IV with descriptions |
| 8. Special hernia types | Sliding, Pantaloon, Richter, Maydl |
| 9. Differential diagnosis | 12-condition table with key distinguishing features |
| 10. Mnemonics & Pearls | High-yield memory aids for the exam |