attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment

Make a perfect hand written notes in full detailed version on each topic ..make it easy and easy to understand..you can use flowchart or table format

Running Command

ls /home/daytona/workspace/ 2>/dev/null || echo "workspace empty"

Running Command

mkdir -p /home/daytona/workspace/pharmacodynamics-notes && python3 -c "import re…

Writing File

~/pharmacodynamics-notes/make_notes.py

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

OUTPUT = "/home/daytona/workspace/pharmacodynamics-notes/Pharmacodynamics_Notes.pdf"

# ─────────────────────────────────────────────
# Color palette (handwritten-notebook feel)
# ─────────────────────────────────────────────
PAPER   = colors.HexColor("#FFFDF3")   # cream paper
RULED   = colors.HexColor("#D6E4F0")   # light blue rule lines
TITLE_C = colors.HexColor("#1A3C5E")   # deep navy
HEAD1_C = colors.HexColor("#C0392B")   # red heading
HEAD2_C = colors.HexColor("#1A6B3E")   # dark green
HEAD3_C = colors.HexColor("#7D3C98")   # purple sub-heading
BOX_C   = colors.HexColor("#EAF2FF")   # pale blue box fill
BOX_B   = colors.HexColor("#2980B9")   # box border blue
NOTE_C  = colors.HexColor("#FFF3CD")   # yellow note box
NOTE_B  = colors.HexColor("#E67E22")   # orange note border
FLOW_C  = colors.HexColor("#D5F5E3")   # green flowchart fill
FLOW_B  = colors.HexColor("#1E8449")   # green flowchart border
TBL_H   = colors.HexColor("#2C3E50")   # table header bg
TBL_H_F = colors.white
TBL_A   = colors.HexColor("#EBF5FB")   # alternate row
TBL_B   = colors.white
MNEM_C  = colors.HexColor("#FDEDEC")   # mnemonic fill
MNEM_B  = colors.HexColor("#C0392B")

# ─────────────────────────────────────────────
# Styles
# ─────────────────────────────────────────────
def make_styles():
    s = {}
    base = getSampleStyleSheet()["Normal"]

    s["title"] = ParagraphStyle("title",
        fontName="Helvetica-Bold", fontSize=22, textColor=TITLE_C,
        spaceAfter=4, spaceBefore=6, alignment=TA_CENTER,
        leading=26)

    s["subtitle"] = ParagraphStyle("subtitle",
        fontName="Helvetica-BoldOblique", fontSize=13, textColor=HEAD2_C,
        spaceAfter=2, spaceBefore=2, alignment=TA_CENTER)

    s["head1"] = ParagraphStyle("head1",
        fontName="Helvetica-Bold", fontSize=15, textColor=HEAD1_C,
        spaceBefore=14, spaceAfter=4, leading=18,
        borderPad=4, borderWidth=0, borderColor=HEAD1_C)

    s["head2"] = ParagraphStyle("head2",
        fontName="Helvetica-Bold", fontSize=12, textColor=HEAD2_C,
        spaceBefore=10, spaceAfter=3, leading=15)

    s["head3"] = ParagraphStyle("head3",
        fontName="Helvetica-BoldOblique", fontSize=11, textColor=HEAD3_C,
        spaceBefore=7, spaceAfter=2, leading=13)

    s["body"] = ParagraphStyle("body",
        fontName="Helvetica", fontSize=10, textColor=colors.HexColor("#2C2C2C"),
        spaceAfter=4, spaceBefore=2, leading=15, alignment=TA_JUSTIFY)

    s["bullet"] = ParagraphStyle("bullet",
        fontName="Helvetica", fontSize=10, textColor=colors.HexColor("#2C2C2C"),
        spaceAfter=2, spaceBefore=1, leading=14,
        leftIndent=16, bulletIndent=0)

    s["subbullet"] = ParagraphStyle("subbullet",
        fontName="Helvetica", fontSize=9.5, textColor=colors.HexColor("#2C2C2C"),
        spaceAfter=2, spaceBefore=1, leading=13,
        leftIndent=32, bulletIndent=16)

    s["note"] = ParagraphStyle("note",
        fontName="Helvetica-Oblique", fontSize=9.5, textColor=colors.HexColor("#7B241C"),
        spaceAfter=2, spaceBefore=2, leading=13, leftIndent=6)

    s["flow"] = ParagraphStyle("flow",
        fontName="Helvetica", fontSize=9.5, textColor=colors.HexColor("#145A32"),
        spaceAfter=2, spaceBefore=2, leading=13, alignment=TA_CENTER)

    s["formula"] = ParagraphStyle("formula",
        fontName="Helvetica-Bold", fontSize=11, textColor=colors.HexColor("#1A3C5E"),
        spaceAfter=4, spaceBefore=4, alignment=TA_CENTER,
        backColor=BOX_C, borderPad=6)

    s["mnem"] = ParagraphStyle("mnem",
        fontName="Helvetica-Bold", fontSize=11, textColor=MNEM_B,
        spaceAfter=2, spaceBefore=2, alignment=TA_CENTER)

    s["tbl_hdr"] = ParagraphStyle("tbl_hdr",
        fontName="Helvetica-Bold", fontSize=9.5, textColor=TBL_H_F,
        alignment=TA_CENTER, leading=12)

    s["tbl_cell"] = ParagraphStyle("tbl_cell",
        fontName="Helvetica", fontSize=9, textColor=colors.black,
        alignment=TA_LEFT, leading=12, leftIndent=2)

    s["page_title"] = ParagraphStyle("page_title",
        fontName="Helvetica-Bold", fontSize=18, textColor=TITLE_C,
        spaceBefore=0, spaceAfter=8, alignment=TA_CENTER,
        borderWidth=2, borderColor=TITLE_C, borderPad=8,
        backColor=colors.HexColor("#EBF5FB"))

    return s

# ─────────────────────────────────────────────
# Helper: colored box
# ─────────────────────────────────────────────
def box(content_rows, fill=BOX_C, border=BOX_B, style=None):
    """Wrap list of Paragraphs in a colored 1-cell table."""
    inner = [r for r in content_rows]
    t = Table([[inner]], colWidths=[17.5*cm])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), fill),
        ("BOX", (0,0), (-1,-1), 1.2, border),
        ("TOPPADDING", (0,0), (-1,-1), 6),
        ("BOTTOMPADDING", (0,0), (-1,-1), 6),
        ("LEFTPADDING", (0,0), (-1,-1), 8),
        ("RIGHTPADDING", (0,0), (-1,-1), 8),
        ("VALIGN", (0,0), (-1,-1), "TOP"),
    ]))
    return t

def note_box(text, s):
    inner = [Paragraph("πŸ“ " + text, s["note"])]
    return box(inner, fill=NOTE_C, border=NOTE_B)

def mnem_box(text, s):
    inner = [Paragraph("πŸ”‘ MNEMONIC: " + text, s["mnem"])]
    return box(inner, fill=MNEM_C, border=MNEM_B)

def flow_box(steps, s, arrows=True):
    """Vertical flowchart."""
    rows = []
    for i, step in enumerate(steps):
        rows.append([Paragraph(step, s["flow"])])
        if arrows and i < len(steps)-1:
            rows.append([Paragraph("↓", s["flow"])])
    t = Table(rows, colWidths=[14*cm])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), FLOW_C),
        ("BOX", (0,0), (-1,-1), 1.2, FLOW_B),
        ("LINEBELOW", (0,0), (-1,-2), 0.5, FLOW_B),
        ("ALIGN", (0,0), (-1,-1), "CENTER"),
        ("TOPPADDING", (0,0), (-1,-1), 4),
        ("BOTTOMPADDING", (0,0), (-1,-1), 4),
    ]))
    return t

def data_table(headers, rows, s, col_widths=None):
    data = [[Paragraph(h, s["tbl_hdr"]) for h in headers]]
    for i, row in enumerate(rows):
        data.append([Paragraph(str(c), s["tbl_cell"]) for c in row])
    if col_widths is None:
        w = 17.5*cm / len(headers)
        col_widths = [w]*len(headers)
    t = Table(data, colWidths=col_widths, repeatRows=1)
    style = [
        ("BACKGROUND", (0,0), (-1,0), TBL_H),
        ("TEXTCOLOR", (0,0), (-1,0), TBL_H_F),
        ("GRID", (0,0), (-1,-1), 0.6, colors.HexColor("#BDC3C7")),
        ("ROWBACKGROUNDS", (0,1), (-1,-1), [TBL_A, TBL_B]),
        ("VALIGN", (0,0), (-1,-1), "MIDDLE"),
        ("TOPPADDING", (0,0), (-1,-1), 4),
        ("BOTTOMPADDING", (0,0), (-1,-1), 4),
        ("LEFTPADDING", (0,0), (-1,-1), 5),
        ("RIGHTPADDING", (0,0), (-1,-1), 5),
    ]
    t.setStyle(TableStyle(style))
    return t

def hr(color=HEAD1_C):
    return HRFlowable(width="100%", thickness=1.5, color=color, spaceAfter=4, spaceBefore=2)

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

