Consize it in 15-20 pages for quick revision
cd /home/daytona/workspace/attachments/6b027af5-b8f9-4a6a-b33d-9aa5bc792ae4/ && python3 -c " import pdfplumber with pdfplumber.open('kome-default.pdf') as pdf: print(f'Total pages: {len(pdf.pages)}') # Extract first few pages to understand content for i, page in enumerate(pdf.pages[:5]): text = page.extract_text() if text: print(f'--- PAGE {i+1} ---') print(text[:1000]) print() "
cd /home/daytona/workspace/attachments/6b027af5-b8f9-4a6a-b33d-9aa5bc792ae4/ && python3 -c " import pdfplumber full_text = [] with pdfplumber.open('kome-default.pdf') as pdf: print(f'Total pages: {len(pdf.pages)}') for i, page in enumerate(pdf.pages): text = page.extract_text() if text: full_text.append(f'=== PAGE {i+1} ===\n{text}') combined = '\n\n'.join(full_text) with open('/home/daytona/workspace/pharma_full_text.txt', 'w') as f: f.write(combined) print(f'Extracted {len(full_text)} pages, total chars: {len(combined)}') "
python3 -c " with open('/home/daytona/workspace/pharma_full_text.txt') as f: text = f.read() # Get a sample from different sections to understand structure # Show pages 1, 30, 60, 90, 120, 150, 180, 210, 240, 270 import re pages = re.split(r'=== PAGE \d+ ===', text) print('Total sections:', len(pages)) # Print headings/structure indicators from every 30th page for idx in [1, 30, 60, 90, 120, 150, 180, 210, 240, 260]: if idx < len(pages): print(f'\\n--- SECTION {idx} ---') print(pages[idx][:500]) "
python3 -c " with open('/home/daytona/workspace/pharma_full_text.txt') as f: text = f.read() import re # Find all headings/topic markers lines = text.split('\n') headings = [] for i, line in enumerate(lines): line = line.strip() # Look for SN, LAQ, SAQ, chapter headers if re.match(r'^(SN|LAQ|SAQ|MCQ)\s+\d+', line) or re.match(r'^(CHAPTER|Chapter|\*\*Chapter)', line) or 'PHARMACOLOGY' in line.upper() and len(line) < 100: headings.append(line[:120]) print(f'Total headings found: {len(headings)}') for h in headings[:100]: print(h) "
python3 -c " with open('/home/daytona/workspace/pharma_full_text.txt') as f: text = f.read() import re # Find all unique topic sections - look for chapter/section headers lines = text.split('\n') sections = [] for line in lines: line = line.strip() if re.match(r'^(SN|LAQ|SAQ)\s+\d+', line) or (len(line) > 5 and len(line) < 120 and any(kw in line for kw in ['Chapter', 'CHAPTER', 'Pharmacology', 'PHARMACOLOGY', 'Introduction', 'Pharmacokinetics', 'Pharmacodynamics', 'Autonomic', 'Cardiovascular', 'Haematology', 'Diuretic', 'Antihypertensive', 'Antiarrhythmic', 'Angina', 'CHF', 'Iron', 'Anticoagulant'])): if line not in sections: sections.append(line) print(f'Unique sections: {len(sections)}') for s in sections: print(repr(s[:100])) " 2>&1 | head -200
python3 << 'PYEOF' import re with open('/home/daytona/workspace/pharma_full_text.txt') as f: text = f.read() # Split into pages pages = re.split(r'=== PAGE \d+ ===', text) # Collect all page text (clean up timestamps and noise) all_text = [] for p in pages[1:]: # skip empty first # Remove timestamp lines cleaned = re.sub(r'7/\d+/\d+, \d+:\d+ [AP]M\s*', '', p) cleaned = re.sub(r'\(cid:\d+\)', '->', cleaned) all_text.append(cleaned.strip()) # Join into one big string full = '\n\n'.join(all_text) # Save cleaned version with open('/home/daytona/workspace/pharma_cleaned.txt', 'w') as f: f.write(full) print(f"Cleaned text: {len(full)} chars, approx {len(full.split())} words") PYEOF
python3 -c " with open('/home/daytona/workspace/pharma_cleaned.txt') as f: text = f.read() # Sample 6 representative sections from across the document # Divide into 6 chunks chunk_size = len(text) // 6 for i in range(6): start = i * chunk_size end = start + 3000 print(f'=== CHUNK {i+1} (chars {start}-{end}) ===') print(text[start:end]) print() " 2>&1 | head -400
python3 << 'PYEOF' with open('/home/daytona/workspace/pharma_cleaned.txt') as f: text = f.read() # The document appears duplicated - take only the first half half = len(text) // 2 unique_text = text[:half] # Also sample important sections from different topics # Let's extract key content around different topic areas import re # Find the key topic blocks topics = [ "Routes of Drug Administration", "Bioavailability", "Biotransformation", "Drug Interactions", "Adverse Drug Reactions", "Cholinergic", "Anticholinesterase", "Organophosphate", "Atropine", "Adrenaline", "Beta Adrenergic", "Alpha Adrenergic", "Glaucoma", "Skeletal Muscle Relaxant", "ACE Inhibitor", "Spironolactone", "Digoxin", "Treatment of CHF", "Antiarrhythmic", "Calcium Channel", "Nitroglycerin", "Antihypertensive", "Furosemide", "Iron", "Heparin", "Warfarin", "Streptokinase", "Anti-Platelet", ] print("Topics found in first half:") for t in topics: idx = unique_text.find(t) if idx >= 0: print(f" '{t}' at position {idx}") else: print(f" '{t}' NOT FOUND in first half") print(f"\nFirst half length: {len(unique_text)} chars") PYEOF
cat > /home/daytona/workspace/build_pharma_revision.py << 'PYEOF' from reportlab.lib.pagesizes import A4 from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.lib.units import cm from reportlab.lib import colors from reportlab.platypus import (SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak, HRFlowable, KeepTogether) from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY import re # ─── Styles ─────────────────────────────────────────────────────────────────── PAGE_W, PAGE_H = A4 MARGIN = 1.5 * cm doc = SimpleDocTemplate( "/home/daytona/workspace/Pharmacology_Quick_Revision.pdf", pagesize=A4, rightMargin=MARGIN, leftMargin=MARGIN, topMargin=MARGIN, bottomMargin=MARGIN, ) styles = getSampleStyleSheet() # Custom styles TITLE = ParagraphStyle('Title', parent=styles['Normal'], fontSize=18, fontName='Helvetica-Bold', textColor=colors.HexColor('#003366'), alignment=TA_CENTER, spaceAfter=4) SUBTITLE = ParagraphStyle('Subtitle', parent=styles['Normal'], fontSize=10, fontName='Helvetica', textColor=colors.HexColor('#555555'), alignment=TA_CENTER, spaceAfter=12) H1 = ParagraphStyle('H1', parent=styles['Normal'], fontSize=13, fontName='Helvetica-Bold', textColor=colors.white, backColor=colors.HexColor('#003366'), spaceBefore=10, spaceAfter=4, leftIndent=4, rightIndent=4) H2 = ParagraphStyle('H2', parent=styles['Normal'], fontSize=10.5, fontName='Helvetica-Bold', textColor=colors.HexColor('#003366'), spaceBefore=6, spaceAfter=2, borderPad=2) H3 = ParagraphStyle('H3', parent=styles['Normal'], fontSize=9.5, fontName='Helvetica-BoldOblique', textColor=colors.HexColor('#CC5500'), spaceBefore=4, spaceAfter=1) BODY = ParagraphStyle('Body', parent=styles['Normal'], fontSize=8.5, fontName='Helvetica', leading=11.5, spaceBefore=1, spaceAfter=1, leftIndent=8) BULLET = ParagraphStyle('Bullet', parent=styles['Normal'], fontSize=8.5, fontName='Helvetica', leading=11, spaceBefore=0, spaceAfter=0, leftIndent=16, bulletIndent=8) NOTE = ParagraphStyle('Note', parent=styles['Normal'], fontSize=8, fontName='Helvetica-Oblique', textColor=colors.HexColor('#666666'), leftIndent=8, spaceAfter=2) KEY = ParagraphStyle('Key', parent=styles['Normal'], fontSize=8.5, fontName='Helvetica-Bold', textColor=colors.HexColor('#880000'), leftIndent=8) def h1(txt): return [Paragraph(txt, H1), Spacer(1, 2)] def h2(txt): return [Spacer(1, 3), Paragraph(txt, H2)] def h3(txt): return [Paragraph(txt, H3)] def body(txt): return Paragraph(txt, BODY) def bullet(txt): return Paragraph(f'• {txt}', BULLET) def note(txt): return Paragraph(f'* {txt}', NOTE) def key(txt): return Paragraph(txt, KEY) def sp(h=4): return Spacer(1, h) def hr(): return HRFlowable(width="100%", thickness=0.5, color=colors.HexColor('#CCCCCC'), spaceAfter=3) def tbl(data, col_widths=None, header_bg='#003366'): if col_widths is None: n = len(data[0]) col_widths = [(PAGE_W - 2*MARGIN) / n] * n t = Table(data, colWidths=col_widths) style = [ ('BACKGROUND', (0,0), (-1,0), colors.HexColor(header_bg)), ('TEXTCOLOR', (0,0), (-1,0), colors.white), ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'), ('FONTSIZE', (0,0), (-1,-1), 8), ('FONTNAME', (1,1), (-1,-1), 'Helvetica'), ('GRID', (0,0), (-1,-1), 0.3, colors.HexColor('#AAAAAA')), ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.white, colors.HexColor('#F5F8FF')]), ('VALIGN', (0,0), (-1,-1), 'TOP'), ('PADDING', (0,0), (-1,-1), 3), ('LEFTPADDING', (0,0), (-1,-1), 4), ] t.setStyle(TableStyle(style)) return t # ─── CONTENT ────────────────────────────────────────────────────────────────── story = [] # COVER story.append(Spacer(1, 1.5*cm)) story.append(Paragraph("PHARMACOLOGY PAPER I", TITLE)) story.append(Paragraph("Quick Revision Notes — Shanbhag's Review of Pharmacology", SUBTITLE)) story.append(Paragraph("General Pharmacology | ANS | CVS | Haematology", SUBTITLE)) story.append(HRFlowable(width="100%", thickness=2, color=colors.HexColor('#003366'), spaceAfter=8)) # ═══════════════════════════════════════════════════════════════════════════════ # SECTION 1: GENERAL PHARMACOLOGY — ROUTES & PK # ═══════════════════════════════════════════════════════════════════════════════ story += h1("1. ROUTES OF DRUG ADMINISTRATION") story += h2("Choice of Route — Key Factors") factors = [ ("Nature of drug", "Insulin destroyed orally -> parenteral; GTN high first-pass -> sublingual"), ("Emergency vs chronic", "IV for emergencies; oral for chronic"), ("Patient condition", "Unconscious -> parenteral; vomiting -> avoid oral"), ("First-pass metabolism", "High first-pass drugs (GTN, propranolol) avoid oral route"), ("Local vs systemic", "Topical for local (betamethasone cream); IV for systemic"), ] story.append(tbl([["Factor","Clinical Example"]] + factors, col_widths=[6*cm, 12*cm])) story += h2("Routes Summary") routes = [ ["Route","Example","Key Feature"], ["Oral (PO)","Aspirin","Convenient; subject to first-pass"], ["Sublingual (SL)","Nitroglycerin","Bypasses first-pass; rapid onset"], ["Intravenous (IV)","Furosemide","100% bioavailability; irreversible"], ["Intramuscular (IM)","Penicillin G","Depot preparations possible"], ["Subcutaneous (SC)","Insulin","Slow absorption; self-injectable"], ["Inhalation","Salbutamol","Rapid onset; local lung effect"], ["Transdermal","GTN patch","Sustained; bypasses first-pass"], ["Rectal","Diazepam suppository","Useful if vomiting/unconscious"], ["Intrathecal","Bupivacaine","Spinal anaesthesia"], ] story.append(tbl(routes, col_widths=[4.5*cm, 5*cm, 8.5*cm])) story += h2("Transdermal Therapeutic Systems (TTS)") for b in ["Reservoir/matrix patch applied to skin; drug diffuses at constant rate", "Bypasses first-pass metabolism; sustained delivery (daily to weekly)", "Advantages: constant blood levels, easy removal if toxicity, better compliance", "Disadvantages: expensive, skin irritation, only lipophilic low-MW low-dose drugs", "Examples: GTN (angina), Fentanyl (pain), Nicotine (smoking), Scopolamine (motion sickness), Clonidine (HTN), Estradiol (HRT)"]: story.append(bullet(b)) # ═══════════════════════════════════════════════════════════════════════════════ story += h1("2. PHARMACOKINETICS") # ═══════════════════════════════════════════════════════════════════════════════ story += h2("Bioavailability") story.append(body("<b>Definition:</b> Fraction of administered dose reaching systemic circulation unchanged. IV = 100% (reference).")) story.append(body("<b>Formula:</b> F = AUC(oral) / AUC(IV) × 100")) story += h3("Factors Reducing Oral Bioavailability:") for b in ["First-pass metabolism (liver) — high for GTN, propranolol, lignocaine, morphine", "Poor aqueous solubility (griseofulvin — improved by micronisation)", "Chemical instability — penicillin G (gastric acid), insulin (GI enzymes)", "GI motility changes — rapid emptying increases; delayed reduces absorption", "Food interactions — antacids chelate tetracycline/fluoroquinolones; food enhances griseofulvin", "Enterohepatic recycling increases bioavailability (oestrogens)"]: story.append(bullet(b)) story.append(key("Bioequivalence: Same AUC and Cmax (±20%) as reference product — basis for generic drug approval")) story += h2("Plasma Half-Life (t½)") story.append(body("Time for plasma concentration to fall by 50%. t½ = 0.693 × Vd / Cl")) story.append(body("<b>Steady state:</b> Reached after 4-5 half-lives. Loading dose shortens time to reach steady state.")) story.append(body("<b>Clinical use:</b> Set dosing intervals; predict accumulation; TDM timing")) story += h2("Biotransformation (Drug Metabolism)") phases = [ ["Phase","Reactions","Enzymes","Result"], ["Phase I","Oxidation, Reduction, Hydrolysis","CYP450 (hepatic microsomes)","Add/expose functional group; may activate prodrug"], ["Phase II","Conjugation (glucuronidation, sulfation, acetylation, methylation)","Transferases","Inactive, water-soluble; renally excreted"], ] story.append(tbl(phases, col_widths=[2.5*cm, 5.5*cm, 5*cm, 5*cm])) story += h3("Enzyme Induction — Clinical Consequences") for b in ["Rifampicin induces CYP450 -> reduces efficacy of OCP, warfarin, phenytoin", "Phenobarbitone, carbamazepine, phenytoin — induce own metabolism (autoinduction)", "Consequences: Therapeutic failure, need dose increase, withdrawal rebound"]: story.append(bullet(b)) story += h3("Enzyme Inhibition — Examples") for b in ["Ketoconazole, erythromycin, cimetidine inhibit CYP450 -> drug toxicity", "Allopurinol inhibits xanthine oxidase -> 6-mercaptopurine toxicity"]: story.append(bullet(b)) story += h2("Prodrugs") story.append(body("Pharmacologically inactive precursors activated by metabolism in vivo.")) prods = [["Prodrug","Active Drug","Advantage"], ["Enalapril","Enalaprilat","Better oral absorption"], ["Levodopa","Dopamine","Crosses BBB (dopamine can't)"], ["Codeine","Morphine","Less abuse potential"], ["Prednisone","Prednisolone","Inactive until hepatic activation"], ["Azathioprine","6-Mercaptopurine","Immunosuppressant; less GI upset"]] story.append(tbl(prods, col_widths=[5*cm, 5*cm, 8*cm])) story += h2("Therapeutic Drug Monitoring (TDM)") for b in ["Drugs with narrow therapeutic index: digoxin, lithium, phenytoin, aminoglycosides, cyclosporine", "Trough levels (just before next dose) for most drugs; peak + trough for aminoglycosides", "Indications: lack of response, suspected toxicity, compliance assessment, renal/hepatic disease", "Steady state must be achieved before sampling (4-5 half-lives)"]: story.append(bullet(b)) story += h2("Prolongation of Drug Action") for b in ["Depot preparations: Fluphenazine decanoate, medroxyprogesterone (IM monthly/3-monthly)", "Sustained-release formulations: slow-release morphine, nifedipine GITS", "Protein binding: highly bound drugs have longer duration", "Inhibiting metabolism: allopurinol prolongs 6-MP; probenecid prolongs penicillin", "Combining with vasoconstrictors: adrenaline + LA prolongs local anaesthetic action"]: story.append(bullet(b)) # ═══════════════════════════════════════════════════════════════════════════════ story += h1("3. PHARMACODYNAMICS, DRUG INTERACTIONS & ADRs") # ═══════════════════════════════════════════════════════════════════════════════ story += h2("Mechanisms of Drug Action") mechs = [["Mechanism","Examples"], ["Receptor agonism","Morphine (mu-opioid), salbutamol (beta-2)"], ["Receptor antagonism","Propranolol (beta-blocker), atropine (mAChR blocker)"], ["Enzyme inhibition","NSAIDs (COX), ACEIs (ACE), statins (HMG-CoA reductase)"], ["Ion channel blockade","LA (Na+ channel), CCBs (Ca2+ channel)"], ["Carrier/pump inhibition","Digoxin (Na/K ATPase), TCAs (monoamine reuptake)"], ["Physicochemical","Antacids (neutralise HCl), mannitol (osmotic)"], ["Replacement","Insulin, thyroxine, iron"]] story.append(tbl(mechs, col_widths=[6*cm, 12*cm])) story += h2("Drug Antagonism") antag = [["Type","Definition","Example"], ["Competitive","Reversible; competes at same receptor; overcome by increasing agonist dose","Naloxone vs morphine; atropine vs ACh"], ["Non-competitive","Irreversible or allosteric; cannot overcome by increasing agonist","Phenoxybenzamine vs adrenaline"], ["Physiological","Acts on different receptor producing opposite effect","Adrenaline vs insulin (blood glucose)"], ["Chemical","Direct chemical combination","Protamine vs heparin; EDTA vs lead"]] story.append(tbl(antag, col_widths=[3.5*cm, 7.5*cm, 7*cm])) story += h2("Drug Interactions — Classification") story += h3("Pharmacokinetic:") for b in ["Absorption: antacids reduce tetracycline absorption (chelation); metoclopramide speeds paracetamol absorption", "Distribution: aspirin displaces warfarin from plasma proteins -> bleeding risk", "Metabolism: rifampicin (inducer); ketoconazole (inhibitor)", "Excretion: probenecid blocks tubular secretion of penicillin (beneficial)"]: story.append(bullet(b)) story += h3("Pharmacodynamic:") for b in ["Synergism (additive/potentiation): Co-trimoxazole = trimethoprim + sulfamethoxazole", "Antagonism: Naloxone reverses opioid overdose; vitamin K reverses warfarin"]: story.append(bullet(b)) story += h3("Beneficial Interactions:") bint = [["Combination","Mechanism","Benefit"], ["Carbidopa + Levodopa","Carbidopa inhibits peripheral DOPA decarboxylase","More levodopa reaches brain"], ["Probenecid + Penicillin","Blocks tubular secretion","Prolonged penicillin level"], ["Trimethoprim + Sulfamethoxazole","Sequential folate pathway block","Synergistic bactericidal"], ["Adrenaline + LA","Vasoconstriction reduces LA absorption","Prolonged and reduced toxicity"], ["Naloxone + Opioid","Competitive antagonism","Reverses respiratory depression"]] story.append(tbl(bint, col_widths=[5*cm, 6.5*cm, 6.5*cm])) story += h2("Adverse Drug Reactions (ADRs) — Classification") adrs = [["Type","Description","Example"], ["A - Augmented","Predictable, dose-related, common","Bleeding with heparin; hypoglycaemia with insulin"], ["B - Bizarre","Unpredictable, not dose-related, rare","Penicillin anaphylaxis; aplastic anaemia with chloramphenicol"], ["C - Chronic","Long-term use","Adrenal suppression with corticosteroids"], ["D - Delayed","Appear after long latency","Carcinogenesis with cytotoxics; tardive dyskinesia"], ["E - End-of-use","Withdrawal effects","Clonidine rebound HTN; BDZ withdrawal seizures"], ["F - Failure","Unexpected failure of therapy","OCP failure with rifampicin"]] story.append(tbl(adrs, col_widths=[2.5*cm, 6.5*cm, 9*cm])) story += h2("Factors Affecting Drug Action (Key Points)") for b in ["Age: neonates (immature enzymes, high Vd); elderly (reduced renal/hepatic function, polypharmacy)", "Weight/Body composition: obese patients need weight-based dosing for lipophilic drugs", "Genetics: slow vs fast acetylators (isoniazid, hydralazine); G6PD deficiency (haemolysis with primaquine)", "Disease: renal failure (aminoglycosides, digoxin — reduce dose); liver failure (increase bioavailability of high first-pass drugs)", "Drug tolerance: reduced effect with repeated use (opioids, nitrates)", "Tachyphylaxis: rapid tolerance within minutes-hours (ephedrine, glyceryl trinitrate)", "Pregnancy: Category D/X drugs contraindicated (warfarin, ACEIs, valproate, thalidomide, tetracycline)", "Chronopharmacology: corticosteroids given in morning to mimic cortisol diurnal rhythm"]: story.append(bullet(b)) story.append(PageBreak()) # ═══════════════════════════════════════════════════════════════════════════════ story += h1("4. AUTONOMIC NERVOUS SYSTEM — CHOLINERGIC DRUGS") # ═══════════════════════════════════════════════════════════════════════════════ story += h2("Cholinergic Drugs — Classification") story.append(tbl([ ["Class","Drugs","Mechanism"], ["Choline esters","ACh, Bethanechol, Carbachol","Direct muscarinic/nicotinic agonism"], ["Alkaloids","Pilocarpine, Muscarine, Nicotine","Direct receptor agonism"], ["Anticholinesterases (reversible)","Neostigmine, Pyridostigmine, Physostigmine, Donepezil","Inhibit AChE -> increase ACh at synapse"], ["Anticholinesterases (irreversible)","Organophosphates (malathion, sarin), Echothiophate","Covalent phosphorylation of AChE"], ], col_widths=[4.5*cm, 6.5*cm, 7*cm])) story += h2("Anticholinesterases — Therapeutic Indications") for b in ["Myasthenia Gravis: pyridostigmine (oral, long-acting), neostigmine (IV for crisis)", "Glaucoma: physostigmine eye drops, echothiophate", "Reversal of non-depolarising NMB (post-op): neostigmine + atropine", "Alzheimer's disease: donepezil, rivastigmine, galantamine (BBB-crossing)", "Post-operative ileus/urinary retention: neostigmine", "Diagnosis of MG: edrophonium (Tensilon test — 5-10 min action)", "Atropine poisoning: physostigmine (only anticholinesterase crossing BBB)"]: story.append(bullet(b)) story += h2("OPC (Organophosphate) Poisoning — Management") story.append(body("<b>Mechanism:</b> Irreversible phosphorylation of AChE -> ACh accumulation -> SLUDGE + CNS effects")) story.append(tbl([ ["System","Features"], ["Muscarinic (SLUDGE)","Salivation, Lacrimation, Urination, Defecation, GI cramps, Emesis + Miosis, bradycardia, bronchospasm"], ["Nicotinic","Muscle fasciculations, weakness, paralysis (respiratory failure — main cause of death)"], ["CNS","Anxiety, seizures, coma"], ], col_widths=[4.5*cm, 13.5*cm])) story += h3("Treatment:") for b in ["Remove exposure: fresh air, remove clothes, wash skin", "Atropine (ANTIDOTE 1): 2-4 mg IV, repeat every 10-15 min until secretions dry (not miosis). Large doses may be needed.", "Pralidoxime / 2-PAM (ANTIDOTE 2): 1-2g IV slowly; reactivates AChE if given before 'ageing' (within 24-48 hr)", "Diazepam: for seizures", "Ventilatory support: for respiratory paralysis"]: story.append(bullet(b)) story.append(key("REMEMBER: Atropine dries secretions; pralidoxime reverses nicotinic features (muscle paralysis)")) story += h2("Atropine — Clinical Uses") for b in ["Preanesthetic medication (reduce secretions, prevent bradycardia)", "OPC/anticholinesterase poisoning (antidote — muscarinic effects)", "Reversal of non-depolarising NMB (with neostigmine) — prevents neostigmine-induced bradycardia", "Bradycardia/heart block (IV)", "Peptic ulcer (older use — replaced by H2 blockers/PPIs)", "Ophthalmology: mydriasis and cycloplegia (1% atropine — lasts 2 weeks)"]: story.append(bullet(b)) story += h2("Atropine vs Tropicamide (as mydriatics)") story.append(tbl([ ["Feature","Atropine","Tropicamide"], ["Duration","Up to 2 weeks","4-6 hours"], ["Cycloplegia","Marked","Mild/moderate"], ["Use","Uveitis, amblyopia treatment","Fundus examination (brief)"], ["Side effects","Prolonged blurring, photophobia","Minimal, short-lived"], ], col_widths=[4*cm, 7*cm, 7*cm])) story += h2("Myasthenia Gravis — Treatment") for b in ["Pyridostigmine (60 mg TID-QID oral) — first-line symptomatic", "Neostigmine IV — myasthenic crisis", "Steroids (prednisolone) + steroid-sparing (azathioprine, mycophenolate)", "Thymectomy — in thymoma or generalised MG <50 years", "Plasmapheresis / IV Immunoglobulin — rapid effect in crisis", "Eculizumab — complement inhibitor for refractory generalised MG"]: story.append(bullet(b)) # ═══════════════════════════════════════════════════════════════════════════════ story += h1("5. SYMPATHOMIMETIC DRUGS (ADRENERGIC AGONISTS)") # ═══════════════════════════════════════════════════════════════════════════════ story += h2("Adrenaline (Epinephrine) — Pharmacological Actions") adr_actions = [["Receptor","Effect"], ["alpha-1","Vasoconstriction (skin, viscera), mydriasis, urinary retention"], ["beta-1","Increased HR, force, AV conduction (chronotropy, inotropy, dromotropy)"], ["beta-2","Bronchodilation, vasodilation (muscle), uterine relaxation, glycogenolysis"], ] story.append(tbl(adr_actions, col_widths=[4*cm, 14*cm])) story += h3("Therapeutic Uses of Adrenaline:") for b in ["Anaphylaxis (DOC): 0.5mg IM anterolateral thigh (1:1000); repeat every 5-15 min", "Bronchial asthma (acute severe) — when beta-2 agonists fail", "Cardiac arrest — 1mg IV every 3-5 min (1:10000)", "With local anaesthetics: vasoconstriction -> prolongs LA action, reduces bleeding and toxicity", "Open-angle glaucoma (reduces IOP by reducing aqueous humour formation)", "Allergic reactions/urticaria", "To raise BP in hypotension (vasopressor)"]: story.append(bullet(b)) story.append(key("Adrenaline CONTRAINDICATED in hypotensive shock: beta-2 vasodilation of muscle vessels worsens hypotension. Use noradrenaline instead.")) story += h2("Adrenergic Drug Classification") story.append(tbl([ ["Class","Drugs","Selectivity"], ["Direct alpha+beta","Adrenaline, Noradrenaline","Both receptors"], ["Direct alpha","Phenylephrine, Methoxamine","Alpha-1 selective"], ["Direct beta","Isoprenaline","Beta-1 + Beta-2"], ["Selective beta-1","Dobutamine","Inotrope; +ve inotropy, minimal HR"], ["Selective beta-2","Salbutamol, Terbutaline","Bronchodilation; tocolysis"], ["Indirect","Ephedrine, Amphetamine","Release stored NA"], ["Mixed","Dopamine (dose-dependent)","DA1 -> DA/Beta -> Alpha at high dose"], ], col_widths=[4.5*cm, 6*cm, 7.5*cm])) story += h2("Alpha Blockers — Uses & Adverse Effects") for b in ["Selective alpha-1: Prazosin, Terazosin, Tamsulosin", "Non-selective: Phentolamine (competitive), Phenoxybenzamine (non-competitive/irreversible)", "Uses: BPH (tamsulosin), HTN (prazosin — postural hypotension), phaeochromocytoma (phenoxybenzamine pre-op)", "Adverse effects: Postural hypotension (especially first dose), reflex tachycardia, nasal congestion"]: story.append(bullet(b)) story += h2("Beta Blockers — Classification & Uses") story.append(tbl([ ["Class","Drugs"], ["Non-selective (beta-1 + beta-2)","Propranolol, Timolol, Nadolol, Sotalol"], ["Cardioselective (beta-1)","Atenolol, Metoprolol, Bisoprolol, Esmolol"], ["With ISA","Pindolol, Acebutolol"], ["With alpha-blocking","Carvedilol (beta-1+2+alpha-1), Labetalol (beta+alpha)"], ["Ultra-short acting","Esmolol (t½ = 9 min — IV for perioperative HTN)"], ], col_widths=[7.5*cm, 10.5*cm])) story += h3("Therapeutic Uses:") for b in ["HTN, Angina pectoris (reduces O2 demand), MI (mortality reduction)", "Arrhythmias (class II antiarrhythmic — AF, SVT, VT)", "CHF: carvedilol, bisoprolol, metoprolol succinate (REDUCE MORTALITY — start low, go slow)", "Thyrotoxicosis (propranolol — controls symptoms; inhibits T4->T3 conversion)", "Migraine prophylaxis (propranolol)", "Anxiety/essential tremor (propranolol)", "Glaucoma (timolol eye drops — reduces aqueous formation)", "Phaeochromocytoma (ONLY AFTER alpha-blocker given)"]: story.append(bullet(b)) story += h3("Propranolol vs Atenolol (Key Differences):") story.append(tbl([ ["Feature","Propranolol","Atenolol"], ["Selectivity","Non-selective (beta-1+2)","Cardioselective (beta-1)"], ["CNS penetration","Yes (lipophilic)","Minimal (hydrophilic)"], ["Asthma","Contraindicated","Relative CI; cautious use"], ["Metabolism","Hepatic first-pass (high)","Renal excretion"], ["Additional uses","Migraine, thyrotoxicosis, tremor","Mainly cardiovascular"], ["ISA","No","No"], ["Dosing frequency","BD-TDS","Once daily"], ], col_widths=[4.5*cm, 7*cm, 6.5*cm])) story.append(key("BB Contraindications: Asthma, COPD (propranolol), AV block, cardiogenic shock, severe bradycardia")) story += h2("Drugs Used in Glaucoma") glaucoma = [["Drug","MOA","Type of Glaucoma"], ["Pilocarpine","Pupil constriction -> opens canal of Schlemm","Open + closed angle (acute)"], ["Timolol","Reduces aqueous humour production","Open angle (chronic)"], ["Latanoprost (PGF2a)","Increases uveoscleral outflow","Open angle"], ["Dorzolamide/Acetazolamide","Carbonic anhydrase inhibition -> reduces aqueous","Open angle"], ["Apraclonidine","Alpha-2 agonist -> reduces aqueous","Open angle"], ["Adrenaline","Reduces aqueous formation + increases outflow","Open angle"], ] story.append(tbl(glaucoma, col_widths=[4.5*cm, 7*cm, 6.5*cm])) story.append(PageBreak()) # ═══════════════════════════════════════════════════════════════════════════════ story += h1("6. SKELETAL MUSCLE RELAXANTS") # ═══════════════════════════════════════════════════════════════════════════════ story += h2("Classification by MOA") story.append(tbl([ ["Type","Drugs","MOA"], ["Depolarising NMB","Succinylcholine (suxamethonium)","Persistent depolarisation of motor end plate; phase I -> phase II block"], ["Non-depolarising NMB","Tubocurarine, Atracurium, Rocuronium, Vecuronium, Pancuronium","Competitive block at nicotinic NMJ receptor"], ["Centrally acting","Diazepam, Baclofen, Tizanidine","Depress polysynaptic spinal reflexes"], ["Directly acting","Dantrolene","Reduces Ca2+ release from SR -> reduces muscle contractility"], ], col_widths=[4*cm, 6*cm, 8*cm])) story += h2("Succinylcholine — Pharmacology") for b in ["Onset: 60 sec; Duration: 5-10 min (hydrolysed by plasma pseudocholinesterase)", "Uses: Rapid-sequence intubation (RSI), electroconvulsive therapy (ECT)", "Adverse effects: Fasciculations, hyperkalaemia (dangerous in burns, crush injury, denervation), malignant hyperthermia, prolonged apnoea in pseudocholinesterase deficiency, raised IOP/ICP", "Reversal: NOT reversible by neostigmine (depolarising); wait for spontaneous recovery"]: story.append(bullet(b)) story += h2("Non-Depolarising NMBs (NDNMBs)") for b in ["Reversed by neostigmine + atropine (or sugammadex for rocuronium/vecuronium)", "Atracurium: metabolised by Hofmann elimination — safe in renal/liver failure", "Rocuronium: fastest onset among NDNMBs; used for RSI when succinylcholine contraindicated", "Monitoring: Train-of-four (TOF) ratio"]: story.append(bullet(b)) # ═══════════════════════════════════════════════════════════════════════════════ story += h1("7. DRUGS ACTING ON RAAS — ACE INHIBITORS & ARBs") # ═══════════════════════════════════════════════════════════════════════════════ story += h2("ACE Inhibitors — MOA, Uses, ADRs") story.append(body("<b>MOA:</b> Inhibit ACE -> reduced Ang II -> arterial+venous vasodilation (reduced afterload+preload); reduced aldosterone -> natriuresis; prevent cardiac remodelling; bradykinin accumulation (cough).")) story += h3("Therapeutic Uses:") for b in ["Hypertension (all types; especially with diabetes/CKD)", "Heart failure (CHF) — reduce mortality", "Post-MI (prevent remodelling, improve survival)", "Diabetic nephropathy (reduce proteinuria, slow progression)", "Chronic kidney disease with proteinuria", "Left ventricular hypertrophy (regression)"]: story.append(bullet(b)) story += h3("Adverse Effects:") story.append(tbl([ ["ADR","Mechanism","Management"], ["Dry cough (10-20%)","Bradykinin/substance P accumulation","Switch to ARB"], ["Angioedema (rare)","Bradykinin excess","Stop ACEI immediately; ARB (cautious)"], ["First-dose hypotension","Especially in volume-depleted patients","Start low; stop diuretic temporarily"], ["Hyperkalaemia","Reduced aldosterone","Avoid K+ supplements; caution with spironolactone"], ["Acute renal failure","Bilateral RAS — loss of Ang II efferent constriction","Contraindicated in bilateral RAS"], ["Teratogenic","Renal agenesis (2nd/3rd trimester)","Contraindicated in pregnancy"], ], col_widths=[3.5*cm, 6.5*cm, 8*cm])) story += h2("Enalapril vs Losartan (ACEI vs ARB)") story.append(tbl([ ["Feature","Enalapril (ACEI)","Losartan (ARB)"], ["MOA","Inhibit ACE","AT1 receptor blocker"], ["Cough","Common (10-20%)","Absent (main advantage)"], ["Angioedema","Can occur","Very rare"], ["Bradykinin effect","Yes (cough/angioedema)","No"], ["Hyperkalaemia","Yes","Yes"], ["Renal protection","Yes","Yes"], ["Teratogenicity","Yes","Yes (avoid in pregnancy)"], ], col_widths=[4.5*cm, 6.5*cm, 7*cm])) # ═══════════════════════════════════════════════════════════════════════════════ story += h1("8. CONGESTIVE HEART FAILURE (CHF) DRUGS") # ═══════════════════════════════════════════════════════════════════════════════ story += h2("Drugs Used in CHF — Overview") story.append(tbl([ ["Drug Class","Examples","Mortality Benefit?"], ["ACE Inhibitors","Enalapril, Ramipril, Lisinopril","YES (cornerstone)"], ["ARBs","Valsartan, Candesartan","YES (if ACEI intolerant)"], ["Beta-blockers","Carvedilol, Bisoprolol, Metoprolol succinate","YES (start low in stable CHF)"], ["Aldosterone antagonists","Spironolactone, Eplerenone","YES (RALES trial)"], ["ARNi","Sacubitril/Valsartan (Entresto)","YES (superior to enalapril)"], ["SGLT2 inhibitors","Empagliflozin, Dapagliflozin","YES"], ["Loop diuretics","Furosemide","Symptomatic only"], ["Digoxin","Digoxin","NO (symptoms + hospitalisations)"], ["Ivabradine","Ivabradine","Symptoms (If-channel block)"], ["Hydralazine + ISDN","Hydralazine + Isosorbide dinitrate","YES (if ACEI/ARB intolerant)"], ], col_widths=[4.5*cm, 6*cm, 7.5*cm])) story += h2("Digoxin — MOA & Clinical Use") story.append(body("<b>MOA:</b> Inhibits Na+/K+ ATPase -> intracellular Na+ rises -> reduced Na+/Ca2+ exchange -> intracellular Ca2+ rises -> positive inotropy")) story.append(body("<b>Vagomimetic:</b> Increases vagal tone -> slows AV conduction (useful in AF)")) for b in ["Uses: CHF with AF (controls rate AND improves contractility), chronic CHF (symptoms only)", "Does NOT reduce mortality in CHF — narrow therapeutic index", "Therapeutic range: 0.5-2 ng/mL"]: story.append(bullet(b)) story += h3("Digitalis Toxicity — Management:") for b in ["Features: nausea/vomiting, yellow vision (xanthopsia), arrhythmias (PAT with block, VT, AF), bradycardia", "Stop digoxin; correct hypokalaemia (K+ is protective)", "Lignocaine / phenytoin for ventricular arrhythmias", "Atropine for bradycardia/AV block", "Digoxin-specific antibody fragments (Digibind) — severe toxicity", "Avoid: DC cardioversion if possible; quinidine (raises digoxin levels); K+-depleting diuretics"]: story.append(bullet(b)) story += h2("Spironolactone in CHF") story.append(body("<b>MOA:</b> Competitive aldosterone antagonist -> reduces Na+ retention, reduces K+ loss, blocks cardiac fibrosis")) story.append(body("<b>RALES Trial:</b> Spironolactone 25 mg/day in severe CHF -> 30% reduction in mortality")) for b in ["Uses in CHF: reduces oedema, prevents hypokalaemia from loop diuretics, anti-remodelling", "Drug interactions: K+ supplements/K+-sparing diuretics -> hyperkalaemia; reduces warfarin effect", "ADRs: hyperkalaemia, gynaecomastia (eplerenone has less)"]: story.append(bullet(b)) story.append(PageBreak()) # ═══════════════════════════════════════════════════════════════════════════════ story += h1("9. ANTIARRHYTHMIC DRUGS") # ═══════════════════════════════════════════════════════════════════════════════ story += h2("Vaughan Williams Classification") story.append(tbl([ ["Class","MOA","Drugs"], ["IA","Na+ channel block + K+ block (intermediate)","Quinidine, Procainamide, Disopyramide"], ["IB","Na+ channel block (fast — shorten APD)","Lignocaine, Mexiletine"], ["IC","Na+ channel block (slow — no APD change)","Flecainide, Propafenone"], ["II","Beta-blockers","Propranolol, Atenolol, Esmolol"], ["III","K+ channel block (prolong APD/QT)","Amiodarone, Sotalol, Ibutilide"], ["IV","Ca2+ channel block","Verapamil, Diltiazem"], ["Others","Various","Digoxin (vagal), Adenosine (SVT), Atropine (bradycardia)"], ], col_widths=[1.8*cm, 6*cm, 10.2*cm])) story += h3("Key Drug Notes:") for b in ["Amiodarone: most effective antiarrhythmic; has class I+II+III+IV actions; ADRs = pulmonary fibrosis, thyroid dysfunction, corneal deposits, photosensitivity, hepatotoxicity", "Adenosine: DOC for SVT — 6mg rapid IV; very short t½ (10-30 sec); causes transient AV block", "Lignocaine: IV only; for ventricular arrhythmias post-MI", "Verapamil: AF/SVT rate control; AVOID in WPW syndrome and with beta-blockers (risk of asystole)", "Propranolol antiarrhythmic: slows SA node, prolongs AV conduction, effective for supraventricular arrhythmias"]: story.append(bullet(b)) # ═══════════════════════════════════════════════════════════════════════════════ story += h1("10. ANTIANGINAL DRUGS") # ═══════════════════════════════════════════════════════════════════════════════ story += h2("Nitroglycerin (GTN) — Pharmacology") story.append(body("<b>MOA:</b> Releases NO -> activates guanylyl cyclase -> increases cGMP -> smooth muscle relaxation (venodilation > arteriodilation)")) story.append(body("<b>Haemodynamics:</b> Reduces preload (venodilation) -> reduces LV end-diastolic pressure -> reduces O2 demand; also dilates coronary arteries (indirect)")) story += h3("Therapeutic Uses:") for b in ["Acute angina attack: sublingual (0.3-0.6mg) — onset 1-3 min; duration 30 min", "Angina prophylaxis: transdermal patch, long-acting oral ISDN/ISMN", "Acute LVF/pulmonary oedema: IV (rapid preload reduction)", "Hypertensive emergencies with cardiac ischaemia: IV", "Anal fissure: topical GTN 0.2% ointment", "Oesophageal spasm"]: story.append(bullet(b)) story += h3("ADRs:") for b in ["Throbbing headache (cerebral vasodilation) — most common", "Postural hypotension, tachycardia, flushing", "Tolerance: develops with continuous use; requires nitrate-free interval (8-10 hr/day)"]: story.append(bullet(b)) story += h2("Calcium Channel Blockers (CCBs)") story.append(tbl([ ["Drug","Selectivity","Key Uses"], ["Nifedipine (DHP)","Vascular > cardiac","Angina (vasospastic), HTN, Raynaud's"], ["Amlodipine (DHP)","Vascular","HTN, stable angina, Prinzmetal"], ["Verapamil (non-DHP)","Cardiac (HR, AV)","SVT, AF rate control, HTN, HCM"], ["Diltiazem (non-DHP)","Cardiac + vascular","SVT, AF, angina, HTN"], ["Nimodipine","Cerebral vessels","Subarachnoid haemorrhage (cerebral vasospasm)"], ], col_widths=[4*cm, 4.5*cm, 9.5*cm])) story.append(body("<b>MOA in Angina:</b> Block L-type Ca2+ channels -> reduce cardiac contractility, HR (diltiazem/verapamil), vasodilation -> reduce O2 demand and increase coronary supply")) story += h3("ADRs:") for b in ["DHP (nifedipine): flushing, headache, ankle oedema, reflex tachycardia", "Verapamil/diltiazem: constipation, bradycardia, AV block, negative inotropy", "Nifedipine vs Verapamil: DHP preferred in angina + HTN; verapamil for arrhythmias but avoid in CHF/beta-blocker combination"]: story.append(bullet(b)) story += h2("Coronary Steal Phenomenon") story.append(body("Vasodilators (e.g. dipyridamole) preferentially dilate already-dilated normal vessels (which respond better) -> blood diverted FROM ischaemic area (which has maximally dilated arterioles) -> worsens ischaemia")) story.append(note("Dipyridamole used in pharmacological stress test to PROVOKE ischaemia for diagnostic purposes")) story += h2("Myocardial Infarction — Drug Management") story.append(body("<b>Acute STEMI: MONA + reperfusion</b>")) for b in ["Morphine (pain relief, venodilation, reduces anxiety)", "Oxygen (if SpO2 <94%)", "Nitrates (GTN sublingual/IV)", "Aspirin 300mg stat + P2Y12 inhibitor (clopidogrel/ticagrelor)", "Reperfusion: Primary PCI (preferred) or thrombolysis (streptokinase/tPA if PCI unavailable within 120 min)", "Anticoagulation: Heparin (UFH or LMWH) or fondaparinux", "Beta-blocker (oral, once haemodynamically stable — reduces mortality)", "ACE Inhibitor (within 24hr post-MI, especially with LV dysfunction)", "Statin (high-intensity — atorvastatin 40-80mg)"]: story.append(bullet(b)) story.append(PageBreak()) # ═══════════════════════════════════════════════════════════════════════════════ story += h1("11. ANTIHYPERTENSIVE DRUGS") # ═══════════════════════════════════════════════════════════════════════════════ story += h2("Classification of Antihypertensives") story.append(tbl([ ["Class","Examples","First-line?"], ["Thiazide diuretics","Hydrochlorothiazide, Chlorthalidone, Indapamide","YES"], ["ACE Inhibitors","Enalapril, Ramipril, Lisinopril","YES (especially DM/CKD)"], ["ARBs","Losartan, Valsartan, Olmesartan","YES (if ACEI intolerant)"], ["CCBs (DHP)","Amlodipine, Nifedipine","YES"], ["Beta-blockers","Atenolol, Metoprolol","Not first-line (unless angina/post-MI)"], ["Alpha-1 blockers","Prazosin, Terazosin","Add-on (BPH benefit)"], ["Central alpha-2 agonists","Methyldopa, Clonidine","Methyldopa in pregnancy"], ["Vasodilators","Hydralazine, Minoxidil","Add-on (resistant HTN)"], ], col_widths=[5*cm, 6*cm, 7*cm])) story += h2("Hypertensive Emergency — Management") for b in ["Target: reduce MAP by max 25% in 1st hour, then to 160/100 over next 2-6 hr (to avoid ischaemia)", "IV Sodium nitroprusside: most rapid, titratable; metabolised to cyanide (caution)", "IV Labetalol: alpha+beta block; safe in aortic dissection and pregnancy", "IV GTN: preferred with cardiac ischaemia or pulmonary oedema", "IV Esmolol: for aortic dissection (rapid heart rate control)", "Oral Nifedipine SL: AVOID (precipitous BP fall -> stroke/MI)", "Hydralazine IV: used in eclampsia"]: story.append(bullet(b)) story += h2("Diuretics in HTN") story.append(tbl([ ["Type","Drug","MOA","Special Uses"], ["Thiazide","HCT, Chlorthalidone","Inhibit NCC in DCT","Uncomplicated HTN, nephrogenic DI"], ["Loop","Furosemide","Inhibit NKCC2 in LoH","Oedema, acute pulmonary oedema, hypercalcaemia"], ["K+-sparing","Spironolactone","Aldosterone antagonist","CHF (RALES), hyperaldosteronism"], ["Carbonic anhydrase inhibitor","Acetazolamide","Inhibit CA in PCT","Glaucoma, altitude sickness"], ], col_widths=[3.5*cm, 4*cm, 5.5*cm, 5*cm])) story += h3("Complications of Diuretic Therapy:") for b in ["Hypokalaemia: loop + thiazide (most common); -> arrhythmias; potentiates digoxin toxicity", "Hyponatraemia: thiazides > loop (especially elderly)", "Hypercalcaemia: thiazides (reduce urinary Ca excretion); hypocalcaemia with loop diuretics", "Hyperuricaemia/Gout: thiazides and loop diuretics", "Hyperglycaemia: thiazides (reduce insulin secretion)", "Ototoxicity: furosemide (high doses, especially with aminoglycosides)"]: story.append(bullet(b)) story += h2("Furosemide — Pharmacology") story.append(body("<b>MOA:</b> Inhibits Na+/K+/2Cl- cotransporter in thick ascending limb of Loop of Henle -> massive natriuresis + diuresis; also venodilation (early, before diuresis)")) story += h3("Therapeutic Uses:") for b in ["Acute pulmonary oedema/LVF (IV — venodilation + diuresis)", "Chronic CCF and oedema", "Hypertension (add-on, especially with renal impairment)", "Acute hypercalcaemia (IV furosemide + saline infusion)", "Nephrotic syndrome/cirrhotic ascites", "Forced diuresis in drug poisoning"]: story.append(bullet(b)) story += h3("ADRs:") for b in ["Hypokalaemia (most common), Hyponatraemia, Hypomagnesaemia", "Metabolic alkalosis (H+ loss with Na/K loss)", "Hyperuricaemia, Hyperglycaemia", "Ototoxicity (high-dose IV, especially + aminoglycosides)", "Volume depletion, Postural hypotension"]: story.append(bullet(b)) story.append(PageBreak()) # ═══════════════════════════════════════════════════════════════════════════════ story += h1("12. HAEMATINICS — IRON PREPARATIONS") # ═══════════════════════════════════════════════════════════════════════════════ story += h2("Oral Iron Preparations") story.append(tbl([ ["Drug","Form","Note"], ["Ferrous sulfate","Ferrous (Fe2+)","Cheapest, most absorbed; GI side effects common"], ["Ferrous gluconate","Ferrous","Less GI SE; fewer elemental iron mg"], ["Ferrous fumarate","Ferrous","High elemental iron content"], ["Iron polymaltose","Ferric (Fe3+)","Non-ionic; less GI SE; can be taken with food; slower absorption"], ], col_widths=[5*cm, 3.5*cm, 9.5*cm])) story += h3("ADRs of Oral Iron:") for b in ["GI: nausea, vomiting, constipation, diarrhoea, metallic taste (most common)", "Black stools (not pathological — reassure patient)", "Take on empty stomach for best absorption (but increases GI SE)", "Avoid with tea/coffee/antacids (reduce absorption)"]: story.append(bullet(b)) story += h2("Parenteral Iron Preparations") story.append(tbl([ ["Drug","Route","Key Notes"], ["Iron dextran","IV or deep IM (Z-track)","Highest anaphylaxis risk (1-2%); test dose required"], ["Iron sucrose (Venofer)","IV infusion/bolus","Safer; low anaphylaxis risk; 100-200mg per infusion"], ["Ferric carboxymaltose","IV infusion","Single large dose (up to 1000mg); low anaphylaxis risk"], ["Iron isomaltoside","IV","Single high dose possible"], ["Iron sorbitol citric acid (Jectofer)","IM","Older preparation; iron overload risk"], ], col_widths=[5*cm, 3.5*cm, 9.5*cm])) story += h3("Indications for Parenteral Iron:") for b in ["Intolerance to oral iron", "Malabsorption (coeliac, IBD)", "Rapid preoperative iron repletion", "Chronic kidney disease (CKD) patients on ESA therapy", "Non-compliance with oral therapy"]: story.append(bullet(b)) story += h2("Iron Poisoning — Treatment") story.append(tbl([ ["Stage","Time","Features"], ["Stage 1 (0-6 hr)","Immediate","Nausea, vomiting, GI bleeding, abdominal pain"], ["Stage 2 (6-24 hr)","Latent","Apparent improvement (deceptive)"], ["Stage 3 (24-72 hr)","Systemic","CV collapse, metabolic acidosis, hepatotoxicity"], ["Stage 4 (>2 weeks)","Late","GI strictures from mucosal damage"], ], col_widths=[4*cm, 3*cm, 11*cm])) for b in ["Gastric lavage (if early); activated charcoal NOT effective for iron", "Deferoxamine (desferrioxamine) IV: chelates iron -> excreted as ferrioxamine (urine turns pink-orange)", "IV fluids, correct acidosis", "Serum iron > 90 umol/L or symptomatic = treat with deferoxamine"]: story.append(bullet(b)) # ═══════════════════════════════════════════════════════════════════════════════ story += h1("13. ANTICOAGULANTS & FIBRINOLYTICS") # ═══════════════════════════════════════════════════════════════════════════════ story += h2("UFH vs LMWH") story.append(tbl([ ["Feature","UFH (Unfractionated Heparin)","LMWH (Enoxaparin, Dalteparin)"], ["MW","Large (3000-30,000 Da)","Small (4000-6000 Da)"], ["MOA","Activates antithrombin -> inhibits Xa + IIa (1:1)","Activates antithrombin -> mainly inhibits Xa (3:1)"], ["Route","IV or SC","SC only"], ["Monitoring","APTT (target 60-100 sec)","Not routine (anti-Xa if needed)"], ["Reversal","Protamine sulfate","Protamine partially effective"], ["HIT risk","Higher","Lower"], ["Preferred in","Renal failure (titratable), cardiac surgery","DVT prophylaxis/treatment, pregnancy"], ], col_widths=[3.5*cm, 6.5*cm, 8*cm])) story += h2("Warfarin — MOA & Uses") story.append(body("<b>MOA:</b> Inhibits vitamin K epoxide reductase -> reduces activation of clotting factors II, VII, IX, X (and protein C, S) — vitamin K-dependent factors")) story.append(body("<b>Onset:</b> 36-72 hours (existing factors must deplete). Monitored by INR (target 2-3 for most indications).")) story += h3("Uses:") for b in ["DVT/PE treatment and prevention", "AF (stroke prevention)", "Prosthetic heart valves (INR 2.5-3.5)", "Bridging with heparin until INR therapeutic"]: story.append(bullet(b)) story += h3("Drug interactions:") for b in ["Enhance warfarin (increase bleeding): aspirin, NSAIDs, cimetidine, metronidazole, fluconazole, amiodarone", "Reduce warfarin (clotting risk): rifampicin (enzyme induction), carbamazepine, vitamin K, cholestyramine"]: story.append(bullet(b)) story.append(key("Warfarin reversal: Vitamin K (oral/IV), FFP (immediate), Prothrombin Complex Concentrate")) story += h2("Fibrinolytic Agents") story.append(tbl([ ["Drug","MOA","Features"], ["Streptokinase","Combines with plasminogen -> activates all plasminogen (fibrin + circulating)","Antigenic (bacteria-derived); cannot repeat in 6 months; cheaper"], ["Alteplase (tPA)","Binds fibrin-bound plasminogen selectively","Fibrin-specific; non-antigenic; expensive; preferred for stroke"], ["Tenecteplase (TNK-tPA)","Modified tPA; fibrin-specific","Single IV bolus; convenient"], ["Urokinase","Directly converts plasminogen to plasmin","Non-antigenic"], ], col_widths=[4*cm, 7*cm, 7*cm])) story += h3("Indications:") for b in ["STEMI (when PCI not available within 120 min)", "Massive PE with haemodynamic instability", "Ischaemic stroke within 4.5 hr (alteplase/tenecteplase)", "DVT (massive, limb-threatening)"]: story.append(bullet(b)) story.append(key("Streptokinase vs Alteplase: SK is antigenic, cheaper, no fibrin-selectivity; tPA is fibrin-specific, non-antigenic, preferred in stroke/re-treatment")) story += h2("Antiplatelet Drugs") story.append(tbl([ ["Drug","MOA","Use"], ["Aspirin","Irreversible COX-1 inhibition -> reduced TXA2","Acute MI, ACS, secondary prevention of stroke"], ["Clopidogrel","Irreversible P2Y12 ADP receptor block","ACS, post-PCI stenting (dual therapy with aspirin)"], ["Ticagrelor","Reversible P2Y12 block","Faster onset than clopidogrel; preferred in ACS"], ["Prasugrel","Irreversible P2Y12 block","ACS with PCI; AVOID in >75yr, prior stroke, low weight"], ["Dipyridamole","Inhibits phosphodiesterase + adenosine uptake -> increases cAMP/cGMP","Combined with aspirin (stroke prevention); stress testing"], ["Abciximab (GPIIb/IIIa inhibitor)","Blocks GPIIb/IIIa -> prevents fibrinogen binding","High-risk PCI; ACS"], ], col_widths=[3.5*cm, 7*cm, 7.5*cm])) story += h2("Low Molecular Weight Heparins (LMWH)") for b in ["Examples: Enoxaparin (Clexane), Dalteparin, Tinzaparin, Reviparin", "MOA: Bind antithrombin III -> inactivate mainly factor Xa (anti-Xa:anti-IIa = 3:1)", "Advantages over UFH: predictable response (weight-based SC dosing), no routine monitoring, lower HIT risk, once/twice daily dosing", "Uses: DVT prophylaxis, DVT/PE treatment, ACS (with aspirin), pregnancy (safer than warfarin)"]: story.append(bullet(b)) story.append(PageBreak()) # ═══════════════════════════════════════════════════════════════════════════════ story += h1("14. HIGH-YIELD QUICK REFERENCE TABLES") # ═══════════════════════════════════════════════════════════════════════════════ story += h2("Drugs of Choice (DOC) — Must Know") story.append(tbl([ ["Condition","DOC / First-line"], ["Anaphylaxis","Adrenaline 0.5mg IM (1:1000)"], ["Acute SVT","Adenosine 6mg rapid IV"], ["Vasospastic (Prinzmetal) angina","Nifedipine / Amlodipine (CCB)"], ["Hypertension in pregnancy","Methyldopa (first-line); Labetalol; Nifedipine"], ["Hypertensive emergency","IV Sodium nitroprusside / Labetalol"], ["Subarachnoid haemorrhage","Nimodipine (cerebral vasospasm)"], ["Post-MI (reduce remodelling)","ACE Inhibitor + Beta-blocker + Aspirin + Statin"], ["Hypertension with DM/CKD","ACE Inhibitor or ARB"], ["Hypertension with BPH","Alpha-1 blocker (Tamsulosin/Prazosin)"], ["Acute pulmonary oedema","IV Furosemide + IV GTN + Morphine"], ["OPC poisoning","Atropine + Pralidoxime"], ["Iron poisoning","Deferoxamine"], ["Warfarin toxicity","Vitamin K + FFP"], ["Heparin toxicity","Protamine sulfate"], ["Non-depolarising NMB reversal","Neostigmine + Atropine"], ["Myasthenia Gravis","Pyridostigmine"], ["Glaucoma (chronic open-angle)","Latanoprost (PGF2a analogue)"], ["AF rate control","Digoxin / Verapamil / Diltiazem / Beta-blocker"], ["Bradycardia/AV block (acute)","Atropine IV; temporary pacing"], ["STEMI (thrombolysis when no PCI)","Streptokinase or Alteplase"], ], col_widths=[8*cm, 10*cm])) story += h2("Key Drug Comparisons at a Glance") story.append(tbl([ ["Comparison","Key Difference"], ["Streptokinase vs Alteplase","SK: antigenic, non-fibrin specific, cheaper; tPA: fibrin-specific, non-antigenic, used in stroke"], ["Depolarising vs Non-depolarising NMB","Succinylcholine: rapid onset, not reversed by neostigmine; NDNMBs reversed by neostigmine+atropine"], ["UFH vs LMWH","UFH: IV, monitored by APTT, full reversal; LMWH: SC, no routine monitoring, lower HIT"], ["Loop vs Thiazide diuretics","Loop (furosemide): potent, hypocalcaemia; Thiazide: mild, hypercalcaemia, hyperglycaemia"], ["ACE inhibitor vs ARB","ACEI: cough/angioedema (bradykinin); ARB: no cough — main advantage"], ["Atropine vs Tropicamide","Atropine: 2 weeks mydriasis (uveitis/amblyopia); Tropicamide: 4-6 hr (fundus exam)"], ["Reversible vs Irreversible anticholinesterase","Reversible (neostigmine): spontaneous bond hydrolysis; Irreversible (OPC): covalent phosphorylation; pralidoxime reactivates if given early"], ], col_widths=[5.5*cm, 12.5*cm])) story += h2("Important Drug ADR Mnemonics") story.append(tbl([ ["Drug","Characteristic ADR — Remember"], ["ACE Inhibitors","Dry cough (bradykinin); angioedema; hyperkalaemia; teratogenic"], ["Amiodarone","TPFC: Thyroid (hypo/hyper), Pulmonary fibrosis, corneal deposits (Fluorescent), hepatotoxicity; photosensitivity"], ["Digoxin","Xanthopsia (yellow vision); nausea; arrhythmias; narrow TI"], ["Furosemide","Hypokalaemia; ototoxicity (+ aminoglycosides); hyperuricaemia"], ["Spironolactone","Hyperkalaemia; gynaecomastia; menstrual irregularities"], ["Beta-blockers","Bronchoconstriction; bradycardia; cold extremities; mask hypoglycaemia; rebound on withdrawal"], ["Succinylcholine","Fasciculations; hyperkalaemia (burns/crush); malignant hyperthermia; raised IOP/ICP"], ["Warfarin","Bleeding; teratogenic (fetal warfarin syndrome); interactions with many drugs"], ["Thiazides","HGULA: Hyperglycaemia, Gout (hyperuricaemia), hyperUricaemia, hyponatraemia, hypercaLcaemia, Alkalosis"], ["Atropine","ABCDE: Anticholinergic: Blurred vision, Constipation, Dry mouth, Elevated HR, urinary retention"], ], col_widths=[4.5*cm, 13.5*cm])) story += h2("Fixed Dose Combinations (FDCs) — Key Examples") story.append(tbl([ ["FDC","Components","Rationale"], ["Co-trimoxazole","Trimethoprim + Sulfamethoxazole","Sequential folate block = synergistic"], ["Co-amoxiclav","Amoxicillin + Clavulanic acid","Beta-lactamase inhibitor extends spectrum"], ["Carbidopa + Levodopa","Carbidopa + Levodopa","Peripheral DOPA decarboxylase inhibition -> more levodopa to brain"], ["Ferrous + Folic acid","Iron + Folic acid","Prevents both iron deficiency + neural tube defects in pregnancy"], ["Salbutamol + Ipratropium","Beta-2 + Anticholinergic","Additive bronchodilation in COPD"], ], col_widths=[5*cm, 5.5*cm, 7.5*cm])) story += h2("Pregnancy — Drug Categories (Key D/X Drugs)") preg = [["Category D (avoid)","Valproate (NTD), Warfarin (fetal warfarin syndrome), ACE Inhibitors (renal agenesis 2nd/3rd trimester), Tetracycline (teeth/bone), Aminoglycosides (ototoxicity), Benzodiazepines (floppy infant)"], ["Category X (contraindicated)","Thalidomide, Isotretinoin, Misoprostol (if not for termination), Methotrexate, Ribavirin, Statins"], ["Safe in pregnancy","Penicillins, Cephalosporins, Erythromycin, Methyldopa, Nifedipine, Labetalol, Heparin, Insulin"], ["DOC for HTN in pregnancy","Methyldopa (most data), Labetalol, Nifedipine; AVOID ACEIs/ARBs"]] story.append(tbl([["Category","Key Drugs"]] + preg, col_widths=[5*cm, 13*cm])) # Footer note story.append(sp(8)) story.append(HRFlowable(width="100%", thickness=1, color=colors.HexColor('#003366'), spaceAfter=4)) story.append(Paragraph("Pharmacology Paper I — Quick Revision | Based on Shanbhag's Review of Pharmacology | Generated July 2026", ParagraphStyle('footer', parent=styles['Normal'], fontSize=7, textColor=colors.HexColor('#888888'), alignment=TA_CENTER))) # ─── BUILD ──────────────────────────────────────────────────────────────────── doc.build(story) print("PDF built successfully!") import os size = os.path.getsize("/home/daytona/workspace/Pharmacology_Quick_Revision.pdf") print(f"File size: {size/1024:.1f} KB") PYEOF
python3 -c " from pypdf import PdfReader r = PdfReader('/home/daytona/workspace/Pharmacology_Quick_Revision.pdf') print(f'Pages: {len(r.pages)}') import os print(f'Size: {os.path.getsize(\"/home/daytona/workspace/Pharmacology_Quick_Revision.pdf\")/1024:.1f} KB') "
ls /home/daytona/workspace/*.pdf 2>/dev/null; ls /home/daytona/workspace/*.py 2>/dev/null; ls /home/daytona/workspace/
cd /home/daytona/workspace && python3 build_pharma_revision.py && ls -lh *.pdf
cd /home/daytona/workspace && python3 -c " from pypdf import PdfReader r = PdfReader('Pharmacology_Quick_Revision.pdf') print(f'Total pages: {len(r.pages)}') # Sample text from first page print(r.pages[0].extract_text()[:300]) "
cd /home/daytona/workspace && python3 -c " from pypdf import PdfReader r = PdfReader('Pharmacology_Quick_Revision.pdf') print(f'Total pages: {len(r.pages)}') # Check last page print('--- LAST PAGE ---') print(r.pages[-1].extract_text()[:500]) print('--- PAGE 10 ---') print(r.pages[9].extract_text()[:400]) "
Pharmacology Quick Revision
PDF Document · PDF
| Page(s) | Topic |
|---|---|
| 1 | Routes of Administration + TTS patches |
| 2-3 | Pharmacokinetics — Bioavailability, t½, Biotransformation, Prodrugs, TDM |
| 4 | Pharmacodynamics, Drug Antagonism, Drug Interactions (+ beneficial interactions table) |
| 5 | ADRs classification, Factors affecting drug action |
| 6 | Cholinergic drugs, Anticholinesterases, OPC poisoning management |
| 7 | Atropine, Myasthenia Gravis treatment |
| 8 | Adrenaline, Adrenergic classification, Alpha/Beta blockers, Glaucoma drugs |
| 9 | Skeletal Muscle Relaxants (Succinylcholine, NDNMBs) |
| 10 | ACE Inhibitors & ARBs (MOA, uses, ADR comparison table) |
| 11 | CHF drugs — mortality table, Digoxin, Digitalis toxicity, Spironolactone |
| 12 | Antiarrhythmic drugs (Vaughan Williams), Antianginal (GTN, CCBs, MI management) |
| 13 | Antihypertensives classification, Hypertensive emergency, Diuretics, Furosemide |
| 14 | Iron preparations (oral/parenteral), Iron poisoning stages + deferoxamine |
| 15 | Anticoagulants (UFH vs LMWH), Warfarin, Fibrinolytics (SK vs tPA), Antiplatelets |
| 15 | High-yield tables: DOCs, drug comparisons, ADR mnemonics, FDCs, pregnancy categories |
Keep all the information intact and compress it as much less pages possi le for quick revision for exam
python3 -c " import pdfplumber with pdfplumber.open('/home/daytona/workspace/attachments/6b027af5-b8f9-4a6a-b33d-9aa5bc792ae4/kome-default (1).pdf') as pdf: print(f'Total pages: {len(pdf.pages)}') for i, page in enumerate(pdf.pages[:3]): text = page.extract_text() if text: print(f'--- PAGE {i+1} ---') print(text[:600]) " 2>&1
Keep all the information intact and compress it as much less pages possible for quick revision for exam
python3 -c " import os # Check what we have files = os.listdir('/home/daytona/workspace/') print(files) # Check size of cleaned text if 'pharma_cleaned.txt' in files: with open('/home/daytona/workspace/pharma_cleaned.txt') as f: t = f.read() print(f'Cleaned text: {len(t)} chars, {len(t.split(chr(10)))} lines') # Show first unique section titles import re lines = t.split(chr(10)) unique = [] seen = set() for l in lines: l = l.strip() if re.match(r'^(SN|LAQ|SAQ)\s+\d+\.', l) and l not in seen: seen.add(l) unique.append(l) print(f'Unique SN/LAQ topics: {len(unique)}') # Find the mid-point of document (since it seems duplicated) half_marker = t.find('PHARMACOLOGY PAPER I', 5000) print(f'Duplicate starts at char: {half_marker}') "
python3 -c " with open('/home/daytona/workspace/pharma_cleaned.txt') as f: t = f.read() # Take only unique first half unique = t[:105121] print(f'Unique content: {len(unique)} chars') # Show all topic headings import re lines = unique.split(chr(10)) for i,l in enumerate(lines): ls = l.strip() if re.match(r'^(SN|LAQ|SAQ)\s+\d+\.', ls) or re.match(r'^[A-Z][A-Z\s&\-]+$', ls) and len(ls)>4 and len(ls)<80: print(f'{i:4d}: {ls[:100]}') " | head -120
python3 -c " with open('/home/daytona/workspace/pharma_cleaned.txt') as f: t = f.read() unique = t[:105121] lines = unique.split('\n') # Print key content blocks we need def get_block(start_ln, end_ln): return '\n'.join(lines[start_ln:end_ln]) # Sample several important sections fully print('=== KINETICS SN4 (lines 70-83) ===') print(get_block(70,84)) print() print('=== BIOAVAILABILITY (lines 103-141) ===') print(get_block(103,142)) print() print('=== BIOTRANSFORMATION (240-307) ===') print(get_block(240,308)) " 2>&1 | head -250
python3 -c " with open('/home/daytona/workspace/pharma_cleaned.txt') as f: t = f.read() unique = t[:105121] lines = unique.split('\n') def get_block(s,e): return '\n'.join(lines[s:e]) print('=== DRUG INTERACTIONS (365-477) ===') print(get_block(365,478)) " 2>&1 | head -200
python3 -c " with open('/home/daytona/workspace/pharma_cleaned.txt') as f: t = f.read() unique = t[:105121] lines = unique.split('\n') def get_block(s,e): return '\n'.join(lines[s:e]) # Get remaining important sections print('=== PHARMACOTHERAPY/TOLERANCE (478-596) ===') print(get_block(478,597)) " 2>&1 | head -150
python3 -c " with open('/home/daytona/workspace/pharma_cleaned.txt') as f: t = f.read() unique = t[:105121] lines = unique.split('\n') def get_block(s,e): return '\n'.join(lines[s:e]) print('=== ADRs + PHARMACOVIGILANCE (597-674) ===') print(get_block(597,675)) " 2>&1 | head -150
python3 -c " with open('/home/daytona/workspace/pharma_cleaned.txt') as f: t = f.read() unique = t[:105121] lines = unique.split('\n') def get_block(s,e): return '\n'.join(lines[s:e]) print('=== ANS CHOLINERGIC (675-843) ===') print(get_block(675,844)) " 2>&1 | head -230
python3 -c " with open('/home/daytona/workspace/pharma_cleaned.txt') as f: t = f.read() unique = t[:105121] lines = unique.split('\n') def get_block(s,e): return '\n'.join(lines[s:e]) print('=== ATROPINE + ADRENERGIC (844-1052) ===') print(get_block(844,1053)) " 2>&1 | head -280
python3 -c " with open('/home/daytona/workspace/pharma_cleaned.txt') as f: t = f.read() unique = t[:105121] lines = unique.split('\n') def get_block(s,e): return '\n'.join(lines[s:e]) print('=== GLAUCOMA + BETA BLOCKERS + ALPHA BLOCKERS + SMR (1053-1315) ===') print(get_block(1053,1316)) " 2>&1 | head -350
python3 -c " with open('/home/daytona/workspace/pharma_cleaned.txt') as f: t = f.read() unique = t[:105121] lines = unique.split('\n') def get_block(s,e): return '\n'.join(lines[s:e]) print('=== CVS DRUGS: RAAS + CHF + ANTIARRHYTHMICS (1316-1820) ===') print(get_block(1316,1640)) " 2>&1 | head -300
Make it fast
ls /home/daytona/workspace/*.pdf /home/daytona/workspace/pharma_cleaned.txt 2>/dev/null
Keep all the information intact and compress it as much less pages possible for quick revision for exam
ls /home/daytona/workspace/pharma_cleaned.txt && python3 -c " with open('/home/daytona/workspace/pharma_cleaned.txt') as f: t = f.read() print(f'chars: {len(t)}, half marker at: {t.find(chr(10)+\"PHARMACOLOGY PAPER I\", 5000)}') "
Keep all the information intact and compress it as much less pages possible for quick revision for exam