/visulize Calots triangle And its borders with labels

Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Loading Image
Loading Image
Reading File
Loading Image
I now have all the information and images needed to provide a comprehensive, well-illustrated answer.

Calot's Triangle (Hepatocystic Triangle)


Original Description (Calot, 1891)

Calot originally described the triangle as bounded by:
BorderStructure
InferiorCystic duct
MedialCommon hepatic duct (CHD)
SuperiorCystic artery

Modern / Contemporary Definition (Hepatocystic Triangle)

The current surgical working definition is larger and more practical:
BorderStructure
Inferior / LateralCystic duct + medial wall of gallbladder
MedialCommon hepatic duct
SuperiorInferior surface of the liver (segment V)
The cystic artery now lies within (not forming the border of) this triangle - making it the primary target structure to identify safely.

Contents of Calot's Triangle

  • Cystic artery (branch of the right hepatic artery, typically)
  • Cystic lymph node (Lund's node / sentinel node) - lies superficial to the cystic artery and acts as a useful intraoperative landmark
  • Occasionally: an aberrant right hepatic artery or accessory ducts

Diagram 1 - Hepatocystic Triangle (normal anatomy, variant A = green shaded)

Calot's triangle variants - hepatocystic triangle shown in green (A)
Fig. 57.7 from Mulholland & Greenfield's Surgery, 7e - The modern Calot's (hepatocystic) triangle is highlighted in green in panel A. Panels B-F show cystic artery variations.

Diagram 2 - Gallbladder & Bile Duct Arterial Anatomy

Gallbladder and bile duct anatomy with labeled arterial tree
Fig. 71.1 from Bailey & Love's Surgery, 28e - Full arterial labeling: right/left hepatic arteries, cystic artery, right/left choledochal arteries, hepatic, retroduodenal, and gastroduodenal arteries.

Diagram 3 - Hepatocystic Triangle with Anatomical Variations

Hepatocystic triangle with variants: normal (a), caterpillar turn (b), tortuous right hepatic artery (c)
Fig. 71.2 from Bailey & Love's Surgery, 28e - (a) Normal hepatocystic triangle (white lines = triangle borders); (b) tortuous common hepatic artery; (c) tortuous right hepatic artery with short cystic artery - the "caterpillar turn" / Moynihan's hump.

Surgical Significance

  1. Critical View of Safety (CVS) - The triangle must be fully dissected during laparoscopic cholecystectomy so that only two structures (cystic duct + cystic artery) are seen entering the gallbladder before clipping.
  2. Biliary injury risk - The CBD lies below/dorsal to the triangle. The R4U line (Rouvière's sulcus → segment IV → umbilical fissure) is a safety reference: cystic duct and artery lie ventral to this line; CBD lies below it.
  3. Cystic artery variations - In 15% of cases the right hepatic artery or cystic artery crosses anterior to the CHD and cystic duct, increasing injury risk. Six recognized variants are shown in the first diagram above.

Sources: Mulholland & Greenfield's Surgery, 7e (§57); Bailey & Love's Short Practice of Surgery, 28e (§71); Maingot's Abdominal Operations.

/visulize Colitis

Asking for Preferences
Finding Sources
Finding Sources
Reading File
Finding Sources
Reading File
Loading Image
Reading File
Reading File
Loading Image
Finding Sources
Reading File
Loading Image
Reading File
Loading Image
I now have all four key images. I have everything I need to deliver a comprehensive, well-visualized comparison of the three types of colitis.

Colitis - Gross/Macroscopic Anatomy & Distribution


1. ULCERATIVE COLITIS (UC)

Distribution: Starts in the rectum, spreads continuously and proximally - never skips. Confined to the colon only.
FeatureUC
GI tract involvementColon + rectum only
PatternContinuous, no skip lesions
Wall depthMucosal & submucosal only (not transmural)
UlcersSuperficial, broad-based
Characteristic lesionPseudopolyps (regenerating mucosa bulging into lumen)
StricturesRare
FistulaeNo
Perianal diseaseNo
Extent subtypes (Montreal Classification):
  • Proctitis - rectum only
  • Left-sided colitis - up to splenic flexure
  • Pancolitis - entire colon

2. CROHN'S COLITIS

Distribution: Can involve any part of the GI tract from mouth to anus. Skip lesions are the hallmark - discontinuous inflamed segments with normal bowel between them. Terminal ileum is affected in ~70%.
FeatureCrohn's
GI tract involvementMouth to anus (esophagus to anus)
PatternSkip lesions
Wall depthTransmural (full thickness)
UlcersDeep, knife-like / "cobblestoning"
Characteristic lesionCreeping fat, strictures, fistulae
GranulomasYes (~35%)
Fistulae / sinusesYes
Perianal diseaseYes

Diagram 1 - Disease Distribution Comparison (Lippincott)

Crohn's disease vs Ulcerative Colitis - distribution patterns showing skip lesions vs continuous rectal involvement
Fig. 42.15 from Lippincott Illustrated Reviews: Pharmacology - (A) Crohn's disease with skip lesions involving terminal ileum and colon segments; (B) Ulcerative colitis beginning at rectum with continuous proximal spread.

Diagram 2 - Gross & Wall-Layer Distribution (Robbins Pathology)

Robbins: Crohn disease vs Ulcerative Colitis - macroscopic distribution and transmural vs mucosal cross-section comparison
Fig. 17.35 from Robbins, Cotran & Kumar Pathologic Basis of Disease - Left column = gross distribution map; Right column = cross-section of bowel wall showing depth of inflammation for each condition.
Key wall-layer takeaways from the diagram:
  • Crohn's (top): transmural inflammation + fissures + creeping fat + thickened wall
  • UC (bottom): mucosal/submucosal inflammation + pseudopolyps + broad-based ulcers, wall thickness normal

3. ISCHEMIC COLITIS

Distribution: Affects watershed zones - areas where two major arterial territories meet and collateral flow is weakest:
Watershed ZoneLocationEponym
#1 (most common)Splenic flexureGriffiths' point
#2Rectosigmoid junctionSudeck's point
#3 (embolic)Right colon (cecum/ascending)Terminal branch of SMA (ileocolic)
The rectum is usually spared - it has dual supply from both IMA and iliac circulations.
Collateral vessels:
  • Marginal artery of Drummond - runs parallel to colon, absent at splenic flexure in up to 18% of people
  • Arc of Riolan - connects SMA and IMA closer to the mesenteric root; its presence often signals a proximal major vessel obstruction

Diagram 3 - Ischemic Colitis Watershed Zones (Sabiston Surgery)

Ischemic colitis watershed zones - gray shaded areas show splenic flexure (Griffiths), right colon, and rectosigmoid (Sudeck's point) vulnerability
Fig. 95.54 from Sabiston Textbook of Surgery - Gray dashed regions = ischemia-vulnerable watershed areas: splenic flexure (top-right), right colon/cecum (bottom-left), and rectosigmoid (bottom-center). All major colic arteries labeled.

Diagram 4 - Arc of Riolan Collateral Anatomy (Sabiston Surgery)

Arc of Riolan connecting SMA and IMA with labeled middle colic and superior mesenteric arteries
Fig. 95.53 from Sabiston Textbook of Surgery - The Arc of Riolan (meandering mesenteric artery) bridges SMA and IMA territories; a prominent arc is a clue to proximal major vessel occlusion.

Side-by-Side Summary

FeatureUlcerative ColitisCrohn's ColitisIschemic Colitis
LocationColon onlyAny part of GI tractColon (watershed zones)
PatternContinuous from rectumSkip lesionsFocal (splenic flexure, rectosigmoid, right colon)
RectumAlways involvedOften sparedUsually spared
Wall depthMucosa/submucosaTransmuralVariable (mucosal → full thickness necrosis)
MechanismAutoimmuneAutoimmuneIschemia / hypoperfusion
FistulaeNoYesNo
Age predilection20-40 years15-30 yearsElderly (>60 years)
Sources: Robbins Pathologic Basis of Disease; Sabiston Textbook of Surgery, 21e; Lippincott Illustrated Reviews: Pharmacology; Goldman-Cecil Medicine, International Edition.

Colitis

Asking for Preferences
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Finding Sources
Reading File
Loading Image
Loading Image
Loading Image
I now have all the content and images needed. Here is the comprehensive overview:

Colitis - Overview & Types

Colitis is inflammation of the large intestine (colon). It is not a single disease - it is a pattern of injury that can result from autoimmune, ischemic, infectious, or idiopathic causes. The key to management is identifying the underlying type.

Major Types at a Glance

TypeCauseLocationKey Feature
Ulcerative ColitisAutoimmuneRectum → continuous proximal spreadMucosal only, bloody diarrhea
Crohn's ColitisAutoimmuneAny GI segment, skip lesionsTransmural, fistulae, strictures
Ischemic ColitisVascular / low flowWatershed zones (splenic flexure, rectosigmoid)Rectum spared, elderly
Infectious ColitisBacteria, parasites (C. diff, E. coli, Shigella)VariableAcute onset, often self-limiting
Microscopic ColitisIdiopathic / autoimmuneRight colon predominantNormal endoscopy, watery diarrhea

1. Ulcerative Colitis (UC)

  • Distribution: Starts always in the rectum, spreads continuously and proximally. Colon only - never involves the small bowel.
  • Extent subtypes (Montreal Classification): Proctitis (rectum only) → Left-sided (to splenic flexure) → Pancolitis (entire colon)
  • Wall involvement: Mucosa and submucosa only - NOT transmural
  • Gross features: Granular/erythematous mucosa, superficial broad-based ulcers, pseudopolyps (islands of regenerating mucosa), loss of haustral folds in chronic disease ("lead pipe" colon)
  • Hallmark symptom: Bloody diarrhea, urgency, tenesmus
  • Complications: Toxic megacolon, colorectal cancer (risk begins after 7-10 years; ~10% per decade), primary sclerosing cholangitis
  • Peak age: 20-40 years (second smaller peak after 60)

2. Crohn's Colitis (Crohn's Disease)

  • Distribution: Mouth to anus - any part of the GI tract. Skip lesions (discontinuous involvement) are the hallmark. Terminal ileum involved in ~70%.
  • Wall involvement: Transmural (full thickness) - this explains why fistulae and abscesses form
  • Gross features: Deep "knife-like" fissures and ulcers, cobblestone mucosa, creeping fat (fat wrapping around bowel wall), strictures, thickened wall
  • Hallmark symptom: Abdominal pain (RLQ), diarrhea (often non-bloody), weight loss, perianal disease
  • Complications: Fistulae (enteroenteric, enterovesical, enterocutaneous, perianal), abscesses, strictures/obstruction, malabsorption, gallstones, kidney stones
  • Peak age: 15-30 years (second peak in 7th decade)

Diagram 1 - Distribution Comparison: Crohn's vs UC

Crohn disease vs Ulcerative Colitis - intestinal distribution showing skip lesions (Crohn) vs continuous rectal spread (UC)
Fig. 42.15, Lippincott Illustrated Reviews: Pharmacology - (A) Crohn's: skip lesions throughout small and large bowel including terminal ileum. (B) UC: continuous involvement starting from rectum.

Diagram 2 - Wall Layer Depth (Crohn's vs UC Cross-Section)

Robbins: Crohn disease vs Ulcerative Colitis - gross distribution and bowel wall cross-section showing transmural vs mucosal inflammation
Fig. 17.35, Robbins Pathologic Basis of Disease - Left column: distribution map; Right column: cross-section of bowel wall. Crohn's (top) = transmural inflammation + fissures + creeping fat + thickened wall. UC (bottom) = mucosal/submucosal inflammation + pseudopolyps + broad-based ulcers.

3. Ischemic Colitis

  • Cause: Insufficient arterial blood supply - usually from low-flow states (heart failure, shock, sepsis), atherosclerosis, or iatrogenic (post-aortic surgery)
  • Distribution: Watershed zones - areas at the boundary between two major arterial territories:
    • Splenic flexure (Griffiths' point) - SMA/IMA border, most common
    • Rectosigmoid junction (Sudeck's point) - terminal IMA branches
    • Right colon/cecum - vulnerable to embolic SMA occlusion
    • Rectum is spared (dual supply from IMA + iliac vessels)
  • Presentation: Sudden lower abdominal pain, followed within 24 hours by bloody diarrhea; 3 phases - Hyperactive → Paralytic → Shock
  • Severity: Most cases are mild and self-limiting; 10-20% progress to gangrenous colitis requiring emergency colectomy
  • Peak age: Elderly (>60 years), more common in women

4. Infectious Colitis

  • Cause: Bacterial, viral, or parasitic pathogens invading or toxin-producing in the colon
  • Common organisms:
OrganismNotes
Clostridioides difficileMost common healthcare-associated colitis; antibiotic-associated; pseudomembranous pattern
Escherichia coli O157:H7Enterohemorrhagic; hemolytic-uremic syndrome risk
ShigellaDysentery; invasive mucosa
Campylobacter jejuniMost common infectious diarrhea worldwide
Entamoeba histolyticaAmebic colitis; "flask-shaped" ulcers
Cytomegalovirus (CMV)Immunocompromised patients
  • Presentation: Acute diarrhea (bloody or watery), cramping, fever; usually self-limiting but can mimic IBD or surgical abdomen
  • Key concern: C. difficile fulminant colitis can cause toxic megacolon and death; it is the most common cause of healthcare-associated diarrhea

5. Microscopic Colitis

  • Definition: Chronic watery, non-bloody diarrhea with a normal-appearing colon on endoscopy - diagnosed only by biopsy
  • Two subtypes:
    • Collagenous Colitis: Thickened subepithelial collagen band (>10 µm) - pathognomonic finding
    • Lymphocytic Colitis: Increased intraepithelial lymphocytes (>20 per 100 surface epithelial cells), no collagen thickening
  • Distribution: Right colon predominant; rectal sparing in ~8% of cases
  • Epidemiology: Middle-aged to elderly women (F:M ratio 3:1 to 9:1 for collagenous; slightly lower for lymphocytic); strong association with autoimmune diseases (rheumatoid arthritis, autoimmune thyroiditis, celiac disease); linked to NSAIDs, PPIs, SSRIs, statins
  • HLA association: Linked to HLA-DQ2 and HLA-DQ1,3, similar to celiac disease
  • Treatment: Budesonide (most effective), bismuth subsalicylate, cholestyramine; stop offending drugs

Diagram 3 - Microscopic Colitis Histology (Collagenous Colitis)

Microscopic colitis histology - collagenous colitis, rectum vs right colon biopsies showing thickened subepithelial collagen layer
Fig. 5.10, Clinical Gastrointestinal Endoscopy, 3e - Collagenous colitis. A & B: Rectum (low/high power) - minimal involvement. C & D: Right colon (low/high power) - stars mark the thickened subepithelial collagen layer, with increased lamina propria inflammation and surface epithelial detachment.

Distinguishing Features at a Glance

FeatureUCCrohn'sIschemicInfectiousMicroscopic
Bloody diarrheaYes (common)SometimesYes (acute)SometimesNo
Rectal involvementAlwaysOften sparedSparedVariableOften spared
Skip lesionsNoYesNoNoNo
TransmuralNoYesVariableNoNo
FistulaeNoYesNoNoNo
Normal endoscopyNoNoNoNoYes
Cancer riskYes (duration-dependent)Slightly elevatedNoNoNo
Age20-4015-30ElderlyAnyMiddle-aged women

Sources: Robbins Pathologic Basis of Disease; Sleisenger & Fordtran's GI & Liver Disease; Sabiston Textbook of Surgery, 21e; Lippincott Illustrated Reviews: Pharmacology; Goldman-Cecil Medicine; Clinical Gastrointestinal Endoscopy, 3e.

Create a diagnostic flowchart for colitis workup

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

mkdir -p /tmp/workspace/colitis-flowchart && ls /tmp/workspace/colitis-flowchart/

Writing File

~/colitis-flowchart/generate_flowchart.py

import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from matplotlib.patches import FancyBboxPatch, FancyArrowPatch
import matplotlib.patheffects as pe

fig, ax = plt.subplots(figsize=(22, 32))
ax.set_xlim(0, 22)
ax.set_ylim(0, 32)
ax.axis('off')
fig.patch.set_facecolor('#F7F9FC')

# ── Color palette ────────────────────────────────────────────────────────────
C = {
    'start':    '#1A237E',   # dark navy   – start/end
    'step':     '#1565C0',   # blue        – process step
    'decision': '#E65100',   # orange      – decision diamond
    'lab':      '#2E7D32',   # green       – labs / investigations
    'dx':       '#6A1B9A',   # purple      – final diagnosis boxes
    'tx':       '#00695C',   # teal        – treatment hint
    'arrow':    '#37474F',   # dark grey   – arrows
    'warn':     '#C62828',   # red         – red-flag / urgent
    'bg':       '#FFFFFF',
    'text_lt':  '#FFFFFF',
    'text_dk':  '#1A1A1A',
}

def box(ax, x, y, w, h, text, facecolor, textcolor='white', fontsize=9,
        bold=False, radius=0.4, style='round,pad=0.1', wrap=True):
    patch = FancyBboxPatch((x - w/2, y - h/2), w, h,
                           boxstyle=f"round,pad=0.15",
                           facecolor=facecolor, edgecolor='white',
                           linewidth=1.5, zorder=3)
    ax.add_patch(patch)
    weight = 'bold' if bold else 'normal'
    ax.text(x, y, text, ha='center', va='center', fontsize=fontsize,
            color=textcolor, fontweight=weight, wrap=True,
            multialignment='center', zorder=4,
            bbox=dict(boxstyle='square,pad=0', facecolor='none', edgecolor='none'))

def diamond(ax, x, y, w, h, text, facecolor=None, textcolor='white', fontsize=8.5):
    if facecolor is None:
        facecolor = C['decision']
    dx, dy = w/2, h/2
    pts = [(x, y+dy), (x+dx, y), (x, y-dy), (x-dx, y)]
    polygon = plt.Polygon(pts, closed=True, facecolor=facecolor,
                          edgecolor='white', linewidth=1.5, zorder=3)
    ax.add_patch(polygon)
    ax.text(x, y, text, ha='center', va='center', fontsize=fontsize,
            color=textcolor, fontweight='bold', multialignment='center', zorder=4)

def arrow(ax, x1, y1, x2, y2, label='', color=None):
    if color is None:
        color = C['arrow']
    ax.annotate('', xy=(x2, y2), xytext=(x1, y1),
                arrowprops=dict(arrowstyle='->', color=color,
                                lw=2.0, connectionstyle='arc3,rad=0.0'),
                zorder=2)
    if label:
        mx, my = (x1+x2)/2, (y1+y2)/2
        ax.text(mx+0.15, my, label, fontsize=7.5, color=color,
                fontweight='bold', va='center', zorder=5)

def harrow(ax, x1, y1, x2, y2, label='', color=None):
    """Horizontal-then-vertical arrow via a bend."""
    if color is None:
        color = C['arrow']
    ax.annotate('', xy=(x2, y2), xytext=(x1, y1),
                arrowprops=dict(arrowstyle='->', color=color, lw=1.8,
                                connectionstyle='angle,angleA=0,angleB=90,rad=6'),
                zorder=2)
    if label:
        ax.text((x1+x2)/2, (y1+y2)/2 + 0.15, label, fontsize=7.5, color=color,
                fontweight='bold', ha='center', zorder=5)

# ── Title ─────────────────────────────────────────────────────────────────────
ax.text(11, 31.3, 'COLITIS — DIAGNOSTIC WORKUP FLOWCHART',
        ha='center', va='center', fontsize=16, fontweight='bold',
        color=C['start'],
        bbox=dict(boxstyle='round,pad=0.4', facecolor='#E8EAF6', edgecolor=C['start'], lw=2))

# ══════════════════════════════════════════════════════════════════════════════
# ROW 1  –  Presentation
# ══════════════════════════════════════════════════════════════════════════════
Y1 = 29.5
box(ax, 11, Y1, 9, 0.9,
    'PATIENT PRESENTATION\nDiarrhea ± blood  |  Abdominal pain  |  Urgency / tenesmus',
    C['start'], fontsize=9, bold=True)

arrow(ax, 11, Y1-0.45, 11, Y1-1.15)

# ══════════════════════════════════════════════════════════════════════════════
# ROW 2  –  History & Exam
# ══════════════════════════════════════════════════════════════════════════════
Y2 = 27.9
box(ax, 11, Y2, 14, 1.1,
    'HISTORY & PHYSICAL EXAM\nOnset (acute vs chronic)  |  Blood in stool?  |  Recent antibiotics / NSAIDs / travel\n'
    'Wt loss, fever, fistulae, perianal disease  |  Family history IBD  |  Cardiovascular risk (ischemia)',
    C['step'], fontsize=8.5, bold=False)

arrow(ax, 11, Y2-0.55, 11, Y2-1.3)

# ══════════════════════════════════════════════════════════════════════════════
# ROW 3  –  First branch: Acute vs Chronic
# ══════════════════════════════════════════════════════════════════════════════
Y3 = 26.1
diamond(ax, 11, Y3, 5.5, 1.1,
        'Onset\nACUTE (<3 wks)  or  CHRONIC (>3 wks)?',
        fontsize=8.5)

# ── LEFT branch: ACUTE ────────────────────────────────────────────────────────
harrow(ax, 8.25, Y3, 4.5, Y3, label='ACUTE', color=C['warn'])

Y3L = 26.1
box(ax, 3.0, Y3L, 4.8, 1.2,
    'ACUTE COLITIS WORKUP\n① Stool MC&S (Salmonella, Shigella,\n'
    '   Campylobacter, E.coli O157, Yersinia)\n'
    '② C. difficile toxin PCR (EIA/GDH)\n'
    '③ Ova & Parasites (travel history)\n'
    '④ CBC, CRP, electrolytes, LFTs',
    C['lab'], fontsize=7.5)

arrow(ax, 3.0, Y3L-0.6, 3.0, Y3L-1.45)

Y3La = 24.3
diamond(ax, 3.0, Y3La, 4.2, 0.95,
        'Stool cultures / C. diff\nPOSITIVE?', fontsize=8)

arrow(ax, 3.0, Y3La-0.47, 3.0, Y3La-1.1, label='YES')

box(ax, 3.0, 22.8, 4.2, 0.85,
    '⚕ INFECTIOUS COLITIS\nTargeted antimicrobial / supportive Rx',
    C['dx'], fontsize=8, bold=True)

# "No" from acute → proceeds to chronic workup
harrow(ax, 5.1, Y3La, 8.0, Y3La-1.0, label='NO → proceed\nas chronic', color='#37474F')


# ── RIGHT branch: CHRONIC ─────────────────────────────────────────────────────
harrow(ax, 13.75, Y3, 17.5, Y3, label='CHRONIC', color=C['step'])

Y3R = 26.1
box(ax, 19.0, Y3R, 4.8, 1.2,
    '⚠ RED FLAGS → URGENT\n• Bloody diarrhea + fever + tachycardia\n'
    '• Toxic megacolon (distension, peritonism)\n'
    '• Haemodynamic instability\n→ Admit, IV fluids, urgent imaging',
    C['warn'], fontsize=7.5)

# ══════════════════════════════════════════════════════════════════════════════
# ROW 4  –  Initial Labs (chronic / after excluding infection)
# ══════════════════════════════════════════════════════════════════════════════
Y4 = 24.1
arrow(ax, 11, Y3-0.55, 11, Y4+0.55)   # centre arrow from diamond down

box(ax, 11, Y4, 14, 1.1,
    'INITIAL INVESTIGATIONS\n'
    'Bloods: CBC  |  CRP / ESR  |  CMP (albumin, LFTs, creatinine)  |  Iron studies  |  B12 / Folate  |  TFTs\n'
    'Stool: Fecal calprotectin  |  C. diff PCR  |  MC&S  |  Ova & Parasites',
    C['lab'], fontsize=8.5)

arrow(ax, 11, Y4-0.55, 11, Y4-1.3)

# ══════════════════════════════════════════════════════════════════════════════
# ROW 5  –  Fecal Calprotectin branch
# ══════════════════════════════════════════════════════════════════════════════
Y5 = 22.4
diamond(ax, 11, Y5, 6.0, 1.1,
        'Fecal Calprotectin\n< 50 µg/g  or  ≥ 50 µg/g?', fontsize=8.5)

# Low calprotectin → left
harrow(ax, 8.0, Y5, 4.5, Y5, label='< 50', color=C['tx'])
box(ax, 3.0, Y5, 4.0, 0.85,
    'IBD unlikely\nConsider IBS / functional disorder\nReview & reassess if symptoms persist',
    C['tx'], fontsize=7.5)

# High calprotectin → continue
arrow(ax, 11, Y5-0.55, 11, Y5-1.2, label='≥ 50', color=C['decision'])

# ══════════════════════════════════════════════════════════════════════════════
# ROW 6  –  Serology
# ══════════════════════════════════════════════════════════════════════════════
Y6 = 20.9
box(ax, 11, Y6, 13, 0.95,
    'SEROLOGY  (to help differentiate IBD subtypes)\n'
    'pANCA  (UC positive ~60-70%)  |  ASCA IgG/IgA  (Crohn positive ~50-60%)  |  Anti-OmpC  |  Anti-CBir1',
    C['lab'], fontsize=8.5)

arrow(ax, 11, Y6-0.47, 11, Y6-1.2)

# ══════════════════════════════════════════════════════════════════════════════
# ROW 7  –  Colonoscopy branch
# ══════════════════════════════════════════════════════════════════════════════
Y7 = 19.3
box(ax, 11, Y7, 13, 1.0,
    'COLONOSCOPY + ILEOSCOPY WITH BIOPSY  (gold standard)\n'
    'Note: extent & pattern of inflammation  |  mucosal appearance  |  multiple biopsies ≥6 sites',
    C['step'], fontsize=8.5, bold=True)

arrow(ax, 11, Y7-0.5, 11, Y7-1.25)

# ══════════════════════════════════════════════════════════════════════════════
# ROW 8  –  Endoscopic findings branch (3 columns)
# ══════════════════════════════════════════════════════════════════════════════
Y8 = 17.65
diamond(ax, 11, Y8, 9, 1.0,
        'ENDOSCOPIC + HISTOLOGICAL PATTERN?', fontsize=9)

# ── UC column ────────────────────────────────────────────────────────────────
XUC = 3.5
harrow(ax, 6.5, Y8, XUC+1.8, Y8, label='Continuous\nmucosal', color='#1565C0')

Y8a = 17.65
box(ax, XUC, Y8a-1.3, 5.2, 1.75,
    'ULCERATIVE COLITIS\n──────────────\n'
    '• Continuous from rectum\n'
    '• Erythema, granularity,\n  pseudopolyps\n'
    '• Mucosa / submucosa only\n'
    '• No fistulae or granulomas',
    '#1565C0', fontsize=8, bold=True)

# ── Crohn column ─────────────────────────────────────────────────────────────
XCD = 11
harrow(ax, 11, Y8-0.5, XCD, Y8-1.55, label='', color=C['step'])

box(ax, XCD, Y8-2.05, 5.2, 1.75,
    "CROHN'S DISEASE\n──────────────\n"
    '• Skip lesions, any GI segment\n'
    '• Deep fissures, cobblestoning\n'
    '• Transmural, creeping fat\n'
    '• Granulomas (~35%)',
    '#6A1B9A', fontsize=8, bold=True)

# ── Normal endoscopy column ──────────────────────────────────────────────────
XMC = 18.5
harrow(ax, 15.5, Y8, XMC-1.8, Y8, label='Normal\nappearance', color='#2E7D32')

box(ax, XMC, Y8a-1.3, 5.2, 1.75,
    'MICROSCOPIC COLITIS\n──────────────\n'
    '• Normal mucosa on endoscopy\n'
    '• Biopsy: collagen band >10µm\n  (collagenous) or IEL >20/100\n  (lymphocytic)\n'
    '• Watery non-bloody diarrhea',
    '#2E7D32', fontsize=8, bold=True)

# ══════════════════════════════════════════════════════════════════════════════
# ROW 9  –  Cannot distinguish UC vs Crohn → further imaging
# ══════════════════════════════════════════════════════════════════════════════
Y9 = 14.9
# Arrow from Crohn box down to "indeterminate / need small bowel imaging"
arrow(ax, XCD, Y8-2.93, XCD, Y9+0.55)

box(ax, XCD, Y9, 6.0, 1.0,
    'INDETERMINATE or NEED SMALL BOWEL EVAL?\n'
    '→ MR Enterography (preferred, no radiation)\n'
    '→ CT Enterography (widely available)\n'
    '→ Capsule Endoscopy (rule out stricture first)',
    C['lab'], fontsize=8)

# ══════════════════════════════════════════════════════════════════════════════
# ROW 10  –  Ischemic colitis pathway (side branch from history)
# ══════════════════════════════════════════════════════════════════════════════
# Draw as a side note from the clinical features step
Y10 = 20.0
box(ax, 19.5, Y10, 4.8, 2.2,
    'SUSPECT ISCHEMIC COLITIS\nif:\n'
    '• Elderly + CVD risk factors\n'
    '• Sudden pain → bloody diarrhea\n'
    '• Post-aortic surgery\n──────────────\n'
    '① CT Abdomen/Pelvis with contrast\n'
    '   (thumbprinting, wall thickening)\n'
    '② Flexible sigmoidoscopy / colonoscopy\n'
    '   (when stable, avoid air insufflation)\n'
    '③ Mesenteric angiography (if occlusive)',
    C['warn'], fontsize=7.5)

ax.text(16.8, 25.5, '▶ If ischaemic\n   pattern', fontsize=7.5, color=C['warn'],
        fontweight='bold', ha='center')
ax.annotate('', xy=(19.5, Y10+1.1), xytext=(17.3, Y2-0.6),
            arrowprops=dict(arrowstyle='->', color=C['warn'], lw=1.5,
                            connectionstyle='arc3,rad=0.2'), zorder=2)

# ══════════════════════════════════════════════════════════════════════════════
# ROW 11  –  Final Diagnosis summary bar
# ══════════════════════════════════════════════════════════════════════════════
Y11 = 13.3
box(ax, 11, Y11, 20, 0.75,
    'FINAL DIAGNOSIS  →  Classify, Stage Severity, and Plan Management',
    C['start'], fontsize=10, bold=True)

# 5 diagnosis boxes
DX_Y = 11.9
dx_labels = [
    ('ULCERATIVE\nCOLITIS', '#1565C0'),
    ("CROHN'S\nDISEASE", '#6A1B9A'),
    ('ISCHEMIC\nCOLITIS', '#C62828'),
    ('INFECTIOUS\nCOLITIS', '#2E7D32'),
    ('MICROSCOPIC\nCOLITIS', '#00695C'),
]
dx_x = [2.3, 6.3, 11, 15.7, 19.7]
for (lbl, col), x in zip(dx_labels, dx_x):
    box(ax, x, DX_Y, 3.4, 0.95, lbl, col, fontsize=8.5, bold=True)
    ax.annotate('', xy=(x, DX_Y+0.47), xytext=(11, Y11-0.37),
                arrowprops=dict(arrowstyle='->', color=col, lw=1.2,
                                connectionstyle='arc3,rad=0.0'), zorder=1)

# ══════════════════════════════════════════════════════════════════════════════
# ROW 12  –  Treatment summary per type
# ══════════════════════════════════════════════════════════════════════════════
TX_Y = 10.4
tx_data = [
    ('5-ASA (mild-mod)\nCorticosteroids (acute)\nAzathioprine/6-MP\nBiologics (anti-TNF,\nvedolizumab, ustekinumab)\nSurgery: proctocolectomy', '#BBDEFB', '#0D47A1'),
    ('Corticosteroids\nAzathioprine / MTX\nBiologics (anti-TNF,\nvedolizumab, ustekinumab)\nSurgery: bowel resection\n(not curative)', '#E1BEE7', '#4A148C'),
    ('Conservative (mild):\nIV fluids, bowel rest, O2\nSurgery (severe):\ncolectomy for gangrene\nor perforation', '#FFCDD2', '#B71C1C'),
    ('C. diff: oral vancomycin\nor fidaxomicin\nBacterial: supportive\n± targeted antibiotics\nSevere/recurrent C.diff:\nFMT', '#C8E6C9', '#1B5E20'),
    ('Stop offending drugs\n(NSAIDs, PPIs, SSRIs)\nBudesonide (first line)\nBismuth subsalicylate\nCholestyramine', '#B2DFDB', '#004D40'),
]
tx_x = [2.3, 6.3, 11, 15.7, 19.7]
for (tx, bg, tc), x in zip(tx_data, tx_x):
    box(ax, x, TX_Y, 3.7, 1.9, tx, bg, textcolor=tc, fontsize=7, bold=False)
    arrow(ax, x, DX_Y-0.47, x, TX_Y+0.95)

# Treatment header labels
for lbl, x in zip(['UC Rx', "CD Rx", 'Ischaemic Rx', 'Infectious Rx', 'Microscopic Rx'], tx_x):
    ax.text(x, TX_Y+1.1, lbl, ha='center', va='bottom', fontsize=7.5,
            color='#37474F', fontweight='bold')

# ══════════════════════════════════════════════════════════════════════════════
# LEGEND
# ══════════════════════════════════════════════════════════════════════════════
legend_y = 8.8
ax.text(1.0, legend_y, 'LEGEND:', fontsize=8, fontweight='bold', color='#37474F')
legend_items = [
    (C['start'],    'Start / End / Final step'),
    (C['step'],     'Process / Action'),
    (C['decision'], 'Decision point'),
    (C['lab'],      'Investigations / Labs'),
    (C['dx'],       'Diagnosis'),
    (C['warn'],     'Urgent / Red flag'),
    (C['tx'],       'Treatment / Management'),
]
for i, (col, lbl) in enumerate(legend_items):
    xi = 1.0 + i * 2.95
    p = FancyBboxPatch((xi-0.3, legend_y-0.55), 0.6, 0.4,
                       boxstyle='round,pad=0.05', facecolor=col,
                       edgecolor='white', lw=1)
    ax.add_patch(p)
    ax.text(xi+0.45, legend_y-0.38, lbl, va='center', fontsize=7, color='#37474F')

# ══════════════════════════════════════════════════════════════════════════════
# Footer
# ══════════════════════════════════════════════════════════════════════════════
ax.text(11, 7.9,
        'Sources: Symptom to Diagnosis (4e)  •  Sabiston Textbook of Surgery (21e)  •  '
        'Sleisenger & Fordtran\'s GI & Liver Disease  •  Robbins Pathologic Basis of Disease',
        ha='center', va='center', fontsize=7, color='#78909C', style='italic')

plt.tight_layout(pad=0.5)
plt.savefig('/tmp/workspace/colitis-flowchart/colitis_diagnostic_flowchart.png',
            dpi=180, bbox_inches='tight', facecolor=fig.get_facecolor())
plt.close()
print("Saved successfully.")
Running Command

cd /tmp/workspace/colitis-flowchart && python generate_flowchart.py 2>&1

Running Command

ls -lh /tmp/workspace/colitis-flowchart/colitis_diagnostic_flowchart.png

Loading Image
Reading File
Your diagnostic flowchart is ready:

colitis diagnostic flowchart

Image · PNG


Here is what the flowchart covers, top to bottom:
1. Presentation - Diarrhea ± blood, abdominal pain, urgency/tenesmus
2. History & Physical - Onset duration, blood in stool, recent antibiotics/NSAIDs/travel, weight loss, cardiovascular risk factors, family history of IBD
3. First branch - Acute vs Chronic
  • Acute path (left): Stool MC&S + C. difficile PCR → if positive = Infectious Colitis + treat; if negative = proceed as chronic
  • Chronic path (right): Red flags sidebar (toxic megacolon, haemodynamic instability → urgent admission)
4. Initial Labs - CBC, CRP/ESR, albumin, LFTs, B12/folate, TFTs; plus fecal calprotectin, C. diff PCR, stool MC&S, ova & parasites
5. Fecal Calprotectin gate - <50 µg/g = IBD unlikely → IBS/functional; ≥50 µg/g → continue IBD workup
6. Serology - pANCA (UC ~60-70%), ASCA IgG/IgA (Crohn ~50-60%), Anti-OmpC, Anti-CBir1
7. Colonoscopy + Ileoscopy with Biopsy (gold standard) - pattern, extent, ≥6 biopsy sites
8. Endoscopic/Histological branch - Three outcomes:
  • Continuous mucosal → Ulcerative Colitis
  • Skip lesions / transmural → Crohn's Disease
  • Normal endoscopy → Microscopic Colitis (biopsy only)
9. Indeterminate/Small bowel evaluation - MR Enterography (preferred) / CT Enterography / Capsule Endoscopy
10. Ischemic Colitis sidebar - For elderly patients with cardiovascular risk: CT abdomen/pelvis, flexible sigmoidoscopy, mesenteric angiography if occlusive
11-12. Final Diagnosis + Treatment summary - All 5 types with specific management per type (5-ASA, biologics, budesonide, vancomycin/fidaxomicin, surgery thresholds, etc.)
Sources: Symptom to Diagnosis 4e; Sabiston Textbook of Surgery 21e; Sleisenger & Fordtran's GI & Liver Disease; Robbins Pathologic Basis of Disease.
This is a shared conversation. Sign in to Orris to start your own chat.