Can you make notes of pyogenic liver abscess from srb

Reading File
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
I now have comprehensive information. Let me compile detailed notes on pyogenic liver abscess in SRB-style surgical notes format.

Pyogenic Liver Abscess — Surgical Notes

Source note: SRB's Manual of Surgery is not available in this library. These notes are compiled from Sabiston Textbook of Surgery (12th ed.), Mulholland & Greenfield's Surgery (7th ed.), and Sleisenger & Fordtran's GI & Liver Disease — all equally authoritative surgical references.

Definition

A pyogenic liver abscess (PLA) is a focal collection of purulent bacterial material and necroinflammatory debris within the liver parenchyma. It may be solitary or multiple and is caused by one or more aerobic or anaerobic bacteria.

Epidemiology

  • Annual incidence: ~2.3 cases per 100,000 persons
  • Most common type of visceral abscess (13% of intra-abdominal abscesses)
  • Historically affected young adults (20s–30s) due to appendicitis; now predominantly affects patients in their 50s–60s
  • Male-to-female ratio: ~1.5:1 (no significant ethnic/geographic difference)
  • Right lobe affected in ~75% of cases (due to greater portal venous flow)

Aetiology & Routes of Infection

RouteMechanismCommon Causes
Biliary tree (most common identifiable)Ascending suppurative cholangitis from bile stasis → bacterial colonizationCholedocholithiasis, malignant biliary obstruction, Caroli disease, biliary-enteric anastomosis, biliary ascariasis
Portal vein (Pylephlebitis)Intra-abdominal infection → portal vein bacteraemiaAppendicitis, diverticulitis, pancreatitis, IBD, pelvic inflammatory disease, perforated viscus, omphalitis (newborns)
Hepatic artery (systemic bacteraemia)Any systemic infection seeds the liver via hepatic arteryEndocarditis, pneumonia, osteomyelitis, septicaemia
Direct extensionContiguous spread from adjacent infectionSuppurative cholecystitis, subphrenic/perinephric abscess, bowel perforation into liver
TraumaPenetrating or blunt injury → intrahepatic haematoma → superinfectionAlso: hepatic artery embolisation, thermal ablation (especially with prior biliary-enteric anastomosis)
CryptogenicNo identifiable sourceMost common in modern series (40–43%); possible sources include oral flora/severe periodontal disease (especially alcoholics)
Historical note: Ochsner and DeBakey (1938) described 47 cases — appendicitis via portal vein was then the dominant cause. Today, biliary disease and cryptogenic causes predominate in Western countries. In Asia, recurrent pyogenic cholangitis (intrahepatic stones) remains important.

Risk Factors

  • Diabetes mellitus (most important comorbidity)
  • Cirrhosis
  • Chronic renal failure
  • Malignancy / immunosuppression (AIDS, haematologic malignancy → fungal abscesses)
  • Liver transplantation
  • Previous hepatobiliary/pancreatic disease or surgery
  • Chronic granulomatous disease (children — susceptibility to S. aureus)
  • Atrophic gastritis / loss of gastric acid (altered bowel flora in elderly)
  • Colorectal cancer: population studies from Taiwan showed a fourfold increased incidence of GI malignancy in PLA patients — especially with Klebsiella pneumoniae

Microbiology

Most PLAs are polymicrobial (enteric + anaerobic organisms):
Gram-negative aerobes (most common):
  • Escherichia coli — most frequently isolated
  • Klebsiella pneumoniae — especially virulent strains cause liver abscess without underlying hepatobiliary disease, often with metastatic septic complications
  • Enterobacter, Pseudomonas, Proteus, Citrobacter spp.
Gram-positive aerobes:
  • Streptococcus milleri (anginosus) group — important
  • Enterococcus, S. aureus (especially in children and septicaemia), S. pyogenes
Anaerobes:
  • Bacteroides fragilis — most common anaerobe
  • Fusobacterium necrophorum
  • Anaerobic streptococci, Peptostreptococcus, Prevotella
Special situations:
  • Salmonella Typhi — PLA complicating recurrent pyogenic cholangitis
  • Candida — in immunocompromised hosts (haematologic malignancy)
  • Mycobacterium tuberculosis — rare
  • Actinomyces, Clostridium — uncommon

Pathology

  • Right lobe involved in ~75% of cases
  • Multiple abscesses → suggest biliary source
  • Single, large abscess → more often cryptogenic or portal/arterial seeding
  • Gross: cavity of pus surrounded by zone of hepatic necrosis and inflammatory infiltrate
  • The abscess wall eventually develops a fibrous capsule

Clinical Features

Symptoms

  • Fever with chills/rigors — most common (up to 90%), may be spiking
  • Right upper quadrant pain — dull, constant; increased with movement
  • Anorexia, nausea, malaise, weight loss
  • Pain referred to right shoulder or cough if abscess near the dome of liver (diaphragmatic irritation)
  • Presentation is often insidious (subacute) — symptoms may be present for >1 month before diagnosis
  • Multiple abscesses → more acute presentation, often with sepsis/shock

Signs

  • Hepatomegaly with tenderness (accentuated by movement/percussion)
  • Fever
  • Jaundice — late feature (absent early unless biliary disease is underlying cause)
  • Splenomegaly — unusual, only with chronic abscess
  • Portal hypertension — may follow recovery if portal vein was thrombosed

