| Type | Source |
|---|---|
| Primary | Monomicrobial, extraperitoneal source, blood spread |
| Secondary | Most common, polymicrobial, intraperitoneal source |
| Tertiary | Due to superadded infection following treatment of secondary/primary |
Create a study guide PDF comparing primary vs secondary vs tertiary peritonitis
ls -la /tmp/workspace/ 2>/dev/null || mkdir -p /tmp/workspace && echo "workspace ready"
mkdir -p /tmp/workspace/peritonitis-guide && python3 << 'PYEOF' from reportlab.lib.pagesizes import A4 from reportlab.lib import colors from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.lib.units import cm, mm from reportlab.platypus import (SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, HRFlowable, KeepTogether, PageBreak) from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY from reportlab.platypus import flowables OUTPUT = "/tmp/workspace/peritonitis-guide/Peritonitis_Study_Guide.pdf" doc = SimpleDocTemplate( OUTPUT, pagesize=A4, leftMargin=1.8*cm, rightMargin=1.8*cm, topMargin=2*cm, bottomMargin=2*cm, title="Peritonitis Study Guide", author="SRB's Manual of Surgery - Ch. 32", ) W, H = A4 # ── Colour palette ────────────────────────────────────────────────────────── C_PRIMARY = colors.HexColor("#1A5276") # deep blue C_SECONDARY = colors.HexColor("#196F3D") # deep green C_TERTIARY = colors.HexColor("#7B241C") # deep red C_ACCENT = colors.HexColor("#2E4057") # dark slate C_LIGHT_BLUE = colors.HexColor("#D6EAF8") C_LIGHT_GRN = colors.HexColor("#D5F5E3") C_LIGHT_RED = colors.HexColor("#FADBD8") C_YELLOW = colors.HexColor("#FEF9E7") C_GREY_BG = colors.HexColor("#F2F3F4") C_HEADER_BG = colors.HexColor("#1A1A2E") C_WHITE = colors.white C_BLACK = colors.HexColor("#1C1C1C") C_MID_GREY = colors.HexColor("#707B7C") # ── Styles ─────────────────────────────────────────────────────────────────── ss = getSampleStyleSheet() def style(name, parent="Normal", **kw): s = ParagraphStyle(name, parent=ss[parent], **kw) return s S_TITLE = style("Title2", fontSize=24, leading=28, textColor=C_WHITE, alignment=TA_CENTER, fontName="Helvetica-Bold", spaceAfter=4) S_SUBTITLE = style("Subtitle2", fontSize=12, leading=16, textColor=colors.HexColor("#AED6F1"), alignment=TA_CENTER, fontName="Helvetica", spaceAfter=6) S_SOURCE = style("Source", fontSize=9, leading=12, textColor=colors.HexColor("#85C1E9"), alignment=TA_CENTER, fontName="Helvetica-Oblique") S_SECTION = style("Section", fontSize=14, leading=18, textColor=C_WHITE, fontName="Helvetica-Bold", alignment=TA_CENTER, spaceAfter=2) S_H2 = style("H2", fontSize=11, leading=14, textColor=C_ACCENT, fontName="Helvetica-Bold", spaceBefore=6, spaceAfter=3) S_BODY = style("Body2", fontSize=9, leading=13, textColor=C_BLACK, fontName="Helvetica", spaceAfter=2) S_BODY_J = style("BodyJ", fontSize=9, leading=13, textColor=C_BLACK, fontName="Helvetica", spaceAfter=2, alignment=TA_JUSTIFY) S_BULLET = style("Bullet2", fontSize=9, leading=13, textColor=C_BLACK, fontName="Helvetica", leftIndent=12, bulletIndent=0, spaceAfter=1) S_TABLE_HDR = style("TblHdr", fontSize=9, leading=11, textColor=C_WHITE, fontName="Helvetica-Bold", alignment=TA_CENTER) S_TABLE_CELL = style("TblCell", fontSize=8.5, leading=12, textColor=C_BLACK, fontName="Helvetica", alignment=TA_LEFT) S_TABLE_CELL_C = style("TblCellC", fontSize=8.5, leading=12, textColor=C_BLACK, fontName="Helvetica", alignment=TA_CENTER) S_LABEL_P = style("LabelP", fontSize=9, leading=12, textColor=C_PRIMARY, fontName="Helvetica-Bold") S_LABEL_S = style("LabelS", fontSize=9, leading=12, textColor=C_SECONDARY, fontName="Helvetica-Bold") S_LABEL_T = style("LabelT", fontSize=9, leading=12, textColor=C_TERTIARY, fontName="Helvetica-Bold") S_CAPTION = style("Caption", fontSize=8, leading=10, textColor=C_MID_GREY, fontName="Helvetica-Oblique", alignment=TA_CENTER) S_BOX_TITLE = style("BoxTitle", fontSize=10, leading=13, textColor=C_ACCENT, fontName="Helvetica-Bold", spaceBefore=2, spaceAfter=2) S_BOX_BODY = style("BoxBody", fontSize=8.5, leading=12, textColor=C_BLACK, fontName="Helvetica", spaceAfter=1) S_MNEMO = style("Mnemo", fontSize=10, leading=14, textColor=C_ACCENT, fontName="Helvetica-Bold", alignment=TA_CENTER) story = [] # ═══════════════════════════════════════════════════════════════════ # COVER / HEADER BANNER (rendered as a 1-cell table acting as banner) # ═══════════════════════════════════════════════════════════════════ banner_data = [[ Paragraph("PERITONITIS", S_TITLE), Paragraph("Primary · Secondary · Tertiary", S_SUBTITLE), Paragraph("Study Guide | Based on SRB's Manual of Surgery, Chapter 32 – Peritoneum", S_SOURCE), ]] banner_tbl = Table([[ [ Paragraph("PERITONITIS", S_TITLE), Spacer(1, 4), Paragraph("Primary · Secondary · Tertiary", S_SUBTITLE), Spacer(1, 4), Paragraph("Study Guide | SRB's Manual of Surgery, Chapter 32 – Peritoneum", S_SOURCE), ] ]], colWidths=[doc.width]) banner_tbl.setStyle(TableStyle([ ("BACKGROUND", (0,0), (-1,-1), C_HEADER_BG), ("ALIGN", (0,0), (-1,-1), "CENTER"), ("VALIGN", (0,0), (-1,-1), "MIDDLE"), ("TOPPADDING", (0,0), (-1,-1), 18), ("BOTTOMPADDING", (0,0), (-1,-1), 18), ("LEFTPADDING", (0,0), (-1,-1), 10), ("RIGHTPADDING", (0,0), (-1,-1), 10), ("ROUNDEDCORNERS", [6, 6, 6, 6]), ])) story.append(banner_tbl) story.append(Spacer(1, 10)) # ═══════════════════════════════════════════════════════════════════ # QUICK-REFERENCE CARDS (3 columns: Primary | Secondary | Tertiary) # ═══════════════════════════════════════════════════════════════════ def card_header(text, bg): t = Table([[Paragraph(text, S_SECTION)]], colWidths=[(doc.width - 8)/3]) t.setStyle(TableStyle([ ("BACKGROUND", (0,0), (-1,-1), bg), ("ALIGN", (0,0), (-1,-1), "CENTER"), ("TOPPADDING", (0,0), (-1,-1), 6), ("BOTTOMPADDING", (0,0), (-1,-1), 6), ])) return t def bullet_block(items, color_bg): rows = [[Paragraph("• " + i, S_BULLET)] for i in items] t = Table(rows, colWidths=[(doc.width - 8)/3]) t.setStyle(TableStyle([ ("BACKGROUND", (0,0), (-1,-1), color_bg), ("LEFTPADDING", (0,0), (-1,-1), 8), ("RIGHTPADDING", (0,0), (-1,-1), 6), ("TOPPADDING", (0,0), (-1,-1), 3), ("BOTTOMPADDING",(0,0), (-1,-1), 3), ])) return t # ── Section header helper ───────────────────────────────────────── def section_banner(text, bg=C_ACCENT): t = Table([[Paragraph(text, S_SECTION)]], colWidths=[doc.width]) t.setStyle(TableStyle([ ("BACKGROUND", (0,0), (-1,-1), bg), ("ALIGN", (0,0), (-1,-1), "CENTER"), ("TOPPADDING", (0,0), (-1,-1), 5), ("BOTTOMPADDING", (0,0), (-1,-1), 5), ("LEFTPADDING", (0,0), (-1,-1), 8), ])) return t # ── 1. OVERVIEW ────────────────────────────────────────────────── story.append(section_banner("1. OVERVIEW — WHAT IS PERITONITIS?")) story.append(Spacer(1, 6)) overview_text = ( "Peritonitis is defined as <b>inflammation of the parietal and serosal layer of the peritoneum</b> " "due to chemicals (gastric acid, bile) or bacterial infection. The peritoneal cavity is " "normally sterile. There are three distinct types based on source, microbiology, and clinical context." ) story.append(Paragraph(overview_text, S_BODY_J)) story.append(Spacer(1, 8)) # ── 2. SIDE-BY-SIDE COMPARISON TABLE ──────────────────────────── story.append(section_banner("2. AT-A-GLANCE COMPARISON")) story.append(Spacer(1, 6)) col_w = [3.8*cm, 5.0*cm, 5.0*cm, 5.0*cm] comp_headers = [ Paragraph("FEATURE", S_TABLE_HDR), Paragraph("PRIMARY", S_TABLE_HDR), Paragraph("SECONDARY", S_TABLE_HDR), Paragraph("TERTIARY", S_TABLE_HDR), ] def R(feature, primary, secondary, tertiary): return [ Paragraph(feature, S_TABLE_CELL), Paragraph(primary, S_TABLE_CELL), Paragraph(secondary, S_TABLE_CELL), Paragraph(tertiary, S_TABLE_CELL), ] comp_rows = [ comp_headers, R("Frequency", "Rare (1% of all peritonitis)", "Most common type", "Uncommon; post-surgical"), R("Source", "No identifiable source (spontaneous)", "Bowel/visceral perforation or pathology", "Failed treatment of 1° or 2°"), R("Timing", "Spontaneous onset", "Acute; follows a precipitating event", "After ≥48 h of adequate treatment"), R("Microbiology", "Monomicrobial; extra-peritoneal source (blood spread)", "Polymicrobial; intra-peritoneal source", "MDR organisms; superadded infection"), R("Common organisms", "Pneumococci, Streptococci, E. coli; SBP = E. coli (40%), Klebsiella, Pseudomonas", "E. coli (70%), Clostridium Welchii, Bacteroides, Klebsiella, Salmonella typhi", "E. faecalis/faecium, S. epidermidis, P. aeruginosa, Candida albicans"), R("At-risk population", "Young girls (3–9 yrs), cirrhotic patients (SBP), nephrotic syndrome, SLE", "All ages; following hollow viscus perforation, appendicitis, trauma", "Immunosuppressed, post-laparotomy patients; SIRS/MODS"), R("Pathophysiology", "Haematogenous/lymphatic spread; gut translocation (SBP)", "Direct contamination from ruptured hollow viscus", "Persistent infection despite surgery; host defence failure"), R("Diagnosis", "SBP: ascitic WBC >250 cells/mm² with >50% PMN; TC >30,000/mm³", "Clinical + imaging; X-ray shows gas under diaphragm", "Difficult; CT abdomen, LFT, platelet count, urine output monitoring"), R("Treatment", "Tapping + peritoneal drainage; broad-spectrum antibiotics (aminoglycosides + cephalosporins + metronidazole)", "Surgical drainage (main); laparotomy/laparoscopy; closure of perforation; peritoneal lavage", "Aggressive antibiotics + antifungals; TPN; re-exploration; FFP/platelets; Ventilator/ICU"), R("Mortality", "High (SBP mortality significant)", "10% (diffuse peritonitis)", ">50%; complicated by DIC, ARDS, haemorrhage"), ] comp_table = Table(comp_rows, colWidths=col_w, repeatRows=1) comp_table.setStyle(TableStyle([ # Header row ("BACKGROUND", (0,0), (0,-1), C_GREY_BG), ("BACKGROUND", (1,0), (1,0), C_PRIMARY), ("BACKGROUND", (2,0), (2,0), C_SECONDARY), ("BACKGROUND", (3,0), (3,0), C_TERTIARY), # Column header (feature col) ("BACKGROUND", (0,0), (0,0), C_ACCENT), # Alternating row shading *[("BACKGROUND", (1,r), (1,r), C_LIGHT_BLUE) for r in range(1, len(comp_rows), 2)], *[("BACKGROUND", (2,r), (2,r), C_LIGHT_GRN) for r in range(1, len(comp_rows), 2)], *[("BACKGROUND", (3,r), (3,r), C_LIGHT_RED) for r in range(1, len(comp_rows), 2)], # Grid ("GRID", (0,0), (-1,-1), 0.5, colors.HexColor("#BFC9CA")), ("VALIGN", (0,0), (-1,-1), "TOP"), ("TOPPADDING", (0,0), (-1,-1), 4), ("BOTTOMPADDING", (0,0), (-1,-1), 4), ("LEFTPADDING", (0,0), (-1,-1), 5), ("RIGHTPADDING", (0,0), (-1,-1), 5), ("FONTNAME", (0,1), (0,-1), "Helvetica-Bold"), ("FONTSIZE", (0,1), (0,-1), 8.5), ])) story.append(comp_table) story.append(Spacer(1, 10)) # ── 3. DEEP-DIVE CARDS ────────────────────────────────────────── story.append(section_banner("3. DETAILED BREAKDOWN")) story.append(Spacer(1, 6)) # ---- helpers ---- def detail_card(title_text, bg_color, light_bg, sub_sections): """sub_sections: list of (heading, list_of_strings)""" elements = [] # Title bar hdr = Table([[Paragraph(title_text, S_SECTION)]], colWidths=[doc.width]) hdr.setStyle(TableStyle([ ("BACKGROUND", (0,0),(-1,-1), bg_color), ("TOPPADDING", (0,0),(-1,-1), 6), ("BOTTOMPADDING",(0,0),(-1,-1), 6), ])) elements.append(hdr) # Content for heading, bullets in sub_sections: elements.append(Spacer(1, 4)) elements.append(Paragraph(heading, S_H2)) for b in bullets: elements.append(Paragraph("• " + b, S_BULLET)) return KeepTogether(elements) story.append(detail_card( "PRIMARY PERITONITIS", C_PRIMARY, C_LIGHT_BLUE, [ ("Definition & Epidemiology", [ "Peritonitis with <b>no documented intra-abdominal source</b> of infection", "Represents <b>~1% of all peritonitis</b> cases", "Two main contexts: (a) <b>children 3–9 years</b>, especially girls; (b) <b>cirrhotic adults</b> with ascites (SBP)", ]), ("Pathogenesis — How does infection reach the peritoneum?", [ "<b>Haematogenous spread</b>: from blood (e.g., pneumococcal bacteraemia)", "<b>Lymphatic spread</b>: from genitals via Fallopian tubes", "<b>Upper respiratory tract / middle ear</b>: in males", "<b>Gut translocation</b> in cirrhosis: bacteria cross gut wall → mesenteric lymphatics → peritoneum", "SBP ascitic fluid protein <1 g/dL ↑ risk", ]), ("Spontaneous Bacterial Peritonitis (SBP) — Specific", [ "30% of cirrhotic patients with ascites develop SBP", "90% are monomicrobial: <b>E. coli (40%)</b>, Klebsiella, Pseudomonas, Proteus, S. pneumoniae (15%), Staphylococcus, anaerobes (5%)", "Also occurs with: nephrotic syndrome, SLE, peritoneovenous shunts, peritoneal dialysis catheters, Chlamydial/fungal/mycobacterial infection", ]), ("Primary Streptococcal Peritonitis (Children)", [ "Infants and children <4 years", "Cloudy fibrin flakes in peritoneal cavity", "Features of tonsillitis/pharyngitis + gastroenteritis", "Often greenish watery stool", "No documented source of infection", ]), ("Diagnosis", [ "Ascitic fluid WBC <b>>250 cells/mm²</b> with <b>>50% PMN</b> → diagnostic of SBP", "Total count (TC) very high: <b>>30,000/mm³</b>", "Culture: usually monomicrobial", "Patient: toxic, severely ill, develops septicaemia early", "Uncommon after 10 years of age", ]), ("Treatment", [ "Diagnostic tapping + tube peritoneal drainage", "Laparoscopic drainage and wash (useful)", "Broad-spectrum antibiotics: <b>aminoglycosides + cephalosporins + metronidazole</b>", "Local instillation of antibiotics into peritoneal cavity", "<b>Note: Mortality is HIGH</b>", ]), ] )) story.append(Spacer(1, 10)) story.append(detail_card( "SECONDARY PERITONITIS", C_SECONDARY, C_LIGHT_GRN, [ ("Definition & Epidemiology", [ "<b>Most common type</b> of peritonitis", "Secondary to bowel or other visceral pathology (perforation, obstruction, trauma)", "<b>Duodenal perforation</b> and <b>burst appendicitis</b> are the most common causes", ]), ("Common Causes (Mode of Infection)", [ "Perforation of GIT: duodenal ulcer, gastric ulcer, enteric/colonic ulcers, Meckel's diverticulitis", "Appendicitis, cholecystitis, diverticulitis", "Intestinal obstruction with strangulation", "Penetrating or blunt trauma", "Surgery; drains; dialysis; foreign body", "Via Fallopian tubes; blood spread (septicaemia); transmural spread", "Uterine perforation during abortion or termination of pregnancy", ]), ("Microbiology (Polymicrobial)", [ "<b>From GIT</b>: E. coli (most common, 70%), aerobic streptococci, Streptococcus faecalis, Staphylococcus, anaerobic streptococci, Bacteroides (anaerobes), Klebsiella, Clostridium Welchii", "<b>Not from GIT</b>: Gonococcus, Pneumococcus (from Fallopian tubes, in young females); Chlamydia, beta-haemolytic streptococci, Mycobacterium", "Most common bacterium during peritonitis phase: <b>E. coli</b>", "Most common during abscess formation: <b>Bacteroides fragilis</b>", ]), ("Pathogenesis", [ "Direct contamination from ruptured hollow viscus", "Fibrinogen → Fibrin → attempts to localise infection", "Bowel adheres to itself; thick flakes on bowel surface", "Peritoneum: thick, oedematous, velvety, reddish — <b>loses glistening appearance</b>", "Pus collects in subphrenic, paracolic, and pelvic spaces", "Bacterial load (2×10⁸ CFU/mL) overwhelms host defence → multiplication, toxaemia, pus", ]), ("Investigations", [ "<b>Erect CXR</b>: ground glass appearance + gas under diaphragm (hollow viscus perforation)", "<b>Left lateral decubitus X-ray</b>: for critically ill patients who cannot stand", "CT abdomen: detects bowel ischaemia, gangrene, perforation, internal hernias, fluid", "US abdomen: fluid in abdominal cavity; haemoperitoneum, pancreatitis", "Four-quadrant tap / DPL: pus or infected fluid; DPL WBC >100/mL suggests peritonitis", "Serum amylase (4× normal = significant), LFT, platelet count, blood cultures", "Diagnostic laparoscopy: also therapeutic for duodenal ulcer perforation", ]), ("Treatment", [ "Primary assessment: ABCDE (Airway, Breathing, Circulation, Disability, Drugs)", "Secondary: Fever/Fluid/Foley's/Gastric tube/History/Investigations/Judgement", "<b>Sepsis SIX in first hour</b>: IV fluids + Antibiotics + High O₂ (Give 3); Blood culture + Serum lactate + Hourly urine output (Take 3)", "Antibiotics: 3rd-gen cephalosporins or quinolones or piperacillin-tazobactam or meropenem/imipenem", "<b>Surgical drainage (MAIN modality)</b>: laparotomy; closure of perforation; resection of gangrene; diversion (ileostomy/colostomy); peritoneal lavage with warm normal saline", "Laparoscopy: controversial but increasingly used", "Percutaneous US/CT-guided drainage: for unstable or subacute/localised sepsis", "Mortality for diffuse peritonitis: <b>10%</b>", ]), ] )) story.append(Spacer(1, 10)) story.append(detail_card( "TERTIARY PERITONITIS", C_TERTIARY, C_LIGHT_RED, [ ("Definition", [ "Persistent or recurrent intra-abdominal infection after <b>adequate treatment</b> for primary or secondary peritonitis — usually occurring <b>after 48 hours</b>", "Occurs after any abdominal surgery; usually severe", "Patient often progresses to <b>SIRS</b> or <b>MODS</b> early", ]), ("Why does it happen?", [ "Common in <b>immunosuppressed</b> individuals with ineffective peritoneal host defences", "Virulence and drug resistance of organisms are key factors", "Difficult to diagnose clinically — causes delay in therapy", ]), ("Causative Organisms (MDR)", [ "Enterococcus faecalis / faecium", "Staphylococcus epidermidis", "Pseudomonas aeruginosa", "Candida albicans", "Enterobacter, Pseudomonas — multidrug resistant", "Note: enterococci, Candida, S. epidermidis, Enterobacter, Pseudomonas all show MDR", ]), ("Clinical Features & Investigations", [ "Clinically difficult to diagnose; often presents as persistent SIRS/MODS", "CT abdomen", "Total and platelet count; LFT", "Monitoring renal functions (hourly urine output)", "Chest X-ray", ]), ("Treatment (Aggressive & Multi-modal)", [ "Aggressive <b>antibiotic therapy</b>", "<b>Antifungal therapy</b> (Candida coverage)", "<b>TPN</b> (Total Parenteral Nutrition)", "Maintaining haemodynamic stability", "Re-exploration of abdomen; thorough wash", "Colostomy / ileostomy or exteriorisation of bowel segment", "FFP, packed cells, platelet transfusions as needed", "<b>Ventilator / ICU care</b> often required", ]), ("Prognosis", [ "<b>Mortality >50%</b>", "Complications: DIC, septicaemia, haemorrhage, pneumonia, <b>ARDS</b>", ]), ] )) story.append(Spacer(1, 10)) # ── 4. BACTERIA TABLE ──────────────────────────────────────────── story.append(section_banner("4. BACTERIOLOGY SUMMARY")) story.append(Spacer(1, 6)) bact_data = [ [Paragraph("TYPE", S_TABLE_HDR), Paragraph("MICROBIOLOGY", S_TABLE_HDR), Paragraph("SOURCE", S_TABLE_HDR), Paragraph("KEY POINT", S_TABLE_HDR)], [Paragraph("Primary", S_TABLE_CELL_C), Paragraph("Monomicrobial\nE. coli (40%), Klebsiella, Pseudomonas, Proteus, S. pneumoniae (15%), Staphylococcus, anaerobes (5%)", S_TABLE_CELL), Paragraph("Extraperitoneal\n(blood/lymphatic spread)", S_TABLE_CELL_C), Paragraph("SBP: 90% monomicrobial; cirrhosis + ascites + protein <1 g/dL = high risk", S_TABLE_CELL)], [Paragraph("Secondary", S_TABLE_CELL_C), Paragraph("Polymicrobial\nE. coli (70% — most common), Clostridium Welchii, Bacteroides, Streptococcus faecalis, Klebsiella, Staphylococcus, Salmonella typhi", S_TABLE_CELL), Paragraph("Intraperitoneal\n(perforation/visceral pathology)", S_TABLE_CELL_C), Paragraph("During peritonitis: E. coli\nDuring abscess formation: B. fragilis", S_TABLE_CELL)], [Paragraph("Tertiary", S_TABLE_CELL_C), Paragraph("MDR organisms\nE. faecalis, E. faecium, S. epidermidis, P. aeruginosa, Candida albicans, Enterobacter", S_TABLE_CELL), Paragraph("Superadded infection\n(nosocomial/post-surgical)", S_TABLE_CELL_C), Paragraph("Multidrug resistance is hallmark; Candida coverage essential; mortality >50%", S_TABLE_CELL)], ] bact_table = Table(bact_data, colWidths=[2.5*cm, 6.5*cm, 4.0*cm, 5.8*cm], repeatRows=1) bact_table.setStyle(TableStyle([ ("BACKGROUND", (0,0),(-1,0), C_ACCENT), ("BACKGROUND", (0,1),(-1,1), C_LIGHT_BLUE), ("BACKGROUND", (0,2),(-1,2), C_LIGHT_GRN), ("BACKGROUND", (0,3),(-1,3), C_LIGHT_RED), ("BACKGROUND", (0,1),(0,1), colors.HexColor("#AED6F1")), ("BACKGROUND", (0,2),(0,2), colors.HexColor("#A9DFBF")), ("BACKGROUND", (0,3),(0,3), colors.HexColor("#F1948A")), ("FONTNAME", (0,1),(0,-1), "Helvetica-Bold"), ("GRID", (0,0),(-1,-1), 0.5, colors.HexColor("#BFC9CA")), ("VALIGN", (0,0),(-1,-1), "TOP"), ("TOPPADDING", (0,0),(-1,-1), 5), ("BOTTOMPADDING",(0,0),(-1,-1), 5), ("LEFTPADDING",(0,0),(-1,-1), 5), ("RIGHTPADDING",(0,0),(-1,-1), 5), ])) story.append(bact_table) story.append(Spacer(1, 10)) # ── 5. TREATMENT PRINCIPLES ────────────────────────────────────── story.append(section_banner("5. TREATMENT PRINCIPLES (COMMON TO ALL)")) story.append(Spacer(1, 6)) treat_data = [ [Paragraph("PRINCIPLE", S_TABLE_HDR), Paragraph("DETAILS", S_TABLE_HDR)], [Paragraph("1. Control source of infection", S_TABLE_CELL), Paragraph("Identify and close/repair the perforation; drain abscess; remove infected focus", S_TABLE_CELL)], [Paragraph("2. Eliminate bacteria and sepsis", S_TABLE_CELL), Paragraph("Broad-spectrum IV antibiotics ± antifungals; peritoneal lavage with warm normal saline", S_TABLE_CELL)], [Paragraph("3. Resuscitation (ABCDE)", S_TABLE_CELL), Paragraph("IV fluids, airway management, vasopressors if needed; Foley catheter + nasogastric tube; FFP/blood products", S_TABLE_CELL)], [Paragraph("4. Vital organ support", S_TABLE_CELL), Paragraph("Cardiac, pulmonary, renal support; ICU care; ventilator if needed", S_TABLE_CELL)], [Paragraph("5. Nutrition & metabolic support", S_TABLE_CELL), Paragraph("Enteral nutrition preferred; TPN if gut not usable; electrolyte correction", S_TABLE_CELL)], [Paragraph("6. Sepsis SIX Bundle", S_TABLE_CELL), Paragraph("Give 3: IV Fluids + Antibiotics + High O₂ — Take 3: Blood cultures + Serum lactate + Hourly urine output", S_TABLE_CELL)], [Paragraph("7. Scoring systems", S_TABLE_CELL), Paragraph("APACHE II (12 physiological variables) and Mannheim Peritonitis Index (8 parameters) to assess severity and predict outcome", S_TABLE_CELL)], ] treat_table = Table(treat_data, colWidths=[5.5*cm, 13.3*cm], repeatRows=1) treat_table.setStyle(TableStyle([ ("BACKGROUND", (0,0),(-1,0), C_ACCENT), *[("BACKGROUND", (0,r),(-1,r), C_GREY_BG) for r in range(1, len(treat_data), 2)], ("FONTNAME", (0,1),(0,-1), "Helvetica-Bold"), ("FONTSIZE", (0,1),(0,-1), 8.5), ("GRID", (0,0),(-1,-1), 0.5, colors.HexColor("#BFC9CA")), ("VALIGN", (0,0),(-1,-1), "TOP"), ("TOPPADDING", (0,0),(-1,-1), 5), ("BOTTOMPADDING",(0,0),(-1,-1), 5), ("LEFTPADDING",(0,0),(-1,-1), 6), ("RIGHTPADDING",(0,0),(-1,-1), 6), ])) story.append(treat_table) story.append(Spacer(1, 10)) # ── 6. MNEMONICS & HIGH-YIELD BOX ─────────────────────────────── story.append(section_banner("6. MNEMONICS & HIGH-YIELD FACTS")) story.append(Spacer(1, 6)) mnem_data = [ [ # Mnemonic 1 [ Paragraph("Sepsis SIX Bundle", S_BOX_TITLE), Paragraph("<b>GIVE 3 (therapeutic):</b>", S_BOX_BODY), Paragraph("• IV Fluids", S_BOX_BODY), Paragraph("• Antibiotics", S_BOX_BODY), Paragraph("• High O₂", S_BOX_BODY), Spacer(1,3), Paragraph("<b>TAKE 3 (diagnostic):</b>", S_BOX_BODY), Paragraph("• Blood culture", S_BOX_BODY), Paragraph("• Serum lactate", S_BOX_BODY), Paragraph("• Hourly urine output", S_BOX_BODY), ], # Mnemonic 2 [ Paragraph("Secondary Assessment — FFGHIJ", S_BOX_TITLE), Paragraph("• <b>F</b>ever", S_BOX_BODY), Paragraph("• <b>F</b>luid", S_BOX_BODY), Paragraph("• <b>F</b>oley's catheter", S_BOX_BODY), Paragraph("• <b>G</b>astric tube/other tubes", S_BOX_BODY), Paragraph("• <b>H</b>istory and Head-to-toe", S_BOX_BODY), Paragraph("• <b>I</b>nvestigations", S_BOX_BODY), Paragraph("• <b>J</b>udgement", S_BOX_BODY), ], # High-yield facts [ Paragraph("High-Yield Numbers", S_BOX_TITLE), Paragraph("• Most common cause 2° peritonitis: <b>duodenal perforation + appendicitis</b>", S_BOX_BODY), Paragraph("• Most common organism: <b>E. coli</b>", S_BOX_BODY), Paragraph("• Abscess formation: <b>B. fragilis</b>", S_BOX_BODY), Paragraph("• Peritoneal fluid (normal): <b>100 mL</b>", S_BOX_BODY), Paragraph("• SBP diagnostic: ascitic WBC <b>>250/mm²</b> + >50% PMN", S_BOX_BODY), Paragraph("• Bacterial load to overwhelm: <b>2×10⁸ CFU/mL</b>", S_BOX_BODY), Paragraph("• Mortality — 2°: <b>10%</b> | 3°: <b>>50%</b>", S_BOX_BODY), Paragraph("• Tertiary defined: persists after <b>>48 h</b> adequate treatment", S_BOX_BODY), ], ] ] mnem_table = Table(mnem_data, colWidths=[(doc.width - 8)/3]*3) mnem_table.setStyle(TableStyle([ ("BACKGROUND", (0,0),(0,0), C_LIGHT_BLUE), ("BACKGROUND", (1,0),(1,0), C_LIGHT_GRN), ("BACKGROUND", (2,0),(2,0), C_YELLOW), ("VALIGN", (0,0),(-1,-1), "TOP"), ("GRID", (0,0),(-1,-1), 0.5, colors.HexColor("#BFC9CA")), ("TOPPADDING", (0,0),(-1,-1), 8), ("BOTTOMPADDING",(0,0),(-1,-1), 8), ("LEFTPADDING",(0,0),(-1,-1), 8), ("RIGHTPADDING",(0,0),(-1,-1), 8), ])) story.append(mnem_table) story.append(Spacer(1, 10)) # ── 7. FACTORS AFFECTING SPREAD ────────────────────────────────── story.append(section_banner("7. FACTORS AFFECTING SPREAD OF INFECTION")) story.append(Spacer(1, 6)) spread_items = [ "Rapidity by which pus is gushed into the peritoneal cavity (e.g., burst appendix, perforations)", "Amount of peristalsis — more peristalsis = more spread", "Virulence of the organism, bacterial load and nature", "Localising action of the omentum (in children: poor localisation because omentum is small)", "Immunosuppression (HIV, steroids)", "Anatomical nature of the peritoneal cavity", "Age, associated diseases (malignancy, malnutrition, anaemia)", ] for item in spread_items: story.append(Paragraph("• " + item, S_BULLET)) story.append(Spacer(1, 10)) # ── 8. DIFFERENTIAL DIAGNOSIS ──────────────────────────────────── story.append(section_banner("8. DIFFERENTIAL DIAGNOSIS OF ACUTE PERITONITIS")) story.append(Spacer(1, 6)) dd_data = [ [Paragraph("CONDITION", S_TABLE_HDR), Paragraph("KEY DIFFERENTIATING FEATURE", S_TABLE_HDR), Paragraph("INVESTIGATION", S_TABLE_HDR)], [Paragraph("Pancreatitis", S_TABLE_CELL), Paragraph("Back pain is common; difficult to differentiate clinically", S_TABLE_CELL), Paragraph("Serum amylase ↑; CT abdomen", S_TABLE_CELL)], [Paragraph("Intestinal obstruction", S_TABLE_CELL), Paragraph("Distension, vomiting, colicky pain; dilated bowel loops on X-ray", S_TABLE_CELL), Paragraph("Plain X-ray (multiple air-fluid levels); CT abdomen", S_TABLE_CELL)], [Paragraph("Ruptured ectopic pregnancy", S_TABLE_CELL), Paragraph("Urine pregnancy test +ve; amenorrhoea; lower abdominal pain", S_TABLE_CELL), Paragraph("Urine β-hCG; US abdomen + pelvis", S_TABLE_CELL)], [Paragraph("Acute pyelonephritis", S_TABLE_CELL), Paragraph("Urinary symptoms; tender renal angle; may mimic peritonitis", S_TABLE_CELL), Paragraph("Urine microscopy (pus cells); US abdomen", S_TABLE_CELL)], [Paragraph("Acute mesenteric ischaemia", S_TABLE_CELL), Paragraph("Bloody diarrhoea, colicky pain, tender abdomen", S_TABLE_CELL), Paragraph("CT abdomen + angiogram", S_TABLE_CELL)], [Paragraph("Diabetic acute abdomen", S_TABLE_CELL), Paragraph("Diabetes mellitus patient; free fluid in flank may be absent; ketoacidosis", S_TABLE_CELL), Paragraph("Blood glucose; urinalysis for ketones; free fluid assessment", S_TABLE_CELL)], [Paragraph("Acute MI / Cardiac", S_TABLE_CELL), Paragraph("Cardiac history; epigastric pain can mimic peritonitis", S_TABLE_CELL), Paragraph("ECG; echocardiography; troponin", S_TABLE_CELL)], ] dd_table = Table(dd_data, colWidths=[4.5*cm, 7.5*cm, 6.8*cm], repeatRows=1) dd_table.setStyle(TableStyle([ ("BACKGROUND", (0,0),(-1,0), C_ACCENT), *[("BACKGROUND", (0,r),(-1,r), C_GREY_BG) for r in range(1, len(dd_data), 2)], ("GRID", (0,0),(-1,-1), 0.5, colors.HexColor("#BFC9CA")), ("VALIGN", (0,0),(-1,-1), "TOP"), ("TOPPADDING", (0,0),(-1,-1), 4), ("BOTTOMPADDING",(0,0),(-1,-1), 4), ("LEFTPADDING",(0,0),(-1,-1), 5), ("RIGHTPADDING",(0,0),(-1,-1), 5), ])) story.append(dd_table) story.append(Spacer(1, 10)) # ── Footer note ────────────────────────────────────────────────── story.append(HRFlowable(width="100%", thickness=1, color=C_MID_GREY)) story.append(Spacer(1, 4)) story.append(Paragraph( "Source: SRB's Manual of Surgery — Chapter 32: Peritoneum | Section 2: Gastrointestinal Surgery", S_CAPTION)) story.append(Paragraph( "Study guide created for educational purposes. Always verify clinical decisions with current guidelines.", S_CAPTION)) # ── Build ───────────────────────────────────────────────────────── doc.build(story) print("PDF created:", OUTPUT) PYEOF
ls -lh /tmp/workspace/peritonitis-guide/
Peritonitis Study Guide
PDF Document · PDF