# ─────────────────────────────────────────────
# Build document
# ─────────────────────────────────────────────
def build():
    doc = SimpleDocTemplate(
        OUTPUT,
        pagesize=A4,
        leftMargin=2*cm, rightMargin=2*cm,
        topMargin=2.2*cm, bottomMargin=2.2*cm,
        title="Pharmacodynamics - Handwritten Notes",
        author="Orris AI"
    )
    s = make_styles()
    story = []

    # ══════════════════════════════════════════
    # COVER PAGE
    # ══════════════════════════════════════════
    story += [
        sp(60),
        Paragraph("PHARMACODYNAMICS", s["title"]),
        Paragraph("General Pharmacology β€” Shanbhag", s["subtitle"]),
        sp(6),
        hr(HEAD2_C),
        sp(4),
        Paragraph("Detailed Handwritten-Style Notes", s["subtitle"]),
        sp(8),
        box([
            Paragraph("πŸ“š Topics Covered:", s["head2"]),
            sp(4),
            Paragraph("1. Types of Drug Effects", s["bullet"]),
            Paragraph("2. Mechanism of Drug Action", s["bullet"]),
            Paragraph("3. Receptor Families & GPCR Signalling", s["bullet"]),
            Paragraph("4. Dose-Response Relationships", s["bullet"]),
            Paragraph("5. Combined Effect of Drugs (Synergism / Antagonism)", s["bullet"]),
            Paragraph("6. Factors Modifying Drug Action", s["bullet"]),
            Paragraph("7. Drug Interactions", s["bullet"]),
            Paragraph("8. Adverse Drug Reactions (ADR)", s["bullet"]),
            Paragraph("9. Drug Dependence & Tolerance", s["bullet"]),
            Paragraph("10. Teratogenicity, Pharmacovigilance", s["bullet"]),
            Paragraph("11. Treatment of Poisoning", s["bullet"]),
        ]),
        PageBreak(),
    ]

    # ══════════════════════════════════════════
    # PAGE 1 β€” PHARMACODYNAMICS INTRO + TYPES OF EFFECTS
    # ══════════════════════════════════════════
    story += [
        Paragraph("1. PHARMACODYNAMICS", s["page_title"]),
        sp(4),
        box([
            Paragraph("<b>Definition:</b> Greek β€” <i>pharmacon</i> (drug) + <i>dynamis</i> (power)", s["body"]),
            Paragraph("Study of what the drug does to the body β€” mechanism of action, pharmacological actions, and adverse effects.", s["body"]),
        ]),
        sp(8),
        Paragraph("TYPES OF EFFECTS OF A DRUG", s["head1"]),
        hr(),
        sp(4),
    ]

    effects_data = [
        ["Type", "Mechanism", "Example"],
        ["1. Stimulation", "Increases activity of specific organ/system", "Adrenaline β†’ ↑ HR & force of contraction"],
        ["2. Depression", "Decreases activity of specific organ/system", "Alcohol, barbiturates β†’ CNS depression"],
        ["3. Irritation", "Causes irritation of skin/tissues on topical application", "Eucalyptus oil, methyl salicylate (counter-irritants) β€” used in sprains, joint pain"],
        ["4. Cytotoxic", "Selectively toxic to infecting organism / cancer cells", "Antibiotics, anticancer drugs"],
        ["5. Replacement", "Replaces deficient endogenous substances", "Insulin (DM), Thyroxine (hypothyroidism)"],
    ]
    story.append(data_table(effects_data[0], effects_data[1:], s, [3.5*cm, 7*cm, 7*cm]))
    story.append(sp(6))
    story.append(note_box("Irritants act by: (a) Reflexly increasing local circulation in deeper structures  (b) Blocking impulse conduction in spinal cord", s))
    story.append(sp(10))
    story.append(PageBreak())

    # ══════════════════════════════════════════
    # PAGE 2 β€” MECHANISM OF DRUG ACTION
    # ══════════════════════════════════════════
    story += [
        Paragraph("2. MECHANISM OF DRUG ACTION", s["page_title"]),
        sp(6),
        flow_box([
            "Mechanism of Action of Drugs",
            "NON-RECEPTOR MEDIATED  |  RECEPTOR MEDIATED"
        ], s, arrows=False),
        sp(10),
        Paragraph("A. NON-RECEPTOR MEDIATED MECHANISMS", s["head1"]),
        hr(),
        sp(4),
        Paragraph("1. By Physical Action", s["head2"]),
    ]

    phys_data = [
        ["Mechanism", "Drug", "Use"],
        ["Osmosis", "20% Mannitol", "Cerebral oedema, Acute congestive glaucoma"],
        ["Adsorption", "Activated charcoal", "Drug poisoning treatment"],
        ["Demulcent", "Cough syrup (coats mucosa)", "Pharyngitis soothing"],
        ["Radioactivity", "ΒΉΒ³ΒΉI (Iodine-131)", "Hyperthyroidism β€” destroys thyroid tissue"],
    ]
    story.append(data_table(phys_data[0], phys_data[1:], s, [4*cm, 5*cm, 8.5*cm]))
    story.append(sp(8))

    story.append(Paragraph("2. By Chemical Action", s["head2"]))
    chem = [
        Paragraph("a. <b>Antacids</b> (weak bases) β†’ neutralize gastric acid β†’ used in <b>peptic ulcer</b>", s["bullet"]),
        Paragraph("b. <b>Chelating agents</b> (dimercaprol/BAL, desferrioxamine, d-penicillamine) β†’ trap metals β†’ form water-soluble complexes β†’ excreted", s["bullet"]),
        Paragraph("   β€’ BAL β†’ arsenic poisoning  |  Desferrioxamine β†’ iron poisoning  |  d-Penicillamine β†’ copper poisoning", s["subbullet"]),
    ]
    story.append(box(chem))
    story.append(sp(8))

    story.append(Paragraph("3. Through Enzymes", s["head2"]))
    enz = [
        Paragraph("a. <b>ACE Inhibitors</b> (Captopril, Enalapril) β†’ inhibit ACE β†’ used in hypertension, CHF", s["bullet"]),
        Paragraph("b. <b>Allopurinol</b> β†’ inhibits Xanthine Oxidase β†’ ↓ uric acid β†’ used in chronic gout", s["bullet"]),
    ]
    story.append(box(enz))
    story.append(sp(4))
    story.append(flow_box([
        "Xanthine  β†’  Hypoxanthine  β†’  Uric Acid",
        "(via Xanthine Oxidase)",
        "βŠ— Allopurinol BLOCKS this enzyme"
    ], s))
    story.append(sp(8))

    other_mech = [
        ["Mechanism", "Drug / Example"],
        ["4. Ion Channels", "Local anaesthetics β†’ block Na⁺ channels β†’ produce local anaesthesia"],
        ["5. Antibody Production", "Vaccines (BCG, oral polio) β†’ stimulate IgE/Ab production β†’ immunity"],
        ["6. Transporters", "SSRIs β†’ bind 5-HT transporter β†’ block 5-HT reuptake β†’ antidepressant"],
        ["7. Others", "Colchicine β†’ binds tubulin β†’ ↓ neutrophil migration β†’ used in acute gout"],
    ]
    story.append(data_table(other_mech[0], other_mech[1:], s, [4.5*cm, 13*cm]))
    story.append(sp(8))
    story.append(PageBreak())

    # ══════════════════════════════════════════
    # PAGE 3 β€” RECEPTOR MEDIATED MECHANISM
    # ══════════════════════════════════════════
    story += [
        Paragraph("3. RECEPTOR-MEDIATED MECHANISM", s["page_title"]),
        sp(6),
        box([
            Paragraph("<b>Receptors:</b> Macromolecules on cell surface, cytoplasm, or nucleus. Drug binds β†’ cellular response.", s["body"]),
            sp(2),
            Paragraph("<b>Drug (D) + Receptor (R) β‡Œ Drug-Receptor Complex β†’ Response</b>", s["formula"]),
        ]),
        sp(6),
    ]

    story += [
        Paragraph("KEY TERMS", s["head1"]),
        hr(),
        sp(4),
    ]

    terms_data = [
        ["Term", "Definition", "Example"],
        ["Affinity", "Ability of drug to bind to receptor", "High affinity = binds strongly"],
        ["Intrinsic Activity", "Ability to produce pharmacological action after binding", "Morphine has high intrinsic activity"],
        ["Agonist", "Has affinity + high intrinsic activity β†’ produces full response", "Morphine, Adrenaline"],
        ["Antagonist", "Has affinity, NO intrinsic activity β†’ blocks receptor", "Naloxone, Atropine"],
        ["Partial Agonist", "Has affinity + LESS intrinsic activity β†’ partial response", "Pindolol, Buprenorphine"],
        ["Inverse Agonist", "Affinity + intrinsic activity between 0 and -1 β†’ OPPOSITE effect", "Ξ²-Carboline at BZD receptor β†’ anxiety"],
        ["Competitive Antagonist", "High affinity, no intrinsic activity β†’ receptor blockade (reversible)", "Naloxone, Atropine"],
        ["Partial Agonist", "Less effect than full agonist; inhibits full agonist effect", "Pindolol, Buprenorphine"],
    ]
    story.append(data_table(terms_data[0], terms_data[1:], s, [4*cm, 8*cm, 5.5*cm]))
    story.append(sp(10))

    story += [
        Paragraph("RECEPTOR FAMILIES (Table 1.5)", s["head1"]),
        hr(),
        sp(4),
    ]

    rec_data = [
        ["Feature", "Ligand-Gated Ion Channels\n(Ionotropic)", "G-Protein Coupled\n(GPCRs / Metabotropic)", "Enzymatic\nReceptors", "Nuclear\nReceptors"],
        ["Location", "Membrane", "Membrane", "Membrane", "Intracellular"],
        ["Effector", "Ion channel", "Channel or enzyme", "Enzyme", "Gene transcription"],
        ["Examples", "Nicotinic, GABA_A, Glutamate", "Muscarinic, Adrenergic, M₁", "Insulin, EGF receptors", "Steroid, Thyroid hormone"],
        ["Response Time", "Milliseconds (fastest!)", "Seconds", "Minutes to hours", "Hours (slowest)"],
    ]
    story.append(data_table(rec_data[0], rec_data[1:], s, [3*cm, 4*cm, 4.5*cm, 3.5*cm, 2.5*cm]))
    story.append(sp(8))

    story += [
        Paragraph("GPCR SIGNALLING PATHWAY", s["head2"]),
        sp(4),
        flow_box([
            "Agonist binds GPCR β†’ G-protein couples to receptor",
            "GDP bound to Ξ± subunit exchanges with GTP",
            "G-protein dissociates; Ξ±-GTP + Ξ²Ξ³ subunits released",
            "Bind to target enzyme / ion channel",
            "Effect depends on G-protein type (Gs, Gi, Gq, Ξ²Ξ³)",
            "GTPase stimulated β†’ GTP β†’ GDP  β†’ Ξ± rejoins Ξ²Ξ³"
        ], s),
        sp(6),
    ]

    gpcr_data = [
        ["G-Protein Type", "Effect on Effector", "Result", "Example Receptor"],
        ["Gs (stimulatory)", "↑ Adenylyl cyclase", "↑↑ cAMP", "Ξ²-Adrenergic receptors"],
        ["Gi (inhibitory)", "↓ Adenylyl cyclase", "↓↓ cAMP", "Ξ±β‚‚-Adrenergic, Mβ‚‚"],
        ["Gq", "↑ Phospholipase C", "↑ IP₃ + ↑ DAG", "Muscarinic M₁, α₁"],
        ["Ξ²Ξ³ subunit", "Enzymes + ion channels", "Various", "All GPCRs"],
    ]
    story.append(data_table(gpcr_data[0], gpcr_data[1:], s, [3.5*cm, 5*cm, 3.5*cm, 5.5*cm]))
    story.append(sp(6))
    story.append(note_box("Second messengers: cAMP, cGMP, Ca²⁺, IP₃, DAG, NO. The agonist = first messenger.", s))
    story.append(sp(10))
    story.append(PageBreak())

    # ══════════════════════════════════════════
    # PAGE 4 β€” REGULATION OF RECEPTORS
    # ══════════════════════════════════════════
    story += [
        Paragraph("REGULATION OF RECEPTORS", s["page_title"]),
        sp(6),
    ]

    reg_data = [
        ["Receptor DOWNREGULATION", "Receptor UPREGULATION"],
        ["Prolonged use of AGONISTS\n↓\n↓↓ Receptor number & sensitivity\n↓\n↓↓ Drug effect\n\nEg: Chronic salbutamol use β†’ downregulates Ξ²β‚‚ receptors β†’ reduced effect in asthma",
         "Prolonged use of ANTAGONISTS\n↓\n↑↑ Receptor number & sensitivity\n↓\n↑↑ Response to agonist on stopping\n\nEg: Stopping propranolol abruptly β†’ Ξ²β‚‚ supersensitivity β†’ angina, tachycardia, MI risk"],
    ]
    t = Table([[Paragraph(reg_data[0][0], s["tbl_hdr"]), Paragraph(reg_data[0][1], s["tbl_hdr"])],
               [Paragraph(reg_data[1][0], s["body"]), Paragraph(reg_data[1][1], s["body"])]],
              colWidths=[8.75*cm, 8.75*cm])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,0), TBL_H),
        ("TEXTCOLOR", (0,0), (-1,0), TBL_H_F),
        ("BACKGROUND", (0,1), (0,1), colors.HexColor("#FDEDEC")),
        ("BACKGROUND", (1,1), (1,1), colors.HexColor("#EAF4FB")),
        ("GRID", (0,0), (-1,-1), 1, colors.HexColor("#BDC3C7")),
        ("VALIGN", (0,0), (-1,-1), "TOP"),
        ("TOPPADDING", (0,0), (-1,-1), 6),
        ("BOTTOMPADDING", (0,0), (-1,-1), 6),
        ("LEFTPADDING", (0,0), (-1,-1), 6),
    ]))
    story.append(t)
    story.append(sp(8))
    story.append(note_box("CLINICAL PEARL: Propranolol should NEVER be stopped abruptly due to rebound upregulation of Ξ² receptors β†’ risk of MI.", s))
    story.append(sp(10))
    story.append(PageBreak())

    # ══════════════════════════════════════════
    # PAGE 5 β€” DOSE RESPONSE RELATIONSHIP
    # ══════════════════════════════════════════
    story += [
        Paragraph("4. DOSE-RESPONSE RELATIONSHIP", s["page_title"]),
        sp(6),
        box([
            Paragraph("The pharmacological effect depends on <b>concentration at the site of action</b>, which depends on the <b>dose administered</b>.", s["body"]),
        ]),
        sp(8),
        Paragraph("TYPES OF DOSE-RESPONSE CURVES", s["head1"]),
        hr(),
        sp(4),
    ]

    drc_data = [
        ["Type", "Description", "Graph Shape"],
        ["1. Graded DRC", "Plotted on graph = rectangular hyperbola; Log DRC = sigmoid (S-shaped)", "S-shaped sigmoid curve"],
        ["2. Quantal DRC", "Effects that CANNOT be quantified β€” only present or absent (all-or-none)\nEg: drug causing ovulation", "Bell-shaped / normal distribution"],
    ]
    story.append(data_table(drc_data[0], drc_data[1:], s, [3.5*cm, 9*cm, 5*cm]))
    story.append(sp(8))

    story.append(Paragraph("THERAPEUTIC INDEX (TI)", s["head2"]))
    story.append(sp(4))
    story.append(box([
        Paragraph("<b>TI = LDβ‚…β‚€ / EDβ‚…β‚€</b>", s["formula"]),
        sp(4),
        Paragraph("β€’ <b>LDβ‚…β‚€</b> = Median Lethal Dose (lethal to 50% of population)", s["bullet"]),
        Paragraph("β€’ <b>EDβ‚…β‚€</b> = Median Effective Dose (produces desired effect in 50%)", s["bullet"]),
        Paragraph("β€’ Higher TI = SAFER drug  (eg Penicillin G = very high TI)", s["bullet"]),
        Paragraph("β€’ <b>Narrow TI drugs</b> (require monitoring!): Digoxin, Lithium, Phenytoin, Aminoglycosides, Warfarin", s["bullet"]),
    ]))
    story.append(sp(8))

    story.append(Paragraph("DRUG POTENCY vs DRUG EFFICACY", s["head2"]))
    story.append(sp(4))

    pe_data = [
        ["Concept", "Definition", "Example"],
        ["Potency", "Amount of drug required for a given response β€” LOWER dose needed = MORE potent", "Morphine (10mg) > Pethidine (100mg) as analgesic β€” Morphine is 10Γ— more potent"],
        ["Efficacy", "MAXIMUM effect a drug can produce", "Morphine is more efficacious than Aspirin as analgesic (produces greater max pain relief)"],
        ["Therapeutic Range", "Range of concentration that produces desired response with minimal toxicity", "Aim to keep drug level within this range clinically"],
    ]
    story.append(data_table(pe_data[0], pe_data[1:], s, [3*cm, 8.5*cm, 6*cm]))
    story.append(sp(10))
    story.append(PageBreak())

    # ══════════════════════════════════════════
    # PAGE 6 β€” COMBINED EFFECTS OF DRUGS
    # ══════════════════════════════════════════
    story += [
        Paragraph("5. COMBINED EFFECT OF DRUGS", s["page_title"]),
        sp(6),
        Paragraph("INCREASED RESPONSE", s["head1"]),
        hr(HEAD2_C),
        sp(4),
    ]

    inc_data = [
        ["Type", "Definition", "Formula", "Example"],
        ["1. Additive", "Combined effect = sum of individual effects", "A + B = A alone + B alone", "Ibuprofen + Paracetamol as analgesics"],
        ["2. Potentiation\n(Supra-additive)", "One INACTIVE drug enhances effect of active drug", "A + B > A + B individually", "Levodopa + Carbidopa\nAcetylcholine + Physostigmine\n(Carbidopa inhibits levodopa breakdown β†’ ↑ L-DOPA effect)"],
        ["3. Synergism", "Both drugs active; combined > either alone", "A + B > A alone or B alone", "Sulphamethoxazole + Trimethoprim (Co-trimoxazole)\nPyrimethamine + Sulphadoxine"],
    ]
    story.append(data_table(inc_data[0], inc_data[1:], s, [3*cm, 5*cm, 4.5*cm, 5*cm]))
    story.append(sp(8))

    story += [
        Paragraph("DECREASED RESPONSE (DRUG ANTAGONISM)", s["head1"]),
        hr(HEAD1_C),
        sp(4),
    ]

    ant_data = [
        ["Type", "Mechanism", "Example"],
        ["1. Physical Antagonism", "Opposing action due to physical property", "Activated charcoal adsorbs alkaloids β†’ alkaloid poisoning"],
        ["2. Chemical Antagonism", "Opposing chemical action", "Antacids neutralize gastric acid (peptic ulcer);\nDimercaprol in heavy metal poisoning"],
        ["3. Physiological\n(Functional)", "Act on different receptors/mechanisms on SAME system β†’ opposing effects", "Insulin vs glucagon (blood sugar)\nAdrenaline vs histamine (bronchial muscle)\nAdrenaline reverses anaphylactic bronchoconstriction"],
        ["4. Receptor Antagonism\na. Competitive\n(Equilibrium type)", "BOTH agonist & antagonist bind SAME site on receptor REVERSIBLY. Can be overcome by ↑ agonist dose. DRC shows RIGHTWARD PARALLEL SHIFT (no change in max effect).", "Acetylcholine β†’ Muscarinic ← Atropine\nMorphine β†’ Opioid receptor ← Naloxone"],
        ["4b. Non-competitive", "Antagonist binds DIFFERENT site; prevents agonist from interacting. CANNOT be overcome by increasing agonist.\nDRC shows DOWNWARD FLATTENING (↓ max effect).", "Diazepam, Bicuculline"],
        ["Nonequilibrium\nAntagonism", "Binds SAME site as agonist but IRREVERSIBLY (strong covalent bond). Cannot be overcome.", "Phenoxybenzamine β†’ irreversible Ξ± blocker"],
    ]
    story.append(data_table(ant_data[0], ant_data[1:], s, [3.5*cm, 8*cm, 6*cm]))
    story.append(sp(6))
    story.append(note_box("KEY: Competitive β†’ parallel rightward shift of DRC (Emax unchanged). Non-competitive β†’ flattened DRC (Emax reduced).", s))
    story.append(sp(10))
    story.append(PageBreak())

    # ══════════════════════════════════════════
    # PAGE 7 β€” FACTORS MODIFYING DRUG ACTION
    # ══════════════════════════════════════════
    story += [
        Paragraph("6. FACTORS MODIFYING DRUG ACTION", s["page_title"]),
        sp(6),
    ]

    factors_data = [
        ["DRUG FACTORS", "PATIENT FACTORS"],
        ["β€’ Route of administration\nβ€’ Presence of other drugs\nβ€’ Cumulation",
         "β€’ Age\nβ€’ Body weight & BSA\nβ€’ Sex\nβ€’ Environment\nβ€’ Genetic factors\nβ€’ Psychological factor\nβ€’ Pathological state\nβ€’ Tolerance\nβ€’ Drug dependence"],
    ]
    t2 = Table([[Paragraph(factors_data[0][0], s["tbl_hdr"]), Paragraph(factors_data[0][1], s["tbl_hdr"])],
                [Paragraph(factors_data[1][0], s["body"]), Paragraph(factors_data[1][1], s["body"])]],
               colWidths=[8.75*cm, 8.75*cm])
    t2.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,0), TBL_H),
        ("TEXTCOLOR", (0,0), (-1,0), TBL_H_F),
        ("BACKGROUND", (0,1), (0,1), BOX_C),
        ("BACKGROUND", (1,1), (1,1), FLOW_C),
        ("GRID", (0,0), (-1,-1), 1, colors.HexColor("#BDC3C7")),
        ("VALIGN", (0,0), (-1,-1), "TOP"),
        ("TOPPADDING", (0,0), (-1,-1), 6),
        ("BOTTOMPADDING", (0,0), (-1,-1), 6),
        ("LEFTPADDING", (0,0), (-1,-1), 6),
    ]))
    story.append(t2)
    story.append(sp(8))

    story.append(Paragraph("PATIENT FACTORS β€” DETAILED", s["head1"]))
    story.append(hr())
    story.append(sp(4))

    story.append(Paragraph("1. AGE", s["head2"]))
    age_items = [
        Paragraph("<b>Neonates:</b> Immature liver metabolism + renal excretion β†’ Chloramphenicol β†’ Grey Baby Syndrome", s["bullet"]),
        Paragraph("<b>Infants:</b> Excretory function immature β†’ Penicillin G given 12-hourly (vs 6-hourly in adults)", s["bullet"]),
        Paragraph("<b>Elderly:</b> ↓ Renal & hepatic function β†’ ↓ dose needed (eg aminoglycosides)", s["bullet"]),
        Paragraph("<b>Child dose formulas:</b>", s["bullet"]),
        Paragraph("Young's formula: Child dose = (Age / Age+12) Γ— Adult dose", s["formula"]),
        Paragraph("Dilling's formula: Child dose = (Age / 20) Γ— Adult dose", s["formula"]),
    ]
    story.append(box(age_items))
    story.append(sp(6))

    story.append(Paragraph("2. BODY WEIGHT / BSA", s["head2"]))
    story.append(box([
        Paragraph("Dose = (Body weight in kg / 70) Γ— Average adult dose", s["formula"]),
        Paragraph("BSA (Body Surface Area) more accurate for anticancer drugs and a few others.", s["note"]),
    ]))
    story.append(sp(6))

    story.append(Paragraph("3. GENETIC FACTORS", s["head2"]))
    gen_data = [
        ["Genetic Condition", "Drug", "Effect"],
        ["Acute Porphyria (susceptible)", "Barbiturates", "Precipitate acute intermittent porphyria by inducing ALA synthase"],
        ["Malignant Hyperthermia", "Halothane + succinylcholine", "Dangerous ↑ in body temperature"],
        ["Narrow anterior chamber", "Mydriatics (atropine)", "Precipitate acute congestive glaucoma"],
        ["Slow acetylators", "Isoniazid", "Prolonged succinylcholine apnoea, primaquine haemolysis in G6PD deficiency"],
        ["CYP2C9 variant", "Warfarin / Coumarins", "Increased bleeding risk"],
    ]
    story.append(data_table(gen_data[0], gen_data[1:], s, [4.5*cm, 5.5*cm, 7.5*cm]))
    story.append(sp(6))

    story.append(Paragraph("4. TOLERANCE", s["head2"]))
    story.append(sp(4))
    story.append(flow_box([
        "TOLERANCE = Need for LARGER doses to produce the SAME response",
        "NATURAL TOLERANCE β†’ Genetically determined (species/racial)",
        "ACQUIRED TOLERANCE β†’ Develops on repeated exposure",
        "Pharmacokinetic (Dispositional): ↓ drug concentration at site (eg rifampicin β†’ contraceptive failure)",
        "Pharmacodynamic (Functional): ↓ receptor response / downregulation",
        "Cross-tolerance: Related drugs show same tolerance (eg nitrates)",
        "Tachyphylaxis: RAPID tolerance with SHORT interval doses (eg ephedrine, tyramine, amphetamine)"
    ], s))
    story.append(sp(10))
    story.append(PageBreak())

    # ══════════════════════════════════════════
    # PAGE 8 β€” DRUG INTERACTIONS
    # ══════════════════════════════════════════
    story += [
        Paragraph("7. DRUG INTERACTIONS", s["page_title"]),
        sp(6),
        flow_box(["Drug Interactions", "IN VITRO (outside body)  |  IN VIVO (inside body)",
                  "Pharmacokinetic Interactions  |  Pharmacodynamic Interactions"], s, arrows=False),
        sp(8),
        Paragraph("A. PHARMACEUTICAL INTERACTIONS", s["head2"]),
    ]

    pharma_items = [
        Paragraph("Occur due to <b>physical/chemical incompatibility</b> when two drugs are mixed in same syringe/IV.", s["body"]),
        Paragraph("β€’ Phenytoin <b>precipitates</b> in dextrose solution β†’ give in saline", s["bullet"]),
        Paragraph("β€’ Dextrose solution unsuitable for i.v. ampicillin (unstable at acidic pH)", s["bullet"]),
        Paragraph("β€’ Gentamicin + carbenicillin in same infusion β†’ loss of potency", s["bullet"]),
    ]
    story.append(box(pharma_items))
    story.append(sp(6))

    story.append(Paragraph("B. PHARMACOKINETIC INTERACTIONS", s["head2"]))
    pk_data = [
        ["Stage", "Mechanism", "Example"],
        ["Absorption", "Antacids (Al, Mg, Ca) form insoluble complexes with tetracyclines β†’ ↓ absorption\nMetoclopramide ↑ gastric emptying β†’ ↑ aspirin absorption", "Al-antacid + Tetracycline β†’ ↓ tetracycline level"],
        ["Distribution", "Displacement from plasma proteins β†’ ↑ free (active) drug\nDrug with higher affinity displaces the other", "Salicylates displace warfarin β†’ ↑ free warfarin β†’ ↑ bleeding risk"],
        ["Metabolism", "Enzyme INDUCTION β†’ ↑ metabolism of another drug\nEnzyme INHIBITION β†’ ↓ metabolism β†’ ↑ toxicity", "Rifampicin induces CYP β†’ ↓ warfarin/OCP effect\nErythromycin inhibits CYP β†’ ↑ carbamazepine toxicity"],
        ["Excretion", "Competition for active tubular secretion in kidneys", "Probenecid ↓ renal secretion of penicillin β†’ prolongs penicillin action\nSalicylates ↑ methotrexate toxicity"],
    ]
    story.append(data_table(pk_data[0], pk_data[1:], s, [2.5*cm, 8*cm, 7*cm]))
    story.append(sp(6))

    story.append(Paragraph("C. PHARMACODYNAMIC INTERACTIONS", s["head2"]))
    story.append(box([
        Paragraph("Due to action of drugs on same receptors or physiological system. May be additive, synergistic, or antagonistic.", s["body"]),
        Paragraph("β€’ HARMFUL eg: Aminoglycosides + Amphotericin B β†’ enhanced nephrotoxicity", s["bullet"]),
        Paragraph("β€’ BENEFICIAL eg: Levodopa + Carbidopa β†’ enhanced anti-Parkinson effect", s["bullet"]),
    ]))
    story.append(sp(10))
    story.append(PageBreak())

    # ══════════════════════════════════════════
    # PAGE 9 β€” ADVERSE DRUG REACTIONS
    # ══════════════════════════════════════════
    story += [
        Paragraph("8. ADVERSE DRUG REACTIONS (ADR)", s["page_title"]),
        sp(4),
        box([
            Paragraph("<b>ADR (WHO):</b> Any response which is <i>noxious, unintended</i>, occurring at doses normally used for prophylaxis/diagnosis/therapy.", s["body"]),
            Paragraph("<b>AE (Adverse Event):</b> Any untoward medical occurrence during treatment β€” may NOT have causal relationship.", s["note"]),
        ]),
        sp(6),
        Paragraph("CLASSIFICATION OF ADVERSE DRUG REACTIONS", s["head1"]),
        hr(),
        sp(4),
    ]

    adr_data = [
        ["Type", "Features", "Examples"],
        ["Type A β€” Predictable\n(Augmented Reactions)", "Related to pharmacological action\nDose-dependent\nPredictable\nIncludes: Side effects, Secondary effects, Toxic effects",
         "β€’ Side effects: Atropine (for heart block) β†’ dry mouth, urinary retention (unwanted actions)\nβ€’ Secondary effects: Corticosteroids β†’ immunosuppression β†’ opportunistic candidiasis\nβ€’ Toxic effects: Anticoagulants β†’ bleeding; Aminoglycosides β†’ nephrotoxicity in renal failure"],
        ["Type B β€” Unpredictable\n(Bizarre Reactions)", "NOT related to pharmacological action\nNot dose-dependent\nIncludes: Allergy, Idiosyncrasy",
         "Drug allergy (immune-mediated)\nIdiosyncrasy (genetically determined abnormal reaction)"],
    ]
    story.append(data_table(adr_data[0], adr_data[1:], s, [3.5*cm, 7*cm, 7*cm]))
    story.append(sp(8))

    story.append(Paragraph("HYPERSENSITIVITY REACTIONS (Drug Allergy)", s["head1"]))
    story.append(hr())
    story.append(sp(4))

    hyp_data = [
        ["Type", "Mechanism", "Manifestations", "Treatment / Examples"],
        ["Type I\n(Immediate/\nAnaphylactic)", "IgE mediated β†’ mast cell release of histamine, 5-HT, PGs, LTs, PAF", "Itching, urticaria, hay fever, asthma,\nANAPHYLACTIC SHOCK",
         "Adrenaline (1:1000) 0.3-0.5 mL IM\nHydrocortisone 100-200 mg IV\nPheniramine 45 mg IM/IV\nAirway maintenance + IV fluids\nDrugs: Penicillin, Aspirin, Lignocaine"],
        ["Type II\n(Cytotoxic)", "IgG & IgM react with cell-bound antigen β†’ complement activation β†’ cell destruction", "Haemolytic anaemia, thrombocytopenia", "Glucocorticoids\nEg: Quinidine, Cephalosporins, Methyldopa"],
        ["Type III\n(Arthus/\nSerum Sickness)", "IgG β†’ AB complexes β†’ complement β†’ vascular endothelium deposition β†’ inflammatory response", "Fever, urticaria, joint pain, lymphadenopathy\nAcute interstitial nephritis, Stevens-Johnson syndrome", "Glucocorticoids\nEg: Penicillins, Sulphonamides, NSAIDs"],
        ["Type IV\n(Delayed/\nCell-mediated)", "Sensitized T lymphocytes β†’ local inflammatory response 1-2 days after re-exposure", "Contact dermatitis", "Glucocorticoids\nEg: Topical anaesthetic creams, antibiotics, antifungals"],
    ]
    story.append(data_table(hyp_data[0], hyp_data[1:], s, [2.5*cm, 5*cm, 4*cm, 6*cm]))
    story.append(sp(6))
    story.append(note_box("Types II, III and IV are treated with glucocorticoids. Type I = Adrenaline (emergency) + antihistamines + steroids.", s))
    story.append(sp(6))

    story.append(Paragraph("ANAPHYLACTIC SHOCK β€” Emergency Protocol", s["head2"]))
    story.append(flow_box([
        "Exposure to sensitizing drug (Penicillin, Aspirin, Lignocaine)",
        "IgE antibody production β†’ fixed on mast cells",
        "Re-exposure β†’ Ag-Ab reaction on mast cell surface",
        "Release of mediators: Histamine, 5-HT, PGs, LTs, PAF",
        "Hypotension, Bronchospasm, Angioedema, Urticaria, Anaphylactic Shock",
        "TREATMENT: Adrenaline (1:1000) 0.3–0.5 mL IM + Hydrocortisone IV + Pheniramine IM/IV + IV fluids"
    ], s))
    story.append(sp(10))
    story.append(PageBreak())

    # ══════════════════════════════════════════
    # PAGE 10 β€” DRUG DEPENDENCE + IDIOSYNCRASY
    # ══════════════════════════════════════════
    story += [
        Paragraph("9. DRUG DEPENDENCE & IDIOSYNCRASY", s["page_title"]),
        sp(6),
        Paragraph("DRUG DEPENDENCE", s["head1"]),
        hr(),
        sp(4),
        box([
            Paragraph("<b>WHO Definition:</b> A state, psychic and sometimes also physical, resulting from the interaction between a living organism and a drug β€” characterised by compulsion to take the drug on a continuous/periodic basis to experience its psychic effects and to avoid discomfort of its absence.", s["body"]),
        ]),
        sp(6),
    ]

    dep_data = [
        ["Type", "Description", "Examples"],
        ["Psychological Dependence", "Intense desire to continue taking the drug; patients feel well-being depends on it", "Opioids, Alcohol, Nicotine, Cannabis"],
        ["Physical Dependence", "Repeated use β†’ physiological changes; continuous presence needed for normal function. Abrupt stop β†’ WITHDRAWAL SYNDROME (signs opposite to drug effects)", "Opioids, Alcohol, Barbiturates, Benzodiazepines"],
    ]
    story.append(data_table(dep_data[0], dep_data[1:], s, [4*cm, 8.5*cm, 5*cm]))
    story.append(sp(6))

    story.append(Paragraph("Treatment of Drug Dependence", s["head2"]))
    story.append(flow_box([
        "1. Hospitalization",
        "2. Substitution Therapy (eg Methadone for morphine/heroin addiction)",
        "3. Aversion Therapy (eg Disulfiram for alcohol addiction)",
        "4. Psychotherapy",
        "5. General Measures: Nutrition, family support, rehabilitation"
    ], s))
    story.append(sp(8))

    story.append(Paragraph("IDIOSYNCRASY", s["head2"]))
    story.append(box([
        Paragraph("Genetically determined <b>abnormal</b> reaction to a drug (not immune-mediated).", s["body"]),
        Paragraph("β€’ Aplastic anaemia with Chloramphenicol", s["bullet"]),
        Paragraph("β€’ Prolonged succinylcholine apnoea (pseudocholinesterase deficiency)", s["bullet"]),
        Paragraph("β€’ Haemolytic anaemia with primaquine / sulphonamides (G6PD deficiency)", s["bullet"]),
    ]))
    story.append(sp(10))

    story.append(Paragraph("TERATOGENICITY", s["head1"]))
    story.append(hr())
    story.append(sp(4))
    story.append(box([
        Paragraph("<b>Definition:</b> Ability of drugs to cause birth defects when given during pregnancy.", s["body"]),
        Paragraph("β€’ Early pregnancy (conception to 16 days): abortion", s["bullet"]),
        Paragraph("β€’ 2-8 weeks: organogenesis β†’ structural abnormalities", s["bullet"]),
        Paragraph("β€’ 2nd/3rd trimester: growth & developmental effects", s["bullet"]),
    ]))
    story.append(sp(4))

    terat_data = [
        ["Drug", "Teratogenic Effect"],
        ["Thalidomide", "Phocomelia (seal limbs)"],
        ["Tetracyclines", "Yellowish discolouration of teeth"],
        ["Antithyroid drugs", "Fetal goitre"],
        ["Warfarin", "Category X β€” contraindicated (fetal warfarin syndrome)"],
        ["Methotrexate", "Category X β€” contraindicated"],
        ["Alcohol", "Fetal alcohol syndrome"],
        ["Valproate", "Neural tube defects"],
    ]
    story.append(data_table(terat_data[0], terat_data[1:], s, [8*cm, 9.5*cm]))
    story.append(sp(6))

    story.append(Paragraph("OTHER ADVERSE EFFECTS (Quick Reference)", s["head2"]))
    story.append(sp(4))

    tox_data = [
        ["Adverse Effect Type", "Drug Examples"],
        ["Hepatotoxicity", "Isoniazid, Rifampicin, Pyrazinamide, Halothane, Paracetamol"],
        ["Nephrotoxicity (VACATION mnemonic)", "Vancomycin, Aminoglycosides, Cisplatin, Amphotericin B, Tetracyclines (Fanconi), Indinavir, gold salts, Nystatin"],
        ["Ototoxicity", "Aminoglycosides, Loop diuretics (furosemide), Cisplatin"],
        ["Photosensitivity", "Sulphonamides (photoallergy β€” immune), Doxycycline, Tetracycline (phototoxic)"],
        ["Ocular Toxicity", "Ethambutol, Chloroquine, Glucocorticoids"],
        ["Carcinogenicity/Mutagenicity", "Anticancer drugs, Oestrogens"],
        ["Iatrogenic Diseases", "Parkinsonism (metoclopramide), Acute gastritis/peptic ulcer (NSAIDs)"],
    ]
    story.append(data_table(tox_data[0], tox_data[1:], s, [5*cm, 12.5*cm]))
    story.append(sp(4))
    story.append(mnem_box("VACATION = Vancomycin, Aminoglycosides, Cisplatin, Amphotericin B, Tetracyclines, Indinavir, gold salts (Auranofin), Nystatin (nephrotoxic drugs)", s))
    story.append(sp(10))
    story.append(PageBreak())

    # ══════════════════════════════════════════
    # PAGE 11 β€” PHARMACOVIGILANCE + TREATMENT OF POISONING
    # ══════════════════════════════════════════
    story += [
        Paragraph("10. PHARMACOVIGILANCE", s["page_title"]),
        sp(6),
        box([
            Paragraph("<b>Pharmacovigilance (WHO):</b> The science and activities relating to <i>detection, assessment, understanding and prevention of adverse effects or any other possible drug-related problems</i>.", s["body"]),
            sp(2),
            Paragraph("Aims: Improve patient safety, promote rational use of medicines, develop regulations for drug use, educate health care professionals about ADRs.", s["body"]),
            sp(2),
            Paragraph("β€’ Causality assessment tools: <b>Naranjo's scale</b> and <b>WHO scale</b>", s["bullet"]),
            Paragraph("β€’ National Pharmacovigilance Centre: <b>Ghaziabad</b>", s["bullet"]),
            Paragraph("β€’ International Centre: <b>Uppsala Monitoring Centre, Sweden</b>", s["bullet"]),
            Paragraph("β€’ Any health professional (doctor, nurse, pharmacist) can report suspected ADRs. Patients can also report.", s["bullet"]),
        ]),
        sp(10),
        Paragraph("11. TREATMENT OF POISONING", s["page_title"]),
        sp(6),
        Paragraph("GENERAL MANAGEMENT (Mnemonic: A to H)", s["head1"]),
        hr(),
        sp(4),
    ]

    story.append(flow_box([
        "A β€” Airway: Clear airway. Coma β†’ turn left lateral. Cuffed ETT + regular aspiration",
        "B β€” Breathing: Oβ‚‚ if hypoxic. Mechanical ventilation if respiratory insufficiency",
        "C β€” Circulation: Monitor pulse & BP. Set up IV line",
        "D β€” Decontamination: Prevent further absorption of poison",
        "E β€” Elimination: Promote elimination of absorbed drug",
        "F β€” Fluid & Electrolyte Balance: Treat hypo/hypernatraemia, hypo/hyperkalaemia",
        "G β€” Gastric Lavage (if ingested, within 2-3 hrs, patient conscious or intubated)",
        "H β€” Hospitalization + Symptomatic treatment"
    ], s))
    story.append(sp(6))

    story.append(Paragraph("DECONTAMINATION METHODS", s["head2"]))
    story.append(sp(4))
    decon_data = [
        ["Poison Type", "Method"],
        ["Inhaled (gases)", "Move to fresh air immediately"],
        ["Contact (skin)", "Remove contaminated clothes, wash with soap & water"],
        ["Ingested", "Gastric lavage (normal saline) within 2-3 hrs. Activated charcoal (adsorbs poisons). Laxatives (Mg sulphate/citrate). Contraindications to lavage: corrosives, petroleum products, convulsions (except carbolic acid)"],
    ]
    story.append(data_table(decon_data[0], decon_data[1:], s, [3.5*cm, 14*cm]))
    story.append(sp(6))

    story.append(Paragraph("ELIMINATION OF ABSORBED POISON", s["head2"]))
    story.append(box([
        Paragraph("β€’ <b>Diuretics</b> (mannitol/furosemide) β†’ forced diuresis", s["bullet"]),
        Paragraph("β€’ <b>Alkalinize urine</b> (sodium bicarbonate) β†’ ↑ excretion of acidic drugs (salicylates)", s["bullet"]),
        Paragraph("β€’ <b>Acidify urine</b> (ammonium chloride) β†’ ↑ excretion of basic drugs (amphetamines)", s["bullet"]),
        Paragraph("β€’ <b>Dialysis</b>: Severe poisoning β€” lithium, aspirin, methanol, ethylene glycol", s["bullet"]),
        Paragraph("β€’ <b>IV Diazepam</b> 5-10 mg if convulsions; External cooling for hyperpyrexia", s["bullet"]),
    ]))
    story.append(sp(6))

    story.append(Paragraph("SPECIFIC ANTIDOTES (Table 1.9)", s["head2"]))
    story.append(sp(4))
    antidotes = [
        ["Poison", "Antidote"],
        ["Alkalies", "Dilute acetic acid (vinegar)"],
        ["Organophosphorus compounds", "Atropine (+ Pralidoxime/PAM for reactivation)"],
        ["Morphine / Opioids", "Naloxone"],
        ["Atropine", "Physostigmine"],
        ["Benzodiazepines", "Flumazenil"],
        ["Carbamates", "Atropine"],
        ["Cyanide", "Sodium nitrite + Sodium thiosulphate"],
        ["Methanol", "Fomepizole, Ethyl alcohol"],
        ["Paracetamol", "N-Acetylcysteine (NAC)"],
        ["Heparin", "Protamine sulphate"],
        ["Warfarin", "Vitamin K (Phytonadione)"],
        ["Iron compounds", "Desferrioxamine"],
        ["Heavy metals (arsenic)", "Dimercaprol (BAL)"],
        ["Copper poisoning", "D-Penicillamine"],
        ["Iron poisoning", "Desferrioxamine"],
        ["Digoxin", "Digoxin-specific Fab antibody fragments"],
    ]
    story.append(data_table(antidotes[0], antidotes[1:], s, [8.75*cm, 8.75*cm]))
    story.append(sp(6))

    story.append(Paragraph("RATIONAL USE OF MEDICINES (WHO)", s["head1"]))
    story.append(hr())
    story.append(sp(4))
    story.append(box([
        Paragraph("<b>WHO Definition:</b> Patients receive medications appropriate to their clinical needs, in doses that meet their own individual requirements, for adequate period, at lowest cost to them and their community.", s["body"]),
        sp(4),
        Paragraph("<b>Rational Prescribing Steps:</b>", s["head3"]),
        Paragraph("1. Make a diagnosis", s["bullet"]),
        Paragraph("2. Define the problem", s["bullet"]),
        Paragraph("3. Set therapeutic goals (relief/cure/prophylaxis)", s["bullet"]),
        Paragraph("4. Select right drug β€” appropriate route, dose, duration. Write complete prescription.", s["bullet"]),
        Paragraph("5. Give proper instructions & information", s["bullet"]),
        Paragraph("6. Monitor therapy", s["bullet"]),
        sp(4),
        Paragraph("<b>Examples of Irrational Prescribing:</b>", s["head3"]),
        Paragraph("β€’ Antibiotics for viral infections (unnecessary use)", s["bullet"]),
        Paragraph("β€’ Not prescribing ORS in acute diarrhoea (underuse)", s["bullet"]),
        Paragraph("β€’ Wrong drug / wrong dose / wrong route selection", s["bullet"]),
        Paragraph("β€’ Drugs with doubtful efficacy (eg appetite stimulants)", s["bullet"]),
        Paragraph("β€’ Polypharmacy, prescribing banned drugs (eg cisapride)", s["bullet"]),
        sp(4),
        Paragraph("<b>Hazards of Irrational Use:</b>", s["head3"]),
        Paragraph("Therapeutic failure | ↑ ADRs | Drug resistance | ↑ cost | Financial burden | Loss of patient trust", s["body"]),
    ]))
    story.append(sp(10))
    story.append(PageBreak())

    # ══════════════════════════════════════════
    # QUICK REVISION PAGE
    # ══════════════════════════════════════════
    story += [
        Paragraph("QUICK REVISION TABLES", s["page_title"]),
        sp(6),
        Paragraph("IMPORTANT DRUG-RECEPTOR PAIRS", s["head2"]),
        sp(4),
    ]
    dr_data = [
        ["Drug", "Receptor/Target", "Effect"],
        ["Morphine", "Opioid receptor (agonist)", "Analgesia, euphoria, respiratory depression"],
        ["Naloxone", "Opioid receptor (competitive antagonist)", "Reverses opioid effects"],
        ["Atropine", "Muscarinic receptor (competitive antagonist)", "Tachycardia, dry mouth, mydriasis"],
        ["Salbutamol", "Ξ²β‚‚-adrenergic (agonist)", "Bronchodilation"],
        ["Propranolol", "Ξ² receptor (competitive antagonist)", "↓ HR, BP; used in angina, hypertension"],
        ["Diazepam", "GABA-A (non-competitive at BZD site)", "Anxiolytic, anticonvulsant, muscle relaxant"],
        ["Insulin", "Tyrosine kinase receptor (enzymatic)", "↓ Blood glucose"],
        ["Prednisolone", "Glucocorticoid receptor (nuclear)", "Anti-inflammatory, immunosuppressive"],
        ["Captopril", "ACE enzyme inhibitor", "↓ BP, used in hypertension, heart failure"],
        ["Allopurinol", "Xanthine oxidase inhibitor", "↓ Uric acid, used in gout"],
        ["Pindolol", "Ξ² receptor (partial agonist)", "Less bradycardia than propranolol"],
        ["Buprenorphine", "Opioid receptor (partial agonist)", "Used in opioid dependence"],
    ]
    story.append(data_table(dr_data[0], dr_data[1:], s, [4*cm, 6.5*cm, 7*cm]))
    story.append(sp(8))

    story.append(Paragraph("NARROW THERAPEUTIC INDEX DRUGS (need TDM)", s["head2"]))
    story.append(sp(4))
    story.append(mnem_box("WANTS = Warfarin, Aminoglycosides, Lithium, Theophylline, Phenytoin (and Digoxin)", s))
    story.append(sp(6))

    ntm_data = [
        ["Drug", "TI Issue"],
        ["Digoxin", "Narrow TI β€” monitor levels; toxicity: arrhythmias, yellow vision"],
        ["Lithium", "Narrow TI β€” monitor levels; toxicity: tremor, seizures, renal damage"],
        ["Phenytoin", "Narrow TI; toxicity: nystagmus, ataxia, gingival hyperplasia"],
        ["Aminoglycosides", "Narrow TI; toxicity: nephrotoxicity + ototoxicity (esp. with renal failure)"],
        ["Warfarin", "Narrow TI; monitor INR; many drug & food interactions"],
        ["Theophylline", "Narrow TI; toxicity: tachycardia, arrhythmias, seizures"],
    ]
    story.append(data_table(ntm_data[0], ntm_data[1:], s, [4*cm, 13.5*cm]))

    # Build
    doc.build(story)
    print(f"PDF saved: {OUTPUT}")
    print(f"File size: {os.path.getsize(OUTPUT)//1024} KB")

