*Assignment for 17-07-26* *Sedative Hypnotics & Antiepileptic Drugs* 1.Classify antiepileptic drugs and explain the mechanism of action, therapeutic uses, and adverse effects of Phenytoin. 2.Write a short note on newer antiepileptic agents. 3.Classify sedative-hypnotics. Discuss the mechanism of action, pharmacological actions, adverse effects, clinical uses, contraindications, and indications of Diazepam. 4.Write a short note on non-benzodiazepine hypnotics 5.Management of barbiturate poisoning. *Assignment for 21-07-26* *General Anaesthetics* 1.Classify general anaesthetics and add a note on the pharmacology of Halothane. 2.Adverse effects of general anaesthesia during and after anaesthesia. 3.Short note on pre-anaesthetic medication. 4.What are intravenous anaesthetics? Add a note on the pharmacology of Propofol Give answers with 3 pages for assignment with the reference of kdt 8th edition no question should go above 3 pages

Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
general-purpose

Create a Word document (.docx) for a pharmacology assignment dated 17-07-26 on "Sedative Hypnotics & Antiepileptic Drugs". IMPORTANT: First run `ls -la /tmp/workspace/` to check the workspace, then create the directory `/tmp/workspace/assignments/` and write the Python script there. The document should be formatted as a student assignment with: - Title: "Assignment – 17-07-26: Sedative Hypnotics & Antiepileptic Drugs" - Reference: KD Tripathi Essentials of Medical Pharmacology, 8th Edition - Each answer should be ~3 pages worth of content (approximately 700-900 words per answer, with appropriate subheadings) - Use Heading 1 for question numbers (Q.1, Q.2, etc.), Heading 2 for subheadings within answers - Font: Times New Roman, size 12 for body text - Line spacing: 1.5 lines Write a Python script using python-docx to generate this document. Save to `/tmp/workspace/assignments/Assignment_17_07_26.docx` Here is the FULL content for each question: --- **Q.1 Classify antiepileptic drugs and explain the mechanism of action, therapeutic uses, and adverse effects of Phenytoin.** **CLASSIFICATION OF ANTIEPILEPTIC DRUGS (KDT 8th Ed.)** **Based on Chemical Structure:** 1. Hydantoins: Phenytoin, Fosphenytoin 2. Barbiturates: Phenobarbitone, Primidone 3. Iminostilbenes: Carbamazepine, Oxcarbazepine 4. Succinimides: Ethosuximide 5. Benzodiazepines: Diazepam, Clonazepam, Lorazepam 6. Valproate: Sodium valproate, Valproic acid 7. Newer agents: Lamotrigine, Levetiracetam, Gabapentin, Pregabalin, Topiramate, Vigabatrin, Tiagabine, Zonisamide, Lacosamide, Perampanel **Based on Mechanism of Action:** 1. Sodium channel blockers: Phenytoin, Carbamazepine, Valproate, Lamotrigine, Topiramate 2. Calcium channel blockers (T-type): Ethosuximide, Valproate 3. GABA enhancers: Benzodiazepines, Barbiturates, Vigabatrin, Tiagabine, Gabapentin 4. Glutamate antagonists: Lamotrigine, Topiramate, Perampanel 5. Unique mechanisms: Levetiracetam (SV2A binding) **PHENYTOIN (Diphenylhydantoin)** **Mechanism of Action:** Phenytoin acts primarily by blocking voltage-gated sodium channels in a use-dependent (frequency-dependent) manner. It preferentially binds to the inactivated state of the Na+ channel and prolongs its inactivation, thereby reducing sustained high-frequency repetitive firing of action potentials in epileptic foci without significantly affecting normal neuronal function. Additionally, it reduces calcium influx through L-type calcium channels at high concentrations and inhibits calmodulin kinase, which modulates neurotransmitter release. The overall effect is stabilization of neuronal membranes and suppression of epileptiform activity. **Pharmacokinetics:** - Absorption: Variable oral absorption; phenytoin sodium capsules preferred (extended release) - Protein binding: ~90% bound to plasma albumin - Metabolism: Hepatic via CYP2C9/CYP2C19 (zero-order/saturable kinetics at therapeutic doses) - Half-life: 20-30 hours (highly variable; dose-dependent) - Exhibits non-linear (Michaelis-Menten) pharmacokinetics - small dose increases can cause disproportionate rise in plasma levels **Therapeutic Uses:** 1. Epilepsy: - Drug of choice (DOC) or first-line for: Generalized tonic-clonic (grand mal) seizures, Focal (partial) seizures with or without secondary generalization - Status epilepticus: IV phenytoin/fosphenytoin (second-line after benzodiazepines) - NOT effective for absence (petit mal) seizures - may worsen them 2. Trigeminal neuralgia (second-line, after carbamazepine) 3. Cardiac arrhythmias: Digoxin-induced arrhythmias, ventricular arrhythmias (rarely used now) 4. Neuropathic pain (adjuvant use) **Adverse Effects:** *Dose-related (concentration-dependent):* - Nystagmus (earliest sign at plasma levels >20 mcg/mL) - Diplopia and ataxia (cerebellar signs) - Confusion, cognitive impairment - Sedation, slurred speech *Idiosyncratic/hypersensitivity:* - Skin rashes (morbilliform), rarely Stevens-Johnson syndrome, toxic epidermal necrolysis - Drug reaction with eosinophilia and systemic symptoms (DRESS) - Hepatotoxicity (rare) *Chronic toxicity:* - Gingival hyperplasia (due to inhibition of collagen metabolism; especially in children; avoid in epileptic children) - most characteristic side effect - Hirsutism (especially in young women) - Coarsening of facial features - Peripheral neuropathy (long-term use) - Megaloblastic anemia (due to folate deficiency - impairs folate absorption) - Osteomalacia (induces CYP enzymes, increasing Vitamin D metabolism) - Cerebellar atrophy (chronic high doses) *Teratogenicity:* - Fetal hydantoin syndrome: cleft palate, cleft lip, cardiac defects, growth retardation, digital hypoplasia, nail hypoplasia *Drug interactions:* - Induces CYP enzymes (CYP1A2, CYP2C, CYP3A) - reduces efficacy of OCP, warfarin, corticosteroids - Displaced by valproate from protein binding - increases free phenytoin levels - Inhibited by isoniazid, chloramphenicol, cimetidine - raises phenytoin levels --- **Q.2 Write a short note on newer antiepileptic agents.** **NEWER ANTIEPILEPTIC DRUGS (Third Generation)** The newer antiepileptic drugs (AEDs) were developed to overcome the limitations of older agents - particularly to reduce drug interactions, improve tolerability, and offer broader spectrum activity. **1. Lamotrigine** - MOA: Blocks voltage-sensitive Na+ channels (use-dependent); also inhibits glutamate release - Uses: Broad spectrum - partial seizures, generalized tonic-clonic, absence, Lennox-Gastaut syndrome, bipolar disorder - ADRs: Skin rash (can progress to Stevens-Johnson syndrome - especially if dose escalated rapidly), dizziness, diplopia, headache - Advantage: Safe in pregnancy (relatively); no enzyme induction **2. Levetiracetam** - MOA: Binds to synaptic vesicle protein SV2A, modulating neurotransmitter release (unique mechanism) - Uses: Partial seizures, myoclonic epilepsy (drug of choice for juvenile myoclonic epilepsy), generalized tonic-clonic - ADRs: Somnolence, behavioral disturbances (irritability, aggression), headache - Advantages: No hepatic metabolism, minimal drug interactions, no enzyme induction, safe in pregnancy **3. Gabapentin** - MOA: Binds to α2δ subunit of voltage-gated Ca2+ channels, reducing calcium influx and neurotransmitter release (does NOT actually act on GABA receptors despite its name) - Uses: Partial seizures, neuropathic pain (postherpetic neuralgia, diabetic neuropathy), restless leg syndrome, fibromyalgia - ADRs: Dizziness, somnolence, ataxia, peripheral edema, weight gain **4. Pregabalin** - MOA: Same as gabapentin (α2δ subunit of Ca2+ channels) but more potent and predictable absorption - Uses: Partial seizures, neuropathic pain, generalized anxiety disorder, fibromyalgia - ADRs: Dizziness, somnolence, weight gain, peripheral edema **5. Topiramate** - MOA: Multiple - Na+ channel blockade, GABA-A enhancement, AMPA/kainate glutamate receptor blockade, carbonic anhydrase inhibition - Uses: Partial and generalized seizures, migraine prophylaxis, Lennox-Gastaut syndrome - ADRs: Cognitive impairment ("dopamax" - word-finding difficulty), weight loss, nephrolithiasis (kidney stones - due to CA inhibition), metabolic acidosis, angle-closure glaucoma (acute), paresthesias **6. Vigabatrin** - MOA: Irreversible inhibitor of GABA-transaminase (the enzyme that degrades GABA), thereby increasing brain GABA levels - Uses: Infantile spasms (West syndrome - DOC), partial seizures refractory to other drugs - ADRs: Visual field defects (irreversible bilateral concentric visual field constriction - limits its use), sedation, weight gain **7. Tiagabine** - MOA: Blocks GABA reuptake transporter (GAT-1), increasing synaptic GABA - Uses: Adjunctive therapy in partial seizures - ADRs: Dizziness, nervousness, confusion, may precipitate non-convulsive status epilepticus **8. Lacosamide** - MOA: Enhances slow inactivation of Na+ channels; also modulates CRMP-2 (collapsin response mediator protein-2) - Uses: Partial-onset seizures (adjunctive) - ADRs: Dizziness, diplopia, PR interval prolongation **9. Perampanel** - MOA: Selective non-competitive AMPA (α-amino-3-hydroxy-5-methyl-4-isoxazolepropionic acid) glutamate receptor antagonist - Uses: Partial and generalized tonic-clonic seizures (adjunctive) - ADRs: Dizziness, aggression, psychiatric disturbances **10. Zonisamide** - MOA: Na+ channel blockade, T-type Ca2+ channel blockade, carbonic anhydrase inhibition - Uses: Partial seizures, juvenile myoclonic epilepsy, Lennox-Gastaut - ADRs: Somnolence, anorexia, nephrolithiasis, oligohydrosis (decreased sweating) --- **Q.3 Classify sedative-hypnotics. Discuss the mechanism of action, pharmacological actions, adverse effects, clinical uses, contraindications, and indications of Diazepam.** **CLASSIFICATION OF SEDATIVE-HYPNOTICS (KDT 8th Ed.)** **I. Benzodiazepines:** - Long-acting: Diazepam, Chlordiazepoxide, Clonazepam, Clorazepate - Intermediate-acting: Alprazolam, Lorazepam, Oxazepam, Temazepam - Short-acting: Triazolam, Midazolam **II. Barbiturates:** - Ultra-short acting: Thiopentone - Short-acting: Pentobarbitone, Secobarbitone - Intermediate-acting: Butobarbitone, Amobarbitone - Long-acting: Phenobarbitone **III. Non-benzodiazepine hypnotics (Z-drugs):** - Zolpidem, Zaleplon, Zopiclone, Eszopiclone **IV. Melatonin receptor agonists:** - Ramelteon, Melatonin **V. Orexin (hypocretin) receptor antagonists:** - Suvorexant, Lemborexant **VI. Others:** - Buspirone (anxiolytic, not hypnotic) - Antihistamines (promethazine, diphenhydramine) - Chloral hydrate, Paraldehyde (older agents) --- **DIAZEPAM** **Mechanism of Action:** Diazepam acts as a positive allosteric modulator of GABA-A receptor. The GABA-A receptor is a ligand-gated Cl- ion channel consisting of 5 subunits (typically 2α, 2β, 1γ). Diazepam binds to the benzodiazepine binding site located at the interface of α and γ subunits (specifically α1, α2, α3, α5 subunits). This binding does not directly open the channel but increases the frequency of Cl- channel opening in response to GABA. The resultant increased Cl- influx leads to hyperpolarization of the neuronal membrane, enhancing inhibitory neurotransmission and producing sedation, anxiolysis, muscle relaxation, and anticonvulsant effects. Note: Barbiturates act on a different site on GABA-A receptor and increase the duration of Cl- channel opening (not frequency). **Pharmacokinetics:** - Lipid soluble → rapid CNS penetration after IV/IM administration - Oral bioavailability: ~100%; IM absorption erratic (use IV or oral preferred) - Protein binding: ~98% - Metabolism: Hepatic (CYP2C19, CYP3A4) → active metabolites: desmethyldiazepam (nordazepam), oxazepam, temazepam - Half-life: Parent: 20-70 hours; desmethyldiazepam: 36-200 hours (cumulative effect) - Excreted in urine as glucuronide conjugates **Pharmacological Actions:** 1. Anxiolysis: Reduces anxiety at sub-sedative doses; acts on limbic system 2. Sedation and Hypnosis: Dose-dependent CNS depression; decreases sleep latency, reduces REM sleep 3. Anticonvulsant: Suppresses seizure spread; elevates seizure threshold 4. Muscle relaxation: Acts on spinal cord interneurons (polysynaptic inhibition) and supraspinal sites 5. Anterograde amnesia: Impairs formation of new memories 6. Cardiovascular: Minimal effects at therapeutic doses; slight fall in BP 7. Respiratory: Mild respiratory depression (dose-dependent); dangerous in COPD patients **Clinical Uses:** 1. Anxiety disorders: Generalized anxiety disorder, panic disorder, situational anxiety (short-term use only) 2. Insomnia: Short-term management; not preferred for long-term due to dependence 3. Seizures/Epilepsy: - Status epilepticus: IV diazepam is first-line treatment (0.15 mg/kg IV, repeat after 5 min if needed) - Febrile seizures: Rectal diazepam for acute management - Alcohol withdrawal seizures 4. Muscle spasm: Skeletal muscle spasm, spastic conditions (cerebral palsy, tetanus) 5. Pre-anaesthetic medication: Reduces anxiety, produces amnesia before surgery 6. Procedural sedation: For endoscopy, cardioversion, minor surgical procedures 7. Alcohol and drug withdrawal: Prevents withdrawal seizures and delirium tremens 8. Night terrors and somnambulism (sleep walking) 9. Tetanus: IV diazepam for muscle spasm control **Adverse Effects:** 1. CNS: Drowsiness, sedation, cognitive impairment, anterograde amnesia, psychomotor impairment 2. Paradoxical reactions: Increased anxiety, aggression, disinhibition (especially in elderly and children) 3. Respiratory depression: Especially with opioids, alcohol, or in COPD patients 4. Cardiovascular: Hypotension (with IV use) 5. Dependence and tolerance: Physical and psychological dependence with long-term use; tolerance to sedative/hypnotic effects (not anxiolytic) 6. Withdrawal syndrome: Anxiety, tremor, sweating, insomnia, seizures (life-threatening in abrupt discontinuation) 7. Hangover effect: Residual sedation next morning (due to long half-life) 8. Thrombophlebitis: With IV diazepam (due to insolubility in water; use emulsion preparation) **Contraindications:** - Myasthenia gravis (worsens neuromuscular blockade) - Respiratory depression / COPD / Sleep apnea - Severe hepatic impairment - Narrow-angle glaucoma - Pregnancy (Category D) - crosses placenta; neonatal respiratory depression, "floppy infant syndrome," cleft palate - Breastfeeding - Acute alcohol intoxication - Known hypersensitivity to benzodiazepines **Antidote:** Flumazenil - competitive antagonist at benzodiazepine binding site; IV use; short-acting (resedation can occur) --- **Q.4 Write a short note on non-benzodiazepine hypnotics.** **NON-BENZODIAZEPINE HYPNOTICS (Z-DRUGS) (KDT 8th Ed.)** Non-benzodiazepine hypnotics are a class of GABA-A receptor modulators that were developed as safer alternatives to benzodiazepines for the treatment of insomnia. Although they share the same receptor target, they differ in receptor subtype selectivity, producing more selective hypnotic effects with fewer anxiolytic, anticonvulsant, and muscle relaxant properties. **Drugs in this class:** 1. Zolpidem (most widely used) 2. Zaleplon 3. Zopiclone 4. Eszopiclone (S-isomer of zopiclone; FDA-approved) **Mechanism of Action:** These drugs act on GABA-A receptors, specifically at the benzodiazepine binding site (BZ1/ω1 receptor), but show preferential selectivity for receptors containing α1 subunits (vs. benzodiazepines which also bind α2, α3, α5). This α1 selectivity is responsible for their preferential hypnotic effect (α1 mediates sedation/hypnosis) with relatively less anxiolytic and muscle relaxant activity (mediated by α2/α3 subunits). **Individual Drug Profiles:** *Zolpidem:* - Onset: Rapid (15-30 min); Duration: 6-8 hours - Uses: Short-term insomnia (sleep onset and maintenance) - ADRs: Drowsiness, dizziness, headache; complex sleep behaviors (sleepwalking, sleep-driving - FDA black box warning), anterograde amnesia; next-day impairment *Zaleplon:* - Ultra-short half-life (1 hour) - safest for middle-of-night awakening - Minimal next-day hangover - ADRs: Headache, dizziness; less complex sleep behaviors *Zopiclone/Eszopiclone:* - Duration: 6-8 hours - Bitter metallic taste (characteristic side effect) - Eszopiclone: Approved for long-term use (up to 6 months) **Comparison with Benzodiazepines:** | Feature | BZDs | Z-drugs | |---------|------|---------| | Receptor selectivity | α1, α2, α3, α5 | Mainly α1 | | Anxiolytic | Yes | Minimal | | Anticonvulsant | Yes | Minimal | | Muscle relaxant | Yes | Minimal | | Dependence risk | Higher | Lower (but not zero) | | Sleep architecture | Suppresses REM | Better preserved | | Next-day impairment | More | Less | **Advantages over benzodiazepines:** - Less disruption of sleep architecture (normal REM sleep relatively preserved) - Less tolerance and dependence (though abuse potential exists, especially zolpidem) - Less next-morning hangover - Shorter half-life for most agents **Adverse effects of Z-drugs:** - CNS: Drowsiness, dizziness, cognitive impairment - Complex sleep behaviors: Sleep-walking, sleep-eating, sleep-driving (FDA black box warning for all Z-drugs) - especially with zolpidem - Anterograde amnesia - Tolerance and dependence (especially with long-term use of zolpidem) - Rebound insomnia on discontinuation - Metallic taste (zopiclone/eszopiclone) **Clinical use:** - Short-term treatment of insomnia (2-4 weeks maximum recommended) - Sleep-onset insomnia: Zaleplon (ultra-short), Zolpidem - Sleep maintenance insomnia: Eszopiclone, Zolpidem CR --- **Q.5 Management of Barbiturate Poisoning.** **BARBITURATE POISONING (KDT 8th Ed.)** Barbiturate poisoning is a serious medical emergency, commonly encountered in suicidal overdose or accidental ingestion. It manifests as progressive CNS and respiratory depression. **Clinical Features of Barbiturate Poisoning:** - Mild: Slurred speech, ataxia, nystagmus, confusion, drowsiness - Moderate: Deep sleep, sluggish reflexes, hypotension - Severe (Grades III-IV coma): - Coma with absent reflexes (including corneal reflex) - Severe respiratory depression → apnea - Cardiovascular collapse (hypotension, shock) - Hypothermia - Absent gag reflex → aspiration pneumonia - Hyporeflexia, flaccid limbs - "Bullous lesions" on skin (blisters) - pathognomonic feature of barbiturate/benzodiazepine coma **There is NO specific antidote for barbiturate poisoning.** Management is primarily supportive: **A. Supportive Care (Most Important):** *Airway and Breathing:* - Immediate endotracheal intubation and mechanical ventilation (for respiratory failure/apnea) - Maintain SpO2 >95%, PaCO2 35-45 mmHg - Avoid respiratory stimulants (analeptics like nikethamide - CONTRAINDICATED, may cause seizures) *Circulation:* - IV fluids (normal saline, Ringer's lactate) for hypotension - Vasopressors (dopamine, norepinephrine) if fluid-refractory hypotension - Treat hypothermia: Warming blankets, warm IV fluids *Monitoring:* - Continuous ECG monitoring - Urinary catheterization and hourly urine output measurement - Monitor blood pressure, temperature, electrolytes, arterial blood gas **B. Elimination of Poison:** *Gastric Decontamination:* - Gastric lavage: Within 1-2 hours of ingestion if airway is protected (cuffed ET tube in place) - Activated charcoal: 1 g/kg orally (or via NGT) - adsorbs barbiturates; can be given as multiple doses for long-acting barbiturates (multiple-dose activated charcoal/MDAC for phenobarbitone) - Do NOT induce emesis (aspiration risk in obtunded patient) *Urinary Alkalinization:* - IV sodium bicarbonate (0.5-1 mEq/kg followed by infusion to maintain urine pH 7.5-8.0) - Effective for LONG-ACTING barbiturates (phenobarbitone, which are weak acids; pKa ~7.4) - Alkaline urine → ionization of weak acid → trapping in tubular lumen → reduced reabsorption → increased renal excretion - NOT useful for short/ultra-short acting barbiturates *Forced Diuresis:* - IV furosemide + IV fluids to maintain urine output 100-200 mL/hour - Used with alkalinization for long-acting barbiturates *Dialysis:* - Hemodialysis or hemoperfusion (charcoal hemoperfusion most effective) for: - Severe poisoning not responding to supportive care - Renal failure - Long-acting barbiturate poisoning with very high serum levels - Phenobarbitone level >10 mg/dL (phenobarbitone is dialyzable) **C. Specific Measures:** - Correct hypoglycemia (IV dextrose 50%) - Thiamine 100 mg IV before glucose (especially in alcoholics) - Maintain normothermia - Prevent pressure sores: Positioning changes every 2 hours - Prevent aspiration pneumonia: Head-end elevation - Catheter care to prevent UTI **D. Monitoring and Follow-up:** - Repeated neurological assessment (Glasgow Coma Scale) - Drug levels (plasma barbiturate levels if available) - LFT, RFT, CBC monitoring - Psychiatric evaluation after recovery (for deliberate self-harm) **Prognosis:** With prompt and adequate supportive care, most patients recover fully. Respiratory complications (aspiration pneumonia) are the main cause of morbidity and mortality. **Key Points (KDT):** - NO analeptics (respiratory stimulants) - NO specific antidote - Urinary alkalinization only for long-acting barbiturates - Supportive care is the cornerstone of management --- Please write a Python script using python-docx to create this document with proper formatting. The file should be saved at `/tmp/workspace/assignments/Assignment_17_07_26.docx`. Use Heading 1 for "Q.1", "Q.2" etc., Heading 2 for subheadings like "CLASSIFICATION", "Mechanism of Action", etc. Body text should use Normal style with Times New Roman 12pt. Include a proper title page at the start. Run the script and confirm the file is created successfully.

general-purpose

Create a Word document (.docx) for a pharmacology assignment dated 21-07-26 on "General Anaesthetics". IMPORTANT: First run `ls -la /tmp/workspace/` to check the workspace, then create the directory `/tmp/workspace/assignments/` if not exists and write the Python script there. The document should be formatted as a student assignment with: - Title: "Assignment – 21-07-26: General Anaesthetics" - Reference: KD Tripathi Essentials of Medical Pharmacology, 8th Edition - Each answer should be ~3 pages worth of content (approximately 700-900 words per answer, with appropriate subheadings) - Use Heading 1 for question numbers (Q.1, Q.2, etc.), Heading 2 for subheadings within answers - Font: Times New Roman, size 12 for body text - Line spacing: 1.5 lines Write a Python script using python-docx to generate this document. Save to `/tmp/workspace/assignments/Assignment_21_07_26.docx` Here is the FULL content for each question: --- **Q.1 Classify general anaesthetics and add a note on the pharmacology of Halothane.** **CLASSIFICATION OF GENERAL ANAESTHETICS (KDT 8th Ed.)** **I. Inhalational Anaesthetics:** *A. Gases:* 1. Nitrous oxide (N2O) 2. Cyclopropane (obsolete) 3. Xenon (experimental) *B. Volatile Liquids (Halogenated hydrocarbons/ethers):* 1. Halothane (Fluothane) - halogenated alkane 2. Enflurane - halogenated ether 3. Isoflurane - halogenated ether (currently most widely used) 4. Desflurane - halogenated ether (very low blood-gas partition coefficient) 5. Sevoflurane - halogenated ether (most commonly used in pediatrics) 6. Methoxyflurane (analgesic doses) 7. Diethyl ether (obsolete, historical) 8. Chloroform (obsolete, toxic) 9. Trichloroethylene (obsolete) **II. Intravenous Anaesthetics:** *A. Induction Agents:* 1. Barbiturates: Thiopentone sodium, Methohexitone 2. Propofol (2,6-diisopropylphenol) - most widely used 3. Etomidate 4. Ketamine (dissociative anaesthetic) *B. Benzodiazepines (used for induction/sedation):* - Midazolam, Diazepam, Lorazepam *C. Opioid anaesthetics (neuroleptanalgesia):* - Fentanyl, Remifentanil, Sufentanil **Stages of General Anaesthesia (Guedel's classification - for ether):** - Stage I: Analgesia (conscious but pain reduced) - Stage II: Excitement/Delirium (unconscious, irregular breathing, vomiting risk - dangerous) - Stage III: Surgical Anaesthesia (four planes) - Plane 1: Regular breathing, eyes deviate - Plane 2: Ocular movements cease, conjugate gaze - Plane 3: Intercostal paralysis begins - Plane 4: Complete intercostal paralysis - Stage IV: Medullary depression (apnea, cardiovascular collapse, death) --- **PHARMACOLOGY OF HALOTHANE** Halothane (2-bromo-2-chloro-1,1,1-trifluoroethane) is a halogenated alkane that was introduced in 1956 and was formerly one of the most widely used inhalational anaesthetics, though largely replaced by newer agents. **Physical Properties:** - Non-flammable, non-explosive (major advantage over ether) - Sweet, pleasant odor - Volatile liquid at room temperature - Boiling point: 50.2°C - Blood-gas partition coefficient: 2.4 (moderate - slower induction than desflurane/sevoflurane but faster than ether) - Oil-gas partition coefficient: 224 (high potency; low MAC) - MAC (Minimum Alveolar Concentration): 0.75% (relatively potent) - Stored in amber bottles with thymol as preservative (prevents decomposition) **Mechanism of Action:** The precise mechanism is not fully elucidated. Halothane and other volatile anaesthetics are believed to act by: 1. Enhancing GABA-A receptor-mediated inhibitory neurotransmission (increase Cl- conductance) 2. Inhibiting NMDA (N-methyl-D-aspartate) glutamate receptors 3. Modulating K+ channels (two-pore domain K+ channels/TREK channels) causing hyperpolarization 4. Disrupting neuronal synaptic transmission through effects on membrane lipids (Meyer-Overton lipid theory - older concept, now less favored) The net result is global CNS depression producing unconsciousness, analgesia, and amnesia. **Pharmacological Actions:** *CNS:* - Produces all stages of anaesthesia rapidly - Good hypnosis and amnesia; moderate analgesia - Reduces cerebral metabolic rate but INCREASES cerebral blood flow (vasodilation) → increases ICP - Contraindicated in raised intracranial pressure *Cardiovascular:* - Myocardial depression: Reduces cardiac output and myocardial contractility (dose-dependent) - Hypotension: Fall in blood pressure (due to vasodilation + myocardial depression) - Bradycardia: Sensitizes myocardium to catecholamines → arrhythmias (particularly with adrenaline administration) - most important cardiac adverse effect - Halothane sensitizes the heart to adrenaline-induced arrhythmias (use of adrenaline with halothane is avoided or dose strictly limited) *Respiratory:* - Potent bronchodilator - useful in asthmatics - Respiratory depression (reduces tidal volume and respiratory rate) - Depresses hypoxic and hypercapnic ventilatory responses - Does NOT irritate respiratory tract (unlike ether, isoflurane) *Smooth Muscle:* - Uterine relaxation (potential for PPH - avoid in obstetric analgesia at low doses; use only for uterine relaxation in specific procedures) - Bronchodilation (advantage in asthma) *Neuromuscular:* - Moderate neuromuscular blockade; enhances effect of non-depolarizing muscle relaxants *Hepatic:* - Hepatotoxicity: Halothane is metabolized (20%) by CYP2E1 to reactive intermediates (trifluoroacetyl chloride) that can cause immune-mediated hepatitis - Type 1 (mild): Transient elevation of liver enzymes (asymptomatic) - Type 2 (severe): "Halothane hepatitis" - fulminant hepatic necrosis (1 in 35,000 exposures); associated with repeat exposure and immune mechanism (haptenization of liver proteins) - Contraindicated in patients with previous halothane exposure + jaundice **Clinical Uses:** 1. Induction and maintenance of general anaesthesia 2. Inhalation induction (especially in children - pleasant smell, non-irritating) 3. As a bronchodilator in status asthmaticus (rarely, when other agents fail) 4. Uterine relaxation (during intrauterine manipulation) **Adverse Effects Summary:** 1. Halothane hepatitis (most serious - fulminant hepatic necrosis) 2. Malignant hyperthermia (rare but life-threatening - triggered in susceptible individuals) 3. Cardiac arrhythmias (sensitization to catecholamines) 4. Myocardial depression and hypotension 5. Raised ICP (cerebral vasodilation) 6. Uterine relaxation (post-partum hemorrhage risk) 7. Shivering in recovery (common) **Contraindications:** - Previous halothane exposure with jaundice or unexplained fever - Pheochromocytoma (catecholamine sensitization) - Raised intracranial pressure - Malignant hyperthermia susceptibility - Liver disease **Current Status:** Halothane has been largely replaced by isoflurane, sevoflurane, and desflurane due to its significant hepatotoxicity and cardiac sensitization. However, it remains in use in developing countries because of its low cost. --- **Q.2 Adverse effects of general anaesthesia during and after anaesthesia.** **ADVERSE EFFECTS OF GENERAL ANAESTHESIA (KDT 8th Ed.)** General anaesthesia is associated with a spectrum of adverse effects that can occur during administration (intraoperative) or following recovery (postoperative). **A. DURING ANAESTHESIA (Intraoperative Complications):** **1. Cardiovascular:** - Hypotension: Most common - due to vasodilation, myocardial depression, hypovolemia - Management: IV fluids, dose reduction, vasopressors (ephedrine, phenylephrine) - Hypertension: Due to inadequate depth of anaesthesia, laryngoscopy, CO2 retention - Arrhythmias: - Bradycardia: Halothane, vagal stimulation during intubation → treat with atropine - Tachycardia: Inadequate anaesthesia, hypercapnia, halothane + catecholamine interaction - Ventricular fibrillation: Rare but catastrophic (halothane + catecholamine, hypoxia) - Cardiac arrest: Due to vagal reflex, hypoxia, drug overdose **2. Respiratory:** - Laryngospasm: Spasm of laryngeal muscles during light anaesthesia - life-threatening - Management: 100% O2, succinylcholine (50-100 mg IV), positive pressure ventilation - Bronchospasm: In asthmatics, irritant agents (isoflurane, desflurane), inadequate anaesthesia - Management: Halothane (bronchodilator), sevoflurane, IV bronchodilators - Respiratory depression → Hypercapnia and Hypoxia - Airway obstruction: Tongue fall, secretions, foreign body - Aspiration of gastric contents (Mendelson syndrome): In patients with full stomach, incompetent LES → chemical pneumonitis - Prevention: RSI (rapid sequence induction), pre-op fasting (NPO 6-8 hrs), antacids/H2 blockers/metoclopramide **3. Stage II Excitement:** - Involuntary movements, breath-holding, laryngospasm, vomiting during induction - Minimized by rapid induction with IV agents (bypasses Stage II) **4. Malignant Hyperthermia:** - Life-threatening pharmacogenetic emergency - Triggered by: Halothane, other volatile agents, succinylcholine - Mechanism: Mutation in RYR1 (ryanodine receptor) gene → uncontrolled Ca2+ release from SR → muscle hypermetabolism - Features: Hyperthermia (>40°C, rapidly rising), muscle rigidity, tachycardia, metabolic acidosis, myoglobinuria, hyperkalemia - Treatment: DANTROLENE SODIUM (specific antidote - blocks RyR1 receptor) 2.5 mg/kg IV; cooling, bicarbonate for acidosis, supportive care - Mortality: ~70% if untreated; 5-10% with dantrolene **5. Awareness During Anaesthesia:** - Consciousness during anaesthesia (inadequate anaesthetic depth) - Associated with: TIVA, neuromuscular blockade without adequate hypnotics, equipment failure - Psychological trauma, post-traumatic stress disorder **6. Drug-related:** - Suxamethonium apnea (in pseudocholinesterase deficiency) - Anaphylaxis/Anaphylactoid reactions (muscle relaxants, latex, antibiotics, colloids) **B. AFTER ANAESTHESIA (Postoperative Complications):** **1. Nausea and Vomiting (PONV - Post-Operative Nausea and Vomiting):** - Most common postoperative complication - Risk factors: Female sex, non-smoker, history of motion sickness, opioid use, volatile anaesthetics, nitrous oxide - Treatment/Prevention: Ondansetron (5-HT3 antagonist), dexamethasone, droperidol, scopolamine patch, TIVA with propofol (reduced PONV) **2. Residual CNS Effects:** - Delayed recovery from anaesthesia: Drug accumulation (elderly, hepatic/renal impairment) - Cognitive dysfunction: Postoperative cognitive dysfunction (POCD) - especially in elderly; may persist - Shivering: Common, increases O2 consumption; treat with meperidine (pethidine), forced air warming - Emergence delirium/agitation: Especially with ketamine, in children **3. Cardiovascular Postoperative:** - Hypertension (pain, urinary retention, anxiety) - Hypotension (hypovolemia, bleeding, myocardial depression) - Myocardial infarction (perioperative cardiac events) **4. Respiratory Postoperative:** - Atelectasis: Most common postoperative pulmonary complication (small airways collapse due to reduced FRC, surfactant changes) - Aspiration pneumonia (Mendelson syndrome) - Pulmonary embolism (DVT-PE) - Respiratory depression from residual opioids/muscle relaxants - Prevention: Deep breathing exercises, CPAP, early mobilization **5. Hepatic and Renal:** - Postoperative liver dysfunction (especially with halothane) - Acute kidney injury (hypotension, nephrotoxic drugs) - Fluoride-induced nephrotoxicity (methoxyflurane, high-dose enflurane - obsolete concern) **6. Other:** - Sore throat, hoarseness (from ET tube or laryngeal mask airway) - Dental damage (during laryngoscopy) - Corneal abrasion (dry eyes during surgery) - Hypothermia (prolonged surgery, cold operating rooms) - Backache, myalgia (from succinylcholine fasciculations, positioning) - Nerve injuries (improper positioning) - Pain: Inadequate postoperative analgesia --- **Q.3 Short note on pre-anaesthetic medication.** **PRE-ANAESTHETIC MEDICATION (KDT 8th Ed.)** Pre-anaesthetic medication (premedication) refers to the administration of one or more drugs before the induction of general anaesthesia to facilitate a smooth, safe, and comfortable anaesthetic experience. It is given 45-90 minutes before surgery (oral/IM) or immediately before induction (IV). **Goals/Objectives of Premedication:** 1. Allayment of anxiety and apprehension (sedation) 2. Amnesia (prevent unpleasant memories of the preoperative period) 3. Analgesia (preemptive analgesia, especially if patient has pain) 4. Attenuation of autonomic reflexes (particularly vagal reflexes during intubation/surgery) 5. Anti-sialogue effect (reduce secretions to facilitate airway management) 6. Antiemetic effect (reduce postoperative nausea and vomiting) 7. Reduce requirements of induction and maintenance agents (dose sparing) 8. Antacid prophylaxis (reduce risk of aspiration pneumonitis) 9. Facilitation of smooth induction **Drugs Used in Premedication:** **1. Sedatives / Anxiolytics / Hypnotics:** - Benzodiazepines (most commonly used): - Diazepam: 0.1-0.2 mg/kg PO/IV, 1-2 hours preoperatively - Midazolam: 0.05-0.1 mg/kg IM/IV (preferred - shorter acting, greater amnesia) - Lorazepam: For prolonged sedation/amnesia - Actions: Anxiolysis, sedation, anterograde amnesia, anticonvulsant - Barbiturates (historical): Pentobarbitone IM (largely replaced by BZDs) - Promethazine: Antihistamine with sedation; also antiemetic **2. Opioid Analgesics:** - Morphine: 0.1 mg/kg IM; provides analgesia and sedation; may cause respiratory depression, nausea, vomiting, histamine release - Pethidine (meperidine): 1 mg/kg IM; shorter acting - Fentanyl: IV, rapid onset, used immediately preoperatively - Indication: When patient has preoperative pain; for preemptive analgesia **3. Anticholinergics (Anti-secretory/Vagolytic agents):** - Atropine: 0.6 mg IM - most commonly used - Reduces oral, pharyngeal, bronchial secretions (antisialogogue) - Prevents bradycardia during laryngoscopy, intubation, vagal stimulation - Bronchodilation - Raises intragastric pH slightly - Side effects: Tachycardia, drying of secretions, urinary retention, blurred vision, central anticholinergic syndrome (in elderly) - Glycopyrrolate (preferred for antisialogogue effect): Does not cross BBB (no central effects); better antisialogogue, does not raise HR as much **4. H2 Blockers / Antacids (Aspiration prophylaxis):** - Ranitidine: 150 mg PO (evening before and morning of surgery) - raises gastric pH - Omeprazole (PPI): Effective in reducing gastric acid volume and acidity - Sodium citrate (0.3 M): Immediate-acting antacid; given 15-20 min before induction (for emergency/rapid sequence induction) - Indication: Full stomach, emergency surgery, pregnancy (increased aspiration risk), GERD, obesity **5. Antiemetics:** - Metoclopramide: 10 mg IV; promotes gastric emptying + antiemetic (dopamine antagonist); given 1-2 hrs before surgery - Ondansetron: 4-8 mg IV; 5-HT3 antagonist; prevents PONV (can be given preoperatively) - Dexamethasone: 4-8 mg IV; anti-inflammatory + potent antiemetic (synergistic with ondansetron) **6. Others:** - Beta-blockers (e.g., atenolol, metoprolol): In hypertensive patients, continue perioperatively to prevent rebound hypertension; cardioprotetion - Clonidine (alpha-2 agonist): Sedation, reduces anaesthetic requirements, stabilizes hemodynamics - Insulin and antidiabetics: For diabetic patients **Drugs NOT used in premedication (to be withheld):** - Oral hypoglycemics (hold on day of surgery) - Anticoagulants (timing depends on procedure) - NSAIDs (controversial - may continue for preemptive analgesia) - MAO inhibitors (serious interactions with pethidine and sympathomimetics) **Pediatric Premedication:** - Oral midazolam (0.5 mg/kg) is most commonly used in children - EMLA cream over IV sites to reduce pain of cannulation **Summary Table:** | Drug Class | Drug | Main Purpose | |-----------|------|-------------| | Benzodiazepine | Midazolam | Anxiolysis, amnesia | | Opioid | Morphine/Pethidine | Analgesia | | Anticholinergic | Atropine/Glycopyrrolate | Antisialogogue, vagolysis | | Antiemetic | Ondansetron, Metoclopramide | Prevent PONV | | Antacid | Ranitidine, Na citrate | Aspiration prophylaxis | --- **Q.4 What are intravenous anaesthetics? Add a note on the pharmacology of Propofol.** **INTRAVENOUS ANAESTHETICS (KDT 8th Ed.)** Intravenous (IV) anaesthetics are drugs administered intravenously to produce unconsciousness (anaesthesia), usually for the purpose of induction of general anaesthesia. They offer rapid onset of unconsciousness (within one arm-brain circulation time) and are more pleasant for the patient than inhalational induction. **Classification of IV Anaesthetics:** **1. Barbiturates:** - Thiopentone sodium (thiopental): Ultra-short acting; prototypic IV induction agent - Methohexitone: Short acting barbiturate **2. Non-barbiturate IV agents:** - Propofol (2,6-diisopropylphenol): Most widely used current induction agent - Etomidate: Used in cardiovascular compromise (minimal cardiac depression) - Ketamine: Dissociative anaesthetic (unique - produces analgesia + unconsciousness + amnesia with maintained airway reflexes) **3. Benzodiazepines (used for induction/sedation):** - Midazolam, Lorazepam, Diazepam **4. Alpha-2 agonist:** - Dexmedetomidine: Sedation, procedural sedation, ICU sedation (does not produce unconsciousness at usual doses) --- **PHARMACOLOGY OF PROPOFOL** Propofol (2,6-diisopropylphenol) is the most widely used intravenous anaesthetic agent worldwide, introduced in 1977 (clinically 1986). **Physical Properties:** - White oil-in-water emulsion (soya bean oil, egg phosphatide, glycerol) - Insoluble in water (requires lipid emulsion formulation) - Stored at room temperature (2-25°C) - Preservative-free formulation → risk of microbial contamination (single-use within 6-12 hours) - pH: 7 (neutral) - Supports microbial growth (strict aseptic technique required) **Mechanism of Action:** Propofol acts primarily by enhancing GABA-A receptor-mediated inhibitory neurotransmission, similar to barbiturates and benzodiazepines. It increases the duration of chloride channel opening (similar to barbiturates), leading to membrane hyperpolarization and CNS depression. Additionally, propofol inhibits NMDA receptor activity and modulates glycine receptors. At subanesthetic concentrations, it produces sedation and anxiolysis; at higher doses, unconsciousness. **Pharmacokinetics:** - Onset: Rapid - loss of consciousness within 30-60 seconds of IV injection (one arm-brain circulation time) - Duration: Short - 5-10 minutes (due to rapid redistribution from brain to peripheral tissues) - Distribution: Highly lipophilic, large Vd (~3.5 L/kg) - Protein binding: ~98% - Metabolism: Hepatic conjugation to inactive glucuronide and sulfate metabolites; also extra-hepatic metabolism (lung, kidney - context-sensitive half-life allows prolonged infusions) - Elimination half-life: Initial 2-8 min (distribution); terminal 4-7 hours - Excretion: Renal (88% as conjugates) - Context-sensitive half-time: Relatively short even after prolonged infusion (enables use in TIVA) **Pharmacological Actions:** *CNS:* - Unconsciousness (loss of consciousness within 30-60 sec) - No analgesia (must supplement with opioids) - Excellent amnesia - Antiemetic effect (reduces PONV - major advantage over volatile agents) - Reduces ICP and cerebral metabolic rate (CMRO2) - useful in neuroanaesthesia - Anticonvulsant at low doses; may cause myoclonic movements at induction - EEG: Burst suppression at high doses *Cardiovascular:* - Significant hypotension (most important adverse effect): Due to vasodilation (reduces SVR) + negative inotropy - Decrease in MAP by 25-40% during induction - Bradycardia (inhibits baroreceptor reflex) - More hypotension than thiopentone - Caution in elderly, hypovolemic, cardiac compromised patients *Respiratory:* - Dose-dependent respiratory depression → Apnea during induction (common, brief) - Reduces tidal volume and respiratory rate - Depresses laryngeal reflexes - facilitates LMA (laryngeal mask airway) insertion - Bronchodilation (reduces airway resistance) *Antiemetic:* - Subhypnotic doses have direct antiemetic properties - Patients anaesthetized with propofol have significantly less PONV compared to volatile anaesthetics - Propofol infusion used as rescue antiemetic in PONV **Clinical Uses:** 1. Induction of general anaesthesia: Most commonly used induction agent (replaced thiopentone in most centers) 2. Maintenance of anaesthesia: Total Intravenous Anaesthesia (TIVA) - propofol infusion throughout surgery 3. Procedural sedation: Endoscopy, colonoscopy, cardioversion, minor procedures (monitored anaesthesia care) 4. ICU sedation: Propofol infusion for mechanically ventilated patients (risk of Propofol Infusion Syndrome with prolonged high-dose use) 5. Antiemetic: Subhypnotic doses (10-20 mg IV) as rescue antiemetic **Adverse Effects:** 1. Hypotension (most common serious adverse effect - especially in elderly, hypovolemic patients) 2. Pain on injection: Very common (60-80% of patients); IV site burning pain; reduced by: injecting into large vein, pretreatment with IV lignocaine, mixing lignocaine with propofol 3. Apnea during induction (brief, 30-60 seconds) 4. Bradycardia 5. Propofol Infusion Syndrome (PRIS): Rare, life-threatening; occurs with prolonged high-dose infusions (>4 mg/kg/hr for >48 hrs) - Features: Metabolic acidosis, rhabdomyolysis, hyperkalemia, renal failure, cardiac failure (right bundle branch block, ST elevation, Brugada-pattern), hypertriglyceridemia, hepatomegaly - Risk: ICU patients, children (higher risk) - Treatment: Discontinue propofol; supportive care 6. Egg/soy allergy: Contraindicated in patients with severe egg or soy allergy (contains egg phosphatide and soybean oil) - though allergy to propofol itself is rare 7. Lipemia (hypertriglyceridemia) with prolonged infusion (provides 1.1 kcal/mL from lipid) 8. Microbial contamination risk (supports bacterial growth; strict aseptic technique) 9. Green discolouration of urine (benign, due to phenol metabolites) 10. Involuntary movements/excitatory phenomena during induction **Contraindications:** - Allergy to propofol or components (soy, egg) - Severe cardiovascular compromise/hypotension (use etomidate instead) - Children <3 years for ICU sedation (risk of PRIS) **Advantages of Propofol:** - Rapid, smooth induction - Rapid, clear-headed recovery (minimal hangover) - Reduced PONV (antiemetic property) - Smooth awakening - suitable for day surgery - Titratable in TIVA - Reduces ICP - useful in neuroanaesthesia - Anticonvulsant **Disadvantages:** - No analgesic properties (must supplement with opioids) - Significant hypotension (especially in elderly) - Pain on injection - PRIS with prolonged use - Expensive compared to thiopentone --- Please write a Python script using python-docx to create this document with proper formatting. The file should be saved at `/tmp/workspace/assignments/Assignment_21_07_26.docx`. Use Heading 1 for "Q.1", "Q.2" etc., Heading 2 for subheadings. Body text should use Normal style with Times New Roman 12pt. Include a proper title page at the start. Run the script and confirm the file is created successfully.

Running Command

ls -la /tmp/workspace/

Reading File
Running Command

ls -la /tmp/workspace/ 2>/dev/null || echo "Directory does not exist"

Reading File
Running Command

mkdir -p /tmp/workspace/assignments && echo "Directory created successfully" && ls -la /tmp/workspace/

Running Command

mkdir -p /tmp/workspace/assignments && ls -la /tmp/workspace/

Writing File

~/assignments/generate_assignment.py

"""
Assignment Generator: General Anaesthetics
Date: 21-07-26
Reference: KD Tripathi Essentials of Medical Pharmacology, 8th Edition
Output: /tmp/workspace/assignments/Assignment_21_07_26.docx
"""

from docx import Document
from docx.shared import Pt, Inches, RGBColor
from docx.enum.text import WD_ALIGN_PARAGRAPH, WD_LINE_SPACING
from docx.oxml.ns import qn
from docx.oxml import OxmlElement
from io import BytesIO


# ──────────────────────────────────────────────────────────────────
# Helper utilities
# ──────────────────────────────────────────────────────────────────

def set_line_spacing(paragraph, spacing=1.5):
    """Set line spacing (1.5 lines) on a paragraph."""
    pf = paragraph.paragraph_format
    pf.line_spacing_rule = WD_LINE_SPACING.MULTIPLE
    pf.line_spacing = Pt(12 * spacing)   # 12pt * 1.5 = 18pt


def set_body_font(run, bold=False, italic=False, size=12):
    """Apply Times New Roman formatting to a run."""
    run.font.name = "Times New Roman"
    run.font.size = Pt(size)
    run.font.bold = bold
    run.font.italic = italic


def add_body_paragraph(doc, text, bold=False, italic=False, space_before=0, space_after=6):
    """Add a normal body paragraph with Times New Roman 12pt and 1.5 line spacing."""
    p = doc.add_paragraph(style="Normal")
    run = p.add_run(text)
    set_body_font(run, bold=bold, italic=italic)
    set_line_spacing(p)
    p.paragraph_format.space_before = Pt(space_before)
    p.paragraph_format.space_after = Pt(space_after)
    return p


def add_bullet(doc, text, level=1, bold=False, italic=False):
    """Add a bullet list item."""
    style = "List Bullet" if level == 1 else f"List Bullet {level}"
    p = doc.add_paragraph(style=style)
    run = p.add_run(text)
    set_body_font(run, bold=bold, italic=italic)
    set_line_spacing(p)
    p.paragraph_format.space_after = Pt(3)
    return p


def add_numbered(doc, text, level=1, bold=False, italic=False):
    """Add a numbered list item."""
    style = "List Number" if level == 1 else f"List Number {level}"
    p = doc.add_paragraph(style=style)
    run = p.add_run(text)
    set_body_font(run, bold=bold, italic=italic)
    set_line_spacing(p)
    p.paragraph_format.space_after = Pt(3)
    return p


def add_h1(doc, text):
    """Add a Heading 1 paragraph."""
    p = doc.add_heading(text, level=1)
    p.paragraph_format.space_before = Pt(18)
    p.paragraph_format.space_after = Pt(6)
    return p


def add_h2(doc, text):
    """Add a Heading 2 paragraph."""
    p = doc.add_heading(text, level=2)
    p.paragraph_format.space_before = Pt(12)
    p.paragraph_format.space_after = Pt(4)
    return p


def add_h3(doc, text):
    """Add a Heading 3 paragraph."""
    p = doc.add_heading(text, level=3)
    p.paragraph_format.space_before = Pt(8)
    p.paragraph_format.space_after = Pt(3)
    return p


def shade_cell(cell, hex_fill):
    """Apply background shading to a table cell."""
    tcPr = cell._tc.get_or_add_tcPr()
    shd = OxmlElement("w:shd")
    shd.set(qn("w:val"), "clear")
    shd.set(qn("w:fill"), hex_fill)
    tcPr.append(shd)


# ──────────────────────────────────────────────────────────────────
# Document setup
# ──────────────────────────────────────────────────────────────────

doc = Document()

# Page setup: A4, 1-inch margins
section = doc.sections[0]
section.page_width  = Inches(8.27)
section.page_height = Inches(11.69)
section.top_margin    = Inches(1.0)
section.bottom_margin = Inches(1.0)
section.left_margin   = Inches(1.25)
section.right_margin  = Inches(1.25)

# ── Global styles ──────────────────────────────────────────────────
normal_style = doc.styles["Normal"]
normal_style.font.name = "Times New Roman"
normal_style.font.size = Pt(12)

# Heading 1 style
h1_style = doc.styles["Heading 1"]
h1_style.font.name = "Times New Roman"
h1_style.font.size = Pt(14)
h1_style.font.bold = True
h1_style.font.color.rgb = RGBColor(0x00, 0x00, 0x00)

# Heading 2 style
h2_style = doc.styles["Heading 2"]
h2_style.font.name = "Times New Roman"
h2_style.font.size = Pt(13)
h2_style.font.bold = True
h2_style.font.color.rgb = RGBColor(0x00, 0x00, 0x00)

# Heading 3 style
h3_style = doc.styles["Heading 3"]
h3_style.font.name = "Times New Roman"
h3_style.font.size = Pt(12)
h3_style.font.bold = True
h3_style.font.italic = False
h3_style.font.color.rgb = RGBColor(0x00, 0x00, 0x00)

# List Bullet style
lb_style = doc.styles["List Bullet"]
lb_style.font.name = "Times New Roman"
lb_style.font.size = Pt(12)

# List Number style
ln_style = doc.styles["List Number"]
ln_style.font.name = "Times New Roman"
ln_style.font.size = Pt(12)

# ── Header ────────────────────────────────────────────────────────
header = section.header
hp = header.paragraphs[0]
hp.clear()
run = hp.add_run("Assignment – General Anaesthetics | 21-07-26")
run.font.name = "Times New Roman"
run.font.size = Pt(10)
run.font.italic = True
hp.alignment = WD_ALIGN_PARAGRAPH.CENTER

# ── Footer with page number ───────────────────────────────────────
footer = section.footer
fp = footer.paragraphs[0]
fp.clear()
fp.alignment = WD_ALIGN_PARAGRAPH.CENTER
run_pre = fp.add_run("Page ")
run_pre.font.name = "Times New Roman"
run_pre.font.size = Pt(10)
run_num = fp.add_run()
fldBegin = OxmlElement("w:fldChar"); fldBegin.set(qn("w:fldCharType"), "begin")
instr    = OxmlElement("w:instrText"); instr.set(qn("xml:space"), "preserve"); instr.text = "PAGE"
fldEnd   = OxmlElement("w:fldChar"); fldEnd.set(qn("w:fldCharType"), "end")
for el in (fldBegin, instr, fldEnd):
    run_num._r.append(el)
run_num.font.name = "Times New Roman"
run_num.font.size = Pt(10)


# ══════════════════════════════════════════════════════════════════
# TITLE PAGE
# ══════════════════════════════════════════════════════════════════

# Spacer
for _ in range(4):
    sp = doc.add_paragraph()
    sp.paragraph_format.space_after = Pt(0)

# Main title
title_p = doc.add_paragraph()
title_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
r = title_p.add_run("Assignment – 21-07-26")
r.font.name = "Times New Roman"
r.font.size = Pt(20)
r.font.bold = True

subtitle_p = doc.add_paragraph()
subtitle_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
r2 = subtitle_p.add_run("General Anaesthetics")
r2.font.name = "Times New Roman"
r2.font.size = Pt(18)
r2.font.bold = True

doc.add_paragraph()

# Divider line
div_p = doc.add_paragraph()
div_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
r3 = div_p.add_run("─" * 50)
r3.font.name = "Times New Roman"
r3.font.size = Pt(11)

doc.add_paragraph()

# Reference info
def centre_info(text, size=12, bold=False):
    p = doc.add_paragraph()
    p.alignment = WD_ALIGN_PARAGRAPH.CENTER
    r = p.add_run(text)
    r.font.name = "Times New Roman"
    r.font.size = Pt(size)
    r.font.bold = bold
    p.paragraph_format.space_after = Pt(4)
    return p

centre_info("Subject: Pharmacology", size=12, bold=True)
centre_info("Date: 21 July 2026", size=12)
centre_info("Reference: KD Tripathi – Essentials of Medical Pharmacology, 8th Edition", size=12)

doc.add_paragraph()
doc.add_paragraph()

# Questions listed on title page
centre_info("Questions Covered:", size=12, bold=True)
qs = [
    "Q.1  Classify general anaesthetics and add a note on the pharmacology of Halothane.",
    "Q.2  Adverse effects of general anaesthesia during and after anaesthesia.",
    "Q.3  Short note on pre-anaesthetic medication.",
    "Q.4  What are intravenous anaesthetics? Add a note on the pharmacology of Propofol.",
]
for q in qs:
    p = doc.add_paragraph()
    p.alignment = WD_ALIGN_PARAGRAPH.CENTER
    r = p.add_run(q)
    r.font.name = "Times New Roman"
    r.font.size = Pt(11)
    p.paragraph_format.space_after = Pt(5)

# Page break after title page
doc.add_page_break()


# ══════════════════════════════════════════════════════════════════
# Q.1  Classification of General Anaesthetics + Pharmacology of Halothane
# ══════════════════════════════════════════════════════════════════

add_h1(doc, "Q.1  Classify general anaesthetics and add a note on the pharmacology of Halothane.")

add_body_paragraph(doc,
    "General anaesthetics are drugs that produce reversible loss of all sensations and consciousness "
    "(general anaesthesia) sufficient for carrying out surgical and other procedures. They act on the "
    "entire CNS and are broadly divided into two major groups based on their route of administration: "
    "inhalational and intravenous anaesthetics.",
    space_after=8)

# ── Classification ─────────────────────────────────────────────────
add_h2(doc, "CLASSIFICATION OF GENERAL ANAESTHETICS  (KDT 8th Ed.)")

add_h3(doc, "I. Inhalational Anaesthetics")

add_body_paragraph(doc, "A. Gases:", bold=True, space_after=3)
add_numbered(doc, "Nitrous oxide (N2O)")
add_numbered(doc, "Cyclopropane (obsolete)")
add_numbered(doc, "Xenon (experimental)")

add_body_paragraph(doc, "B. Volatile Liquids (Halogenated hydrocarbons / ethers):", bold=True, space_after=3)
add_numbered(doc, "Halothane (Fluothane) – halogenated alkane")
add_numbered(doc, "Enflurane – halogenated ether")
add_numbered(doc, "Isoflurane – halogenated ether (currently most widely used)")
add_numbered(doc, "Desflurane – halogenated ether (very low blood–gas partition coefficient)")
add_numbered(doc, "Sevoflurane – halogenated ether (most commonly used in paediatrics)")
add_numbered(doc, "Methoxyflurane (analgesic doses)")
add_numbered(doc, "Diethyl ether (obsolete, historical)")
add_numbered(doc, "Chloroform (obsolete, toxic)")
add_numbered(doc, "Trichloroethylene (obsolete)")

add_h3(doc, "II. Intravenous Anaesthetics")

add_body_paragraph(doc, "A. Induction Agents:", bold=True, space_after=3)
add_numbered(doc, "Barbiturates: Thiopentone sodium, Methohexitone")
add_numbered(doc, "Propofol (2,6-diisopropylphenol) – most widely used")
add_numbered(doc, "Etomidate")
add_numbered(doc, "Ketamine (dissociative anaesthetic)")

add_body_paragraph(doc, "B. Benzodiazepines (used for induction / sedation):", bold=True, space_after=3)
add_bullet(doc, "Midazolam, Diazepam, Lorazepam")

add_body_paragraph(doc, "C. Opioid anaesthetics (neuroleptanalgesia):", bold=True, space_after=3)
add_bullet(doc, "Fentanyl, Remifentanil, Sufentanil")

# Stages of anaesthesia
add_h3(doc, "Stages of General Anaesthesia (Guedel's Classification – for ether)")

stages = [
    ("Stage I",   "Analgesia – patient is conscious but pain is reduced; responds to verbal commands."),
    ("Stage II",  "Excitement / Delirium – patient is unconscious but breathing is irregular; risk of "
                  "laryngospasm, vomiting, and breath-holding. This stage is dangerous and must be "
                  "passed through rapidly."),
    ("Stage III", "Surgical Anaesthesia (four planes): Plane 1 – regular breathing, eyes deviate; "
                  "Plane 2 – ocular movements cease, conjugate gaze; Plane 3 – intercostal paralysis "
                  "begins, diaphragmatic breathing; Plane 4 – complete intercostal paralysis."),
    ("Stage IV",  "Medullary depression – apnoea, cardiovascular collapse, and death if anaesthesia "
                  "is not immediately reversed."),
]
for stage, desc in stages:
    p = doc.add_paragraph(style="Normal")
    r1 = p.add_run(stage + ": ")
    set_body_font(r1, bold=True)
    r2 = p.add_run(desc)
    set_body_font(r2)
    set_line_spacing(p)
    p.paragraph_format.space_after = Pt(4)

# ── Pharmacology of Halothane ──────────────────────────────────────
add_h2(doc, "PHARMACOLOGY OF HALOTHANE")

add_body_paragraph(doc,
    "Halothane (2-bromo-2-chloro-1,1,1-trifluoroethane) is a halogenated alkane introduced in 1956 "
    "and was formerly one of the most widely used inhalational anaesthetics. It has largely been "
    "replaced by newer agents such as isoflurane, sevoflurane, and desflurane, primarily due to "
    "concerns over hepatotoxicity and cardiac sensitisation.",
    space_after=8)

add_h3(doc, "Physical Properties")
props = [
    ("Non-flammable and non-explosive",   "Major advantage over diethyl ether."),
    ("Odour",                             "Sweet and pleasant, facilitating inhalational induction."),
    ("Blood–gas partition coefficient",   "2.4 (moderate) – slower induction than desflurane/sevoflurane "
                                          "but faster than ether."),
    ("Oil–gas partition coefficient",     "224 (high potency; low MAC required)."),
    ("MAC",                               "0.75% – relatively low, indicating high potency."),
    ("Storage",                           "Amber bottles with thymol as preservative to prevent decomposition."),
    ("Boiling point",                     "50.2°C – volatile at room temperature."),
]
for prop, val in props:
    p = doc.add_paragraph(style="Normal")
    r1 = p.add_run(prop + ": ")
    set_body_font(r1, bold=True)
    r2 = p.add_run(val)
    set_body_font(r2)
    set_line_spacing(p)
    p.paragraph_format.space_after = Pt(4)

add_h3(doc, "Mechanism of Action")
add_body_paragraph(doc,
    "The precise molecular mechanism of halothane is not fully elucidated; however, the following "
    "pathways are recognised:")
moa = [
    "Enhancement of GABA-A receptor-mediated inhibitory neurotransmission – increases Cl- conductance leading to neuronal hyperpolarisation.",
    "Inhibition of NMDA (N-methyl-D-aspartate) glutamate receptors – reducing excitatory neurotransmission.",
    "Modulation of two-pore domain K+ channels (TREK channels) – causing further hyperpolarisation.",
    "Non-specific disruption of neuronal membrane lipids (Meyer–Overton lipid theory) – an older concept now less favoured.",
]
for item in moa:
    add_numbered(doc, item)

add_body_paragraph(doc,
    "The net result is global CNS depression producing unconsciousness, analgesia, and amnesia.",
    space_after=8)

add_h3(doc, "Pharmacological Actions")

# CNS
add_body_paragraph(doc, "CNS:", bold=True, space_after=3)
cnss = [
    "Produces all stages of anaesthesia relatively rapidly.",
    "Good hypnosis and amnesia; moderate analgesia.",
    "Reduces cerebral metabolic rate (CMRO2) but INCREASES cerebral blood flow (vasodilation) – raises intracranial pressure (ICP).",
    "Contraindicated in raised intracranial pressure.",
]
for item in cnss:
    add_bullet(doc, item)

# CVS
add_body_paragraph(doc, "Cardiovascular:", bold=True, space_after=3)
cvs = [
    "Myocardial depression: reduces cardiac output and myocardial contractility in a dose-dependent manner.",
    "Hypotension: fall in blood pressure due to both vasodilation and myocardial depression.",
    "Bradycardia: sensitises the myocardium to catecholamines – predisposes to arrhythmias, particularly with exogenous adrenaline.",
    "Use of adrenaline with halothane is avoided or the dose is strictly limited (maximum 1:100,000 adrenaline, 10 mL per 10 minutes).",
]
for item in cvs:
    add_bullet(doc, item)

# Respiratory
add_body_paragraph(doc, "Respiratory:", bold=True, space_after=3)
resp = [
    "Potent bronchodilator – clinically useful in patients with asthma.",
    "Dose-dependent respiratory depression: reduces tidal volume and respiratory rate.",
    "Depresses hypoxic and hypercapnic ventilatory responses.",
    "Does NOT irritate the respiratory tract (advantage over ether and isoflurane).",
]
for item in resp:
    add_bullet(doc, item)

# Smooth Muscle
add_body_paragraph(doc, "Smooth Muscle:", bold=True, space_after=3)
sm = [
    "Uterine relaxation – potential for postpartum haemorrhage (PPH); avoided in routine obstetric analgesia but used intentionally for uterine relaxation during intrauterine procedures.",
    "Bronchodilation (beneficial in asthma).",
]
for item in sm:
    add_bullet(doc, item)

# NMJ
add_body_paragraph(doc, "Neuromuscular:", bold=True, space_after=3)
nmj = [
    "Moderate neuromuscular blockade; potentiates the effect of non-depolarising muscle relaxants (e.g., vecuronium, atracurium).",
]
for item in nmj:
    add_bullet(doc, item)

# Hepatic
add_body_paragraph(doc, "Hepatic (Hepatotoxicity – most important adverse effect):", bold=True, space_after=3)
hep = [
    "Halothane is metabolised (~20%) by CYP2E1 to reactive intermediates (trifluoroacetyl chloride), which can trigger immune-mediated hepatitis.",
    "Type 1 (mild): Transient, asymptomatic elevation of liver enzymes; relatively common.",
    "Type 2 (severe – Halothane Hepatitis): Fulminant hepatic necrosis; incidence 1 in 35,000 exposures; associated with repeated exposure and haptenisation of liver proteins. Case fatality rate is high.",
]
for item in hep:
    add_bullet(doc, item)

add_h3(doc, "Clinical Uses")
uses = [
    "Induction and maintenance of general anaesthesia.",
    "Inhalational induction – especially in children (pleasant odour, non-irritating airway).",
    "Bronchodilator in refractory status asthmaticus (rarely, when other agents fail).",
    "Uterine relaxation during intrauterine foetal manipulation.",
]
for i, u in enumerate(uses, 1):
    add_numbered(doc, u)

add_h3(doc, "Adverse Effects Summary")
aes = [
    "Halothane hepatitis (most serious – fulminant hepatic necrosis on re-exposure).",
    "Malignant hyperthermia (rare but life-threatening; triggered in genetically susceptible individuals with RYR1 mutation).",
    "Cardiac arrhythmias (sensitisation of myocardium to catecholamines).",
    "Myocardial depression and hypotension.",
    "Raised intracranial pressure (cerebral vasodilation).",
    "Uterine relaxation (postpartum haemorrhage risk in obstetrics).",
    "Shivering during recovery (common).",
]
for ae in aes:
    add_numbered(doc, ae)

add_h3(doc, "Contraindications")
cis = [
    "Previous halothane exposure associated with jaundice or unexplained fever.",
    "Phaeochromocytoma (risk of catecholamine sensitisation leading to hypertensive crisis and arrhythmias).",
    "Raised intracranial pressure (e.g., brain tumour, head injury).",
    "Known susceptibility to malignant hyperthermia.",
    "Pre-existing liver disease.",
]
for ci in cis:
    add_bullet(doc, ci)

add_h3(doc, "Current Status")
add_body_paragraph(doc,
    "Halothane has been largely replaced in most developed countries by isoflurane, sevoflurane, and "
    "desflurane due to its significant hepatotoxicity and cardiac sensitisation. However, it continues "
    "to be used in developing countries owing to its low cost and availability.")

doc.add_page_break()


# ══════════════════════════════════════════════════════════════════
# Q.2  Adverse Effects of General Anaesthesia
# ══════════════════════════════════════════════════════════════════

add_h1(doc, "Q.2  Adverse effects of general anaesthesia during and after anaesthesia.")

add_body_paragraph(doc,
    "General anaesthesia is associated with a spectrum of adverse effects that can occur during "
    "administration (intraoperative) or following recovery (postoperative). These can be related to "
    "the anaesthetic agents themselves, the technique employed, or the patient's underlying condition. "
    "A thorough understanding of these complications is essential for safe perioperative management.",
    space_after=8)

add_h2(doc, "A. DURING ANAESTHESIA (Intraoperative Complications)")

# 1. Cardiovascular
add_h3(doc, "1. Cardiovascular Complications")
add_body_paragraph(doc, "Hypotension:", bold=True, space_after=3)
add_bullet(doc, "Most common intraoperative cardiovascular complication.")
add_bullet(doc, "Causes: vasodilation from anaesthetic agents, myocardial depression, hypovolaemia, positive pressure ventilation.")
add_bullet(doc, "Management: IV crystalloid/colloid bolus, dose reduction of anaesthetic, vasopressors (ephedrine, phenylephrine, noradrenaline).")

add_body_paragraph(doc, "Hypertension:", bold=True, space_after=3)
add_bullet(doc, "Caused by inadequate depth of anaesthesia, pain, laryngoscopy stimulus, or CO2 retention.")
add_bullet(doc, "Management: deepen anaesthesia, ensure adequate analgesia, treat hypercapnia.")

add_body_paragraph(doc, "Arrhythmias:", bold=True, space_after=3)
arrs = [
    "Bradycardia: vagal stimulation during laryngoscopy and intubation, halothane, oculocardiac reflex. Treat with atropine 0.6 mg IV.",
    "Tachycardia: inadequate anaesthesia, pain, hypercapnia, hypovolaemia.",
    "Ventricular arrhythmias: halothane + catecholamine interaction, hypoxia, electrolyte imbalance. May precipitate ventricular fibrillation.",
    "Cardiac arrest: vagal reflex, hypoxia, drug overdose – CPR and ACLS protocols apply.",
]
for item in arrs:
    add_bullet(doc, item)

# 2. Respiratory
add_h3(doc, "2. Respiratory Complications")
resp_comps = [
    ("Laryngospasm",
     "Spasm of laryngeal muscles during light anaesthesia on stimulation (secretions, airway manipulation). "
     "Life-threatening; management: 100% O2 under positive pressure, jaw thrust; if refractory, "
     "succinylcholine 0.5–1 mg/kg IV (or 4 mg/kg IM in children) followed by intubation."),
    ("Bronchospasm",
     "Occurs in asthmatic patients, or with irritant agents (desflurane, isoflurane), inadequate anaesthesia depth, or airway stimulation. "
     "Management: deepen anaesthesia with propofol/halothane, IV salbutamol/aminophylline, inhaled bronchodilators."),
    ("Aspiration of Gastric Contents (Mendelson Syndrome)",
     "Chemical pneumonitis from acid aspiration. Risk highest in emergency surgery, full stomach, pregnancy, GERD, and obesity. "
     "Prevention: RSI (rapid sequence induction) with cricoid pressure (Sellick's manoeuvre), NPO 6–8 hours preoperatively, "
     "prophylactic antacids / H2 blockers / metoclopramide."),
    ("Respiratory Depression and Airway Obstruction",
     "Tongue fall, secretions, and neuromuscular blockade residue can cause obstruction. "
     "Hypercapnia and hypoxia follow inadequate ventilation."),
]
for title, text in resp_comps:
    p = doc.add_paragraph(style="Normal")
    r1 = p.add_run(title + ": ")
    set_body_font(r1, bold=True)
    r2 = p.add_run(text)
    set_body_font(r2)
    set_line_spacing(p)
    p.paragraph_format.space_after = Pt(5)

# 3. Stage II Excitement
add_h3(doc, "3. Stage II Excitement (Excitation Phase)")
add_body_paragraph(doc,
    "Involuntary movements, breath-holding, coughing, laryngospasm, and vomiting can occur during "
    "induction through Stage II (excitation stage). This stage is minimised by rapid induction with "
    "IV agents such as propofol or thiopentone, which bypass the excitation stage.")

# 4. Malignant Hyperthermia
add_h3(doc, "4. Malignant Hyperthermia (MH)")
add_body_paragraph(doc,
    "Malignant hyperthermia is a life-threatening pharmacogenetic emergency triggered by volatile "
    "anaesthetic agents (halothane, isoflurane, sevoflurane, desflurane) and succinylcholine in "
    "genetically susceptible individuals.")
mh = [
    "Mechanism: Autosomal dominant mutation in the RYR1 (ryanodine receptor) gene leads to uncontrolled Ca2+ release from the sarcoplasmic reticulum, causing sustained skeletal muscle hypermetabolism.",
    "Clinical features: Rapidly rising hyperthermia (>40°C), skeletal muscle rigidity (masseter spasm early), tachycardia, hypertension, metabolic and respiratory acidosis, hyperkalemia, myoglobinuria, rhabdomyolysis, dark urine.",
    "Specific antidote: DANTROLENE SODIUM 2.5 mg/kg IV (blocks RyR1 receptor, prevents Ca2+ release); continue until symptoms resolve; dose up to 10 mg/kg total.",
    "Additional treatment: Immediate cessation of triggering agent, 100% O2, active cooling, sodium bicarbonate for acidosis, IV glucose/insulin for hyperkalaemia, supportive ICU care.",
    "Prognosis: Mortality approaches 70% if untreated; reduced to 5–10% with prompt dantrolene therapy.",
]
for item in mh:
    add_numbered(doc, item)

# 5. Awareness
add_h3(doc, "5. Awareness During Anaesthesia")
add_body_paragraph(doc,
    "Consciousness during general anaesthesia occurs due to inadequate anaesthetic depth, neuromuscular "
    "blockade without sufficient hypnotic cover, equipment malfunction, or use of TIVA without adequate "
    "monitoring (BIS monitor, entropy). This can result in significant psychological trauma and "
    "post-traumatic stress disorder. Incidence is approximately 1–2 per 1000 general anaesthetics.")

# 6. Drug-related
add_h3(doc, "6. Drug-related Intraoperative Complications")
drugs = [
    "Suxamethonium apnoea: Prolonged apnoea in patients with pseudocholinesterase deficiency (genetic or acquired); treat with fresh frozen plasma or packed red cells; ventilate until recovery.",
    "Anaphylaxis / anaphylactoid reactions: Most commonly to neuromuscular blocking agents (most frequent), latex, antibiotics, colloids, or induction agents. Treat with adrenaline 0.5 mg IM/IV, fluids, antihistamines, steroids.",
    "Drug interactions: Serotonin syndrome (pethidine + MAO inhibitors), prolonged neuromuscular blockade (aminoglycosides + muscle relaxants).",
]
for item in drugs:
    add_numbered(doc, item)

# ── POST-OPERATIVE ─────────────────────────────────────────────────
add_h2(doc, "B. AFTER ANAESTHESIA (Postoperative Complications)")

# PONV
add_h3(doc, "1. Post-Operative Nausea and Vomiting (PONV)")
add_body_paragraph(doc,
    "PONV is the most common postoperative complication, occurring in 25–30% of patients overall "
    "and up to 80% in high-risk groups.")
ponv = [
    "Risk factors (Apfel score): Female sex, non-smoker, history of PONV or motion sickness, postoperative opioid use, volatile anaesthetic agents, nitrous oxide, longer surgery duration.",
    "Treatment and prevention: Ondansetron 4–8 mg IV (5-HT3 antagonist) – first line; dexamethasone 4–8 mg IV (synergistic); droperidol 0.625–1.25 mg IV; scopolamine transdermal patch (72 hrs).",
    "TIVA with propofol significantly reduces PONV compared to volatile anaesthetics (propofol has intrinsic antiemetic properties).",
    "Multimodal approach (combination of two or more antiemetics) is recommended for high-risk patients.",
]
for item in ponv:
    add_numbered(doc, item)

# Residual CNS
add_h3(doc, "2. Residual and Delayed CNS Effects")
cns_post = [
    "Delayed recovery from anaesthesia: Drug accumulation in elderly patients or in those with hepatic/renal impairment; residual neuromuscular blockade.",
    "Postoperative Cognitive Dysfunction (POCD): Subtle decline in cognitive function, memory, and concentration, particularly in elderly patients; may persist weeks to months; mechanism not fully understood.",
    "Shivering: Common in recovery (40% of patients), increases oxygen consumption by up to 400%; treated with meperidine (pethidine) 0.5 mg/kg IV, forced air warming blanket.",
    "Emergence delirium / agitation: More common with ketamine, in paediatric patients, and following prolonged procedures; midazolam or propofol may be used as rescue.",
]
for item in cns_post:
    add_numbered(doc, item)

# Cardiovascular postop
add_h3(doc, "3. Postoperative Cardiovascular Complications")
cvs_post = [
    "Hypertension: Pain, urinary retention, anxiety, fluid overload, pre-existing hypertension – resume antihypertensives promptly.",
    "Hypotension: Hypovolaemia from bleeding or inadequate fluid replacement, myocardial depression, vasodilation.",
    "Perioperative myocardial infarction: Significant cause of postoperative mortality in high-risk cardiac patients; ECG and troponin monitoring required.",
]
for item in cvs_post:
    add_numbered(doc, item)

# Respiratory postop
add_h3(doc, "4. Postoperative Respiratory Complications")
resp_post = [
    "Atelectasis: Most common postoperative pulmonary complication; small airway collapse due to reduced FRC, diaphragmatic splinting, and surfactant changes. Prevention: incentive spirometry, deep breathing exercises, CPAP, early mobilisation.",
    "Aspiration pneumonia (Mendelson Syndrome): Acid aspiration resulting in chemical pneumonitis; may progress to ARDS.",
    "Pulmonary embolism (PE): Secondary to deep vein thrombosis (DVT); risk increased by prolonged immobility; prophylaxis with LMWH and graduated compression stockings.",
    "Residual respiratory depression: Opioids, benzodiazepines, residual muscle relaxants; treat with reversal agents (naloxone, flumazenil, neostigmine).",
]
for item in resp_post:
    add_numbered(doc, item)

# Hepatic / Renal
add_h3(doc, "5. Hepatic and Renal Complications")
add_bullet(doc, "Postoperative liver dysfunction: Particularly with halothane (halothane hepatitis); also due to hypotension-induced hepatic ischaemia.")
add_bullet(doc, "Acute kidney injury: Perioperative hypotension, nephrotoxic drugs (aminoglycosides, NSAIDs), contrast agents.")
add_bullet(doc, "Fluoride-induced nephrotoxicity: Historical concern with methoxyflurane and high-dose enflurane (largely obsolete now).")

# Other
add_h3(doc, "6. Other Postoperative Adverse Effects")
others = [
    "Sore throat and hoarseness: From endotracheal tube or laryngeal mask airway (LMA) trauma.",
    "Dental damage: During laryngoscopy – particularly loose teeth.",
    "Corneal abrasion: Dry eyes during surgery if eye tape not applied.",
    "Hypothermia: Prolonged surgery, cold operating rooms, large volume IV fluids; may precipitate cardiac arrhythmias and coagulopathy.",
    "Myalgia and backache: From succinylcholine fasciculations and prolonged positioning; treated with NSAIDs.",
    "Peripheral nerve injuries: Improper intraoperative positioning (brachial plexus, ulnar, common peroneal nerve).",
    "Inadequate postoperative analgesia: Leading to splinting, atelectasis, and patient distress.",
]
for item in others:
    add_numbered(doc, item)

doc.add_page_break()


# ══════════════════════════════════════════════════════════════════
# Q.3  Pre-Anaesthetic Medication
# ══════════════════════════════════════════════════════════════════

add_h1(doc, "Q.3  Short note on pre-anaesthetic medication.")

add_body_paragraph(doc,
    "Pre-anaesthetic medication (premedication) refers to the administration of one or more drugs "
    "before the induction of general anaesthesia to facilitate a smooth, safe, and comfortable "
    "perioperative experience. It is typically administered 45–90 minutes before surgery when given "
    "orally or intramuscularly, or immediately before induction when given intravenously.",
    space_after=8)

# Goals
add_h2(doc, "Goals / Objectives of Premedication")
goals = [
    "Allayment of anxiety and apprehension (anxiolysis and sedation).",
    "Amnesia – prevent unpleasant memories of the preoperative period (anterograde amnesia).",
    "Analgesia – preemptive analgesia, particularly when the patient has preoperative pain.",
    "Attenuation of autonomic (vagal) reflexes during laryngoscopy and intubation.",
    "Antisialogogue effect – reduction of oral and bronchial secretions to facilitate airway management.",
    "Antiemetic effect – reduce the incidence of postoperative nausea and vomiting (PONV).",
    "Reduction of anaesthetic requirements (dose-sparing effect on induction and maintenance agents).",
    "Antacid prophylaxis – reduce the risk of aspiration pneumonitis (Mendelson Syndrome).",
    "Facilitation of smooth, rapid induction without the excitation stage.",
]
for item in goals:
    add_numbered(doc, item)

# Drugs used
add_h2(doc, "Drugs Used in Premedication")

add_h3(doc, "1. Sedatives / Anxiolytics / Hypnotics")
add_body_paragraph(doc, "Benzodiazepines (most commonly used class):", bold=True, space_after=3)
bzds = [
    "Midazolam 0.05–0.1 mg/kg IM/IV – preferred agent; short acting, provides excellent anterograde amnesia; water-soluble.",
    "Diazepam 0.1–0.2 mg/kg PO, 1–2 hours preoperatively; longer duration but effective anxiolysis.",
    "Lorazepam – used when prolonged sedation and amnesia are desired.",
    "Actions of BZDs: anxiolysis, sedation, anterograde amnesia, anticonvulsant, muscle relaxation, reduction of anaesthetic requirements.",
]
for item in bzds:
    add_bullet(doc, item)

add_body_paragraph(doc, "Other sedatives:", bold=True, space_after=3)
add_bullet(doc, "Promethazine (antihistamine): provides sedation and antiemetic effect; used particularly in paediatric patients.")
add_bullet(doc, "Barbiturates (historical): pentobarbitone IM; largely replaced by benzodiazepines.")

add_h3(doc, "2. Opioid Analgesics")
opioids = [
    "Morphine 0.1 mg/kg IM – standard preoperative opioid; provides analgesia and sedation; adverse effects include respiratory depression, nausea/vomiting, histamine release.",
    "Pethidine (meperidine) 1 mg/kg IM – shorter acting; avoid with MAO inhibitors (risk of serotonin syndrome).",
    "Fentanyl – administered IV immediately preoperatively; rapid onset, short duration; used for preemptive analgesia.",
    "Indication: reserved for patients with significant preoperative pain or when preemptive analgesia is desired.",
]
for item in opioids:
    add_numbered(doc, item)

add_h3(doc, "3. Anticholinergics (Antisialogogue / Vagolytic Agents)")
anticholinergics = [
    "Atropine 0.6 mg IM (most widely used anticholinergic in premedication):",
    "Glycopyrrolate (preferred antisialogogue):",
]
# Atropine
add_bullet(doc, "Atropine 0.6 mg IM (most widely used): reduces oral, pharyngeal, and bronchial secretions; prevents bradycardia during laryngoscopy and vagal stimulation; bronchodilation; mild elevation of intragastric pH.")
add_bullet(doc,  "Side effects of atropine: tachycardia, drying of secretions, urinary retention, blurred vision, central anticholinergic syndrome in elderly (confusion, restlessness), hyperthermia.")
# Glycopyrrolate
add_bullet(doc, "Glycopyrrolate (preferred for antisialogogue effect): quaternary ammonium compound; does NOT cross the blood-brain barrier (no central effects); superior antisialogogue with less tachycardia than atropine; preferred in paediatrics and elderly.")

add_h3(doc, "4. H2 Blockers / Antacids (Aspiration Prophylaxis)")
antacids = [
    "Ranitidine 150 mg PO (evening before and morning of surgery): raises gastric pH above 2.5; reduces volume of gastric secretions.",
    "Omeprazole (PPI): 40 mg PO night before and morning of surgery; effective in raising gastric pH and reducing acid volume.",
    "Sodium citrate (0.3 M, 30 mL PO): immediate-acting non-particulate antacid; given 15–20 minutes before RSI in emergency surgery; neutralises gastric acid rapidly.",
    "Metoclopramide 10 mg IV: promotes gastric emptying (prokinetic), reduces gastric volume; also has antiemetic properties.",
    "Indications: full stomach (emergency surgery), pregnancy, GERD, obesity, history of aspiration.",
]
for item in antacids:
    add_numbered(doc, item)

add_h3(doc, "5. Antiemetics")
antiemetics = [
    "Ondansetron 4–8 mg IV: 5-HT3 receptor antagonist; highly effective for prevention of PONV; can be given preoperatively or at end of surgery.",
    "Dexamethasone 4–8 mg IV: potent antiemetic with anti-inflammatory properties; synergistic with ondansetron; also reduces laryngeal oedema after intubation.",
    "Droperidol 0.625–1.25 mg IV: dopamine D2 antagonist; effective antiemetic; note QTc prolongation risk.",
    "Promethazine 25 mg IM: antihistamine with strong antiemetic and sedative properties.",
]
for item in antiemetics:
    add_numbered(doc, item)

add_h3(doc, "6. Other Agents Used Perioperatively")
others_pre = [
    "Beta-blockers (atenolol, metoprolol): continue perioperatively in hypertensive patients; cardioprotective, prevent perioperative hypertension and tachycardia.",
    "Clonidine (alpha-2 agonist): sedation, reduces anaesthetic requirements (MAC reduction), sympatholytic – attenuates haemodynamic responses to laryngoscopy; useful in anxious patients.",
    "Analgesics (paracetamol, COX-2 inhibitors, NSAIDs): multimodal preemptive analgesia; reduces postoperative pain and opioid requirements.",
]
for item in others_pre:
    add_numbered(doc, item)

add_h2(doc, "Drugs Withheld Before Anaesthesia")
withheld = [
    "Oral hypoglycaemics and insulin (adjusted dose on day of surgery per diabetic protocol).",
    "Anticoagulants (timing of withholding depends on procedure and bleeding risk).",
    "MAO inhibitors – serious interactions with pethidine (serotonin syndrome) and sympathomimetics (hypertensive crisis); withhold 2 weeks before elective surgery.",
]
for item in withheld:
    add_bullet(doc, item)

add_h2(doc, "Paediatric Premedication")
add_body_paragraph(doc, "Special considerations in children:", space_after=4)
add_bullet(doc, "Oral midazolam 0.5 mg/kg (maximum 15 mg) – most commonly used agent; given 20–30 minutes before induction.")
add_bullet(doc, "EMLA cream (eutectic mixture of local anaesthetics): applied over IV cannulation sites 60 minutes beforehand to reduce pain of needle insertion.")
add_bullet(doc, "Ketamine 3–5 mg/kg IM: used in extremely uncooperative children when IV access cannot be established.")

# Summary Table
add_h2(doc, "Summary Table: Common Premedication Drugs")

col_widths = [Inches(1.5), Inches(2.0), Inches(2.5)]
table = doc.add_table(rows=7, cols=3)
table.style = "Table Grid"

headers = ["Drug Class", "Drug (Dose)", "Main Purpose"]
hdr_row = table.rows[0]
for i, (cell, header) in enumerate(zip(hdr_row.cells, headers)):
    cell.text = header
    cell.width = col_widths[i]
    p = cell.paragraphs[0]
    run = p.runs[0]
    run.font.name = "Times New Roman"
    run.font.size = Pt(11)
    run.font.bold = True
    shade_cell(cell, "D5E8F0")

rows_data = [
    ("Benzodiazepine",    "Midazolam (0.05–0.1 mg/kg)",   "Anxiolysis, anterograde amnesia"),
    ("Opioid Analgesic",  "Morphine (0.1 mg/kg IM)",      "Preemptive analgesia, sedation"),
    ("Anticholinergic",   "Atropine (0.6 mg IM)\nGlycopyrrolate",  "Antisialogogue, vagolysis, prevent bradycardia"),
    ("Antiemetic",        "Ondansetron (4–8 mg IV)\nDexamethasone (4–8 mg IV)",  "Prevention of PONV"),
    ("Antacid/H2 Blocker","Ranitidine 150 mg PO\nSodium Citrate 30 mL",  "Aspiration prophylaxis"),
    ("Alpha-2 Agonist",   "Clonidine (100–200 mcg PO)",   "Sedation, MAC reduction, haemodynamic stability"),
]
for r_idx, (cls, drug, purpose) in enumerate(rows_data, 1):
    cells = table.rows[r_idx].cells
    cells[0].text = cls;     cells[0].width = col_widths[0]
    cells[1].text = drug;    cells[1].width = col_widths[1]
    cells[2].text = purpose; cells[2].width = col_widths[2]
    for cell in cells:
        for run in cell.paragraphs[0].runs:
            run.font.name = "Times New Roman"
            run.font.size = Pt(11)

doc.add_paragraph()  # spacing after table
doc.add_page_break()


# ══════════════════════════════════════════════════════════════════
# Q.4  Intravenous Anaesthetics + Pharmacology of Propofol
# ══════════════════════════════════════════════════════════════════

add_h1(doc, "Q.4  What are intravenous anaesthetics? Add a note on the pharmacology of Propofol.")

add_body_paragraph(doc,
    "Intravenous (IV) anaesthetics are drugs administered intravenously to produce rapid unconsciousness, "
    "usually for the induction of general anaesthesia. They offer the advantage of a rapid, smooth, and "
    "pleasant onset of unconsciousness within one arm-to-brain circulation time (~30 seconds), avoiding "
    "the unpleasant Stage II excitement seen with inhalational induction.",
    space_after=8)

add_h2(doc, "CLASSIFICATION OF INTRAVENOUS ANAESTHETICS  (KDT 8th Ed.)")

add_h3(doc, "1. Barbiturates")
add_numbered(doc, "Thiopentone sodium (thiopental): prototypic ultra-short acting IV induction agent; still used in some centres for RSI.")
add_numbered(doc, "Methohexitone: short-acting barbiturate; historically used for ECT (electroconvulsive therapy).")

add_h3(doc, "2. Non-barbiturate IV Agents")
add_numbered(doc, "Propofol (2,6-diisopropylphenol): most widely used induction and maintenance agent worldwide; current gold standard.")
add_numbered(doc, "Etomidate: imidazole derivative; preferred in cardiovascular compromise due to minimal cardiac depression; inhibits cortisol synthesis with single dose.")
add_numbered(doc, "Ketamine: dissociative anaesthetic; unique – produces analgesia, unconsciousness, and amnesia while maintaining airway reflexes and haemodynamic stability; NMDA receptor antagonist.")

add_h3(doc, "3. Benzodiazepines (Induction/Sedation)")
add_bullet(doc, "Midazolam (0.3–0.35 mg/kg IV): water-soluble; used for induction, procedural sedation, and ICU sedation; slower onset than propofol.")
add_bullet(doc, "Lorazepam, Diazepam: longer acting; less frequently used for induction; mainly for premedication and procedural sedation.")

add_h3(doc, "4. Alpha-2 Adrenoceptor Agonist")
add_bullet(doc, "Dexmedetomidine: highly selective alpha-2 agonist; produces sedation and analgesia without respiratory depression; used for ICU sedation, awake fibreoptic intubation, and procedural sedation. Does NOT produce unconsciousness at standard doses.")

# ── Pharmacology of Propofol ───────────────────────────────────────
add_h2(doc, "PHARMACOLOGY OF PROPOFOL")

add_body_paragraph(doc,
    "Propofol (2,6-diisopropylphenol) is the most widely used intravenous anaesthetic agent worldwide, "
    "introduced in 1977 and approved for clinical use in 1986. It has become the gold standard for "
    "induction and maintenance of general anaesthesia.",
    space_after=8)

add_h3(doc, "Physical Properties")
phys = [
    "White oil-in-water emulsion (soya bean oil 10%, egg phosphatide 1.2%, glycerol 2.25%).",
    "Insoluble in water; requires lipid emulsion formulation for IV delivery.",
    "pH 7 (neutral); stored at room temperature (2–25°C).",
    "Supports microbial growth (no bacteriostatic preservative in most formulations) – strict aseptic technique mandatory; single-use within 6–12 hours of opening.",
    "Provides caloric load: 1.1 kcal/mL from lipid (relevant in ICU long-term infusions).",
]
for item in phys:
    add_bullet(doc, item)

add_h3(doc, "Mechanism of Action")
add_body_paragraph(doc,
    "Propofol acts primarily by potentiating GABA-A receptor-mediated inhibitory neurotransmission. "
    "Specifically, it increases the duration of Cl- channel opening at the GABA-A receptor (similar "
    "to barbiturates), leading to membrane hyperpolarisation and global CNS depression. "
    "Additional mechanisms include:")
moa_p = [
    "Inhibition of NMDA receptor-mediated excitatory neurotransmission.",
    "Modulation of glycine receptors (inhibitory neurotransmitter).",
    "Activation of TREK-1 (two-pore domain K+) channels contributing to hyperpolarisation.",
]
for item in moa_p:
    add_numbered(doc, item)

add_body_paragraph(doc,
    "At subanesthetic concentrations, propofol produces sedation and anxiolysis; at induction doses, "
    "it produces rapid unconsciousness within 30–60 seconds.")

add_h3(doc, "Pharmacokinetics")
pk = [
    ("Onset",             "Rapid – loss of consciousness within 30–60 seconds of IV injection (one arm–brain circulation time)."),
    ("Duration",          "Short – 5–10 minutes following a single bolus dose (due to rapid redistribution from brain to peripheral tissues and fat)."),
    ("Distribution",      "Highly lipophilic; large volume of distribution (~3.5 L/kg); rapidly enters CNS."),
    ("Protein binding",   "~98% (mainly albumin)."),
    ("Metabolism",        "Hepatic conjugation (glucuronidation and sulfation) to inactive metabolites. Extra-hepatic metabolism also occurs (lung, kidney), allowing use even in liver failure with caution."),
    ("Elimination t1/2",  "Initial distribution: 2–8 minutes; terminal elimination: 4–7 hours (biphasic)."),
    ("Context-sensitive half-time", "Remains relatively short even after prolonged infusion (enables TIVA without accumulation and prolonged sedation)."),
    ("Excretion",         "Renal – 88% as conjugated metabolites; green discolouration of urine (benign)."),
]
for prop, val in pk:
    p = doc.add_paragraph(style="Normal")
    r1 = p.add_run(prop + ": ")
    set_body_font(r1, bold=True)
    r2 = p.add_run(val)
    set_body_font(r2)
    set_line_spacing(p)
    p.paragraph_format.space_after = Pt(4)

add_h3(doc, "Pharmacological Actions")

add_body_paragraph(doc, "CNS:", bold=True, space_after=3)
cns_p = [
    "Unconsciousness within 30–60 seconds; dose 1.5–2.5 mg/kg IV for induction (lower in elderly: 1–1.5 mg/kg).",
    "Excellent amnesia; NO intrinsic analgesic activity (must supplement with opioids for painful procedures).",
    "Antiemetic property (reduces PONV) – major clinical advantage; mechanism involves direct antiemetic activity at 5-HT3 receptors and suppression of the chemoreceptor trigger zone.",
    "Reduces ICP and cerebral metabolic rate (CMRO2) – useful in neuroanaesthesia; maintains cerebral autoregulation.",
    "Anticonvulsant at low doses; may cause myoclonic excitatory movements during induction (does not represent seizure activity).",
    "EEG: burst suppression at high doses.",
]
for item in cns_p:
    add_bullet(doc, item)

add_body_paragraph(doc, "Cardiovascular (most important adverse effect):", bold=True, space_after=3)
cvs_p = [
    "Significant hypotension: fall in MAP by 25–40% during induction; due to vasodilation (reduced systemic vascular resistance) and mild negative inotropy.",
    "Bradycardia: inhibits baroreceptor reflex arc; worsens the hypotensive response.",
    "More haemodynamic instability than thiopentone; particularly problematic in elderly, hypovolaemic, and cardiac-compromised patients.",
]
for item in cvs_p:
    add_bullet(doc, item)

add_body_paragraph(doc, "Respiratory:", bold=True, space_after=3)
resp_p = [
    "Dose-dependent respiratory depression – apnoea after induction bolus (common, brief, 30–90 seconds); depresses tidal volume and rate.",
    "Depresses laryngeal and protective reflexes – facilitates LMA (laryngeal mask airway) insertion without neuromuscular blockade.",
    "Bronchodilation – reduces airway resistance; suitable for asthmatic patients.",
]
for item in resp_p:
    add_bullet(doc, item)

add_h3(doc, "Clinical Uses")
clinical_uses = [
    "Induction of general anaesthesia: 1.5–2.5 mg/kg IV (most common indication; has largely replaced thiopentone).",
    "Maintenance of anaesthesia (TIVA): Propofol infusion 4–12 mg/kg/hr; provides smooth, controllable anaesthesia with rapid clear-headed recovery.",
    "Procedural sedation (MAC – Monitored Anaesthesia Care): 25–75 mcg/kg/min infusion for endoscopy, colonoscopy, cardioversion, dental procedures.",
    "ICU sedation: Propofol infusion for mechanically ventilated patients; facilitates rapid neurological assessment (can wake patient quickly); caution – risk of PRIS with doses >4 mg/kg/hr for >48 hours.",
    "Antiemetic: Subhypnotic doses (10–20 mg IV bolus) as rescue antiemetic for PONV unresponsive to standard therapy.",
]
for i, use in enumerate(clinical_uses, 1):
    add_numbered(doc, use)

add_h3(doc, "Adverse Effects")
aes_p = [
    ("Hypotension",
     "Most common serious adverse effect (especially in elderly, hypovolaemic, or cardiac-compromised patients); "
     "manage by slowing injection rate, fluid preloading, and vasopressors."),
    ("Pain on Injection",
     "Very common (60–80% of patients); burning pain at IV site (due to aqueous phase propofol concentration). "
     "Reduced by: injecting into large antecubital vein (not dorsum of hand), pretreatment with IV lignocaine "
     "1–2 mg/kg (or mixing lignocaine with propofol), cooling the formulation."),
    ("Apnoea",
     "Brief apnoea (30–90 seconds) during induction in virtually all patients; anticipate and have airway "
     "equipment ready."),
    ("Propofol Infusion Syndrome (PRIS)",
     "Rare but life-threatening; occurs with prolonged high-dose infusions (>4 mg/kg/hr for >48 hours), "
     "particularly in ICU patients and children. Features: metabolic acidosis, rhabdomyolysis, "
     "hyperkalemia, acute renal failure, cardiac failure (right bundle branch block, Brugada-pattern ECG), "
     "hypertriglyceridaemia, hepatomegaly. Treatment: immediate discontinuation of propofol, supportive "
     "ICU care (dialysis, haemofiltration, ECMO in severe cases)."),
    ("Egg/Soy Allergy",
     "Contains egg phosphatide and soybean oil; use with caution in patients with severe egg or soy allergy "
     "(true anaphylaxis to propofol itself is rare)."),
    ("Hypertriglyceridaemia",
     "With prolonged infusion (provides 1.1 kcal/mL from lipid); monitor serum triglycerides."),
    ("Microbial Contamination",
     "Supports bacterial growth at room temperature; strict aseptic technique and single-use policy required."),
    ("Green Urine Discolouration",
     "Benign; due to phenol metabolites in urine; not indicative of organ toxicity."),
    ("Involuntary Excitatory Movements",
     "Myoclonic jerks during induction; not true seizure activity; self-limiting."),
    ("Bradycardia",
     "May occur, particularly in combination with opioids or beta-blockers; treat with atropine."),
]
for title, text in aes_p:
    p = doc.add_paragraph(style="Normal")
    r1 = p.add_run(title + ": ")
    set_body_font(r1, bold=True)
    r2 = p.add_run(text)
    set_body_font(r2)
    set_line_spacing(p)
    p.paragraph_format.space_after = Pt(5)

add_h3(doc, "Contraindications")
contraind = [
    "Known allergy to propofol or its components (soy, egg).",
    "Severe cardiovascular compromise / haemodynamic instability (use etomidate instead).",
    "Children <3 years for prolonged ICU sedation (high risk of PRIS).",
]
for item in contraind:
    add_bullet(doc, item)

add_h3(doc, "Advantages of Propofol over Other IV Anaesthetics")
advantages = [
    "Rapid, smooth induction within 30–60 seconds.",
    "Short context-sensitive half-time: rapid, clear-headed recovery – ideal for day-surgery.",
    "Significant antiemetic property: reduced PONV compared to volatile agents.",
    "Titratable in TIVA: precise depth of anaesthesia control throughout surgery.",
    "Reduces ICP and CMRO2: beneficial in neuroanaesthesia.",
    "Anticonvulsant: useful in refractory status epilepticus.",
    "Pleasant recovery – minimal postoperative hangover.",
]
for item in advantages:
    add_bullet(doc, item)

add_h3(doc, "Disadvantages of Propofol")
disadvantages = [
    "No analgesic properties – must supplement with opioids, ketamine, or regional analgesia.",
    "Significant hypotension, especially in elderly and hypovolaemic patients.",
    "Pain on injection (60–80%).",
    "Propofol Infusion Syndrome (PRIS) with prolonged high-dose use.",
    "Expensive compared to thiopentone and volatile anaesthetics.",
    "Supports microbial growth – infection risk with poor aseptic technique.",
]
for item in disadvantages:
    add_bullet(doc, item)

# Final reference paragraph
doc.add_paragraph()
add_body_paragraph(doc,
    "Reference: Tripathi KD. Essentials of Medical Pharmacology. 8th Edition. "
    "Jaypee Brothers Medical Publishers; 2019. Chapters 24–25: General Anaesthetics.",
    italic=True, space_after=6)


# ══════════════════════════════════════════════════════════════════
# Save document
# ══════════════════════════════════════════════════════════════════

output_path = "/tmp/workspace/assignments/Assignment_21_07_26.docx"

try:
    doc.save(output_path)
    print(f"SUCCESS: Document saved to {output_path}")
except Exception as e:
    print(f"Direct save failed: {e}. Trying BytesIO fallback...")
    buf = BytesIO()
    doc.save(buf)
    with open(output_path, "wb") as f:
        f.write(buf.getvalue())
    print(f"SUCCESS (BytesIO fallback): Document saved to {output_path}")
Writing File

~/assignments/generate_assignment.py

"""
Pharmacology Assignment – 17-07-26
Sedative Hypnotics & Antiepileptic Drugs
Reference: KD Tripathi Essentials of Medical Pharmacology, 8th Edition
"""

from docx import Document
from docx.shared import Pt, Inches, RGBColor
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.enum.section import WD_ORIENT
from docx.oxml.ns import qn
from docx.oxml import OxmlElement
from io import BytesIO

# ──────────────────────────────────────────────
# Helper utilities
# ──────────────────────────────────────────────

def set_paragraph_spacing(para, space_before=0, space_after=6, line_spacing=1.5):
    """Apply spacing to a paragraph."""
    from docx.shared import Pt
    from docx.oxml.ns import qn
    pPr = para._p.get_or_add_pPr()
    # spacing element
    spacing = pPr.find(qn("w:spacing"))
    if spacing is None:
        spacing = OxmlElement("w:spacing")
        pPr.append(spacing)
    if space_before is not None:
        spacing.set(qn("w:before"), str(int(space_before * 20)))
    if space_after is not None:
        spacing.set(qn("w:after"), str(int(space_after * 20)))
    # line spacing: 1.5 = 360 twips in auto mode
    if line_spacing:
        spacing.set(qn("w:line"), str(int(line_spacing * 240)))
        spacing.set(qn("w:lineRule"), "auto")


def add_body_para(doc, text, bold=False, italic=False, align=WD_ALIGN_PARAGRAPH.LEFT):
    """Add a Normal-style paragraph with Times New Roman 12pt."""
    p = doc.add_paragraph(style="Normal")
    run = p.add_run(text)
    run.font.name = "Times New Roman"
    run.font.size = Pt(12)
    run.bold = bold
    run.italic = italic
    p.alignment = align
    set_paragraph_spacing(p)
    return p


def add_heading1(doc, text):
    """Add a Heading 1 paragraph."""
    p = doc.add_heading(text, level=1)
    # Ensure font is Times New Roman
    for run in p.runs:
        run.font.name = "Times New Roman"
    set_paragraph_spacing(p, space_before=12, space_after=6)
    return p


def add_heading2(doc, text):
    """Add a Heading 2 paragraph."""
    p = doc.add_heading(text, level=2)
    for run in p.runs:
        run.font.name = "Times New Roman"
    set_paragraph_spacing(p, space_before=10, space_after=4)
    return p


def add_bullet(doc, text, level=1):
    """Add a bullet list item."""
    style = "List Bullet" if level == 1 else "List Bullet 2"
    p = doc.add_paragraph(style=style)
    run = p.add_run(text)
    run.font.name = "Times New Roman"
    run.font.size = Pt(12)
    set_paragraph_spacing(p, space_before=0, space_after=3)
    return p


def add_numbered(doc, text, level=1):
    """Add a numbered list item."""
    style = "List Number" if level == 1 else "List Number 2"
    p = doc.add_paragraph(style=style)
    run = p.add_run(text)
    run.font.name = "Times New Roman"
    run.font.size = Pt(12)
    set_paragraph_spacing(p, space_before=0, space_after=3)
    return p


def add_italic_heading(doc, text):
    """Add bold+italic subheading within body text (used for sub-sub-headings like dose-related)."""
    p = doc.add_paragraph(style="Normal")
    run = p.add_run(text)
    run.font.name = "Times New Roman"
    run.font.size = Pt(12)
    run.bold = True
    run.italic = True
    set_paragraph_spacing(p, space_before=4, space_after=2)
    return p


def shade_cell(cell, hex_fill):
    tcPr = cell._tc.get_or_add_tcPr()
    shd = OxmlElement("w:shd")
    shd.set(qn("w:val"), "clear")
    shd.set(qn("w:fill"), hex_fill)
    tcPr.append(shd)


# ──────────────────────────────────────────────
# Document setup
# ──────────────────────────────────────────────

doc = Document()

# Page setup
section = doc.sections[0]
section.page_width = Inches(8.5)
section.page_height = Inches(11)
section.top_margin = Inches(1)
section.bottom_margin = Inches(1)
section.left_margin = Inches(1.25)
section.right_margin = Inches(1.25)

# Configure Normal style
normal_style = doc.styles["Normal"]
normal_style.font.name = "Times New Roman"
normal_style.font.size = Pt(12)

# Configure Heading 1 style
h1 = doc.styles["Heading 1"]
h1.font.name = "Times New Roman"
h1.font.size = Pt(14)
h1.font.bold = True
h1.font.color.rgb = RGBColor(0x00, 0x00, 0x00)

# Configure Heading 2 style
h2 = doc.styles["Heading 2"]
h2.font.name = "Times New Roman"
h2.font.size = Pt(13)
h2.font.bold = True
h2.font.color.rgb = RGBColor(0x00, 0x00, 0x00)

# ──────────────────────────────────────────────
# TITLE PAGE
# ──────────────────────────────────────────────

# Top spacer
for _ in range(4):
    sp = doc.add_paragraph()
    set_paragraph_spacing(sp, 0, 0, 1.0)

# Title
title_p = doc.add_paragraph(style="Normal")
title_run = title_p.add_run("Assignment – 17-07-26")
title_run.font.name = "Times New Roman"
title_run.font.size = Pt(18)
title_run.bold = True
title_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
set_paragraph_spacing(title_p, space_before=0, space_after=10)

subtitle_p = doc.add_paragraph(style="Normal")
subtitle_run = subtitle_p.add_run("Sedative Hypnotics & Antiepileptic Drugs")
subtitle_run.font.name = "Times New Roman"
subtitle_run.font.size = Pt(16)
subtitle_run.bold = True
subtitle_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
set_paragraph_spacing(subtitle_p, space_before=0, space_after=8)

subject_p = doc.add_paragraph(style="Normal")
subject_run = subject_p.add_run("Subject: Pharmacology")
subject_run.font.name = "Times New Roman"
subject_run.font.size = Pt(13)
subject_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
set_paragraph_spacing(subject_p, space_before=0, space_after=6)

date_p = doc.add_paragraph(style="Normal")
date_run = date_p.add_run("Date: 17-07-2026")
date_run.font.name = "Times New Roman"
date_run.font.size = Pt(13)
date_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
set_paragraph_spacing(date_p, space_before=0, space_after=6)

ref_p = doc.add_paragraph(style="Normal")
ref_run = ref_p.add_run("Reference: KD Tripathi – Essentials of Medical Pharmacology, 8th Edition")
ref_run.font.name = "Times New Roman"
ref_run.font.size = Pt(12)
ref_run.italic = True
ref_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
set_paragraph_spacing(ref_p, space_before=0, space_after=6)

# Page break after title page
doc.add_page_break()

# ══════════════════════════════════════════════════════════════════
# Q.1 – Phenytoin
# ══════════════════════════════════════════════════════════════════

add_heading1(doc, "Q.1  Classify antiepileptic drugs and explain the mechanism of action, "
             "therapeutic uses, and adverse effects of Phenytoin.")

# ── Classification ──
add_heading2(doc, "CLASSIFICATION OF ANTIEPILEPTIC DRUGS (KDT 8th Ed.)")

add_body_para(doc, "A. Based on Chemical Structure:", bold=True)
add_numbered(doc, "Hydantoins: Phenytoin, Fosphenytoin")
add_numbered(doc, "Barbiturates: Phenobarbitone, Primidone")
add_numbered(doc, "Iminostilbenes: Carbamazepine, Oxcarbazepine")
add_numbered(doc, "Succinimides: Ethosuximide")
add_numbered(doc, "Benzodiazepines: Diazepam, Clonazepam, Lorazepam")
add_numbered(doc, "Valproate: Sodium valproate, Valproic acid")
add_numbered(doc, "Newer agents: Lamotrigine, Levetiracetam, Gabapentin, Pregabalin, "
             "Topiramate, Vigabatrin, Tiagabine, Zonisamide, Lacosamide, Perampanel")

add_body_para(doc, "B. Based on Mechanism of Action:", bold=True)
add_numbered(doc, "Sodium channel blockers: Phenytoin, Carbamazepine, Valproate, Lamotrigine, Topiramate")
add_numbered(doc, "Calcium channel blockers (T-type): Ethosuximide, Valproate")
add_numbered(doc, "GABA enhancers: Benzodiazepines, Barbiturates, Vigabatrin, Tiagabine, Gabapentin")
add_numbered(doc, "Glutamate antagonists: Lamotrigine, Topiramate, Perampanel")
add_numbered(doc, "Unique mechanisms: Levetiracetam (SV2A binding)")

# ── Phenytoin ──
add_heading2(doc, "PHENYTOIN (Diphenylhydantoin)")

# MOA
add_heading2(doc, "Mechanism of Action")
add_body_para(doc,
    "Phenytoin acts primarily by blocking voltage-gated sodium channels in a use-dependent "
    "(frequency-dependent) manner. It preferentially binds to the inactivated state of the Na+ "
    "channel and prolongs its inactivation, thereby reducing sustained high-frequency repetitive "
    "firing of action potentials in epileptic foci without significantly affecting normal neuronal "
    "function. Additionally, it reduces calcium influx through L-type calcium channels at high "
    "concentrations and inhibits calmodulin kinase, which modulates neurotransmitter release. "
    "The overall effect is stabilization of neuronal membranes and suppression of epileptiform activity.")

# Pharmacokinetics
add_heading2(doc, "Pharmacokinetics")
add_bullet(doc, "Absorption: Variable oral absorption; phenytoin sodium capsules preferred (extended release)")
add_bullet(doc, "Protein binding: ~90% bound to plasma albumin")
add_bullet(doc, "Metabolism: Hepatic via CYP2C9/CYP2C19 (zero-order/saturable kinetics at therapeutic doses)")
add_bullet(doc, "Half-life: 20–30 hours (highly variable; dose-dependent)")
add_bullet(doc, "Exhibits non-linear (Michaelis-Menten) pharmacokinetics – small dose increases can cause "
           "disproportionate rise in plasma levels")

# Therapeutic Uses
add_heading2(doc, "Therapeutic Uses")
add_numbered(doc, "Epilepsy:")
add_bullet(doc, "Drug of choice (DOC) / first-line for: Generalized tonic-clonic (grand mal) seizures; "
           "Focal (partial) seizures with or without secondary generalization", level=2)
add_bullet(doc, "Status epilepticus: IV phenytoin/fosphenytoin (second-line after benzodiazepines)", level=2)
add_bullet(doc, "NOT effective for absence (petit mal) seizures – may worsen them", level=2)
add_numbered(doc, "Trigeminal neuralgia (second-line, after carbamazepine)")
add_numbered(doc, "Cardiac arrhythmias: Digoxin-induced arrhythmias, ventricular arrhythmias (rarely used now)")
add_numbered(doc, "Neuropathic pain (adjuvant use)")

# Adverse Effects
add_heading2(doc, "Adverse Effects")

add_italic_heading(doc, "a) Dose-related (concentration-dependent):")
add_bullet(doc, "Nystagmus (earliest sign at plasma levels >20 mcg/mL)")
add_bullet(doc, "Diplopia and ataxia (cerebellar signs)")
add_bullet(doc, "Confusion, cognitive impairment")
add_bullet(doc, "Sedation, slurred speech")

add_italic_heading(doc, "b) Idiosyncratic / Hypersensitivity:")
add_bullet(doc, "Skin rashes (morbilliform), rarely Stevens-Johnson syndrome, toxic epidermal necrolysis")
add_bullet(doc, "Drug reaction with eosinophilia and systemic symptoms (DRESS)")
add_bullet(doc, "Hepatotoxicity (rare)")

add_italic_heading(doc, "c) Chronic Toxicity:")
add_bullet(doc, "Gingival hyperplasia – most characteristic side effect (inhibition of collagen metabolism; "
           "especially in children; avoid in epileptic children)")
add_bullet(doc, "Hirsutism (especially in young women)")
add_bullet(doc, "Coarsening of facial features")
add_bullet(doc, "Peripheral neuropathy (long-term use)")
add_bullet(doc, "Megaloblastic anemia (folate deficiency – impairs folate absorption)")
add_bullet(doc, "Osteomalacia (induces CYP enzymes, increasing Vitamin D metabolism)")
add_bullet(doc, "Cerebellar atrophy (chronic high doses)")

add_italic_heading(doc, "d) Teratogenicity:")
add_bullet(doc, "Fetal hydantoin syndrome: cleft palate, cleft lip, cardiac defects, growth retardation, "
           "digital hypoplasia, nail hypoplasia")

add_italic_heading(doc, "e) Drug Interactions:")
add_bullet(doc, "Induces CYP enzymes (CYP1A2, CYP2C, CYP3A) – reduces efficacy of OCP, warfarin, corticosteroids")
add_bullet(doc, "Displaced by valproate from protein binding – increases free phenytoin levels")
add_bullet(doc, "Inhibited by isoniazid, chloramphenicol, cimetidine – raises phenytoin levels")

doc.add_page_break()

# ══════════════════════════════════════════════════════════════════
# Q.2 – Newer Antiepileptic Agents
# ══════════════════════════════════════════════════════════════════

add_heading1(doc, "Q.2  Write a short note on newer antiepileptic agents.")

add_heading2(doc, "NEWER ANTIEPILEPTIC DRUGS (Third Generation)")

add_body_para(doc,
    "The newer antiepileptic drugs (AEDs) were developed to overcome the limitations of older agents – "
    "particularly to reduce drug interactions, improve tolerability, and offer broader spectrum activity.")

# Lamotrigine
add_heading2(doc, "1. Lamotrigine")
add_bullet(doc, "Mechanism of Action: Blocks voltage-sensitive Na+ channels (use-dependent); also inhibits glutamate release")
add_bullet(doc, "Uses: Broad spectrum – partial seizures, generalized tonic-clonic, absence, Lennox-Gastaut syndrome, bipolar disorder")
add_bullet(doc, "Adverse Effects: Skin rash (can progress to Stevens-Johnson syndrome – especially if dose escalated rapidly), dizziness, diplopia, headache")
add_bullet(doc, "Advantage: Safe in pregnancy (relatively); no enzyme induction")

# Levetiracetam
add_heading2(doc, "2. Levetiracetam")
add_bullet(doc, "Mechanism of Action: Binds to synaptic vesicle protein SV2A, modulating neurotransmitter release (unique mechanism)")
add_bullet(doc, "Uses: Partial seizures, myoclonic epilepsy (DOC for juvenile myoclonic epilepsy), generalized tonic-clonic")
add_bullet(doc, "Adverse Effects: Somnolence, behavioral disturbances (irritability, aggression), headache")
add_bullet(doc, "Advantages: No hepatic metabolism, minimal drug interactions, no enzyme induction, safe in pregnancy")

# Gabapentin
add_heading2(doc, "3. Gabapentin")
add_bullet(doc, "Mechanism of Action: Binds to alpha-2-delta subunit of voltage-gated Ca2+ channels, reducing calcium influx "
           "and neurotransmitter release (does NOT actually act on GABA receptors despite its name)")
add_bullet(doc, "Uses: Partial seizures, neuropathic pain (postherpetic neuralgia, diabetic neuropathy), "
           "restless leg syndrome, fibromyalgia")
add_bullet(doc, "Adverse Effects: Dizziness, somnolence, ataxia, peripheral edema, weight gain")

# Pregabalin
add_heading2(doc, "4. Pregabalin")
add_bullet(doc, "Mechanism of Action: Same as gabapentin (alpha-2-delta subunit of Ca2+ channels) but more potent and predictable absorption")
add_bullet(doc, "Uses: Partial seizures, neuropathic pain, generalized anxiety disorder, fibromyalgia")
add_bullet(doc, "Adverse Effects: Dizziness, somnolence, weight gain, peripheral edema")

# Topiramate
add_heading2(doc, "5. Topiramate")
add_bullet(doc, "Mechanism of Action: Multiple – Na+ channel blockade, GABA-A enhancement, "
           "AMPA/kainate glutamate receptor blockade, carbonic anhydrase inhibition")
add_bullet(doc, "Uses: Partial and generalized seizures, migraine prophylaxis, Lennox-Gastaut syndrome")
add_bullet(doc, "Adverse Effects: Cognitive impairment (\"dopamax\" – word-finding difficulty), weight loss, "
           "nephrolithiasis (kidney stones – due to CA inhibition), metabolic acidosis, "
           "angle-closure glaucoma (acute), paresthesias")

# Vigabatrin
add_heading2(doc, "6. Vigabatrin")
add_bullet(doc, "Mechanism of Action: Irreversible inhibitor of GABA-transaminase (the enzyme that degrades GABA), "
           "thereby increasing brain GABA levels")
add_bullet(doc, "Uses: Infantile spasms (West syndrome – DOC), partial seizures refractory to other drugs")
add_bullet(doc, "Adverse Effects: Visual field defects (irreversible bilateral concentric visual field constriction – "
           "limits its use), sedation, weight gain")

# Tiagabine
add_heading2(doc, "7. Tiagabine")
add_bullet(doc, "Mechanism of Action: Blocks GABA reuptake transporter (GAT-1), increasing synaptic GABA")
add_bullet(doc, "Uses: Adjunctive therapy in partial seizures")
add_bullet(doc, "Adverse Effects: Dizziness, nervousness, confusion, may precipitate non-convulsive status epilepticus")

# Lacosamide
add_heading2(doc, "8. Lacosamide")
add_bullet(doc, "Mechanism of Action: Enhances slow inactivation of Na+ channels; also modulates CRMP-2 "
           "(collapsin response mediator protein-2)")
add_bullet(doc, "Uses: Partial-onset seizures (adjunctive)")
add_bullet(doc, "Adverse Effects: Dizziness, diplopia, PR interval prolongation")

# Perampanel
add_heading2(doc, "9. Perampanel")
add_bullet(doc, "Mechanism of Action: Selective non-competitive AMPA (alpha-amino-3-hydroxy-5-methyl-4-isoxazolepropionic acid) "
           "glutamate receptor antagonist")
add_bullet(doc, "Uses: Partial and generalized tonic-clonic seizures (adjunctive)")
add_bullet(doc, "Adverse Effects: Dizziness, aggression, psychiatric disturbances")

# Zonisamide
add_heading2(doc, "10. Zonisamide")
add_bullet(doc, "Mechanism of Action: Na+ channel blockade, T-type Ca2+ channel blockade, carbonic anhydrase inhibition")
add_bullet(doc, "Uses: Partial seizures, juvenile myoclonic epilepsy, Lennox-Gastaut")
add_bullet(doc, "Adverse Effects: Somnolence, anorexia, nephrolithiasis, oligohydrosis (decreased sweating)")

doc.add_page_break()

# ══════════════════════════════════════════════════════════════════
# Q.3 – Sedative-Hypnotics & Diazepam
# ══════════════════════════════════════════════════════════════════

add_heading1(doc, "Q.3  Classify sedative-hypnotics. Discuss the mechanism of action, "
             "pharmacological actions, adverse effects, clinical uses, contraindications, "
             "and indications of Diazepam.")

add_heading2(doc, "CLASSIFICATION OF SEDATIVE-HYPNOTICS (KDT 8th Ed.)")

add_body_para(doc, "I. Benzodiazepines:", bold=True)
add_bullet(doc, "Long-acting: Diazepam, Chlordiazepoxide, Clonazepam, Clorazepate")
add_bullet(doc, "Intermediate-acting: Alprazolam, Lorazepam, Oxazepam, Temazepam")
add_bullet(doc, "Short-acting: Triazolam, Midazolam")

add_body_para(doc, "II. Barbiturates:", bold=True)
add_bullet(doc, "Ultra-short acting: Thiopentone")
add_bullet(doc, "Short-acting: Pentobarbitone, Secobarbitone")
add_bullet(doc, "Intermediate-acting: Butobarbitone, Amobarbitone")
add_bullet(doc, "Long-acting: Phenobarbitone")

add_body_para(doc, "III. Non-benzodiazepine hypnotics (Z-drugs):", bold=True)
add_bullet(doc, "Zolpidem, Zaleplon, Zopiclone, Eszopiclone")

add_body_para(doc, "IV. Melatonin receptor agonists:", bold=True)
add_bullet(doc, "Ramelteon, Melatonin")

add_body_para(doc, "V. Orexin (hypocretin) receptor antagonists:", bold=True)
add_bullet(doc, "Suvorexant, Lemborexant")

add_body_para(doc, "VI. Others:", bold=True)
add_bullet(doc, "Buspirone (anxiolytic, not hypnotic)")
add_bullet(doc, "Antihistamines (promethazine, diphenhydramine)")
add_bullet(doc, "Chloral hydrate, Paraldehyde (older agents)")

# ── Diazepam ──
add_heading2(doc, "DIAZEPAM")

# MOA
add_heading2(doc, "Mechanism of Action")
add_body_para(doc,
    "Diazepam acts as a positive allosteric modulator of the GABA-A receptor. The GABA-A receptor is "
    "a ligand-gated Cl- ion channel consisting of 5 subunits (typically 2alpha, 2beta, 1gamma). "
    "Diazepam binds to the benzodiazepine binding site located at the interface of alpha and gamma "
    "subunits (specifically alpha1, alpha2, alpha3, alpha5 subunits). This binding does not directly "
    "open the channel but increases the FREQUENCY of Cl- channel opening in response to GABA. "
    "The resultant increased Cl- influx leads to hyperpolarization of the neuronal membrane, enhancing "
    "inhibitory neurotransmission and producing sedation, anxiolysis, muscle relaxation, and "
    "anticonvulsant effects.")
add_body_para(doc,
    "Note: Barbiturates act on a different site on the GABA-A receptor and increase the DURATION of "
    "Cl- channel opening (not frequency).", italic=True)

# Pharmacokinetics
add_heading2(doc, "Pharmacokinetics")
add_bullet(doc, "Lipid soluble – rapid CNS penetration after IV/IM administration")
add_bullet(doc, "Oral bioavailability: ~100%; IM absorption erratic (IV or oral preferred)")
add_bullet(doc, "Protein binding: ~98%")
add_bullet(doc, "Metabolism: Hepatic (CYP2C19, CYP3A4) – active metabolites: desmethyldiazepam (nordazepam), oxazepam, temazepam")
add_bullet(doc, "Half-life: Parent: 20–70 hours; desmethyldiazepam: 36–200 hours (cumulative effect)")
add_bullet(doc, "Excreted in urine as glucuronide conjugates")

# Pharmacological Actions
add_heading2(doc, "Pharmacological Actions")
add_numbered(doc, "Anxiolysis: Reduces anxiety at sub-sedative doses; acts on limbic system")
add_numbered(doc, "Sedation and Hypnosis: Dose-dependent CNS depression; decreases sleep latency, reduces REM sleep")
add_numbered(doc, "Anticonvulsant: Suppresses seizure spread; elevates seizure threshold")
add_numbered(doc, "Muscle Relaxation: Acts on spinal cord interneurons (polysynaptic inhibition) and supraspinal sites")
add_numbered(doc, "Anterograde Amnesia: Impairs formation of new memories")
add_numbered(doc, "Cardiovascular: Minimal effects at therapeutic doses; slight fall in BP")
add_numbered(doc, "Respiratory: Mild respiratory depression (dose-dependent); dangerous in COPD patients")

# Clinical Uses
add_heading2(doc, "Clinical Uses")
add_numbered(doc, "Anxiety disorders: Generalized anxiety disorder, panic disorder, situational anxiety (short-term use only)")
add_numbered(doc, "Insomnia: Short-term management; not preferred for long-term due to dependence")
add_numbered(doc, "Seizures / Epilepsy:")
add_bullet(doc, "Status epilepticus: IV diazepam is first-line treatment (0.15 mg/kg IV, repeat after 5 min if needed)", level=2)
add_bullet(doc, "Febrile seizures: Rectal diazepam for acute management", level=2)
add_bullet(doc, "Alcohol withdrawal seizures", level=2)
add_numbered(doc, "Muscle spasm: Skeletal muscle spasm, spastic conditions (cerebral palsy, tetanus)")
add_numbered(doc, "Pre-anaesthetic medication: Reduces anxiety, produces amnesia before surgery")
add_numbered(doc, "Procedural sedation: For endoscopy, cardioversion, minor surgical procedures")
add_numbered(doc, "Alcohol and drug withdrawal: Prevents withdrawal seizures and delirium tremens")
add_numbered(doc, "Night terrors and somnambulism (sleep walking)")
add_numbered(doc, "Tetanus: IV diazepam for muscle spasm control")

# Adverse Effects
add_heading2(doc, "Adverse Effects")
add_numbered(doc, "CNS: Drowsiness, sedation, cognitive impairment, anterograde amnesia, psychomotor impairment")
add_numbered(doc, "Paradoxical reactions: Increased anxiety, aggression, disinhibition (especially in elderly and children)")
add_numbered(doc, "Respiratory depression: Especially with opioids, alcohol, or in COPD patients")
add_numbered(doc, "Cardiovascular: Hypotension (with IV use)")
add_numbered(doc, "Dependence and tolerance: Physical and psychological dependence with long-term use; "
             "tolerance to sedative/hypnotic effects (not anxiolytic)")
add_numbered(doc, "Withdrawal syndrome: Anxiety, tremor, sweating, insomnia, seizures (life-threatening on abrupt discontinuation)")
add_numbered(doc, "Hangover effect: Residual sedation next morning (due to long half-life)")
add_numbered(doc, "Thrombophlebitis: With IV diazepam (due to insolubility in water; use emulsion preparation)")

# Contraindications
add_heading2(doc, "Contraindications")
add_bullet(doc, "Myasthenia gravis (worsens neuromuscular blockade)")
add_bullet(doc, "Respiratory depression / COPD / Sleep apnea")
add_bullet(doc, "Severe hepatic impairment")
add_bullet(doc, "Narrow-angle glaucoma")
add_bullet(doc, "Pregnancy (Category D) – crosses placenta; neonatal respiratory depression, "
           "\"floppy infant syndrome,\" cleft palate")
add_bullet(doc, "Breastfeeding")
add_bullet(doc, "Acute alcohol intoxication")
add_bullet(doc, "Known hypersensitivity to benzodiazepines")

# Antidote
add_heading2(doc, "Antidote")
add_body_para(doc,
    "Flumazenil – competitive antagonist at the benzodiazepine binding site; "
    "administered IV; short-acting (resedation can occur due to short duration of action).")

doc.add_page_break()

# ══════════════════════════════════════════════════════════════════
# Q.4 – Non-Benzodiazepine Hypnotics
# ══════════════════════════════════════════════════════════════════

add_heading1(doc, "Q.4  Write a short note on non-benzodiazepine hypnotics.")

add_heading2(doc, "NON-BENZODIAZEPINE HYPNOTICS (Z-DRUGS) (KDT 8th Ed.)")

add_body_para(doc,
    "Non-benzodiazepine hypnotics are a class of GABA-A receptor modulators that were developed as "
    "safer alternatives to benzodiazepines for the treatment of insomnia. Although they share the same "
    "receptor target, they differ in receptor subtype selectivity, producing more selective hypnotic "
    "effects with fewer anxiolytic, anticonvulsant, and muscle relaxant properties.")

add_heading2(doc, "Drugs in This Class")
add_numbered(doc, "Zolpidem (most widely used)")
add_numbered(doc, "Zaleplon")
add_numbered(doc, "Zopiclone")
add_numbered(doc, "Eszopiclone (S-isomer of zopiclone; FDA-approved)")

add_heading2(doc, "Mechanism of Action")
add_body_para(doc,
    "These drugs act on GABA-A receptors, specifically at the benzodiazepine binding site (BZ1/omega1 "
    "receptor), but show preferential selectivity for receptors containing alpha1 subunits "
    "(vs. benzodiazepines which also bind alpha2, alpha3, alpha5). This alpha1 selectivity is responsible "
    "for their preferential hypnotic effect (alpha1 mediates sedation/hypnosis) with relatively less "
    "anxiolytic and muscle relaxant activity (mediated by alpha2/alpha3 subunits).")

add_heading2(doc, "Individual Drug Profiles")

add_italic_heading(doc, "Zolpidem:")
add_bullet(doc, "Onset: Rapid (15–30 min); Duration: 6–8 hours")
add_bullet(doc, "Uses: Short-term insomnia (sleep onset and maintenance)")
add_bullet(doc, "Adverse Effects: Drowsiness, dizziness, headache; complex sleep behaviors "
           "(sleepwalking, sleep-driving – FDA black box warning), anterograde amnesia; next-day impairment")

add_italic_heading(doc, "Zaleplon:")
add_bullet(doc, "Ultra-short half-life (~1 hour) – safest for middle-of-night awakening")
add_bullet(doc, "Minimal next-day hangover")
add_bullet(doc, "Adverse Effects: Headache, dizziness; less complex sleep behaviors than zolpidem")

add_italic_heading(doc, "Zopiclone / Eszopiclone:")
add_bullet(doc, "Duration: 6–8 hours")
add_bullet(doc, "Characteristic side effect: Bitter metallic taste")
add_bullet(doc, "Eszopiclone: Approved for long-term use (up to 6 months)")

# Comparison Table
add_heading2(doc, "Comparison with Benzodiazepines")

table = doc.add_table(rows=9, cols=3)
table.style = "Table Grid"

headers = ["Feature", "Benzodiazepines (BZDs)", "Z-Drugs"]
for i, h in enumerate(headers):
    cell = table.cell(0, i)
    cell.text = h
    run = cell.paragraphs[0].runs[0]
    run.font.name = "Times New Roman"
    run.font.size = Pt(11)
    run.bold = True
    shade_cell(cell, "D0E8F0")

rows_data = [
    ("Receptor selectivity", "alpha1, alpha2, alpha3, alpha5", "Mainly alpha1"),
    ("Anxiolytic effect", "Yes", "Minimal"),
    ("Anticonvulsant", "Yes", "Minimal"),
    ("Muscle relaxant", "Yes", "Minimal"),
    ("Dependence risk", "Higher", "Lower (but not zero)"),
    ("Sleep architecture", "Suppresses REM", "REM better preserved"),
    ("Next-day impairment", "More", "Less"),
    ("Tolerance", "Develops faster", "Slower"),
]
for r_idx, (feat, bzd, zdrug) in enumerate(rows_data, start=1):
    for c_idx, text in enumerate([feat, bzd, zdrug]):
        cell = table.cell(r_idx, c_idx)
        cell.text = text
        run = cell.paragraphs[0].runs[0]
        run.font.name = "Times New Roman"
        run.font.size = Pt(11)

for row in table.rows:
    row.cells[0].width = Inches(2.0)
    row.cells[1].width = Inches(2.0)
    row.cells[2].width = Inches(2.0)

add_body_para(doc, "")  # spacer

add_heading2(doc, "Advantages over Benzodiazepines")
add_bullet(doc, "Less disruption of sleep architecture (normal REM sleep relatively preserved)")
add_bullet(doc, "Less tolerance and dependence (though abuse potential exists, especially zolpidem)")
add_bullet(doc, "Less next-morning hangover effect")
add_bullet(doc, "Shorter half-life for most agents")

add_heading2(doc, "Adverse Effects of Z-Drugs")
add_bullet(doc, "CNS: Drowsiness, dizziness, cognitive impairment")
add_bullet(doc, "Complex sleep behaviors: Sleep-walking, sleep-eating, sleep-driving "
           "(FDA black box warning for all Z-drugs) – especially with zolpidem")
add_bullet(doc, "Anterograde amnesia")
add_bullet(doc, "Tolerance and dependence (especially with long-term use of zolpidem)")
add_bullet(doc, "Rebound insomnia on discontinuation")
add_bullet(doc, "Metallic taste (zopiclone/eszopiclone)")

add_heading2(doc, "Clinical Use")
add_bullet(doc, "Short-term treatment of insomnia (2–4 weeks maximum recommended)")
add_bullet(doc, "Sleep-onset insomnia: Zaleplon (ultra-short), Zolpidem")
add_bullet(doc, "Sleep maintenance insomnia: Eszopiclone, Zolpidem CR")

doc.add_page_break()

# ══════════════════════════════════════════════════════════════════
# Q.5 – Barbiturate Poisoning
# ══════════════════════════════════════════════════════════════════

add_heading1(doc, "Q.5  Management of Barbiturate Poisoning.")

add_heading2(doc, "BARBITURATE POISONING (KDT 8th Ed.)")

add_body_para(doc,
    "Barbiturate poisoning is a serious medical emergency, commonly encountered in suicidal overdose "
    "or accidental ingestion. It manifests as progressive CNS and respiratory depression.")

add_heading2(doc, "Clinical Features of Barbiturate Poisoning")

add_italic_heading(doc, "Mild:")
add_bullet(doc, "Slurred speech, ataxia, nystagmus, confusion, drowsiness")

add_italic_heading(doc, "Moderate:")
add_bullet(doc, "Deep sleep, sluggish reflexes, hypotension")

add_italic_heading(doc, "Severe (Grades III–IV Coma):")
add_bullet(doc, "Coma with absent reflexes (including corneal reflex)")
add_bullet(doc, "Severe respiratory depression leading to apnea")
add_bullet(doc, "Cardiovascular collapse (hypotension, shock)")
add_bullet(doc, "Hypothermia")
add_bullet(doc, "Absent gag reflex leading to aspiration pneumonia")
add_bullet(doc, "Hyporeflexia, flaccid limbs")
add_bullet(doc, "\"Bullous lesions\" on skin (blisters) – pathognomonic feature of barbiturate/benzodiazepine coma")

add_body_para(doc,
    "There is NO specific antidote for barbiturate poisoning. Management is primarily supportive.",
    bold=True)

# A. Supportive Care
add_heading2(doc, "A. Supportive Care (Most Important)")

add_italic_heading(doc, "Airway and Breathing:")
add_bullet(doc, "Immediate endotracheal intubation and mechanical ventilation (for respiratory failure/apnea)")
add_bullet(doc, "Maintain SpO2 >95%, PaCO2 35–45 mmHg")
add_bullet(doc, "AVOID respiratory stimulants (analeptics like nikethamide – CONTRAINDICATED, may cause seizures)")

add_italic_heading(doc, "Circulation:")
add_bullet(doc, "IV fluids (normal saline, Ringer's lactate) for hypotension")
add_bullet(doc, "Vasopressors (dopamine, norepinephrine) if fluid-refractory hypotension")
add_bullet(doc, "Treat hypothermia: Warming blankets, warm IV fluids")

add_italic_heading(doc, "Monitoring:")
add_bullet(doc, "Continuous ECG monitoring")
add_bullet(doc, "Urinary catheterization and hourly urine output measurement")
add_bullet(doc, "Monitor blood pressure, temperature, electrolytes, arterial blood gas")

# B. Elimination
add_heading2(doc, "B. Elimination of Poison")

add_italic_heading(doc, "Gastric Decontamination:")
add_bullet(doc, "Gastric lavage: Within 1–2 hours of ingestion if airway is protected (cuffed ET tube in place)")
add_bullet(doc, "Activated charcoal: 1 g/kg orally (or via NGT) – adsorbs barbiturates; can be given as multiple "
           "doses for long-acting barbiturates (multiple-dose activated charcoal/MDAC for phenobarbitone)")
add_bullet(doc, "Do NOT induce emesis (aspiration risk in obtunded patient)")

add_italic_heading(doc, "Urinary Alkalinization:")
add_bullet(doc, "IV sodium bicarbonate (0.5–1 mEq/kg bolus, followed by infusion to maintain urine pH 7.5–8.0)")
add_bullet(doc, "Effective for LONG-ACTING barbiturates (phenobarbitone) – weak acids (pKa ~7.4)")
add_bullet(doc, "Alkaline urine leads to ionization of weak acid (ion trapping), reducing renal tubular reabsorption "
           "and increasing renal excretion")
add_bullet(doc, "NOT useful for short/ultra-short acting barbiturates")

add_italic_heading(doc, "Forced Diuresis:")
add_bullet(doc, "IV furosemide + IV fluids to maintain urine output 100–200 mL/hour")
add_bullet(doc, "Used with alkalinization for long-acting barbiturates")

add_italic_heading(doc, "Dialysis:")
add_bullet(doc, "Hemodialysis or hemoperfusion (charcoal hemoperfusion most effective) for:")
add_bullet(doc, "Severe poisoning not responding to supportive care", level=2)
add_bullet(doc, "Renal failure", level=2)
add_bullet(doc, "Long-acting barbiturate poisoning with very high serum levels", level=2)
add_bullet(doc, "Phenobarbitone level >10 mg/dL (phenobarbitone is dialyzable)", level=2)

# C. Specific Measures
add_heading2(doc, "C. Specific Measures")
add_bullet(doc, "Correct hypoglycemia (IV dextrose 50%)")
add_bullet(doc, "Thiamine 100 mg IV before glucose (especially in alcoholics – to prevent Wernicke's encephalopathy)")
add_bullet(doc, "Maintain normothermia")
add_bullet(doc, "Prevent pressure sores: Positioning changes every 2 hours")
add_bullet(doc, "Prevent aspiration pneumonia: Head-end elevation")
add_bullet(doc, "Catheter care to prevent urinary tract infection")

# D. Monitoring
add_heading2(doc, "D. Monitoring and Follow-up")
add_bullet(doc, "Repeated neurological assessment (Glasgow Coma Scale)")
add_bullet(doc, "Drug levels (plasma barbiturate levels if available)")
add_bullet(doc, "LFT, RFT, CBC monitoring")
add_bullet(doc, "Psychiatric evaluation after recovery (for deliberate self-harm cases)")

# Prognosis
add_heading2(doc, "Prognosis")
add_body_para(doc,
    "With prompt and adequate supportive care, most patients recover fully. "
    "Respiratory complications (aspiration pneumonia) are the main cause of morbidity and mortality.")

# Key Points
add_heading2(doc, "Key Points (KDT)")
add_bullet(doc, "NO analeptics (respiratory stimulants)")
add_bullet(doc, "NO specific antidote available")
add_bullet(doc, "Urinary alkalinization only effective for long-acting barbiturates")
add_bullet(doc, "Supportive care is the cornerstone of management")

# ──────────────────────────────────────────────
# Save document
# ──────────────────────────────────────────────

out_path = "/tmp/workspace/assignments/Assignment_17_07_26.docx"
buf = BytesIO()
doc.save(buf)
with open(out_path, "wb") as f:
    f.write(buf.getvalue())

print(f"SUCCESS: Document saved to {out_path}")
Running Command

python3 /tmp/workspace/assignments/generate_assignment.py

Running Command

python /tmp/skills/docx/scripts/office/validate.py /tmp/workspace/assignments/Assignment_17_07_26.docx

Running Command

python3 -c " from docx import Document doc = Document('/tmp/workspace/assignments/Assignment_17_07_26.docx') print('Paragraphs:', len(doc.paragraphs)) print('Sections:', len(doc.sections)) # Print first few paragraphs to verify structure for i, p in enumerate(doc.paragraphs[:20]): style = p.style.name if p.style else 'None' text = p.text[:80] if p.text else '' print(f' [{i:02d}] [{style}] {text}') "

Running Command

python3 -c " # Check the exact validation error more carefully - the spacing element order # The issue is that in pPr, spacing must come AFTER pStyle and numPr # Let's check what the document.xml looks like for a paragraph import zipfile with zipfile.ZipFile('/tmp/workspace/assignments/Assignment_17_07_26.docx') as z: content = z.read('word/document.xml').decode('utf-8') # Find the first spacing occurrence idx = content.find('<w:spacing') print(content[max(0,idx-300):idx+200]) "

Running Command

python3 -c " # Check for the actual failing element - spacing in a pPr with pStyle before it import zipfile, re with zipfile.ZipFile('/tmp/workspace/assignments/Assignment_17_07_26.docx') as z: content = z.read('word/document.xml').decode('utf-8') # Find cases where spacing comes before pStyle (wrong order) # Look for <w:pPr> that has spacing before pStyle matches = re.findall(r'<w:pPr>.*?<w:spacing.*?<w:pStyle', content) print('Wrong order (spacing before pStyle):', len(matches)) matches2 = re.findall(r'<w:pStyle.*?<w:spacing', content) print('Correct order (pStyle before spacing):', len(matches2)) " 2>&1 | head -20

Editing File

~/assignments/generate_assignment.py

Successfully replaced 1 instance(s) of the string in '/tmp/workspace/assignments/generate_assignment.py'
Running Command

python3 /tmp/workspace/assignments/generate_assignment.py

Running Command

python /tmp/skills/docx/scripts/office/validate.py /tmp/workspace/assignments/Assignment_17_07_26.docx

Editing File

~/assignments/generate_assignment.py

Successfully replaced 1 instance(s) of the string in '/tmp/workspace/assignments/generate_assignment.py'
Running Command

python3 /tmp/workspace/assignments/generate_assignment.py && python /tmp/skills/docx/scripts/office/validate.py /tmp/workspace/assignments/Assignment_17_07_26.docx

Running Command

python3 -c " import zipfile with zipfile.ZipFile('/tmp/workspace/assignments/Assignment_17_07_26.docx') as z: s = z.read('word/settings.xml').decode('utf-8') # Find zoom import re m = re.search(r'<w:zoom[^>]*>', s) if m: print('zoom element:', m.group()) "

Editing File

~/assignments/generate_assignment.py

Successfully replaced 1 instance(s) of the string in '/tmp/workspace/assignments/generate_assignment.py'
Running Command

python3 /tmp/workspace/assignments/generate_assignment.py && python /tmp/skills/docx/scripts/office/validate.py /tmp/workspace/assignments/Assignment_17_07_26.docx

Running Command

python3 -c " from docx import Document doc = Document('/tmp/workspace/assignments/Assignment_17_07_26.docx') print('=== DOCUMENT STRUCTURE ===') print(f'Total paragraphs: {len(doc.paragraphs)}') print(f'Total tables: {len(doc.tables)}') print() print('=== HEADINGS & KEY PARAGRAPHS ===') for i, p in enumerate(doc.paragraphs): style = p.style.name if p.style else 'None' if style in ('Heading 1', 'Heading 2') or (i < 12 and p.text.strip()): text = p.text[:90] if p.text else '' print(f' [{style}] {text}') print() print('=== TABLE (Q.4 comparison) ===') if doc.tables: tbl = doc.tables[0] for row in tbl.rows: print(' | ' + ' | '.join(c.text[:25] for c in row.cells) + ' |') print() import os size = os.path.getsize('/tmp/workspace/assignments/Assignment_17_07_26.docx') print(f'File size: {size:,} bytes ({size/1024:.1f} KB)') ls_out = __import__('subprocess').check_output(['ls','-lh','/tmp/workspace/assignments/']).decode() print(ls_out) "

Running Command

ls -la /tmp/workspace/assignments/

Reading File

Don't give in pdf form.

Running Command

ls -la /tmp/workspace/assignments/

general-purpose

Create a Word document (.docx) for a pharmacology assignment dated 21-07-26 on "General Anaesthetics". Save to `/tmp/workspace/assignments/Assignment_21_07_26.docx`. Write and run a Python script using python-docx. Do NOT create any PDF. Output must be a .docx file only. Formatting requirements: - Title page: "Assignment – 21-07-26: General Anaesthetics", reference KD Tripathi Essentials of Medical Pharmacology, 8th Edition - Font: Times New Roman, 12pt for body text - Line spacing: 1.5 lines - Heading 1 (14pt bold TNR) for Q.1, Q.2, Q.3, Q.4 - Heading 2 (13pt bold TNR) for all subheadings - Page breaks between questions - Normal style for body paragraphs - Use python-docx List Bullet / List Number styles for bullet/numbered lists (never use unicode bullet characters manually) Here is the FULL content: --- Q.1 Classify general anaesthetics and add a note on the pharmacology of Halothane. CLASSIFICATION OF GENERAL ANAESTHETICS (KDT 8th Ed.) I. Inhalational Anaesthetics: A. Gases: Nitrous oxide (N2O), Cyclopropane (obsolete), Xenon (experimental) B. Volatile Liquids (Halogenated): Halothane (halogenated alkane), Enflurane (halogenated ether), Isoflurane (most widely used), Desflurane (very low blood-gas partition coefficient), Sevoflurane (most used in pediatrics), Methoxyflurane, Diethyl ether (obsolete), Chloroform (obsolete) II. Intravenous Anaesthetics: A. Induction Agents: Barbiturates (Thiopentone sodium, Methohexitone), Propofol (most widely used), Etomidate, Ketamine (dissociative) B. Benzodiazepines (sedation/induction): Midazolam, Diazepam, Lorazepam C. Opioid anaesthetics: Fentanyl, Remifentanil, Sufentanil Stages of General Anaesthesia (Guedel's classification for ether): Stage I: Analgesia (conscious, pain reduced) Stage II: Excitement/Delirium (unconscious, irregular breathing, vomiting risk — dangerous) Stage III: Surgical Anaesthesia (four planes: I-IV, progressively deeper) Stage IV: Medullary depression (apnea, cardiovascular collapse, death) PHARMACOLOGY OF HALOTHANE Halothane (2-bromo-2-chloro-1,1,1-trifluoroethane) is a halogenated alkane introduced in 1956, formerly widely used but largely replaced by newer agents. Physical Properties: - Non-flammable, non-explosive (major advantage over ether) - Sweet, pleasant odor; volatile liquid at room temperature - Blood-gas partition coefficient: 2.4 (moderate — slower induction than desflurane/sevoflurane) - Oil-gas partition coefficient: 224 (high potency) - MAC (Minimum Alveolar Concentration): 0.75% (relatively potent) - Stored in amber bottles with thymol as preservative Mechanism of Action: The precise mechanism is not fully understood. Halothane acts by: 1. Enhancing GABA-A receptor-mediated inhibitory neurotransmission (increases Cl- conductance) 2. Inhibiting NMDA glutamate receptors 3. Modulating two-pore domain K+ channels (TREK channels), causing hyperpolarization 4. Disrupting neuronal membrane function (Meyer-Overton lipid theory — older concept) Net result: Global CNS depression producing unconsciousness, analgesia, and amnesia. Pharmacological Actions: CNS: - Produces all stages of anaesthesia rapidly - Good hypnosis and amnesia; moderate analgesia - Reduces cerebral metabolic rate (CMRO2) but INCREASES cerebral blood flow (vasodilation) → raises ICP - Contraindicated in raised intracranial pressure Cardiovascular: - Myocardial depression: Reduces cardiac output and contractility (dose-dependent) - Hypotension: Due to vasodilation and myocardial depression - Bradycardia - Sensitizes myocardium to catecholamines → arrhythmias (most important cardiac adverse effect) - Adrenaline use with halothane is avoided or strictly dose-limited Respiratory: - Potent bronchodilator — useful in asthmatics - Respiratory depression (reduces tidal volume and rate) - Does NOT irritate respiratory tract (unlike ether, isoflurane) Smooth Muscle: Uterine relaxation (risk of PPH); bronchodilation Neuromuscular: Moderate neuromuscular blockade; enhances non-depolarizing muscle relaxants Hepatic (Halothane Hepatitis): - Metabolized 20% by CYP2E1 → reactive trifluoroacetyl chloride intermediate → immune-mediated hepatitis - Type 1 (mild): Transient liver enzyme elevation (asymptomatic) - Type 2 (severe): Fulminant hepatic necrosis — "Halothane hepatitis" (1 in 35,000 exposures); repeat exposure increases risk - Contraindicated in patients with previous halothane exposure + jaundice Clinical Uses: 1. Induction and maintenance of general anaesthesia 2. Inhalation induction in children (pleasant smell, non-irritating) 3. Bronchodilator in refractory status asthmaticus 4. Uterine relaxation during intrauterine manipulation Adverse Effects Summary: 1. Halothane hepatitis (most serious — fulminant hepatic necrosis) 2. Malignant hyperthermia (life-threatening, in susceptible individuals) 3. Cardiac arrhythmias (catecholamine sensitization) 4. Myocardial depression and hypotension 5. Raised ICP 6. Uterine relaxation (PPH risk) 7. Postoperative shivering Contraindications: - Previous halothane exposure with jaundice/unexplained fever - Pheochromocytoma - Raised intracranial pressure - Malignant hyperthermia susceptibility - Liver disease Current Status: Largely replaced by isoflurane, sevoflurane, desflurane due to hepatotoxicity and cardiac sensitization. Still used in developing countries due to low cost. --- Q.2 Adverse effects of general anaesthesia during and after anaesthesia. ADVERSE EFFECTS OF GENERAL ANAESTHESIA (KDT 8th Ed.) A. DURING ANAESTHESIA (Intraoperative Complications) 1. Cardiovascular: - Hypotension (most common): Vasodilation, myocardial depression, hypovolemia. Treat with IV fluids, vasopressors (ephedrine) - Hypertension: Inadequate anaesthetic depth, laryngoscopy, CO2 retention - Arrhythmias: Bradycardia (halothane, vagal stimulation — treat with atropine); Tachycardia (inadequate anaesthesia, hypercapnia); Ventricular fibrillation (rare — halothane + catecholamine, hypoxia) - Cardiac arrest: Vagal reflex, hypoxia, drug overdose 2. Respiratory: - Laryngospasm: Spasm during light anaesthesia; life-threatening. Treat with 100% O2, succinylcholine IV, positive pressure ventilation - Bronchospasm: In asthmatics, irritant agents (isoflurane, desflurane), inadequate anaesthesia. Treat with halothane/sevoflurane, IV bronchodilators - Respiratory depression → Hypercapnia and Hypoxia - Airway obstruction: Tongue fall, secretions, foreign body - Aspiration of gastric contents (Mendelson syndrome): Chemical pneumonitis. Prevention: RSI, pre-op fasting (NPO 6-8 hrs), antacids/H2-blockers/metoclopramide 3. Stage II Excitement: Involuntary movements, breath-holding, laryngospasm, vomiting during induction. Minimized by rapid IV induction 4. Malignant Hyperthermia: - Life-threatening pharmacogenetic emergency - Triggered by: Halothane, volatile agents, succinylcholine - Mechanism: RYR1 gene mutation → uncontrolled Ca2+ release from SR → muscle hypermetabolism - Features: Hyperthermia (>40°C, rapidly rising), muscle rigidity, tachycardia, metabolic acidosis, myoglobinuria, hyperkalemia - Treatment: Dantrolene sodium (specific antidote, 2.5 mg/kg IV); cooling; bicarbonate for acidosis - Mortality: ~70% untreated; 5-10% with dantrolene 5. Awareness During Anaesthesia: Consciousness during surgery; associated with inadequate depth, neuromuscular blockade without hypnotics; causes PTSD 6. Drug-related: Suxamethonium apnea (pseudocholinesterase deficiency); Anaphylaxis (muscle relaxants, latex, antibiotics) B. AFTER ANAESTHESIA (Postoperative Complications) 1. Post-operative Nausea and Vomiting (PONV): - Most common postoperative complication - Risk factors: Female sex, non-smoker, history of motion sickness, opioids, volatile agents, nitrous oxide - Prevention/Treatment: Ondansetron (5-HT3 antagonist), dexamethasone, droperidol, TIVA with propofol (reduced PONV) 2. Residual CNS Effects: - Delayed recovery: Drug accumulation (elderly, hepatic/renal impairment) - Postoperative cognitive dysfunction (POCD): Especially in elderly; may persist weeks-months - Shivering: Common, increases O2 consumption; treat with meperidine, forced-air warming - Emergence delirium/agitation: Especially with ketamine; common in children 3. Cardiovascular (Postoperative): Hypertension (pain, urinary retention); Hypotension (hypovolemia, bleeding); Perioperative MI 4. Respiratory (Postoperative): - Atelectasis: Most common postoperative pulmonary complication (small airways collapse, reduced FRC) - Aspiration pneumonia - Pulmonary embolism (DVT-PE) - Respiratory depression from residual opioids/muscle relaxants - Prevention: Deep breathing, CPAP, early mobilization 5. Hepatic and Renal: Postoperative liver dysfunction (halothane); Acute kidney injury (hypotension, nephrotoxic drugs) 6. Other Complications: - Sore throat, hoarseness (ET tube or LMA) - Dental damage (laryngoscopy) - Corneal abrasion (dry eyes) - Hypothermia (prolonged surgery, cold OR) - Backache, myalgia (succinylcholine fasciculations, positioning) - Nerve injuries (improper positioning) - Inadequate postoperative pain control --- Q.3 Short note on pre-anaesthetic medication. PRE-ANAESTHETIC MEDICATION (Premedication) (KDT 8th Ed.) Pre-anaesthetic medication refers to drugs given before induction of general anaesthesia to facilitate a smooth, safe, and comfortable anaesthetic experience. Given 45-90 minutes preoperatively (oral/IM) or just before induction (IV). Goals/Objectives of Premedication: 1. Allayment of anxiety and apprehension (sedation/anxiolysis) 2. Amnesia (prevent recall of preoperative period) 3. Analgesia (preemptive analgesia) 4. Attenuation of autonomic (vagal) reflexes during intubation/surgery 5. Anti-sialogue effect (reduce secretions to facilitate airway management) 6. Antiemetic effect (reduce PONV) 7. Reduce requirements of induction and maintenance agents (dose-sparing) 8. Antacid prophylaxis (reduce risk of Mendelson's syndrome) 9. Facilitation of smooth induction Drugs Used in Premedication: 1. Sedatives/Anxiolytics — Benzodiazepines (most commonly used): - Diazepam: 0.1-0.2 mg/kg PO/IV, 1-2 hours preoperatively - Midazolam: 0.05-0.1 mg/kg IM/IV (preferred — shorter acting, potent amnesia) - Lorazepam: For prolonged sedation and amnesia - Actions: Anxiolysis, sedation, anterograde amnesia, anticonvulsant, reduce anaesthetic requirements - Barbiturates (historical): Pentobarbitone IM (largely replaced) - Promethazine: Antihistamine with sedation + antiemetic properties 2. Opioid Analgesics: - Morphine: 0.1 mg/kg IM; analgesia + sedation; side effects: respiratory depression, nausea, vomiting, histamine release - Pethidine (meperidine): 1 mg/kg IM; shorter acting - Fentanyl: IV, rapid onset, given immediately preoperatively - Indication: Preoperative pain; preemptive analgesia 3. Anticholinergics (Anti-secretory/Vagolytic): - Atropine: 0.6 mg IM — most commonly used Actions: Reduces oral/pharyngeal/bronchial secretions (antisialogogue); prevents bradycardia during laryngoscopy; bronchodilation; raises intragastric pH Side effects: Tachycardia, drying of secretions, urinary retention, blurred vision, central anticholinergic syndrome (in elderly) - Glycopyrrolate (preferred for antisialogogue): Does NOT cross BBB (no central effects); better antisialogogue; less tachycardia 4. H2-Blockers / Antacids (Aspiration Prophylaxis): - Ranitidine: 150 mg PO (evening before + morning of surgery) — raises gastric pH - Omeprazole (PPI): Reduces gastric acid volume and acidity - Sodium citrate 0.3 M: Immediate-acting antacid; given 15-20 min before induction (emergency/RSI) - Indication: Full stomach, emergency surgery, pregnancy, GERD, obesity 5. Antiemetics: - Metoclopramide: 10 mg IV — promotes gastric emptying + antiemetic (D2 antagonist); given 1-2 hrs before surgery - Ondansetron: 4-8 mg IV; 5-HT3 antagonist; prevents PONV - Dexamethasone: 4-8 mg IV; potent antiemetic, anti-inflammatory; synergistic with ondansetron 6. Others: - Beta-blockers: Continue perioperatively in hypertensives; cardioprotection - Clonidine (alpha-2 agonist): Sedation, reduces anaesthetic requirements, hemodynamic stability - MAO inhibitors: Must be stopped 2 weeks before surgery (dangerous interactions with pethidine and sympathomimetics) Pediatric Premedication: - Oral midazolam (0.5 mg/kg) — most commonly used in children - EMLA cream over IV sites to reduce pain of cannulation Summary Table (create a table with 3 columns: Drug Class | Drug | Main Purpose): Row 1: Benzodiazepine | Midazolam/Diazepam | Anxiolysis, amnesia Row 2: Opioid | Morphine/Pethidine | Analgesia Row 3: Anticholinergic | Atropine/Glycopyrrolate | Antisialogogue, vagolysis Row 4: Antiemetic | Ondansetron/Metoclopramide | Prevent PONV Row 5: Antacid/H2-blocker | Ranitidine/Na citrate | Aspiration prophylaxis --- Q.4 What are intravenous anaesthetics? Add a note on the pharmacology of Propofol. INTRAVENOUS ANAESTHETICS (KDT 8th Ed.) Intravenous (IV) anaesthetics are drugs administered intravenously to produce unconsciousness, usually for induction of general anaesthesia. They offer rapid onset (within one arm-brain circulation time) and are more pleasant than inhalational induction. Classification of IV Anaesthetics: 1. Barbiturates: Thiopentone sodium (ultra-short acting, prototypic), Methohexitone 2. Non-barbiturate IV agents: Propofol (most widely used), Etomidate (preferred in cardiac compromise), Ketamine (dissociative — unique: analgesia + unconsciousness + amnesia with maintained airway reflexes) 3. Benzodiazepines: Midazolam, Lorazepam, Diazepam 4. Alpha-2 agonist: Dexmedetomidine (sedation/ICU sedation; does not produce unconsciousness at usual doses) PHARMACOLOGY OF PROPOFOL Propofol (2,6-diisopropylphenol) is the most widely used IV anaesthetic agent worldwide, introduced clinically in 1986. Physical Properties: - White oil-in-water emulsion (soybean oil, egg phosphatide, glycerol) - Insoluble in water (requires lipid emulsion formulation) - pH: 7 (neutral); stored at 2-25°C; preservative-free (strict aseptic technique required, single use within 6-12 hours) - Supports microbial growth Mechanism of Action: Propofol acts primarily by enhancing GABA-A receptor-mediated inhibitory neurotransmission. It increases the duration of chloride channel opening (similar to barbiturates), leading to membrane hyperpolarization and CNS depression. Additionally, propofol inhibits NMDA receptors and modulates glycine receptors. At subanesthetic concentrations: sedation and anxiolysis; at higher doses: unconsciousness. Pharmacokinetics: - Onset: 30-60 seconds (one arm-brain circulation time) — very rapid - Duration: 5-10 minutes (rapid redistribution from brain to peripheral tissues) - Protein binding: ~98%; Volume of distribution: ~3.5 L/kg (highly lipophilic) - Metabolism: Hepatic conjugation to inactive glucuronide/sulfate metabolites; also extra-hepatic (lung, kidney) - Terminal elimination half-life: 4-7 hours - Short context-sensitive half-time — suitable for prolonged TIVA infusions - Excretion: Renal (88% as conjugates) Pharmacological Actions: CNS: - Loss of consciousness within 30-60 seconds - No analgesia (must supplement with opioids) - Excellent amnesia - Antiemetic effect — major advantage (reduces PONV) - Reduces ICP and CMRO2 — useful in neuroanaesthesia - Anticonvulsant at low doses; may cause myoclonic movements at induction - EEG: Burst suppression at high doses Cardiovascular: - Significant hypotension (most important adverse effect): Vasodilation (reduced SVR) + negative inotropy - MAP falls by 25-40% during induction - Bradycardia (inhibits baroreceptor reflex) - Greater hypotension than thiopentone - Caution in elderly, hypovolemic, cardiac-compromised patients Respiratory: - Dose-dependent respiratory depression → brief apnea during induction (common) - Depresses laryngeal reflexes — facilitates LMA insertion - Bronchodilation (reduces airway resistance) Clinical Uses: 1. Induction of general anaesthesia (replaced thiopentone in most centres) 2. Maintenance: Total Intravenous Anaesthesia (TIVA) 3. Procedural sedation: Endoscopy, colonoscopy, cardioversion, minor procedures 4. ICU sedation: Mechanically ventilated patients (risk PRIS with prolonged high-dose) 5. Rescue antiemetic: Subhypnotic doses (10-20 mg IV) Adverse Effects: 1. Hypotension (most common serious adverse effect) 2. Pain on injection: Very common (60-80% of patients); reduced by: injecting into large vein, IV lignocaine pretreatment, or mixing lignocaine with propofol 3. Apnea during induction (brief, 30-60 seconds) 4. Bradycardia 5. Propofol Infusion Syndrome (PRIS): Rare, life-threatening with prolonged high-dose use (>4 mg/kg/hr for >48 hrs) Features: Metabolic acidosis, rhabdomyolysis, hyperkalemia, renal failure, cardiac failure (Brugada pattern, RBBB, ST elevation), hypertriglyceridemia, hepatomegaly Risk: ICU patients; children at higher risk Treatment: Discontinue propofol; supportive care 6. Contraindicated in severe soy/egg allergy (contains egg phosphatide and soybean oil) 7. Hypertriglyceridemia with prolonged infusion (provides 1.1 kcal/mL from lipid vehicle) 8. Microbial contamination risk (strict aseptic technique mandatory) 9. Green discolouration of urine (benign — phenol metabolites) 10. Involuntary excitatory movements during induction Contraindications: - Allergy to propofol or its components (soy, egg) - Severe cardiovascular compromise/hypotension (use etomidate instead) - Children under 3 years for ICU sedation (risk of PRIS) Advantages of Propofol over Other IV Agents: - Rapid, smooth induction and clear-headed recovery - Reduced PONV (antiemetic property) - Suitable for day surgery (minimal hangover) - Titratable in TIVA - Reduces ICP — useful in neuroanaesthesia - Anticonvulsant Disadvantages: - No analgesic properties - Significant hypotension (especially in elderly) - Pain on injection - PRIS with prolonged infusion - More expensive than thiopentone --- Write and run a Python script saved at `/tmp/workspace/assignments/generate_assignment_21.py`. Output file: `/tmp/workspace/assignments/Assignment_21_07_26.docx`. Confirm file exists and print its size. Do NOT generate any PDF file.

Reading File
Running Command

mkdir -p /tmp/workspace/assignments

Writing File

~/assignments/generate_assignment_21.py

"""
Pharmacology Assignment: General Anaesthetics
Date: 21-07-26
Reference: KD Tripathi Essentials of Medical Pharmacology, 8th Edition
Output: /tmp/workspace/assignments/Assignment_21_07_26.docx
"""

from docx import Document
from docx.shared import Pt, Inches, RGBColor
from docx.enum.text import WD_ALIGN_PARAGRAPH, WD_LINE_SPACING
from docx.oxml.ns import qn
from docx.oxml import OxmlElement
import os

OUTPUT_PATH = "/tmp/workspace/assignments/Assignment_21_07_26.docx"

# ── helpers ──────────────────────────────────────────────────────────────────

def set_line_spacing(paragraph, spacing=1.5):
    """Set 1.5 line spacing on a paragraph."""
    pf = paragraph.paragraph_format
    pf.line_spacing_rule = WD_LINE_SPACING.MULTIPLE
    pf.line_spacing = spacing

def apply_body_font(run, bold=False, italic=False, size=12):
    run.font.name = "Times New Roman"
    run.font.size = Pt(size)
    run.font.bold = bold
    run.font.italic = italic

def add_body(doc, text, bold=False, italic=False):
    """Add a Normal paragraph with TNR 12pt, 1.5 spacing."""
    p = doc.add_paragraph(style="Normal")
    run = p.add_run(text)
    apply_body_font(run, bold=bold, italic=italic)
    set_line_spacing(p)
    return p

def add_bullet(doc, text, level=1):
    """List Bullet style (level 1 or 2)."""
    style = "List Bullet" if level == 1 else "List Bullet 2"
    p = doc.add_paragraph(style=style)
    run = p.add_run(text)
    apply_body_font(run)
    set_line_spacing(p)
    return p

def add_number(doc, text, level=1):
    """List Number style (level 1 or 2)."""
    style = "List Number" if level == 1 else "List Number 2"
    p = doc.add_paragraph(style=style)
    run = p.add_run(text)
    apply_body_font(run)
    set_line_spacing(p)
    return p

def add_h1(doc, text):
    """Heading 1: TNR 14pt bold black, 1.5 spacing."""
    p = doc.add_heading(text, level=1)
    set_line_spacing(p)
    return p

def add_h2(doc, text):
    """Heading 2: TNR 13pt bold black, 1.5 spacing."""
    p = doc.add_heading(text, level=2)
    set_line_spacing(p)
    return p

def shade_cell(cell, hex_fill):
    tcPr = cell._tc.get_or_add_tcPr()
    shd = OxmlElement("w:shd")
    shd.set(qn("w:val"), "clear")
    shd.set(qn("w:fill"), hex_fill)
    tcPr.append(shd)

# ── document setup ────────────────────────────────────────────────────────────

doc = Document()

# Page size: A4, 1-inch margins
section = doc.sections[0]
section.page_width  = Inches(8.27)
section.page_height = Inches(11.69)
section.top_margin    = Inches(1)
section.bottom_margin = Inches(1)
section.left_margin   = Inches(1.25)
section.right_margin  = Inches(1.25)

# ── Style customisation ───────────────────────────────────────────────────────

# Normal (body) style
normal = doc.styles["Normal"]
normal.font.name = "Times New Roman"
normal.font.size = Pt(12)

# Heading 1 – 14pt bold TNR, black
h1_style = doc.styles["Heading 1"]
h1_style.font.name          = "Times New Roman"
h1_style.font.size          = Pt(14)
h1_style.font.bold          = True
h1_style.font.color.rgb     = RGBColor(0, 0, 0)
h1_style.font.underline     = False
h1_style.paragraph_format.space_before = Pt(12)
h1_style.paragraph_format.space_after  = Pt(6)

# Heading 2 – 13pt bold TNR, black
h2_style = doc.styles["Heading 2"]
h2_style.font.name          = "Times New Roman"
h2_style.font.size          = Pt(13)
h2_style.font.bold          = True
h2_style.font.color.rgb     = RGBColor(0, 0, 0)
h2_style.font.underline     = False
h2_style.paragraph_format.space_before = Pt(10)
h2_style.paragraph_format.space_after  = Pt(4)

# ════════════════════════════════════════════════════════════════════════════
# TITLE PAGE
# ════════════════════════════════════════════════════════════════════════════

# Several blank lines before title for vertical centering effect
for _ in range(6):
    p = doc.add_paragraph(style="Normal")
    set_line_spacing(p)

title_p = doc.add_paragraph(style="Normal")
title_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = title_p.add_run("Assignment – 21-07-26")
run.font.name = "Times New Roman"
run.font.size = Pt(18)
run.font.bold = True
set_line_spacing(title_p)

subtitle_p = doc.add_paragraph(style="Normal")
subtitle_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run2 = subtitle_p.add_run("General Anaesthetics")
run2.font.name = "Times New Roman"
run2.font.size = Pt(16)
run2.font.bold = True
set_line_spacing(subtitle_p)

for _ in range(2):
    p = doc.add_paragraph(style="Normal")
    set_line_spacing(p)

ref_p = doc.add_paragraph(style="Normal")
ref_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run3 = ref_p.add_run("Reference: KD Tripathi Essentials of Medical Pharmacology, 8th Edition")
run3.font.name = "Times New Roman"
run3.font.size = Pt(12)
run3.font.italic = True
set_line_spacing(ref_p)

for _ in range(2):
    p = doc.add_paragraph(style="Normal")
    set_line_spacing(p)

date_p = doc.add_paragraph(style="Normal")
date_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run4 = date_p.add_run("Date: 21-07-26")
run4.font.name = "Times New Roman"
run4.font.size = Pt(12)
set_line_spacing(date_p)

doc.add_page_break()

# ════════════════════════════════════════════════════════════════════════════
# Q.1
# ════════════════════════════════════════════════════════════════════════════

add_h1(doc, "Q.1  Classify general anaesthetics and add a note on the pharmacology of Halothane.")

add_h2(doc, "CLASSIFICATION OF GENERAL ANAESTHETICS (KDT 8th Ed.)")

add_body(doc, "I.  Inhalational Anaesthetics:", bold=True)
add_body(doc, "A.  Gases:", bold=True)
add_bullet(doc, "Nitrous oxide (N2O)")
add_bullet(doc, "Cyclopropane (obsolete)")
add_bullet(doc, "Xenon (experimental)")

add_body(doc, "B.  Volatile Liquids (Halogenated):", bold=True)
add_bullet(doc, "Halothane (halogenated alkane)")
add_bullet(doc, "Enflurane (halogenated ether)")
add_bullet(doc, "Isoflurane (most widely used)")
add_bullet(doc, "Desflurane (very low blood-gas partition coefficient)")
add_bullet(doc, "Sevoflurane (most used in pediatrics)")
add_bullet(doc, "Methoxyflurane")
add_bullet(doc, "Diethyl ether (obsolete)")
add_bullet(doc, "Chloroform (obsolete)")

add_body(doc, "II.  Intravenous Anaesthetics:", bold=True)
add_body(doc, "A.  Induction Agents:", bold=True)
add_bullet(doc, "Barbiturates: Thiopentone sodium, Methohexitone")
add_bullet(doc, "Propofol (most widely used)")
add_bullet(doc, "Etomidate")
add_bullet(doc, "Ketamine (dissociative)")

add_body(doc, "B.  Benzodiazepines (sedation/induction):", bold=True)
add_bullet(doc, "Midazolam")
add_bullet(doc, "Diazepam")
add_bullet(doc, "Lorazepam")

add_body(doc, "C.  Opioid Anaesthetics:", bold=True)
add_bullet(doc, "Fentanyl")
add_bullet(doc, "Remifentanil")
add_bullet(doc, "Sufentanil")

add_h2(doc, "Stages of General Anaesthesia (Guedel's Classification for Ether)")
add_bullet(doc, "Stage I:  Analgesia – conscious, pain reduced")
add_bullet(doc, "Stage II: Excitement/Delirium – unconscious, irregular breathing, vomiting risk (dangerous)")
add_bullet(doc, "Stage III: Surgical Anaesthesia – four planes (I-IV), progressively deeper")
add_bullet(doc, "Stage IV: Medullary depression – apnea, cardiovascular collapse, death")

add_h2(doc, "PHARMACOLOGY OF HALOTHANE")

add_body(doc, "Halothane (2-bromo-2-chloro-1,1,1-trifluoroethane) is a halogenated alkane introduced in 1956, formerly widely used but largely replaced by newer agents.")

add_h2(doc, "Physical Properties")
add_bullet(doc, "Non-flammable, non-explosive (major advantage over ether)")
add_bullet(doc, "Sweet, pleasant odour; volatile liquid at room temperature")
add_bullet(doc, "Blood-gas partition coefficient: 2.4 (moderate — slower induction than desflurane/sevoflurane)")
add_bullet(doc, "Oil-gas partition coefficient: 224 (high potency)")
add_bullet(doc, "MAC (Minimum Alveolar Concentration): 0.75% (relatively potent)")
add_bullet(doc, "Stored in amber bottles with thymol as preservative")

add_h2(doc, "Mechanism of Action")
add_body(doc, "The precise mechanism is not fully understood. Halothane acts by:")
add_number(doc, "Enhancing GABA-A receptor-mediated inhibitory neurotransmission (increases Cl\u207b conductance)")
add_number(doc, "Inhibiting NMDA glutamate receptors")
add_number(doc, "Modulating two-pore domain K\u207a channels (TREK channels), causing hyperpolarization")
add_number(doc, "Disrupting neuronal membrane function (Meyer-Overton lipid theory — older concept)")
add_body(doc, "Net result: Global CNS depression producing unconsciousness, analgesia, and amnesia.")

add_h2(doc, "Pharmacological Actions")

add_body(doc, "CNS:", bold=True)
add_bullet(doc, "Produces all stages of anaesthesia rapidly")
add_bullet(doc, "Good hypnosis and amnesia; moderate analgesia")
add_bullet(doc, "Reduces cerebral metabolic rate (CMRO\u2082) but INCREASES cerebral blood flow (vasodilation) \u2192 raises ICP")
add_bullet(doc, "Contraindicated in raised intracranial pressure")

add_body(doc, "Cardiovascular:", bold=True)
add_bullet(doc, "Myocardial depression: Reduces cardiac output and contractility (dose-dependent)")
add_bullet(doc, "Hypotension: Due to vasodilation and myocardial depression")
add_bullet(doc, "Bradycardia")
add_bullet(doc, "Sensitizes myocardium to catecholamines \u2192 arrhythmias (most important cardiac adverse effect)")
add_bullet(doc, "Adrenaline use with halothane is avoided or strictly dose-limited")

add_body(doc, "Respiratory:", bold=True)
add_bullet(doc, "Potent bronchodilator — useful in asthmatics")
add_bullet(doc, "Respiratory depression (reduces tidal volume and rate)")
add_bullet(doc, "Does NOT irritate respiratory tract (unlike ether, isoflurane)")

add_body(doc, "Smooth Muscle:", bold=True)
add_bullet(doc, "Uterine relaxation (risk of PPH)")
add_bullet(doc, "Bronchodilation")

add_body(doc, "Neuromuscular:", bold=True)
add_bullet(doc, "Moderate neuromuscular blockade; enhances non-depolarizing muscle relaxants")

add_body(doc, "Hepatic (Halothane Hepatitis):", bold=True)
add_bullet(doc, "Metabolized 20% by CYP2E1 \u2192 reactive trifluoroacetyl chloride intermediate \u2192 immune-mediated hepatitis")
add_bullet(doc, "Type 1 (mild): Transient liver enzyme elevation (asymptomatic)")
add_bullet(doc, "Type 2 (severe): Fulminant hepatic necrosis — 'Halothane hepatitis' (1 in 35,000 exposures); repeat exposure increases risk")
add_bullet(doc, "Contraindicated in patients with previous halothane exposure + jaundice")

add_h2(doc, "Clinical Uses")
add_number(doc, "Induction and maintenance of general anaesthesia")
add_number(doc, "Inhalation induction in children (pleasant smell, non-irritating)")
add_number(doc, "Bronchodilator in refractory status asthmaticus")
add_number(doc, "Uterine relaxation during intrauterine manipulation")

add_h2(doc, "Adverse Effects Summary")
add_number(doc, "Halothane hepatitis (most serious — fulminant hepatic necrosis)")
add_number(doc, "Malignant hyperthermia (life-threatening, in susceptible individuals)")
add_number(doc, "Cardiac arrhythmias (catecholamine sensitization)")
add_number(doc, "Myocardial depression and hypotension")
add_number(doc, "Raised ICP")
add_number(doc, "Uterine relaxation (PPH risk)")
add_number(doc, "Postoperative shivering")

add_h2(doc, "Contraindications")
add_bullet(doc, "Previous halothane exposure with jaundice/unexplained fever")
add_bullet(doc, "Pheochromocytoma")
add_bullet(doc, "Raised intracranial pressure")
add_bullet(doc, "Malignant hyperthermia susceptibility")
add_bullet(doc, "Liver disease")

add_h2(doc, "Current Status")
add_body(doc, "Largely replaced by isoflurane, sevoflurane, and desflurane due to hepatotoxicity and cardiac sensitization. Still used in developing countries due to low cost.")

doc.add_page_break()

# ════════════════════════════════════════════════════════════════════════════
# Q.2
# ════════════════════════════════════════════════════════════════════════════

add_h1(doc, "Q.2  Adverse effects of general anaesthesia during and after anaesthesia.")

add_h2(doc, "ADVERSE EFFECTS OF GENERAL ANAESTHESIA (KDT 8th Ed.)")

add_h2(doc, "A.  DURING ANAESTHESIA (Intraoperative Complications)")

add_body(doc, "1.  Cardiovascular:", bold=True)
add_bullet(doc, "Hypotension (most common): Vasodilation, myocardial depression, hypovolemia. Treat with IV fluids, vasopressors (ephedrine)")
add_bullet(doc, "Hypertension: Inadequate anaesthetic depth, laryngoscopy, CO\u2082 retention")
add_bullet(doc, "Arrhythmias: Bradycardia (halothane, vagal stimulation — treat with atropine); Tachycardia (inadequate anaesthesia, hypercapnia); Ventricular fibrillation (rare — halothane + catecholamine, hypoxia)")
add_bullet(doc, "Cardiac arrest: Vagal reflex, hypoxia, drug overdose")

add_body(doc, "2.  Respiratory:", bold=True)
add_bullet(doc, "Laryngospasm: Spasm during light anaesthesia; life-threatening. Treat with 100% O\u2082, succinylcholine IV, positive pressure ventilation")
add_bullet(doc, "Bronchospasm: In asthmatics, irritant agents (isoflurane, desflurane), inadequate anaesthesia. Treat with halothane/sevoflurane, IV bronchodilators")
add_bullet(doc, "Respiratory depression \u2192 Hypercapnia and Hypoxia")
add_bullet(doc, "Airway obstruction: Tongue fall, secretions, foreign body")
add_bullet(doc, "Aspiration of gastric contents (Mendelson syndrome): Chemical pneumonitis. Prevention: RSI, pre-op fasting (NPO 6-8 hrs), antacids/H\u2082-blockers/metoclopramide")

add_body(doc, "3.  Stage II Excitement:", bold=True)
add_body(doc, "Involuntary movements, breath-holding, laryngospasm, vomiting during induction. Minimized by rapid IV induction.")

add_body(doc, "4.  Malignant Hyperthermia:", bold=True)
add_bullet(doc, "Life-threatening pharmacogenetic emergency")
add_bullet(doc, "Triggered by: Halothane, volatile agents, succinylcholine")
add_bullet(doc, "Mechanism: RYR1 gene mutation \u2192 uncontrolled Ca\u00b2\u207a release from SR \u2192 muscle hypermetabolism")
add_bullet(doc, "Features: Hyperthermia (>40\u00b0C, rapidly rising), muscle rigidity, tachycardia, metabolic acidosis, myoglobinuria, hyperkalemia")
add_bullet(doc, "Treatment: Dantrolene sodium (specific antidote, 2.5 mg/kg IV); cooling; bicarbonate for acidosis")
add_bullet(doc, "Mortality: ~70% untreated; 5–10% with dantrolene")

add_body(doc, "5.  Awareness During Anaesthesia:", bold=True)
add_body(doc, "Consciousness during surgery; associated with inadequate depth, neuromuscular blockade without hypnotics; causes PTSD.")

add_body(doc, "6.  Drug-Related:", bold=True)
add_bullet(doc, "Suxamethonium apnea (pseudocholinesterase deficiency)")
add_bullet(doc, "Anaphylaxis (muscle relaxants, latex, antibiotics)")

add_h2(doc, "B.  AFTER ANAESTHESIA (Postoperative Complications)")

add_body(doc, "1.  Post-operative Nausea and Vomiting (PONV):", bold=True)
add_bullet(doc, "Most common postoperative complication")
add_bullet(doc, "Risk factors: Female sex, non-smoker, history of motion sickness, opioids, volatile agents, nitrous oxide")
add_bullet(doc, "Prevention/Treatment: Ondansetron (5-HT\u2083 antagonist), dexamethasone, droperidol, TIVA with propofol (reduced PONV)")

add_body(doc, "2.  Residual CNS Effects:", bold=True)
add_bullet(doc, "Delayed recovery: Drug accumulation (elderly, hepatic/renal impairment)")
add_bullet(doc, "Postoperative cognitive dysfunction (POCD): Especially in elderly; may persist weeks–months")
add_bullet(doc, "Shivering: Common, increases O\u2082 consumption; treat with meperidine, forced-air warming")
add_bullet(doc, "Emergence delirium/agitation: Especially with ketamine; common in children")

add_body(doc, "3.  Cardiovascular (Postoperative):", bold=True)
add_bullet(doc, "Hypertension (pain, urinary retention)")
add_bullet(doc, "Hypotension (hypovolemia, bleeding)")
add_bullet(doc, "Perioperative MI")

add_body(doc, "4.  Respiratory (Postoperative):", bold=True)
add_bullet(doc, "Atelectasis: Most common postoperative pulmonary complication (small airways collapse, reduced FRC)")
add_bullet(doc, "Aspiration pneumonia")
add_bullet(doc, "Pulmonary embolism (DVT-PE)")
add_bullet(doc, "Respiratory depression from residual opioids/muscle relaxants")
add_bullet(doc, "Prevention: Deep breathing, CPAP, early mobilization")

add_body(doc, "5.  Hepatic and Renal:", bold=True)
add_bullet(doc, "Postoperative liver dysfunction (halothane)")
add_bullet(doc, "Acute kidney injury (hypotension, nephrotoxic drugs)")

add_body(doc, "6.  Other Complications:", bold=True)
add_bullet(doc, "Sore throat, hoarseness (ET tube or LMA)")
add_bullet(doc, "Dental damage (laryngoscopy)")
add_bullet(doc, "Corneal abrasion (dry eyes)")
add_bullet(doc, "Hypothermia (prolonged surgery, cold OR)")
add_bullet(doc, "Backache, myalgia (succinylcholine fasciculations, positioning)")
add_bullet(doc, "Nerve injuries (improper positioning)")
add_bullet(doc, "Inadequate postoperative pain control")

doc.add_page_break()

# ════════════════════════════════════════════════════════════════════════════
# Q.3
# ════════════════════════════════════════════════════════════════════════════

add_h1(doc, "Q.3  Short note on pre-anaesthetic medication.")

add_h2(doc, "PRE-ANAESTHETIC MEDICATION (Premedication) (KDT 8th Ed.)")

add_body(doc, "Pre-anaesthetic medication refers to drugs given before induction of general anaesthesia to facilitate a smooth, safe, and comfortable anaesthetic experience. Given 45–90 minutes preoperatively (oral/IM) or just before induction (IV).")

add_h2(doc, "Goals / Objectives of Premedication")
add_number(doc, "Allayment of anxiety and apprehension (sedation/anxiolysis)")
add_number(doc, "Amnesia (prevent recall of preoperative period)")
add_number(doc, "Analgesia (preemptive analgesia)")
add_number(doc, "Attenuation of autonomic (vagal) reflexes during intubation/surgery")
add_number(doc, "Anti-sialogue effect (reduce secretions to facilitate airway management)")
add_number(doc, "Antiemetic effect (reduce PONV)")
add_number(doc, "Reduce requirements of induction and maintenance agents (dose-sparing)")
add_number(doc, "Antacid prophylaxis (reduce risk of Mendelson's syndrome)")
add_number(doc, "Facilitation of smooth induction")

add_h2(doc, "Drugs Used in Premedication")

add_body(doc, "1.  Sedatives/Anxiolytics — Benzodiazepines (most commonly used):", bold=True)
add_bullet(doc, "Diazepam: 0.1–0.2 mg/kg PO/IV, 1–2 hours preoperatively")
add_bullet(doc, "Midazolam: 0.05–0.1 mg/kg IM/IV (preferred — shorter acting, potent amnesia)")
add_bullet(doc, "Lorazepam: For prolonged sedation and amnesia")
add_bullet(doc, "Actions: Anxiolysis, sedation, anterograde amnesia, anticonvulsant, reduce anaesthetic requirements")
add_bullet(doc, "Barbiturates (historical): Pentobarbitone IM (largely replaced)")
add_bullet(doc, "Promethazine: Antihistamine with sedation + antiemetic properties")

add_body(doc, "2.  Opioid Analgesics:", bold=True)
add_bullet(doc, "Morphine: 0.1 mg/kg IM; analgesia + sedation; side effects: respiratory depression, nausea, vomiting, histamine release")
add_bullet(doc, "Pethidine (meperidine): 1 mg/kg IM; shorter acting")
add_bullet(doc, "Fentanyl: IV, rapid onset, given immediately preoperatively")
add_bullet(doc, "Indication: Preoperative pain; preemptive analgesia")

add_body(doc, "3.  Anticholinergics (Anti-secretory/Vagolytic):", bold=True)
add_bullet(doc, "Atropine: 0.6 mg IM — most commonly used")
add_bullet(doc,
    "Actions: Reduces oral/pharyngeal/bronchial secretions (antisialogogue); prevents bradycardia during laryngoscopy; bronchodilation; raises intragastric pH",
    level=2)
add_bullet(doc,
    "Side effects: Tachycardia, drying of secretions, urinary retention, blurred vision, central anticholinergic syndrome (in elderly)",
    level=2)
add_bullet(doc, "Glycopyrrolate (preferred for antisialogogue): Does NOT cross BBB (no central effects); better antisialogogue; less tachycardia")

add_body(doc, "4.  H\u2082-Blockers / Antacids (Aspiration Prophylaxis):", bold=True)
add_bullet(doc, "Ranitidine: 150 mg PO (evening before + morning of surgery) — raises gastric pH")
add_bullet(doc, "Omeprazole (PPI): Reduces gastric acid volume and acidity")
add_bullet(doc, "Sodium citrate 0.3 M: Immediate-acting antacid; given 15–20 min before induction (emergency/RSI)")
add_bullet(doc, "Indication: Full stomach, emergency surgery, pregnancy, GERD, obesity")

add_body(doc, "5.  Antiemetics:", bold=True)
add_bullet(doc, "Metoclopramide: 10 mg IV — promotes gastric emptying + antiemetic (D\u2082 antagonist); given 1–2 hrs before surgery")
add_bullet(doc, "Ondansetron: 4–8 mg IV; 5-HT\u2083 antagonist; prevents PONV")
add_bullet(doc, "Dexamethasone: 4–8 mg IV; potent antiemetic, anti-inflammatory; synergistic with ondansetron")

add_body(doc, "6.  Others:", bold=True)
add_bullet(doc, "Beta-blockers: Continue perioperatively in hypertensives; cardioprotection")
add_bullet(doc, "Clonidine (alpha-2 agonist): Sedation, reduces anaesthetic requirements, hemodynamic stability")
add_bullet(doc, "MAO inhibitors: Must be stopped 2 weeks before surgery (dangerous interactions with pethidine and sympathomimetics)")

add_h2(doc, "Pediatric Premedication")
add_bullet(doc, "Oral midazolam (0.5 mg/kg) — most commonly used in children")
add_bullet(doc, "EMLA cream over IV sites to reduce pain of cannulation")

add_h2(doc, "Summary Table")

from docx.enum.table import WD_TABLE_ALIGNMENT

table = doc.add_table(rows=6, cols=3)
table.style = "Table Grid"
table.alignment = WD_TABLE_ALIGNMENT.CENTER

headers = ["Drug Class", "Drug", "Main Purpose"]
rows_data = [
    ("Benzodiazepine",       "Midazolam / Diazepam",         "Anxiolysis, amnesia"),
    ("Opioid",               "Morphine / Pethidine",          "Analgesia"),
    ("Anticholinergic",      "Atropine / Glycopyrrolate",     "Antisialogogue, vagolysis"),
    ("Antiemetic",           "Ondansetron / Metoclopramide",  "Prevent PONV"),
    ("Antacid / H\u2082-blocker", "Ranitidine / Na citrate",  "Aspiration prophylaxis"),
]

# Header row
col_widths = [Inches(1.9), Inches(2.0), Inches(2.1)]
for col_idx, header in enumerate(headers):
    cell = table.cell(0, col_idx)
    cell.width = col_widths[col_idx]
    p = cell.paragraphs[0]
    run = p.add_run(header)
    run.font.name = "Times New Roman"
    run.font.size = Pt(12)
    run.font.bold = True
    shade_cell(cell, "D5E8F0")

# Data rows
for row_idx, (col0, col1, col2) in enumerate(rows_data):
    row_cells = [table.cell(row_idx + 1, c) for c in range(3)]
    for c_idx, text in enumerate((col0, col1, col2)):
        row_cells[c_idx].width = col_widths[c_idx]
        p = row_cells[c_idx].paragraphs[0]
        run = p.add_run(text)
        run.font.name = "Times New Roman"
        run.font.size = Pt(12)

doc.add_page_break()

# ════════════════════════════════════════════════════════════════════════════
# Q.4
# ════════════════════════════════════════════════════════════════════════════

add_h1(doc, "Q.4  What are intravenous anaesthetics? Add a note on the pharmacology of Propofol.")

add_h2(doc, "INTRAVENOUS ANAESTHETICS (KDT 8th Ed.)")

add_body(doc, "Intravenous (IV) anaesthetics are drugs administered intravenously to produce unconsciousness, usually for induction of general anaesthesia. They offer rapid onset (within one arm-brain circulation time) and are more pleasant than inhalational induction.")

add_h2(doc, "Classification of IV Anaesthetics")
add_number(doc, "Barbiturates: Thiopentone sodium (ultra-short acting, prototypic), Methohexitone")
add_number(doc, "Non-barbiturate IV agents: Propofol (most widely used), Etomidate (preferred in cardiac compromise), Ketamine (dissociative — unique: analgesia + unconsciousness + amnesia with maintained airway reflexes)")
add_number(doc, "Benzodiazepines: Midazolam, Lorazepam, Diazepam")
add_number(doc, "Alpha-2 agonist: Dexmedetomidine (sedation/ICU sedation; does not produce unconsciousness at usual doses)")

add_h2(doc, "PHARMACOLOGY OF PROPOFOL")

add_body(doc, "Propofol (2,6-diisopropylphenol) is the most widely used IV anaesthetic agent worldwide, introduced clinically in 1986.")

add_h2(doc, "Physical Properties")
add_bullet(doc, "White oil-in-water emulsion (soybean oil, egg phosphatide, glycerol)")
add_bullet(doc, "Insoluble in water (requires lipid emulsion formulation)")
add_bullet(doc, "pH: 7 (neutral); stored at 2–25\u00b0C; preservative-free (strict aseptic technique required, single use within 6–12 hours)")
add_bullet(doc, "Supports microbial growth")

add_h2(doc, "Mechanism of Action")
add_body(doc, "Propofol acts primarily by enhancing GABA-A receptor-mediated inhibitory neurotransmission. It increases the duration of chloride channel opening (similar to barbiturates), leading to membrane hyperpolarization and CNS depression. Additionally, propofol inhibits NMDA receptors and modulates glycine receptors. At sub-anaesthetic concentrations: sedation and anxiolysis; at higher doses: unconsciousness.")

add_h2(doc, "Pharmacokinetics")
add_bullet(doc, "Onset: 30–60 seconds (one arm-brain circulation time) — very rapid")
add_bullet(doc, "Duration: 5–10 minutes (rapid redistribution from brain to peripheral tissues)")
add_bullet(doc, "Protein binding: ~98%; Volume of distribution: ~3.5 L/kg (highly lipophilic)")
add_bullet(doc, "Metabolism: Hepatic conjugation to inactive glucuronide/sulfate metabolites; also extra-hepatic (lung, kidney)")
add_bullet(doc, "Terminal elimination half-life: 4–7 hours")
add_bullet(doc, "Short context-sensitive half-time — suitable for prolonged TIVA infusions")
add_bullet(doc, "Excretion: Renal (88% as conjugates)")

add_h2(doc, "Pharmacological Actions")

add_body(doc, "CNS:", bold=True)
add_bullet(doc, "Loss of consciousness within 30–60 seconds")
add_bullet(doc, "No analgesia (must supplement with opioids)")
add_bullet(doc, "Excellent amnesia")
add_bullet(doc, "Antiemetic effect — major advantage (reduces PONV)")
add_bullet(doc, "Reduces ICP and CMRO\u2082 — useful in neuroanaesthesia")
add_bullet(doc, "Anticonvulsant at low doses; may cause myoclonic movements at induction")
add_bullet(doc, "EEG: Burst suppression at high doses")

add_body(doc, "Cardiovascular:", bold=True)
add_bullet(doc, "Significant hypotension (most important adverse effect): Vasodilation (reduced SVR) + negative inotropy")
add_bullet(doc, "MAP falls by 25–40% during induction")
add_bullet(doc, "Bradycardia (inhibits baroreceptor reflex)")
add_bullet(doc, "Greater hypotension than thiopentone")
add_bullet(doc, "Caution in elderly, hypovolemic, cardiac-compromised patients")

add_body(doc, "Respiratory:", bold=True)
add_bullet(doc, "Dose-dependent respiratory depression \u2192 brief apnea during induction (common)")
add_bullet(doc, "Depresses laryngeal reflexes — facilitates LMA insertion")
add_bullet(doc, "Bronchodilation (reduces airway resistance)")

add_h2(doc, "Clinical Uses")
add_number(doc, "Induction of general anaesthesia (replaced thiopentone in most centres)")
add_number(doc, "Maintenance: Total Intravenous Anaesthesia (TIVA)")
add_number(doc, "Procedural sedation: Endoscopy, colonoscopy, cardioversion, minor procedures")
add_number(doc, "ICU sedation: Mechanically ventilated patients (risk PRIS with prolonged high-dose)")
add_number(doc, "Rescue antiemetic: Subhypnotic doses (10–20 mg IV)")

add_h2(doc, "Adverse Effects")
add_number(doc, "Hypotension (most common serious adverse effect)")
add_number(doc, "Pain on injection: Very common (60–80% of patients); reduced by injecting into large vein, IV lignocaine pretreatment, or mixing lignocaine with propofol")
add_number(doc, "Apnea during induction (brief, 30–60 seconds)")
add_number(doc, "Bradycardia")

# PRIS as item 5 with sub-bullets
p_pris = doc.add_paragraph(style="List Number")
run_pris = p_pris.add_run(
    "Propofol Infusion Syndrome (PRIS): Rare, life-threatening with prolonged high-dose use (>4 mg/kg/hr for >48 hrs)"
)
apply_body_font(run_pris)
set_line_spacing(p_pris)

add_bullet(doc, "Features: Metabolic acidosis, rhabdomyolysis, hyperkalemia, renal failure, cardiac failure (Brugada pattern, RBBB, ST elevation), hypertriglyceridemia, hepatomegaly", level=2)
add_bullet(doc, "Risk: ICU patients; children at higher risk", level=2)
add_bullet(doc, "Treatment: Discontinue propofol; supportive care", level=2)

add_number(doc, "Contraindicated in severe soy/egg allergy (contains egg phosphatide and soybean oil)")
add_number(doc, "Hypertriglyceridemia with prolonged infusion (provides 1.1 kcal/mL from lipid vehicle)")
add_number(doc, "Microbial contamination risk (strict aseptic technique mandatory)")
add_number(doc, "Green discolouration of urine (benign — phenol metabolites)")
add_number(doc, "Involuntary excitatory movements during induction")

add_h2(doc, "Contraindications")
add_bullet(doc, "Allergy to propofol or its components (soy, egg)")
add_bullet(doc, "Severe cardiovascular compromise/hypotension (use etomidate instead)")
add_bullet(doc, "Children under 3 years for ICU sedation (risk of PRIS)")

add_h2(doc, "Advantages of Propofol over Other IV Agents")
add_bullet(doc, "Rapid, smooth induction and clear-headed recovery")
add_bullet(doc, "Reduced PONV (antiemetic property)")
add_bullet(doc, "Suitable for day surgery (minimal hangover)")
add_bullet(doc, "Titratable in TIVA")
add_bullet(doc, "Reduces ICP — useful in neuroanaesthesia")
add_bullet(doc, "Anticonvulsant")

add_h2(doc, "Disadvantages")
add_bullet(doc, "No analgesic properties")
add_bullet(doc, "Significant hypotension (especially in elderly)")
add_bullet(doc, "Pain on injection")
add_bullet(doc, "PRIS with prolonged infusion")
add_bullet(doc, "More expensive than thiopentone")

# ── Save ─────────────────────────────────────────────────────────────────────

from io import BytesIO
buf = BytesIO()
doc.save(buf)
buf.seek(0)
with open(OUTPUT_PATH, "wb") as f:
    f.write(buf.read())

size = os.path.getsize(OUTPUT_PATH)
print(f"File saved: {OUTPUT_PATH}")
print(f"File size : {size:,} bytes ({size/1024:.1f} KB)")
Running Command

python3 /tmp/workspace/assignments/generate_assignment_21.py

Running Command

python3 /tmp/skills/docx/scripts/office/validate.py /tmp/workspace/assignments/Assignment_21_07_26.docx

Running Command

python3 -c " from docx import Document doc = Document('/tmp/workspace/assignments/Assignment_21_07_26.docx') # Quick content spot-check paras = [p.text for p in doc.paragraphs if p.text.strip()] print(f'Total non-empty paragraphs: {len(paras)}') print('First 5:', paras[:5]) print('Last 5:', paras[-5:]) "

Running Command

python3 /tmp/skills/docx/scripts/office/unpack.py /tmp/workspace/assignments/Assignment_21_07_26.docx /tmp/workspace/assignments/unpacked/

Running Command

grep -n "zoom" /tmp/workspace/assignments/unpacked/word/settings.xml

Reading File
Editing File

~/assignments/unpacked/word/settings.xml

Successfully replaced 1 instance(s) of the string in '/tmp/workspace/assignments/unpacked/word/settings.xml'
Running Command

python3 /tmp/skills/docx/scripts/office/pack.py /tmp/workspace/assignments/unpacked/ /tmp/workspace/assignments/Assignment_21_07_26.docx --original /tmp/workspace/assignments/Assignment_21_07_26.docx

Running Command

ls -lh /tmp/workspace/assignments/Assignment_21_07_26.docx && python3 -c " import os path = '/tmp/workspace/assignments/Assignment_21_07_26.docx' size = os.path.getsize(path) print(f'File: {path}') print(f'Size: {size:,} bytes ({size/1024:.1f} KB)') # Confirm it is a valid ZIP / OOXML import zipfile zf = zipfile.ZipFile(path) names = zf.namelist() print(f'OOXML parts inside ZIP: {len(names)}') print('Key parts:', [n for n in names if n.startswith('word/') and n.endswith('.xml')][:8]) "

Both assignments are ready as .docx (Word) files - no PDFs. Download them here:

Assignment 1 - Sedative Hypnotics & Antiepileptic Drugs

Assignment 17 07 26

Word Document · DOCX

Assignment 2 - General Anaesthetics

Assignment 21 07 26

Word Document · DOCX


What's inside each file:
Assignment 17-07-26 (5 questions):
  • Q.1 - AED classification (chemical + MOA-based) + Phenytoin (MOA, PK, uses, all adverse effects, drug interactions)
  • Q.2 - 10 newer AEDs: Lamotrigine, Levetiracetam, Gabapentin, Pregabalin, Topiramate, Vigabatrin, Tiagabine, Lacosamide, Perampanel, Zonisamide
  • Q.3 - Sedative-hypnotic classification + Diazepam (GABA-A MOA, pharmacokinetics, actions, uses, ADRs, contraindications, antidote - Flumazenil)
  • Q.4 - Non-benzodiazepine hypnotics (Z-drugs: Zolpidem, Zaleplon, Zopiclone, Eszopiclone) with BZD vs Z-drug comparison table
  • Q.5 - Barbiturate poisoning management (supportive care, gastric decontamination, urinary alkalinization, dialysis)
Assignment 21-07-26 (4 questions):
  • Q.1 - GA classification + Guedel's stages + full Halothane pharmacology (halothane hepatitis, cardiac sensitization, contraindications)
  • Q.2 - Intraoperative adverse effects (malignant hyperthermia, laryngospasm, Mendelson's syndrome) + postoperative (PONV, POCD, atelectasis, PRIS)
  • Q.3 - Pre-anaesthetic medication (goals, BZDs, opioids, atropine/glycopyrrolate, antacids, antiemetics) + summary table
  • Q.4 - IV anaesthetics classification + Propofol pharmacology (GABA-A MOA, PK, PRIS, advantages/disadvantages)
All formatted in Times New Roman 12pt, 1.5 line spacing, with heading styles and page breaks between questions, referenced to KDT 8th Edition.
This is a shared conversation. Sign in to Orris to start your own chat.