explain meningitis pathology from robbins pathology book
| Type | Usual Cause | CSF Pattern |
|---|---|---|
| Acute Pyogenic | Bacterial | Neutrophilic pleocytosis, ↑↑ protein, ↓↓ glucose |
| Aseptic (Viral) | Viral (enteroviruses most common) | Lymphocytic pleocytosis, ↑ protein (moderate), normal glucose |
| Chronic | TB, spirochetes, fungi | Mixed cellularity, ↑ protein, ↓ or normal glucose |
| Age Group | Common Organisms |
|---|---|
| Neonates | Escherichia coli, Group B Streptococci |
| Adolescents/Young Adults | Neisseria meningitidis |
| Elderly | Streptococcus pneumoniae, Listeria monocytogenes |

| Parameter | Bacterial | Viral | Tuberculous/Fungal |
|---|---|---|---|
| Appearance | Turbid/purulent | Clear | Clear/viscous |
| Cells | Neutrophils ↑↑ | Lymphocytes ↑ | Lymphocytes/mixed ↑ |
| Protein | ↑↑ | Mildly ↑ | ↑↑ |
| Glucose | ↓↓ | Normal | ↓ or normal |
make pdf
ls -la /home/daytona/workspace/ 2>/dev/null || mkdir -p /home/daytona/workspace
mkdir -p /home/daytona/workspace/meningitis-pdf
~/meningitis-pdf/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 import colors
from reportlab.platypus import (
SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
HRFlowable, Image, KeepTogether
)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
import urllib.request
import os
OUTPUT = "/home/daytona/workspace/meningitis-pdf/Meningitis_Pathology_Robbins.pdf"
# Download brain image
img_url = "https://cdn.orris.care/cdss_images/a1b43e7b5560ad74493828517fb67d7428a26b46f8b47d8fa140658ba8d75a8c.png"
img_path = "/home/daytona/workspace/meningitis-pdf/pyogenic_meningitis.png"
if not os.path.exists(img_path):
urllib.request.urlretrieve(img_url, img_path)
doc = SimpleDocTemplate(
OUTPUT,
pagesize=A4,
rightMargin=2*cm, leftMargin=2*cm,
topMargin=2.5*cm, bottomMargin=2.5*cm
)
styles = getSampleStyleSheet()
# Custom styles
title_style = ParagraphStyle(
'CustomTitle',
parent=styles['Title'],
fontSize=22,
textColor=colors.HexColor('#1a3a5c'),
spaceAfter=6,
alignment=TA_CENTER,
fontName='Helvetica-Bold'
)
subtitle_style = ParagraphStyle(
'Subtitle',
parent=styles['Normal'],
fontSize=10,
textColor=colors.HexColor('#555555'),
alignment=TA_CENTER,
spaceAfter=16
)
h1_style = ParagraphStyle(
'H1',
parent=styles['Heading1'],
fontSize=14,
textColor=colors.white,
fontName='Helvetica-Bold',
spaceAfter=4,
spaceBefore=14,
leftIndent=0,
backColor=colors.HexColor('#1a3a5c'),
borderPad=(4, 6, 4, 6),
)
h2_style = ParagraphStyle(
'H2',
parent=styles['Heading2'],
fontSize=12,
textColor=colors.HexColor('#1a3a5c'),
fontName='Helvetica-Bold',
spaceAfter=4,
spaceBefore=10,
borderPad=0,
)
h3_style = ParagraphStyle(
'H3',
parent=styles['Heading3'],
fontSize=10,
textColor=colors.HexColor('#2c5f8a'),
fontName='Helvetica-BoldOblique',
spaceAfter=3,
spaceBefore=7,
)
body_style = ParagraphStyle(
'Body',
parent=styles['Normal'],
fontSize=10,
leading=15,
spaceAfter=6,
alignment=TA_JUSTIFY,
fontName='Helvetica'
)
caption_style = ParagraphStyle(
'Caption',
parent=styles['Normal'],
fontSize=8.5,
textColor=colors.HexColor('#444444'),
alignment=TA_CENTER,
fontName='Helvetica-Oblique',
spaceAfter=8
)
bullet_style = ParagraphStyle(
'Bullet',
parent=styles['Normal'],
fontSize=10,
leading=14,
leftIndent=16,
spaceAfter=3,
bulletIndent=4,
fontName='Helvetica'
)
def H1(text):
# Draw a colored banner
return Paragraph(f"<font color='white'><b> {text}</b></font>", h1_style)
def H2(text):
return Paragraph(text, h2_style)
def H3(text):
return Paragraph(text, h3_style)
def P(text):
return Paragraph(text, body_style)
def B(text):
return Paragraph(f"• {text}", bullet_style)
def Sp(h=8):
return Spacer(1, h)
def HR():
return HRFlowable(width="100%", thickness=0.5, color=colors.HexColor('#cccccc'), spaceAfter=4, spaceBefore=4)
# ---- TABLE HELPER ----
TABLE_HEADER_BG = colors.HexColor('#1a3a5c')
TABLE_ROW_BG = colors.HexColor('#eaf2fb')
TABLE_ALT_BG = colors.white
def make_table(data, col_widths=None):
n_cols = len(data[0])
if col_widths is None:
w = (A4[0] - 4*cm) / n_cols
col_widths = [w] * n_cols
style = TableStyle([
('BACKGROUND', (0,0), (-1,0), TABLE_HEADER_BG),
('TEXTCOLOR', (0,0), (-1,0), colors.white),
('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
('FONTSIZE', (0,0), (-1,0), 9),
('ALIGN', (0,0), (-1,-1), 'LEFT'),
('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
('ROWBACKGROUNDS', (0,1), (-1,-1), [TABLE_ROW_BG, TABLE_ALT_BG]),
('FONTNAME', (0,1), (-1,-1), 'Helvetica'),
('FONTSIZE', (0,1), (-1,-1), 9),
('GRID', (0,0), (-1,-1), 0.4, colors.HexColor('#aaaaaa')),
('LEFTPADDING',(0,0), (-1,-1), 6),
('RIGHTPADDING',(0,0),(-1,-1), 6),
('TOPPADDING', (0,0), (-1,-1), 4),
('BOTTOMPADDING',(0,0),(-1,-1), 4),
])
formatted_data = []
for i, row in enumerate(data):
formatted_row = []
for cell in row:
fs = 9
fn = 'Helvetica-Bold' if i == 0 else 'Helvetica'
fc = colors.white if i == 0 else colors.black
p = Paragraph(str(cell), ParagraphStyle('tc', fontSize=fs, fontName=fn, textColor=fc, leading=13))
formatted_row.append(p)
formatted_data.append(formatted_row)
return Table(formatted_data, colWidths=col_widths, style=style, repeatRows=1)
# ===================== CONTENT =====================
story = []
# --- Cover ---
story.append(Sp(20))
story.append(Paragraph("Meningitis", title_style))
story.append(Paragraph("Pathology — From Robbins & Kumar", subtitle_style))
story.append(HR())
story.append(Paragraph(
"<i>Sources: Robbins & Kumar Basic Pathology (9th Ed.) | "
"Robbins, Cotran & Kumar Pathologic Basis of Disease</i>",
caption_style
))
story.append(Sp(10))
# --- Definition ---
story.append(H1("1. Definition"))
story.append(Sp(6))
story.append(P(
"<b>Meningitis</b> is an inflammatory process involving the <b>leptomeninges and CSF within the "
"subarachnoid space</b>, typically caused by infection. When inflammation extends into the brain "
"parenchyma, it is termed <b>meningoencephalitis</b>."
))
story.append(P("Non-infectious forms include:"))
story.append(B("<b>Chemical meningitis</b> — response to irritants (e.g., debris from a ruptured epidermoid cyst)"))
story.append(B("<b>Carcinomatous meningitis</b> — metastatic cancer cells spreading to the subarachnoid space"))
story.append(B("<b>Autoimmune meningitis</b> — associated with systemic autoimmune disease"))
story.append(Sp(4))
# --- Classification Table ---
story.append(H1("2. Classification"))
story.append(Sp(6))
story.append(P("Infectious meningitis is classified into three subtypes based on etiology and clinical evolution:"))
story.append(Sp(4))
class_data = [
["Type", "Usual Cause", "CSF Pattern"],
["Acute Pyogenic", "Bacterial", "Neutrophilic pleocytosis, ↑↑ protein, ↓↓ glucose"],
["Aseptic (Viral)", "Enteroviruses (80% of cases)", "Lymphocytic pleocytosis, ↑ protein (moderate), normal glucose"],
["Chronic", "TB, spirochetes, fungi", "Mixed cellularity, ↑ protein, ↓ or normal glucose"],
]
story.append(make_table(class_data, col_widths=[4.5*cm, 5.5*cm, 7.5*cm]))
story.append(Sp(10))
# --- Acute Pyogenic ---
story.append(H1("3. Acute Pyogenic (Bacterial) Meningitis"))
story.append(Sp(6))
story.append(H2("Causative Organisms by Age"))
age_data = [
["Age Group", "Common Organisms"],
["Neonates", "Escherichia coli, Group B Streptococci"],
["Adolescents / Young Adults", "Neisseria meningitidis"],
["Elderly", "Streptococcus pneumoniae, Listeria monocytogenes"],
["Immunosuppressed", "Klebsiella, anaerobes (atypical course)"],
]
story.append(make_table(age_data, col_widths=[6*cm, 11.5*cm]))
story.append(Sp(6))
story.append(P(
"Note: <i>Haemophilus influenzae</i> was formerly a major cause in infants; widespread immunization "
"has dramatically reduced its incidence."
))
story.append(H2("Clinical Features"))
story.append(B("Systemic: fever, malaise"))
story.append(B("Meningeal irritation: headache, photophobia, neck stiffness"))
story.append(B("Neurologic: irritability, clouding of consciousness"))
story.append(Sp(4))
story.append(H2("CSF Findings"))
csf_data = [
["Parameter", "Bacterial"],
["Appearance", "Turbid / frankly purulent"],
["Cells", "Neutrophils ↑↑"],
["Protein", "Elevated ↑↑"],
["Glucose", "Markedly reduced ↓↓"],
["Pressure", "Increased"],
]
story.append(make_table(csf_data, col_widths=[6*cm, 11.5*cm]))
story.append(Sp(8))
story.append(H2("Morphology"))
story.append(H3("Gross Pathology"))
story.append(B("<b>Exudate</b> within leptomeninges on brain surface; meningeal vessels engorged and prominent"))
story.append(B("<b>Tracts of pus</b> extend along blood vessels"))
story.append(B("Distribution varies: <i>H. influenzae</i> → basal; pneumococcal → cerebral convexities near sagittal sinus"))
story.append(B("Fulminant cases: inflammation extends to ventricles (<b>ventriculitis</b>); choroid plexus acts as portal of entry"))
story.append(Sp(4))
story.append(H3("Microscopic Pathology"))
story.append(B("<b>Neutrophils fill the subarachnoid space</b> (severe) or surround leptomeningeal vessels (mild)"))
story.append(B("<b>Gram stain</b> reveals bacteria, especially in untreated cases"))
story.append(B("Fulminant: inflammatory cells infiltrate leptomeningeal vein walls → extend into brain parenchyma (<b>cerebritis</b>)"))
story.append(B("Secondary <b>vasculitis</b> and <b>venous thrombosis</b> → <b>hemorrhagic cerebral infarction</b>"))
story.append(Sp(6))
# Brain image
try:
img = Image(img_path, width=12*cm, height=8*cm, kind='proportional')
img.hAlign = 'CENTER'
story.append(KeepTogether([
img,
Paragraph(
"<i>Fig. 21.16 / Fig. 28.23 — Pyogenic meningitis. A thick layer of suppurative exudate covers "
"the brain surface and thickens the leptomeninges. (Robbins Pathology)</i>",
caption_style
)
]))
except Exception as e:
story.append(P(f"[Image not available: {e}]"))
story.append(Sp(6))
story.append(H3("Sequelae"))
story.append(B("<b>Leptomeningeal fibrosis</b> → <b>hydrocephalus</b>"))
story.append(B("Pneumococcal meningitis: capsular polysaccharide → gelatinous exudate → <b>chronic adhesive arachnoiditis</b>"))
story.append(B("<b>Waterhouse-Friderichsen syndrome</b>: septicemia + hemorrhagic infarction of adrenal glands (meningococcal/pneumococcal)"))
story.append(Sp(8))
# --- Aseptic Viral ---
story.append(H1("4. Aseptic (Viral) Meningitis"))
story.append(Sp(6))
story.append(P(
"Aseptic meningitis is a <b>clinical term</b> for meningitis manifestations (meningeal irritation, "
"fever, altered consciousness) <b>without organisms identifiable by bacterial culture</b>. "
"It is generally viral in etiology; may be rickettsial or autoimmune. "
"<b>Enteroviruses</b> account for ~<b>80%</b> of identified cases. Usually self-limited."
))
story.append(H2("CSF Findings"))
vcsf_data = [
["Parameter", "Viral (Aseptic)"],
["Cells", "Lymphocytic pleocytosis"],
["Protein", "Moderately elevated"],
["Glucose", "Normal (key distinguishing feature)"],
]
story.append(make_table(vcsf_data, col_widths=[6*cm, 11.5*cm]))
story.append(Sp(4))
story.append(H2("Morphology"))
story.append(B("Leptomeningeal infiltration by <b>lymphocytes and monocytes</b> (not neutrophils)"))
story.append(B("No suppurative exudate"))
story.append(B("Less dramatic changes than bacterial meningitis"))
story.append(Sp(8))
# --- Chronic Meningitis ---
story.append(H1("5. Chronic Meningitis"))
story.append(Sp(6))
story.append(P(
"Caused by <b>mycobacteria, spirochetes, and fungi</b>. These infections often also involve "
"the brain parenchyma."
))
story.append(H2("A. Tuberculous Meningitis"))
story.append(B("Symptoms: headache, malaise, mental confusion, vomiting"))
story.append(B("CSF: moderate ↑ cellularity (mononuclear or mixed), ↑↑ protein, ↓ or normal glucose"))
story.append(B("<b>Tuberculoma</b>: well-circumscribed intraparenchymal mass; may coexist with meningitis"))
story.append(B("Complication: <b>arachnoid fibrosis</b> at base of brain → <b>hydrocephalus</b> (impaired CSF resorption)"))
story.append(Sp(6))
story.append(H2("B. Spirochetal Infections (Neurosyphilis)"))
story.append(P(
"Occurs in ~10% of untreated <i>Treponema pallidum</i> infection (tertiary syphilis). "
"HIV co-infection increases risk and aggressiveness."
))
syphilis_data = [
["Pattern", "Description"],
["Meningovascular neurosyphilis", "Chronic meningitis (basal) + obliterative endarteritis → strokes"],
["Paretic neurosyphilis (General paresis)", "Progressive dementia from direct parenchymal invasion"],
["Tabes dorsalis", "Degeneration of posterior spinal columns and dorsal nerve roots"],
["Lyme neuroborreliosis (B. burgdorferi)", "Meningitis, cranial nerve palsies, radiculopathy"],
]
story.append(make_table(syphilis_data, col_widths=[6.5*cm, 11*cm]))
story.append(Sp(6))
story.append(H2("C. Fungal Meningitis"))
story.append(B("<b>Cryptococcus neoformans</b>: most important fungal cause; especially in HIV/immunocompromised"))
story.append(B("Produces <b>gelatinous meningitis</b> as organisms fill the subarachnoid space"))
story.append(B("Characteristic <b>'soap-bubble' lesions</b> (pseudocysts) in basal ganglia/cortex"))
story.append(Sp(8))
# --- CSF Comparison Table ---
story.append(H1("6. CSF Summary — Comparison Table"))
story.append(Sp(6))
csf_comp = [
["Parameter", "Bacterial", "Viral", "TB / Fungal"],
["Appearance", "Turbid/purulent", "Clear", "Clear/viscous"],
["Predominant cells", "Neutrophils ↑↑", "Lymphocytes ↑", "Lymphocytes/mixed ↑"],
["Protein", "↑↑", "Mildly ↑", "↑↑"],
["Glucose", "↓↓", "Normal", "↓ or normal"],
]
story.append(make_table(csf_comp, col_widths=[4.5*cm, 4.5*cm, 4.5*cm, 4*cm]))
story.append(Sp(10))
# Footer note
story.append(HR())
story.append(Paragraph(
"<i>Robbins & Kumar Basic Pathology (Robbins Pathology), Chapter 21 | "
"Robbins, Cotran & Kumar Pathologic Basis of Disease, Chapter 28</i>",
caption_style
))
# Build
doc.build(story)
print("PDF generated successfully:", OUTPUT)
python /home/daytona/workspace/meningitis-pdf/generate_pdf.py
Meningitis Pathology Robbins
PDF Document · PDF