Investigations

Blood Tests

TestFinding
WBCLeukocytosis (70–90%)
HaemoglobinNormochromic, normocytic anaemia
Alkaline phosphatase (ALP)Mildly elevated in ~80%
Total bilirubinElevated in 20–50%
TransaminasesMildly elevated in ~60%
AlbuminHypoalbuminaemia (reflects chronicity)
PT/INRMildly elevated in chronic cases
ESRElevated
None of these tests are specific — they raise suspicion that leads to imaging.

Cultures

  • Blood cultures — positive in 50% of cases; should be drawn before starting antibiotics
  • Aspirate cultures — aerobic + anaerobic; yield ~90% (lower if antibiotics already started)
  • Serologic testing for Entamoeba histolytica (ELISA) — in patients with epidemiologic risk factors, to exclude amebic abscess

Imaging

Chest X-ray (abnormal ~50%):
  • Elevated right hemidiaphragm
  • Right pleural effusion
  • Right basal atelectasis
Plain Abdominal X-ray (rarely helpful):
  • Air-fluid levels in abscess cavity
  • Portal venous gas (grave sign)
Ultrasound (first-line):
  • Sensitivity: 80–95%
  • Shows hypoechoic, round/oval lesion; distinguishes solid from cystic
  • Can guide needle aspiration
  • Limitation: poor visualisation of high dome lesions; operator-dependent
CT (contrast-enhanced) (investigation of choice):
  • Sensitivity: 95–100%
  • Hypodense lesion with rim enhancement (in <20%)
  • Detects small abscesses, multiple lesions, gas in cavity
  • Gas in abscess = associated with increased mortality
  • Identifies underlying cause (biliary stones, diverticulitis, appendicitis, malignancy)
MRI:
  • More sensitive than CT for small abscesses
  • Low signal on T1, high signal on T2, gadolinium enhancement
  • No clear advantage over CT for diagnosis; better for biliary tree assessment
ERCP: Indicated if imaging shows biliary stones or cholestasis

Differential Diagnosis

ConditionDistinguishing features
Amebic abscessYoung male, travel history, single lesion right lobe, positive serology, responds to metronidazole alone
Echinococcal cystEndemic area, daughter cysts on imaging, positive serology
Simple hepatic cystThin wall, no enhancement, no symptoms
Hepatocellular carcinomaAFP elevated, arterial enhancement + washout on CT
Hepatic metastasisKnown primary, multiple lesions
Inflammatory pseudotumourYoung men, history of infection, biopsy needed

Pyogenic vs. Amebic Liver Abscess — Key Comparison

FeaturePyogenicAmebic
Age>50 years20–40 years
Sex ratio1.5:1 (M:F)≥10:1 (M:F)
NumberOften multipleUsually single
LocationEither lobeRight lobe, near diaphragm
PresentationSubacuteAcute
JaundiceMild (late)Moderate
SerologyNegativePositive (ELISA)
Pus characterPurulent (foul-smelling)"Anchovy sauce" (odourless unless superinfected)
TreatmentDrainage + IV antibioticsMetronidazole (no drainage usually needed)

Treatment

Treatment requires a multimodal approach: antibiotics + drainage + treatment of the underlying cause.

1. Antibiotics

  • Start broad-spectrum IV antibiotics immediately once diagnosis suspected (do not wait for cultures)
  • Coverage must include: streptococci, enteric gram-negative bacilli, and anaerobes
  • Standard empiric regimens:
    • Ampicillin + aminoglycoside + metronidazole (classic triple therapy)
    • 3rd-generation cephalosporin (e.g., ceftriaxone) + metronidazole (preferred in renal impairment)
    • Piperacillin-tazobactam (covers gram-negative + anaerobes)
  • Narrow therapy once culture and sensitivity results available
  • Duration: 14 days IV → oral for a total of 4–6 weeks
  • Antibiotics alone (without drainage) → prohibitively high mortality (59–100%) in most series

2. Percutaneous Drainage (Treatment of Choice)

  • Percutaneous catheter drainage (PCD) under US or CT guidance — now the standard of care
  • Success rate: 66–90%
  • Catheter left in place until output is minimal (~7 days)
  • Aspirate sent for Gram stain, aerobic/anaerobic culture
  • Advantages: avoids laparotomy, can be done at time of radiologic diagnosis, suitable for high-risk surgical patients
  • Relative contraindications: ascites, coagulopathy, proximity to vital structures
Percutaneous needle aspiration (without indwelling catheter):
  • Success rate: 60–90%; often requires multiple aspirations (>1 in majority; 3+ in 25%)
  • A single aspiration is a reasonable first attempt, especially for small/simple abscesses
  • One RCT: catheter drainage (100% success) > aspiration alone (60% success)

3. Surgical Drainage

Indications for surgery:
  • Failure of percutaneous drainage
  • Need for surgery to treat the primary source (e.g., appendicitis, perforated diverticulum)
  • Ruptured abscess with peritonitis
  • Multiple abscesses not amenable to percutaneous drainage
  • Thick-walled abscess (poor catheter drainage)
Approach: Open or laparoscopic; laparoscopic drainage is increasingly used in selected cases
  • Large abscesses (>5 cm): retrospective data favour surgical drainage, but PCD still succeeds in two-thirds

