Meningitis
"meningitis" AND "management"
| Type | Usual Cause | CSF Pattern |
|---|---|---|
| Acute pyogenic | Bacterial | Neutrophilic pleocytosis, low glucose, high protein |
| Aseptic (viral) | Enteroviruses, HSV, HIV | Lymphocytic pleocytosis, normal/near-normal glucose |
| Chronic | TB, fungi, spirochetes | Lymphocytic, variable glucose |
| Age Group | Common Organisms |
|---|---|
| Neonates (<1 month) | Escherichia coli, Group B streptococci, Listeria monocytogenes |
| Infants 1-23 months | S. pneumoniae, N. meningitidis, H. influenzae |
| Adolescents/young adults | Neisseria meningitidis |
| Older adults (>50) | S. pneumoniae, Listeria monocytogenes |

| Parameter | Normal | Bacterial | Viral | Tuberculous/Fungal |
|---|---|---|---|---|
| Appearance | Clear | Turbid/cloudy | Clear/slightly turbid | Clear/slightly turbid |
| Opening pressure | <20 cm H₂O | Elevated | Normal | Elevated |
| WBC count | <5/mm³ | >1000/mm³ (often much higher) | <1000/mm³ | <1000/mm³ |
| Differential | - | Neutrophil predominance | Lymphocyte predominance | Lymphocyte predominance |
| Protein | Normal | Elevated | Normal/mildly elevated | Elevated |
| Glucose | Normal | Low (<45 mg/dL or <60% serum) | Normal | Low |
| Age/Situation | Empiric Regimen |
|---|---|
| <1 month | Ampicillin + ceftazidime (or cefotaxime) |
| 1 month and older | Vancomycin + ceftriaxone |
| >50 years or immunocompromised | Add ampicillin (covers Listeria) |
| CNS hardware infection | Vancomycin + cefepime |
| Drug | Dose |
|---|---|
| Vancomycin | 40-60 mg/kg/day divided q8-12h |
| Ceftriaxone | 2 g q12h |
| Cefepime | 2 g q8h |
| Cefotaxime | 2 g q4-6h |
| Ampicillin | 2 g q4h |
| Aqueous penicillin G | 18-24 million U/day |
| Organism | Gram Stain |
|---|---|
| S. pneumoniae | Gram-positive diplococci in pairs |
| N. meningitidis | Gram-negative diplococci |
| L. monocytogenes | Gram-positive rods |
| H. influenzae type b | Gram-negative coccobacilli |
| M. tuberculosis | AFB stain + PCR required |
| T. pallidum | Serology (VDRL in CSF) |
Suspected meningitis
↓
Blood cultures → start empiric Abx + dexamethasone
↓
Signs of mass lesion? (papilledema, focal deficit, altered consciousness, new seizures)
YES → CT first, then LP
NO → LP directly
↓
CSF: cell count + diff, protein, glucose, Gram stain, culture, ± additional studies
↓
Tailor antibiotics to culture/sensitivity results
Create a clinical reference sheet for CSF analysis interpretation
mkdir -p /home/daytona/workspace/csf-reference && ls /home/daytona/workspace/
~/csf-reference/build_csf_ref.py
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import cm, mm
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.platypus import (
SimpleDocTemplate, Table, TableStyle, Paragraph, Spacer,
HRFlowable, KeepTogether
)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_RIGHT
from reportlab.lib.colors import HexColor
import reportlab.lib.colors as rcolors
OUTPUT = "/home/daytona/workspace/csf-reference/CSF_Analysis_Reference.pdf"
# ── Palette ──────────────────────────────────────────────────────────────────
NAVY = HexColor("#0D2B55")
TEAL = HexColor("#1A6B8A")
LIGHT_TEAL = HexColor("#D6EEF5")
GREEN = HexColor("#1A7A4A")
LIGHT_GREEN= HexColor("#D5EFE3")
RED = HexColor("#A63228")
LIGHT_RED = HexColor("#F9E0DE")
AMBER = HexColor("#8A5E00")
LIGHT_AMB = HexColor("#FFF3CD")
PURPLE = HexColor("#5B2D8E")
LIGHT_PURP = HexColor("#EDE0F7")
LIGHT_GREY = HexColor("#F2F4F6")
MID_GREY = HexColor("#B0B8C1")
DARK_GREY = HexColor("#3A3F47")
WHITE = colors.white
doc = SimpleDocTemplate(
OUTPUT,
pagesize=A4,
leftMargin=1.2*cm, rightMargin=1.2*cm,
topMargin=1.2*cm, bottomMargin=1.4*cm,
)
W, H = A4
PW = W - 2.4*cm # printable width
styles = getSampleStyleSheet()
def style(name, **kw):
return ParagraphStyle(name, **kw)
title_style = style("Title",
fontName="Helvetica-Bold", fontSize=16, textColor=WHITE,
alignment=TA_CENTER, leading=20)
subtitle_style = style("Subtitle",
fontName="Helvetica", fontSize=8.5, textColor=HexColor("#CCE8F4"),
alignment=TA_CENTER, leading=12)
section_style = style("Section",
fontName="Helvetica-Bold", fontSize=9, textColor=WHITE,
alignment=TA_LEFT, leading=12, leftPadding=5)
body_style = style("Body",
fontName="Helvetica", fontSize=7.8, textColor=DARK_GREY,
leading=10.5)
bold_body = style("BoldBody",
fontName="Helvetica-Bold", fontSize=7.8, textColor=DARK_GREY,
leading=10.5)
small_style = style("Small",
fontName="Helvetica", fontSize=6.8, textColor=HexColor("#666"),
leading=9, alignment=TA_CENTER)
label_style = style("Label",
fontName="Helvetica-Bold", fontSize=7, textColor=DARK_GREY,
leading=9)
footnote_style = style("Footnote",
fontName="Helvetica-Oblique", fontSize=6.5, textColor=HexColor("#888"),
leading=8.5, alignment=TA_LEFT)
def section_header(text, color=NAVY):
data = [[Paragraph(text, section_style)]]
t = Table(data, colWidths=[PW])
t.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), color),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING", (0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 8),
("RIGHTPADDING", (0,0), (-1,-1), 4),
("ROWBACKGROUNDS", (0,0), (-1,-1), [color]),
]))
return t
def cell(text, bold=False, color=DARK_GREY, size=7.8, align=TA_LEFT):
s = ParagraphStyle("c", fontName="Helvetica-Bold" if bold else "Helvetica",
fontSize=size, textColor=color, leading=10, alignment=align)
return Paragraph(text, s)
def make_table(headers, rows, col_widths, row_bg_pairs=None,
header_bg=NAVY, header_fg=WHITE,
stripe_a=WHITE, stripe_b=LIGHT_GREY,
fontsize=7.8):
header_row = [cell(h, bold=True, color=header_fg, size=fontsize) for h in headers]
data = [header_row]
for r in rows:
data.append([cell(str(c), size=fontsize) if isinstance(c, str) else c for c in r])
style_cmds = [
("BACKGROUND", (0,0), (-1,0), header_bg),
("TOPPADDING", (0,0), (-1,-1), 3),
("BOTTOMPADDING", (0,0), (-1,-1), 3),
("LEFTPADDING", (0,0), (-1,-1), 5),
("RIGHTPADDING", (0,0), (-1,-1), 5),
("LINEBELOW", (0,0), (-1,0), 0.5, WHITE),
("LINEBELOW", (0,1), (-1,-1), 0.3, MID_GREY),
("VALIGN", (0,0), (-1,-1), "MIDDLE"),
]
# zebra
for i in range(1, len(data)):
bg = stripe_a if i % 2 == 1 else stripe_b
style_cmds.append(("BACKGROUND", (0,i), (-1,i), bg))
# override specific row colours if provided
if row_bg_pairs:
for row_idx, bg in row_bg_pairs:
style_cmds.append(("BACKGROUND", (0,row_idx), (-1,row_idx), bg))
t = Table(data, colWidths=col_widths, repeatRows=1)
t.setStyle(TableStyle(style_cmds))
return t
# ─────────────────────────────────────────────────────────────────────────────
story = []
# ── TITLE BANNER ─────────────────────────────────────────────────────────────
banner_data = [[
Paragraph("CSF ANALYSIS", title_style),
Paragraph("Clinical Reference Sheet", title_style),
]]
banner = Table(banner_data, colWidths=[PW*0.45, PW*0.55])
banner.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), NAVY),
("TOPPADDING", (0,0), (-1,-1), 10),
("BOTTOMPADDING", (0,0), (-1,-1), 2),
]))
story.append(banner)
sub_data = [[Paragraph("Cerebrospinal Fluid Interpretation · Lumbar Puncture · CNS Infection · SAH", subtitle_style)]]
sub_tbl = Table(sub_data, colWidths=[PW])
sub_tbl.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), TEAL),
("TOPPADDING", (0,0), (-1,-1), 3),
("BOTTOMPADDING", (0,0), (-1,-1), 5),
]))
story.append(sub_tbl)
story.append(Spacer(1, 4))
# ── SECTION 1: NORMAL VALUES ─────────────────────────────────────────────────
story.append(section_header("① NORMAL CSF VALUES (Adult, lateral decubitus position)", NAVY))
story.append(Spacer(1, 2))
normal_headers = ["Parameter", "Normal Value", "Clinical Note"]
normal_rows = [
["Opening Pressure", "50–170 mm H₂O\n(<28 cm H₂O in children)", "Measure in lateral decubitus only; coughing/crying falsely elevates"],
["Appearance", "Clear, colourless", "Turbidity visible when WBC >200–500/mm³"],
["Xanthochromia", "Absent", "Yellow/pink = oxyhemoglobin/bilirubin; suggests SAH if traumatic tap excluded"],
["Red Blood Cells", "≤5/mm³", "Traumatic tap: ≥10,000 RBC/mm³ or fewer RBCs in tube 4 vs tube 1"],
["White Blood Cells", "≤5/mm³; no PMNs", ">1 PMN is abnormal; any eosinophil is abnormal"],
["Glucose", ">40 mg/dL or\n60–70% of serum glucose", "Always compare to simultaneous serum glucose"],
["Protein", "<50 mg/dL", "Elevated in bacterial, TB, fungal, SAH, GBS, malignant meningitis"],
["Gram Stain & Culture", "Negative", "Most important tests when fluid is limited"],
]
story.append(make_table(
normal_headers, normal_rows,
col_widths=[PW*0.22, PW*0.25, PW*0.53],
header_bg=NAVY, stripe_a=WHITE, stripe_b=LIGHT_GREY
))
story.append(Spacer(1, 5))
# ── SECTION 2: PATTERN COMPARISON ────────────────────────────────────────────
story.append(section_header("② CSF PATTERN COMPARISON BY DIAGNOSIS", TEAL))
story.append(Spacer(1, 2))
comp_headers = ["Parameter", "Normal", "Bacterial", "Viral (Aseptic)", "TB / Fungal", "SAH"]
comp_rows = [
["Opening Pressure",
cell("Normal", size=7.5),
cell("↑↑ Elevated", bold=True, color=RED, size=7.5),
cell("Normal / ↑", size=7.5),
cell("↑ Elevated", color=AMBER, size=7.5),
cell("↑↑ Elevated", bold=True, color=RED, size=7.5)],
["Appearance",
cell("Clear", color=GREEN, size=7.5),
cell("Turbid / cloudy", bold=True, color=RED, size=7.5),
cell("Clear / slightly turbid", size=7.5),
cell("Clear / cloudy", color=AMBER, size=7.5),
cell("Bloody / xanthochromic", bold=True, color=RED, size=7.5)],
["WBC /mm³",
cell("≤5", size=7.5),
cell("500–10,000+", bold=True, color=RED, size=7.5),
cell("6–1,000", size=7.5),
cell("10–500", color=AMBER, size=7.5),
cell("Normal or mildly ↑", size=7.5)],
["Differential",
cell("—", size=7.5),
cell("Neutrophil (PMN)\npredominance", bold=True, color=RED, size=7.5),
cell("Lymphocyte\npredominance", color=GREEN, size=7.5),
cell("Lymphocyte\npredominance", color=AMBER, size=7.5),
cell("RBC predominance\n± xanthochromia", size=7.5)],
["Glucose",
cell(">40 mg/dL\n(60–70% serum)", size=7.5),
cell("↓↓ Low\n0–40 mg/dL", bold=True, color=RED, size=7.5),
cell("Normal", color=GREEN, size=7.5),
cell("↓ Low (may be\nvery low in TB)", color=AMBER, size=7.5),
cell("Normal", size=7.5)],
["Protein",
cell("<50 mg/dL", size=7.5),
cell("↑↑ >50 mg/dL\n(often >100)", bold=True, color=RED, size=7.5),
cell("Normal or\nmildly ↑", size=7.5),
cell("↑ Elevated\n(TB may be very high)", color=AMBER, size=7.5),
cell("↑ Elevated", size=7.5)],
["Gram Stain / Smear",
cell("—", size=7.5),
cell("Positive\n~60–80%", bold=True, color=RED, size=7.5),
cell("Negative", size=7.5),
cell("AFB smear\n(low sensitivity)", color=AMBER, size=7.5),
cell("Negative", size=7.5)],
["Special Tests",
cell("—", size=7.5),
cell("Culture, PCR panel,\nlatex agglutination", size=7.5),
cell("Viral PCR\n(enterovirus, HSV)", size=7.5),
cell("AFB culture, PCR\nIndia ink / CrAg\n(fungal)", color=PURPLE, size=7.5),
cell("No visible\nxanthochromia <2 h;\ntake tube 4 for spectrophotometry", size=7.5)],
]
comp_table = Table(
[[cell(h, bold=True, color=WHITE, size=7.5) for h in comp_headers]] +
[[
cell(str(r[0]) if isinstance(r[0], str) else "", size=7.5, bold=True),
r[1], r[2], r[3], r[4], r[5]
] for r in comp_rows],
colWidths=[PW*0.13, PW*0.11, PW*0.165, PW*0.165, PW*0.185, PW*0.175]
)
comp_cmds = [
("BACKGROUND", (0,0), (-1,0), TEAL),
("TOPPADDING", (0,0), (-1,-1), 3),
("BOTTOMPADDING", (0,0), (-1,-1), 3),
("LEFTPADDING", (0,0), (-1,-1), 4),
("RIGHTPADDING", (0,0), (-1,-1), 4),
("LINEBELOW", (0,0), (-1,0), 0.5, WHITE),
("LINEBELOW", (0,1), (-1,-1), 0.3, MID_GREY),
("LINEBEFORE", (1,0), (-1,-1), 0.3, MID_GREY),
("VALIGN", (0,0), (-1,-1), "TOP"),
("BACKGROUND", (2,1), (2,-1), HexColor("#FFF0EE")), # bacterial column
("BACKGROUND", (3,1), (3,-1), HexColor("#F0F8FF")), # viral column
("BACKGROUND", (4,1), (4,-1), HexColor("#FFFBF0")), # TB column
("BACKGROUND", (5,1), (5,-1), HexColor("#F5F0FB")), # SAH column
]
for i in range(1, len(comp_rows)+1):
comp_cmds.append(("BACKGROUND", (0,i), (0,i), LIGHT_GREY))
comp_table.setStyle(TableStyle(comp_cmds))
story.append(comp_table)
story.append(Spacer(1, 2))
story.append(Paragraph(
"⚠ Note: Early bacterial meningitis (<48 h) may show lymphocytic predominance mimicking viral. "
"Listeria meningitis may show <1000 WBC/mm³ with lymphocyte predominance and near-normal glucose. "
"Pre-treatment with antibiotics reduces Gram stain/culture yield but does not alter cell count or protein.",
footnote_style))
story.append(Spacer(1, 5))
# ── SECTION 3: ORGANISMS BY AGE ──────────────────────────────────────────────
story.append(section_header("③ COMMON PATHOGENS BY AGE (Bacterial Meningitis)", GREEN))
story.append(Spacer(1, 2))
org_headers = ["Age Group", "Key Organisms", "Gram Stain Appearance", "Empiric Treatment"]
org_rows = [
["Neonates\n(<1 month)",
"E. coli, Group B Streptococcus,\nListeria monocytogenes",
"GBS: gram+ cocci in chains\nE. coli: gram− rods\nListeria: gram+ rods",
"Ampicillin +\nCeftazidime\n(or Cefotaxime)"],
["Infants\n(1–23 months)",
"S. pneumoniae, N. meningitidis,\nH. influenzae, GBS",
"Pneumo: gram+ diplococci\nMeningo: gram− diplococci\nHib: gram− coccobacilli",
"Vancomycin +\nCeftriaxone"],
["Children/Adults\n(2–50 years)",
"N. meningitidis,\nS. pneumoniae",
"Gram− diplococci (Meningo)\nGram+ diplococci (Pneumo)",
"Vancomycin +\nCeftriaxone\n+ Dexamethasone"],
["Older Adults\n(>50 years /\nimmunosuppressed)",
"S. pneumoniae, Listeria\nmonocytogenes, gram− bacilli",
"Pneumo: gram+ diplococci\nListeria: gram+ rods",
"Vancomycin + Ceftriaxone\n+ Ampicillin\n(covers Listeria)"],
]
story.append(make_table(
org_headers, org_rows,
col_widths=[PW*0.14, PW*0.32, PW*0.30, PW*0.24],
header_bg=GREEN, stripe_a=WHITE, stripe_b=LIGHT_GREEN
))
story.append(Spacer(1, 5))
# ── SECTION 4: ANTIBIOTIC DOSES & DEXAMETHASONE ──────────────────────────────
story.append(section_header("④ KEY ANTIBIOTIC DOSES (Adult, Normal Renal Function) & ADJUNCTIVE THERAPY", NAVY))
story.append(Spacer(1, 2))
# Two side-by-side tables
abx_headers = ["Drug", "CNS Dose (Adult)"]
abx_rows = [
["Vancomycin", "40–60 mg/kg/day ÷ q8–12h"],
["Ceftriaxone", "2 g IV q12h"],
["Cefepime", "2 g IV q8h"],
["Cefotaxime", "2 g IV q4–6h"],
["Ampicillin", "2 g IV q4h"],
["Metronidazole", "500 mg IV q6h"],
["Aqueous Penicillin G", "18–24 million U/day continuous or ÷ q4h"],
["Acyclovir (HSV)", "10 mg/kg IV q8h × 14–21 days"],
]
dexa_text = (
"<b>Dexamethasone (Adjunctive)</b><br/>"
"• Give BEFORE or WITH first antibiotic dose<br/>"
"• Dose: 0.15 mg/kg IV q6h × 4 days (adult)<br/>"
"• Most evidence: S. pneumoniae meningitis<br/>"
"• Reduces mortality + hearing loss (pneumococcal)<br/>"
"• Reduces hearing loss in H. influenzae Hib meningitis<br/>"
"• Continues for 4 days; concurrent dexamethasone<br/>"
" does NOT significantly reduce CSF vancomycin levels<br/><br/>"
"<b>Do NOT delay antibiotics for CT or LP.</b><br/>"
"Draw blood cultures → start Abx + dexa → then LP / CT"
)
left_t = make_table(abx_headers, abx_rows, col_widths=[PW*0.26, PW*0.32], header_bg=NAVY)
right_p = ParagraphStyle("Dexa", fontName="Helvetica", fontSize=7.5,
textColor=DARK_GREY, leading=11, leftPadding=8)
right_block = Table(
[[Paragraph(dexa_text, right_p)]],
colWidths=[PW*0.38]
)
right_block.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), LIGHT_TEAL),
("BOX", (0,0), (-1,-1), 0.5, TEAL),
("TOPPADDING", (0,0), (-1,-1), 6),
("BOTTOMPADDING", (0,0), (-1,-1), 6),
("LEFTPADDING", (0,0), (-1,-1), 8),
]))
combo = Table([[left_t, right_block]], colWidths=[PW*0.60, PW*0.40])
combo.setStyle(TableStyle([
("VALIGN", (0,0), (-1,-1), "TOP"),
("LEFTPADDING", (0,0), (-1,-1), 0),
("RIGHTPADDING", (0,0), (-1,-1), 0),
("TOPPADDING", (0,0), (-1,-1), 0),
("BOTTOMPADDING", (0,0), (-1,-1), 0),
]))
story.append(combo)
story.append(Spacer(1, 5))
# ── SECTION 5: TRAUMATIC TAP vs SAH ─────────────────────────────────────────
story.append(section_header("⑤ TRAUMATIC TAP vs SUBARACHNOID HEMORRHAGE", RED))
story.append(Spacer(1, 2))
tt_headers = ["Feature", "Traumatic Tap", "Subarachnoid Hemorrhage (SAH)"]
tt_rows = [
["RBC count", "High in tube 1, clears by tube 4\n(decreasing trend)", "Uniformly elevated across all 4 tubes\n(≥100,000 cells/μL typical; does NOT clear)"],
["Xanthochromia", "Absent (develops only if >2 h old)", "Present (develops within 2–4 h; persists days–weeks)\nYellow/pink – oxyhemoglobin then bilirubin"],
["Clotting", "CSF may clot (blood contamination)", "CSF does NOT clot"],
["Opening Pressure", "Normal or artefactually elevated", "Elevated"],
["Protein", "May be elevated (blood contamination):\nsubtract 1 mg/dL protein per 1000 RBCs", "Independently elevated"],
["WBC correction\n(traumatic)", "Subtract 1 WBC per 500–1000 RBCs\n(inconsistent evidence)", "Not applicable"],
["Gold standard", "—", "Spectrophotometry of tube 4\n(detects xanthochromia even when visual inspection normal)"],
]
story.append(make_table(
tt_headers, tt_rows,
col_widths=[PW*0.20, PW*0.38, PW*0.42],
header_bg=RED, stripe_a=WHITE, stripe_b=LIGHT_RED
))
story.append(Spacer(1, 5))
# ── SECTION 6: SPECIAL PATTERNS ─────────────────────────────────────────────
story.append(section_header("⑥ SPECIAL & LESS-COMMON CSF PATTERNS", PURPLE))
story.append(Spacer(1, 2))
sp_headers = ["Condition", "Key CSF Finding(s)", "Additional Tests"]
sp_rows = [
["Cryptococcal meningitis\n(HIV / immunocompromised)",
"Lymphocytic pleocytosis, ↓glucose;\nIndia ink: encapsulated yeast\nOpening pressure often very high",
"Serum + CSF cryptococcal antigen (CrAg)\nFungal culture"],
["Tuberculous meningitis",
"Lymphocytic, protein very high (may be >500);\nglucose very low (can be <20 mg/dL);\nSubacute/chronic onset",
"AFB smear (30–40% sens), AFB culture (gold std)\nCSF PCR; send 20–30 mL for best yield"],
["HSV Encephalitis",
"Lymphocytic pleocytosis\nCSF may show RBCs (haemorrhagic necrosis)\nNormal glucose",
"CSF HSV PCR (>95% sensitivity)\nMRI: temporal lobe enhancement"],
["Guillain-Barré Syndrome (GBS)",
"ALBUMINOCYTOLOGIC DISSOCIATION:\n↑↑ Protein (>100 mg/dL) with normal/near-normal WBC",
"Nerve conduction studies\nAnti-ganglioside antibodies"],
["Multiple Sclerosis",
"Normal opening pressure, WBC, glucose, protein\n(usually normal overall)",
"Oligoclonal IgG bands (CSF only, not serum)\nIgG index elevated"],
["Carcinomatous / Leptomeningeal\nMetastasis",
"↑ protein, ↓ glucose, lymphocytic pleocytosis;\nMay mimic TB meningitis",
"CSF cytology (multiple LPs increase yield)\nFlow cytometry"],
["Neurosyphilis",
"Lymphocytic pleocytosis, ↑ protein\n(may be subtle or normal)",
"CSF VDRL (specific but insensitive)\nSerum RPR/TPPA/FTA-ABS"],
]
story.append(make_table(
sp_headers, sp_rows,
col_widths=[PW*0.23, PW*0.43, PW*0.34],
header_bg=PURPLE, stripe_a=WHITE, stripe_b=LIGHT_PURP
))
story.append(Spacer(1, 5))
# ── SECTION 7: CT BEFORE LP DECISION ────────────────────────────────────────
story.append(section_header("⑦ WHEN TO CT BEFORE LP", AMBER))
story.append(Spacer(1, 2))
ct_text = (
"<b>CT REQUIRED BEFORE LP if ANY of the following present:</b><br/>"
"• Immunocompromised state (HIV, steroids, transplant)<br/>"
"• Known or suspected CNS structural disease (mass, hydrocephalus)<br/>"
"• Papilledema on fundoscopy or elevated optic nerve sheath diameter on bedside US<br/>"
"• Focal neurologic deficit (new or changing)<br/>"
"• New-onset seizures<br/>"
"• Abnormal level of consciousness / GCS decline<br/><br/>"
"<b>If NONE of the above → proceed directly to LP.</b><br/>"
"⚠ Do NOT delay antibiotics + dexamethasone for CT or LP. Obtain blood cultures, start treatment, then image/puncture."
)
ct_block = Table(
[[Paragraph(ct_text, ParagraphStyle("ct", fontName="Helvetica", fontSize=7.8,
textColor=DARK_GREY, leading=11))]],
colWidths=[PW]
)
ct_block.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), LIGHT_AMB),
("BOX", (0,0), (-1,-1), 1, AMBER),
("TOPPADDING", (0,0), (-1,-1), 7),
("BOTTOMPADDING", (0,0), (-1,-1), 7),
("LEFTPADDING", (0,0), (-1,-1), 10),
("RIGHTPADDING", (0,0), (-1,-1), 10),
]))
story.append(ct_block)
story.append(Spacer(1, 5))
# ── FOOTER ───────────────────────────────────────────────────────────────────
story.append(HRFlowable(width=PW, thickness=0.5, color=MID_GREY))
story.append(Spacer(1, 2))
story.append(Paragraph(
"Sources: Rosen's Emergency Medicine | Tintinalli's Emergency Medicine | Roberts & Hedges' Clinical Procedures | "
"Bradley & Daroff's Neurology in Clinical Practice | Robbins & Kumar Basic Pathology | "
"Harriet Lane Handbook 23rd Ed. | Goldman-Cecil Medicine | Neuroanatomy Through Clinical Cases 3e · "
"For educational use only. Always correlate with clinical context.",
footnote_style))
# ── BUILD ────────────────────────────────────────────────────────────────────
doc.build(story)
print("PDF created:", OUTPUT)
cd /home/daytona/workspace/csf-reference && python build_csf_ref.py 2>&1
ls -lh /home/daytona/workspace/csf-reference/CSF_Analysis_Reference.pdf
CSF Analysis Reference
PDF Document · PDF