make a note on pharmacology and classification of antifungals in short amphotericin b in details and role of antifungals In ent in detail for essay answer of ent pg exam and make it into pdf

Reading File
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Finding Sources
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Running Command

mkdir -p /home/daytona/workspace/antifungals-ent

Writing File

~/antifungals-ent/generate_pdf.py

from reportlab.lib.pagesizes import A4
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm, mm
from reportlab.lib import colors
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    HRFlowable, KeepTogether, PageBreak
)
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_JUSTIFY
from reportlab.platypus import BaseDocTemplate, Frame, PageTemplate

OUTPUT = "/home/daytona/workspace/antifungals-ent/Antifungals_ENT_PG_Essay.pdf"

# ── colour palette ────────────────────────────────────────────────────────────
NAVY   = colors.HexColor("#1a3a5c")
TEAL   = colors.HexColor("#1a7a7a")
GOLD   = colors.HexColor("#c8860a")
LTBLUE = colors.HexColor("#e8f2f8")
LTGOLD = colors.HexColor("#fdf5e4")
WHITE  = colors.white
DARK   = colors.HexColor("#1c1c1c")
MGRAY  = colors.HexColor("#555555")
LGRAY  = colors.HexColor("#dddddd")

# ── styles ────────────────────────────────────────────────────────────────────
styles = getSampleStyleSheet()

def S(name, **kw):
    return ParagraphStyle(name, **kw)

TITLE = S("MyTitle",
    fontSize=22, leading=28, textColor=WHITE,
    fontName="Helvetica-Bold", alignment=TA_CENTER, spaceAfter=4)

SUBTITLE = S("MySubtitle",
    fontSize=12, leading=16, textColor=LTBLUE,
    fontName="Helvetica", alignment=TA_CENTER, spaceAfter=2)

H1 = S("H1",
    fontSize=14, leading=18, textColor=WHITE,
    fontName="Helvetica-Bold", alignment=TA_LEFT,
    spaceBefore=14, spaceAfter=6)

H2 = S("H2",
    fontSize=12, leading=16, textColor=NAVY,
    fontName="Helvetica-Bold", alignment=TA_LEFT,
    spaceBefore=10, spaceAfter=4)

H3 = S("H3",
    fontSize=11, leading=14, textColor=TEAL,
    fontName="Helvetica-Bold", alignment=TA_LEFT,
    spaceBefore=8, spaceAfter=3)

BODY = S("MyBody",
    fontSize=10, leading=15, textColor=DARK,
    fontName="Helvetica", alignment=TA_JUSTIFY,
    spaceBefore=3, spaceAfter=3)

BULLET = S("MyBullet",
    fontSize=10, leading=14, textColor=DARK,
    fontName="Helvetica", leftIndent=16, bulletIndent=4,
    alignment=TA_JUSTIFY, spaceBefore=2, spaceAfter=2)

SUBBULLET = S("SubBullet",
    fontSize=10, leading=13, textColor=MGRAY,
    fontName="Helvetica", leftIndent=30, bulletIndent=18,
    alignment=TA_JUSTIFY, spaceBefore=1, spaceAfter=1)

KEY = S("Key",
    fontSize=9.5, leading=13, textColor=DARK,
    fontName="Helvetica", alignment=TA_JUSTIFY,
    leftIndent=6, spaceBefore=2, spaceAfter=2)

TABLE_HEADER = S("TH",
    fontSize=9.5, leading=12, textColor=WHITE,
    fontName="Helvetica-Bold", alignment=TA_CENTER)

TABLE_CELL = S("TC",
    fontSize=9, leading=12, textColor=DARK,
    fontName="Helvetica", alignment=TA_LEFT)

TABLE_CELL_C = S("TCC",
    fontSize=9, leading=12, textColor=DARK,
    fontName="Helvetica", alignment=TA_CENTER)

NOTE = S("Note",
    fontSize=9, leading=12, textColor=MGRAY,
    fontName="Helvetica-Oblique", alignment=TA_LEFT,
    leftIndent=10, spaceBefore=3, spaceAfter=5)

# ── helpers ────────────────────────────────────────────────────────────────────
def h1_block(text):
    """Navy banner heading."""
    return Table(
        [[Paragraph(text, H1)]],
        colWidths=[17*cm],
        style=TableStyle([
            ("BACKGROUND", (0,0), (-1,-1), NAVY),
            ("TOPPADDING",    (0,0), (-1,-1), 7),
            ("BOTTOMPADDING", (0,0), (-1,-1), 7),
            ("LEFTPADDING",   (0,0), (-1,-1), 12),
            ("RIGHTPADDING",  (0,0), (-1,-1), 8),
            ("ROUNDEDCORNERS",(0,0), (-1,-1), [4,4,4,4]),
        ])
    )

def h2_block(text):
    return Table(
        [[Paragraph(text, H2)]],
        colWidths=[17*cm],
        style=TableStyle([
            ("BACKGROUND", (0,0), (-1,-1), LTBLUE),
            ("TOPPADDING",    (0,0), (-1,-1), 5),
            ("BOTTOMPADDING", (0,0), (-1,-1), 5),
            ("LEFTPADDING",   (0,0), (-1,-1), 10),
            ("LINEBELOW", (0,0), (-1,-1), 1.2, TEAL),
        ])
    )

def gold_box(text):
    return Table(
        [[Paragraph(text, KEY)]],
        colWidths=[17*cm],
        style=TableStyle([
            ("BACKGROUND", (0,0), (-1,-1), LTGOLD),
            ("TOPPADDING",    (0,0), (-1,-1), 6),
            ("BOTTOMPADDING", (0,0), (-1,-1), 6),
            ("LEFTPADDING",   (0,0), (-1,-1), 12),
            ("RIGHTPADDING",  (0,0), (-1,-1), 8),
            ("BOX", (0,0), (-1,-1), 1, GOLD),
        ])
    )

def bullet(text, level=1):
    if level == 1:
        return Paragraph(f"• {text}", BULLET)
    else:
        return Paragraph(f"◦ {text}", SUBBULLET)

def sp(h=6):
    return Spacer(1, h)

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

# ── cover page helper ──────────────────────────────────────────────────────────
def cover_page():
    """Returns a list of flowables making up the cover."""
    cover = Table(
        [[Paragraph("PHARMACOLOGY & CLINICAL ROLE OF", SUBTITLE),
          Paragraph("ANTIFUNGAL AGENTS IN ENT", TITLE),
          Paragraph("Comprehensive Essay for PG Entrance Examination", SUBTITLE),
          Spacer(1, 6),
          Paragraph("Includes: Classification · Amphotericin B (Detailed) · Role of Antifungals in ENT", NOTE)]],
        colWidths=[17*cm],
        style=TableStyle([
            ("BACKGROUND", (0,0), (-1,-1), NAVY),
            ("TOPPADDING",    (0,0), (-1,-1), 30),
            ("BOTTOMPADDING", (0,0), (-1,-1), 30),
            ("LEFTPADDING",   (0,0), (-1,-1), 20),
            ("RIGHTPADDING",  (0,0), (-1,-1), 20),
        ])
    )
    return [cover, sp(14)]