build()
Running Command

cd /home/daytona/workspace/pharmacodynamics-notes && python3 make_notes.py

Running Command

python3 -c " from reportlab.lib.pagesizes import A4 import subprocess # Check pa…

Your handwritten-style notes PDF is ready! πŸŽ‰

πŸ“„ Download Your Notes

Pharmacodynamics Notes

PDF Document Β· PDF


What's Inside (19 pages, fully detailed):

SectionTopics
Cover PageAll topics listed with visual layout
Page 1Types of Drug Effects (Stimulation, Depression, Irritation, Cytotoxic, Replacement) β€” color table
Pages 2-3Mechanism of Drug Action β€” Non-receptor (Physical, Chemical, Enzymes, Ion channels, Transporters) + flowcharts
Pages 3-4Receptor-Mediated Mechanisms β€” Key terms (Agonist, Antagonist, Partial Agonist, Inverse Agonist), all 4 Receptor Families table, GPCR signalling flowchart
Page 4Regulation of Receptors β€” Downregulation vs Upregulation comparison table
Page 5Dose-Response Relationships β€” Graded vs Quantal DRC, TI formula, Potency vs Efficacy
Page 6Combined Drug Effects β€” Additive, Potentiation, Synergism; all 4 types of Antagonism with DRC patterns
Pages 7Factors Modifying Drug Action β€” Drug factors + Patient factors; Age formulas (Young's, Dilling's), Genetic factors table, Tolerance flowchart
Page 8Drug Interactions β€” Pharmaceutical, Pharmacokinetic (ADME), Pharmacodynamic with examples
Pages 9ADR classification, all 4 Hypersensitivity types table, Anaphylactic Shock protocol flowchart
Page 10Drug Dependence, Idiosyncrasy, Teratogenicity table, Organ toxicity quick table + VACATION mnemonic
Page 11Pharmacovigilance, Treatment of Poisoning (A to H mnemonic flowchart), Antidotes table
Final PageQuick Revision β€” Important drug-receptor pairs, Narrow TI drugs (WANTS mnemonic)