4. ERCP

  • Indicated when the underlying cause is biliary obstruction (stones, strictures, malignancy)
  • ERCP with stenting/sphincterotomy addresses the primary biliary source

5. Treatment of Underlying Cause

  • Essential for cure and prevention of recurrence
  • Treat biliary disease, GI malignancy, diverticulitis, appendicitis as appropriate

Complications

  • Rupture — into peritoneal cavity (peritonitis), pleural cavity (empyema), pericardium (purulent pericarditis)
  • Septicaemia/septic shock
  • Portal vein thrombosis → portal hypertension
  • Right pleural effusion / empyema thoracis
  • Subphrenic abscess
  • Biliary fistula
  • Hepatic failure (in massive or multiple abscesses)
  • Metastatic septic emboli (K. pneumoniae virulent strains — endophthalmitis, meningitis)

Prognosis

  • Mortality in Ochsner & DeBakey's era: ~70–80%
  • Modern mortality: 5–30% with aggressive antibiotic therapy and drainage
  • Worse prognosis with:
    • Jaundice
    • Hypoalbuminaemia
    • Multiple abscesses
    • Underlying malignancy
    • Gas in abscess cavity
    • Delay in diagnosis

Key Points (SRB-style Summary)

  1. Most common visceral abscess; right lobe predominance (75%)
  2. Biliary disease is now the most common identifiable cause; cryptogenic predominates overall (40%)
  3. Most common organisms: E. coli and K. pneumoniae
  4. Polymicrobial in majority
  5. Classic triad: fever + RUQ pain + tender hepatomegaly (Charcot's triad of cholangitis if biliary origin)
  6. CT (contrast-enhanced) is the investigation of choice (sensitivity 95–100%)
  7. Blood cultures positive in ~50% — draw before antibiotics
  8. Percutaneous catheter drainage + IV antibiotics = treatment of choice
  9. Surgery reserved for failed PCD or concurrent surgical pathology
  10. K. pneumoniae PLA — screen for colorectal malignancy (fourfold risk)
  11. Differentiate from amebic abscess (young male, single, right lobe, anchovy sauce pus, positive serology, responds to metronidazole alone)

Sources: Sabiston Textbook of Surgery (The Biological Basis of Modern Surgical Practice); Mulholland & Greenfield's Surgery: Scientific Principles and Practice, 7th ed.; Sleisenger & Fordtran's Gastrointestinal and Liver Disease

Can you make a pdf of above notes

Reading File
Running Command

ls -la /home/daytona/workspace/

Running Command

mkdir -p /home/daytona/workspace/pyogenic-liver-abscess && ls /home/daytona/workspace/

Writing File

~/pyogenic-liver-abscess/generate_pdf.py

from reportlab.lib.pagesizes import A4
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm
from reportlab.lib.colors import HexColor, black, white
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    HRFlowable, KeepTogether
)
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_JUSTIFY
from reportlab.lib import colors

OUTPUT = "/home/daytona/workspace/pyogenic-liver-abscess/Pyogenic_Liver_Abscess_Notes.pdf"

# Colors
DARK_BLUE   = HexColor("#1a3a5c")
MED_BLUE    = HexColor("#2563a8")
LIGHT_BLUE  = HexColor("#dbeafe")
ACCENT_GOLD = HexColor("#b45309")
TABLE_HEADER= HexColor("#1e3a5f")
TABLE_ALT   = HexColor("#f0f5ff")
BORDER_BLUE = HexColor("#3b82f6")
RED         = HexColor("#b91c1c")
GREEN       = HexColor("#166534")
LIGHT_GREY  = HexColor("#f8fafc")

doc = SimpleDocTemplate(
    OUTPUT,
    pagesize=A4,
    leftMargin=2*cm, rightMargin=2*cm,
    topMargin=2.5*cm, bottomMargin=2.5*cm,
    title="Pyogenic Liver Abscess — Surgical Notes",
    author="Orris Medical"
)

styles = getSampleStyleSheet()

# Custom styles
title_style = ParagraphStyle("Title", parent=styles["Normal"],
    fontSize=22, textColor=white, fontName="Helvetica-Bold",
    alignment=TA_CENTER, spaceAfter=4)

subtitle_style = ParagraphStyle("Subtitle", parent=styles["Normal"],
    fontSize=11, textColor=HexColor("#cfe0ff"), fontName="Helvetica",
    alignment=TA_CENTER, spaceAfter=2)

h1_style = ParagraphStyle("H1", parent=styles["Normal"],
    fontSize=13, textColor=white, fontName="Helvetica-Bold",
    spaceBefore=10, spaceAfter=4, leftIndent=0,
    backColor=DARK_BLUE, borderPad=6)

h2_style = ParagraphStyle("H2", parent=styles["Normal"],
    fontSize=11, textColor=DARK_BLUE, fontName="Helvetica-Bold",
    spaceBefore=8, spaceAfter=3, leftIndent=0,
    borderPad=2)

body_style = ParagraphStyle("Body", parent=styles["Normal"],
    fontSize=9.5, textColor=HexColor("#1e293b"), fontName="Helvetica",
    leading=14, spaceAfter=4, alignment=TA_JUSTIFY)

bullet_style = ParagraphStyle("Bullet", parent=styles["Normal"],
    fontSize=9.5, textColor=HexColor("#1e293b"), fontName="Helvetica",
    leading=13, spaceAfter=2, leftIndent=14, bulletIndent=4)