# ══════════════════════════════════════════════════════════════════════════════
# DOCUMENT BUILD
# ══════════════════════════════════════════════════════════════════════════════
def build():
    doc = SimpleDocTemplate(
        OUTPUT,
        pagesize=A4,
        leftMargin=2*cm, rightMargin=2*cm,
        topMargin=2*cm, bottomMargin=2*cm,
        title="Antifungals – Pharmacology & Role in ENT",
        author="Orris Medical Notes"
    )
    story = []

    # ── COVER ─────────────────────────────────────────────────────────────────
    story += cover_page()

    # ══════════════════════════════════════════════════════════════════════════
    # SECTION 1 – INTRODUCTION
    # ══════════════════════════════════════════════════════════════════════════
    story.append(h1_block("1. INTRODUCTION"))
    story.append(sp(6))
    story.append(Paragraph(
        "Fungal infections have increased dramatically in incidence and severity, "
        "mainly due to advances in surgery, cancer treatment, organ/bone marrow "
        "transplantation, the HIV epidemic, and widespread use of broad-spectrum "
        "antibiotics in critically ill patients. Fungi are eukaryotes, making targeted "
        "pharmacotherapy challenging — differences in sterol biosynthesis, cytosine "
        "deamination ability, and unique cell wall components (glucans, chitin) have "
        "been exploited to develop antifungal agents with relative selectivity.",
        BODY))
    story.append(sp(4))
    story.append(Paragraph(
        "For many years, <b>Amphotericin B</b> was the only efficacious agent for systemic "
        "use. The introduction of azoles and echinocandins revolutionised therapy. "
        "Despite this, mortality from invasive fungal disease remains unacceptably high.",
        BODY))
    story.append(sp(10))

    # ══════════════════════════════════════════════════════════════════════════
    # SECTION 2 – CLASSIFICATION
    # ══════════════════════════════════════════════════════════════════════════
    story.append(h1_block("2. CLASSIFICATION OF ANTIFUNGAL AGENTS"))
    story.append(sp(6))

    story.append(gold_box(
        "<b>Mnemonic:</b> <i>Poly-Azole-Echino-Allyl-Misc</i> — "
        "Polyenes | Azoles | Echinocandins | Allylamines | Miscellaneous"
    ))
    story.append(sp(8))

    # ── Classification table ──────────────────────────────────────────────────
    class_data = [
        [Paragraph("Class", TABLE_HEADER),
         Paragraph("Mechanism", TABLE_HEADER),
         Paragraph("Key Agents", TABLE_HEADER),
         Paragraph("Route", TABLE_HEADER)],

        [Paragraph("<b>Polyenes</b>", TABLE_CELL),
         Paragraph("Bind ergosterol → membrane pores → leakage & cell death", TABLE_CELL),
         Paragraph("Amphotericin B, Nystatin", TABLE_CELL),
         Paragraph("IV / Topical", TABLE_CELL_C)],

        [Paragraph("<b>Azoles</b>\nImidazoles", TABLE_CELL),
         Paragraph("Inhibit CYP450 14α-lanosterol demethylase → ↓ ergosterol synthesis", TABLE_CELL),
         Paragraph("Ketoconazole, Clotrimazole, Miconazole", TABLE_CELL),
         Paragraph("Oral / Topical", TABLE_CELL_C)],

        [Paragraph("<b>Azoles</b>\nTriazoles", TABLE_CELL),
         Paragraph("Same as imidazoles but more selective for fungal CYP → ↓ ADRs & drug interactions", TABLE_CELL),
         Paragraph("Fluconazole, Itraconazole, Voriconazole, Posaconazole, Isavuconazole", TABLE_CELL),
         Paragraph("Oral / IV", TABLE_CELL_C)],

        [Paragraph("<b>Echinocandins</b>", TABLE_CELL),
         Paragraph("Inhibit β-(1,3)-D-glucan synthase → disrupts fungal cell wall", TABLE_CELL),
         Paragraph("Caspofungin, Micafungin, Anidulafungin", TABLE_CELL),
         Paragraph("IV only", TABLE_CELL_C)],

        [Paragraph("<b>Allylamines</b>", TABLE_CELL),
         Paragraph("Inhibit squalene epoxidase → ↓ ergosterol, ↑ toxic squalene", TABLE_CELL),
         Paragraph("Terbinafine, Naftifine", TABLE_CELL),
         Paragraph("Oral / Topical", TABLE_CELL_C)],

        [Paragraph("<b>Miscellaneous</b>", TABLE_CELL),
         Paragraph("Inhibits DNA/RNA synthesis (5-FC); disrupts microtubules (Griseofulvin)", TABLE_CELL),
         Paragraph("Flucytosine (5-FC), Griseofulvin", TABLE_CELL),
         Paragraph("Oral", TABLE_CELL_C)],
    ]

    class_table = Table(class_data, colWidths=[3*cm, 5.5*cm, 5.5*cm, 3*cm])
    class_table.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,0), NAVY),
        ("BACKGROUND",    (0,1), (-1,1), LTBLUE),
        ("BACKGROUND",    (0,2), (-1,2), colors.white),
        ("BACKGROUND",    (0,3), (-1,3), LTBLUE),
        ("BACKGROUND",    (0,4), (-1,4), colors.white),
        ("BACKGROUND",    (0,5), (-1,5), LTBLUE),
        ("BACKGROUND",    (0,6), (-1,6), colors.white),
        ("GRID",          (0,0), (-1,-1), 0.5, LGRAY),
        ("VALIGN",        (0,0), (-1,-1), "TOP"),
        ("TOPPADDING",    (0,0), (-1,-1), 6),
        ("BOTTOMPADDING", (0,0), (-1,-1), 6),
        ("LEFTPADDING",   (0,0), (-1,-1), 6),
        ("FONTSIZE",      (0,0), (-1,-1), 9),
    ]))
    story.append(class_table)
    story.append(sp(8))

    # brief notes on each class
    story.append(h2_block("2a. Polyenes"))
    story.append(bullet("Act by binding to ergosterol in the fungal cell membrane, forming transmembrane pores."))
    story.append(bullet("Selective toxicity: ergosterol (fungi) >> cholesterol (mammals)."))
    story.append(bullet("Amphotericin B — gold standard for systemic use; Nystatin — topical only (too toxic systemically)."))
    story.append(sp(4))

    story.append(h2_block("2b. Azoles"))
    story.append(bullet("Fungistatic (usually); block ergosterol synthesis via inhibition of CYP450 14α-lanosterol demethylase."))
    story.append(bullet("<b>Imidazoles</b> (ketoconazole, miconazole, clotrimazole): less selective, more drug interactions."))
    story.append(bullet("<b>Triazoles</b> (fluconazole, itraconazole, voriconazole, posaconazole, isavuconazole): greater selectivity for fungal CYP, broader spectrum."))
    story.append(bullet("Voriconazole — drug of choice for invasive aspergillosis."))
    story.append(bullet("Posaconazole / Isavuconazole — also active against Mucorales (zygomycosis)."))
    story.append(sp(4))

    story.append(h2_block("2c. Echinocandins"))
    story.append(bullet("Fungicidal against Candida; fungistatic against Aspergillus."))
    story.append(bullet("No activity against Cryptococcus neoformans, Mucorales, or endemic dimorphic fungi."))
    story.append(bullet("IV only; minimal toxicity; few drug interactions."))
    story.append(bullet("Caspofungin (loading 70 mg → 50 mg/day), Micafungin (100 mg/day), Anidulafungin (200 mg loading → 100 mg/day)."))
    story.append(sp(4))

    story.append(h2_block("2d. Allylamines"))
    story.append(bullet("Terbinafine: oral — first-line for onychomycosis (dermatophytes); fungicidal."))
    story.append(bullet("Inhibits squalene epoxidase (not CYP450) → no significant P450-drug interactions."))
    story.append(sp(4))

    story.append(h2_block("2e. Miscellaneous"))
    story.append(bullet("<b>Flucytosine (5-FC)</b>: converted to 5-FU inside fungal cells → inhibits DNA/RNA synthesis; used only in combination (to prevent rapid resistance); active against Candida and Cryptococcus."))
    story.append(bullet("<b>Griseofulvin</b>: disrupts microtubule polymerisation; deposits in keratin; used for dermatophytoses of skin/hair/nails; largely replaced by terbinafine and itraconazole."))
    story.append(sp(12))

    # ══════════════════════════════════════════════════════════════════════════
    # SECTION 3 – AMPHOTERICIN B IN DETAIL
    # ══════════════════════════════════════════════════════════════════════════
    story.append(h1_block("3. AMPHOTERICIN B — DETAILED PHARMACOLOGY"))
    story.append(sp(6))

    story.append(h2_block("3a. Source & Chemistry"))
    story.append(Paragraph(
        "Amphotericin B is a <b>polyene macrolide antifungal antibiotic</b> produced by "
        "<i>Streptomyces nodosus</i>. It is a <b>heptaene macrolide</b>, containing "
        "seven conjugated trans-double bonds and a 3-amino-3,6-dideoxymannose "
        "(mycosamine) connected through a glycosidic bond. Its <b>amphoteric</b> properties "
        "(carboxyl group + primary amino group) confer aqueous solubility only at extremes "
        "of pH. Conventional formulation: colloidal suspension with sodium deoxycholate "
        "(Fungizone) for IV use.",
        BODY))
    story.append(sp(4))

    story.append(h2_block("3b. Mechanism of Action"))
    story.append(Paragraph(
        "Amphotericin B acts by <b>binding to ergosterol</b> in the fungal cell membrane. "
        "This binding causes formation of <b>transmembrane pores (ion channels)</b>, "
        "resulting in loss of cytoplasmic contents (K⁺, H⁺, amino acids), "
        "collapse of the electrochemical gradient, and ultimately <b>cell death</b> (fungicidal).",
        BODY))
    story.append(sp(2))
    story.append(bullet("Selective toxicity: Much greater affinity for ergosterol (fungi) than cholesterol (mammalian cells)."))
    story.append(bullet("Also has immunostimulatory properties: stimulates macrophages to produce TNF-α and IL-1."))
    story.append(sp(4))

    story.append(h2_block("3c. Spectrum of Activity"))
    act_data = [
        [Paragraph("Susceptible Organisms", TABLE_HEADER), Paragraph("Resistant / Intrinsically Resistant", TABLE_HEADER)],
        [Paragraph("Candida spp. (most), Aspergillus spp.", TABLE_CELL), Paragraph("Candida lusitaniae", TABLE_CELL)],
        [Paragraph("Cryptococcus neoformans", TABLE_CELL), Paragraph("Candida guilliermondii (variable)", TABLE_CELL)],
        [Paragraph("Mucorales / Zygomycetes (Rhizopus, Mucor)", TABLE_CELL), Paragraph("Pseudallescheria boydii (S. apiospermum)", TABLE_CELL)],
        [Paragraph("Histoplasma, Blastomyces, Coccidioides, Sporothrix", TABLE_CELL), Paragraph("Trichosporon (variable)", TABLE_CELL)],
        [Paragraph("Paracoccidioides, Penicillium, Fusarium (partial)", TABLE_CELL), Paragraph("Dermatophytes — NOT susceptible", TABLE_CELL)],
    ]
    act_table = Table(act_data, colWidths=[8.5*cm, 8.5*cm])
    act_table.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,0), TEAL),
        ("GRID",          (0,0), (-1,-1), 0.5, LGRAY),
        ("VALIGN",        (0,0), (-1,-1), "TOP"),
        ("TOPPADDING",    (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
        ("LEFTPADDING",   (0,0), (-1,-1), 6),
        ("ROWBACKGROUNDS",(0,1), (-1,-1), [LTBLUE, WHITE]),
    ]))
    story.append(act_table)
    story.append(sp(6))

    story.append(h2_block("3d. Pharmacokinetics"))
    pk_data = [
        [Paragraph("Parameter", TABLE_HEADER), Paragraph("Details", TABLE_HEADER)],
        [Paragraph("Absorption", TABLE_CELL), Paragraph("Not absorbed orally; IV only for systemic use", TABLE_CELL)],
        [Paragraph("Distribution", TABLE_CELL), Paragraph("Vd very large; penetrates most tissues including pleura, peritoneum, joints; POOR CNS penetration (10% of serum); binds to cholesterol in host membranes", TABLE_CELL)],
        [Paragraph("Protein Binding", TABLE_CELL), Paragraph(">90% bound to serum proteins", TABLE_CELL)],
        [Paragraph("Blood Levels", TABLE_CELL), Paragraph("0.6 mg/kg/day IV → average blood levels 0.3–1 mcg/mL", TABLE_CELL)],
        [Paragraph("Metabolism", TABLE_CELL), Paragraph("Mostly metabolised; very slow hepatic metabolism", TABLE_CELL)],
        [Paragraph("Excretion", TABLE_CELL), Paragraph("Slow biliary and renal excretion; t½ ≈ 15 days; detectable in urine for 7 weeks after stopping", TABLE_CELL)],
        [Paragraph("Dose adjustment", TABLE_CELL), Paragraph("Not required in renal failure (conventional formulation); however, nephrotoxicity mandates careful monitoring", TABLE_CELL)],
    ]
    pk_table = Table(pk_data, colWidths=[3.5*cm, 13.5*cm])
    pk_table.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,0), TEAL),
        ("GRID",          (0,0), (-1,-1), 0.5, LGRAY),
        ("VALIGN",        (0,0), (-1,-1), "TOP"),
        ("TOPPADDING",    (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
        ("LEFTPADDING",   (0,0), (-1,-1), 6),
        ("ROWBACKGROUNDS",(0,1), (-1,-1), [colors.white, LTBLUE]),
    ]))
    story.append(pk_table)
    story.append(sp(6))

    story.append(h2_block("3e. Lipid Formulations"))
    story.append(Paragraph(
        "Conventional amphotericin B is highly nephrotoxic, limiting its dose. "
        "<b>Lipid formulations</b> package the drug in lipid delivery vehicles; amphotericin "
        "binds lipids with affinity between that for ergosterol (high) and cholesterol (lower), "
        "thus reducing nonspecific binding to mammalian membranes and allowing higher effective doses.",
        BODY))
    story.append(sp(4))
    lipid_data = [
        [Paragraph("Preparation", TABLE_HEADER),
         Paragraph("Physical Form", TABLE_HEADER),
         Paragraph("Dose (mg/kg/day)", TABLE_HEADER),
         Paragraph("Nephrotoxicity", TABLE_HEADER),
         Paragraph("Infusional Toxicity", TABLE_HEADER)],
        [Paragraph("Fungizone (conventional)", TABLE_CELL),
         Paragraph("Micelles with deoxycholate", TABLE_CELL),
         Paragraph("0.5–1", TABLE_CELL_C),
         Paragraph("High +++", TABLE_CELL_C),
         Paragraph("High +++", TABLE_CELL_C)],
        [Paragraph("AmBisome (L-AMB)", TABLE_CELL),
         Paragraph("Liposomal spheres", TABLE_CELL),
         Paragraph("3–5", TABLE_CELL_C),
         Paragraph("↓ Low", TABLE_CELL_C),
         Paragraph("↓ Low", TABLE_CELL_C)],
        [Paragraph("Amphocil / ABCD", TABLE_CELL),
         Paragraph("Colloidal dispersion (disks)", TABLE_CELL),
         Paragraph("3–4", TABLE_CELL_C),
         Paragraph("↓ Low", TABLE_CELL_C),
         Paragraph("↑ Higher", TABLE_CELL_C)],
        [Paragraph("Abelcet / ABLC", TABLE_CELL),
         Paragraph("Lipid complex (ribbons)", TABLE_CELL),
         Paragraph("5", TABLE_CELL_C),
         Paragraph("↓ Low", TABLE_CELL_C),
         Paragraph("↓ Low", TABLE_CELL_C)],
    ]
    lipid_table = Table(lipid_data, colWidths=[3.5*cm, 4*cm, 3*cm, 3.25*cm, 3.25*cm])
    lipid_table.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,0), NAVY),
        ("GRID",          (0,0), (-1,-1), 0.5, LGRAY),
        ("VALIGN",        (0,0), (-1,-1), "TOP"),
        ("TOPPADDING",    (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
        ("LEFTPADDING",   (0,0), (-1,-1), 5),
        ("ROWBACKGROUNDS",(0,1), (-1,-1), [WHITE, LTBLUE]),
    ]))
    story.append(lipid_table)
    story.append(sp(4))
    story.append(Paragraph(
        "<i>L-AMB (AmBisome) is preferred in CNS fungal infections, pre-existing renal impairment, "
        "and in patients with significant infusion-related reactions to conventional amphotericin B. "
        "No trials directly compare lipid formulations with each other.</i>", NOTE))
    story.append(sp(6))

    story.append(h2_block("3f. Adverse Effects"))
    story.append(Paragraph(
        "<b>Amphotericin B has two main categories of toxicity: infusion-related (acute) "
        "and dose-dependent (cumulative/chronic).</b>", BODY))
    story.append(sp(3))

    story.append(Paragraph("<b>A. Infusion-related reactions (acute, within 1–3 hours):</b>", H3))
    story.append(bullet("Fever, rigors, chills, headache, nausea, vomiting"))
    story.append(bullet("Hypotension, bronchospasm (anaphylactoid reaction)"))
    story.append(bullet("<b>Management:</b> Premedicate with paracetamol, antihistamine (diphenhydramine), hydrocortisone; slow infusion rate; meperidine (pethidine) for rigors"))
    story.append(sp(4))

    story.append(Paragraph("<b>B. Dose-dependent / cumulative toxicities:</b>", H3))
    story.append(bullet("<b>Nephrotoxicity</b> (most important): renal tubular acidosis, loss of K⁺ and Mg²⁺ (hypokalaemia, hypomagnesaemia), reduced GFR, azotaemia. Occurs in up to 80% of patients. Reversible with adequate hydration. Rarely permanent if cumulative dose &lt;4 g."))
    story.append(bullet("<b>Normochromic normocytic anaemia</b>: due to reduced erythropoietin production"))
    story.append(bullet("<b>Thrombophlebitis</b>: at IV site"))
    story.append(bullet("<b>Hypokalaemia and hypomagnesaemia</b>: require regular monitoring and replacement"))
    story.append(bullet("Rarely: hepatotoxicity, arrhythmias (with rapid infusion)"))
    story.append(sp(4))

    story.append(gold_box(
        "<b>Prevention of nephrotoxicity:</b> Normal saline loading (500 mL NS before each dose), "
        "avoid concomitant nephrotoxic drugs (aminoglycosides, NSAIDs, cisplatin), monitor renal "
        "function and electrolytes twice weekly."
    ))
    story.append(sp(6))

    story.append(h2_block("3g. Drug Interactions"))
    story.append(bullet("Aminoglycosides, cyclosporin, cisplatin: additive nephrotoxicity"))
    story.append(bullet("Corticosteroids: worsen hypokalaemia → risk of cardiac arrhythmia"))
    story.append(bullet("Flucytosine (5-FC): synergistic (used in combination for cryptococcal meningitis)"))
    story.append(bullet("Azoles (fluconazole, itraconazole): Amphotericin B may antagonise azoles by reducing ergosterol (the target for azoles) — clinical significance debated"))
    story.append(sp(4))

    story.append(h2_block("3h. Clinical Indications"))
    ind_data = [
        [Paragraph("Indication", TABLE_HEADER), Paragraph("Notes", TABLE_HEADER)],
        [Paragraph("Invasive Aspergillosis", TABLE_CELL), Paragraph("Now superseded by voriconazole as first-line; AmB used if voriconazole resistant/intolerant", TABLE_CELL)],
        [Paragraph("Mucormycosis / Zygomycosis", TABLE_CELL), Paragraph("Drug of choice (L-AMB preferred); voriconazole NOT active", TABLE_CELL)],
        [Paragraph("Cryptococcal Meningitis", TABLE_CELL), Paragraph("L-AMB + flucytosine induction for 2 weeks, then fluconazole consolidation", TABLE_CELL)],
        [Paragraph("Candidaemia / Invasive Candidiasis", TABLE_CELL), Paragraph("Echinocandins now preferred; AmB used in resistance or unavailability", TABLE_CELL)],
        [Paragraph("Endemic Mycoses (severe)", TABLE_CELL), Paragraph("Histoplasmosis, coccidioidomycosis, blastomycosis — severe/CNS cases", TABLE_CELL)],
        [Paragraph("Acute Invasive Fungal Sinusitis (ENT)", TABLE_CELL), Paragraph("L-AMB IV is cornerstone of medical management; combined with surgical debridement", TABLE_CELL)],
        [Paragraph("Intrathecal / Intraventricular", TABLE_CELL), Paragraph("Fungal meningitis unresponsive to IV; specialist use", TABLE_CELL)],
    ]
    ind_table = Table(ind_data, colWidths=[5*cm, 12*cm])
    ind_table.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,0), TEAL),
        ("GRID",          (0,0), (-1,-1), 0.5, LGRAY),
        ("VALIGN",        (0,0), (-1,-1), "TOP"),
        ("TOPPADDING",    (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
        ("LEFTPADDING",   (0,0), (-1,-1), 6),
        ("ROWBACKGROUNDS",(0,1), (-1,-1), [WHITE, LTBLUE]),
    ]))
    story.append(ind_table)
    story.append(sp(12))

    # ══════════════════════════════════════════════════════════════════════════
    # SECTION 4 – ROLE OF ANTIFUNGALS IN ENT
    # ══════════════════════════════════════════════════════════════════════════
    story.append(PageBreak())
    story.append(h1_block("4. ROLE OF ANTIFUNGALS IN ENT — DETAILED"))
    story.append(sp(6))

    story.append(Paragraph(
        "Fungal infections in ENT practice are increasingly recognised, particularly in "
        "immunocompromised patients. Management generally involves a combination of "
        "<b>surgical debridement</b> and <b>systemic antifungal therapy</b>. "
        "The following classification is based on <i>K.J. Lee's Essential Otolaryngology</i>:",
        BODY))
    story.append(sp(8))

    # ── 4A: Otomycosis ────────────────────────────────────────────────────────
    story.append(h2_block("4A. OTOMYCOSIS (Fungal Otitis Externa)"))
    story.append(sp(4))

    story.append(Paragraph("<b>Definition & Epidemiology:</b>", H3))
    story.append(Paragraph(
        "Fungal infection of the external auditory canal (EAC), most commonly caused by "
        "<i>Aspergillus niger</i> (most common) and <i>Candida</i> spp. Occurs in hot, "
        "humid climates; predisposed by water exposure, trauma, hearing aids, and prior "
        "antibiotic ear drops.",
        BODY))
    story.append(sp(3))

    story.append(Paragraph("<b>Clinical Features:</b>", H3))
    story.append(bullet("Intense pruritus (more prominent than in bacterial otitis externa)"))
    story.append(bullet("Scanty ear discharge — black (Aspergillus niger), white/creamy (Candida)"))
    story.append(bullet("Blocked sensation / hearing loss"))
    story.append(bullet("On otoscopy: fungal debris with hyphal elements; EAC oedema"))
    story.append(sp(3))

    story.append(Paragraph("<b>Treatment (Antifungal Role):</b>", H3))
    story.append(bullet("<b>Step 1 — Aural toilet:</b> Thorough debridement and microsuction of fungal debris under microscopy. This is ESSENTIAL and forms the cornerstone of treatment."))
    story.append(bullet("<b>Step 2 — Topical antifungals:</b>"))
    story.append(bullet("Clotrimazole 1% solution (ear drops) — first-line; broad-spectrum", level=2))
    story.append(bullet("Nystatin drops or cream — for Candida-predominant disease", level=2))
    story.append(bullet("Vioform (clioquinol) + clotrimazole combination drops — used in recalcitrant cases", level=2))
    story.append(bullet("Boric acid 2% in alcohol — antifungal and acidifying; useful in chronic/recurrent cases", level=2))
    story.append(bullet("<b>Step 3 — Systemic antifungals:</b> Required only in immunocompromised patients, invasive disease, or failures. Oral itraconazole or fluconazole used."))
    story.append(bullet("Keep ear dry; avoid trauma; treat predisposing factors"))
    story.append(sp(8))

    # ── 4B: Fungal Rhinosinusitis ─────────────────────────────────────────────
    story.append(h2_block("4B. FUNGAL RHINOSINUSITIS (FRS)"))
    story.append(sp(4))
    story.append(Paragraph(
        "Fungal rhinosinusitis is classified into <b>noninvasive</b> and <b>invasive</b> forms, "
        "each with distinct pathophysiology, patient populations, and antifungal requirements.",
        BODY))
    story.append(sp(5))

    # overview table
    frs_data = [
        [Paragraph("Type", TABLE_HEADER),
         Paragraph("Host Immunity", TABLE_HEADER),
         Paragraph("Causative Fungi", TABLE_HEADER),
         Paragraph("Antifungals Needed?", TABLE_HEADER)],
        [Paragraph("Fungal Ball (Mycetoma)", TABLE_CELL),
         Paragraph("Immunocompetent", TABLE_CELL),
         Paragraph("Aspergillus fumigatus / flavus", TABLE_CELL),
         Paragraph("NO — surgery alone", TABLE_CELL_C)],
        [Paragraph("Allergic Fungal Rhinosinusitis (AFRS)", TABLE_CELL),
         Paragraph("Immunocompetent (atopic)", TABLE_CELL),
         Paragraph("Dematiaceous fungi: Bipolaris, Curvularia, Alternaria", TABLE_CELL),
         Paragraph("Adjunct only (limited benefit)", TABLE_CELL_C)],
        [Paragraph("Acute Invasive FRS (AIFS)", TABLE_CELL),
         Paragraph("Severely immunocompromised (ANC &lt;500, DKA)", TABLE_CELL),
         Paragraph("Mucorales / Aspergillus", TABLE_CELL),
         Paragraph("YES — IV AmB essential", TABLE_CELL_C)],
        [Paragraph("Chronic Invasive FRS", TABLE_CELL),
         Paragraph("Mildly immunocompromised / diabetic", TABLE_CELL),
         Paragraph("Aspergillus spp., dematiaceous molds", TABLE_CELL),
         Paragraph("YES — prolonged antifungal", TABLE_CELL_C)],
        [Paragraph("Granulomatous Invasive FRS", TABLE_CELL),
         Paragraph("Immunocompetent (endemic regions)", TABLE_CELL),
         Paragraph("Aspergillus flavus, A. fumigatus", TABLE_CELL),
         Paragraph("YES — antifungal + surgery", TABLE_CELL_C)],
    ]
    frs_table = Table(frs_data, colWidths=[3.5*cm, 3.5*cm, 5*cm, 5*cm])
    frs_table.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,0), NAVY),
        ("GRID",          (0,0), (-1,-1), 0.5, LGRAY),
        ("VALIGN",        (0,0), (-1,-1), "TOP"),
        ("TOPPADDING",    (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
        ("LEFTPADDING",   (0,0), (-1,-1), 5),
        ("ROWBACKGROUNDS",(0,1), (-1,-1), [WHITE, LTBLUE]),
    ]))
    story.append(frs_table)
    story.append(sp(8))

    # ── Fungal Ball ────────────────────────────────────────────────────────────
    story.append(Paragraph("<b>i. Fungal Ball (Aspergilloma / Mycetoma)</b>", H3))
    story.append(Paragraph(
        "Dense amalgamation of fungal hyphae in a sinus cavity — usually <b>maxillary</b> "
        "(most common), then sphenoid, ethmoid, frontal. Occurs in immunocompetent patients.",
        BODY))
    story.append(bullet("CT: Sinus opacification with heterogeneous attenuation (hyperdense foci); bony thickening/hyperostosis"))
    story.append(bullet("Treatment: <b>Endoscopic sinus surgery (ESS)</b> — complete removal of fungal debris + wide ostial opening"))
    story.append(bullet("<b>Antifungals NOT required</b> postoperatively in immunocompetent hosts"))
    story.append(bullet("Rare progression to invasive disease in immunocompromised — antifungals then indicated"))
    story.append(sp(6))

    # ── AFRS ──────────────────────────────────────────────────────────────────
    story.append(Paragraph("<b>ii. Allergic Fungal Rhinosinusitis (AFRS)</b>", H3))
    story.append(Paragraph(
        "IgE-mediated hypersensitivity to fungal antigens (type I and III), leading to "
        "eosinophilic mucin, nasal polyposis, and sinonasal expansion. "
        "Dematiaceous fungi (Bipolaris, Curvularia, Alternaria) are most common causative agents.",
        BODY))
    story.append(bullet("Hallmark: <b>Eosinophilic (allergic) mucin</b> — thick, brown/green, contains Charcot-Leyden crystals, eosinophils, non-invasive fungal hyphae"))
    story.append(bullet("CT: Bilateral (often) sinus opacification with <b>heterogeneous attenuation / dual-density secretions</b>; bone erosion (expansion)"))
    story.append(bullet("MRI: T2 hypointense mucin (dehydrated, high protein); peripheral mucosal enhancement"))
    story.append(sp(3))
    story.append(Paragraph("<b>Treatment:</b>", H3))
    story.append(bullet("Surgery: Functional endoscopic sinus surgery (FESS) — complete evacuation of mucin and polyposis; wide sinus drainage"))
    story.append(bullet("Systemic corticosteroids: Perioperative prednisone 0.5 mg/kg/day (mainstay)"))
    story.append(bullet("Topical nasal steroids: Long-term postoperative maintenance"))
    story.append(bullet("<b>Antifungals in AFRS:</b>"))
    story.append(bullet("Systemic antifungals have LIMITED proven benefit in AFRS (disease is immunologic, not invasive)", level=2))
    story.append(bullet("Topical antifungals (amphotericin B nasal irrigation) have been investigated — modest benefit in some studies", level=2))
    story.append(bullet("Itraconazole orally — may reduce recurrence in some patients; not standard of care", level=2))
    story.append(bullet("High recurrence rate; antifungals alone are insufficient; immunotherapy with fungal antigens used adjunctively"))
    story.append(sp(6))

    # ── AIFS ──────────────────────────────────────────────────────────────────
    story.append(Paragraph("<b>iii. Acute Invasive Fungal Sinusitis (AIFS) — CRITICAL</b>", H3))
    story.append(gold_box(
        "<b>Medical Emergency:</b> Acute invasive fungal sinusitis has a mortality of 50–80% "
        "in untreated or delayed cases. Prompt surgical debridement + reversal of "
        "immunosuppression + IV antifungal therapy is life-saving."
    ))
    story.append(sp(4))
    story.append(Paragraph("<b>Definition:</b> Angioinvasive fungal infection of the sinonasal mucosa in severely immunocompromised hosts, progressing over days.", BODY))
    story.append(sp(3))
    story.append(Paragraph("<b>Risk Factors:</b>", H3))
    story.append(bullet("Haematological malignancies with neutropenia (ANC &lt;500 cells/mm³) — most common"))
    story.append(bullet("Diabetic ketoacidosis (DKA) — especially for mucormycosis"))
    story.append(bullet("Post-transplant immunosuppression, HIV/AIDS, prolonged corticosteroid use"))
    story.append(sp(3))
    story.append(Paragraph("<b>Causative Organisms:</b>", H3))
    story.append(bullet("Mucorales order: <i>Rhizopus, Mucor, Rhizomucor, Cunninghamella</i> — rhino-orbital-cerebral mucormycosis"))
    story.append(bullet("Aspergillus fumigatus / flavus — angioinvasive aspergillosis"))
    story.append(sp(3))
    story.append(Paragraph("<b>Clinical Features:</b>", H3))
    story.append(bullet("Fever unresponsive to antibiotics, nasal congestion, bloody discharge"))
    story.append(bullet("Facial pain/numbness, periorbital oedema"))
    story.append(bullet("Eschar formation on nasal mucosa, palate, or turbinates — PATHOGNOMONIC of necrosis"))
    story.append(bullet("Proptosis, ophthalmoplegia, visual loss → orbital involvement"))
    story.append(bullet("Cavernous sinus thrombosis, intracranial extension (very poor prognosis)"))
    story.append(sp(3))
    story.append(Paragraph("<b>Diagnosis:</b>", H3))
    story.append(bullet("Endoscopy + biopsy: Tissue invasion with angioinvasion and necrosis — ESSENTIAL"))
    story.append(bullet("CT: Unilateral mucosal thickening, bony erosion, extrasinus fat stranding"))
    story.append(bullet("MRI Gd: <b>'Black turbinate sign'</b> — absence of enhancement in sinonasal mucosa on T1 post-contrast = mucosal necrosis from angioinvasion (highly suggestive of AIFS)"))
    story.append(sp(3))
    story.append(Paragraph("<b>Treatment — Three Pillars:</b>", H3))
    story.append(bullet("<b>Pillar 1 — Surgical debridement:</b> Aggressive endoscopic surgery; open approaches (maxillectomy, orbital exenteration) for orbital/cerebral extension"))
    story.append(bullet("<b>Pillar 2 — Reversal of immunosuppression:</b> Correct neutropenia (G-CSF), control DKA, reduce steroids if possible"))
    story.append(bullet("<b>Pillar 3 — Prolonged IV antifungal therapy:</b>"))
    story.append(sp(2))

    aifs_drug = [
        [Paragraph("Organism", TABLE_HEADER), Paragraph("Drug of Choice", TABLE_HEADER), Paragraph("Alternative", TABLE_HEADER)],
        [Paragraph("Mucorales (Mucormycosis)", TABLE_CELL),
         Paragraph("Liposomal Amphotericin B (L-AMB) 5–10 mg/kg/day", TABLE_CELL),
         Paragraph("Isavuconazole or Posaconazole (stepdown/combination)", TABLE_CELL)],
        [Paragraph("Aspergillus (Aspergillosis)", TABLE_CELL),
         Paragraph("Voriconazole 6 mg/kg IV q12h (loading) → 4 mg/kg q12h", TABLE_CELL),
         Paragraph("L-AMB 3–5 mg/kg/day; Isavuconazole; Caspofungin (combination)", TABLE_CELL)],
    ]
    aifs_table = Table(aifs_drug, colWidths=[4*cm, 7*cm, 6*cm])
    aifs_table.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,0), NAVY),
        ("GRID",          (0,0), (-1,-1), 0.5, LGRAY),
        ("VALIGN",        (0,0), (-1,-1), "TOP"),
        ("TOPPADDING",    (0,0), (-1,-1), 6),
        ("BOTTOMPADDING", (0,0), (-1,-1), 6),
        ("LEFTPADDING",   (0,0), (-1,-1), 6),
        ("ROWBACKGROUNDS",(0,1), (-1,-1), [WHITE, LTBLUE]),
    ]))
    story.append(aifs_table)
    story.append(sp(4))
    story.append(Paragraph(
        "<i>Duration: Continue antifungals until resolution of infection and immune reconstitution — "
        "often months. Serial MRI/CT monitoring required. Surgical debridement may need to be repeated.</i>",
        NOTE))
    story.append(sp(6))

    # ── Chronic Invasive FRS ──────────────────────────────────────────────────
    story.append(Paragraph("<b>iv. Chronic Invasive Fungal Sinusitis</b>", H3))
    story.append(Paragraph(
        "Indolent form (>4 weeks) occurring in mildly immunocompromised or diabetic patients. "
        "Caused by Aspergillus spp. and dematiaceous molds. Presents like chronic rhinosinusitis "
        "with late complications (proptosis, cranial neuropathies).",
        BODY))
    story.append(bullet("Treatment: Same three pillars as AIFS — surgical debridement + reversal of immunosuppression + prolonged antifungal therapy"))
    story.append(bullet("Voriconazole for Aspergillus; L-AMB for mucorales; long-term oral itraconazole/voriconazole for step-down"))
    story.append(bullet("Long-term surveillance is mandatory"))
    story.append(sp(6))

    # ── Granulomatous Invasive FRS ────────────────────────────────────────────
    story.append(Paragraph("<b>v. Granulomatous Invasive Fungal Sinusitis</b>", H3))
    story.append(Paragraph(
        "Rare; characterised by non-caseating granulomas with giant cells and dense fibrosis. "
        "Reported in Sudan, India, Pakistan, Saudi Arabia. Caused by Aspergillus flavus. "
        "Presents with unilateral <b>proptosis</b> — often mistaken for a tumour.",
        BODY))
    story.append(bullet("Treatment: Surgical debridement + antifungal therapy (voriconazole or itraconazole)"))
    story.append(sp(8))

    # ── 4C: Oropharyngeal & Laryngeal Candidiasis ─────────────────────────────
    story.append(h2_block("4C. OROPHARYNGEAL & LARYNGEAL CANDIDIASIS"))
    story.append(sp(4))
    story.append(Paragraph(
        "Most commonly caused by <i>Candida albicans</i>. "
        "Predisposing factors: HIV/AIDS, corticosteroid inhaler use, dentures, xerostomia, "
        "chemotherapy, diabetes, prolonged antibiotics.",
        BODY))
    story.append(bullet("<b>Oral thrush:</b> White pseudomembranous plaques — wipe off leaving erythematous base"))
    story.append(bullet("<b>Laryngeal candidiasis:</b> Hoarseness, dysphagia, odynophagia; white plaques on laryngoscopy; in immunocompromised"))
    story.append(sp(3))
    story.append(Paragraph("<b>Treatment:</b>", H3))
    story.append(bullet("Mild–moderate (immunocompetent): Topical nystatin oral suspension (swish and swallow) OR clotrimazole troches"))
    story.append(bullet("Moderate–severe or immunocompromised: Systemic fluconazole 100–200 mg/day × 7–14 days (first-line)"))
    story.append(bullet("Fluconazole-resistant (C. krusei, C. glabrata): Voriconazole, posaconazole, or echinocandin"))
    story.append(bullet("Correct predisposing factors — rinse mouth after steroid inhaler; treat underlying immunosuppression"))
    story.append(sp(8))

    # ── 4D: Pharyngeal / Deep Neck Fungal Infections ──────────────────────────
    story.append(h2_block("4D. DEEP-NECK & PHARYNGEAL FUNGAL INFECTIONS"))
    story.append(sp(4))
    story.append(Paragraph(
        "Uncommon; occur in severely immunocompromised patients. May involve parapharyngeal, "
        "retropharyngeal, and masticator spaces. Candida, Aspergillus, and Mucorales implicated.",
        BODY))
    story.append(bullet("Treatment: Systemic antifungal (based on organism) + surgical drainage where applicable"))
    story.append(bullet("Amphotericin B IV for mucormycosis of deep neck spaces; voriconazole for aspergillosis"))
    story.append(sp(8))

    # ══════════════════════════════════════════════════════════════════════════
    # SECTION 5 – SUMMARY TABLE
    # ══════════════════════════════════════════════════════════════════════════
    story.append(PageBreak())
    story.append(h1_block("5. QUICK REVISION — HIGH-YIELD POINTS FOR PG EXAM"))
    story.append(sp(6))

    hiyield = [
        ["Drug of choice for mucormycosis (AIFS)", "Liposomal Amphotericin B (L-AMB)"],
        ["Drug of choice for invasive aspergillosis", "Voriconazole (primary); L-AMB (alternative)"],
        ["Drug NOT active against Mucorales", "Voriconazole, Echinocandins"],
        ["Echinocandins NOT active against", "Cryptococcus, Mucorales, endemic dimorphic fungi"],
        ["Antifungal required for fungal ball in immunocompetent", "NONE — surgery alone suffices"],
        ["Antifungal role in AFRS", "Limited; adjunct only; topical AmB irrigation investigated"],
        ["'Black turbinate sign' on MRI", "Acute invasive fungal sinusitis — mucosal necrosis"],
        ["Most common cause of otomycosis", "Aspergillus niger > Candida"],
        ["First-line for otomycosis (topical)", "Clotrimazole 1% ear drops + aural toilet"],
        ["Lipid AmB advantage over conventional", "↓ Nephrotoxicity, ↓ infusion reactions; same/better efficacy"],
        ["AmB + flucytosine combination used for", "Cryptococcal meningitis induction therapy"],
        ["Fluconazole NOT effective against", "Aspergillus, Mucorales, C. krusei (intrinsic resistance)"],
        ["Mechanism — Amphotericin B", "Binds ergosterol → membrane pores → cell death (fungicidal)"],
        ["Mechanism — Azoles", "Inhibit CYP450 14α-demethylase → ↓ ergosterol synthesis"],
        ["Mechanism — Echinocandins", "Inhibit β-(1,3)-D-glucan synthase → disrupts cell wall"],
        ["Mechanism — Terbinafine", "Inhibits squalene epoxidase → ↑ toxic squalene accumulation"],
        ["Mechanism — 5-FC (Flucytosine)", "Converted to 5-FU inside fungi → inhibits DNA/RNA synthesis"],
        ["Amphotericin B nephrotoxicity prevention", "Normal saline loading before each dose; avoid nephrotoxins"],
        ["AFRS characteristic pathological mucin", "Eosinophilic mucin + Charcot-Leyden crystals"],
        ["Most common sinus in fungal ball", "Maxillary sinus (>50%)"],
    ]

    hy_table_data = [
        [Paragraph("Key Question / Concept", TABLE_HEADER), Paragraph("Answer / Key Point", TABLE_HEADER)]
    ] + [
        [Paragraph(r[0], TABLE_CELL), Paragraph(f"<b>{r[1]}</b>", TABLE_CELL)]
        for r in hiyield
    ]
    hy_table = Table(hy_table_data, colWidths=[8*cm, 9*cm])
    hy_table.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,0), NAVY),
        ("GRID",          (0,0), (-1,-1), 0.5, LGRAY),
        ("VALIGN",        (0,0), (-1,-1), "TOP"),
        ("TOPPADDING",    (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
        ("LEFTPADDING",   (0,0), (-1,-1), 6),
        ("ROWBACKGROUNDS",(0,1), (-1,-1), [WHITE, LTBLUE]),
    ]))
    story.append(hy_table)
    story.append(sp(10))

    # ══════════════════════════════════════════════════════════════════════════
    # SECTION 6 – REFERENCES
    # ══════════════════════════════════════════════════════════════════════════
    story.append(h1_block("6. REFERENCES"))
    story.append(sp(5))
    story.append(bullet("Katzung BG. Basic and Clinical Pharmacology, 16th ed. Chapter 48: Antifungal Agents."))
    story.append(bullet("Goodman & Gilman's The Pharmacological Basis of Therapeutics, 14th ed. Chapter 61."))
    story.append(bullet("K.J. Lee's Essential Otolaryngology, 12th ed. Chapter 30: Fungal Rhinosinusitis."))
    story.append(bullet("Goldman-Cecil Medicine International Edition. Antifungal Agents & Antifungal Treatment."))
    story.append(bullet("Jawetz, Melnick & Adelberg's Medical Microbiology, 28th ed. Antifungal Chemotherapies."))
    story.append(sp(10))

    # ── footer note ────────────────────────────────────────────────────────────
    story.append(hr())
    story.append(Paragraph(
        "<i>Prepared by Orris — AI Medical Notes | For ENT PG Entrance Examination Preparation | May 2026</i>",
        NOTE))

    doc.build(story)
    print(f"PDF saved: {OUTPUT}")

