Make ppt on Inflammmatory Bowel syndrome
mkdir -p /tmp/workspace/ibd-ppt && ls /tmp/workspace/
~/ibd-ppt/create_ibd_ppt.py
from pptx import Presentation
from pptx.util import Inches, Pt, Emu
from pptx.dml.color import RGBColor
from pptx.enum.text import PP_ALIGN, MSO_ANCHOR
from io import BytesIO
# ── Colour palette ──────────────────────────────────────────────────────────
DARK_BLUE = RGBColor(0x1A, 0x37, 0x6C) # navy
MID_BLUE = RGBColor(0x1E, 0x6A, 0xA5) # medium blue
ACCENT_TEAL = RGBColor(0x00, 0x8B, 0x8B) # teal
LIGHT_BG = RGBColor(0xF0, 0xF6, 0xFF) # very light blue-white
WHITE = RGBColor(0xFF, 0xFF, 0xFF)
LIGHT_GREY = RGBColor(0xE8, 0xEE, 0xF6)
DARK_TEXT = RGBColor(0x1A, 0x1A, 0x2E)
ACCENT_RED = RGBColor(0xC0, 0x39, 0x2B)
ACCENT_GREEN= RGBColor(0x1A, 0x7A, 0x4A)
ORANGE = RGBColor(0xE6, 0x7E, 0x22)
def add_rect(slide, x, y, w, h, fill=None, line_color=None, line_width=None):
shape = slide.shapes.add_shape(1, Inches(x), Inches(y), Inches(w), Inches(h))
shape.line.fill.background()
if fill:
shape.fill.solid()
shape.fill.fore_color.rgb = fill
else:
shape.fill.background()
if line_color:
shape.line.color.rgb = line_color
shape.line.width = Pt(line_width or 1)
else:
shape.line.fill.background()
return shape
def add_textbox(slide, x, y, w, h, text, font_size=12, bold=False, color=DARK_TEXT,
align=PP_ALIGN.LEFT, italic=False, wrap=True):
tb = slide.shapes.add_textbox(Inches(x), Inches(y), Inches(w), Inches(h))
tf = tb.text_frame
tf.word_wrap = wrap
tf.margin_left = Pt(2)
tf.margin_right = Pt(2)
tf.margin_top = Pt(2)
tf.margin_bottom = Pt(2)
p = tf.paragraphs[0]
p.alignment = align
run = p.add_run()
run.text = text
run.font.size = Pt(font_size)
run.font.bold = bold
run.font.italic = italic
run.font.color.rgb = color
run.font.name = "Calibri"
return tb
def add_multiline_textbox(slide, x, y, w, h, lines, font_size=11, bold=False,
color=DARK_TEXT, align=PP_ALIGN.LEFT, line_spacing=None):
tb = slide.shapes.add_textbox(Inches(x), Inches(y), Inches(w), Inches(h))
tf = tb.text_frame
tf.word_wrap = True
tf.margin_left = Pt(4)
tf.margin_right = Pt(4)
tf.margin_top = Pt(2)
tf.margin_bottom = Pt(2)
for i, line in enumerate(lines):
if i == 0:
p = tf.paragraphs[0]
else:
p = tf.add_paragraph()
p.alignment = align
if line_spacing:
p.line_spacing = Pt(line_spacing)
run = p.add_run()
if isinstance(line, dict):
run.text = line['text']
run.font.size = Pt(line.get('size', font_size))
run.font.bold = line.get('bold', bold)
run.font.color.rgb = line.get('color', color)
run.font.italic = line.get('italic', False)
else:
run.text = line
run.font.size = Pt(font_size)
run.font.bold = bold
run.font.color.rgb = color
run.font.name = "Calibri"
return tb
def add_header_bar(slide, title, subtitle=None):
"""Add gradient-style header bar to slide"""
add_rect(slide, 0, 0, 13.333, 1.4, fill=DARK_BLUE)
add_rect(slide, 0, 1.4, 13.333, 0.06, fill=ACCENT_TEAL)
add_textbox(slide, 0.3, 0.1, 12.7, 0.85, title,
font_size=28, bold=True, color=WHITE, align=PP_ALIGN.LEFT)
if subtitle:
add_textbox(slide, 0.3, 0.9, 12.7, 0.5, subtitle,
font_size=13, bold=False, color=LIGHT_BG, italic=True)
def add_slide_number(slide, num):
add_textbox(slide, 12.5, 7.2, 0.8, 0.3, str(num),
font_size=9, color=RGBColor(0xAA, 0xAA, 0xAA), align=PP_ALIGN.RIGHT)
def add_footer(slide, text="Inflammatory Bowel Disease | Medical Education"):
add_rect(slide, 0, 7.3, 13.333, 0.2, fill=DARK_BLUE)
add_textbox(slide, 0.3, 7.3, 10, 0.2, text,
font_size=7, color=LIGHT_BG, align=PP_ALIGN.LEFT)
def bullet_lines(items, indent=" • "):
return [f"{indent}{item}" for item in items]
# ─────────────────────────────────────────────────────────────────────────────
prs = Presentation()
prs.slide_width = Inches(13.333)
prs.slide_height = Inches(7.5)
blank = prs.slide_layouts[6]
# ══════════════════════════════════════════════════════════════════════════════
# SLIDE 1 — TITLE SLIDE
# ══════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
add_rect(s, 0, 0, 13.333, 7.5, fill=DARK_BLUE)
add_rect(s, 0, 5.8, 13.333, 1.7, fill=MID_BLUE)
add_rect(s, 0, 3.3, 13.333, 0.08, fill=ACCENT_TEAL)
# decorative circles
for cx, cy, cw in [(11.5,0.5,2.5),(10.2,5.5,1.8),(1.0,6.5,1.2)]:
c = s.shapes.add_shape(9, Inches(cx), Inches(cy), Inches(cw), Inches(cw))
c.fill.solid(); c.fill.fore_color.rgb = MID_BLUE
c.line.fill.background()
add_textbox(s, 1.0, 1.2, 11.0, 0.8, "INFLAMMATORY BOWEL DISEASE",
font_size=13, bold=True, color=ACCENT_TEAL, align=PP_ALIGN.CENTER)
add_textbox(s, 0.8, 1.9, 11.5, 1.3,
"A Comprehensive Clinical Overview",
font_size=38, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
add_textbox(s, 1.0, 3.05, 11.0, 0.5,
"Crohn's Disease • Ulcerative Colitis • Indeterminate Colitis",
font_size=16, bold=False, color=LIGHT_BG, align=PP_ALIGN.CENTER, italic=True)
add_textbox(s, 1.0, 5.9, 11.0, 0.5,
"Based on Sleisenger & Fordtran's GI & Liver Disease | Goldman-Cecil Medicine | Harrison's Principles",
font_size=10, bold=False, color=LIGHT_BG, align=PP_ALIGN.CENTER)
add_textbox(s, 1.0, 6.4, 11.0, 0.5,
"July 2026",
font_size=12, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
# ══════════════════════════════════════════════════════════════════════════════
# SLIDE 2 — TABLE OF CONTENTS
# ══════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
add_rect(s, 0, 0, 13.333, 7.5, fill=LIGHT_BG)
add_header_bar(s, "Table of Contents")
add_footer(s); add_slide_number(s, 2)
toc_items = [
("01", "Definition & Overview"),
("02", "Epidemiology & Risk Factors"),
("03", "Pathophysiology & Immunology"),
("04", "Types of IBD: Crohn's vs UC"),
("05", "Clinical Manifestations"),
("06", "Extraintestinal Manifestations"),
("07", "Diagnosis & Investigations"),
("08", "Endoscopic & Histological Features"),
("09", "Disease Activity Scoring"),
("10", "Medical Management"),
("11", "Biologic & Targeted Therapies"),
("12", "Surgical Management"),
("13", "Complications"),
("14", "IBD & Colorectal Cancer"),
("15", "Special Populations"),
("16", "Monitoring & Follow-up"),
("17", "Emerging Therapies"),
("18", "Key Takeaways"),
]
cols = [toc_items[:9], toc_items[9:]]
for col_i, col in enumerate(cols):
x_base = 0.5 + col_i * 6.5
for row_i, (num, title) in enumerate(col):
y = 1.6 + row_i * 0.56
add_rect(s, x_base, y, 0.55, 0.38, fill=MID_BLUE)
add_textbox(s, x_base, y, 0.55, 0.38, num,
font_size=9, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
add_textbox(s, x_base + 0.6, y, 5.6, 0.38, title,
font_size=12, bold=False, color=DARK_TEXT)
# ══════════════════════════════════════════════════════════════════════════════
# SLIDE 3 — DEFINITION & OVERVIEW
# ══════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
add_rect(s, 0, 0, 13.333, 7.5, fill=LIGHT_BG)
add_header_bar(s, "Definition & Overview", "What is Inflammatory Bowel Disease?")
add_footer(s); add_slide_number(s, 3)
add_rect(s, 0.4, 1.6, 8.2, 5.5, fill=WHITE, line_color=RGBColor(0xCC,0xDD,0xEE), line_width=1)
add_multiline_textbox(s, 0.5, 1.65, 8.0, 5.3, [
{"text":"DEFINITION", "size":13, "bold":True, "color":DARK_BLUE},
{"text":" "},
{"text":"IBD is a chronic, relapsing and remitting inflammatory disease of the gastrointestinal tract characterised by an inappropriate immune response to gut microbiota in genetically susceptible individuals.", "size":12},
{"text":" "},
{"text":"KEY FEATURES", "size":13, "bold":True, "color":DARK_BLUE},
{"text":" • Chronic inflammation — can last years to decades"},
{"text":" • Relapsing-remitting course — flares interspersed with remissions"},
{"text":" • Two main entities: Crohn's Disease (CD) and Ulcerative Colitis (UC)"},
{"text":" • 'Indeterminate colitis' when features overlap (~10% of cases)"},
{"text":" • Not the same as Irritable Bowel Syndrome (IBS) — IBD has structural inflammation"},
{"text":" "},
{"text":"SCOPE", "size":13, "bold":True, "color":DARK_BLUE},
{"text":" • Affects both the GI tract and multiple organ systems"},
{"text":" • Significant morbidity, reduced quality of life, risk of cancer"},
], font_size=12, color=DARK_TEXT, line_spacing=16)
add_rect(s, 9.0, 1.6, 4.0, 2.4, fill=DARK_BLUE)
add_multiline_textbox(s, 9.1, 1.65, 3.8, 2.3, [
{"text":"IBD vs IBS", "size":14, "bold":True, "color":WHITE},
{"text":" "},
{"text":"IBD: Organic inflammation, endoscopically visible, biomarkers elevated", "color":LIGHT_BG, "size":11},
{"text":" "},
{"text":"IBS: Functional disorder, no structural change, normal investigations", "color":LIGHT_BG, "size":11},
], color=WHITE)
add_rect(s, 9.0, 4.15, 4.0, 2.95, fill=MID_BLUE)
add_multiline_textbox(s, 9.1, 4.2, 3.8, 2.85, [
{"text":"Incidence", "size":14, "bold":True, "color":WHITE},
{"text":" "},
{"text":"CD: 3–20 per 100,000/yr (Western)", "color":LIGHT_BG, "size":11},
{"text":"UC: 2–25 per 100,000/yr (Western)", "color":LIGHT_BG, "size":11},
{"text":" "},
{"text":"Rising incidence globally, including Asia, Africa, South America", "color":LIGHT_BG, "size":11},
{"text":" "},
{"text":"Peak onset: 15–35 yrs (bimodal distribution)", "color":LIGHT_BG, "size":11},
], color=WHITE)
# ══════════════════════════════════════════════════════════════════════════════
# SLIDE 4 — EPIDEMIOLOGY & RISK FACTORS
# ══════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
add_rect(s, 0, 0, 13.333, 7.5, fill=LIGHT_BG)
add_header_bar(s, "Epidemiology & Risk Factors")
add_footer(s); add_slide_number(s, 4)
add_rect(s, 0.4, 1.6, 6.0, 5.5, fill=WHITE, line_color=RGBColor(0xCC,0xDD,0xEE), line_width=1)
add_multiline_textbox(s, 0.55, 1.65, 5.8, 5.3, [
{"text":"EPIDEMIOLOGICAL FACTS", "size":13, "bold":True, "color":DARK_BLUE},
{"text":" "},
{"text":" • Crohn's Disease (CD): F:M ratio = 1.2:1", "size":11},
{"text":" • Ulcerative Colitis (UC): Equal sex distribution (1:1)", "size":11},
{"text":" • Bimodal age peaks: 15–30 yrs and 50–70 yrs", "size":11},
{"text":" • Highest prevalence in North America & Northern Europe", "size":11},
{"text":" • Incidence increasing in newly industrialised countries (Asia, Middle East)", "size":11},
{"text":" • Jews of Ashkenazi descent: 3–5× higher risk vs general population", "size":11},
{"text":" "},
{"text":"GENETIC RISK FACTORS", "size":13, "bold":True, "color":DARK_BLUE},
{"text":" "},
{"text":" • NOD2/CARD15 mutations — most replicated CD gene", "size":11},
{"text":" • HLA-B27 — ankylosing spondylitis overlap", "size":11},
{"text":" • >240 susceptibility loci identified via GWAS", "size":11},
{"text":" • First-degree relatives: 5–20× increased risk", "size":11},
{"text":" • Concordance: 50–60% in identical twins (CD)", "size":11},
], font_size=11, color=DARK_TEXT, line_spacing=16)
add_rect(s, 6.7, 1.6, 6.3, 5.5, fill=WHITE, line_color=RGBColor(0xCC,0xDD,0xEE), line_width=1)
env_factors = [
("ENVIRONMENTAL TRIGGERS", None, DARK_BLUE, True, 13),
(" ", None, DARK_TEXT, False, 8),
(" Smoking", None, DARK_TEXT, True, 12),
(" • Increases CD risk; protective in UC", None, DARK_TEXT, False, 11),
(" ", None, DARK_TEXT, False, 8),
(" Diet & Microbiome", None, DARK_TEXT, True, 12),
(" • Western diet (high fat, low fibre) increases risk", None, DARK_TEXT, False, 11),
(" • Gut dysbiosis — reduced Firmicutes, increased Proteobacteria", None, DARK_TEXT, False, 11),
(" ", None, DARK_TEXT, False, 8),
(" Hygiene Hypothesis", None, DARK_TEXT, True, 12),
(" • Reduced childhood infections → aberrant immune maturation", None, DARK_TEXT, False, 11),
(" ", None, DARK_TEXT, False, 8),
(" Other Factors", None, DARK_TEXT, True, 12),
(" • NSAIDs may precipitate flares", None, DARK_TEXT, False, 11),
(" • Oral contraceptives: modest increased CD risk", None, DARK_TEXT, False, 11),
(" • Appendectomy: protective in UC, risk factor in CD", None, DARK_TEXT, False, 11),
(" • Stress — can trigger relapse", None, DARK_TEXT, False, 11),
]
lines = []
for item in env_factors:
lines.append({"text": item[0], "color": item[2], "bold": item[3], "size": item[4]})
add_multiline_textbox(s, 6.85, 1.65, 6.1, 5.3, lines, font_size=11, color=DARK_TEXT, line_spacing=15)
# ══════════════════════════════════════════════════════════════════════════════
# SLIDE 5 — PATHOPHYSIOLOGY
# ══════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
add_rect(s, 0, 0, 13.333, 7.5, fill=LIGHT_BG)
add_header_bar(s, "Pathophysiology & Immunology", "The interplay of genetics, microbiome, immune dysregulation, and environment")
add_footer(s); add_slide_number(s, 5)
# 3 boxes
boxes = [
(0.3, "GENETIC SUSCEPTIBILITY", [
"• NOD2/CARD15 — bacterial recognition defect",
"• ATG16L1 — impaired autophagy",
"• IL23R variants — Th17 pathway dysregulation",
"• IRGM — mitophagy and bacterial clearance",
"• Epithelial barrier gene defects",
], MID_BLUE),
(4.6, "IMMUNE DYSREGULATION", [
"• Th1 dominance in Crohn's (TNF-α, IFN-γ, IL-12)",
"• Th2 dominance in UC (IL-4, IL-5, IL-13)",
"• Th17 pathway (IL-17, IL-23) — amplifies both",
"• Deficient regulatory T-cell (Treg) response",
"• Activated macrophages release pro-inflammatory cytokines",
"• Loss of mucosal tolerance to commensal bacteria",
], ACCENT_TEAL),
(8.9, "GUT MICROBIOME", [
"• Dysbiosis: disrupted microbial diversity",
"• Reduced Firmicutes (Faecalibacterium prausnitzii)",
"• Increased E. coli, Fusobacterium",
"• Impaired short-chain fatty acid production",
"• Enteroadherent-invasive E. coli (AIEC) in CD",
"• Leaky gut → bacterial translocation",
], DARK_BLUE),
]
for (x_pos, title, points, col) in boxes:
add_rect(s, x_pos, 1.7, 4.0, 5.4, fill=col)
add_textbox(s, x_pos+0.1, 1.75, 3.8, 0.45, title, font_size=11, bold=True, color=WHITE)
add_rect(s, x_pos, 2.2, 4.0, 4.9, fill=WHITE)
add_multiline_textbox(s, x_pos+0.1, 2.25, 3.8, 4.8,
[{"text": p, "size":11, "color":DARK_TEXT} for p in points],
font_size=11, line_spacing=18)
# Arrow label
add_textbox(s, 0.3, 7.1, 12.7, 0.3,
"Genetic susceptibility + microbial dysbiosis + aberrant immune activation → uncontrolled mucosal inflammation → tissue destruction",
font_size=9, italic=True, color=DARK_BLUE, align=PP_ALIGN.CENTER)
# ══════════════════════════════════════════════════════════════════════════════
# SLIDE 6 — CD vs UC COMPARISON
# ══════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
add_rect(s, 0, 0, 13.333, 7.5, fill=LIGHT_BG)
add_header_bar(s, "Crohn's Disease vs Ulcerative Colitis", "Key distinguishing features")
add_footer(s); add_slide_number(s, 6)
# Table header
add_rect(s, 0.3, 1.7, 4.5, 0.45, fill=LIGHT_GREY)
add_rect(s, 4.8, 1.7, 4.0, 0.45, fill=MID_BLUE)
add_rect(s, 8.85, 1.7, 4.1, 0.45, fill=ACCENT_TEAL)
add_textbox(s, 0.3, 1.7, 4.5, 0.45, "CHARACTERISTIC", font_size=11, bold=True, color=DARK_BLUE, align=PP_ALIGN.CENTER)
add_textbox(s, 4.8, 1.7, 4.0, 0.45, "CROHN'S DISEASE", font_size=11, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
add_textbox(s, 8.85, 1.7, 4.1, 0.45, "ULCERATIVE COLITIS", font_size=11, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
rows = [
("GI Tract Involvement", "Esophagus to anus (any segment)", "Colon and rectum only"),
("Distribution", "Skip lesions (patchy)", "Continuous from rectum"),
("Inflammation Depth", "Transmural (full thickness)", "Mucosal / submucosal only"),
("Ulcer Type", "Discrete, deep, linear", "Superficial, continuous"),
("Fistulas", "Common (+)", "Rare (–)"),
("Strictures", "Common (+)", "Rare (–)"),
("Perianal Disease", "Common (+)", "Very rare"),
("Granulomas", "Non-caseating (~50%)", "Absent"),
("Smoking Effect", "Worsens disease", "Protective (paradoxically)"),
("CRC Risk", "4–20× general population", "Begins after 7–10 yrs disease"),
("Surgery Outcome", "Not curative", "Proctocolectomy is curative"),
]
for i, (char, cd, uc) in enumerate(rows):
y = 2.2 + i * 0.44
bg = WHITE if i % 2 == 0 else LIGHT_GREY
add_rect(s, 0.3, y, 4.5, 0.44, fill=bg)
add_rect(s, 4.8, y, 4.0, 0.44, fill=RGBColor(0xE8, 0xF4, 0xFF) if i%2==0 else WHITE)
add_rect(s, 8.85, y, 4.1, 0.44, fill=RGBColor(0xE0, 0xF5, 0xF5) if i%2==0 else WHITE)
add_textbox(s, 0.35, y+0.04, 4.4, 0.38, char, font_size=10, bold=True, color=DARK_TEXT)
add_textbox(s, 4.85, y+0.04, 3.9, 0.38, cd, font_size=10, color=DARK_TEXT)
add_textbox(s, 8.9, y+0.04, 4.0, 0.38, uc, font_size=10, color=DARK_TEXT)
# ══════════════════════════════════════════════════════════════════════════════
# SLIDE 7 — CLINICAL MANIFESTATIONS
# ══════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
add_rect(s, 0, 0, 13.333, 7.5, fill=LIGHT_BG)
add_header_bar(s, "Clinical Manifestations")
add_footer(s); add_slide_number(s, 7)
add_rect(s, 0.3, 1.7, 6.1, 5.5, fill=MID_BLUE)
add_textbox(s, 0.4, 1.75, 5.9, 0.45, "CROHN'S DISEASE", font_size=14, bold=True, color=WHITE)
add_rect(s, 0.3, 2.2, 6.1, 5.0, fill=WHITE)
add_multiline_textbox(s, 0.45, 2.25, 5.9, 4.9, [
{"text":"Terminal ileum affected in ~70% of patients", "size":11, "bold":True, "color":MID_BLUE},
{"text":" • Ileocolonic disease (40%), ileal only (30%)", "size":11},
{"text":" "},
{"text":"Common Symptoms:", "size":11, "bold":True, "color":DARK_BLUE},
{"text":" • Abdominal pain (RLQ — mimics appendicitis)", "size":11},
{"text":" • Diarrhea (often non-bloody)", "size":11},
{"text":" • Hematochezia (less frequent than UC)", "size":11},
{"text":" • Fatigue, weight loss, fever", "size":11},
{"text":" • Nausea/vomiting (obstructive symptoms)", "size":11},
{"text":" "},
{"text":"Less Common:", "size":11, "bold":True, "color":DARK_BLUE},
{"text":" • Upper GI involvement (<5%): dysphagia, epigastric pain", "size":11},
{"text":" • Perianal fistulas, fissures, skin tags", "size":11},
{"text":" • Oral aphthous ulcers", "size":11},
{"text":" • Abdominal mass (RLQ) in fibrostenotic disease", "size":11},
], font_size=11, color=DARK_TEXT, line_spacing=15)
add_rect(s, 6.9, 1.7, 6.1, 5.5, fill=ACCENT_TEAL)
add_textbox(s, 7.0, 1.75, 5.9, 0.45, "ULCERATIVE COLITIS", font_size=14, bold=True, color=WHITE)
add_rect(s, 6.9, 2.2, 6.1, 5.0, fill=WHITE)
add_multiline_textbox(s, 7.05, 2.25, 5.9, 4.9, [
{"text":"Starts in rectum; extends proximally", "size":11, "bold":True, "color":ACCENT_TEAL},
{"text":" • Proctosigmoiditis (44–49%), pancolitis (14–37%)", "size":11},
{"text":" "},
{"text":"Cardinal Symptoms:", "size":11, "bold":True, "color":DARK_BLUE},
{"text":" • Bloody diarrhea ± mucus (hallmark)", "size":11},
{"text":" • Tenesmus (urge to defecate)", "size":11},
{"text":" • Urgency, crampy abdominal pain", "size":11},
{"text":" • Hematochezia", "size":11},
{"text":" "},
{"text":"Severe Disease:", "size":11, "bold":True, "color":DARK_BLUE},
{"text":" • Weight loss, fever (>37.5°C)", "size":11},
{"text":" • Nausea/vomiting, peripheral edema (hypoalbuminaemia)", "size":11},
{"text":" • Anaemia (fatigue, pallor)", "size":11},
{"text":" "},
{"text":"Proctitis presentation:", "size":11, "bold":True, "color":DARK_BLUE},
{"text":" • Constipation despite rectal urgency", "size":11},
], font_size=11, color=DARK_TEXT, line_spacing=15)
# ══════════════════════════════════════════════════════════════════════════════
# SLIDE 8 — EXTRAINTESTINAL MANIFESTATIONS
# ══════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
add_rect(s, 0, 0, 13.333, 7.5, fill=LIGHT_BG)
add_header_bar(s, "Extraintestinal Manifestations (EIMs)", "Systemic involvement in IBD — affects up to 40% of patients")
add_footer(s); add_slide_number(s, 8)
systems = [
("MUSCULOSKELETAL\n(Most common — 10–20%)", [
"Peripheral arthritis / arthralgia",
"Ankylosing spondylitis",
"Sacroiliitis",
"Clubbing",
"Osteoporosis (steroid-related)",
], MID_BLUE, 0.3, 1.7),
("DERMATOLOGICAL\n(Up to 15%)", [
"Erythema nodosum (10–15%)",
"Pyoderma gangrenosum (1–2%)",
"Aphthous stomatitis",
"Sweet's syndrome",
"Psoriasis",
], ACCENT_RED, 3.8, 1.7),
("OCULAR\n(5–15%)", [
"Uveitis / iritis",
"Episcleritis",
"Scleritis",
"Cataracts (steroid-induced)",
], ACCENT_TEAL, 7.3, 1.7),
("HEPATOBILIARY\n(2–7.5%)", [
"Primary sclerosing cholangitis (UC>>CD)",
"Autoimmune hepatitis",
"Fatty liver",
"Cholelithiasis",
], DARK_BLUE, 10.4, 1.7),
("RENAL\n(Up to 10%)", [
"Calcium oxalate stones (Crohn's)",
"Uric acid stones",
"Ureteral obstruction",
"Amyloidosis (rare)",
], ORANGE, 0.3, 4.4),
("HAEMATOLOGICAL", [
"Anaemia of chronic disease",
"Iron deficiency anaemia",
"B12/folate deficiency",
"DVT / VTE (3× risk)",
"Thrombocytosis",
], MID_BLUE, 3.8, 4.4),
("PULMONARY", [
"Bronchiectasis",
"Interstitial lung disease",
"Pleuritis",
"Airway inflammation",
], ACCENT_TEAL, 7.3, 4.4),
("NEUROLOGICAL", [
"Peripheral neuropathy",
"Cerebrovascular events (DVT/stroke)",
"Mononeuritis multiplex",
], ACCENT_RED, 10.4, 4.4),
]
for (title, items, col, x, y) in systems:
add_rect(s, x, y, 2.9, 0.5, fill=col)
add_textbox(s, x+0.05, y+0.02, 2.8, 0.46, title, font_size=8.5, bold=True, color=WHITE)
add_rect(s, x, y+0.5, 2.9, 2.3, fill=WHITE, line_color=col, line_width=1)
add_multiline_textbox(s, x+0.08, y+0.52, 2.8, 2.2,
[{"text": f"• {i}", "size":9, "color":DARK_TEXT} for i in items],
font_size=9, line_spacing=15)
# ══════════════════════════════════════════════════════════════════════════════
# SLIDE 9 — DIAGNOSIS & INVESTIGATIONS
# ══════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
add_rect(s, 0, 0, 13.333, 7.5, fill=LIGHT_BG)
add_header_bar(s, "Diagnosis & Investigations", "No single gold standard — requires clinical, endoscopic, histological, and radiological correlation")
add_footer(s); add_slide_number(s, 9)
sections = [
("LABORATORY", [
"FBC — anaemia (chronic/blood loss/B12/folate deficiency)",
"WBC — mild elevation (active disease), marked ↑ = abscess",
"ESR, CRP — non-specific inflammatory markers",
"Fecal calprotectin — elevated in active disease, low in remission",
"Albumin — hypoalbuminaemia in severe/active disease",
"B12 — low with terminal ileal disease or resection >100 cm",
"LFTs — to detect PSC (ALP, GGT elevation)",
], 0.3, 1.65, 6.1, MID_BLUE),
("SEROLOGICAL MARKERS", [
"ASCA (Anti-Saccharomyces cerevisiae Ab) — positive 40–70% CD, <15% UC",
"pANCA — positive 55% UC, 20% CD (colon-predominant)",
"ASCA+/pANCA– → sensitivity 55%, specificity 93% for CD",
"Anti-OmpC, anti-CBir1 — additional CD markers",
"NOTE: Serology alone NOT diagnostic — supportive only",
], 6.7, 1.65, 6.3, ACCENT_TEAL),
("RADIOLOGY", [
"CT enterography / MRI enterography — PREFERRED over barium studies",
"Detects: strictures, fistulas, abscesses, bowel wall thickening",
"MRI: No radiation — preferred for young patients and monitoring",
"USS — useful for assessing bowel wall thickness",
"Plain AXR — in acute severe IBD to exclude toxic megacolon",
"CT scan: colonic dilation >6 cm = toxic megacolon",
], 0.3, 4.25, 6.1, ORANGE),
("ENDOSCOPY", [
"Colonoscopy with biopsies — cornerstone of diagnosis",
"Upper GI endoscopy — if upper GI CD suspected",
"Capsule endoscopy — for small bowel CD (only if no strictures)",
"MRI enterography / balloon enteroscopy for deep small bowel",
"Repeat colonoscopy for surveillance of dysplasia in longstanding IBD",
], 6.7, 4.25, 6.3, DARK_BLUE),
]
for (title, items, x, y, w, col) in sections:
add_rect(s, x, y, w, 0.42, fill=col)
add_textbox(s, x+0.1, y+0.03, w-0.2, 0.38, title, font_size=11, bold=True, color=WHITE)
add_rect(s, x, y+0.42, w, 2.35, fill=WHITE, line_color=col, line_width=1)
add_multiline_textbox(s, x+0.1, y+0.46, w-0.2, 2.28,
[{"text": f"• {i}", "size":10, "color":DARK_TEXT} for i in items],
font_size=10, line_spacing=15)
# ══════════════════════════════════════════════════════════════════════════════
# SLIDE 10 — ENDOSCOPIC & HISTOLOGICAL FEATURES
# ══════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
add_rect(s, 0, 0, 13.333, 7.5, fill=LIGHT_BG)
add_header_bar(s, "Endoscopic & Histological Features")
add_footer(s); add_slide_number(s, 10)
add_rect(s, 0.3, 1.65, 6.1, 5.5, fill=WHITE, line_color=MID_BLUE, line_width=1.5)
add_rect(s, 0.3, 1.65, 6.1, 0.45, fill=MID_BLUE)
add_textbox(s, 0.4, 1.68, 5.9, 0.42, "ULCERATIVE COLITIS", font_size=13, bold=True, color=WHITE)
add_multiline_textbox(s, 0.4, 2.15, 5.9, 4.9, [
{"text":"Endoscopy:", "size":11, "bold":True, "color":MID_BLUE},
{"text":"• Continuous inflammation from rectum proximally", "size":11},
{"text":"• Diffuse mucosal erythema, loss of vascular pattern", "size":11},
{"text":"• Granular, edematous mucosa (mild disease)", "size":11},
{"text":"• Friable mucosa, contact bleeding (moderate)", "size":11},
{"text":"• Ulceration, spontaneous bleeding (severe)", "size":11},
{"text":"• Pseudopolyps — epithelial regeneration after recurrent attacks", "size":11},
{"text":"• Chronic: colonic shortening, loss of haustration ('lead pipe')", "size":11},
{"text":" "},
{"text":"Histology:", "size":11, "bold":True, "color":MID_BLUE},
{"text":"• Crypt distortion and architectural irregularity", "size":11},
{"text":"• Cryptitis and crypt abscesses", "size":11},
{"text":"• Acute inflammatory infiltrate in lamina propria", "size":11},
{"text":"• Lymphocytic infiltrate in chronic disease", "size":11},
{"text":"• Absent granulomas", "size":11},
{"text":"• Mucin depletion from goblet cells", "size":11},
], font_size=11, color=DARK_TEXT, line_spacing=15)
add_rect(s, 6.9, 1.65, 6.1, 5.5, fill=WHITE, line_color=ACCENT_TEAL, line_width=1.5)
add_rect(s, 6.9, 1.65, 6.1, 0.45, fill=ACCENT_TEAL)
add_textbox(s, 7.0, 1.68, 5.9, 0.42, "CROHN'S DISEASE", font_size=13, bold=True, color=WHITE)
add_multiline_textbox(s, 7.0, 2.15, 5.9, 4.9, [
{"text":"Endoscopy:", "size":11, "bold":True, "color":ACCENT_TEAL},
{"text":"• Skip lesions — normal mucosa between diseased areas", "size":11},
{"text":"• Deep, longitudinal/linear ulcers", "size":11},
{"text":"• 'Cobblestone' mucosa — network of ulcers + oedematous islands", "size":11},
{"text":"• Aphthous ulcers (earliest lesion)", "size":11},
{"text":"• Strictures, stenosis", "size":11},
{"text":"• Fistulous openings", "size":11},
{"text":"• Any segment — terminal ileum most common", "size":11},
{"text":" "},
{"text":"Histology:", "size":11, "bold":True, "color":ACCENT_TEAL},
{"text":"• Transmural inflammation (all layers)", "size":11},
{"text":"• Non-caseating granulomas (~50%) — PATHOGNOMONIC", "size":11},
{"text":"• Lymphoid aggregates throughout bowel wall", "size":11},
{"text":"• Fissuring ulcers penetrating deep into wall", "size":11},
{"text":"• Preserved crypt architecture (early disease)", "size":11},
], font_size=11, color=DARK_TEXT, line_spacing=15)
# ══════════════════════════════════════════════════════════════════════════════
# SLIDE 11 — DISEASE ACTIVITY SCORING
# ══════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
add_rect(s, 0, 0, 13.333, 7.5, fill=LIGHT_BG)
add_header_bar(s, "Disease Activity Scoring")
add_footer(s); add_slide_number(s, 11)
# UC scoring
add_rect(s, 0.3, 1.65, 6.1, 0.42, fill=MID_BLUE)
add_textbox(s, 0.4, 1.68, 5.9, 0.38, "ULCERATIVE COLITIS — Truelove & Witts Criteria", font_size=11, bold=True, color=WHITE)
add_rect(s, 0.3, 2.07, 6.1, 4.55, fill=WHITE, line_color=MID_BLUE, line_width=1)
uc_table = [
("CRITERION", "MILD", "MODERATE", "SEVERE"),
("Stools/day", "<4", "4–6", ">6"),
("Blood in stool", "Little", "Moderate", "Large"),
("Temp", "Normal", "<37.8°C", ">37.8°C"),
("Pulse", "Normal", "<90 bpm", ">90 bpm"),
("Haemoglobin", ">11 g/dL", "10.5–11", "<10.5 g/dL"),
("ESR", "<20 mm/hr", "20–30", ">30 mm/hr"),
]
col_colors = [LIGHT_GREY, RGBColor(0xD4, 0xED, 0xDA), ORANGE, ACCENT_RED]
for ri, row in enumerate(uc_table):
for ci, cell in enumerate(row):
cx = 0.3 + ci * 1.52
cy = 2.07 + ri * 0.58
bg = col_colors[ci] if ri == 0 else (LIGHT_GREY if ri % 2 == 0 else WHITE)
if ri == 0: bg = col_colors[ci]
add_rect(s, cx, cy, 1.52, 0.58, fill=bg)
add_textbox(s, cx+0.05, cy+0.08, 1.42, 0.42, cell,
font_size=9.5, bold=(ri==0), color=WHITE if ri==0 else DARK_TEXT,
align=PP_ALIGN.CENTER)
# CD scoring
add_rect(s, 6.9, 1.65, 6.1, 0.42, fill=ACCENT_TEAL)
add_textbox(s, 7.0, 1.68, 5.9, 0.38, "CROHN'S DISEASE — Harvey-Bradshaw Index (HBI)", font_size=11, bold=True, color=WHITE)
add_rect(s, 6.9, 2.07, 6.1, 2.6, fill=WHITE, line_color=ACCENT_TEAL, line_width=1)
add_multiline_textbox(s, 7.0, 2.12, 5.9, 2.5, [
{"text":"Score = Sum of 5 parameters:", "size":11, "bold":True, "color":DARK_BLUE},
{"text":"1. General well-being (0–4)", "size":11},
{"text":"2. Abdominal pain (0–3)", "size":11},
{"text":"3. Abdominal mass (0–3)", "size":11},
{"text":"4. Stool frequency (1 pt each)", "size":11},
{"text":"5. Complications (1 pt each)", "size":11},
], font_size=11, color=DARK_TEXT, line_spacing=16)
add_rect(s, 6.9, 4.72, 6.1, 0.42, fill=DARK_BLUE)
add_textbox(s, 7.0, 4.75, 5.9, 0.38, "HBI Score Interpretation", font_size=11, bold=True, color=WHITE)
add_rect(s, 6.9, 5.14, 6.1, 1.5, fill=WHITE, line_color=DARK_BLUE, line_width=1)
add_multiline_textbox(s, 7.0, 5.18, 5.9, 1.4, [
{"text":"• <5 → Remission", "size":11, "color":ACCENT_GREEN},
{"text":"• 5–7 → Mild activity", "size":11, "color":ORANGE},
{"text":"• 8–16 → Moderate activity", "size":11, "color":ORANGE},
{"text":"• >16 → Severe activity", "size":11, "color":ACCENT_RED},
], font_size=11, color=DARK_TEXT, line_spacing=16)
add_textbox(s, 0.3, 6.7, 12.7, 0.35,
"Other scoring: CDAI (Crohn's Disease Activity Index) — complex 8-variable score; Remission = CDAI <150; Moderate-severe = 220–450; Mayo Score for UC endoscopic severity",
font_size=9, italic=True, color=DARK_BLUE)
# ══════════════════════════════════════════════════════════════════════════════
# SLIDE 12 — MEDICAL MANAGEMENT
# ══════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
add_rect(s, 0, 0, 13.333, 7.5, fill=LIGHT_BG)
add_header_bar(s, "Medical Management", "Step-up therapy: mild → moderate → severe disease")
add_footer(s); add_slide_number(s, 12)
steps = [
("STEP 1 — MILD DISEASE", [
"Aminosalicylates (5-ASA): First-line for UC",
" Mesalazine (oral + topical), Sulfasalazine",
" Less effective in Crohn's disease",
"Topical steroids: Rectal foam/suppositories for proctitis",
"Antibiotics: Metronidazole / Ciprofloxacin for perianal CD",
"Nutritional therapy: Exclusive enteral nutrition in paediatric CD",
], MID_BLUE, 0.3, 1.65, 6.0),
("STEP 2 — MODERATE DISEASE", [
"Corticosteroids (systemic): Prednisolone 40–60 mg/day PO",
" Budesonide (ileal-release): preferred for ileocolonic CD",
" Hydrocortisone IV (200–300 mg/day) for hospitalised patients",
"Immunomodulators:",
" Azathioprine (AZA) / 6-Mercaptopurine (6-MP)",
" Methotrexate (MTX) — CD maintenance",
" TPMT testing before thiopurines",
], ACCENT_TEAL, 0.3, 4.3, 6.0),
("STEP 3 — SEVERE / REFRACTORY DISEASE", [
"Anti-TNF therapy: Infliximab, Adalimumab",
"Anti-integrin: Vedolizumab (gut-selective)",
"Anti-IL-12/23: Ustekinumab",
"JAK inhibitors: Tofacitinib, Filgotinib (UC)",
"Combination therapy: Biologic + immunomodulator > monotherapy",
"Cyclosporin IV: Acute severe UC (rescue therapy)",
], DARK_BLUE, 6.6, 1.65, 6.4),
("MONITORING & SIDE EFFECTS", [
"Steroids: Bone density, diabetes, cataracts, adrenal suppression",
"Thiopurines: LFTs, FBC (3–6 monthly); pancreatitis, lymphoma risk",
"Methotrexate: LFTs, FBC; teratogenic — contraception essential",
"Anti-TNF: TB screening (IGRA), HBV screen, skin checks",
"Vedolizumab: PML risk very low; generally gut-selective — safer",
"JAK inhibitors: VTE risk, lipids, cardiovascular events (monitor)",
], ORANGE, 6.6, 4.3, 6.4),
]
for (title, items, col, x, y, w) in steps:
add_rect(s, x, y, w, 0.42, fill=col)
add_textbox(s, x+0.1, y+0.04, w-0.2, 0.36, title, font_size=11, bold=True, color=WHITE)
add_rect(s, x, y+0.42, w, 2.4, fill=WHITE, line_color=col, line_width=1)
add_multiline_textbox(s, x+0.1, y+0.46, w-0.2, 2.32,
[{"text": f"{' ' if i.startswith(' ') else '• '}{i.strip()}", "size":10, "color":DARK_TEXT} for i in items],
font_size=10, color=DARK_TEXT, line_spacing=15)
# ══════════════════════════════════════════════════════════════════════════════
# SLIDE 13 — BIOLOGIC & TARGETED THERAPIES
# ══════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
add_rect(s, 0, 0, 13.333, 7.5, fill=LIGHT_BG)
add_header_bar(s, "Biologic & Targeted Therapies", "Mechanism-based treatments for moderate-to-severe IBD")
add_footer(s); add_slide_number(s, 13)
agents = [
("Anti-TNF\nAgents", ["Infliximab (IV)", "Adalimumab (SC)", "Certolizumab (SC, CD only)", "Golimumab (SC, UC only)"], "Neutralise TNF-α → block\npro-inflammatory cascade", "Both CD & UC\n(except Certolizumab = CD;\nGolimumab = UC only)", MID_BLUE),
("Anti-Integrin", ["Vedolizumab (IV/SC)"], "Blocks α4β7 integrin →\nprevents lymphocyte\nmigration to gut", "Both CD & UC\nGut-selective\n(safer profile)", ACCENT_TEAL),
("Anti-IL-12/23", ["Ustekinumab (IV then SC)", "Risankizumab (anti-IL-23)"], "Blocks p40 subunit of\nIL-12/IL-23 →\ninhibits Th1 & Th17", "CD & UC\nSafe in infections;\nno TB concern", DARK_BLUE),
("JAK Inhibitors\n(Small molecules)", ["Tofacitinib (UC)", "Filgotinib (UC)", "Upadacitinib (CD, UC)"], "Inhibit JAK1/3 →\nreduce cytokine\nsignalling", "Oral agents\nMonitor: VTE,\ncardiovascular, lipids", ORANGE),
]
add_rect(s, 0.3, 1.65, 2.5, 0.42, fill=DARK_TEXT)
for hdr, x in [("DRUG CLASS / AGENTS", 0.3),("KEY AGENTS", 2.8),("MECHANISM", 5.9),("INDICATION", 9.1),]:
pass
headers = ["DRUG CLASS", "KEY AGENTS", "MECHANISM", "INDICATION / NOTES"]
col_widths = [2.5, 3.1, 3.2, 3.7]
col_starts = [0.3, 2.8, 5.9, 9.1]
for ci, (hdr, w, x) in enumerate(zip(headers, col_widths, col_starts)):
add_rect(s, x, 1.65, w, 0.42, fill=DARK_TEXT)
add_textbox(s, x+0.05, 1.67, w-0.1, 0.38, hdr, font_size=10, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
for ri, (cls, agents_list, mech, ind, col) in enumerate(agents):
y = 2.07 + ri * 1.18
bg = RGBColor(0xF5, 0xF8, 0xFF) if ri % 2 == 0 else WHITE
add_rect(s, col_starts[0], y, col_widths[0], 1.18, fill=col)
add_textbox(s, col_starts[0]+0.05, y+0.1, col_widths[0]-0.1, 1.0, cls, font_size=10, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
add_rect(s, col_starts[1], y, col_widths[1], 1.18, fill=bg)
add_multiline_textbox(s, col_starts[1]+0.08, y+0.1, col_widths[1]-0.1, 1.0,
[{"text": f"• {a}", "size":10, "color":DARK_TEXT} for a in agents_list], font_size=10)
add_rect(s, col_starts[2], y, col_widths[2], 1.18, fill=bg)
add_textbox(s, col_starts[2]+0.08, y+0.1, col_widths[2]-0.1, 1.0, mech, font_size=10, color=DARK_TEXT, wrap=True)
add_rect(s, col_starts[3], y, col_widths[3], 1.18, fill=bg)
add_textbox(s, col_starts[3]+0.08, y+0.1, col_widths[3]-0.1, 1.0, ind, font_size=10, color=DARK_TEXT, wrap=True)
add_textbox(s, 0.3, 6.75, 12.7, 0.35,
"Key principle: Treat early and aggressively. Combination of biologic + immunomodulator > monotherapy (SONIC & UC SUCCESS trials). Monitor drug levels and antibody formation. Switch class (not agent) if adequate trough levels + active inflammation.",
font_size=8.5, italic=True, color=DARK_BLUE)
# ══════════════════════════════════════════════════════════════════════════════
# SLIDE 14 — SURGICAL MANAGEMENT
# ══════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
add_rect(s, 0, 0, 13.333, 7.5, fill=LIGHT_BG)
add_header_bar(s, "Surgical Management")
add_footer(s); add_slide_number(s, 14)
add_rect(s, 0.3, 1.65, 6.0, 0.42, fill=MID_BLUE)
add_textbox(s, 0.4, 1.68, 5.8, 0.38, "CROHN'S DISEASE — Surgery is NOT curative", font_size=12, bold=True, color=WHITE)
add_rect(s, 0.3, 2.07, 6.0, 4.55, fill=WHITE, line_color=MID_BLUE, line_width=1)
add_multiline_textbox(s, 0.4, 2.12, 5.8, 4.45, [
{"text":"Indications:", "size":11, "bold":True, "color":MID_BLUE},
{"text":"• Obstruction not responding to steroids", "size":11},
{"text":"• Intra-abdominal abscess (percutaneous drainage first, then resection)", "size":11},
{"text":"• Fistulas refractory to medical therapy", "size":11},
{"text":"• Failure of medical management", "size":11},
{"text":"• Dysplasia or carcinoma", "size":11},
{"text":" "},
{"text":"Procedures:", "size":11, "bold":True, "color":MID_BLUE},
{"text":"• Ileocolonic resection (most common for terminal ileal CD)", "size":11},
{"text":"• Strictureplasty — bowel conservation for multiple strictures", "size":11},
{"text":"• Ileostomy or colostomy (diverting procedures)", "size":11},
{"text":"• Perianal drainage + seton placement", "size":11},
{"text":" "},
{"text":"Key point: Up to 70% of CD patients require surgery within 20 yrs.", "size":10, "italic":True, "color":ACCENT_RED},
{"text":"Risk of recurrence after resection is high — post-op maintenance therapy essential.", "size":10, "italic":True, "color":ACCENT_RED},
], font_size=11, color=DARK_TEXT, line_spacing=15)
add_rect(s, 6.9, 1.65, 6.1, 0.42, fill=ACCENT_TEAL)
add_textbox(s, 7.0, 1.68, 5.9, 0.38, "ULCERATIVE COLITIS — Surgery IS curative", font_size=12, bold=True, color=WHITE)
add_rect(s, 6.9, 2.07, 6.1, 4.55, fill=WHITE, line_color=ACCENT_TEAL, line_width=1)
add_multiline_textbox(s, 7.0, 2.12, 5.9, 4.45, [
{"text":"Indications:", "size":11, "bold":True, "color":ACCENT_TEAL},
{"text":"• Acute severe UC refractory to IV corticosteroids and rescue therapy", "size":11},
{"text":"• Toxic megacolon (colonic dilation >6 cm)", "size":11},
{"text":"• Intestinal perforation", "size":11},
{"text":"• Dysplasia or colorectal carcinoma", "size":11},
{"text":"• Chronic corticosteroid dependence / intolerance", "size":11},
{"text":" "},
{"text":"Gold Standard: Restorative Proctocolectomy", "size":11, "bold":True, "color":ACCENT_TEAL},
{"text":"• Total proctocolectomy + ileal pouch-anal anastomosis (IPAA)", "size":11},
{"text":"• 'J-pouch' construction — eliminates UC permanently", "size":11},
{"text":"• Temporary loop ileostomy for pouch protection", "size":11},
{"text":" "},
{"text":"Alternative: Total proctocolectomy + permanent end ileostomy", "size":11},
{"text":" "},
{"text":"Complication: Pouchitis in ~50% of IPAA patients (usually antibiotic-responsive).", "size":10, "italic":True, "color":ACCENT_RED},
], font_size=11, color=DARK_TEXT, line_spacing=15)
# ══════════════════════════════════════════════════════════════════════════════
# SLIDE 15 — COMPLICATIONS
# ══════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
add_rect(s, 0, 0, 13.333, 7.5, fill=LIGHT_BG)
add_header_bar(s, "Complications of IBD")
add_footer(s); add_slide_number(s, 15)
comps = [
("INTESTINAL", [
("Obstruction (CD)", "Most common reason for CD surgery; fibrous strictures respond to strictureplasty"),
("Abscesses (CD)", "15–20% of CD patients; fever + RLQ pain + leukocytosis; CT-guided drainage + antibiotics"),
("Fistulas (CD)", "Enteroenteric, enterovesical, enterovaginal; may require combined medical-surgical approach"),
("Toxic Megacolon", "Colonic dilation >6 cm; fever, tachycardia, leukocytosis; emergency — risk of perforation"),
("Perforation", "Surgical emergency; higher risk in severe UC and CD with transmural disease"),
("Haemorrhage", "Massive lower GI bleeding requiring colonoscopy, embolisation or surgery"),
], 0.3),
("SYSTEMIC", [
("VTE / DVT", "3× increased risk; thromboprophylaxis in hospitalised IBD patients; arterial events also increased"),
("Malnutrition", "From malabsorption, poor intake, increased catabolism; supplement B12, iron, folate, D, zinc"),
("Osteoporosis", "Steroid-related + disease-related; baseline DXA; Ca2+ + Vit D supplementation"),
("Growth retardation", "Important in paediatric CD; exclusive enteral nutrition preferred over steroids"),
("Anaemia", "Chronic disease, blood loss, haematinic deficiency; IV iron often required"),
("Drug side effects", "See medications slide; thiopurine lymphoma, anti-TNF infections, JAK inhibitor VTE"),
], 6.9),
]
for (title, items, x) in comps:
add_rect(s, x, 1.65, 6.1, 0.42, fill=DARK_BLUE)
add_textbox(s, x+0.1, 1.68, 5.9, 0.38, title + " COMPLICATIONS", font_size=12, bold=True, color=WHITE)
for i, (comp, desc) in enumerate(items):
y = 2.12 + i * 0.83
add_rect(s, x, y, 6.1, 0.83, fill=RGBColor(0xF0, 0xF5, 0xFF) if i%2==0 else WHITE, line_color=LIGHT_GREY, line_width=0.5)
add_textbox(s, x+0.1, y+0.06, 6.0, 0.28, comp, font_size=11, bold=True, color=DARK_BLUE)
add_textbox(s, x+0.1, y+0.36, 6.0, 0.4, desc, font_size=9.5, color=DARK_TEXT, wrap=True)
# ══════════════════════════════════════════════════════════════════════════════
# SLIDE 16 — IBD & COLORECTAL CANCER
# ══════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
add_rect(s, 0, 0, 13.333, 7.5, fill=LIGHT_BG)
add_header_bar(s, "IBD & Colorectal Cancer (CRC)", "Dysplasia surveillance is mandatory in long-standing IBD")
add_footer(s); add_slide_number(s, 16)
add_rect(s, 0.3, 1.65, 12.7, 0.42, fill=DARK_BLUE)
add_textbox(s, 0.4, 1.68, 12.5, 0.38, "RISK OF COLORECTAL CANCER", font_size=13, bold=True, color=WHITE)
add_rect(s, 0.3, 2.07, 4.0, 4.5, fill=WHITE, line_color=MID_BLUE, line_width=1)
add_multiline_textbox(s, 0.4, 2.12, 3.8, 4.4, [
{"text":"UC Risk:", "size":12, "bold":True, "color":MID_BLUE},
{"text":" "},
{"text":"• Risk begins after 7 years of disease", "size":11},
{"text":"• Rises ~10% per decade", "size":11},
{"text":"• 15.8–34% at 30 years (referral centres)", "size":11},
{"text":"• Greatest with pancolitis", "size":11},
{"text":"• Left-sided colitis: onset ~1 decade later", "size":11},
{"text":"• Proctitis alone: minimally increased risk", "size":11},
{"text":" "},
{"text":"Risk Correlates:", "size":12, "bold":True, "color":MID_BLUE},
{"text":"• Duration + extent of disease", "size":11},
{"text":"• Degree of chronic inflammation", "size":11},
{"text":"• Family history of CRC", "size":11},
{"text":"• Co-existing PSC (highest risk)", "size":11},
], font_size=11, color=DARK_TEXT, line_spacing=15)
add_rect(s, 4.6, 2.07, 4.0, 4.5, fill=WHITE, line_color=ACCENT_TEAL, line_width=1)
add_multiline_textbox(s, 4.7, 2.12, 3.8, 4.4, [
{"text":"Crohn's Disease Risk:", "size":12, "bold":True, "color":ACCENT_TEAL},
{"text":" "},
{"text":"• 4–20× general population risk", "size":11},
{"text":"• Often arise from mucosa in bypassed/strictured segments", "size":11},
{"text":"• Mucinous carcinomas common", "size":11},
{"text":"• Can occur at younger age", "size":11},
{"text":" "},
{"text":"Dysplasia-Carcinoma Sequence:", "size":12, "bold":True, "color":ACCENT_TEAL},
{"text":" "},
{"text":"Normal mucosa → Low-grade dysplasia (LGD) → High-grade dysplasia (HGD) → Carcinoma", "size":11},
{"text":" "},
{"text":"• HGD: 25% have synchronous CRC at colectomy", "size":11},
{"text":"• Back-to-back glands, nuclear pseudostratification, crypt distortion", "size":11},
], font_size=11, color=DARK_TEXT, line_spacing=15)
add_rect(s, 8.9, 2.07, 4.1, 4.5, fill=WHITE, line_color=ORANGE, line_width=1)
add_multiline_textbox(s, 9.0, 2.12, 3.9, 4.4, [
{"text":"Surveillance Guidelines:", "size":12, "bold":True, "color":ORANGE},
{"text":" "},
{"text":"• Begin colonoscopy surveillance 8–10 years after IBD onset", "size":11},
{"text":"• Frequency: every 1–3 years (based on risk)", "size":11},
{"text":"• HIGH RISK (PSC, extensive colitis): Annual", "size":11},
{"text":"• MODERATE RISK: Every 2–3 years", "size":11},
{"text":" "},
{"text":"Chromoendoscopy:", "size":12, "bold":True, "color":ORANGE},
{"text":"Preferred technique — dye spray enhances mucosal surface detail to detect dysplasia", "size":11},
{"text":" "},
{"text":"On finding HGD: Urgent colectomy recommended", "size":11, "bold":True, "color":ACCENT_RED},
{"text":"On finding LGD: Multidisciplinary discussion; repeat colonoscopy or colectomy", "size":11},
], font_size=11, color=DARK_TEXT, line_spacing=15)
# ══════════════════════════════════════════════════════════════════════════════
# SLIDE 17 — SPECIAL POPULATIONS & EMERGING THERAPIES
# ══════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
add_rect(s, 0, 0, 13.333, 7.5, fill=LIGHT_BG)
add_header_bar(s, "Special Populations & Emerging Therapies")
add_footer(s); add_slide_number(s, 17)
add_rect(s, 0.3, 1.65, 6.0, 5.5, fill=WHITE, line_color=MID_BLUE, line_width=1)
add_rect(s, 0.3, 1.65, 6.0, 0.42, fill=MID_BLUE)
add_textbox(s, 0.4, 1.68, 5.8, 0.38, "SPECIAL POPULATIONS", font_size=12, bold=True, color=WHITE)
add_multiline_textbox(s, 0.4, 2.12, 5.8, 4.9, [
{"text":"PREGNANCY:", "size":11, "bold":True, "color":MID_BLUE},
{"text":"• Most IBD medications safe in pregnancy (except MTX — absolutely contraindicated)", "size":11},
{"text":"• 5-ASA and biologics generally continued", "size":11},
{"text":"• Active disease at conception = worse maternal/fetal outcomes", "size":11},
{"text":"• Anti-TNF agents: Stop at ~week 24–32 to reduce cord transfer", "size":11},
{"text":" "},
{"text":"PAEDIATRIC IBD:", "size":11, "bold":True, "color":MID_BLUE},
{"text":"• Exclusive enteral nutrition (EEN) = first-line induction (CD)", "size":11},
{"text":"• Avoid long-term steroids — growth retardation", "size":11},
{"text":"• Early biologic use favoured", "size":11},
{"text":" "},
{"text":"ELDERLY IBD:", "size":11, "bold":True, "color":MID_BLUE},
{"text":"• Steroid side effects more severe — osteoporosis, delirium", "size":11},
{"text":"• Drug interactions with polypharmacy — caution with thiopurines", "size":11},
{"text":"• Higher VTE risk — prophylaxis in hospitalised patients", "size":11},
{"text":" "},
{"text":"IBD & COVID-19:", "size":11, "bold":True, "color":MID_BLUE},
{"text":"• Immunosuppressants (steroids, thiopurines, JAK inhibitors) increase infection risk", "size":11},
{"text":"• Biologics (vedolizumab) generally safer", "size":11},
{"text":"• Vaccination strongly recommended (including COVID-19, flu, pneumococcal)", "size":11},
], font_size=11, color=DARK_TEXT, line_spacing=14)
add_rect(s, 6.9, 1.65, 6.1, 5.5, fill=WHITE, line_color=ACCENT_TEAL, line_width=1)
add_rect(s, 6.9, 1.65, 6.1, 0.42, fill=ACCENT_TEAL)
add_textbox(s, 7.0, 1.68, 5.9, 0.38, "EMERGING & FUTURE THERAPIES", font_size=12, bold=True, color=WHITE)
add_multiline_textbox(s, 7.0, 2.12, 5.9, 4.9, [
{"text":"Selective JAK Inhibitors:", "size":11, "bold":True, "color":ACCENT_TEAL},
{"text":"• Upadacitinib (JAK1-selective) — approved CD & UC", "size":11},
{"text":"• Filgotinib (JAK1-selective) — improved safety over tofacitinib", "size":11},
{"text":" "},
{"text":"Anti-IL-23 Antibodies:", "size":11, "bold":True, "color":ACCENT_TEAL},
{"text":"• Risankizumab, Mirikizumab, Guselkumab", "size":11},
{"text":"• More specific than ustekinumab (targets p19 of IL-23 only)", "size":11},
{"text":" "},
{"text":"S1P Receptor Modulators:", "size":11, "bold":True, "color":ACCENT_TEAL},
{"text":"• Ozanimod (UC) — oral; retains lymphocytes in lymph nodes", "size":11},
{"text":" "},
{"text":"Microbiome-based Therapies:", "size":11, "bold":True, "color":ACCENT_TEAL},
{"text":"• Faecal microbiota transplantation (FMT) — active clinical trials in IBD", "size":11},
{"text":"• Targeted microbial consortia — experimental", "size":11},
{"text":" "},
{"text":"Stem Cell Therapy:", "size":11, "bold":True, "color":ACCENT_TEAL},
{"text":"• Autologous HSCT in refractory CD — promising pilot data", "size":11},
{"text":" "},
{"text":"Precision / Personalised Medicine:", "size":11, "bold":True, "color":ACCENT_TEAL},
{"text":"• Therapeutic drug monitoring (TDM) — optimise biologic dosing", "size":11},
{"text":"• Biomarker-guided treatment selection", "size":11},
], font_size=11, color=DARK_TEXT, line_spacing=14)
# ══════════════════════════════════════════════════════════════════════════════
# SLIDE 18 — MONITORING & FOLLOW-UP
# ══════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
add_rect(s, 0, 0, 13.333, 7.5, fill=LIGHT_BG)
add_header_bar(s, "Monitoring & Follow-up", "Treat to target: mucosal healing and clinical remission")
add_footer(s); add_slide_number(s, 18)
monitor_items = [
("Clinical", ["Regular symptom assessment (HBI/Mayo scores)", "Nutritional status, weight, BMI", "Growth velocity in children", "Quality of life assessment"]),
("Biochemical", ["FBC, ESR, CRP — every 3–6 months in active disease", "Fecal calprotectin — non-invasive mucosal healing marker", "Albumin, B12, folate, iron, zinc, vitamin D", "Drug levels + anti-drug antibodies (biologics)"]),
("Endoscopic", ["Colonoscopy: treat-to-target approach — mucosal healing endpoint", "Surveillance colonoscopy: 8–10 yrs after IBD onset", "Chromoendoscopy preferred for dysplasia detection", "MRI/CT enterography for Crohn's (transmural response)"]),
("Bone Health", ["DEXA scan at baseline — all patients on long-term steroids", "Ca2+ 1000–1200 mg/day + Vitamin D 800 IU/day", "Consider bisphosphonates if T-score < -2.5"]),
("Infection Screen", ["Annual flu vaccine; pneumococcal (every 5 yrs); Hepatitis B, HPV, VZV (pre-immunosuppression)", "TB IGRA screening before anti-TNF initiation", "Avoid live vaccines in immunosuppressed patients"]),
("Cancer Screen", ["Annual colonoscopy if PSC + pancolitis", "Cervical smear (increased CIN risk with immunosuppression)", "Skin checks (squamous cell carcinoma risk with thiopurines)", "Lymphoma awareness (thiopurines + anti-TNF)"]),
]
for i, (category, points) in enumerate(monitor_items):
row = i // 3
col = i % 3
x = 0.3 + col * 4.35
y = 1.65 + row * 2.7
col_bg = [MID_BLUE, ACCENT_TEAL, DARK_BLUE, ORANGE, MID_BLUE, ACCENT_TEAL][i]
add_rect(s, x, y, 4.05, 0.42, fill=col_bg)
add_textbox(s, x+0.1, y+0.04, 3.85, 0.36, category.upper(), font_size=11, bold=True, color=WHITE)
add_rect(s, x, y+0.42, 4.05, 2.2, fill=WHITE, line_color=col_bg, line_width=1)
add_multiline_textbox(s, x+0.1, y+0.46, 3.85, 2.1,
[{"text": f"• {p}", "size":9.5, "color":DARK_TEXT} for p in points],
font_size=9.5, line_spacing=15)
# ══════════════════════════════════════════════════════════════════════════════
# SLIDE 19 — KEY TAKEAWAYS
# ══════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
add_rect(s, 0, 0, 13.333, 7.5, fill=DARK_BLUE)
add_rect(s, 0, 1.5, 13.333, 0.07, fill=ACCENT_TEAL)
add_rect(s, 0, 5.9, 13.333, 1.6, fill=MID_BLUE)
add_textbox(s, 1.0, 0.3, 11.0, 0.6, "KEY TAKEAWAYS", font_size=13, bold=True, color=ACCENT_TEAL, align=PP_ALIGN.CENTER)
add_textbox(s, 1.0, 0.85, 11.0, 0.7, "Inflammatory Bowel Disease — Clinical Essentials",
font_size=26, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
add_slide_number(s, 19)
takeaways = [
("1", "IBD = chronic relapsing GI inflammation; two main types: CD (transmural, any GI segment) and UC (mucosal, colon only).", MID_BLUE),
("2", "Pathophysiology: Genetic susceptibility (NOD2, IL23R) + dysbiosis + aberrant Th1/Th17 immune activation → uncontrolled inflammation.", ACCENT_TEAL),
("3", "Diagnosis requires endoscopy + histology; CT/MRI enterography for CD; serological markers are supportive but not diagnostic.", ORANGE),
("4", "Medical therapy is step-up: 5-ASA (UC) → steroids → immunomodulators → biologics (anti-TNF, vedolizumab, ustekinumab) → JAK inhibitors.", MID_BLUE),
("5", "Surgery cures UC (proctocolectomy); CD surgery (resection, strictureplasty) is not curative — 70% need surgery within 20 years.", ACCENT_TEAL),
("6", "Surveillance colonoscopy is mandatory from 8–10 years of disease; HGD = urgent colectomy.", ORANGE),
("7", "Treat-to-target: aim for mucosal healing + clinical remission; therapeutic drug monitoring optimises biologic outcomes.", MID_BLUE),
("8", "Extraintestinal manifestations (joints, skin, eyes, liver) affect up to 40% of patients — multidisciplinary management required.", ACCENT_TEAL),
]
for i, (num, text, col) in enumerate(takeaways):
row = i // 2
side = i % 2
x = 0.4 + side * 6.5
y = 1.7 + row * 0.98
add_rect(s, x, y, 0.52, 0.52, fill=col)
add_textbox(s, x, y, 0.52, 0.52, num, font_size=14, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
add_rect(s, x+0.52, y, 5.7, 0.52, fill=RGBColor(0x22, 0x4A, 0x80))
add_textbox(s, x+0.6, y+0.06, 5.55, 0.42, text, font_size=10, color=WHITE, wrap=True)
add_textbox(s, 1.0, 6.0, 11.0, 0.45,
"Sources: Sleisenger & Fordtran's Gastrointestinal and Liver Disease | Goldman-Cecil Medicine | Harrison's Principles of Internal Medicine 22E",
font_size=9, italic=True, color=LIGHT_BG, align=PP_ALIGN.CENTER)
add_textbox(s, 1.0, 6.55, 11.0, 0.4,
"Rosen's Emergency Medicine | Cellular & Molecular Immunology",
font_size=9, italic=True, color=LIGHT_BG, align=PP_ALIGN.CENTER)
# ─────────────────────────────────────────────────────────────────────────────
out_path = "/tmp/workspace/ibd-ppt/Inflammatory_Bowel_Disease.pptx"
buf = BytesIO()
prs.save(buf)
with open(out_path, "wb") as f:
f.write(buf.getvalue())
print(f"Saved: {out_path}")
print(f"Slides: {len(prs.slides)}")
cd /tmp/workspace/ibd-ppt && python create_ibd_ppt.py 2>&1
ls -lh /tmp/workspace/ibd-ppt/Inflammatory_Bowel_Disease.pptx && python -c " from pptx import Presentation prs = Presentation('/tmp/workspace/ibd-ppt/Inflammatory_Bowel_Disease.pptx') for i, slide in enumerate(prs.slides, 1): texts = [] for shape in slide.shapes: if shape.has_text_frame: t = shape.text_frame.text.strip() if t and len(t) > 3: texts.append(t[:60]) print(f'Slide {i}: {texts[0] if texts else \"(no text)\"}') "
Inflammatory Bowel Disease
Presentation · PPTX
| # | Slide |
|---|---|
| 1 | Title Slide — professional navy/teal design |
| 2 | Table of Contents |
| 3 | Definition & Overview (IBD vs IBS) |
| 4 | Epidemiology & Risk Factors |
| 5 | Pathophysiology & Immunology (Genetics / Immune / Microbiome) |
| 6 | Crohn's Disease vs Ulcerative Colitis — Comparison Table |
| 7 | Clinical Manifestations (CD & UC side-by-side) |
| 8 | Extraintestinal Manifestations (8 organ systems) |
| 9 | Diagnosis & Investigations (Lab / Serology / Radiology / Endoscopy) |
| 10 | Endoscopic & Histological Features |
| 11 | Disease Activity Scoring (Truelove & Witts / Harvey-Bradshaw) |
| 12 | Medical Management (Step-up: 5-ASA → Steroids → Immunomodulators) |
| 13 | Biologic & Targeted Therapies (anti-TNF, vedolizumab, ustekinumab, JAK inhibitors) |
| 14 | Surgical Management (IPAA for UC, strictureplasty / resection for CD) |
| 15 | Complications (intestinal & systemic) |
| 16 | IBD & Colorectal Cancer — dysplasia surveillance |
| 17 | Special Populations & Emerging Therapies (pregnancy, paediatric, FMT, stem cells) |
| 18 | Monitoring & Follow-up (treat-to-target) |
| 19 | Key Takeaways |