mkdir -p /tmp/workspace/pharma-notes && cat > /tmp/workspace/pharma-notes/generate_pdf.py << 'PYEOF'
from reportlab.lib.pagesizes import A4
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import inch, cm
from reportlab.lib import colors
from reportlab.platypus import (SimpleDocTemplate, Paragraph, Spacer, Table,
TableStyle, HRFlowable, PageBreak, KeepTogether)
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_JUSTIFY
OUTPUT = "/tmp/workspace/pharma-notes/Pharmacology_Notes.pdf"
doc = SimpleDocTemplate(
OUTPUT,
pagesize=A4,
rightMargin=1.8*cm,
leftMargin=1.8*cm,
topMargin=2*cm,
bottomMargin=2*cm,
title="Pharmacology Notes",
author="Orris"
)
styles = getSampleStyleSheet()
# Custom styles
title_style = ParagraphStyle('MainTitle', parent=styles['Title'],
fontSize=20, textColor=colors.HexColor('#1a237e'),
spaceAfter=6, alignment=TA_CENTER, fontName='Helvetica-Bold')
subtitle_style = ParagraphStyle('SubTitle', parent=styles['Normal'],
fontSize=10, textColor=colors.HexColor('#5c6bc0'),
spaceAfter=14, alignment=TA_CENTER, fontName='Helvetica')
h1_style = ParagraphStyle('H1', parent=styles['Heading1'],
fontSize=14, textColor=colors.white,
backColor=colors.HexColor('#1a237e'),
fontName='Helvetica-Bold', spaceBefore=14, spaceAfter=6,
leftIndent=-2, rightIndent=-2, leading=18,
borderPad=6)
h2_style = ParagraphStyle('H2', parent=styles['Heading2'],
fontSize=12, textColor=colors.HexColor('#1a237e'),
fontName='Helvetica-Bold', spaceBefore=10, spaceAfter=4,
borderPad=3, leftIndent=0)
h3_style = ParagraphStyle('H3', parent=styles['Heading3'],
fontSize=10.5, textColor=colors.HexColor('#283593'),
fontName='Helvetica-Bold', spaceBefore=7, spaceAfter=3)
body_style = ParagraphStyle('Body', parent=styles['Normal'],
fontSize=9.5, leading=14, spaceAfter=5,
alignment=TA_JUSTIFY, fontName='Helvetica')
bullet_style = ParagraphStyle('Bullet', parent=styles['Normal'],
fontSize=9.5, leading=13, spaceAfter=3,
leftIndent=14, fontName='Helvetica',
bulletIndent=4)
sub_bullet_style = ParagraphStyle('SubBullet', parent=styles['Normal'],
fontSize=9, leading=12, spaceAfter=2,
leftIndent=28, fontName='Helvetica',
bulletIndent=18)
note_style = ParagraphStyle('Note', parent=styles['Normal'],
fontSize=9, leading=12, spaceAfter=4,
fontName='Helvetica-Oblique',
textColor=colors.HexColor('#37474f'),
backColor=colors.HexColor('#f5f5f5'),
borderPad=5, leftIndent=6, rightIndent=6)
TABLE_HEADER = colors.HexColor('#1a237e')
TABLE_ALT = colors.HexColor('#e8eaf6')
TABLE_BORDER = colors.HexColor('#9fa8da')
def make_table(headers, rows, col_widths=None):
data = [headers] + rows
t = Table(data, colWidths=col_widths, repeatRows=1)
style_cmds = [
('BACKGROUND', (0,0), (-1,0), TABLE_HEADER),
('TEXTCOLOR', (0,0), (-1,0), colors.white),
('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
('FONTSIZE', (0,0), (-1,-1), 9),
('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.white, TABLE_ALT]),
('GRID', (0,0), (-1,-1), 0.5, TABLE_BORDER),
('VALIGN', (0,0), (-1,-1), 'TOP'),
('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_cmds))
return t
def B(text): return f"<b>{text}</b>"
def I(text): return f"<i>{text}</i>"
content = []
# ── TITLE PAGE ──────────────────────────────────────────────────────────────
content.append(Spacer(1, 1.5*inch))
content.append(Paragraph("Pharmacology Notes", title_style))
content.append(Paragraph("Comprehensive Review — July 2026", subtitle_style))
content.append(HRFlowable(width="100%", thickness=2, color=colors.HexColor('#1a237e')))
content.append(Spacer(1, 0.2*inch))
toc_items = [
"1. Role of Gut Microbiome in Drug Metabolism",
"2. SNPs (Single Nucleotide Polymorphisms)",
"3. Botulinum Toxin — Mechanism, Uses & Adverse Effects",
"4. Dose Calculation & Drug Administration in Geriatric Population",
"5. Antimuscarinic & Alpha-Adrenergic Drugs in Urogenital System",
"6. Endothelin Inhibitors & 5-HT Agonists",
]
content.append(Paragraph(B("Contents"), h2_style))
for item in toc_items:
content.append(Paragraph(f"• {item}", bullet_style))
content.append(PageBreak())
# ════════════════════════════════════════════════════════════════════════════
# TOPIC 1 — GUT MICROBIOME
# ════════════════════════════════════════════════════════════════════════════
content.append(Paragraph("1. Role of Gut Microbiome in Drug Metabolism", h1_style))
content.append(Spacer(1, 4))
content.append(Paragraph(B("Overview"), h2_style))
content.append(Paragraph(
"The gut microbiome is a prominent contributor to variation in drug response. "
"The relationship is <b>bidirectional</b> — drugs alter the microbiome, and the microbiome in turn alters drug pharmacokinetics and pharmacodynamics. "
"This emerging field is called <b>Pharmacomicrobiomics</b>.",
body_style))
content.append(Paragraph(B("Direct Mechanisms of Microbial Drug Metabolism"), h2_style))
tbl1 = make_table(
[B("Mechanism"), B("Example")],
[
["Direct microbial metabolism (azo reduction)", "Sulfasalazine → gut bacteria cleave azo bond → releases active 5-aminosalicylate (mesalamine) + sulfapyridine"],
["Reductive metabolism", "Digoxin inactivated by Eggerthella lenta (cardiac glycoside reductase)"],
["Hydrolysis of glucuronides", "Beta-glucuronidase reactivates parent drug from conjugated metabolite"],
["Decarboxylation", "Levodopa → dopamine conversion in gut by bacterial tyrosine decarboxylase (reduces CNS delivery)"],
],
col_widths=[5.5*cm, 11*cm]
)
content.append(tbl1)
content.append(Spacer(1, 6))
content.append(Paragraph(B("Indirect Mechanisms"), h2_style))
indirect = [
("Modulation of Phase I/II enzymes", "Gut microbes modify hepatic & intestinal CYP450 (especially CYP3A), UGTs, sulfotransferases. Germ-free animals show markedly altered CYP expression."),
("Modulation of drug transporters", "Affects P-glycoprotein (Pgp/MDR1/ABCB1), OAT, OATP — altering bioavailability of many drugs."),
("Enterohepatic recycling", "Drugs excreted in bile as glucuronide conjugates → deconjugated by bacterial beta-glucuronidase → reabsorbed → prolonged half-life. Key drugs: morphine, ethinylestradiol, irinotecan."),
("Pharmacodynamic interactions", "Microbiome affects immune checkpoint inhibitor (ICI) efficacy. Akkermansia muciniphila enhances anti-PD-1 response."),
]
for title, desc in indirect:
content.append(Paragraph(f"• <b>{title}</b>: {desc}", bullet_style))
content.append(Spacer(1, 6))
content.append(Paragraph(B("Key Clinical Drug-Microbiome Examples"), h2_style))
tbl2 = make_table(
[B("Drug"), B("Microbiome Interaction"), B("Effect")],
[
["Sulfasalazine", "Azo bond cleavage by gut bacteria", "Prodrug → active mesalamine"],
["Irinotecan", "SN-38-glucuronide hydrolyzed in colon by beta-glucuronidase", "Toxic SN-38 reactivated → diarrhea, neutropenia"],
["Digoxin", "Inactivated by E. lenta (cgr pathway)", "Reduced efficacy in ~10% people"],
["Metformin", "Alters gut microbiota composition in T2DM", "Contributes to therapeutic effect"],
["Levodopa", "Bacterial tyrosine decarboxylase converts to dopamine in gut", "Reduced CNS bioavailability"],
["Antibiotics", "Disrupts microbiome diversity and quantity", "Dysbiosis; affects other drug metabolism"],
],
col_widths=[4*cm, 7*cm, 5.5*cm]
)
content.append(tbl2)
content.append(Spacer(1, 6))
content.append(Paragraph(B("Therapeutic Implications"), h2_style))
for pt in [
"<b>Fecal Microbiota Transplantation (FMT)</b>: Restores healthy microbiome; approved for Clostridioides difficile colitis.",
"Prebiotics, probiotics, postbiotics under investigation for IBD, autism, phenylketonuria.",
"Precision medicine: microbiome profiling as a biomarker for drug response.",
"Parenterally administered drugs reaching the gut via biliary secretion also interact with gut microbiota.",
]:
content.append(Paragraph(f"• {pt}", bullet_style))
content.append(PageBreak())
# ════════════════════════════════════════════════════════════════════════════
# TOPIC 2 — SNPs
# ════════════════════════════════════════════════════════════════════════════
content.append(Paragraph("2. Single Nucleotide Polymorphisms (SNPs)", h1_style))
content.append(Spacer(1, 4))
content.append(Paragraph(B("Definition"), h2_style))
content.append(Paragraph(
"An SNP is a <b>variation at a single position (single base/nucleotide) in a DNA sequence</b>. "
"It is the most common type of genetic variation in humans and the foundation of pharmacogenomics. "
"In pharmacogenomics, alleles are reported using <b>star nomenclature</b> (e.g., *1, *4, *17). "
"<b>*1</b> = default (no identified variant). A star allele may represent a single SNP or a group of variations inherited as a <b>haplotype</b>.",
body_style))
content.append(Paragraph(B("Functional Categories"), h2_style))
tbl3 = make_table(
[B("Allele Function"), B("Enzyme Activity"), B("Example Allele (CYP2D6)")],
[
["Increased function", "Greater than normal", "*2xN (gene duplication)"],
["Normal function", "Standard", "*1"],
["Decreased function", "Reduced", "*10, *17"],
["No function", "Complete loss", "*4, *5 (deletion)"],
],
col_widths=[5*cm, 5*cm, 6.5*cm]
)
content.append(tbl3)
content.append(Spacer(1, 6))
content.append(Paragraph(B("Metabolizer Phenotypes"), h2_style))
tbl4 = make_table(
[B("Phenotype"), B("Genetic Basis"), B("Clinical Impact")],
[
["Poor Metabolizer (PM)", "Two no-function alleles", "Drug accumulates → toxicity"],
["Intermediate Metabolizer (IM)", "One no-function + one decreased/normal", "Moderate accumulation"],
["Normal/Extensive (NM/EM)", "Standard combination", "Normal response"],
["Rapid Metabolizer (RM)", "One increased + one normal function", "Faster clearance"],
["Ultrarapid Metabolizer (UM)", "Two increased function or gene duplication", "Drug rapidly cleared → therapeutic failure"],
],
col_widths=[5*cm, 6*cm, 5.5*cm]
)
content.append(tbl4)
content.append(Spacer(1, 6))
content.append(Paragraph(B("Clinically Important SNP-Drug Pairs"), h2_style))
tbl5 = make_table(
[B("Gene"), B("Drug(s) Affected"), B("Clinical Impact")],
[
["CYP2D6", "Codeine, tamoxifen, tricyclics, metoprolol", "PM: codeine accumulates; UM: codeine → morphine toxicity"],
["CYP2C19", "Clopidogrel, omeprazole, SSRIs", "PM: clopidogrel ineffective (prodrug not activated)"],
["CYP2C9", "Warfarin, phenytoin, NSAIDs", "Dose reduction needed in PMs"],
["TPMT", "Azathioprine, 6-mercaptopurine", "PM: severe myelosuppression"],
["DPYD", "5-Fluorouracil, capecitabine", "PM: life-threatening toxicity"],
["HLA-B*5701", "Abacavir (HIV)", "Hypersensitivity reaction — mandatory pre-screening"],
["HLA-B*1502", "Carbamazepine", "Stevens-Johnson syndrome in Asian populations"],
["SLCO1B1", "Statins", "Poor transporter → myopathy risk"],
["UGT1A1*28", "Irinotecan", "PM: increased SN-38 toxicity"],
],
col_widths=[3.5*cm, 6*cm, 7*cm]
)
content.append(tbl5)
content.append(Spacer(1, 6))
content.append(Paragraph(B("Detection Methods"), h2_style))
for m in ["PCR-RFLP (Restriction Fragment Length Polymorphism)",
"Hybridization array-based profiling",
"Genome-Wide Association Studies (GWAS)",
"Whole Exome / Genome Sequencing (WES/WGS)"]:
content.append(Paragraph(f"• {m}", bullet_style))
content.append(PageBreak())
# ════════════════════════════════════════════════════════════════════════════
# TOPIC 3 — BOTULINUM TOXIN
# ════════════════════════════════════════════════════════════════════════════
content.append(Paragraph("3. Botulinum Toxin — Mechanism, Uses & Adverse Effects", h1_style))
content.append(Spacer(1, 4))
content.append(Paragraph(B("Source"), h2_style))
content.append(Paragraph(
"Produced by <b>Clostridium botulinum</b> (anaerobic gram-positive spore-forming bacillus). "
"Seven serotypes: <b>A, B, C1, D, E, F, G</b>. Only types <b>A and B</b> are used clinically.",
body_style))
content.append(Paragraph(B("Mechanism of Action"), h2_style))
moa_steps = [
("1. Binding", "Heavy chain C-terminal domain binds to presynaptic cholinergic nerve terminal receptors (polysialogangliosides + synaptotagmin)."),
("2. Internalization", "Toxin-receptor complex taken into cell by receptor-mediated endocytosis."),
("3. Translocation", "Light chain crosses the endosomal membrane into the cytoplasm."),
("4. SNARE Cleavage", "Light chain is a zinc-dependent metalloprotease that cleaves SNARE proteins:\n• Types A, C, E → cleave SNAP-25\n• Types B, D, F, G → cleave VAMP/synaptobrevin\n• Type C also cleaves syntaxin"),
("5. Result", "Synaptic vesicles cannot dock/fuse with presynaptic membrane → ACh release blocked at NMJ → flaccid paralysis."),
]
for step, desc in moa_steps:
content.append(Paragraph(f"<b>{step}:</b> {desc}", bullet_style))
content.append(Paragraph(
I("BoNT also inhibits release of substance P, noradrenaline, CGRP, and glutamate — explaining its analgesic and autonomic effects. "
"Duration: 3-6 months. Recovery occurs by axonal sprouting and new synapse formation."),
note_style))
content.append(Spacer(1, 6))
content.append(Paragraph(B("Formulations"), h2_style))
tbl6 = make_table(
[B("Trade Name"), B("INN"), B("Type"), B("Notes")],
[
["BOTOX / BOTOX Cosmetic", "OnabotulinumtoxinA", "BoNT-A", "900 kDa complex; prototype"],
["Dysport / Azzalure", "AbobotulinumtoxinA", "BoNT-A", "400 kDa complex"],
["Xeomin / Bocouture", "IncobotulinumtoxinA", "BoNT-A", "150 kDa; free of complexing proteins"],
["DAXXIFY", "DaxibotulinumtoxinA", "BoNT-A", "Longer duration of effect"],
["MYOBLOC / NeuroBloc", "RimabotulinumtoxinB", "BoNT-B", "Type B; lower pH formulation"],
],
col_widths=[4.5*cm, 5*cm, 2.5*cm, 4.5*cm]
)
content.append(tbl6)
content.append(Spacer(1, 6))
content.append(Paragraph(B("Therapeutic Uses"), h2_style))
uses_data = [
("Neurological / Movement Disorders",
["Cervical dystonia (torticollis) — first-line", "Blepharospasm, hemifacial spasm",
"Limb spasticity (stroke, CP, MS)", "Writer's cramp and focal dystonias", "Strabismus"]),
("Cosmetic", ["Glabellar frown lines (FDA-approved)", "Crow's feet, forehead lines",
"Facial contouring (masseter, neck)", "Brow lifting"]),
("Autonomic / Glandular", ["Hyperhidrosis (axillary, palmar, plantar)", "Frey's syndrome (gustatory sweating)",
"Sialorrhoea (drooling)", "Raynaud's phenomenon"]),
("GI / Urological", ["Achalasia (LES injection)", "Chronic anal fissure",
"Overactive bladder / detrusor overactivity", "BPH"]),
("Pain", ["Chronic migraine prophylaxis (BOTOX — FDA approved for ≥15 headache days/month)",
"Neuropathic pain", "Myofascial pain"]),
]
for category, items in uses_data:
content.append(Paragraph(f"<b>{category}</b>", h3_style))
for item in items:
content.append(Paragraph(f" • {item}", sub_bullet_style))
content.append(Paragraph(B("Adverse Effects"), h2_style))
tbl7 = make_table(
[B("Adverse Effect"), B("Notes")],
[
["Eyelid ptosis", "Most common — diffusion to levator palpebrae; esp. glabellar injection"],
["Diplopia", "Spread to extraocular muscles"],
["Bruising/ecchymosis", "At injection site"],
["Dysphagia", "Spread to pharyngeal muscles; esp. cervical dystonia treatment"],
["Flu-like symptoms", "Headache, malaise after injection"],
["Antibody formation (neutralizing)", "Secondary non-response; more with complexing proteins"],
["Dyspnea", "Spread to respiratory muscles (rare, serious)"],
["Urinary retention", "After intravesical injection for OAB"],
["Generalized weakness / botulism symptoms", "Systemic spread; overdose (rare)"],
],
col_widths=[6*cm, 10.5*cm]
)
content.append(tbl7)
content.append(Spacer(1, 4))
content.append(Paragraph(
I("Contraindications: Myasthenia gravis, Lambert-Eaton syndrome, pregnancy, aminoglycoside co-use (potentiates NMJ blockade)."),
note_style))
content.append(PageBreak())
# ════════════════════════════════════════════════════════════════════════════
# TOPIC 4 — GERIATRIC PHARMACOLOGY
# ════════════════════════════════════════════════════════════════════════════
content.append(Paragraph("4. Dose Calculation & Drug Administration in Geriatric Population", h1_style))
content.append(Spacer(1, 4))
content.append(Paragraph(B("Pharmacokinetic Changes with Aging"), h2_style))
pk_data = [
("Absorption", [
"Decreased gastric acid (achlorhydria) → altered ionization of drugs",
"Reduced GI motility and splanchnic blood flow",
"Net effect: usually minor; delayed but not markedly reduced absorption"
]),
("Distribution (Vd)", [
"Decreased total body water → increased plasma concentration of hydrophilic drugs (digoxin, aminoglycosides)",
"Increased body fat → increased Vd of lipophilic drugs (diazepam) → prolonged effect",
"Decreased serum albumin → more free (active) fraction of protein-bound drugs (warfarin, phenytoin)",
"Decreased cardiac output → reduced tissue distribution"
]),
("Metabolism", [
"Decreased liver mass and hepatic blood flow (~40% reduction by age 70)",
"Reduced Phase I (CYP450) reactions > Phase II",
"Increased bioavailability of high-extraction drugs (propranolol, lidocaine, morphine)",
"Phase II (glucuronidation, sulfation) relatively preserved"
]),
("Elimination (Most Important!)", [
"Decreased GFR — serum creatinine may be NORMAL despite low GFR (reduced muscle mass = less creatinine production)",
"Use Cockcroft-Gault formula to estimate CrCl",
"Decreased tubular secretion and reabsorption",
"Renally cleared drugs accumulate → reduce dose or extend interval"
]),
]
for phase, points in pk_data:
content.append(Paragraph(f"<b>{phase}</b>", h3_style))
for pt in points:
content.append(Paragraph(f" • {pt}", sub_bullet_style))
content.append(Paragraph(B("Cockcroft-Gault Formula for CrCl Estimation"), h2_style))
content.append(Paragraph(
"<b>CrCl = [(140 - age) × weight (kg)] / [72 × serum creatinine (mg/dL)]</b><br/>"
"Multiply by <b>0.85 for females</b>.",
note_style))
content.append(Spacer(1, 6))
content.append(Paragraph(B("Pharmacodynamic Changes"), h2_style))
for pt in [
"Increased CNS sensitivity — greater effect of sedatives, opioids, anticholinergics, benzodiazepines per given plasma level",
"Reduced baroreceptor reflex → orthostatic hypotension with antihypertensives",
"Reduced beta-receptor sensitivity → reduced response to beta-agonists and antagonists",
"Impaired thermoregulation",
"Reduced bone marrow reserve",
]:
content.append(Paragraph(f"• {pt}", bullet_style))
content.append(Spacer(1, 6))
content.append(Paragraph(B("Principles of Geriatric Dose Calculation"), h2_style))
content.append(Paragraph(
'<b>"Start low, go slow"</b> — Begin with 25-50% of the standard adult dose. '
'Always estimate renal function (Cockcroft-Gault). Review ALL medications to address polypharmacy. '
'Perform therapeutic drug monitoring (TDM) for narrow therapeutic index drugs.',
body_style))
content.append(Paragraph(B("Beers Criteria — Drugs to Avoid in Elderly"), h2_style))
tbl8 = make_table(
[B("Category"), B("Examples"), B("Risk")],
[
["Long-acting benzodiazepines", "Diazepam, chlordiazepoxide", "Falls, fractures, oversedation"],
["Anticholinergics", "Diphenhydramine, oxybutynin, TCAs", "Confusion, urinary retention, constipation"],
["NSAIDs", "Indomethacin (especially)", "GI bleeding, renal impairment, fluid retention"],
["Muscle relaxants", "Cyclobenzaprine, methocarbamol", "Sedation, anticholinergic effects"],
["Long-acting sulfonylureas", "Glyburide (glibenclamide)", "Prolonged hypoglycemia"],
["Digoxin >0.125 mg/day", "Digoxin", "Toxicity (narrow TI; reduced GFR)"],
["Antipsychotics in dementia", "Haloperidol, risperidone", "Increased stroke risk, mortality"],
],
col_widths=[5*cm, 5.5*cm, 6*cm]
)
content.append(tbl8)
content.append(Spacer(1, 6))
content.append(Paragraph(B("Specific Dose Adjustments"), h2_style))
tbl9 = make_table(
[B("Drug"), B("Adjustment")],
[
["Digoxin", "Reduce dose (0.0625–0.125 mg/day); monitor serum levels"],
["Aminoglycosides", "Extend dosing interval based on CrCl; monitor peaks/troughs"],
["Lithium", "Reduce dose ~30-50%; very narrow therapeutic index"],
["Warfarin", "Highly sensitive; start lower (2.5 mg); monitor INR closely"],
["Morphine/opioids", "Reduce starting dose; titrate slowly; avoid long-acting initially"],
["Metformin", "Avoid if CrCl <30 mL/min; reduce dose if 30-45 mL/min"],
["ACE inhibitors", "Monitor renal function and potassium after initiation"],
["Benzodiazepines", "Use short-acting (lorazepam, oxazepam) if required; avoid long-acting"],
],
col_widths=[4.5*cm, 12*cm]
)
content.append(tbl9)
content.append(PageBreak())
# ════════════════════════════════════════════════════════════════════════════
# TOPIC 5 — ANTIMUSCARINIC & ALPHA-ADRENERGIC IN UROGENITAL
# ════════════════════════════════════════════════════════════════════════════
content.append(Paragraph("5. Antimuscarinic & Alpha-Adrenergic Drugs in the Urogenital System", h1_style))
content.append(Spacer(1, 4))
content.append(Paragraph(B("Autonomic Receptors in Lower Urinary Tract"), h2_style))
tbl10 = make_table(
[B("Location"), B("Receptor"), B("Effect"), B("Drug Target")],
[
["Detrusor muscle", "M2, M3 (parasympathetic)", "Contraction (voiding)", "Antimuscarinics (block)"],
["Detrusor muscle", "Beta-3 (sympathetic)", "Relaxation (storage)", "Mirabegron (stimulate)"],
["Bladder neck / internal sphincter", "Alpha-1 (sympathetic)", "Contraction (storage)", "Alpha-blockers (relax) / Alpha-agonists"],
["Prostate smooth muscle", "Alpha-1A (sympathetic)", "Contraction", "Tamsulosin, silodosin (relax)"],
["External urethral sphincter", "Nicotinic (somatic)", "Contraction (voluntary)", "Botulinum toxin (for dyssynergia)"],
],
col_widths=[4*cm, 4.5*cm, 4*cm, 4*cm]
)
content.append(tbl10)
content.append(Spacer(1, 6))
content.append(Paragraph(B("A. Antimuscarinic Drugs"), h2_style))
content.append(Paragraph(
"<b>Mechanism:</b> Block M2 and M3 muscarinic receptors in detrusor muscle → reduce involuntary contractions → increase bladder capacity.<br/>"
"<b>Primary Use: Overactive Bladder (OAB)</b> — urgency, frequency, nocturia, urge incontinence.",
body_style))
tbl11 = make_table(
[B("Drug"), B("Features")],
[
["Oxybutynin", "Classic drug; also direct smooth muscle relaxant; oral/transdermal/intravesical. High anticholinergic SE profile."],
["Tolterodine", "More bladder-selective than oxybutynin; fewer CNS side effects."],
["Solifenacin", "M3-selective; once daily; good efficacy."],
["Darifenacin", "M3-selective; less CNS penetration — preferred in elderly."],
["Trospium", "Quaternary ammonium; does NOT cross BBB; minimal CNS effects — best for elderly."],
["Fesoterodine", "Prodrug → 5-hydroxymethyl tolterodine."],
],
col_widths=[4*cm, 12.5*cm]
)
content.append(tbl11)
content.append(Spacer(1, 4))
content.append(Paragraph(B("Adverse Effects of Antimuscarinics:"), h3_style))
for ae in ["Dry mouth (most common — M3 in salivary glands)",
"Constipation", "Blurred vision (cycloplegia)", "Urinary retention (paradoxical)",
"Tachycardia (M2 block in heart)",
"Cognitive impairment / confusion (especially in elderly — CNS penetration)",
"Glaucoma exacerbation (angle-closure)"]:
content.append(Paragraph(f"• {ae}", bullet_style))
content.append(Paragraph(
I("Contraindications: Urinary retention, gastric retention, uncontrolled narrow-angle glaucoma, myasthenia gravis.<br/>"
"Note: Mirabegron (beta-3 agonist) is a non-anticholinergic alternative for OAB."),
note_style))
content.append(Spacer(1, 8))
content.append(Paragraph(B("B. Alpha-Adrenergic Drugs"), h2_style))
content.append(Paragraph(B("Alpha-1 Blockers — Primary Use: BPH"), h3_style))
content.append(Paragraph(
"<b>Mechanism:</b> Block alpha-1 receptors in prostate smooth muscle, bladder neck, and proximal urethra "
"→ relax smooth muscle → reduce outflow resistance → improved urine flow.",
body_style))
tbl12 = make_table(
[B("Drug"), B("Selectivity"), B("Notes")],
[
["Tamsulosin", "Alpha-1A selective", "Most bladder/prostate selective; minimal BP drop; first-line for BPH"],
["Silodosin", "Alpha-1A selective", "High uroselectivity; retrograde ejaculation common SE"],
["Alfuzosin", "Alpha-1 (non-subtype)", "Low CNS penetration; good tolerability"],
["Doxazosin", "Alpha-1 (non-selective)", "Also used for hypertension; once daily"],
["Terazosin", "Alpha-1 (non-selective)", "Also used for hypertension"],
["Prazosin", "Alpha-1 (non-selective)", "Short-acting; prominent first-dose hypotension"],
],
col_widths=[3.5*cm, 4.5*cm, 8.5*cm]
)
content.append(tbl12)
content.append(Spacer(1, 4))
content.append(Paragraph(B("Adverse Effects of Alpha-1 Blockers:"), h3_style))
for ae in ["Orthostatic hypotension (esp. non-selective agents; first-dose effect)",
"Dizziness, syncope",
"Nasal congestion (alpha-1 block in nasal mucosa)",
"Intraoperative Floppy Iris Syndrome (IFIS) — warn ophthalmologist before cataract surgery (esp. tamsulosin)",
"Retrograde ejaculation (esp. silodosin)",
"Reflex tachycardia"]:
content.append(Paragraph(f"• {ae}", bullet_style))
content.append(Spacer(1, 4))
content.append(Paragraph(B("Other Urological Uses:"), h3_style))
for use in ["Medical expulsive therapy for ureteral stones (tamsulosin relaxes ureteral SM → facilitates stone passage)",
"Neurogenic bladder dyssynergia",
"Female stress urinary incontinence (limited)"]:
content.append(Paragraph(f"• {use}", bullet_style))
content.append(Paragraph(B("Alpha-1 Agonists in Urogenital System"), h3_style))
tbl13 = make_table(
[B("Drug"), B("Use"), B("Mechanism")],
[
["Midodrine", "Stress urinary incontinence", "Alpha-1 stimulation → increases urethral sphincter tone"],
["Pseudoephedrine", "Mild stress incontinence (historical)", "Alpha-1 agonism"],
],
col_widths=[4*cm, 6.5*cm, 6*cm]
)
content.append(tbl13)
content.append(PageBreak())
# ════════════════════════════════════════════════════════════════════════════
# TOPIC 6 — ENDOTHELIN INHIBITORS + 5-HT AGONISTS
# ════════════════════════════════════════════════════════════════════════════
content.append(Paragraph("6. Endothelin Inhibitors & 5-HT Agonists", h1_style))
content.append(Spacer(1, 4))
# 6A Endothelin
content.append(Paragraph(B("A. Endothelin Receptor Antagonists (ERAs)"), h2_style))
content.append(Paragraph(B("Endothelin System:"), h3_style))
for pt in ["Endothelin-1 (ET-1): Most potent endogenous vasoconstrictor; produced by vascular endothelium",
"ET-A receptors: On smooth muscle → vasoconstriction, proliferation, fibrosis",
"ET-B receptors: On endothelium → vasodilation (via NO and prostacyclin); also on SM (minor vasoconstriction)"]:
content.append(Paragraph(f"• {pt}", bullet_style))
content.append(Paragraph(B("Drugs:"), h3_style))
tbl14 = make_table(
[B("Drug"), B("Selectivity"), B("Route"), B("Notes")],
[
["Bosentan", "Dual (ET-A + ET-B)", "Oral", "First ERA approved; PAH + digital ulcers in systemic sclerosis; CYP3A4/2C9 inducer"],
["Ambrisentan", "ET-A selective", "Oral", "Once daily; less hepatotoxicity; preferred in many guidelines"],
["Macitentan", "Dual", "Oral", "Latest; better tissue penetration; reduces PAH morbidity/mortality"],
],
col_widths=[3.5*cm, 4*cm, 2*cm, 7*cm]
)
content.append(tbl14)
content.append(Spacer(1, 4))
content.append(Paragraph(B("Mechanism:"), h3_style))
content.append(Paragraph(
"Block ET receptors on pulmonary vascular smooth muscle → prevent ET-1-mediated vasoconstriction, smooth muscle proliferation, "
"and vascular remodeling → pulmonary vasodilation + reduced pulmonary vascular resistance (PVR) + improved exercise capacity.",
body_style))
content.append(Paragraph(B("Therapeutic Uses:"), h3_style))
for use in ["Pulmonary Arterial Hypertension (PAH) — WHO Group 1; primary indication. Used alone or with PDE-5 inhibitors (sildenafil) and/or prostacyclins.",
"Digital ulcers in systemic sclerosis (bosentan — reduces number of new ulcers)",
"Portopulmonary hypertension (cautious use)"]:
content.append(Paragraph(f"• {use}", bullet_style))
content.append(Paragraph(B("Adverse Effects:"), h3_style))
tbl15 = make_table(
[B("Adverse Effect"), B("Notes")],
[
["Hepatotoxicity (elevated LFTs)", "Most significant. Monthly LFT monitoring required. Bosentan > ambrisentan."],
["Teratogenicity", "Category X. REMS program mandatory. Two reliable contraceptives required."],
["Peripheral edema / fluid retention", "Common; dose-dependent"],
["Headache, flushing, nasal congestion", "Vasodilatory effects"],
["Anemia (decreased hematocrit)", "Monitor Hb"],
["Drug interactions (bosentan)", "CYP3A4 + CYP2C9 inducer → reduces warfarin, OCPs, statins, cyclosporine efficacy"],
],
col_widths=[5.5*cm, 11*cm]
)
content.append(tbl15)
content.append(Paragraph(
I("Contraindications: Pregnancy, moderate-severe hepatic impairment, cyclosporine co-administration (bosentan)."),
note_style))
content.append(Spacer(1, 10))
# 6B 5-HT Agonists
content.append(Paragraph(B("B. 5-HT (Serotonin) Agonists"), h2_style))
content.append(Paragraph(B("Receptor Subtypes Overview:"), h3_style))
tbl16 = make_table(
[B("Receptor"), B("Location"), B("Effect")],
[
["5-HT1A", "Presynaptic raphe nuclei", "Autoreceptor — inhibits serotonin release"],
["5-HT1B/1D", "Intracranial vessels, trigeminal nerve", "Vasoconstriction; inhibit neuropeptide (CGRP, SP) release"],
["5-HT1F", "Trigeminal neurons", "Pain modulation; NO vasoconstriction"],
["5-HT2A", "Platelets, smooth muscle, brain", "Aggregation, vasoconstriction, hallucinations"],
["5-HT3", "GI tract, area postrema", "Depolarization; nausea/emesis"],
["5-HT4", "GI tract", "Prokinesis; increased GI motility"],
],
col_widths=[3*cm, 5.5*cm, 8*cm]
)
content.append(tbl16)
content.append(Spacer(1, 6))
content.append(Paragraph(B("Class 1 — Triptans (5-HT1B/1D Agonists): Acute Migraine"), h3_style))
content.append(Paragraph(
"<b>Mechanism:</b> (1) Cranial vasoconstriction via 5-HT1B; (2) Inhibit trigeminal nerve firing via 5-HT1D "
"→ reduce release of CGRP and substance P → reduce neurogenic inflammation; (3) Central pain modulation in trigeminal nucleus caudalis.",
body_style))
tbl17 = make_table(
[B("Drug"), B("Route"), B("Notes")],
[
["Sumatriptan", "SC, IN, oral", "First triptan; SC fastest onset; prototype drug"],
["Rizatriptan", "Oral (wafer)", "Fast onset; avoid with propranolol (doubles levels)"],
["Zolmitriptan", "Oral, nasal", "Good CNS penetration"],
["Eletriptan", "Oral", "Longer half-life; fewer recurrences"],
["Naratriptan", "Oral", "Slower onset, longer duration; fewer side effects; menstrual migraine"],
["Almotriptan", "Oral", "Best tolerability profile"],
["Frovatriptan", "Oral", "Longest half-life (~26 h); menstrual migraine prophylaxis"],
],
col_widths=[3.5*cm, 3.5*cm, 9.5*cm]
)
content.append(tbl17)
content.append(Spacer(1, 4))
content.append(Paragraph(B("Adverse Effects of Triptans:"), h3_style))
for ae in ["Chest tightness/pressure ('triptan sensation') — coronary vasospasm risk",
"Tingling/flushing, dizziness, somnolence",
"Medication-overuse headache (rebound) if >10 days/month",
"Serotonin syndrome (especially with SSRIs, SNRIs, MAOIs)",
"Nausea"]:
content.append(Paragraph(f"• {ae}", bullet_style))
content.append(Paragraph(B("Contraindications:"), h3_style))
for ci in ["Ischemic heart disease, Prinzmetal angina",
"Uncontrolled hypertension", "History of stroke/TIA",
"Hemiplegic or basilar migraine",
"MAOIs co-administration", "Severe hepatic impairment"]:
content.append(Paragraph(f"• {ci}", bullet_style))
content.append(Spacer(1, 6))
content.append(Paragraph(B("Class 2 — Lasmiditan (5-HT1F Agonist): 'Ditans'"), h3_style))
content.append(Paragraph(
"Selective 5-HT1F agonist. <b>No vasoconstrictor activity</b> → safe in patients with CV contraindications to triptans. "
"Use: Acute migraine. SE: Dizziness, somnolence (CNS penetrant) — do NOT drive for 8 hours after dose.",
body_style))
content.append(Spacer(1, 4))
content.append(Paragraph(B("Class 3 — Buspirone (5-HT1A Partial Agonist): Anxiolytic"), h3_style))
content.append(Paragraph(
"Partial agonist at presynaptic 5-HT1A autoreceptors → reduces serotonin firing. Also D2 partial antagonist. "
"<b>Uses:</b> Generalized Anxiety Disorder (GAD). <b>Advantages:</b> No dependence/withdrawal, no sedation, no alcohol interaction. "
"<b>Onset: 2-4 weeks</b> — not for acute anxiety. SE: Dizziness, headache, nausea.",
body_style))
content.append(Spacer(1, 4))
content.append(Paragraph(B("Class 4 — 5-HT4 Agonists: Prokinetics"), h3_style))
tbl18 = make_table(
[B("Drug"), B("Use"), B("Notes")],
[
["Metoclopramide", "GI prokinetic; antiemetic", "5-HT4 agonist + D2 antagonist; risk of tardive dyskinesia"],
["Mosapride", "Gastroparesis, GERD", "Selective 5-HT4 agonist; no extrapyramidal effects"],
["Prucalopride", "Chronic constipation", "Selective 5-HT4 agonist; safe; once daily"],
["Cisapride", "(Withdrawn)", "QT prolongation / TdP — withdrawn from market"],
["Tegaserod", "IBS-C in women (restricted)", "5-HT4 partial agonist; cardiovascular concerns"],
],
col_widths=[4*cm, 4.5*cm, 8*cm]
)
content.append(tbl18)
content.append(Spacer(1, 6))
content.append(Paragraph(B("Quick Reference Summary — 5-HT Agonists"), h3_style))
tbl19 = make_table(
[B("Drug Class"), B("Receptor"), B("Clinical Use")],
[
["Triptans", "5-HT1B/1D", "Acute migraine, cluster headache"],
["Lasmiditan", "5-HT1F", "Acute migraine (cardiovascular safe)"],
["Buspirone", "5-HT1A partial agonist", "Generalized Anxiety Disorder"],
["Mosapride, Prucalopride", "5-HT4", "Prokinetic, chronic constipation"],
["Metoclopramide", "5-HT4 + D2 block", "Prokinetic + antiemetic"],
["Ergotamine / DHE", "5-HT1 (non-selective) + others", "Migraine (acute/refractory)"],
],
col_widths=[5*cm, 5.5*cm, 6*cm]
)
content.append(tbl19)
content.append(Spacer(1, 10))
content.append(HRFlowable(width="100%", thickness=1, color=colors.HexColor('#9fa8da')))
content.append(Spacer(1, 6))
content.append(Paragraph(
I("Sources: Goodman & Gilman's The Pharmacological Basis of Therapeutics; "
"Lippincott Illustrated Reviews Pharmacology; Dermatology 5e (Fitzpatrick's); "
"Kaplan & Sadock's Comprehensive Textbook of Psychiatry; Miller's Anesthesia 10e"),
note_style))
# BUILD PDF
doc.build(content)
print("PDF generated:", OUTPUT)
PYEOF
python /tmp/workspace/pharma-notes/generate_pdf.py
show command