note_style = ParagraphStyle("Note", parent=styles["Normal"],
    fontSize=9, textColor=HexColor("#7c3aed"), fontName="Helvetica-Oblique",
    leading=13, spaceAfter=4, leftIndent=10)

key_style = ParagraphStyle("Key", parent=styles["Normal"],
    fontSize=9.5, textColor=HexColor("#166534"), fontName="Helvetica-Bold",
    leading=13, spaceAfter=3, leftIndent=14, bulletIndent=4,
    backColor=HexColor("#f0fdf4"), borderPad=4)

source_style = ParagraphStyle("Source", parent=styles["Normal"],
    fontSize=8, textColor=HexColor("#64748b"), fontName="Helvetica-Oblique",
    alignment=TA_CENTER, spaceBefore=6)


def section_header(text):
    """Blue banner heading."""
    tbl = Table([[Paragraph(f"  {text}", ParagraphStyle("H1inner",
        fontSize=12, textColor=white, fontName="Helvetica-Bold",
        leading=16, leftIndent=4))]],
        colWidths=[17*cm])
    tbl.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), DARK_BLUE),
        ("ROUNDEDCORNERS", [4]),
        ("TOPPADDING", (0,0), (-1,-1), 6),
        ("BOTTOMPADDING", (0,0), (-1,-1), 6),
    ]))
    return tbl

def sub_header(text):
    return Paragraph(f'<font color="#2563a8"><b>▶ {text}</b></font>', h2_style)

def bullet(text):
    return Paragraph(f"• {text}", bullet_style)

def key_point(num, text):
    return Paragraph(f"<b>{num}.</b> {text}", key_style)

def body(text):
    return Paragraph(text, body_style)

def note(text):
    return Paragraph(f"<i>{text}</i>", note_style)

def spacer(h=0.25):
    return Spacer(1, h*cm)

def hr():
    return HRFlowable(width="100%", thickness=0.5, color=BORDER_BLUE, spaceAfter=4, spaceBefore=4)


# ── TABLES ──────────────────────────────────────────────────────────────────

def make_table(headers, rows, col_widths=None):
    data = [[Paragraph(f"<b><font color='white'>{h}</font></b>",
                ParagraphStyle("TH", fontSize=9, fontName="Helvetica-Bold",
                    alignment=TA_CENTER, leading=12)) for h in headers]]
    for i, row in enumerate(rows):
        data.append([Paragraph(str(c),
            ParagraphStyle("TD", fontSize=9, fontName="Helvetica",
                leading=12, spaceAfter=1)) for c in row])
    if col_widths is None:
        col_widths = [17*cm / len(headers)] * len(headers)
    t = Table(data, colWidths=col_widths, repeatRows=1)
    style = [
        ("BACKGROUND", (0,0), (-1,0), TABLE_HEADER),
        ("ROWBACKGROUNDS", (0,1), (-1,-1), [white, TABLE_ALT]),
        ("GRID", (0,0), (-1,-1), 0.4, HexColor("#93c5fd")),
        ("TOPPADDING", (0,0), (-1,-1), 4),
        ("BOTTOMPADDING", (0,0), (-1,-1), 4),
        ("LEFTPADDING", (0,0), (-1,-1), 5),
        ("VALIGN", (0,0), (-1,-1), "TOP"),
        ("FONTSIZE", (0,0), (-1,-1), 9),
    ]
    t.setStyle(TableStyle(style))
    return t

# ── TITLE BLOCK ─────────────────────────────────────────────────────────────

def title_block():
    tbl = Table(
        [[Paragraph("PYOGENIC LIVER ABSCESS", title_style)],
         [Paragraph("Comprehensive Surgical Notes", subtitle_style)],
         [Paragraph("Sabiston · Mulholland & Greenfield · Sleisenger & Fordtran", subtitle_style)]],
        colWidths=[17*cm])
    tbl.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), DARK_BLUE),
        ("TOPPADDING", (0,0), (-1,-1), 8),
        ("BOTTOMPADDING", (0,0), (-1,-1), 8),
        ("ROUNDEDCORNERS", [6]),
    ]))
    return tbl


# ═══════════════════════════════════════════════════════════════════════════
#  BUILD STORY
# ═══════════════════════════════════════════════════════════════════════════
story = []

# Title
story.append(title_block())
story.append(spacer(0.5))

# Definition
story.append(section_header("1.  DEFINITION"))
story.append(spacer(0.2))
story.append(body(
    "A <b>pyogenic liver abscess (PLA)</b> is a focal collection of purulent bacterial material and "
    "necroinflammatory debris within the liver parenchyma. It may be <b>solitary or multiple</b> "
    "and is caused by one or more aerobic or anaerobic bacteria."
))