Design Features:

  • Cream paper background with color-coded sections (red headings, green flowcharts, blue boxes, yellow notes)
  • Flowcharts for GPCR pathway, Anaphylaxis, Poisoning management, Tolerance
  • Color tables for every topic
  • Mnemonics boxed in red (VACATION, WANTS)
  • Clinical pearls highlighted in yellow boxes
attachment
attachment

Make it into hand written notes on excretion in table format of one renal table covering all renal points in one table and other second table covering other factors

Running Command

ls /home/daytona/workspace/pharmacodynamics-notes/

Writing File

~/pharmacodynamics-notes/make_excretion.py

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

OUTPUT = "/home/daytona/workspace/pharmacodynamics-notes/Drug_Excretion_Notes.pdf"

# ── Palette ──────────────────────────────────────────
PAPER   = colors.HexColor("#FFFDF3")
TITLE_C = colors.HexColor("#1A3C5E")
HEAD1_C = colors.HexColor("#C0392B")
HEAD2_C = colors.HexColor("#1A6B3E")
HEAD3_C = colors.HexColor("#7D3C98")
BOX_C   = colors.HexColor("#EAF2FF")
BOX_B   = colors.HexColor("#2980B9")
NOTE_C  = colors.HexColor("#FFF3CD")
NOTE_B  = colors.HexColor("#E67E22")
TBL_H   = colors.HexColor("#1A3C5E")
TBL_H_F = colors.white
TBL_ROW1= colors.HexColor("#EBF5FB")
TBL_ROW2= colors.HexColor("#FDFEFE")
RENAL_H = colors.HexColor("#1A6B3E")   # deep green for renal header
OTHER_H = colors.HexColor("#6C3483")   # purple for other routes header
ACCENT1 = colors.HexColor("#D5F5E3")   # light green row
ACCENT2 = colors.HexColor("#EAF2FF")   # light blue row

