What you do basically
Ok make chart for antibiotics , uses , doses
mkdir -p /home/daytona/workspace/antibiotic-chart && echo "dir ready"
~/antibiotic-chart/generate_chart.py
from reportlab.lib.pagesizes import A4, landscape
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm
from reportlab.platypus import (
SimpleDocTemplate, Table, TableStyle, Paragraph,
Spacer, HRFlowable
)
from reportlab.lib.enums import TA_CENTER, TA_LEFT
OUTPUT = "/home/daytona/workspace/antibiotic-chart/Antibiotic_Chart.pdf"
# ── Colour palette ────────────────────────────────────────────────────────────
HDR_BG = colors.HexColor("#1a3a5c") # dark navy
HDR_TXT = colors.white
CAT_BG = colors.HexColor("#2e6da4") # medium blue (class header rows)
CAT_TXT = colors.white
ALT1 = colors.HexColor("#eaf2fb") # light blue tint
ALT2 = colors.white
GRID = colors.HexColor("#b0c4de")
FOOT_TXT = colors.HexColor("#555555")
# ── Data ──────────────────────────────────────────────────────────────────────
# columns: Class / Drug | Mechanism | Key Uses | Adult Dose | Notes
data = [
# ── header ──
[
"Class / Drug", "Mechanism of Action",
"Key Clinical Uses", "Typical Adult Dose",
"Key Notes / Side Effects"
],
# ══ PENICILLINS ══
["PENICILLINS", "", "", "", ""],
["Amoxicillin",
"Inhibits cell-wall synthesis (binds PBPs)",
"Otitis media, sinusitis, strep pharyngitis, H. pylori (triple tx)",
"250–500 mg PO q8h\n1 g PO q12h (H. pylori)",
"Rash common; avoid if PCN allergy"],
["Amoxicillin-Clavulanate\n(Augmentin)",
"PCN + β-lactamase inhibitor",
"ABRS, ABECB, bite wounds, diabetic foot",
"875/125 mg PO q12h\n500/125 mg PO q8h",
"GI upset; hepatotoxicity (rare); diarrhoea"],
["Ampicillin-Sulbactam\n(Unasyn)",
"PCN + β-lactamase inhibitor",
"Intra-abdominal, gynecologic, soft-tissue infections",
"3 g (2+1) IV/IM q6h",
"Poor MRSA activity; watch renal dosing"],
["Nafcillin / Oxacillin",
"β-lactamase-stable PCN; binds PBPs",
"MSSA bacteraemia, endocarditis, osteomyelitis",
"1–2 g IV q4–6h",
"Interstitial nephritis (nafcillin); hepatotoxicity (oxacillin)"],
["Piperacillin-Tazobactam\n(Pip-Tazo / Zosyn)",
"Extended-spectrum PCN + β-lactamase inhibitor",
"Hospital-acquired/VAP, febrile neutropenia, polymicrobial",
"3.375 g IV q6h or\n4.5 g IV q6–8h",
"AKI risk with vancomycin combo; Na load"],
# ══ CEPHALOSPORINS ══
["CEPHALOSPORINS", "", "", "", ""],
["Cephalexin (1st gen)",
"Inhibits cell-wall synthesis (PBPs)",
"Skin/soft tissue, UTI, strep pharyngitis",
"250–500 mg PO q6h",
"Cross-reactivity with PCN ~1–2%; renal adjust"],
["Cefazolin (1st gen)",
"Inhibits cell-wall synthesis (PBPs)",
"Surgical prophylaxis, MSSA, uncomplicated cellulitis",
"1–2 g IV q8h",
"Drug of choice for MSSA bacteraemia"],
["Cefuroxime (2nd gen)",
"Inhibits cell-wall synthesis",
"Community pneumonia, Lyme disease, sinusitis",
"250–500 mg PO q12h\n750 mg–1.5 g IV q8h",
"Better gram-neg than 1st gen"],
["Ceftriaxone (3rd gen)",
"Inhibits cell-wall synthesis",
"Pneumonia, meningitis, gonorrhoea, sepsis",
"1–2 g IV/IM q24h\n(meningitis: 2 g q12h)",
"Biliary sludge; once-daily dosing convenience"],
["Cefdinir / Cefpodoxime\n(3rd gen oral)",
"Inhibits cell-wall synthesis",
"Otitis media, sinusitis, pharyngitis, ABECB",
"Cefdinir 300 mg PO q12h\nCefpodoxime 200 mg PO q12h",
"Cefdinir: red stools if taken with iron"],
["Cefepime (4th gen)",
"Inhibits cell-wall synthesis (Pseudomonas-active)",
"HAP/VAP, febrile neutropenia, Pseudomonas",
"1–2 g IV q8–12h",
"Neurotoxicity (encephalopathy) at high doses/renal failure"],
["Ceftaroline (5th gen)",
"Binds PBP2a → MRSA activity",
"MRSA SSTI, CAP",
"600 mg IV q12h",
"Only cephalosporin with MRSA activity"],
["Ceftazidime-Avibactam",
"Cephalosporin + novel β-lactamase inhibitor",
"KPC/OXA-48 carbapenem-resistant infections",
"2.5 g IV q8h",
"CRE salvage therapy; renal dose adjustment required"],
# ══ CARBAPENEMS ══
["CARBAPENEMS", "", "", "", ""],
["Meropenem",
"Inhibits cell-wall synthesis; ultra-broad spectrum",
"Severe nosocomial, CRE (with combos), meningitis",
"500 mg–1 g IV q8h\n(meningitis: 2 g IV q8h)",
"Seizures less than imipenem; Pseudomonas active"],
["Imipenem-Cilastatin",
"Carbapenem + DHP-I inhibitor",
"Polymicrobial/abdominal/ICU infections",
"500 mg IV q6h",
"Seizure risk; cilastatin prevents renal degradation"],
["Ertapenem",
"Inhibits cell-wall synthesis",
"Community-acquired intra-abdominal, UTI, SSTI",
"1 g IV/IM q24h",
"NO Pseudomonas/Acinetobacter coverage; once-daily"],
["Meropenem-Vaborbactam",
"Carbapenem + boronic-acid β-lactamase inhibitor",
"KPC carbapenem-resistant Enterobacteriaceae",
"4 g (2+2) IV q8h",
"CRE infections; large fluid volume per dose"],
# ══ MONOBACTAMS ══
["MONOBACTAMS", "", "", "", ""],
["Aztreonam",
"Binds PBP3 → gram-negative cell-wall inhibition",
"Gram-negative infections; PCN/carbapenem-allergic pts",
"1–2 g IV/IM q6–12h",
"No gram-positive or anaerobic coverage; safe in PCN allergy"],
# ══ FLUOROQUINOLONES ══
["FLUOROQUINOLONES", "", "", "", ""],
["Ciprofloxacin",
"Inhibits DNA gyrase & topoisomerase IV",
"UTI, prostatitis, GI infections, anthrax, Pseudomonas",
"250–750 mg PO q12h\n400 mg IV q8–12h",
"QTc prolongation; tendinopathy; avoid in pregnancy; drug interactions"],
["Levofloxacin",
"Inhibits DNA gyrase & topoisomerase IV",
"CAP, HAP, UTI, sinusitis, TB (2nd line)",
"500–750 mg PO/IV q24h",
"QTc prolongation; tendon rupture; photosensitivity"],
["Moxifloxacin",
"Inhibits DNA gyrase & topoisomerase IV",
"CAP, ABRS, ABECB, skin infections (anaerobic coverage)",
"400 mg PO/IV q24h",
"Greater QTc risk; NOT for UTI (no urinary excretion)"],
["Delafloxacin",
"Inhibits DNA gyrase & topoisomerase IV",
"ABSSSI, CAP",
"450 mg PO q12h or 300 mg IV q12h",
"MRSA activity; less QTc effect"],
# ══ MACROLIDES ══
["MACROLIDES", "", "", "", ""],
["Azithromycin\n(Z-pack)",
"Inhibits 50S ribosomal subunit (23S rRNA)",
"CAP, atypical pneumonia (Mycoplasma, Chlamydia), STIs, MAC",
"500 mg PO/IV day 1, then 250 mg days 2–5\nZ-pack: 5-day course",
"QTc prolongation; GI motility effect; drug interactions"],
["Clarithromycin",
"Inhibits 50S ribosomal subunit",
"CAP, H. pylori triple therapy, MAC prophylaxis/tx, SSTI",
"250–500 mg PO q12h",
"Strong CYP3A4 inhibitor; metallic taste; avoid in cardiac disease"],
["Erythromycin",
"Inhibits 50S ribosomal subunit",
"Penicillin-allergy alternative, gastroparesis (prokinetic), chlamydia",
"250–500 mg PO q6h",
"GI side effects common; QTc prolongation; strong CYP3A4 inhibitor"],
# ══ TETRACYCLINES ══
["TETRACYCLINES", "", "", "", ""],
["Doxycycline",
"Inhibits 30S ribosomal subunit → blocks aminoacyl-tRNA binding",
"Atypical pneumonia, Lyme, RMSF, acne, chlamydia, MRSA SSTI",
"100 mg PO/IV q12h",
"Photosensitivity; avoid in pregnancy/children <8; oesophageal irritation"],
["Minocycline",
"Inhibits 30S ribosomal subunit",
"MRSA SSTI, acne, Nocardia, mycobacterial infections",
"100 mg PO q12h",
"Vestibular side effects (dizziness); hyperpigmentation"],
["Tigecycline",
"Inhibits 30S ribosomal subunit; overcomes efflux pump resistance",
"Complicated intra-abdominal, SSTI, CAP (not first-line); last resort",
"100 mg IV load, then 50 mg IV q12h",
"↑ mortality in serious infections vs comparators; nausea/vomiting"],
# ══ AMINOGLYCOSIDES ══
["AMINOGLYCOSIDES", "", "", "", ""],
["Gentamicin",
"Binds 30S ribosome → misreading of mRNA; bactericidal",
"Gram-negative bacteraemia, synergy (endocarditis), plague",
"5–7 mg/kg IV q24h (once-daily)\nor 1–1.7 mg/kg q8h",
"Nephrotoxicity; ototoxicity; monitor levels (trough <1)"],
["Tobramycin",
"Binds 30S ribosome",
"Pseudomonas infections (cystic fibrosis), gram-negative sepsis",
"5–7 mg/kg IV q24h (once-daily)",
"Better Pseudomonas activity than gentamicin; same toxicity profile"],
["Amikacin",
"Binds 30S ribosome; resistant to most aminoglycoside-modifying enzymes",
"MDR gram-negative, Pseudomonas, Acinetobacter, NTM",
"15–20 mg/kg IV q24h",
"Reserved for resistant organisms; nephrotoxicity/ototoxicity"],
# ══ GLYCOPEPTIDES ══
["GLYCOPEPTIDES", "", "", "", ""],
["Vancomycin",
"Inhibits cell-wall synthesis by binding D-Ala-D-Ala terminus",
"MRSA infections, C. diff (PO for colitis), gram-positive endocarditis",
"15–20 mg/kg IV q8–12h (target AUC/MIC 400–600)\n125 mg PO q6h for CDI",
"Red-man syndrome (infusion); nephrotoxicity; ototoxicity; monitor AUC"],
["Teicoplanin",
"Inhibits cell-wall synthesis (same mechanism as vancomycin)",
"MRSA, gram-positive infections, endocarditis",
"400–800 mg IV/IM q24h (after loading)",
"Longer half-life than vancomycin; less nephrotoxicity; not available in US"],
["Telavancin",
"Dual: cell-wall inhibition + membrane depolarisation",
"MRSA ABSSSI, HAP/VAP",
"10 mg/kg IV q24h",
"Nephrotoxicity; QTc prolongation; teratogenic"],
["Dalbavancin / Oritavancin",
"Cell-wall synthesis inhibition",
"ABSSSI (MRSA/strep), osteomyelitis (off-label)",
"Dalbavancin: 1.5 g IV once (or split-dose)\nOritavancin: 1.2 g IV once",
"Ultra-long half-life → single or 2-dose regimens; expensive"],
# ══ OXAZOLIDINONES ══
["OXAZOLIDINONES", "", "", "", ""],
["Linezolid",
"Inhibits 50S ribosome assembly (unique binding site)",
"MRSA pneumonia/SSTI, VRE infections, XDR-TB (2nd line)",
"600 mg PO/IV q12h",
"Serotonin syndrome with SSRIs/SNRIs; thrombocytopenia; myelosuppression (>2 wks)"],
["Tedizolid",
"Inhibits 50S ribosome assembly",
"ABSSSI (MRSA, Streptococcus)",
"200 mg PO/IV q24h × 6 days",
"Less myelosuppression than linezolid; once-daily dosing"],
# ══ LIPOPEPTIDES ══
["LIPOPEPTIDES", "", "", "", ""],
["Daptomycin",
"Disrupts gram-positive cell membrane (Ca2+-dependent)",
"MRSA bacteraemia/endocarditis, VRE, SSTI",
"4 mg/kg IV q24h (SSTI)\n6–10 mg/kg IV q24h (bacteraemia/endocarditis)",
"Pulmonary surfactant inactivation → do NOT use for pneumonia; CPK monitoring"],
# ══ SULFONAMIDES / DIAMINOPYRIMIDINES ══
["SULFONAMIDES / DIAMINOPYRIMIDINES", "", "", "", ""],
["TMP-SMX\n(Cotrimoxazole)",
"Blocks folate synthesis (SMX inhibits dihydropteroate synthase; TMP inhibits DHFR)",
"UTI, PCP prophylaxis/treatment, MRSA SSTI, Nocardia, Toxoplasma",
"UTI: 1 DS tab PO q12h × 3 days\nPCP: 15–20 mg/kg/day (TMP) in 3–4 divided doses IV",
"Hyperkalaemia; Steven-Johnson syndrome; bone marrow suppression; avoid in G6PD"],
# ══ NITROIMIDAZOLES ══
["NITROIMIDAZOLES", "", "", "", ""],
["Metronidazole\n(Flagyl)",
"Forms free radicals that damage microbial DNA",
"Anaerobic infections, C. diff (PO/IV), bacterial vaginosis, Trichomonas, Giardia, H. pylori",
"500 mg PO/IV q6–8h\n(C. diff: 500 mg PO q8h)",
"Disulfiram-like reaction with alcohol; peripheral neuropathy (prolonged use); metallic taste"],
# ══ NITROFURANS ══
["NITROFURANS", "", "", "", ""],
["Nitrofurantoin\n(Macrobid)",
"Damages multiple bacterial targets via reactive intermediates",
"Uncomplicated UTI (lower tract only)",
"Macrobid: 100 mg PO q12h × 5–7 days\nMacrocrystals: 50–100 mg PO q6h × 7 days",
"NOT for pyelonephritis or systemic infections; pulmonary toxicity (long-term); avoid if CrCl <30"],
# ══ ANTI-MRSA / MISC ══
["ANTI-MRSA / MISC", "", "", "", ""],
["Clindamycin",
"Inhibits 50S ribosomal subunit (peptidyl transferase)",
"MRSA SSTI (D-test negative), anaerobic infections, pelvic/dental",
"150–450 mg PO q6–8h\n600–900 mg IV q8h",
"Pseudomembranous colitis (C. diff risk); check inducible resistance (D-test)"],
["Fosfomycin",
"Inhibits MurA → blocks peptidoglycan synthesis",
"Uncomplicated UTI (E. coli, Enterococcus faecalis), MDR-UTI",
"3 g PO single dose (uncomplicated UTI)\n8–24 g/day IV for severe MDR",
"Single-dose convenience; IV form for MDR; GI side effects"],
["Rifampin (Rifampicin)",
"Inhibits DNA-dependent RNA polymerase",
"TB (combination), MRSA biofilm (adjunct), Legionella, meningococcal prophylaxis",
"TB: 10 mg/kg/day PO (max 600 mg)\nMeningococcal prophylaxis: 600 mg PO q12h × 2 days",
"Never use as monotherapy (rapid resistance); orange urine/secretions; CYP450 inducer"],
["Chloramphenicol",
"Inhibits 50S ribosomal subunit (peptidyl transferase)",
"Meningitis (PCN-allergy/resource-limited), typhoid, RMSF, anaerobes",
"50–75 mg/kg/day IV in 4 divided doses",
"Grey baby syndrome; aplastic anaemia (rare); monitor CBC"],
# ══ ANTI-TB (FIRST LINE) ══
["ANTI-TUBERCULOSIS (1st Line)", "", "", "", ""],
["Isoniazid (INH)",
"Inhibits mycolic acid synthesis (InhA target)",
"Active TB (combination), LTBI prophylaxis",
"5 mg/kg/day PO (max 300 mg/day)\nLTBI: 300 mg/day × 9 months or 900 mg biweekly",
"Peripheral neuropathy (give pyridoxine B6); hepatotoxicity; drug interactions"],
["Rifampin (Rifampicin)\n(TB context)",
"Inhibits RNA polymerase",
"Active TB (backbone drug), LTBI (4-month short course)",
"10 mg/kg/day PO (max 600 mg)",
"CYP3A4 inducer; orange discolouration; hepatotoxicity"],
["Pyrazinamide (PZA)",
"Disrupts membrane energetics in acidic environment",
"Active TB (2-month initial phase)",
"15–30 mg/kg/day PO (max 2 g/day)",
"Hepatotoxicity; hyperuricaemia (gout flare); arthralgia"],
["Ethambutol (EMB)",
"Inhibits arabinosyl transferase → cell-wall synthesis disruption",
"Active TB (initial phase, prevents rifampin resistance)",
"15–25 mg/kg/day PO",
"Optic neuritis (colour vision loss); monitor vision monthly"],
]
# ── Identify class-header rows ────────────────────────────────────────────────
CLASS_KEYWORDS = {
"PENICILLINS", "CEPHALOSPORINS", "CARBAPENEMS", "MONOBACTAMS",
"FLUOROQUINOLONES", "MACROLIDES", "TETRACYCLINES", "AMINOGLYCOSIDES",
"GLYCOPEPTIDES", "OXAZOLIDINONES", "LIPOPEPTIDES",
"SULFONAMIDES / DIAMINOPYRIMIDINES", "NITROIMIDAZOLES", "NITROFURANS",
"ANTI-MRSA / MISC", "ANTI-TUBERCULOSIS (1st Line)"
}
def is_class_row(row):
return row[0].strip().upper() in {k.upper() for k in CLASS_KEYWORDS}
# ── Column widths (landscape A4 ≈ 27.7 cm usable) ────────────────────────────
COL_WIDTHS = [4.2*cm, 5.0*cm, 5.8*cm, 4.5*cm, 6.2*cm]
# ── Styles ────────────────────────────────────────────────────────────────────
styles = getSampleStyleSheet()
style_hdr = ParagraphStyle(
"hdr", parent=styles["Normal"],
fontName="Helvetica-Bold", fontSize=8,
textColor=HDR_TXT, alignment=TA_CENTER, leading=10
)
style_class = ParagraphStyle(
"cls", parent=styles["Normal"],
fontName="Helvetica-Bold", fontSize=8,
textColor=CAT_TXT, alignment=TA_LEFT, leading=10
)
style_cell = ParagraphStyle(
"cell", parent=styles["Normal"],
fontName="Helvetica", fontSize=7.2,
textColor=colors.HexColor("#1a1a1a"), leading=9.5, alignment=TA_LEFT
)
style_drug = ParagraphStyle(
"drug", parent=styles["Normal"],
fontName="Helvetica-Bold", fontSize=7.5,
textColor=colors.HexColor("#1a3a5c"), leading=10, alignment=TA_LEFT
)
def make_para(text, row_idx, col_idx):
if row_idx == 0:
return Paragraph(text.replace("\n", "<br/>"), style_hdr)
row = data[row_idx]
if is_class_row(row):
return Paragraph(text.replace("\n", "<br/>"), style_class)
if col_idx == 0:
return Paragraph(text.replace("\n", "<br/>"), style_drug)
return Paragraph(text.replace("\n", "<br/>"), style_cell)
# ── Build table data with Paragraphs ─────────────────────────────────────────
table_data = []
for r_idx, row in enumerate(data):
table_data.append([make_para(cell, r_idx, c_idx) for c_idx, cell in enumerate(row)])
# ── TableStyle commands ───────────────────────────────────────────────────────
ts_cmds = [
# grid
("GRID", (0,0), (-1,-1), 0.4, GRID),
# header row
("BACKGROUND", (0,0), (-1,0), HDR_BG),
("FONTNAME", (0,0), (-1,0), "Helvetica-Bold"),
("ALIGN", (0,0), (-1,0), "CENTER"),
("VALIGN", (0,0), (-1,-1), "TOP"),
("ROWBACKGROUND", (0,0), (-1,0), HDR_BG),
# padding
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING", (0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 4),
("RIGHTPADDING", (0,0), (-1,-1), 4),
]
# apply class-row and alternating-row colours
drug_row_idx = 0 # counter for non-header, non-class rows
for r_idx, row in enumerate(data):
if r_idx == 0:
continue
if is_class_row(row):
ts_cmds.append(("BACKGROUND", (0,r_idx), (-1,r_idx), CAT_BG))
ts_cmds.append(("SPAN", (0,r_idx), (-1,r_idx)))
ts_cmds.append(("FONTNAME", (0,r_idx), (-1,r_idx), "Helvetica-Bold"))
ts_cmds.append(("FONTSIZE", (0,r_idx), (-1,r_idx), 8))
else:
bg = ALT1 if drug_row_idx % 2 == 0 else ALT2
ts_cmds.append(("BACKGROUND", (0,r_idx), (-1,r_idx), bg))
drug_row_idx += 1
table = Table(table_data, colWidths=COL_WIDTHS, repeatRows=1)
table.setStyle(TableStyle(ts_cmds))
# ── Document ──────────────────────────────────────────────────────────────────
doc = SimpleDocTemplate(
OUTPUT,
pagesize=landscape(A4),
leftMargin=1.0*cm, rightMargin=1.0*cm,
topMargin=1.5*cm, bottomMargin=1.5*cm,
)
title_style = ParagraphStyle(
"title", parent=styles["Title"],
fontName="Helvetica-Bold", fontSize=16,
textColor=HDR_BG, alignment=TA_CENTER, spaceAfter=4
)
sub_style = ParagraphStyle(
"sub", parent=styles["Normal"],
fontName="Helvetica", fontSize=9,
textColor=FOOT_TXT, alignment=TA_CENTER, spaceAfter=8
)
foot_style = ParagraphStyle(
"foot", parent=styles["Normal"],
fontName="Helvetica-Oblique", fontSize=7,
textColor=FOOT_TXT, alignment=TA_CENTER
)
story = [
Paragraph("Antibiotic Reference Chart", title_style),
Paragraph("Classes · Mechanisms · Key Uses · Typical Adult Doses · Clinical Notes", sub_style),
HRFlowable(width="100%", thickness=1.5, color=HDR_BG, spaceAfter=8),
table,
Spacer(1, 0.3*cm),
Paragraph(
"For clinical use, always verify dosing in current guidelines and adjust for renal/hepatic function, weight, and local resistance patterns. "
"This chart is a reference aid and does not replace clinical judgement.",
foot_style
),
]
doc.build(story)
print("PDF generated:", OUTPUT)
python /home/daytona/workspace/antibiotic-chart/generate_chart.py
Antibiotic Chart
PDF Document · PDF
| Class | Drugs Covered |
|---|---|
| Penicillins | Amoxicillin, Amox-Clav, Amp-Sulbactam, Nafcillin, Pip-Tazo |
| Cephalosporins | 1st through 5th gen + Ceftazidime-Avibactam |
| Carbapenems | Meropenem, Imipenem, Ertapenem, Meropenem-Vaborbactam |
| Monobactams | Aztreonam |
| Fluoroquinolones | Cipro, Levofloxacin, Moxifloxacin, Delafloxacin |
| Macrolides | Azithromycin, Clarithromycin, Erythromycin |
| Tetracyclines | Doxycycline, Minocycline, Tigecycline |
| Aminoglycosides | Gentamicin, Tobramycin, Amikacin |
| Glycopeptides | Vancomycin, Teicoplanin, Telavancin, Dalbavancin |
| Oxazolidinones | Linezolid, Tedizolid |
| Lipopeptides | Daptomycin |
| Sulfonamides | TMP-SMX |
| Nitroimidazoles | Metronidazole |
| Nitrofurans | Nitrofurantoin |
| Misc | Clindamycin, Fosfomycin, Rifampin, Chloramphenicol |
| Anti-TB (1st line) | INH, Rifampin, PZA, Ethambutol |