# Epidemiology
story.append(spacer(0.3))
story.append(section_header("2.  EPIDEMIOLOGY"))
story.append(spacer(0.2))
epi = [
    ("Annual incidence", "~2.3 cases per 100,000 persons"),
    ("Prevalence", "Most common type of visceral abscess (13% of intra-abdominal abscesses)"),
    ("Age shift", "Historically 20–30s (appendicitis era) → now predominantly <b>50–60s</b> (biliary/cryptogenic era)"),
    ("Sex ratio", "Male : Female ≈ <b>1.5 : 1</b>; no significant ethnic/geographic difference"),
    ("Lobe", "<b>Right lobe ~75%</b> of cases (greater portal venous flow)"),
    ("Key comorbidities", "Cirrhosis, diabetes mellitus, chronic renal failure, malignancy"),
]
t = Table(
    [[Paragraph(f"<b>{k}</b>", ParagraphStyle("EK", fontSize=9, fontName="Helvetica-Bold", leading=12)),
      Paragraph(v, ParagraphStyle("EV", fontSize=9, fontName="Helvetica", leading=12))] for k, v in epi],
    colWidths=[4.5*cm, 12.5*cm]
)
t.setStyle(TableStyle([
    ("ROWBACKGROUNDS", (0,0), (-1,-1), [LIGHT_BLUE, white]),
    ("GRID", (0,0), (-1,-1), 0.4, BORDER_BLUE),
    ("TOPPADDING", (0,0), (-1,-1), 4),
    ("BOTTOMPADDING", (0,0), (-1,-1), 4),
    ("LEFTPADDING", (0,0), (-1,-1), 6),
    ("VALIGN", (0,0), (-1,-1), "TOP"),
]))
story.append(t)

# Aetiology
story.append(spacer(0.3))
story.append(section_header("3.  AETIOLOGY & ROUTES OF INFECTION"))
story.append(spacer(0.2))
ae_headers = ["Route", "Mechanism", "Common Causes"]
ae_rows = [
    ["Biliary tree\n(most common identifiable)", "Ascending suppurative cholangitis → bile stasis → bacterial colonisation",
     "Choledocholithiasis, malignant biliary obstruction, Caroli disease, biliary-enteric anastomosis, biliary ascariasis"],
    ["Portal vein (Pylephlebitis)", "Intra-abdominal infection → portal vein bacteraemia ascending to liver",
     "Appendicitis, diverticulitis, pancreatitis, IBD, PID, perforated viscus, omphalitis (neonates)"],
    ["Hepatic artery (systemic bacteraemia)", "Any systemic infection seeds liver via hepatic artery",
     "Endocarditis, pneumonia, osteomyelitis, septicaemia"],
    ["Direct extension", "Contiguous spread from adjacent infection",
     "Suppurative cholecystitis, subphrenic/perinephric abscess, bowel perforation into liver"],
    ["Trauma / iatrogenic", "Intrahepatic haematoma / necrosis → superinfection",
     "Penetrating/blunt trauma, hepatic artery embolisation, thermal ablation (especially with prior biliary-enteric anastomosis)"],
    ["Cryptogenic (most common overall)", "No identifiable source (~40% of cases)",
     "Possible: oral flora / severe periodontal disease (especially alcoholics); undetected GI malignancy"],
]
story.append(make_table(ae_headers, ae_rows, [3.5*cm, 5.5*cm, 8*cm]))
story.append(spacer(0.2))
story.append(note(
    "Historical note: Ochsner & DeBakey (1938) — appendicitis via portal vein was the dominant cause. "
    "Today, biliary disease and cryptogenic causes predominate in Western countries. "
    "In Asia, recurrent pyogenic cholangitis (intrahepatic stones) remains important."
))

# Risk Factors
story.append(spacer(0.3))
story.append(section_header("4.  RISK FACTORS"))
story.append(spacer(0.2))
rf_left = [
    "Diabetes mellitus (most important comorbidity)",
    "Cirrhosis",
    "Chronic renal failure",
    "Malignancy / immunosuppression",
    "Liver transplantation",
]
rf_right = [
    "Previous hepatobiliary/pancreatic disease or surgery",
    "Chronic granulomatous disease (children — susceptibility to S. aureus)",
    "Atrophic gastritis / elderly (altered bowel flora)",
    "Colorectal cancer: <b>fourfold increased incidence</b> of GI malignancy in PLA patients (especially Klebsiella pneumoniae)",
]
rf_data = []
for i in range(max(len(rf_left), len(rf_right))):
    l = bullet(rf_left[i]) if i < len(rf_left) else Paragraph("", body_style)
    r = bullet(rf_right[i]) if i < len(rf_right) else Paragraph("", body_style)
    rf_data.append([l, r])
rf_table = Table(rf_data, colWidths=[8.5*cm, 8.5*cm])
rf_table.setStyle(TableStyle([
    ("VALIGN", (0,0), (-1,-1), "TOP"),
    ("TOPPADDING", (0,0), (-1,-1), 2),
    ("BOTTOMPADDING", (0,0), (-1,-1), 2),
]))
story.append(rf_table)

# Microbiology
story.append(spacer(0.3))
story.append(section_header("5.  MICROBIOLOGY"))
story.append(spacer(0.2))
story.append(body("Most PLAs are <b>polymicrobial</b> (enteric + anaerobic organisms)."))
story.append(spacer(0.15))