# ── Styles ────────────────────────────────────────────
def S():
    s = {}
    s["page_title"] = ParagraphStyle("page_title",
        fontName="Helvetica-Bold", fontSize=20, textColor=TITLE_C,
        spaceBefore=0, spaceAfter=6, alignment=TA_CENTER,
        borderWidth=2, borderColor=TITLE_C, borderPad=8,
        backColor=colors.HexColor("#EBF5FB"), leading=24)

    s["section_title"] = ParagraphStyle("section_title",
        fontName="Helvetica-Bold", fontSize=14, textColor=colors.white,
        spaceBefore=0, spaceAfter=0, alignment=TA_CENTER,
        backColor=RENAL_H, borderPad=8, leading=18)

    s["section_title2"] = ParagraphStyle("section_title2",
        fontName="Helvetica-Bold", fontSize=14, textColor=colors.white,
        spaceBefore=0, spaceAfter=0, alignment=TA_CENTER,
        backColor=OTHER_H, borderPad=8, leading=18)

    s["col_hdr_green"] = ParagraphStyle("col_hdr_green",
        fontName="Helvetica-Bold", fontSize=10, textColor=colors.white,
        alignment=TA_CENTER, leading=13, backColor=RENAL_H)

    s["col_hdr_purple"] = ParagraphStyle("col_hdr_purple",
        fontName="Helvetica-Bold", fontSize=10, textColor=colors.white,
        alignment=TA_CENTER, leading=13, backColor=OTHER_H)

    s["cell"] = ParagraphStyle("cell",
        fontName="Helvetica", fontSize=9.5, textColor=colors.HexColor("#2C2C2C"),
        alignment=TA_LEFT, leading=13, leftIndent=2)

    s["cell_bold"] = ParagraphStyle("cell_bold",
        fontName="Helvetica-Bold", fontSize=9.5, textColor=colors.HexColor("#1A3C5E"),
        alignment=TA_LEFT, leading=13, leftIndent=2)

    s["cell_center"] = ParagraphStyle("cell_center",
        fontName="Helvetica", fontSize=9.5, textColor=colors.HexColor("#2C2C2C"),
        alignment=TA_CENTER, leading=13)

    s["formula"] = ParagraphStyle("formula",
        fontName="Helvetica-Bold", fontSize=11, textColor=colors.HexColor("#1A3C5E"),
        spaceAfter=6, spaceBefore=6, alignment=TA_CENTER,
        backColor=BOX_C, borderPad=6, leading=16)

    s["note"] = ParagraphStyle("note",
        fontName="Helvetica-Oblique", fontSize=9.5, textColor=colors.HexColor("#7B241C"),
        spaceAfter=2, spaceBefore=2, leading=13, leftIndent=6)

    s["body"] = ParagraphStyle("body",
        fontName="Helvetica", fontSize=10, textColor=colors.HexColor("#2C2C2C"),
        spaceAfter=4, spaceBefore=2, leading=15, alignment=TA_JUSTIFY)

    s["subtitle"] = ParagraphStyle("subtitle",
        fontName="Helvetica-BoldOblique", fontSize=11, textColor=HEAD2_C,
        spaceAfter=2, spaceBefore=2, alignment=TA_CENTER)

    return s

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

