GI Bleed ppt wotj 20 plus slides from standard referral books
mkdir -p /tmp/workspace/gi-bleed-ppt && ls /tmp/workspace/
GI Bleed ppt with 20 plus slides from standard referral books
Ppt please
mkdir -p /tmp/workspace/gi-bleed-ppt && cat > /tmp/workspace/gi-bleed-ppt/build.py << 'PYEOF' 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 pptx.oxml.ns import qn from lxml import etree from io import BytesIO # ── colour palette ────────────────────────────────────────────── DARK_RED = RGBColor(0xC0, 0x10, 0x1A) # header / accent DEEP_NAVY = RGBColor(0x0D, 0x27, 0x4A) # title text MID_NAVY = RGBColor(0x1A, 0x3A, 0x6B) # subtitle / body head LIGHT_GREY = RGBColor(0xF4, 0xF6, 0xF9) # slide background WHITE = RGBColor(0xFF, 0xFF, 0xFF) CHARCOAL = RGBColor(0x2C, 0x2C, 0x2C) GOLD = RGBColor(0xD4, 0xA0, 0x17) TEAL = RGBColor(0x00, 0x7A, 0x87) W = Inches(13.333) H = Inches(7.5) prs = Presentation() prs.slide_width = W prs.slide_height = H blank = prs.slide_layouts[6] # fully blank def rgb_fill(shape, color): sp = shape._element spPr = sp.find(qn('p:spPr')) if spPr is None: spPr = etree.SubElement(sp, qn('p:spPr')) solidFill = etree.SubElement(spPr, qn('a:solidFill')) srgb = etree.SubElement(solidFill, qn('a:srgbClr')) srgb.set('val', '%02X%02X%02X' % (color.red, color.green, color.blue)) def add_rect(slide, x, y, w, h, color): shape = slide.shapes.add_shape(1, x, y, w, h) # MSO_SHAPE_TYPE.RECTANGLE shape.line.fill.background() shape.line.width = 0 sp = shape._element spPr = sp.find(qn('p:spPr')) if spPr is None: spPr = etree.SubElement(sp, qn('p:spPr')) # remove existing fills for f in spPr.findall(qn('a:solidFill')): spPr.remove(f) solidFill = etree.SubElement(spPr, qn('a:solidFill')) srgb = etree.SubElement(solidFill, qn('a:srgbClr')) srgb.set('val', '%02X%02X%02X' % (color.red, color.green, color.blue)) return shape def tb(slide, text, x, y, w, h, fontsize=18, bold=False, color=CHARCOAL, align=PP_ALIGN.LEFT, wrap=True, italic=False): txb = slide.shapes.add_textbox(x, y, w, h) tf = txb.text_frame tf.word_wrap = wrap tf.margin_left = tf.margin_right = tf.margin_top = tf.margin_bottom = 0 p = tf.paragraphs[0] p.alignment = align r = p.add_run() r.text = text r.font.name = 'Calibri' r.font.size = Pt(fontsize) r.font.bold = bold r.font.italic= italic r.font.color.rgb = color return txb def bullet_box(slide, items, x, y, w, h, fontsize=15, color=CHARCOAL, bold_first=False, bullet_color=DARK_RED, indent=Inches(0.2)): txb = slide.shapes.add_textbox(x, y, w, h) tf = txb.text_frame tf.word_wrap = True tf.margin_left = tf.margin_right = Pt(2) tf.margin_top = tf.margin_bottom = 0 for i, item in enumerate(items): if i == 0: p = tf.paragraphs[0] else: p = tf.add_paragraph() p.space_before = Pt(3) p.level = 0 r = p.add_run() r.text = "\u2022 " + item r.font.name = 'Calibri' r.font.size = Pt(fontsize) r.font.bold = (bold_first and i == 0) r.font.color.rgb = color return txb def add_slide_bg(slide, bg_color=LIGHT_GREY): add_rect(slide, 0, 0, W, H, bg_color) def header_bar(slide, title, sub=None): add_rect(slide, 0, 0, W, Inches(1.1), DEEP_NAVY) add_rect(slide, 0, Inches(1.1), W, Inches(0.06), DARK_RED) tb(slide, title, Inches(0.4), Inches(0.1), Inches(12), Inches(0.8), fontsize=28, bold=True, color=WHITE) if sub: tb(slide, sub, Inches(0.4), Inches(0.75), Inches(10), Inches(0.35), fontsize=13, color=RGBColor(0xB8, 0xCC, 0xE4), italic=True) # ════════════════════════════════════════════════════════════════ # SLIDE 1 – TITLE # ════════════════════════════════════════════════════════════════ s = prs.slides.add_slide(blank) add_rect(s, 0, 0, W, H, DEEP_NAVY) add_rect(s, 0, Inches(3.0), W, Inches(0.08), DARK_RED) add_rect(s, 0, Inches(6.6), W, Inches(0.9), RGBColor(0x08, 0x18, 0x32)) tb(s, "GASTROINTESTINAL BLEEDING", Inches(0.6), Inches(1.4), Inches(12), Inches(1.2), fontsize=40, bold=True, color=WHITE, align=PP_ALIGN.CENTER) tb(s, "A Comprehensive Clinical Review", Inches(1), Inches(2.6), Inches(11), Inches(0.6), fontsize=22, color=RGBColor(0xB8, 0xCC, 0xE4), align=PP_ALIGN.CENTER, italic=True) tb(s, "Sources: Sabiston Textbook of Surgery | Sleisenger & Fordtran | Yamada's Gastroenterology\n" "Harrison's Principles | Current Surgical Therapy | Clinical GI Endoscopy", Inches(0.6), Inches(3.3), Inches(12), Inches(0.7), fontsize=13, color=RGBColor(0x80, 0xA0, 0xC8), align=PP_ALIGN.CENTER) tb(s, "July 2026", Inches(0.6), Inches(6.65), Inches(12), Inches(0.45), fontsize=13, color=RGBColor(0x80, 0xA0, 0xC8), align=PP_ALIGN.CENTER) # ════════════════════════════════════════════════════════════════ # SLIDE 2 – DEFINITION & EPIDEMIOLOGY # ════════════════════════════════════════════════════════════════ s = prs.slides.add_slide(blank) add_slide_bg(s) header_bar(s, "Definition & Epidemiology") tb(s, "GI bleeding is defined as any blood loss from the GI tract, classified by its relation to the Ligament of Treitz.", Inches(0.5), Inches(1.25), Inches(12.3), Inches(0.55), fontsize=15, italic=True, color=MID_NAVY) # Two columns add_rect(s, Inches(0.4), Inches(1.95), Inches(5.9), Inches(4.9), WHITE) add_rect(s, Inches(6.7), Inches(1.95), Inches(6.2), Inches(4.9), WHITE) tb(s, "Upper GI Bleeding (UGIB)", Inches(0.5), Inches(2.05), Inches(5.7), Inches(0.45), fontsize=16, bold=True, color=DARK_RED) bullet_box(s, [ "Bleeding proximal to the Ligament of Treitz", "Incidence: ~100 cases / 100,000 population/year", "Mortality: 5–10% overall", "Most common cause: Peptic ulcer disease (PUD)", "Accounts for 70–80% of all GI bleeding episodes", "Male predominance; increases with age", "NSAIDs & H. pylori are key modifiable risk factors", ], Inches(0.5), Inches(2.55), Inches(5.7), Inches(3.9), fontsize=13) tb(s, "Lower GI Bleeding (LGIB)", Inches(6.8), Inches(2.05), Inches(6.0), Inches(0.45), fontsize=16, bold=True, color=TEAL) bullet_box(s, [ "Bleeding distal to the Ligament of Treitz", "Incidence: ~20 cases / 100,000 population/year", "Majority of patients > 70 years of age", "Most common cause: Diverticulosis (~30% of cases)", "Most episodes (75–80%) stop spontaneously", "Colonic source in 75% of severe hematochezia cases", "Lower mortality than UGIB", ], Inches(6.8), Inches(2.55), Inches(6.0), Inches(3.9), fontsize=13) # ════════════════════════════════════════════════════════════════ # SLIDE 3 – CLASSIFICATION # ════════════════════════════════════════════════════════════════ s = prs.slides.add_slide(blank) add_slide_bg(s) header_bar(s, "Classification of GI Bleeding") cols = [ ("UGIB", DARK_RED, ["Hematemesis", "Coffee-ground emesis", "Melena (tarry stools)", "Hematochezia (massive)"]), ("LGIB", TEAL, ["Hematochezia (bright red / maroon)", "Melena (right-sided lesions)", "Occult blood in stool"]), ("Occult / Obscure", GOLD, ["Positive FOBT without visible bleeding", "Iron deficiency anemia", "Obscure: negative scope x2"]), ] for i, (title, col, items) in enumerate(cols): x = Inches(0.4 + i * 4.3) add_rect(s, x, Inches(1.3), Inches(4.0), Inches(0.5), col) tb(s, title, x + Inches(0.1), Inches(1.35), Inches(3.8), Inches(0.4), fontsize=17, bold=True, color=WHITE) add_rect(s, x, Inches(1.8), Inches(4.0), Inches(4.9), WHITE) bullet_box(s, items, x + Inches(0.15), Inches(1.9), Inches(3.75), Inches(4.5), fontsize=14) tb(s, "Ligament of Treitz = anatomical boundary between UGIB and LGIB", Inches(0.4), Inches(6.85), Inches(12), Inches(0.45), fontsize=12, italic=True, color=MID_NAVY, align=PP_ALIGN.CENTER) # ════════════════════════════════════════════════════════════════ # SLIDE 4 – CAUSES OF UGIB # ════════════════════════════════════════════════════════════════ s = prs.slides.add_slide(blank) add_slide_bg(s) header_bar(s, "Causes of Upper GI Bleeding", "Source: Sabiston Textbook of Surgery, 21st Ed.") left_items = [ ("Peptic Ulcer Disease", "Most common (35–50%). Caused by H. pylori, NSAIDs, stress"), ("Esophageal Varices", "Portal hypertension; mortality 15–20% per episode"), ("Mallory-Weiss Tear", "Mucosal laceration at GEJ after forceful vomiting"), ("Erosive Gastritis / Duodenitis", "NSAIDs, alcohol, physiological stress"), ("Dieulafoy Lesion", "Bleeding dilated vessel without primary ulceration"), ] right_items = [ ("Portal Hypertensive Gastropathy", "Diffuse mucosal oozing in cirrhosis"), ("Gastric Antral Vascular Ectasia", "'Watermelon stomach' – dilated antral vessels"), ("Cameron Lesions", "Bleeding ulcers at hiatal hernia site"), ("Aortoenteric Fistula", "Life-threatening; prior aortic aneurysm repair"), ("Hemobilia / Hemosuccus", "Biliary or pancreatic duct bleeding; rare"), ("Angiodysplasia", "Tortuous mucosal vessels; elderly, renal failure"), ("Upper GI Tumors", "Adenocarcinoma, GIST, lymphoma"), ] add_rect(s, Inches(0.4), Inches(1.3), Inches(6.1), Inches(5.9), WHITE) add_rect(s, Inches(6.8), Inches(1.3), Inches(6.1), Inches(5.9), WHITE) y = Inches(1.4) for title, desc in left_items: tb(s, title, Inches(0.55), y, Inches(5.7), Inches(0.3), fontsize=14, bold=True, color=DARK_RED) tb(s, desc, Inches(0.55), y+Inches(0.28), Inches(5.7), Inches(0.35), fontsize=12, color=CHARCOAL) y += Inches(0.72) y = Inches(1.4) for title, desc in right_items: tb(s, title, Inches(6.95), y, Inches(5.7), Inches(0.3), fontsize=14, bold=True, color=MID_NAVY) tb(s, desc, Inches(6.95), y+Inches(0.28), Inches(5.7), Inches(0.32), fontsize=12, color=CHARCOAL) y += Inches(0.66) # ════════════════════════════════════════════════════════════════ # SLIDE 5 – CAUSES OF LGIB # ════════════════════════════════════════════════════════════════ s = prs.slides.add_slide(blank) add_slide_bg(s) header_bar(s, "Causes of Lower GI Bleeding", "Source: Sleisenger & Fordtran; Sabiston Textbook of Surgery") causes = [ ("Diverticulosis", "~30%", "Most common cause; typically painless; usually self-limiting"), ("Colonic Polyps / Cancer", "~20%", "Altered bowel habits, weight loss, iron-deficiency anaemia"), ("Colitis", "~20%", "IBD, ischaemic, infectious, radiation-induced"), ("Anorectal Disorders", "~20%", "Haemorrhoids, anal fissures, rectal varices"), ("Angiodysplasia", "~10%", "Elderly patients; chronic renal failure; aortic stenosis"), ("Meckel's Diverticulum", "Paediatric", "Ectopic gastric mucosa; painless bright-red rectal bleeding"), ("Small Bowel Tumours", "Rare", "GIST, carcinoid, lymphoma, adenocarcinoma"), ] add_rect(s, Inches(0.4), Inches(1.3), Inches(12.5), Inches(5.9), WHITE) tb(s, "Cause", Inches(0.5), Inches(1.35), Inches(3.5), Inches(0.35), fontsize=14, bold=True, color=TEAL) tb(s, "Frequency", Inches(4.1), Inches(1.35), Inches(1.5), Inches(0.35), fontsize=14, bold=True, color=TEAL) tb(s, "Notes", Inches(5.8), Inches(1.35), Inches(6.9), Inches(0.35), fontsize=14, bold=True, color=TEAL) add_rect(s, Inches(0.4), Inches(1.75), Inches(12.5), Inches(0.04), TEAL) y = Inches(1.85) for cause, freq, note in causes: bg = RGBColor(0xF0, 0xF8, 0xFF) if causes.index((cause,freq,note)) % 2 == 0 else WHITE add_rect(s, Inches(0.4), y-Inches(0.05), Inches(12.5), Inches(0.68), bg) tb(s, cause, Inches(0.55), y, Inches(3.4), Inches(0.55), fontsize=13, bold=True, color=CHARCOAL) tb(s, freq, Inches(4.1), y, Inches(1.5), Inches(0.55), fontsize=13, color=DARK_RED, align=PP_ALIGN.CENTER) tb(s, note, Inches(5.8), y, Inches(6.9), Inches(0.55), fontsize=13, color=CHARCOAL) y += Inches(0.68) # ════════════════════════════════════════════════════════════════ # SLIDE 6 – CLINICAL PRESENTATION # ════════════════════════════════════════════════════════════════ s = prs.slides.add_slide(blank) add_slide_bg(s) header_bar(s, "Clinical Presentation", "Source: Sabiston Textbook of Surgery") add_rect(s, Inches(0.4), Inches(1.3), Inches(12.5), Inches(5.9), WHITE) presentations = [ ("Hematemesis", "Red blood or coffee-ground material; suggests active UGIB proximal to Treitz"), ("Coffee-Ground Emesis", "Digested blood; suggests slower or already stopped UGIB"), ("Melena", "Black, tarry, malodorous stool; requires ≥50 mL blood loss; LR 25 on exam"), ("Hematochezia", "Bright-red/maroon rectal blood; usually LGIB; massive UGIB if hypotensive"), ("Occult Bleeding", "Positive FOBT or iron deficiency anaemia; no visible blood loss"), ("Syncope / Dizziness", "Haemodynamic compromise; significant blood volume loss (>15–30%)"), ] tb(s, "Symptom / Sign", Inches(0.55), Inches(1.38), Inches(3.8), Inches(0.35), fontsize=14, bold=True, color=DARK_RED) tb(s, "Clinical Significance", Inches(4.5), Inches(1.38), Inches(8.2), Inches(0.35), fontsize=14, bold=True, color=DARK_RED) add_rect(s, Inches(0.4), Inches(1.78), Inches(12.5), Inches(0.04), DARK_RED) y = Inches(1.88) for sym, sig in presentations: bg = RGBColor(0xFF, 0xF5, 0xF5) if presentations.index((sym,sig)) % 2 == 0 else WHITE add_rect(s, Inches(0.4), y-Inches(0.05), Inches(12.5), Inches(0.8), bg) tb(s, sym, Inches(0.55), y, Inches(3.8), Inches(0.7), fontsize=14, bold=True, color=CHARCOAL) tb(s, sig, Inches(4.5), y, Inches(8.2), Inches(0.7), fontsize=13, color=CHARCOAL) y += Inches(0.8) # ════════════════════════════════════════════════════════════════ # SLIDE 7 – HAEMODYNAMIC ASSESSMENT # ════════════════════════════════════════════════════════════════ s = prs.slides.add_slide(blank) add_slide_bg(s) header_bar(s, "Haemodynamic Assessment & Shock Classification", "Source: Sabiston Textbook of Surgery, Advanced Trauma Life Support (ATLS)") classes = [ ("Class I", "< 15%", "< 750 mL", "Normal", "Normal", "Normal", RGBColor(0xE8,0xF5,0xE9)), ("Class II", "15–30%", "750–1500 mL", "100–120 bpm", "Normal/Narrowed", "Anxious", RGBColor(0xFFF8E1)), ("Class III","30–40%", "1500–2000 mL","120–140 bpm", "Decreased", "Confused", RGBColor(0xFFE0B2)), ("Class IV", "> 40%", "> 2000 mL", "> 140 bpm", "Markedly decreased","Lethargic", RGBColor(0xFFCDD2)), ] add_rect(s, Inches(0.4), Inches(1.3), Inches(12.5), Inches(5.9), WHITE) headers = ["Class","Blood Loss %","Volume Lost","HR","BP","Mental Status"] widths = [1.2, 1.7, 1.8, 1.6, 2.0, 2.4] x = Inches(0.5) for h, w in zip(headers, widths): add_rect(s, x, Inches(1.35), Inches(w), Inches(0.5), DEEP_NAVY) tb(s, h, x+Inches(0.05), Inches(1.4), Inches(w-0.1), Inches(0.4), fontsize=13, bold=True, color=WHITE) x += Inches(w) y = Inches(1.9) for row in classes: x = Inches(0.5) for j, (cell, w) in enumerate(zip(row[:-1], widths)): add_rect(s, x, y, Inches(w), Inches(1.1), row[-1]) tb(s, cell, x+Inches(0.07), y+Inches(0.3), Inches(w-0.1), Inches(0.5), fontsize=13, bold=(j==0), color=CHARCOAL, align=PP_ALIGN.CENTER) x += Inches(w) y += Inches(1.1) # ════════════════════════════════════════════════════════════════ # SLIDE 8 – RISK SCORING # ════════════════════════════════════════════════════════════════ s = prs.slides.add_slide(blank) add_slide_bg(s) header_bar(s, "Risk Stratification Scores", "Source: Current Surgical Therapy 14e; Schwartz's Principles of Surgery") add_rect(s, Inches(0.4), Inches(1.3), Inches(5.9), Inches(5.9), WHITE) add_rect(s, Inches(6.7), Inches(1.3), Inches(6.2), Inches(5.9), WHITE) tb(s, "Glasgow-Blatchford Score (GBS)", Inches(0.5), Inches(1.38), Inches(5.7), Inches(0.45), fontsize=16, bold=True, color=DARK_RED) tb(s, "Pre-endoscopy. Predicts need for intervention.", Inches(0.5), Inches(1.85), Inches(5.7), Inches(0.35), fontsize=12, italic=True, color=MID_NAVY) gbs_items = [ "Elevated BUN 2–6 points", "Low Haemoglobin 1–6 points", "Low Systolic BP 1–3 points", "Tachycardia HR >100 1 point", "Melena 1 point", "Syncope 2 points", "Liver disease 2 points", "Heart failure 2 points", "Max score = 23", "Score 0 = low risk, safe for outpatient Rx", "Score ≥ 6 = 50% likelihood of needing treatment", ] bullet_box(s, gbs_items, Inches(0.5), Inches(2.25), Inches(5.7), Inches(4.5), fontsize=12) tb(s, "Rockall Score", Inches(6.8), Inches(1.38), Inches(6.0), Inches(0.45), fontsize=16, bold=True, color=MID_NAVY) tb(s, "Post-endoscopy. Predicts mortality & rebleeding.", Inches(6.8), Inches(1.85), Inches(6.0), Inches(0.35), fontsize=12, italic=True, color=MID_NAVY) rock_items = [ "Age (0–2 pts): < 60 = 0 | 60–79 = 1 | ≥ 80 = 2", "Shock (0–2 pts): none=0, pulse>100=1, hypotension=2", "Comorbidity (0–3 pts): none=0; IHD/CCF=2; RF/cirrhosis/metastasis=3", "Endoscopic diagnosis (0–2 pts)", "Endoscopic stigmata of haemorrhage (0–2 pts)", "Max score = 11", "Score 0–1 = 0% mortality", "Score 5 = ~10% mortality", "Score ≥ 8 = ~40% mortality", "Score ≥ 6 = 50% need endoscopic haemostatic therapy", ] bullet_box(s, rock_items, Inches(6.8), Inches(2.25), Inches(6.0), Inches(4.5), fontsize=12) # ════════════════════════════════════════════════════════════════ # SLIDE 9 – INITIAL MANAGEMENT # ════════════════════════════════════════════════════════════════ s = prs.slides.add_slide(blank) add_slide_bg(s) header_bar(s, "Initial Assessment & Resuscitation", "Source: Sabiston Textbook of Surgery; Harrison's Principles of Internal Medicine 22E") steps = [ ("1 AIRWAY / BREATHING", "Elective intubation if ongoing haematemesis, altered consciousness, or respiratory compromise to prevent aspiration"), ("2 IV ACCESS", "Two large-bore (≥18G) peripheral IVs or large-bore central cordis; draw bloods simultaneously"), ("3 LABORATORY TESTS", "FBC, U&E, LFTs, coagulation (INR/PT), type & crossmatch, ABG; ECG in cardiac-risk patients"), ("4 FLUID RESUSCITATION", "IV crystalloid immediately; do NOT delay for ICU transfer. Transfuse if Hb < 7 g/dL (restrictive strategy proven superior)"), ("5 PPI THERAPY", "High-dose IV PPI (e.g., omeprazole 80 mg bolus then 8 mg/hr infusion) reduces rebleeding & length of stay"), ("6 PROKINETIC", "IV erythromycin 250 mg over 20–30 min, 30–90 min before endoscopy – improves gastric visualisation (77% vs 51%)"), ("7 ICU ADMISSION", "Haemodynamic instability, active haematemesis, ongoing haematochezia, or high Rockall/GBS score"), ] add_rect(s, Inches(0.4), Inches(1.3), Inches(12.5), Inches(5.9), WHITE) y = Inches(1.38) for title, detail in steps: add_rect(s, Inches(0.5), y, Inches(2.6), Inches(0.72), DEEP_NAVY) tb(s, title, Inches(0.55), y+Inches(0.18), Inches(2.5), Inches(0.45), fontsize=11, bold=True, color=WHITE) tb(s, detail, Inches(3.25), y+Inches(0.1), Inches(9.5), Inches(0.6), fontsize=12, color=CHARCOAL) y += Inches(0.78) # ════════════════════════════════════════════════════════════════ # SLIDE 10 – TRANSFUSION STRATEGY # ════════════════════════════════════════════════════════════════ s = prs.slides.add_slide(blank) add_slide_bg(s) header_bar(s, "Transfusion Strategy in GI Bleeding", "Source: Sabiston Textbook of Surgery; Goldman-Cecil Medicine") add_rect(s, Inches(0.4), Inches(1.3), Inches(12.5), Inches(5.9), WHITE) bullet_box(s, [ "RESTRICTIVE strategy: Transfuse packed RBCs when Hb < 7 g/dL – associated with lower all-cause mortality and lower rebleeding rates vs liberal strategy", "LIBERAL strategy (Hb threshold 9 g/dL): Not routinely recommended; may be considered in ACS, haemodynamic instability, or active ongoing haemorrhage", "Actively bleeding / haemodynamically unstable patients: Transfuse based on haemodynamic parameters, pace of bleeding, and estimated blood loss – DO NOT wait for serial Hb", "Initial Hb may be NORMAL in acute haemorrhage (whole blood loss; equilibration takes time)", "Monitor Hb every 2–8 hours depending on severity; Hb declines as extravascular fluid re-enters vasculature", "PLATELETS: Transfuse if < 50,000/µL in active bleeding", "FFP / Clotting factors: Correct coagulopathy (target INR < 1.5); Consider Vit K for warfarin reversal", "TXA (Tranexamic acid): Antifibrinolytic; may reduce mortality in selected GI bleed patients", "Withhold anticoagulants / antiplatelets where feasible; discuss benefit-risk for high-thrombotic-risk patients", ], Inches(0.55), Inches(1.45), Inches(12.0), Inches(5.5), fontsize=13) # ════════════════════════════════════════════════════════════════ # SLIDE 11 – ENDOSCOPY: TIMING & ROLE # ════════════════════════════════════════════════════════════════ s = prs.slides.add_slide(blank) add_slide_bg(s) header_bar(s, "Role & Timing of Endoscopy", "Source: Clinical GI Endoscopy 3e; Sleisenger & Fordtran") add_rect(s, Inches(0.4), Inches(1.3), Inches(5.8), Inches(5.9), WHITE) add_rect(s, Inches(6.65), Inches(1.3), Inches(6.25), Inches(5.9), WHITE) tb(s, "Upper GI Endoscopy (EGD)", Inches(0.5), Inches(1.4), Inches(5.6), Inches(0.4), fontsize=16, bold=True, color=DARK_RED) bullet_box(s, [ "Gold standard diagnostic & therapeutic tool for UGIB", "Should be performed within 24 hours of presentation", "URGENT EGD (within 12 h): haemodynamic instability, active haematemesis, suspected varices", "Allows diagnosis in > 95% of cases", "Therapeutic options: injection (adrenaline), thermal coagulation, haemoclips, banding", "Pre-EGD erythromycin improves gastric visualisation", "NG lavage before EGD no longer routinely recommended", "Second-look EGD NOT routinely recommended", ], Inches(0.5), Inches(1.88), Inches(5.6), Inches(4.7), fontsize=12) tb(s, "Colonoscopy for LGIB", Inches(6.75), Inches(1.4), Inches(6.0), Inches(0.4), fontsize=16, bold=True, color=TEAL) bullet_box(s, [ "Test of choice for haemodynamically stable LGIB", "Perform after PEG bowel prep (4–6 L polyethylene glycol)", "Next-available basis: no difference in outcomes vs <24h", "Diagnostic yield 45–90%; combined with enteroscopy → 95%", "Panendoscopy first: cirrhosis, prior melena/haematemesis, PUD history", "Capsule endoscopy: obscure GI bleeding, capsule in ER for UGIB triage", "Push enteroscopy or DBE for mid-GI (small bowel) sources", ], Inches(6.75), Inches(1.88), Inches(6.0), Inches(4.7), fontsize=12) # ════════════════════════════════════════════════════════════════ # SLIDE 12 – FORREST CLASSIFICATION # ════════════════════════════════════════════════════════════════ s = prs.slides.add_slide(blank) add_slide_bg(s) header_bar(s, "Forrest Classification of Peptic Ulcer Stigmata", "Source: Clinical GI Endoscopy 3e (Table 14.3 & 14.4)") rows = [ ("IA", "Spurting arterial bleeding", "10%", "90%", DARK_RED, "REQUIRED"), ("IB", "Oozing vessel", "10%", "10–20%", RGBColor(0xE05C00), "REQUIRED"), ("IIA", "Non-bleeding visible vessel (NBVV)","25%", "50%", RGBColor(0xB87800), "REQUIRED"), ("IIB", "Adherent clot", "10%", "25–30%", RGBColor(0x5C7C00), "CONSIDER"), ("IIC", "Flat pigmented base", "10%", "7–10%", TEAL, "NOT required"), ("III", "Clean-based ulcer", "35%", "3–5%", RGBColor(0x2E7D32), "NOT required"), ] add_rect(s, Inches(0.4), Inches(1.3), Inches(12.5), Inches(5.9), WHITE) hdrs = ["Forrest", "Endoscopic Appearance", "Frequency", "Rebleed Risk", "Endoscopic Therapy"] xpos = [0.5, 1.85, 6.2, 7.8, 9.6] wids = [1.3, 4.25, 1.5, 1.7, 2.7] add_rect(s, Inches(0.4), Inches(1.35), Inches(12.5), Inches(0.5), DEEP_NAVY) for h, x, w in zip(hdrs, xpos, wids): tb(s, h, Inches(x), Inches(1.4), Inches(w), Inches(0.4), fontsize=13, bold=True, color=WHITE) y = Inches(1.9) for f_class, desc, freq, risk, col, therapy in rows: bg = RGBColor(0xFAFAFA) if rows.index((f_class,desc,freq,risk,col,therapy)) % 2 == 0 else WHITE add_rect(s, Inches(0.4), y, Inches(12.5), Inches(0.85), bg) add_rect(s, Inches(0.4), y, Inches(0.12), Inches(0.85), col) vals = [f_class, desc, freq, risk, therapy] for val, x, w in zip(vals, xpos, wids): tb(s, val, Inches(x), y+Inches(0.22), Inches(w), Inches(0.45), fontsize=13, bold=(val==therapy), color=(DARK_RED if val==therapy else CHARCOAL)) y += Inches(0.85) # ════════════════════════════════════════════════════════════════ # SLIDE 13 – ENDOSCOPIC TREATMENT MODALITIES # ════════════════════════════════════════════════════════════════ s = prs.slides.add_slide(blank) add_slide_bg(s) header_bar(s, "Endoscopic Haemostasis Techniques", "Source: Clinical GI Endoscopy 3e; Sleisenger & Fordtran") modalities = [ ("Injection Therapy", DARK_RED, ["Dilute epinephrine (1:10,000) – causes vasoconstriction and tamponade", "Sclerosants (absolute alcohol, ethanolamine) – tissue necrosis", "Thrombin / fibrin glue – promotes clot formation", "Epinephrine alone is insufficient; combine with thermal/mechanical"]), ("Thermal Coagulation", MID_NAVY, ["Bipolar/multipolar electrocoagulation (BICAP) – direct tissue coagulation", "Heater probe – direct heat + compression", "Argon plasma coagulation (APC) – non-contact; ideal for GAVE & angiodysplasia", "Laser photocoagulation – less commonly used"]), ("Mechanical Methods", TEAL, ["Haemoclips – ideal for exposed vessel; excellent for Dieulafoy lesions", "Rubber band ligation – standard for oesophageal varices", "Over-the-scope clip (OTSC) – refractory / difficult lesions", "Suturing devices – emerging technology"]), ("Combination Therapy", GOLD, ["Epinephrine + thermal or clip – superior to monotherapy", "Recommended for Forrest IA, IB, IIA lesions", "Rebleeding after 2 endoscopic attempts → surgery or IR", "Haemostatic powder (TC-325/Hemospray) – bridging therapy"]), ] for i, (title, col, items) in enumerate(modalities): row, c2 = divmod(i, 2) x = Inches(0.4 + c2 * 6.5) y2 = Inches(1.3 + row * 3.1) add_rect(s, x, y2, Inches(6.1), Inches(0.42), col) tb(s, title, x+Inches(0.12), y2+Inches(0.07), Inches(5.9), Inches(0.35), fontsize=15, bold=True, color=WHITE) add_rect(s, x, y2+Inches(0.42), Inches(6.1), Inches(2.55), WHITE) bullet_box(s, items, x+Inches(0.12), y2+Inches(0.5), Inches(5.85), Inches(2.3), fontsize=12) # ════════════════════════════════════════════════════════════════ # SLIDE 14 – VARICEAL BLEEDING # ════════════════════════════════════════════════════════════════ s = prs.slides.add_slide(blank) add_slide_bg(s) header_bar(s, "Variceal Haemorrhage", "Source: Sabiston Textbook of Surgery; Sleisenger & Fordtran") add_rect(s, Inches(0.4), Inches(1.3), Inches(12.5), Inches(5.9), WHITE) bullet_box(s, [ "PATHOPHYSIOLOGY: Portal hypertension (portal pressure > 12 mmHg) → oesophageal/gastric varix formation", "PRESENTATION: Massive haematemesis ± haematochezia; signs of liver disease (jaundice, ascites, spider naevi)", "FIRST-LINE (Medical): IV terlipressin or octreotide (reduces portal pressure); IV antibiotics (norfloxacin/ceftriaxone) reduce infection and improve survival", "FIRST-LINE (Endoscopic): Oesophageal variceal ligation (EVL) is preferred over sclerotherapy – lower rebleeding, fewer complications", "BALLOON TAMPONADE (Sengstaken-Blakemore tube): Emergency temporising measure when endoscopy fails; 50% rebleed on deflation", "RESCUE THERAPY: Transjugular Intrahepatic Portosystemic Shunt (TIPS) – preferred surgical alternative in cirrhosis; reduces portal pressure", "SURGICAL SHUNTS: Portocaval, mesocaval, central splenorenal, or selective distal splenorenal (Warren) shunt", "NON-SHUNT SURGERY: Sugiura procedure – paraesophageal devascularisation + oesophageal transection", "PRIMARY PROPHYLAXIS: Non-selective beta-blockers (propranolol/nadolol) ± EVL for high-risk varices", "SECONDARY PROPHYLAXIS: EVL + NSBB (combination superior to either alone)", "MORTALITY: 15–20% per acute episode; 6-week mortality up to 40% in decompensated cirrhosis", ], Inches(0.55), Inches(1.45), Inches(12.0), Inches(5.5), fontsize=12) # ════════════════════════════════════════════════════════════════ # SLIDE 15 – PEPTIC ULCER MANAGEMENT # ════════════════════════════════════════════════════════════════ s = prs.slides.add_slide(blank) add_slide_bg(s) header_bar(s, "Peptic Ulcer Bleeding: Medical & Surgical Management", "Source: Sabiston Textbook of Surgery; Current Surgical Therapy 14e") add_rect(s, Inches(0.4), Inches(1.3), Inches(12.5), Inches(5.9), WHITE) tb(s, "Medical / Endoscopic Management", Inches(0.55), Inches(1.4), Inches(6.0), Inches(0.4), fontsize=15, bold=True, color=DARK_RED) bullet_box(s, [ "IV PPI bolus (80 mg) then continuous infusion (8 mg/hr x 72h) – reduces rebleeding; stabilises clots", "IV erythromycin pre-EGD – improves gastric visualisation", "H. pylori eradication essential after acute episode to prevent recurrence", "75% of peptic ulcer bleeds stop spontaneously with acid suppression alone", "Rebleeding: 25% will continue/rebleed; higher risk with large ulcers, posterior duodenal wall location", "Repeat endoscopy for rebleeding; surgery after 2 failed endoscopic attempts", "Surgery threshold: haemodynamic instability + > 6 units RBC transfusion", ], Inches(0.55), Inches(1.88), Inches(5.85), Inches(3.6), fontsize=12) tb(s, "Surgical Management", Inches(0.55), Inches(5.5), Inches(6.0), Inches(0.4), fontsize=15, bold=True, color=MID_NAVY) bullet_box(s, [ "BLEEDING DUODENAL ULCER: Anterior longitudinal duodenotomy → figure-of-eight ligation of GDA ± Heineke-Mikulicz pyloroplasty + truncal vagotomy", "BLEEDING GASTRIC ULCER: Wedge excision + primary closure; distal gastrectomy (Billroth I or II / Roux-en-Y) for lesser curve/incisura ulcers", "RESECTION: Lower rebleeding but higher morbidity (duodenal leaks); reserved for high-risk recurrent bleeding", ], Inches(0.55), Inches(5.95), Inches(5.85), Inches(1.2), fontsize=12) # ════════════════════════════════════════════════════════════════ # SLIDE 16 – LGIB MANAGEMENT ALGORITHM # ════════════════════════════════════════════════════════════════ s = prs.slides.add_slide(blank) add_slide_bg(s) header_bar(s, "Lower GI Bleeding: Management Approach", "Source: Sabiston Textbook of Surgery; Sleisenger & Fordtran") steps_lgib = [ ("STEP 1", "Resuscitate", "IV access, fluid resuscitation, blood transfusion if Hb < 7 g/dL; ICU if unstable"), ("STEP 2", "Exclude UGIB", "Massive haematochezia: EGD first to exclude upper source (15% of severe haematochezia is UGIB)"), ("STEP 3", "Colonoscopy", "After PEG prep; diagnostic yield 45–90%; therapeutic in active bleeding (clips, APC, epinephrine)"), ("STEP 4", "CT Angiography", "Active bleeding ≥ 0.3 mL/min; localises source before IR or surgery; rapid, widely available"), ("STEP 5", "Angiography / Embolisation", "Detects bleeding ≥ 1 mL/min; super-selective embolisation 80–90% success; risk of ischaemia"), ("STEP 6", "Radionuclide Scan", "99mTc-labelled RBC scan – detects bleeding as low as 0.1 mL/min; guides angiography localisation"), ("STEP 7", "Surgery", "Persistent/recurrent bleeding after 2 failed endoscopic/IR attempts; segmental colectomy if source localised; subtotal colectomy if unlocalized"), ] x_step = Inches(0.4) x_title = Inches(1.6) x_desc = Inches(3.5) y = Inches(1.35) for step, title, desc in steps_lgib: add_rect(s, x_step, y, Inches(1.1), Inches(0.72), TEAL) tb(s, step, x_step+Inches(0.05), y+Inches(0.18), Inches(1.0), Inches(0.38), fontsize=11, bold=True, color=WHITE, align=PP_ALIGN.CENTER) tb(s, title, x_title, y+Inches(0.18), Inches(1.8), Inches(0.38), fontsize=13, bold=True, color=TEAL) tb(s, desc, x_desc, y+Inches(0.1), Inches(9.6), Inches(0.55), fontsize=12, color=CHARCOAL) y += Inches(0.8) # ════════════════════════════════════════════════════════════════ # SLIDE 17 – DIVERTICULAR BLEEDING # ════════════════════════════════════════════════════════════════ s = prs.slides.add_slide(blank) add_slide_bg(s) header_bar(s, "Diverticular Bleeding", "Source: Sleisenger & Fordtran; Sabiston Textbook of Surgery") add_rect(s, Inches(0.4), Inches(1.3), Inches(12.5), Inches(5.9), WHITE) bullet_box(s, [ "Most common cause of acute LGIB (~30% of cases)", "Pathophysiology: Vasa recta arterial rupture at dome of diverticulum → painless bright-red per rectal bleeding", "Risk factors: Age > 60 years; NSAIDs; aspirin; low-fibre diet; constipation", "Presentation: Sudden onset, massive, PAINLESS haematochezia; often right-sided diverticula bleed despite left-sided prevalence", "Natural history: 75–80% stop spontaneously; 25% rebleed; 5% require urgent intervention", "Diagnosis: Urgent colonoscopy (after PEG prep); CTA if unstable; radionuclide scan for intermittent bleeding", "Endoscopic treatment: Haemoclips or band ligation for actively bleeding diverticulum", "Angiography / Embolisation: When colonoscopy fails or patient unstable; 80–90% success; ischaemic colitis risk", "Surgery: Segmental colectomy (right/left hemicolectomy) when source confirmed; subtotal colectomy if unlocalized; high re-operation risk if wrong segment resected", "Prevention of recurrence: High-fibre diet; avoid NSAIDs; elective colectomy considered after multiple recurrences", ], Inches(0.55), Inches(1.45), Inches(12.0), Inches(5.5), fontsize=13) # ════════════════════════════════════════════════════════════════ # SLIDE 18 – ANGIOGRAPHY & RADIONUCLIDE # ════════════════════════════════════════════════════════════════ s = prs.slides.add_slide(blank) add_slide_bg(s) header_bar(s, "Angiography & Nuclear Imaging in GI Bleeding", "Source: Yamada's Textbook of Gastroenterology; Sabiston Textbook of Surgery") add_rect(s, Inches(0.4), Inches(1.3), Inches(6.1), Inches(5.9), WHITE) add_rect(s, Inches(6.7), Inches(1.3), Inches(6.2), Inches(5.9), WHITE) tb(s, "CT Angiography (CTA)", Inches(0.5), Inches(1.4), Inches(5.7), Inches(0.4), fontsize=15, bold=True, color=DARK_RED) bullet_box(s, [ "Detects active bleeding ≥ 0.3–0.5 mL/min", "Non-invasive; rapid; widely available", "Sensitivity 85–90% for active bleeding", "Guides subsequent angiographic embolisation", "Contraindication: renal impairment (contrast)", "Preferred first-line in haemodynamically stable LGIB if colonoscopy unavailable", "Identifies extravasation of contrast into bowel lumen", ], Inches(0.5), Inches(1.9), Inches(5.7), Inches(3.5), fontsize=12) tb(s, "Conventional Angiography + Embolisation", Inches(0.5), Inches(5.35), Inches(5.7), Inches(0.4), fontsize=14, bold=True, color=MID_NAVY) bullet_box(s, [ "Detects bleeding ≥ 1 mL/min", "Super-selective embolisation → 80–90% haemostasis", "Risk: bowel ischaemia, renal impairment", ], Inches(0.5), Inches(5.8), Inches(5.7), Inches(1.2), fontsize=12) tb(s, "99mTc-RBC Scintigraphy (Nuclear Scan)", Inches(6.8), Inches(1.4), Inches(6.0), Inches(0.4), fontsize=15, bold=True, color=TEAL) bullet_box(s, [ "Most sensitive: detects bleeding ≥ 0.1 mL/min", "In-vitro kit labelling (>95% efficiency) is preferred", "Sequential 2-min images acquired for 90 minutes", "Visualises extravasation of radiolabelled RBCs into bowel", "Anatomical localisation less precise than CTA/angiography", "Primary use: intermittent LGIB to guide angiography", "Positive scan guides timing of angiography – reduces negative angiography rate", "Free Tc-99m can mimic bleeding in stomach (label quality critical)", ], Inches(6.8), Inches(1.9), Inches(6.0), Inches(5.0), fontsize=12) # ════════════════════════════════════════════════════════════════ # SLIDE 19 – OBSCURE GI BLEEDING # ════════════════════════════════════════════════════════════════ s = prs.slides.add_slide(blank) add_slide_bg(s) header_bar(s, "Obscure & Occult GI Bleeding", "Source: Harrison's Principles of Internal Medicine 22E; Yamada's Textbook of Gastroenterology") add_rect(s, Inches(0.4), Inches(1.3), Inches(12.5), Inches(5.9), WHITE) tb(s, "Occult Bleeding", Inches(0.5), Inches(1.4), Inches(4.0), Inches(0.4), fontsize=15, bold=True, color=DARK_RED) tb(s, "Obscure Bleeding", Inches(4.8), Inches(1.4), Inches(4.0), Inches(0.4), fontsize=15, bold=True, color=MID_NAVY) tb(s, "Investigation Ladder", Inches(9.1), Inches(1.4), Inches(3.6), Inches(0.4), fontsize=15, bold=True, color=TEAL) add_rect(s, Inches(0.4), Inches(1.85), Inches(12.5), Inches(0.03), RGBColor(0xDD,0xDD,0xDD)) bullet_box(s, [ "Positive faecal occult blood test (FOBT) or guaiac-based test", "Iron-deficiency anaemia without visible blood loss", "No gross haematochezia or melaena", "Causes: CRC (especially right-sided), polyps, gastric cancer, oesophagitis, angiodysplasia", "Screening with colonoscopy and EGD is first step", ], Inches(0.5), Inches(1.95), Inches(4.1), Inches(3.5), fontsize=12) bullet_box(s, [ "Persistent / recurrent bleeding despite negative EGD and colonoscopy", "Represents ~ 5% of all GI bleeds", "Most common source: Small bowel (angiodysplasia, Meckel's, NSAID enteropathy, tumours, Crohn's)", "Key investigation: Capsule endoscopy", "Push enteroscopy / DBE for biopsy or therapy", "Intraoperative enteroscopy: last resort", ], Inches(4.8), Inches(1.95), Inches(4.1), Inches(3.5), fontsize=12) bullet_box(s, [ "1st: Repeat EGD + Colonoscopy", "2nd: Capsule endoscopy", "3rd: CTA / Angiography", "4th: Push enteroscopy", "5th: DBE (device-assisted enteroscopy)", "6th: Intraoperative enteroscopy", ], Inches(9.1), Inches(1.95), Inches(3.5), Inches(3.5), fontsize=12) tb(s, "Small bowel causes of obscure bleeding: Angiodysplasia (#1) > NSAID ulcers > Meckel's diverticulum > Crohn's disease > Tumours (GIST, carcinoid, lymphoma)", Inches(0.5), Inches(5.5), Inches(12.0), Inches(1.5), fontsize=13, italic=True, color=MID_NAVY) # ════════════════════════════════════════════════════════════════ # SLIDE 20 – SPECIAL CIRCUMSTANCES # ════════════════════════════════════════════════════════════════ s = prs.slides.add_slide(blank) add_slide_bg(s) header_bar(s, "GI Bleeding in Special Circumstances", "Source: Sleisenger & Fordtran; Sabiston Textbook of Surgery") add_rect(s, Inches(0.4), Inches(1.3), Inches(12.5), Inches(5.9), WHITE) groups = [ ("Anticoagulated Patients", "Reverse anticoagulation (Vit K, PCC for warfarin; idarucizumab for dabigatran; andexanet alfa for Xa inhibitors); restart anticoagulation ASAP after haemostasis (48–72h)"), ("Cirrhosis / Portal HTN", "Combine terlipressin + EVL + prophylactic antibiotics; TIPS for refractory bleeding; 6-week mortality up to 40% in decompensated cirrhosis"), ("Post-surgical Bleeding", "Post-polypectomy, post-sphincterotomy, anastomotic bleeds; return to endoscopy first; angiography or re-operation if refractory"), ("Aortoenteric Fistula", "Prior aortic graft repair + GI bleed = aortoenteric fistula until proven otherwise; 'herald bleed' before exsanguination; urgent CT aortography then surgery"), ("Dieulafoy Lesion", "Calibre-persistent submucosal artery without ulceration; typically in proximal stomach; diagnosis by endoscopy during active bleed; clips or band ligation"), ("GAVE (Watermelon Stomach)", "Gastric antral vascular ectasia; striped antral pattern; associated with cirrhosis, autoimmune disease; APC is treatment of choice"), ("Meckel's Diverticulum", "Ectopic gastric mucosa → ectopic acid production → ulceration; painless bright-red rectal bleeding in paediatric patients; 99mTc-pertechnetate scan; surgical diverticulectomy"), ] y = Inches(1.4) for title, detail in groups: add_rect(s, Inches(0.5), y, Inches(3.1), Inches(0.72), DEEP_NAVY) tb(s, title, Inches(0.55), y+Inches(0.18), Inches(3.0), Inches(0.38), fontsize=11, bold=True, color=WHITE) tb(s, detail, Inches(3.75), y+Inches(0.1), Inches(9.0), Inches(0.55), fontsize=12, color=CHARCOAL) y += Inches(0.8) # ════════════════════════════════════════════════════════════════ # SLIDE 21 – SURGICAL INDICATIONS # ════════════════════════════════════════════════════════════════ s = prs.slides.add_slide(blank) add_slide_bg(s) header_bar(s, "Surgical Indications in GI Bleeding", "Source: Sabiston Textbook of Surgery; Current Surgical Therapy 14e") add_rect(s, Inches(0.4), Inches(1.3), Inches(5.8), Inches(5.9), WHITE) add_rect(s, Inches(6.65), Inches(1.3), Inches(6.25), Inches(5.9), WHITE) tb(s, "Indications for Surgery (UGIB)", Inches(0.5), Inches(1.4), Inches(5.6), Inches(0.4), fontsize=15, bold=True, color=DARK_RED) bullet_box(s, [ "Failure of endoscopic haemostasis x2", "Haemodynamic instability despite aggressive resuscitation", "Transfusion requirement > 6 units RBC in 24 hours", "Persistent or recurrent bleeding after IR embolisation", "Ulcer on posterior duodenal wall eroding GDA (high risk)", "Perforated peptic ulcer with haemorrhage", "Malignancy requiring oncological resection", "Rebleeding with predicted postoperative mortality < risk of rebleeding", ], Inches(0.5), Inches(1.9), Inches(5.6), Inches(4.7), fontsize=12) tb(s, "Indications for Surgery (LGIB)", Inches(6.75), Inches(1.4), Inches(6.0), Inches(0.4), fontsize=15, bold=True, color=TEAL) bullet_box(s, [ "Failure of colonoscopic haemostasis", "Failure of IR angioembolisation", "Requirement for > 6 units RBC transfusion", "Haemodynamic instability not responding to resuscitation", "Rebleeding (2+ episodes requiring hospitalisation)", "Source clearly localised → segmental resection preferred", "Unlocalized source in emergency → subtotal colectomy", "Concurrent malignancy requiring resection", ], Inches(6.75), Inches(1.9), Inches(6.0), Inches(4.7), fontsize=12) # ════════════════════════════════════════════════════════════════ # SLIDE 22 – PROGNOSIS & PREVENTION # ════════════════════════════════════════════════════════════════ s = prs.slides.add_slide(blank) add_slide_bg(s) header_bar(s, "Prognosis & Prevention of GI Bleeding", "Source: Harrison's Principles of Internal Medicine 22E; Sleisenger & Fordtran") add_rect(s, Inches(0.4), Inches(1.3), Inches(12.5), Inches(5.9), WHITE) tb(s, "Prognostic Indicators", Inches(0.5), Inches(1.42), Inches(5.7), Inches(0.4), fontsize=15, bold=True, color=DARK_RED) bullet_box(s, [ "Overall UGIB mortality: 5–10%; higher in elderly + comorbidities", "Variceal bleeding: 6-week mortality up to 40% (decompensated cirrhosis)", "Rockall ≥ 8: ~40% mortality; Score 0–1: 0% mortality", "High-risk endoscopic stigmata (Forrest IA): 90% rebleeding without treatment", "Predictors of poor outcome: shock, haematemesis, posterior duodenal ulcers, early rebleeding, failed first endoscopy, age > 80 years, serious comorbidities", ], Inches(0.5), Inches(1.9), Inches(5.7), Inches(2.5), fontsize=12) tb(s, "Prevention Strategies", Inches(0.5), Inches(4.5), Inches(5.7), Inches(0.4), fontsize=15, bold=True, color=MID_NAVY) bullet_box(s, [ "H. pylori eradication: reduces PUD recurrence from 70% to < 5%", "PPIs with NSAIDs / aspirin: co-prescribe in high-risk patients", "Beta-blockers + EVL: primary prophylaxis for oesophageal varices", "High-fibre diet + hydration: reduces diverticular bleeding recurrence", ], Inches(0.5), Inches(4.98), Inches(5.7), Inches(2.0), fontsize=12) tb(s, "Key Management Pearls", Inches(6.65), Inches(1.42), Inches(6.0), Inches(0.4), fontsize=15, bold=True, color=TEAL) bullet_box(s, [ "Always consider UGIB first in massive haematochezia (15% are upper source)", "Restrictive transfusion (Hb < 7 g/dL) reduces mortality – avoid over-transfusion", "EGD within 24h is standard; within 12h for haemodynamic instability", "IV PPI before endoscopy reduces high-risk stigmata and need for intervention", "Never use barium studies in acute GI bleeding (interferes with endoscopy/angiography)", "Re-endoscopy after rebleeding before deciding on surgery", "Involve surgery early in high-risk or refractory bleeding", "Correct coagulopathy (INR, platelets) before / alongside endoscopy", "Post-discharge: confirm H. pylori eradication; stop causative medications", ], Inches(6.65), Inches(1.9), Inches(6.0), Inches(5.0), fontsize=12) # ════════════════════════════════════════════════════════════════ # SLIDE 23 – REFERENCES # ════════════════════════════════════════════════════════════════ s = prs.slides.add_slide(blank) add_slide_bg(s) header_bar(s, "References") add_rect(s, Inches(0.4), Inches(1.3), Inches(12.5), Inches(5.9), WHITE) refs = [ "1. Sabiston Textbook of Surgery: The Biological Basis of Modern Surgical Practice, 21st Edition (Elsevier). Chapter 98: Gastrointestinal Bleeding.", "2. Sleisenger and Fordtran's Gastrointestinal and Liver Disease, 11th Edition (Elsevier). Chapter 20: Gastrointestinal Bleeding.", "3. Yamada's Textbook of Gastroenterology, 7th Edition (Wiley-Blackwell). Chapters on GI Bleeding & Nuclear Imaging.", "4. Harrison's Principles of Internal Medicine, 22nd Edition (McGraw-Hill, 2025). Chapter: Gastrointestinal Bleeding.", "5. Clinical Gastrointestinal Endoscopy, Expert Consult, 3rd Edition (Elsevier). Chapter 14: Endoscopic Therapy for Gastroduodenal Ulcers; Forrest Classification Tables 14.3 & 14.4.", "6. Current Surgical Therapy, 14th Edition (Elsevier). Chapter: Upper GI Bleeding; Box 2: Risk Stratification Scores.", "7. Goldman-Cecil Medicine, International Edition (Elsevier). Chapter: Gastrointestinal Bleeding.", "8. Textbook of Family Medicine, 9th Edition (Elsevier). Chapters: Upper and Lower GI Bleeding.", "9. Rosen's Emergency Medicine: Concepts and Clinical Practice, 10th Edition (Elsevier). Chapter: Gastrointestinal Bleeding.", "10. Schwartz's Principles of Surgery, 11th Edition (McGraw-Hill). Chapter 26: Peptic Ulcer Disease; Rockall Score Table 26-9.", ] y = Inches(1.45) for ref in refs: tb(s, ref, Inches(0.55), y, Inches(12.0), Inches(0.48), fontsize=11, color=CHARCOAL) y += Inches(0.5) # ════════════════════════════════════════════════════════════════ # SAVE # ════════════════════════════════════════════════════════════════ out_path = "/tmp/workspace/gi-bleed-ppt/GI_Bleed_Comprehensive.pptx" buf = BytesIO() prs.save(buf) with open(out_path, "wb") as f: f.write(buf.getvalue()) print(f"Saved to {out_path}") print(f"Total slides: {len(prs.slides)}") PYEOF echo "Script written."
cd /tmp/workspace/gi-bleed-ppt && python build.py 2>&1
~/gi-bleed-ppt/build.py
Error: String ' srgb.set('val', '%02X%02X%02X' % (color.red, color.green, color.blue))' appears multiple times. Use replace_all=True to replace all occurrences.python3 -c "from pptx.dml.color import RGBColor; c = RGBColor(0x0D, 0x27, 0x4A); print(type(c)); print(dir(c))"
sed -i "s/'%02X%02X%02X' % (color\.red, color\.green, color\.blue)/'%02X%02X%02X' % (color[0], color[1], color[2])/g" /tmp/workspace/gi-bleed-ppt/build.py && grep "color\[0\]" /tmp/workspace/gi-bleed-ppt/build.py | head -3
cd /tmp/workspace/gi-bleed-ppt && python build.py 2>&1
cd /tmp/workspace/gi-bleed-ppt && python3 -c " from pptx.dml.color import RGBColor # RGBColor takes 3 separate args c = RGBColor(0xFF, 0xF8, 0xE1) print('OK', c) "
grep -n "RGBColor(0x[0-9A-Fa-f]\{6\})" /tmp/workspace/gi-bleed-ppt/build.py | head -20
cd /tmp/workspace/gi-bleed-ppt && python3 - << 'EOF' import re with open("build.py", "r") as f: content = f.read() def fix_rgb(m): val = int(m.group(1), 16) r = (val >> 16) & 0xFF g = (val >> 8) & 0xFF b = val & 0xFF return f"RGBColor(0x{r:02X}, 0x{g:02X}, 0x{b:02X})" # Fix 6-digit hex RGB in RGBColor() calls content = re.sub(r'RGBColor\(0x([0-9A-Fa-f]{5,6})\)', fix_rgb, content) with open("build.py", "w") as f: f.write(content) print("Fixed.") EOF
cd /tmp/workspace/gi-bleed-ppt && python build.py 2>&1
GI Bleed Comprehensive
Presentation · PPTX
| # | Slide Title |
|---|---|
| 1 | Title Slide - Gastrointestinal Bleeding: A Comprehensive Clinical Review |
| 2 | Definition & Epidemiology - UGIB vs LGIB incidence, mortality, demographics |
| 3 | Classification - UGIB / LGIB / Occult / Obscure with Ligament of Treitz landmark |
| 4 | Causes of Upper GI Bleeding - PUD, varices, Mallory-Weiss, Dieulafoy, GAVE, aortoenteric fistula |
| 5 | Causes of Lower GI Bleeding - Table with frequency % (diverticulosis #1, polyps/cancer, colitis, anorectal) |
| 6 | Clinical Presentation - Haematemesis, melena, haematochezia, occult - with LR values |
| 7 | Haemodynamic Assessment / ATLS Shock Classes - Full 4-class table (volume lost, HR, BP, mental status) |
| 8 | Risk Stratification - Glasgow-Blatchford Score + Rockall Score side-by-side |
| 9 | Initial Assessment & Resuscitation - 7-step protocol (airway, IV access, labs, fluids, PPI, prokinetics, ICU) |
| 10 | Transfusion Strategy - Restrictive vs liberal, platelets, FFP, TXA, anticoagulant reversal |
| 11 | Role & Timing of Endoscopy - EGD + Colonoscopy: timing, indications, diagnostic yield |
| 12 | Forrest Classification - Full table (IA to III) with rebleeding rates and therapy recommendations |
| 13 | Endoscopic Haemostasis Techniques - Injection, thermal, mechanical, combination |
| 14 | Variceal Haemorrhage - EVL, terlipressin, TIPS, surgical shunts, Sugiura, prophylaxis |
| 15 | Peptic Ulcer Management - Medical/endoscopic + surgical (GDA ligation, pyloroplasty, vagotomy) |
| 16 | Lower GI Bleeding Algorithm - 7-step management pathway |
| 17 | Diverticular Bleeding - Pathophysiology, natural history, treatment ladder |
| 18 | Angiography & Nuclear Imaging - CTA, conventional angiography, 99mTc-RBC scintigraphy |
| 19 | Obscure & Occult GI Bleeding - Definitions, investigation ladder, small bowel causes |
| 20 | Special Circumstances - Anticoagulated patients, aortoenteric fistula, Dieulafoy, GAVE, Meckel's |
| 21 | Surgical Indications - UGIB and LGIB surgery criteria |
| 22 | Prognosis, Prevention & Key Pearls - Mortality predictors, H. pylori eradication, beta-blockers |
| 23 | References - 10 standard textbooks cited |