micro_headers = ["Category", "Organisms", "Notes"]
micro_rows = [
    ["Gram-negative aerobes\n(most common)", "E. coli (most frequent), Klebsiella pneumoniae, Enterobacter spp., Pseudomonas spp., Proteus spp., Citrobacter spp.",
     "K. pneumoniae virulent strains → abscess without hepatobiliary disease; metastatic septic complications (endophthalmitis, meningitis)"],
    ["Gram-positive aerobes", "Streptococcus milleri (anginosus) group, Enterococcus spp., S. aureus, S. pyogenes",
     "S. aureus most common in children and septicaemia; Chronic granulomatous disease"],
    ["Anaerobes", "Bacteroides fragilis (most common anaerobe), Fusobacterium necrophorum, anaerobic streptococci, Peptostreptococcus, Prevotella spp.",
     "Improved cultivation → more anaerobic isolates detected"],
    ["Special situations", "Salmonella Typhi (recurrent pyogenic cholangitis); Candida spp. (immunocompromised); Mycobacterium tuberculosis (rare); Actinomyces, Clostridium (uncommon)",
     "Fungal abscesses in haematologic malignancy"],
]
story.append(make_table(micro_headers, micro_rows, [3.5*cm, 7*cm, 6.5*cm]))

# Clinical Features
story.append(spacer(0.3))
story.append(section_header("6.  CLINICAL FEATURES"))
story.append(spacer(0.2))

story.append(sub_header("Symptoms"))
symp = [
    ("<b>Fever with chills/rigors</b>", "Most common symptom (up to 90%); may be spiking or low-grade (insidious)"),
    ("<b>Right upper quadrant pain</b>", "Dull, constant; increases with movement. Referred to right shoulder or cough if abscess near dome"),
    ("Anorexia, nausea, malaise", "Constitutional symptoms; weight loss if chronic"),
    ("Presentation", "<b>Subacute/insidious</b> in most; symptoms may persist >1 month before diagnosis. Multiple abscesses → acute presentation with sepsis/shock"),
]
sym_t = Table(
    [[Paragraph(k, ParagraphStyle("SK", fontSize=9, fontName="Helvetica", leading=12)),
      Paragraph(v, ParagraphStyle("SV", fontSize=9, fontName="Helvetica", leading=12))] for k, v in symp],
    colWidths=[5*cm, 12*cm]
)
sym_t.setStyle(TableStyle([
    ("ROWBACKGROUNDS", (0,0), (-1,-1), [white, LIGHT_BLUE]),
    ("GRID", (0,0), (-1,-1), 0.3, BORDER_BLUE),
    ("TOPPADDING", (0,0), (-1,-1), 3),
    ("BOTTOMPADDING", (0,0), (-1,-1), 3),
    ("LEFTPADDING", (0,0), (-1,-1), 5),
    ("VALIGN", (0,0), (-1,-1), "TOP"),
]))
story.append(sym_t)
story.append(spacer(0.2))

story.append(sub_header("Signs"))
signs = [
    "Fever",
    "Tender hepatomegaly (accentuated by percussion/movement) — most consistent sign",
    "Jaundice — late feature; early only if biliary disease is the underlying cause",
    "Splenomegaly — unusual; only in chronic abscess",
    "Portal hypertension — may follow recovery if portal vein was thrombosed (pylephlebitis)",
]
for s in signs:
    story.append(bullet(s))

# Investigations
story.append(spacer(0.3))
story.append(section_header("7.  INVESTIGATIONS"))
story.append(spacer(0.2))

story.append(sub_header("A. Blood Tests"))
lab_headers = ["Test", "Finding", "Frequency"]
lab_rows = [
    ["WBC", "Leukocytosis", "70–90%"],
    ["Haemoglobin", "Normochromic, normocytic anaemia", "Common"],
    ["Alkaline Phosphatase (ALP)", "Mildly elevated", "~80%"],
    ["Total Bilirubin", "Elevated", "20–50%"],
    ["Transaminases (AST/ALT)", "Mildly elevated", "~60%"],
    ["Serum Albumin", "Hypoalbuminaemia (reflects chronicity)", "Variable"],
    ["PT / INR", "Mildly elevated in chronic cases", "Variable"],
    ["ESR", "Elevated", "Common"],
]
story.append(make_table(lab_headers, lab_rows, [5.5*cm, 7.5*cm, 4*cm]))
story.append(spacer(0.1))
story.append(note("None of these tests are specific — they raise suspicion that leads to imaging."))
story.append(spacer(0.2))

story.append(sub_header("B. Cultures (Critical)"))
cult = [
    "<b>Blood cultures</b>: positive in ~<b>50%</b> of cases — must be drawn <b>before antibiotics</b>",
    "<b>Aspirate cultures</b> (aerobic + anaerobic): yield ~90% (lower if antibiotics already started)",
    "<b>Serology for Entamoeba histolytica</b> (ELISA): in patients with epidemiologic risk factors",
]
for c in cult:
    story.append(bullet(c))
story.append(spacer(0.2))

story.append(sub_header("C. Imaging"))
img_headers = ["Modality", "Sensitivity", "Findings / Notes"]
img_rows = [
    ["Chest X-ray", "~50% abnormal", "Elevated right hemidiaphragm, right pleural effusion, right basal atelectasis"],
    ["Plain Abdominal X-ray", "Rarely helpful", "Air-fluid levels in cavity; portal venous gas (grave sign — high mortality)"],
    ["Ultrasound (first-line)", "80–95%", "Hypoechoic round/oval lesion; distinguishes solid from cystic; guides aspiration. Limitation: poor for dome lesions; operator-dependent"],
    ["CT (contrast-enhanced)\n— Investigation of Choice", "95–100%", "Hypodense lesion with rim enhancement (<20%); detects small/multiple abscesses and gas in cavity; identifies underlying cause. Gas in abscess = increased mortality"],
    ["MRI", "Higher than CT for small lesions", "Low T1, high T2 signal; gadolinium enhancement. No advantage over CT for diagnosis; better for biliary tree assessment"],
    ["ERCP", "—", "Indicated when biliary stones or cholestasis present on imaging"],
]
story.append(make_table(img_headers, img_rows, [3.8*cm, 3cm, 10.2*cm]))