build()
Running Command

cd /home/daytona/workspace/antifungals-ent && python generate_pdf.py 2>&1

Running Command

ls -lh /home/daytona/workspace/antifungals-ent/Antifungals_ENT_PG_Essay.pdf

PDF generated successfully. Here's your download link:

Antifungals ENT PG Essay

PDF Document · PDF


What's Inside the PDF

The document is structured as a full essay answer, organised into 6 sections:

Section 1 — Introduction

Why fungal infections are rising; why they're pharmacologically challenging (eukaryotes); evolution from amphotericin B to modern agents.

Section 2 — Classification of Antifungal Agents

Full classification table with mechanism, agents, and route:
ClassMechanismKey Agents
PolyenesBind ergosterol → membrane poresAmphotericin B, Nystatin
Azoles (Imidazoles)CYP450 14α-demethylase inhibitionKetoconazole, Clotrimazole
Azoles (Triazoles)Same, more selectiveFluconazole, Itraconazole, Voriconazole, Posaconazole
Echinocandinsβ-(1,3)-D-glucan synthase inhibitionCaspofungin, Micafungin, Anidulafungin
AllylaminesSqualene epoxidase inhibitionTerbinafine
MiscellaneousDNA/RNA inhibition, microtubule disruption5-FC (Flucytosine), Griseofulvin