def hr(c=HEAD1_C):
    return HRFlowable(width="100%", thickness=1.5, color=c, spaceAfter=4, spaceBefore=2)

def note_box(text, s):
    t = Table([[Paragraph("πŸ“  " + text, s["note"])]], colWidths=[17.5*cm])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), NOTE_C),
        ("BOX", (0,0), (-1,-1), 1.2, NOTE_B),
        ("TOPPADDING", (0,0), (-1,-1), 6),
        ("BOTTOMPADDING", (0,0), (-1,-1), 6),
        ("LEFTPADDING", (0,0), (-1,-1), 8),
    ]))
    return t

def key_box(text, s):
    t = Table([[Paragraph("πŸ”‘  " + text, s["cell_bold"])]], colWidths=[17.5*cm])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), colors.HexColor("#FDEDEC")),
        ("BOX", (0,0), (-1,-1), 1.5, HEAD1_C),
        ("TOPPADDING", (0,0), (-1,-1), 7),
        ("BOTTOMPADDING", (0,0), (-1,-1), 7),
        ("LEFTPADDING", (0,0), (-1,-1), 10),
    ]))
    return t

def build():
    doc = SimpleDocTemplate(
        OUTPUT,
        pagesize=A4,
        leftMargin=1.8*cm, rightMargin=1.8*cm,
        topMargin=1.8*cm, bottomMargin=1.8*cm,
        title="Drug Excretion - Handwritten Notes",
    )
    s = S()
    story = []

    # ══════════════════════════════════════════
    # TITLE
    # ══════════════════════════════════════════
    story += [
        Paragraph("DRUG EXCRETION", s["page_title"]),
        sp(2),
        Paragraph("Pharmacokinetics β€” Shanbhag Pharmacology", s["subtitle"]),
        sp(4),
        hr(HEAD2_C),
        sp(4),
        note_box("Definition: Removal of the drug and its metabolites from the body is known as drug excretion.  The main channel = KIDNEY.  Others = Lungs, Bile, Faeces, Sweat, Saliva, Tears, Milk, etc.", s),
        sp(6),
    ]

    # ──────────────────────────────────────────────────────
    # FORMULA ROW
    # ──────────────────────────────────────────────────────
    formula_tbl = Table([
        [Paragraph("Rate of Renal Excretion  =  (Rate of Filtration  +  Rate of Secretion)  βˆ’  Rate of Reabsorption", s["formula"])]
    ], colWidths=[17.5*cm])
    formula_tbl.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), BOX_C),
        ("BOX", (0,0), (-1,-1), 1.5, BOX_B),
        ("TOPPADDING", (0,0), (-1,-1), 8),
        ("BOTTOMPADDING", (0,0), (-1,-1), 8),
    ]))
    story += [formula_tbl, sp(10)]

    # ══════════════════════════════════════════
    # TABLE 1 β€” RENAL EXCRETION
    # ══════════════════════════════════════════

    # Header banner
    hdr_banner = Table([
        [Paragraph("TABLE 1 β€” RENAL EXCRETION  (Kidney)", s["section_title"])]
    ], colWidths=[17.5*cm])
    hdr_banner.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), RENAL_H),
        ("TOPPADDING", (0,0), (-1,-1), 8),
        ("BOTTOMPADDING", (0,0), (-1,-1), 8),
        ("LEFTPADDING", (0,0), (-1,-1), 0),
    ]))
    story.append(hdr_banner)

    # Column headers
    col_hdrs = [
        Paragraph("Process", s["col_hdr_green"]),
        Paragraph("Mechanism / How it Works", s["col_hdr_green"]),
        Paragraph("Factors Affecting", s["col_hdr_green"]),
        Paragraph("Key Points / Examples", s["col_hdr_green"]),
        Paragraph("Effect on Excretion", s["col_hdr_green"]),
    ]
    col_w = [2.8*cm, 4.4*cm, 3.5*cm, 4.5*cm, 2.3*cm]

    # Row 1 β€” Glomerular filtration
    r1 = [
        Paragraph("1️⃣  Glomerular\nFiltration", s["cell_bold"]),
        Paragraph(
            "Drugs are filtered from blood at the glomerulus.\n"
            "Passive process β€” no energy required.\n"
            "Drugs pass through glomerular capillary membrane into Bowman's capsule.", s["cell"]),
        Paragraph(
            "β€’ Molecular size (small = filtered more)\n"
            "β€’ GFR (Glomerular Filtration Rate)\n"
            "β€’ Plasma protein binding\n"
            "  (only UNBOUND/FREE drug is filtered)\n"
            "β€’ Highly protein-bound drugs β†’ less filtered", s["cell"]),
        Paragraph(
            "β€’ Extent of filtration ∝ GFR\n"
            "β€’ Extent of filtration ∝ fraction of unbound drug in plasma\n"
            "β€’ Large molecules (proteins, heparin) NOT filtered\n"
            "β€’ In renal failure β†’ ↓ GFR β†’ ↓ excretion β†’ drug accumulates β†’ TOXICITY", s["cell"]),
        Paragraph("↑ EXCRETION\n(facilitates drug removal)", s["cell_center"]),
    ]

    # Row 2 β€” Passive tubular reabsorption
    r2 = [
        Paragraph("2️⃣  Passive\nTubular\nReabsorption", s["cell_bold"]),
        Paragraph(
            "Drugs filtered at glomerulus may be reabsorbed back into blood from the tubular lumen.\n"
            "Passive process β€” follows concentration gradient.\n"
            "Only LIPID SOLUBLE, UNIONIZED drugs are reabsorbed.", s["cell"]),
        Paragraph(
            "β€’ pH of renal tubular fluid\n"
            "  (MOST IMPORTANT FACTOR)\n"
            "β€’ Degree of ionization\n"
            "β€’ Lipid solubility\n\n"
            "Strongly acidic & strongly basic drugs β†’ always ionized β†’ always excreted\n"
            "(pH changes do NOT affect them)", s["cell"]),
        Paragraph(
            "WEAKLY ACIDIC drugs (eg salicylates, barbiturates):\n"
            "β€’ Acidic urine β†’ unionized β†’ reabsorbed (stays in body)\n"
            "β€’ Alkaline urine (NaHCO₃) β†’ ionized β†’ excreted easily\n\n"
            "WEAKLY BASIC drugs (eg morphine, amphetamine):\n"
            "β€’ Alkaline urine β†’ unionized β†’ reabsorbed (stays in body)\n"
            "β€’ Acidic urine (Vitamin C / NHβ‚„Cl) β†’ ionized β†’ excreted easily\n\n"
            "CLINICAL USE:\n"
            "β€’ Salicylate poisoning β†’ alkalinize urine with NaHCO₃\n"
            "β€’ Amphetamine poisoning β†’ acidify urine with NHβ‚„Cl / Vit C", s["cell"]),
        Paragraph("↓ EXCRETION\n(opposes drug removal β€” drug goes back to blood)", s["cell_center"]),
    ]

    # Row 3 β€” Active tubular secretion
    r3 = [
        Paragraph("3️⃣  Active\nTubular\nSecretion", s["cell_bold"]),
        Paragraph(
            "Carrier-mediated active transport of drugs from peritubular blood into tubular lumen.\n"
            "Requires ENERGY (ATP).\n"
            "Transports drugs AGAINST concentration gradient.", s["cell"]),
        Paragraph(
            "β€’ NOT affected by:\n"
            "  - pH of urine\n"
            "  - Plasma protein binding\n\n"
            "β€’ Carrier system is RELATIVELY NONSELECTIVE\n"
            "β€’ Two separate carriers:\n"
            "  - One for ACIDIC drugs\n"
            "  - One for BASIC drugs\n\n"
            "β€’ COMPETITION between drugs with similar physicochemical properties for same carrier", s["cell"]),
        Paragraph(
            "Acidic drugs secreted:\n"
            "Penicillin, Diuretics, Probenecid, Sulphonamides\n\n"
            "Basic drugs secreted:\n"
            "Quinine, Procaine, Morphine\n\n"
            "COMPETITION EXAMPLE:\n"
            "Probenecid competes with PENICILLIN for same carrier\n"
            "β†’ ↓ penicillin secretion\n"
            "β†’ ↑ plasma half-life of penicillin\n"
            "β†’ ↑ duration & effectiveness of penicillin\n"
            "β†’ Used in GONOCOCCAL infections\n\n"
            "Salicylates interfere with methotrexate secretion β†’ ↑ methotrexate TOXICITY", s["cell"]),
        Paragraph("↑ EXCRETION\n(facilitates drug removal)", s["cell_center"]),
    ]

    # Assemble renal table
    renal_data = [col_hdrs, r1, r2, r3]
    renal_tbl = Table(renal_data, colWidths=col_w, repeatRows=1)
    renal_tbl.setStyle(TableStyle([
        # Header row
        ("BACKGROUND", (0,0), (-1,0), RENAL_H),
        ("TEXTCOLOR", (0,0), (-1,0), colors.white),
        # Alternating row colors
        ("BACKGROUND", (0,1), (-1,1), ACCENT1),
        ("BACKGROUND", (0,2), (-1,2), colors.HexColor("#FDFFFE")),
        ("BACKGROUND", (0,3), (-1,3), ACCENT1),
        # Grid
        ("GRID", (0,0), (-1,-1), 0.8, colors.HexColor("#A9DFBF")),
        ("LINEBELOW", (0,0), (-1,0), 1.5, colors.white),
        # Padding
        ("TOPPADDING", (0,0), (-1,-1), 6),
        ("BOTTOMPADDING", (0,0), (-1,-1), 6),
        ("LEFTPADDING", (0,0), (-1,-1), 5),
        ("RIGHTPADDING", (0,0), (-1,-1), 4),
        # Vertical align top
        ("VALIGN", (0,0), (-1,-1), "TOP"),
        # Bold process column
        ("FONTNAME", (0,1), (0,-1), "Helvetica-Bold"),
        ("TEXTCOLOR", (0,1), (0,-1), RENAL_H),
    ]))
    story.append(renal_tbl)
    story.append(sp(6))
    story.append(key_box(
        "pH Trick:  Weakly ACIDIC drugs β†’ alkalize urine to ↑ excretion  |  "
        "Weakly BASIC drugs β†’ acidify urine to ↑ excretion", s))
    story.append(sp(14))

    # ══════════════════════════════════════════
    # TABLE 2 β€” OTHER ROUTES
    # ══════════════════════════════════════════

    hdr_banner2 = Table([
        [Paragraph("TABLE 2 β€” OTHER ROUTES OF EXCRETION", s["section_title2"])]
    ], colWidths=[17.5*cm])
    hdr_banner2.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), OTHER_H),
        ("TOPPADDING", (0,0), (-1,-1), 8),
        ("BOTTOMPADDING", (0,0), (-1,-1), 8),
    ]))
    story.append(hdr_banner2)

    col_hdrs2 = [
        Paragraph("Route", s["col_hdr_purple"]),
        Paragraph("Drugs Excreted", s["col_hdr_purple"]),
        Paragraph("Mechanism / Notes", s["col_hdr_purple"]),
        Paragraph("Clinical Significance", s["col_hdr_purple"]),
    ]
    col_w2 = [2.5*cm, 4.5*cm, 5.5*cm, 5*cm]

    rows2 = [
        # Lungs
        [
            Paragraph("2️⃣  Lungs\n(Pulmonary)", s["cell_bold"]),
            Paragraph("β€’ Alcohol (volatile)\nβ€’ Volatile general anaesthetics:\n  - Ether\n  - Halothane\n  - Isoflurane\n  - Sevoflurane", s["cell"]),
            Paragraph("Volatile/gaseous drugs are excreted via expired air through lungs.\nPassive diffusion across alveolar membrane.", s["cell"]),
            Paragraph("β€’ Breath alcohol test uses this principle (breathalyser)\nβ€’ Rate of excretion depends on respiratory rate & cardiac output\nβ€’ Useful in monitoring anaesthesia depth", s["cell"]),
        ],
        # Faeces
        [
            Paragraph("3️⃣  Faeces", s["cell_bold"]),
            Paragraph("β€’ Purgatives:\n  - Senna\n  - Cascara\nβ€’ Drugs not absorbed from gut\nβ€’ Drugs excreted in bile and NOT reabsorbed", s["cell"]),
            Paragraph("Some drugs excreted directly into intestinal lumen; some via bile and not reabsorbed.\nFaeces also contains unabsorbed oral drugs.", s["cell"]),
            Paragraph("β€’ Minor route for most systemic drugs\nβ€’ Important for purgatives (local action)\nβ€’ Tetracyclines partly excreted in faeces (after biliary excretion)", s["cell"]),
        ],
        # Bile
        [
            Paragraph("4️⃣  Bile\n(Biliary)", s["cell_bold"]),
            Paragraph("β€’ Tetracyclines\nβ€’ Rifampicin\nβ€’ Erythromycin\nβ€’ Chloramphenicol\nβ€’ Digoxin (partially)\nβ€’ Steroids", s["cell"]),
            Paragraph("Drugs excreted in bile β†’ enter intestine β†’ may be:\n(a) Reabsorbed from gut (enterohepatic circulation) β†’ prolongs drug action\n(b) Passed in faeces (small portion)\n\nEnterohepatic circulation: Drug β†’ liver β†’ bile β†’ intestine β†’ reabsorbed β†’ blood β†’ liver (cycle repeats)", s["cell"]),
            Paragraph("β€’ Enterohepatic circulation PROLONGS drug action (eg digoxin, OCP)\nβ€’ Tetracyclines β€” a portion excreted in faeces after biliary excretion\nβ€’ Rifampicin gives orange-red colour to urine & faeces\nβ€’ Cholestyramine can interrupt enterohepatic recirculation (used to ↑ excretion)", s["cell"]),
        ],
        # Skin / Sweat
        [
            Paragraph("5️⃣  Skin\n(Sweat &\nSebaceous\nglands)", s["cell_bold"]),
            Paragraph("β€’ Arsenic\nβ€’ Mercury\nβ€’ Lead\nβ€’ Iodides\nβ€’ Bromides", s["cell"]),
            Paragraph("Heavy metals and certain drugs excreted via sweat glands and sebaceous glands.\nMinor route of excretion.", s["cell"]),
            Paragraph("β€’ Forensic significance for heavy metal poisoning (arsenic, mercury)\nβ€’ Can cause skin reactions / dermatitis\nβ€’ Iodides can cause iodism (acneiform rash)", s["cell"]),
        ],
        # Saliva
        [
            Paragraph("6️⃣  Saliva", s["cell_bold"]),
            Paragraph("β€’ Potassium iodide\nβ€’ Phenytoin\nβ€’ Metronidazole\nβ€’ Lithium\nβ€’ Rifampicin", s["cell"]),
            Paragraph("Certain drugs excreted in saliva, then swallowed and partially reabsorbed from GIT.\nPassive diffusion β€” depends on lipid solubility & ionization.", s["cell"]),
            Paragraph("β€’ Salivary estimation of LITHIUM may be used for non-invasive monitoring of lithium therapy\nβ€’ Metallic taste from some drugs (metronidazole, lithium)\nβ€’ Phenytoin β†’ gingival hyperplasia (salivary exposure)", s["cell"]),
        ],
        # Milk
        [
            Paragraph("7️⃣  Milk\n(Breast milk /\nLactation)", s["cell_bold"]),
            Paragraph("SAFE (can be used):\nβ€’ Penicillins\nβ€’ Erythromycin\nβ€’ Paracetamol\n\nAVOID (harmful to infant):\nβ€’ Amiodarone\nβ€’ Tetracyclines\nβ€’ Chloramphenicol\nβ€’ Methotrexate\nβ€’ Radioactive drugs\nβ€’ Lithium\nβ€’ Antithyroid drugs", s["cell"]),
            Paragraph("Drugs taken by lactating mothers may pass into breast milk.\nLipid soluble, weakly basic, low protein-bound drugs transfer more easily.\nMilk is slightly more acidic than plasma β†’ basic drugs concentrated in milk.", s["cell"]),
            Paragraph("β€’ MUST assess safety before prescribing to breastfeeding mothers\nβ€’ Amiodarone β†’ thyroid toxicity in infant β†’ AVOID\nβ€’ Tetracyclines β†’ tooth discolouration\nβ€’ Chloramphenicol β†’ grey baby syndrome risk\nβ€’ Use Lactmed database for reference\nβ€’ Penicillins, erythromycin = SAFE in breastfeeding", s["cell"]),
        ],
        # Tears
        [
            Paragraph("8️⃣  Tears &\nOther\n(sweat,\ncerumen)", s["cell_bold"]),
            Paragraph("β€’ Rifampicin\nβ€’ Some antibiotics", s["cell"]),
            Paragraph("Minor routes. Rifampicin turns tears, sweat, urine and faeces orange-red.", s["cell"]),
            Paragraph("β€’ Rifampicin discolours contact lenses (orange-red)\nβ€’ Warn patients about orange-red discolouration of body fluids with rifampicin", s["cell"]),
        ],
    ]

    other_data = [col_hdrs2] + rows2
    row_colors = [
        colors.HexColor("#F4ECF7"),  # light purple
        colors.HexColor("#FDFFFE"),
        colors.HexColor("#F4ECF7"),
        colors.HexColor("#FDFFFE"),
        colors.HexColor("#F4ECF7"),
        colors.HexColor("#FDFFFE"),
        colors.HexColor("#F4ECF7"),
    ]

    other_tbl = Table(other_data, colWidths=col_w2, repeatRows=1)
    style2 = [
        ("BACKGROUND", (0,0), (-1,0), OTHER_H),
        ("TEXTCOLOR", (0,0), (-1,0), colors.white),
        ("LINEBELOW", (0,0), (-1,0), 1.5, colors.white),
        ("GRID", (0,0), (-1,-1), 0.8, colors.HexColor("#D2B4DE")),
        ("TOPPADDING", (0,0), (-1,-1), 6),
        ("BOTTOMPADDING", (0,0), (-1,-1), 6),
        ("LEFTPADDING", (0,0), (-1,-1), 5),
        ("RIGHTPADDING", (0,0), (-1,-1), 4),
        ("VALIGN", (0,0), (-1,-1), "TOP"),
        ("FONTNAME", (0,1), (0,-1), "Helvetica-Bold"),
        ("TEXTCOLOR", (0,1), (0,-1), OTHER_H),
    ]
    # Alternating row bg
    for i, rc in enumerate(row_colors):
        style2.append(("BACKGROUND", (0, i+1), (-1, i+1), rc))
    other_tbl.setStyle(TableStyle(style2))
    story.append(other_tbl)
    story.append(sp(8))

    # Final summary note
    summary_data = [
        [
            Paragraph("Route", s["col_hdr_green"]),
            Paragraph("Main Drugs", s["col_hdr_green"]),
            Paragraph("Clinical Tip", s["col_hdr_green"]),
        ],
        [Paragraph("Kidney (urine)", s["cell_bold"]),
         Paragraph("Most water-soluble drugs & metabolites", s["cell"]),
         Paragraph("Monitor renal function for renally-excreted drugs (aminoglycosides, digoxin, lithium)", s["cell"])],
        [Paragraph("Lungs", s["cell_bold"]),
         Paragraph("Volatile anaesthetics, alcohol", s["cell"]),
         Paragraph("Breathalyser test for alcohol", s["cell"])],
        [Paragraph("Bile β†’ Faeces", s["cell_bold"]),
         Paragraph("Tetracyclines, rifampicin, digoxin", s["cell"]),
         Paragraph("Enterohepatic circulation prolongs drug action", s["cell"])],
        [Paragraph("Saliva", s["cell_bold"]),
         Paragraph("Lithium, phenytoin, metronidazole", s["cell"]),
         Paragraph("Saliva used for non-invasive Li monitoring", s["cell"])],
        [Paragraph("Milk", s["cell_bold"]),
         Paragraph("Many drugs β€” check safety", s["cell"]),
         Paragraph("Amiodarone AVOID; Penicillins SAFE", s["cell"])],
        [Paragraph("Skin/Sweat", s["cell_bold"]),
         Paragraph("Heavy metals (arsenic, mercury)", s["cell"]),
         Paragraph("Forensic significance in poisoning", s["cell"])],
    ]

    summary_tbl = Table(summary_data, colWidths=[3.5*cm, 7*cm, 7*cm], repeatRows=1)
    summary_tbl.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,0), TBL_H),
        ("TEXTCOLOR", (0,0), (-1,0), colors.white),
        ("GRID", (0,0), (-1,-1), 0.8, colors.HexColor("#BDC3C7")),
        ("ROWBACKGROUNDS", (0,1), (-1,-1), [TBL_ROW1, TBL_ROW2]),
        ("TOPPADDING", (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
        ("LEFTPADDING", (0,0), (-1,-1), 5),
        ("VALIGN", (0,0), (-1,-1), "TOP"),
        ("FONTNAME", (0,1), (0,-1), "Helvetica-Bold"),
    ]))

    # Summary section header
    summary_banner = Table([
        [Paragraph("πŸ“‹  QUICK SUMMARY β€” All Routes of Drug Excretion", s["section_title"])]
    ], colWidths=[17.5*cm])
    summary_banner.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), TITLE_C),
        ("TOPPADDING", (0,0), (-1,-1), 7),
        ("BOTTOMPADDING", (0,0), (-1,-1), 7),
    ]))
    story += [summary_banner, summary_tbl, sp(8)]

    story.append(note_box(
        "KEY CLINICAL POINTS:  "
        "(1) Renal failure β†’ ↓ drug excretion β†’ reduce doses of renally cleared drugs.  "
        "(2) Alkalinize urine (NaHCO₃) to speed excretion of WEAKLY ACIDIC drugs (salicylates, barbiturates) in poisoning.  "
        "(3) Acidify urine (NHβ‚„Cl / Vit C) to speed excretion of WEAKLY BASIC drugs (amphetamine, morphine).  "
        "(4) Probenecid blocks penicillin secretion β†’ prolongs penicillin half-life (useful in gonorrhoea).  "
        "(5) Rifampicin turns urine, sweat, tears, saliva ORANGE-RED β€” warn the patient!", s))

    doc.build(story)
    print(f"Saved: {OUTPUT}")
    print(f"Size: {os.path.getsize(OUTPUT)//1024} KB")