# Differential Diagnosis
story.append(spacer(0.3))
story.append(section_header("8.  DIFFERENTIAL DIAGNOSIS"))
story.append(spacer(0.2))

story.append(sub_header("Pyogenic vs. Amebic Liver Abscess"))
comp_headers = ["Feature", "PYOGENIC", "AMEBIC"]
comp_rows = [
    ["Age", ">50 years", "20–40 years"],
    ["Sex ratio (M:F)", "1.5 : 1", "≥ 10 : 1"],
    ["Number", "Often MULTIPLE", "Usually SINGLE"],
    ["Location", "Either lobe (Right > Left)", "Right lobe, near diaphragm"],
    ["Presentation", "Subacute (insidious)", "Acute"],
    ["Jaundice", "Mild (late)", "Moderate"],
    ["Serology (E. histolytica)", "Negative", "Positive"],
    ["Pus character", "Purulent, foul-smelling", "'Anchovy sauce' — odourless (unless superinfected)"],
    ["Treatment", "Drainage + IV antibiotics", "Metronidazole alone (no drainage usually needed)"],
]
ct = make_table(comp_headers, comp_rows, [4.5*cm, 6.25*cm, 6.25*cm])
story.append(ct)
story.append(spacer(0.2))

story.append(sub_header("Other Differentials"))
other_dd = [
    ("Echinococcal cyst", "Endemic area, daughter cysts on imaging, positive serology"),
    ("Simple hepatic cyst", "Thin wall, no enhancement, no symptoms, no fever"),
    ("Hepatocellular carcinoma", "AFP elevated, arterial enhancement + washout on CT"),
    ("Hepatic metastasis", "Known primary, multiple lesions, no fever"),
    ("Inflammatory pseudotumour", "Young men, history of infection, biopsy needed for diagnosis"),
]
for cond, feat in other_dd:
    story.append(bullet(f"<b>{cond}</b>: {feat}"))

# Treatment
story.append(spacer(0.3))
story.append(section_header("9.  TREATMENT"))
story.append(spacer(0.2))
story.append(body("Treatment requires a <b>multimodal approach</b>: antibiotics + drainage + treatment of the underlying cause."))
story.append(spacer(0.15))

story.append(sub_header("Step 1 — Resuscitation & Supportive Care"))
story.append(bullet("IV fluids, correction of electrolytes"))
story.append(bullet("Send blood cultures × 2 <b>before</b> starting antibiotics"))
story.append(spacer(0.15))

story.append(sub_header("Step 2 — Empiric IV Antibiotics (Start Immediately)"))
abx_headers = ["Regimen", "Coverage", "Notes"]
abx_rows = [
    ["Ampicillin + Aminoglycoside + Metronidazole", "Gram-positive, gram-negative, anaerobes", "Classic triple therapy; avoid aminoglycoside in renal impairment"],
    ["3rd-gen Cephalosporin (e.g., Ceftriaxone) + Metronidazole", "Enteric gram-negatives + anaerobes", "Preferred regimen in most centres"],
    ["Piperacillin-Tazobactam", "Broad-spectrum (gram-positive + negative + anaerobes)", "Good single-agent option"],
]
story.append(make_table(abx_headers, abx_rows, [5*cm, 5*cm, 7*cm]))
story.append(spacer(0.1))
story.append(bullet("Narrow to targeted therapy once culture & sensitivity available"))
story.append(bullet("<b>Duration</b>: 14 days IV → oral for a total of <b>4–6 weeks</b>"))
story.append(bullet("Antibiotics alone (no drainage) → mortality <b>59–100%</b> — not acceptable"))
story.append(spacer(0.2))

story.append(sub_header("Step 3 — Drainage"))
drain_headers = ["Method", "Success Rate", "Details"]
drain_rows = [
    ["Percutaneous Catheter Drainage (PCD)\n— TREATMENT OF CHOICE",
     "66–90%",
     "US/CT-guided; catheter left in situ until output minimal (~7 days). Aspirate → Gram stain + aerobic/anaerobic culture. Relatively contraindicated: ascites, coagulopathy, proximity to vital structures"],
    ["Percutaneous Needle Aspiration\n(without indwelling catheter)",
     "60–90%\n(often needs >1 session)",
     "Majority require multiple aspirations (25% need ≥3). RCT: catheter 100% vs aspiration 60% success. Single aspiration trial is reasonable for small abscesses"],
    ["Surgical Drainage\n(Open or Laparoscopic)",
     "High (reserved for failures)",
     "Indicated: failed PCD; need to treat surgical primary cause (appendicitis, diverticulitis); ruptured abscess; multiple abscesses not amenable to PCD; large abscess >5 cm where PCD fails"],
    ["ERCP / Biliary Drainage",
     "—",
     "Indicated when underlying biliary obstruction (stones, stricture, malignancy) is identified — addresses the primary source"],
]
story.append(make_table(drain_headers, drain_rows, [4.5*cm, 3cm, 9.5*cm]))
story.append(spacer(0.2))