Section 3 — Amphotericin B (Detailed)

  • Source & Chemistry (heptaene macrolide from Streptomyces nodosus)
  • Mechanism of action (ergosterol binding → ion channel pores → fungicidal)
  • Full spectrum of activity table
  • Detailed pharmacokinetics table
  • Lipid formulations — full comparison table (Fungizone vs AmBisome vs Amphocil vs Abelcet)
  • Adverse effects: infusion-related (fever, rigors, bronchospasm) and dose-dependent (nephrotoxicity, hypokalaemia, anaemia)
  • Drug interactions
  • Clinical indications table

Section 4 — Role of Antifungals in ENT (Detailed)

  • Otomycosis: aural toilet + topical clotrimazole; systemic only in immunocompromised
  • Fungal Ball: surgery alone; antifungals NOT needed in immunocompetent
  • AFRS: surgery + steroids are mainstay; antifungals have limited adjunct role
  • Acute Invasive FRS (AIFS): medical emergency — three pillars (surgery + immunosuppression reversal + IV L-AMB/voriconazole), black turbinate sign
  • Chronic & Granulomatous Invasive FRS: prolonged antifungal + surgery
  • Oropharyngeal/Laryngeal Candidiasis: topical nystatin/clotrimazole or systemic fluconazole

Section 5 — High-Yield PG Exam Quick Revision Table

20 classic exam Q&A pairs (DOC for mucormycosis, drugs NOT active against Mucorales, AFRS mucin pathology, etc.)

Section 6 — References

Katzung, Goodman & Gilman, K.J. Lee's Essential Otolaryngology, Goldman-Cecil Medicine, Jawetz Microbiology.
This is a shared conversation. Sign in to Orris to start your own chat.