build()
Running Command

cd /home/daytona/workspace/pharmacodynamics-notes && python3 make_excretion.py

Your Drug Excretion notes are ready! πŸŽ‰

πŸ“„ Download Here

Drug Excretion Notes

PDF Document Β· PDF


What's in the PDF:

Formula Box (top)

Rate of Renal Excretion = (Rate of Filtration + Rate of Secretion) βˆ’ Rate of Reabsorption

🟒 TABLE 1 β€” Renal Excretion (deep green theme)

All 3 renal processes in one single table with 5 columns:
ColumnContent
ProcessGlomerular Filtration / Passive Tubular Reabsorption / Active Tubular Secretion
MechanismHow each process works
Factors AffectingWhat controls each process (pH, GFR, protein binding, etc.)
Key Points / ExamplesClinical examples, probenecid-penicillin interaction, pH trick for poisoning
Effect on ExcretionWhether it increases or decreases excretion

🟣 TABLE 2 β€” Other Routes of Excretion (purple theme)

All 7 other routes in one table: Lungs, Faeces, Bile, Skin, Saliva, Milk, Tears with:
  • Drugs excreted by each route
  • Mechanism/notes
  • Clinical significance (safe in breastfeeding, breathalyser, rifampicin color warning, etc.)

πŸ“‹ Quick Summary Table

Compact one-liner revision for all routes with clinical tips.

πŸ“ Key Clinical Points Box (bottom)

  • Alkalinize urine for acidic drug poisoning (salicylates)
  • Acidify urine for basic drug poisoning (amphetamine)
  • Probenecid blocks penicillin secretion β†’ prolongs action
  • Rifampicin β†’ orange-red body fluids
This is a shared conversation. Sign in to Orris to start your own chat.