story.append(sub_header("Step 4 — Treat the Underlying Cause"))
story.append(bullet("Biliary disease (ERCP, cholecystectomy, biliary stenting)"))
story.append(bullet("GI malignancy — colonoscopy/endoscopy if K. pneumoniae or cryptogenic PLA"))
story.append(bullet("Diverticulitis, appendicitis — surgical management as appropriate"))

# Complications
story.append(spacer(0.3))
story.append(section_header("10.  COMPLICATIONS"))
story.append(spacer(0.2))
comp_left = [
    "Rupture — peritoneal cavity (peritonitis)",
    "Rupture — pleural cavity (empyema thoracis)",
    "Rupture — pericardium (purulent pericarditis)",
    "Septicaemia / septic shock",
]
comp_right = [
    "Portal vein thrombosis → portal hypertension",
    "Subphrenic abscess",
    "Biliary fistula",
    "Metastatic septic emboli (K. pneumoniae: endophthalmitis, meningitis)",
]
comp_data = []
for i in range(max(len(comp_left), len(comp_right))):
    l = bullet(comp_left[i]) if i < len(comp_left) else Paragraph("", body_style)
    r = bullet(comp_right[i]) if i < len(comp_right) else Paragraph("", body_style)
    comp_data.append([l, r])
comp_t = Table(comp_data, colWidths=[8.5*cm, 8.5*cm])
comp_t.setStyle(TableStyle([("VALIGN", (0,0), (-1,-1), "TOP"), ("TOPPADDING", (0,0), (-1,-1), 2), ("BOTTOMPADDING", (0,0), (-1,-1), 2)]))
story.append(comp_t)

# Prognosis
story.append(spacer(0.3))
story.append(section_header("11.  PROGNOSIS"))
story.append(spacer(0.2))
prog = [
    "Ochsner & DeBakey era (pre-antibiotic): mortality <b>70–80%</b>",
    "Modern mortality: <b>5–30%</b> with aggressive antibiotic therapy and drainage",
]
for p in prog:
    story.append(bullet(p))
story.append(spacer(0.15))
story.append(sub_header("Poor Prognostic Factors"))
poor = ["Jaundice", "Hypoalbuminaemia", "Multiple abscesses", "Underlying malignancy", "Gas in abscess cavity (plain X-ray finding)", "Delay in diagnosis / treatment", "Rupture"]
poor_data = [[bullet(poor[i]) if i < len(poor) else Paragraph("", body_style),
              bullet(poor[i+1]) if i+1 < len(poor) else Paragraph("", body_style)]
             for i in range(0, len(poor), 2)]
poor_t = Table(poor_data, colWidths=[8.5*cm, 8.5*cm])
poor_t.setStyle(TableStyle([("VALIGN", (0,0), (-1,-1), "TOP"), ("TOPPADDING", (0,0), (-1,-1), 2)]))
story.append(poor_t)

# Key Points
story.append(spacer(0.3))
story.append(section_header("12.  KEY POINTS  (SRB-STYLE SUMMARY)"))
story.append(spacer(0.2))

key_points = [
    "Most common <b>visceral abscess</b>; right lobe predominance (75%)",
    "<b>Biliary disease</b> = most common identifiable cause; <b>cryptogenic</b> predominates overall (~40%)",
    "Most common organisms: <b>E. coli</b> and <b>K. pneumoniae</b>; mostly <b>polymicrobial</b>",
    "Classic presentation: <b>Fever + RUQ pain + tender hepatomegaly</b> (+ jaundice if biliary origin)",
    "Presentation is usually <b>subacute/insidious</b>; multiple abscesses → more acute with sepsis",
    "<b>Contrast-enhanced CT</b> = investigation of choice (sensitivity 95–100%)",
    "<b>Blood cultures × 2</b> before antibiotics (positive in ~50%)",
    "<b>Percutaneous catheter drainage + IV antibiotics</b> = standard of care",
    "Surgery reserved for <b>failed PCD</b>, ruptured abscess, or concurrent surgical pathology",
    "<b>Klebsiella PLA</b> → screen for colorectal malignancy (fourfold risk); risk of metastatic septic foci",
    "Differentiate from <b>amebic abscess</b>: young male, single, right lobe, anchovy sauce pus, positive serology, responds to metronidazole alone without drainage",
    "Antibiotic duration: <b>2 weeks IV → 4–6 weeks total</b>",
]
for i, kp in enumerate(key_points, 1):
    story.append(key_point(i, kp))
    story.append(spacer(0.05))

# Sources
story.append(spacer(0.4))
story.append(hr())
story.append(Paragraph(
    "Sources: Sabiston Textbook of Surgery (The Biological Basis of Modern Surgical Practice) · "
    "Mulholland & Greenfield's Surgery: Scientific Principles and Practice, 7th ed. · "
    "Sleisenger & Fordtran's Gastrointestinal and Liver Disease",
    source_style
))

# ── BUILD PDF ──────────────────────────────────────────────────────────────
doc.build(story)
print(f"PDF generated: {OUTPUT}")
Running Command

cd /home/daytona/workspace/pyogenic-liver-abscess && python generate_pdf.py

You've run out of free credits. Sign up for a free account to continue using Orris.
This is a shared conversation. Sign in to Orris to start your own chat.