All details about epilepsy and seizure

Reading File

Epilepsy and seizure defination epidemiology pathophysiology investigation management treatment prevention all data with reference

Now let me search the medical library and PubMed in parallel:
Finding Sources
Searching PubMed

"epilepsy"[MeSH Terms] AND "seizures"[MeSH Terms]

Searching the Web

epilepsy seizure definition epidemiology pathophysiology management 2024 guidelines

Now let me read the key textbook sections in parallel:
Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Finding Sources
Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Finding Sources
Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Reading File
Now I have all the data needed. Here is the comprehensive, referenced answer:

Epilepsy and Seizures - Complete Clinical Reference


1. DEFINITIONS

Seizure

A seizure is a transient event consisting of signs and/or symptoms due to abnormal, excessive, and hypersynchronous neuronal activity in the brain. Seizures may manifest as involuntary movements, altered consciousness, sensory disturbance, autonomic phenomena, or psychic symptoms - alone or in combination. The term "convulsion" implies prominent motor activity, but seizures without motor features (e.g., absence, nonconvulsive) are equally recognized.
  • Bradley and Daroff's Neurology in Clinical Practice, p. 2228

Epilepsy (ILAE 2014 Definition)

Epilepsy is a disease of the brain defined by any of the following:
  1. At least two unprovoked (or reflex) seizures occurring more than 24 hours apart
  2. One unprovoked seizure plus a probability of further seizures of ≥60% over the next 10 years (similar to recurrence risk after two unprovoked seizures)
  3. Diagnosis of an epilepsy syndrome
Epilepsy is considered resolved if a patient has been seizure-free for 10 years and off antiseizure medications (ASMs) for at least 5 years, or if they had an age-dependent epilepsy syndrome that has passed the applicable age.
  • Bradley and Daroff's Neurology in Clinical Practice, p. 2228; Fisher et al., ILAE 2014

Status Epilepticus

Seizures that are prolonged or repeated every few minutes without recovery between episodes; if sustained, threatens life and requires emergency intervention.
  • Adams and Victor's Principles of Neurology, 12th ed.

2. EPIDEMIOLOGY

ParameterData
Global prevalence~50 million people worldwide (WHO, 2024)
Annual incidence (US)~44 new cases per 100,000 persons/year
Lifetime prevalence (US)~1% by age 20; ~3% lifetime risk of diagnosis
Active epilepsy prevalence~0.8% of the general population
Low/middle-income countries~80% of epilepsy cases occur here
Treatment gapUp to 75% in low-income countries receive no treatment
Premature death riskUp to 3 times higher than general population
Seizure-free if treatedUp to 70% can achieve seizure freedom with proper treatment
Age of onset peaksEarly childhood (especially first year of life) and after age 60
Partial epilepsy shareUp to two-thirds of all incident epilepsies
First seizure lifetime risk~9% of people will have at least one seizure in their lifetime
Over two-thirds of all epileptic seizures begin in childhood. After age 60, incidence rises again due to cerebrovascular disease accumulation.
  • Adams and Victor's Principles of Neurology, 12th ed., p. 329; WHO Fact Sheet 2024; StatPearls (NCBI NBK430765)

3. ETIOLOGY

Causes are broadly categorized:

Structural

  • Hippocampal/mesial temporal sclerosis (most common cause of temporal lobe epilepsy)
  • Cortical dysplasia and malformations of cortical development
  • Tumors (primary or metastatic)
  • Cerebrovascular disease (most common cause after age 60)
  • Traumatic brain injury
  • Encephalitis, meningitis (infectious)
  • Post-stroke scarring

Genetic

  • Monogenic channelopathies (ion channel mutations): SCN1A (Dravet syndrome), KCNQ2/3 (benign neonatal epilepsy), CHRNA4 (nocturnal frontal lobe epilepsy)
  • Concordance in monozygotic twins: up to 70%; dizygotic: ~30%
  • Familial incidence in 5-10% of primary generalized epilepsies
  • Polygenic contributions common in idiopathic generalized epilepsies

Metabolic

  • Hyponatremia, hypernatremia, hyperosmolar states
  • Hypoglycemia, hypocalcemia, hypomagnesemia
  • Renal failure (uremia), hepatic encephalopathy, thyrotoxicosis, porphyria

Immune/Autoimmune

  • Anti-NMDAR, anti-LGI1, anti-CASPR2 encephalitis, and other autoimmune epilepsies

Infectious

  • Neurocysticercosis (leading cause globally in low-income settings)
  • Cerebral malaria, bacterial meningitis, viral encephalitis, HIV

Unknown/Idiopathic

  • No identifiable cause; in modern use, increasingly implies genetic underpinning
  • Adams and Victor's, p. 329-337; Bradley and Daroff's Neurology

4. CLASSIFICATION OF SEIZURES (ILAE 2017)

A. Focal Onset Seizures (formerly "partial")

Begin in one area of cortex:
  • Focal aware (formerly simple partial): consciousness preserved; symptoms reflect local cortical area (motor march in Jacksonian seizures, sensory aura, autonomic, psychic)
  • Focal impaired awareness (formerly complex partial): consciousness impaired; automatisms (lip-smacking, hand-picking), postictal confusion
  • Focal to bilateral tonic-clonic (formerly secondarily generalized): starts focal, then spreads

B. Generalized Onset Seizures (both hemispheres from onset)

TypeDescription
Tonic-clonic (grand mal)Loss of consciousness, tonic stiffening → clonic jerking; typically <3 min; postictal confusion
Absence (petit mal)Brief (4-20 sec) staring spells, no postictal state; usually 5-7 yr onset
MyoclonicVery brief (<100 ms) muscle jerks; occurs in juvenile myoclonic epilepsy, Dravet
Atonic (drop attacks)Sudden loss of muscle tone; Lennox-Gastaut syndrome
TonicSustained muscle contraction without clonic phase
ClonicRhythmic jerking without preceding tonic phase
Epileptic spasmsSudden flexion/extension of truncal muscles; infantile spasms (West syndrome)

C. Unknown Onset

D. Unclassified

  • Katzung's Basic and Clinical Pharmacology, 16th ed., Table 24-1; Bradley and Daroff's Neurology, p. 2228

5. PATHOPHYSIOLOGY

Core Mechanism

Seizures result from a sudden imbalance between excitation and inhibition in cortical neuronal networks, producing excessive, synchronized discharges. The key elements:
  • Glutamate (excitatory) excess - AMPA and NMDA receptor overactivation depolarizes neurons
  • GABA (inhibitory) deficit - reduced inhibitory interneuron activity (GABAergic failure)
  • Ion channel dysfunction - abnormal persistent Na+ currents, T-type Ca2+ channels in absence seizures, voltage-gated K+ channel dysfunction

Initiation - The Paroxysmal Depolarization Shift (PDS)

Individual neurons in the epileptic focus undergo a large, sustained depolarization (PDS) with a burst of action potentials, followed by hyperpolarization. In normal tissue, the inhibitory surround contains the discharge. When inhibition fails or excitation overwhelms it, spread occurs.

Focal vs. Generalized Spread

  • Focal seizures: discharge starts in a localized cortical area and may spread locally (e.g., Jacksonian march - prerolandic cortex) or propagate subcortically to thalamus and spread bilaterally
  • Generalized seizures: thalamocortical circuits are involved from the onset; cortico-reticular system activates bilaterally - explaining immediate loss of consciousness

Molecular Targets Implicated

  • Voltage-gated Na+ channels: mutations in SCN1A (Nav1.1) cause Dravet; Nav1.2 implicated in genetic epilepsy with febrile seizures plus (GEFS+)
  • GABA-A receptors: mutations in GABRG2 reduce inhibition
  • K+ channels: KCNQ2/3 mutations underlie benign neonatal epilepsy
  • Ca2+ channels: T-type channels critical in absence seizure generation (thalamocortical loops)

Hippocampal Sclerosis

Neuronal loss in CA1 sector (Sommer sector) of hippocampus + gliosis = most common pathologic substrate for temporal lobe epilepsy. Whether primary or secondary to seizures remains debated. Surgical resection achieves seizure freedom in up to 70% of selected patients.

Consequences of Chronic Seizures

  • Diffuse and accelerated cortical thinning (neurodegeneration)
  • Memory and cognitive impairment
  • SUDEP (Sudden Unexpected Death in Epilepsy)
  • Adams and Victor's Principles of Neurology, 12th ed., p. 329; Katzung's Basic and Clinical Pharmacology, 16th ed., p. 653; Eric Kandel's Principles of Neural Science, 6th ed.

6. CLINICAL PRESENTATION

Prodrome

For hours before a seizure, the patient may feel irritable, apathetic, or rarely ecstatic (not the aura itself).

Aura

A focal seizure preceding a generalized seizure - represents the initial focal discharge. Nature of aura localizes the seizure focus:
Aura typeLocalization
SomatosensoryContralateral post-rolandic
Olfactory / gustatoryMesial temporal / insula
Déjà vu, dreamy statesTemporal
Fear, formed hallucinationsTemporal amygdalo-hippocampal
Visual (unformed lights)Occipital
VertigoSuperior temporal

Tonic-Clonic Seizure Phases

  1. Tonic phase: sudden cry, loss of consciousness, tonic extension of limbs (~10-30 sec)
  2. Clonic phase: rhythmic jerking of limbs, tongue biting, incontinence (~1-2 min)
  3. Postictal phase: confusion, headache, fatigue, Todd's paresis (transient focal weakness after focal motor seizure)

Focal Features by Region

  • Frontal lobe: contralateral head/eye deviation, supplementary motor area posturing
  • Temporal lobe: automatisms (lip-smacking, chewing), impaired awareness, memory changes
  • Parietal: contralateral sensory phenomena
  • Occipital: visual phenomena, eye deviation
  • Adams and Victor's Principles of Neurology, 12th ed., Table 15-2

7. INVESTIGATIONS

1. Electroencephalography (EEG)

The single most important investigation:
  • Interictal EEG: identifies epileptiform discharges (spikes, sharp waves, spike-wave complexes)
  • Ictal EEG: records actual seizure onset - mandatory for presurgical evaluation
  • 3 Hz spike-and-wave: childhood absence epilepsy
  • Hypsarrhythmia: West syndrome/infantile spasms
  • Centrotemporal spikes: benign childhood epilepsy with centrotemporal spikes (BECTS)
  • Video-EEG monitoring: gold standard for localizing seizure onset prior to surgery
  • Continuous EEG: essential after paralytic agents in ICU to detect nonconvulsive status epilepticus

2. Neuroimaging

  • MRI brain (with epilepsy protocol): preferred over CT; detects hippocampal sclerosis, cortical dysplasia, cavernomas, tumors, vascular malformations
  • CT brain: used acutely if hemorrhage, acute trauma, or MRI unavailable
  • MRI sequences: T1 volumetric, FLAIR (for cortical dysplasia, sclerosis), T2, DWI (acute), gadolinium contrast

3. Blood Tests

  • Blood glucose (rule out hypoglycemia)
  • Electrolytes (Na+, Ca2+, Mg2+), BUN, creatinine
  • Liver function tests
  • Full blood count
  • Toxicology screen (alcohol, cocaine, tricyclics, bupropion, tramadol, imipenem, cefepime)
  • Anticonvulsant drug levels (if on treatment)
  • Metabolic panel, thyroid function if indicated
  • Pregnancy test in women of childbearing age

4. Lumbar Puncture

  • Do NOT perform during active status epilepticus
  • Indicated if CNS infection (meningitis, encephalitis) suspected after imaging excludes raised ICP
  • Cell count, protein, glucose, culture, PCR for viruses, oligoclonal bands

5. Genetic Testing

  • Single-gene panel or whole exome sequencing for suspected genetic epilepsy
  • Particularly in children with early-onset, treatment-resistant, or syndromic epilepsy (Dravet, KCNQ2, tuberous sclerosis)

6. Autoimmune Workup

  • Serum and CSF autoantibodies: anti-NMDAR, anti-LGI1, anti-CASPR2, anti-AMPA, anti-GABA-B
  • Paraneoplastic panel if CNS autoimmune encephalitis suspected

7. Neuropsychological Testing

  • Evaluates cognitive function, memory lateralization
  • Required for presurgical planning
  • Tintinalli's Emergency Medicine, p. 1199; Adams and Victor's Principles of Neurology, 12th ed.

8. MANAGEMENT AND TREATMENT

A. Acute Seizure Management (First Aid)

  1. Protect from injury (turn on side, cushion head)
  2. Do not restrain, do not insert objects in mouth
  3. Time the seizure
  4. Call emergency services if seizure >5 minutes, or no return to consciousness

B. Status Epilepticus - Emergency Protocol

(Goal: seizure cessation within 30 minutes; mortality increases with delayed treatment)
Step 1 - Stabilization (0-5 min)
  • ABCs: airway, breathing, circulation
  • IV access, oxygen, cardiac monitor, pulse oximetry
  • Bedside glucose; IV dextrose if hypoglycemic
  • IV normal saline (NOT glucose solutions - incompatible with phenytoin)
  • Labs: glucose, BMP, Ca2+, Mg2+, lactate, toxicology, anticonvulsant levels
  • Temperature monitoring; treat hyperthermia
Step 2 - Benzodiazepines (5-20 min) - FIRST-LINE
DrugRouteDoseNotes
LorazepamIV2-4 mgPreferred if IV access; onset 3 min, duration 12-24 h
MidazolamIM10 mgNon-inferior to IV lorazepam; preferred if no IV access
DiazepamIV5-10 mgFaster onset (2 min), shorter duration (15-60 min)
Step 3 - Second-line AEDs (20-40 min)
  • Phenytoin/Fosphenytoin IV (fosphenytoin preferred - less phlebitis): 20 mg/kg IV load
  • Valproate IV: 20-40 mg/kg
  • Levetiracetam IV: 60 mg/kg (up to 4.5 g)
  • Lacosamide IV: 200-400 mg
Step 4 - Refractory Status (>40-60 min) - ICU
  • Intubation, general anesthesia
  • Propofol IV infusion or midazolam infusion or pentobarbital
  • Continuous EEG monitoring mandatory (to detect nonconvulsive activity post-paralysis)
  • Do not perform LP during active status epilepticus
  • Tintinalli's Emergency Medicine, p. 1199; Harriet Lane Handbook, 23rd ed.

C. Chronic Antiseizure Medications (ASMs)

Principles:
  • Monotherapy preferred initially (fewer adverse effects, better adherence)
  • About 2/3 of patients achieve seizure control with appropriate medication
  • After two failed appropriate medications, patient is considered pharmacoresistant
  • Choice of ASM depends on seizure type and epilepsy syndrome
Pharmacologic Aspects of Major ASMs:
DrugTrade NameAdult DoseHalf-Life (h)Target Level (µg/mL)Main Use
Valproic acidDepakote1,000-3,000 mg/d6-1550-100GTC, absence, myoclonic, broad-spectrum
PhenytoinDilantin300-400 mg/d12-3610-20Focal, GTC
CarbamazepineTegretol600-1,200 mg/d14-254-12Focal seizures
OxcarbazepineTrileptal900-2,400 mg/d1-5-Focal seizures
LamotrigineLamictal300-500 mg/d15-602-7Focal, absence, GTC, broad-spectrum
LevetiracetamKeppra500-3,000 mg/d6-8-Focal, GTC, broad-spectrum
TopiramateTopamax400 mg/d20-30-Focal, GTC
LacosamideVimpat300-400 mg/d13-Focal seizures
EthosuximideZarontin750-1,500 mg/d20-6050-100Absence only
PhenobarbitalLuminal90-200 mg/d40-12015-40GTC, focal (older agent)
BrivaracetamBriviact50-200 mg/d9-Focal seizures
PerampanelFycompa2-12 mg/d105-Focal, GTC
ClobazamOnfi5-40 mg/d16-42-Adjunctive
ZonisamideZonegran100-600 mg/d63-Focal, GTC
GabapentinNeurontin900-3,600 mg/d5-7-Focal (adjunctive)
Key Drug-Seizure Matching:
  • Absence seizures: Ethosuximide (first-line), valproate, lamotrigine
  • Juvenile myoclonic epilepsy: Valproate, lamotrigine, levetiracetam (avoid carbamazepine - can worsen)
  • Focal seizures: Carbamazepine, oxcarbazepine, lacosamide, brivaracetam, levetiracetam
  • Infantile spasms (West syndrome): ACTH or vigabatrin (first-line per ILAE)
  • Lennox-Gastaut syndrome: Valproate, lamotrigine, clobazam, rufinamide, fenfluramine
  • Adams and Victor's Principles of Neurology, 12th ed., Table 15-6; Katzung's Basic and Clinical Pharmacology, 16th ed.

D. Mechanisms of Action (ASMs)

  1. Voltage-gated Na+ channel blockade: phenytoin, carbamazepine, oxcarbazepine, lamotrigine, lacosamide - reduce sustained high-frequency firing
  2. GABA enhancement: benzodiazepines, barbiturates (GABA-A); valproate (increases GABA synthesis/reduces catabolism), vigabatrin (irreversible GABA-T inhibitor)
  3. T-type Ca2+ channel blockade: ethosuximide, valproate - critical for absence seizures (thalamocortical loops)
  4. Synaptic vesicle protein SV2A modulation: levetiracetam, brivaracetam - reduces neurotransmitter release
  5. Glutamate antagonism: perampanel (AMPA receptor antagonist), topiramate (partial)
  6. HCN channel modulation: lamotrigine, gabapentin
  • Katzung's Basic and Clinical Pharmacology, 16th ed., p. 652-653

E. Non-Pharmacological Treatment

1. Epilepsy Surgery
  • For pharmacoresistant epilepsy (failed ≥2 appropriate ASMs)
  • Temporal lobectomy: most common; 70% seizure-free for mesial temporal lobe epilepsy
  • Extratemporal cortical resection: lower success rates
  • Lesionectomy: curative when seizures arise from resectable structural lesion (tumor, cavernoma)
  • Presurgical evaluation: prolonged video-EEG, MRI, neuropsychological testing, fMRI, PET, SPECT, intracranial EEG if necessary
2. Neuromodulation
  • Vagus Nerve Stimulator (VNS): implanted open-loop device; approved for drug-refractory focal seizures and Lennox-Gastaut syndrome; helical electrode on left vagus nerve
  • Responsive Neurostimulation (RNS): closed-loop intracranial device; detects epileptiform activity and delivers targeted stimulation to abort seizures
  • Deep Brain Stimulation (DBS): bilateral stimulation of anterior thalamic nuclei; approved adjunctive therapy for focal seizures ± secondary generalization
3. Ketogenic Diet
  • High fat, low carbohydrate, controlled protein
  • Particularly effective in: myoclonic epilepsies, infantile spasms, Dravet syndrome, tuberous sclerosis, Lennox-Gastaut syndrome
  • First-line for GLUT1 deficiency syndrome (glucose transporter 1 deficiency)
  • Benefits both children and adults
  • Recent meta-analysis (Chen et al., 2023, PMID 37836444) confirms ketogenic diet's multiple health benefits across epilepsy types
4. Special Epilepsy Syndromes - Specific Treatments
  • Febrile seizures: Reassurance; acute benzodiazepine for prolonged febrile seizure; prophylactic ASMs not routinely recommended
  • Neonatal seizures: Phenobarbital (first-line), levetiracetam, phenytoin - ILAE Task Force guidance (Pressler et al., 2023, PMID 37655702)
  • Autoimmune epilepsy: Immunotherapy (steroids, IVIG, plasmapheresis, rituximab)
  • Katzung's, 16th ed., p. 649; Adams and Victor's, 12th ed.

9. METABOLIC AND DRUG-INDUCED SEIZURES

Antiseizure drugs are usually ineffective if the metabolic abnormality causing seizures is not corrected. Key reversible causes:
  • Hypoglycemia, hyponatremia, hypocalcemia, hypomagnesemia
  • Alcohol/benzodiazepine withdrawal
  • Drug toxicity: imipenem, cefepime (especially with renal failure), bupropion, tricyclics, lidocaine, aminophylline, tramadol, propofol (paradoxically)
  • Adams and Victor's Principles of Neurology, 12th ed., p. 355

10. PREVENTION

Primary Prevention (avoiding first seizure)

  • Prevention and prompt treatment of CNS infections (meningitis, encephalitis, neurocysticercosis)
  • Prevention of head trauma (helmets, seat belts)
  • Good prenatal care (prevention of birth injuries, hypoxic-ischemic encephalopathy)
  • Control of cardiovascular risk factors to prevent stroke (major cause of epilepsy after age 60)
  • Avoiding precipitants: sleep deprivation, alcohol/benzodiazepine excess, drug toxicity
  • Lead poisoning prevention in children

Secondary Prevention (preventing seizure recurrence)

  • After two unprovoked seizures: strong evidence for starting ASMs (reduces recurrence risk from >60% baseline)
  • After one unprovoked seizure: ASM initiation recommended if recurrence risk is high (structural lesion, epileptiform EEG, prior brain injury); reduces early recurrence but long-term outcome the same - AAN 2015 guideline (reaffirmed Feb 2024)
  • After febrile seizure: prophylactic ASMs not routinely recommended unless prolonged febrile status
  • Medication adherence: the single most important factor in preventing breakthrough seizures in established epilepsy

Tertiary Prevention (reducing impact of chronic epilepsy)

  • Regular follow-up and medication optimization
  • SUDEP (Sudden Unexpected Death in Epilepsy) awareness and risk reduction: nocturnal supervision, detection devices, optimizing seizure control
  • Driving restriction counseling (typically seizure-free period required before driving legally)
  • Seizure action plans and rescue benzodiazepine prescriptions (intranasal midazolam, diastat)
  • Mental health support (depression and anxiety prevalence 2-3x higher in epilepsy)
  • AAN/American Epilepsy Society Guidelines 2015 (reaffirmed 2024); NAEC 2023 Guidelines for Epilepsy Centers

11. SPECIAL POPULATIONS

Pregnancy

  • Seizures risk fetal hypoxia - generally continuation of ASMs recommended
  • Valproate - highest teratogenicity (neural tube defects, cognitive impairment) - avoid in women of childbearing age if alternatives exist
  • Lamotrigine and levetiracetam - relatively safer options
  • Folic acid supplementation mandatory pre-conception and in first trimester

Elderly

  • Most common new-onset cause: cerebrovascular disease
  • Drug interactions and polypharmacy hazards increase
  • Enzyme-inducing ASMs (phenytoin, carbamazepine) accelerate bone metabolism and interact with anticoagulants

Children

  • Wide variety of age-specific syndromes (West, Dravet, Lennox-Gastaut, childhood absence epilepsy, BECTS)
  • Many benign childhood epilepsies remit spontaneously by adolescence

12. PROGNOSIS

  • ~70% of patients achieve seizure freedom with appropriate treatment
  • ~30% develop pharmacoresistance
  • After 2 failed ASM trials, probability of further seizure control with additional medications is only ~5-10%
  • Surgical candidates: 50-70% achieve long-term seizure freedom with temporal lobectomy
  • Mortality: 2-3x general population; SUDEP risk ~1/1,000 person-years in the general epilepsy population, up to 1/150 in severe drug-resistant epilepsy

13. REFERENCES

  1. Adams and Victor's Principles of Neurology, 12th Edition - Chapter 15: Epilepsy and Other Seizure Disorders
  2. Bradley and Daroff's Neurology in Clinical Practice - Chapter 100: Seizures and Epilepsy
  3. Katzung's Basic and Clinical Pharmacology, 16th Edition - Chapter 24: Antiseizure Medications
  4. Tintinalli's Emergency Medicine: A Comprehensive Study, 9th ed. - Chapter 171: Treatment of Status Epilepticus
  5. Harriet Lane Handbook, 23rd ed. - Status Epilepticus Treatment Guidelines
  6. Eric Kandel's Principles of Neural Science, 6th Edition - Seizure Focus and Surgical Treatment of Epilepsy
  7. Fisher RS et al. ILAE Official Report: A practical clinical definition of epilepsy. Epilepsia 2014; 55(4):475-482
  8. Scheffer IE et al. ILAE classification of the epilepsies: Position paper of the ILAE Commission for Classification and Terminology. Epilepsia 2017;58(4):512-521
  9. WHO Epilepsy Fact Sheet, February 2024. who.int
  10. AAN/AES Practice Guideline: Management of an Unprovoked First Seizure in Adults. Neurology 2015;84(16):1705-1713. Reaffirmed Feb 2024
  11. Pressler RM et al. Treatment of seizures in the neonate: Guidelines and consensus-based recommendations - ILAE Task Force on Neonatal Seizures. Epilepsia 2023 Oct [PMID: 37655702]
  12. Chu H et al. Antiseizure medications for idiopathic generalized epilepsies: a systematic review and network meta-analysis. J Neurol 2023 Oct [PMID: 37378757]
  13. Chen S et al. Ketogenic Diet and Multiple Health Outcomes: An Umbrella Review of Meta-Analysis. Nutrients 2023 [PMID: 37836444]
  14. NAEC 2023 Guidelines for Specialized Epilepsy Centers. Neurology 2024 Feb
  15. Hauser WA, Annegers JF. Epidemiology of epilepsy. In: Laidlaw J, Richens A, Chadwick D (eds). A Textbook of Epilepsy. Churchill Livingstone, 1992

Summary Snapshot: Epilepsy affects ~50 million people worldwide, defined by the ILAE 2014 criteria as ≥2 unprovoked seizures or one seizure with ≥60% recurrence risk. The underlying mechanism is an imbalance of excitation (glutamate) over inhibition (GABA) with abnormal neuronal synchronization. Classification follows the ILAE 2017 framework (focal/generalized/unknown onset). Investigations center on EEG and MRI. Treatment starts with ASM monotherapy; ~70% achieve seizure control. Pharmacoresistant cases may benefit from surgery, VNS/RNS/DBS, or ketogenic diet. Status epilepticus is a medical emergency: lorazepam → phenytoin/levetiracetam → anesthesia.This is a comprehensive reference covering all aspects of epilepsy and seizures. Here is a quick orientation to the sections:

What's covered above:
SectionKey Content
1. DefinitionsILAE 2014 definition of epilepsy, seizure, status epilepticus
2. Epidemiology50 million globally, incidence/prevalence data, age patterns
3. EtiologyStructural, genetic, metabolic, immune, infectious, unknown
4. ClassificationILAE 2017 focal vs. generalized; all seizure subtypes with descriptions
5. PathophysiologyExcitation/inhibition imbalance, PDS, channelopathies, hippocampal sclerosis, genetics
6. Clinical PresentationAuras by localization, tonic-clonic phases, postictal features
7. InvestigationsEEG, MRI protocol, blood tests, LP, genetic/autoimmune workup
8. Management/TreatmentAcute first aid → Status epilepticus protocol → Chronic ASMs (full table) → Surgery → VNS/RNS/DBS → Ketogenic diet
9. Drug-induced seizuresMetabolic causes; ineffectiveness of ASMs if underlying cause not treated
10. PreventionPrimary, secondary, tertiary prevention strategies
11. Special populationsPregnancy, elderly, children
12. Prognosis70% seizure-free; pharmacoresistance; surgical outcomes; SUDEP
13. References15 authoritative references (textbooks + ILAE + AAN + PubMed)

Give uper all information in ppt

Reading File
Reading File
Reading File
Now let me create the full presentation script:
Running Command

ls -la /home/daytona/workspace/

Running Command

mkdir -p /home/daytona/workspace/epilepsy-ppt

Writing File

~/epilepsy-ppt/epilepsy.js

const pptxgen = require("pptxgenjs");
const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Epilepsy and Seizures - Complete Clinical Reference";
pres.author = "Orris Medical";

// ─── COLOR PALETTE ──────────────────────────────────────────────
const C = {
  darkBlue:   "0A1628",  // dominant dark bg
  midBlue:    "1A3A5C",  // card/panel bg
  accentTeal: "00B4D8",  // heading accent / highlight
  accentGold: "F4A261",  // sub-accent
  white:      "FFFFFF",
  lightGray:  "E8EFF6",
  textLight:  "D0E4F7",
  textDark:   "0A1628",
  red:        "E63946",
  green:      "2DC653",
  orange:     "F4A261",
};

// ─── HELPERS ────────────────────────────────────────────────────
function darkSlide(slide) {
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 5.625, fill: { color: C.darkBlue }, line: { color: C.darkBlue } });
}
function sectionBar(slide, title) {
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 0.72, fill: { color: C.midBlue }, line: { color: C.midBlue } });
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0.72, w: 10, h: 0.06, fill: { color: C.accentTeal }, line: { color: C.accentTeal } });
  slide.addText(title, { x: 0.35, y: 0.08, w: 9.3, h: 0.55, fontSize: 22, bold: true, color: C.white, fontFace: "Calibri", margin: 0 });
}
function card(slide, x, y, w, h, color) {
  color = color || C.midBlue;
  slide.addShape(pres.shapes.ROUNDED_RECTANGLE, { x, y, w, h, fill: { color }, line: { color }, rectRadius: 0.12, shadow: { type: "outer", color: "000000", blur: 8, offset: 3, angle: 135, opacity: 0.2 } });
}
function accentLine(slide, x, y, w) {
  slide.addShape(pres.shapes.RECTANGLE, { x, y, w, h: 0.04, fill: { color: C.accentTeal }, line: { color: C.accentTeal } });
}

// ═══════════════════════════════════════════════════════
// SLIDE 1 — TITLE
// ═══════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);
  // Left accent bar
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 0.12, h: 5.625, fill: { color: C.accentTeal }, line: { color: C.accentTeal } });
  // Brain icon placeholder (circle)
  s.addShape(pres.shapes.ELLIPSE, { x: 7.1, y: 0.7, w: 2.5, h: 2.5, fill: { color: C.midBlue }, line: { color: C.accentTeal, pt: 2 } });
  s.addText("🧠", { x: 7.1, y: 0.7, w: 2.5, h: 2.5, fontSize: 72, align: "center", valign: "middle" });
  // Main title
  s.addText("EPILEPSY", { x: 0.5, y: 0.7, w: 6.3, h: 1.1, fontSize: 52, bold: true, color: C.white, fontFace: "Calibri", margin: 0 });
  s.addText("& SEIZURES", { x: 0.5, y: 1.75, w: 6.3, h: 0.9, fontSize: 40, bold: true, color: C.accentTeal, fontFace: "Calibri", margin: 0 });
  accentLine(s, 0.5, 2.75, 5.5);
  s.addText("Complete Clinical Reference", { x: 0.5, y: 2.88, w: 6.3, h: 0.5, fontSize: 18, color: C.textLight, fontFace: "Calibri", margin: 0 });
  s.addText("Definition  •  Epidemiology  •  Pathophysiology  •  Classification\nInvestigation  •  Management  •  Treatment  •  Prevention", {
    x: 0.5, y: 3.5, w: 9.2, h: 0.85, fontSize: 13, color: C.accentGold, fontFace: "Calibri", align: "left", margin: 0
  });
  s.addText("Sources: Adams & Victor | Bradley & Daroff | Katzung | WHO 2024 | ILAE 2017", {
    x: 0.5, y: 5.05, w: 9.2, h: 0.4, fontSize: 10, color: "7A9CC0", fontFace: "Calibri", margin: 0
  });
}

// ═══════════════════════════════════════════════════════
// SLIDE 2 — CONTENTS
// ═══════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);
  sectionBar(s, "Contents");
  const topics = [
    ["01", "Definitions"],
    ["02", "Epidemiology"],
    ["03", "Etiology"],
    ["04", "Classification of Seizures"],
    ["05", "Pathophysiology"],
    ["06", "Clinical Presentation"],
    ["07", "Investigations"],
    ["08", "Management & Treatment"],
    ["09", "Antiseizure Medications"],
    ["10", "Non-Pharmacological Treatment"],
    ["11", "Prevention & Prognosis"],
    ["12", "References"],
  ];
  const cols = [topics.slice(0, 6), topics.slice(6)];
  cols.forEach((col, ci) => {
    col.forEach((t, i) => {
      const x = ci === 0 ? 0.35 : 5.2;
      const y = 0.95 + i * 0.74;
      card(s, x, y, 4.6, 0.62, C.midBlue);
      s.addText(t[0], { x: x + 0.12, y: y + 0.1, w: 0.5, h: 0.42, fontSize: 13, bold: true, color: C.accentTeal, fontFace: "Calibri", margin: 0 });
      s.addText(t[1], { x: x + 0.7, y: y + 0.1, w: 3.7, h: 0.42, fontSize: 13, color: C.white, fontFace: "Calibri", margin: 0 });
    });
  });
}

// ═══════════════════════════════════════════════════════
// SLIDE 3 — DEFINITIONS
// ═══════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);
  sectionBar(s, "01 | Definitions");
  // Seizure card
  card(s, 0.35, 0.92, 9.3, 1.32, "102040");
  s.addText("SEIZURE", { x: 0.55, y: 0.98, w: 3, h: 0.38, fontSize: 15, bold: true, color: C.accentTeal, fontFace: "Calibri", margin: 0 });
  s.addText(
    "A transient event of signs/symptoms due to abnormal, excessive, and hypersynchronous neuronal activity in the brain. May manifest as involuntary movements, altered consciousness, sensory disturbance, autonomic phenomena, or psychic symptoms.",
    { x: 0.55, y: 1.35, w: 9.0, h: 0.78, fontSize: 12, color: C.textLight, fontFace: "Calibri", margin: 0 }
  );
  // Epilepsy card
  card(s, 0.35, 2.38, 9.3, 1.62, "102040");
  s.addText("EPILEPSY  (ILAE 2014 Definition)", { x: 0.55, y: 2.44, w: 8.8, h: 0.38, fontSize: 15, bold: true, color: C.accentGold, fontFace: "Calibri", margin: 0 });
  s.addText([
    { text: "A disease of the brain defined by any ONE of:\n", options: { bold: true, color: C.white, breakLine: false } },
    { text: "1.  At least two unprovoked (or reflex) seizures > 24 hours apart\n", options: { color: C.textLight } },
    { text: "2.  One unprovoked seizure + ≥60% probability of recurrence over next 10 years\n", options: { color: C.textLight } },
    { text: "3.  Diagnosis of an epilepsy syndrome", options: { color: C.textLight } },
  ], { x: 0.55, y: 2.85, w: 9.0, h: 1.05, fontSize: 12, fontFace: "Calibri", margin: 0 });
  // Status card
  card(s, 0.35, 4.12, 9.3, 0.85, "1A0A0A");
  s.addText("STATUS EPILEPTICUS", { x: 0.55, y: 4.17, w: 3.5, h: 0.38, fontSize: 14, bold: true, color: C.red, fontFace: "Calibri", margin: 0 });
  s.addText("Prolonged seizures (>5 min) or repeated seizures without recovery between episodes. Life-threatening emergency.", {
    x: 0.55, y: 4.53, w: 9.0, h: 0.35, fontSize: 12, color: C.textLight, fontFace: "Calibri", margin: 0
  });
}

// ═══════════════════════════════════════════════════════
// SLIDE 4 — EPIDEMIOLOGY
// ═══════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);
  sectionBar(s, "02 | Epidemiology");
  const stats = [
    { val: "50M",   label: "People worldwide\nhave epilepsy",        col: C.accentTeal },
    { val: "80%",   label: "Cases in low/middle-\nincome countries",  col: C.accentGold },
    { val: "70%",   label: "Can be seizure-free\nif treated",         col: C.green },
    { val: "3×",    label: "Higher premature\ndeath risk",            col: C.red },
  ];
  stats.forEach((st, i) => {
    const x = 0.35 + i * 2.35;
    card(s, x, 0.88, 2.15, 1.55, C.midBlue);
    s.addText(st.val, { x, y: 0.98, w: 2.15, h: 0.72, fontSize: 36, bold: true, color: st.col, fontFace: "Calibri", align: "center", margin: 0 });
    s.addText(st.label, { x, y: 1.65, w: 2.15, h: 0.68, fontSize: 11, color: C.textLight, fontFace: "Calibri", align: "center", margin: 0 });
  });
  const rows = [
    ["Annual incidence (US)", "~44 new cases per 100,000 persons/year"],
    ["Lifetime prevalence (US)", "~3% lifetime risk of receiving an epilepsy diagnosis"],
    ["Active epilepsy prevalence", "~0.8% of the general population"],
    ["Age of onset peaks", "Early childhood (first year of life) and after age 60"],
    ["First seizure lifetime risk", "~9% of all people will have at least one seizure in their lifetime"],
    ["Treatment gap (low-income)", "Up to 75% of patients receive no treatment"],
    ["Most common cause after 60", "Cerebrovascular disease"],
  ];
  rows.forEach((r, i) => {
    const y = 2.6 + i * 0.42;
    const bg = i % 2 === 0 ? "0D2136" : "0A1628";
    s.addShape(pres.shapes.RECTANGLE, { x: 0.35, y, w: 9.3, h: 0.42, fill: { color: bg }, line: { color: bg } });
    s.addText(r[0], { x: 0.45, y: y + 0.05, w: 3.5, h: 0.32, fontSize: 11.5, bold: true, color: C.accentTeal, fontFace: "Calibri", margin: 0 });
    s.addText(r[1], { x: 4.05, y: y + 0.05, w: 5.5, h: 0.32, fontSize: 11.5, color: C.textLight, fontFace: "Calibri", margin: 0 });
  });
}

// ═══════════════════════════════════════════════════════
// SLIDE 5 — ETIOLOGY
// ═══════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);
  sectionBar(s, "03 | Etiology");
  const cats = [
    { title: "Structural", color: "1A5276", items: ["Hippocampal/mesial temporal sclerosis", "Cortical dysplasia & malformations", "Tumors (primary or metastatic)", "Cerebrovascular disease (leading cause >60yr)", "Traumatic brain injury", "Encephalitis / meningitis"] },
    { title: "Genetic", color: "1A4731", items: ["SCN1A mutation → Dravet syndrome", "KCNQ2/3 → Benign neonatal epilepsy", "CHRNA4 → Nocturnal frontal lobe epilepsy", "Monozygotic twin concordance: 70%", "Familial incidence: 5-10% of primary epilepsies", "Polygenic contributions common"] },
    { title: "Metabolic", color: "4A1942", items: ["Hypoglycemia, hyponatremia, hypocalcemia", "Hypomagnesemia, hypernatremia", "Renal failure (uremia)", "Hepatic encephalopathy, thyrotoxicosis", "Porphyria", "Alcohol/BZD withdrawal"] },
    { title: "Immune / Infectious", color: "4A2E0A", items: ["Anti-NMDAR, anti-LGI1, anti-CASPR2", "Autoimmune encephalitis", "Neurocysticercosis (global leading cause)", "Cerebral malaria, HIV", "Bacterial meningitis", "Viral encephalitis"] },
  ];
  cats.forEach((c, i) => {
    const x = 0.18 + i * 2.45;
    card(s, x, 0.88, 2.28, 4.55, c.color);
    s.addText(c.title, { x: x + 0.1, y: 0.94, w: 2.08, h: 0.38, fontSize: 13, bold: true, color: C.accentTeal, fontFace: "Calibri", align: "center", margin: 0 });
    accentLine(s, x + 0.1, 1.34, 2.08);
    c.items.forEach((item, j) => {
      s.addText([{ text: "• ", options: { color: C.accentGold } }, { text: item, options: { color: C.textLight } }], {
        x: x + 0.1, y: 1.42 + j * 0.52, w: 2.1, h: 0.5, fontSize: 10.5, fontFace: "Calibri", margin: 0
      });
    });
  });
}

// ═══════════════════════════════════════════════════════
// SLIDE 6 — CLASSIFICATION (ILAE 2017)
// ═══════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);
  sectionBar(s, "04 | Classification of Seizures (ILAE 2017)");
  // Focal
  card(s, 0.25, 0.88, 3.05, 4.5, "0D2545");
  s.addText("FOCAL ONSET", { x: 0.35, y: 0.94, w: 2.85, h: 0.38, fontSize: 14, bold: true, color: C.accentTeal, fontFace: "Calibri", align: "center", margin: 0 });
  s.addText("(formerly Partial)", { x: 0.35, y: 1.28, w: 2.85, h: 0.28, fontSize: 10, color: "7A9CC0", fontFace: "Calibri", align: "center", margin: 0 });
  accentLine(s, 0.45, 1.6, 2.65);
  const focalItems = [
    ["Focal Aware", "Simple partial — consciousness preserved; aura, Jacksonian march"],
    ["Focal Impaired", "Complex partial — consciousness impaired; automatisms"],
    ["Focal → Bilateral", "Formerly 'secondarily generalized'; starts focal, spreads bilaterally"],
  ];
  focalItems.forEach((f, i) => {
    s.addText(f[0], { x: 0.38, y: 1.72 + i * 1.05, w: 2.72, h: 0.3, fontSize: 11.5, bold: true, color: C.accentGold, fontFace: "Calibri", margin: 0 });
    s.addText(f[1], { x: 0.38, y: 2.02 + i * 1.05, w: 2.72, h: 0.65, fontSize: 10.5, color: C.textLight, fontFace: "Calibri", margin: 0 });
  });
  // Generalized
  card(s, 3.6, 0.88, 4.05, 4.5, "0D2545");
  s.addText("GENERALIZED ONSET", { x: 3.7, y: 0.94, w: 3.85, h: 0.38, fontSize: 14, bold: true, color: C.accentGold, fontFace: "Calibri", align: "center", margin: 0 });
  s.addText("(both hemispheres from onset)", { x: 3.7, y: 1.28, w: 3.85, h: 0.28, fontSize: 10, color: "7A9CC0", fontFace: "Calibri", align: "center", margin: 0 });
  accentLine(s, 3.75, 1.6, 3.75);
  const genItems = [
    ["Tonic-Clonic (Grand Mal)", "LOC → tonic stiffening → clonic jerking; <3 min; postictal confusion"],
    ["Absence (Petit Mal)", "4-20 sec staring; no postictal state; 3 Hz spike-wave; onset 5-7 yr"],
    ["Myoclonic", "Brief (<100 ms) muscle jerks; juvenile myoclonic epilepsy, Dravet"],
    ["Atonic (Drop Attacks)", "Sudden loss of muscle tone; Lennox-Gastaut syndrome"],
    ["Epileptic Spasms", "Sudden flexion/extension; West syndrome (infantile spasms)"],
  ];
  genItems.forEach((g, i) => {
    s.addText(g[0], { x: 3.72, y: 1.72 + i * 0.8, w: 3.8, h: 0.28, fontSize: 11, bold: true, color: C.white, fontFace: "Calibri", margin: 0 });
    s.addText(g[1], { x: 3.72, y: 2.0 + i * 0.8, w: 3.8, h: 0.5, fontSize: 10, color: C.textLight, fontFace: "Calibri", margin: 0 });
  });
  // Unknown
  card(s, 7.85, 0.88, 1.9, 4.5, "1A2A1A");
  s.addText("UNKNOWN ONSET", { x: 7.92, y: 0.94, w: 1.76, h: 0.38, fontSize: 11, bold: true, color: C.green, fontFace: "Calibri", align: "center", margin: 0 });
  accentLine(s, 7.95, 1.35, 1.7);
  s.addText("Seizure onset cannot be determined from available information.", {
    x: 7.92, y: 1.45, w: 1.76, h: 1.0, fontSize: 10, color: C.textLight, fontFace: "Calibri", margin: 0
  });
  s.addText("UNCLASSIFIED", { x: 7.92, y: 2.7, w: 1.76, h: 0.32, fontSize: 10, bold: true, color: C.green, fontFace: "Calibri", align: "center", margin: 0 });
  s.addText("Insufficient information or unusual presentation.", { x: 7.92, y: 3.1, w: 1.76, h: 0.8, fontSize: 10, color: C.textLight, fontFace: "Calibri", margin: 0 });
  s.addText("Source: ILAE 2017 Operational Classification", { x: 0.35, y: 5.25, w: 9.3, h: 0.28, fontSize: 9, color: "607080", fontFace: "Calibri", margin: 0 });
}

// ═══════════════════════════════════════════════════════
// SLIDE 7 — PATHOPHYSIOLOGY
// ═══════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);
  sectionBar(s, "05 | Pathophysiology");
  card(s, 0.25, 0.88, 9.5, 1.05, "0D2136");
  s.addText("Core Mechanism:", { x: 0.42, y: 0.94, w: 2.2, h: 0.38, fontSize: 13, bold: true, color: C.accentTeal, fontFace: "Calibri", margin: 0 });
  s.addText("Sudden imbalance between excitation (glutamate ↑) and inhibition (GABA ↓) in cortical neuronal networks → Excessive, abnormal, synchronous discharge", {
    x: 2.65, y: 0.94, w: 7.0, h: 0.9, fontSize: 12, color: C.white, fontFace: "Calibri", margin: 0
  });
  const pathCards = [
    { title: "PDS — Paroxysmal Depolarization Shift", color: "152A40", text: "Large sustained neuronal depolarization with burst of action potentials, followed by hyperpolarization. In normal tissue, inhibitory surround contains the discharge. When inhibition fails → seizure spreads." },
    { title: "Ion Channel Dysfunction", color: "152A40", text: "Persistent Na+ currents (SCN1A mutation = Dravet), T-type Ca²+ channels (absence seizures via thalamocortical loops), voltage-gated K+ channel dysfunction (KCNQ2/3 = benign neonatal epilepsy)." },
    { title: "Hippocampal Sclerosis", color: "152A40", text: "Neuronal loss in CA1 sector (Sommer sector) + gliosis. Most common substrate in temporal lobe epilepsy. Detected by MRI. Surgical resection achieves 70% seizure freedom." },
    { title: "Consequences of Chronic Seizures", color: "1A1A0A", text: "Accelerated cortical thinning (neurodegeneration), hippocampal atrophy, memory/cognitive impairment, SUDEP risk (Sudden Unexpected Death in Epilepsy)." },
  ];
  pathCards.forEach((pc, i) => {
    const col = i < 2 ? 0 : 1;
    const row = i < 2 ? i : i - 2;
    const x = 0.25 + col * 4.88;
    const y = 2.1 + row * 1.62;
    card(s, x, y, 4.65, 1.48, pc.color);
    s.addText(pc.title, { x: x + 0.15, y: y + 0.1, w: 4.35, h: 0.32, fontSize: 12, bold: true, color: C.accentGold, fontFace: "Calibri", margin: 0 });
    s.addText(pc.text, { x: x + 0.15, y: y + 0.45, w: 4.35, h: 0.92, fontSize: 10.5, color: C.textLight, fontFace: "Calibri", margin: 0 });
  });
}

// ═══════════════════════════════════════════════════════
// SLIDE 8 — CLINICAL PRESENTATION
// ═══════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);
  sectionBar(s, "06 | Clinical Presentation");
  // Left: Phases
  card(s, 0.25, 0.88, 4.7, 4.55, "0D2136");
  s.addText("Tonic-Clonic Seizure Phases", { x: 0.38, y: 0.95, w: 4.44, h: 0.35, fontSize: 13, bold: true, color: C.accentTeal, fontFace: "Calibri", margin: 0 });
  accentLine(s, 0.38, 1.33, 4.44);
  const phases = [
    { phase: "PRODROME", desc: "Hours before: irritability, apathy, or ecstasy (not the aura itself)", col: "7A9CC0" },
    { phase: "AURA", desc: "Initial focal seizure; olfactory (mesial temporal), visual (occipital), déjà vu (temporal), fear/formed hallucinations (amygdalo-hippocampal)", col: C.accentGold },
    { phase: "TONIC PHASE", desc: "Sudden cry, loss of consciousness, tonic extension of limbs (~10-30 sec)", col: C.red },
    { phase: "CLONIC PHASE", desc: "Rhythmic jerking, tongue biting, incontinence (~1-2 min)", col: C.orange },
    { phase: "POSTICTAL", desc: "Confusion, headache, fatigue, Todd's paresis (transient focal weakness)", col: C.green },
  ];
  phases.forEach((p, i) => {
    s.addText(p.phase, { x: 0.38, y: 1.42 + i * 0.76, w: 1.5, h: 0.28, fontSize: 10, bold: true, color: p.col, fontFace: "Calibri", margin: 0 });
    s.addText(p.desc, { x: 0.38, y: 1.7 + i * 0.76, w: 4.44, h: 0.42, fontSize: 10, color: C.textLight, fontFace: "Calibri", margin: 0 });
  });
  // Right: Aura localization table
  card(s, 5.2, 0.88, 4.55, 4.55, "0D2136");
  s.addText("Aura → Seizure Focus Localization", { x: 5.32, y: 0.95, w: 4.3, h: 0.35, fontSize: 13, bold: true, color: C.accentGold, fontFace: "Calibri", margin: 0 });
  accentLine(s, 5.32, 1.33, 4.3);
  const auras = [
    ["Somatosensory", "Contralateral post-rolandic"],
    ["Visual (unformed)", "Occipital cortex"],
    ["Olfactory", "Mesial temporal"],
    ["Gustatory", "Insula"],
    ["Auditory", "Heschl gyri"],
    ["Déjà vu / dreamy state", "Temporal lobe"],
    ["Fear / formed hallucination", "Amygdalo-hippocampal"],
    ["Vertigo", "Superior temporal"],
    ["Automatisms", "Temporal / frontal"],
  ];
  auras.forEach((a, i) => {
    const bg = i % 2 === 0 ? "112030" : "0D1A28";
    s.addShape(pres.shapes.RECTANGLE, { x: 5.32, y: 1.42 + i * 0.36, w: 4.3, h: 0.36, fill: { color: bg }, line: { color: bg } });
    s.addText(a[0], { x: 5.38, y: 1.46 + i * 0.36, w: 2.1, h: 0.28, fontSize: 10, color: C.textLight, fontFace: "Calibri", margin: 0 });
    s.addText(a[1], { x: 7.5, y: 1.46 + i * 0.36, w: 2.08, h: 0.28, fontSize: 10, color: C.accentTeal, fontFace: "Calibri", margin: 0 });
  });
}

// ═══════════════════════════════════════════════════════
// SLIDE 9 — INVESTIGATIONS
// ═══════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);
  sectionBar(s, "07 | Investigations");
  const invCols = [
    {
      title: "EEG (Most Important)",
      color: "0D2545",
      accentC: C.accentTeal,
      items: [
        "Interictal EEG: epileptiform discharges (spikes, sharp waves)",
        "3 Hz spike-wave → Childhood Absence Epilepsy",
        "Hypsarrhythmia → West Syndrome (Infantile Spasms)",
        "Centrotemporal spikes → BECTS",
        "Video-EEG: gold standard for presurgical evaluation",
        "Continuous EEG: after paralytics in ICU for non-convulsive status",
      ]
    },
    {
      title: "Neuroimaging",
      color: "0D2545",
      accentC: C.accentGold,
      items: [
        "MRI brain (epilepsy protocol) — preferred",
        "Detects hippocampal sclerosis, cortical dysplasia, tumors",
        "Sequences: T1 volumetric, FLAIR, T2, DWI, gadolinium",
        "CT brain: acute hemorrhage, trauma, MRI unavailable",
      ]
    },
    {
      title: "Blood Tests",
      color: "0D2545",
      accentC: C.green,
      items: [
        "Glucose, electrolytes (Na⁺, Ca²⁺, Mg²⁺), BUN, creatinine",
        "LFTs, TFTs, FBC",
        "Toxicology screen (alcohol, drugs, bupropion, tramadol)",
        "ASM drug levels if on treatment",
        "Pregnancy test in women of childbearing age",
      ]
    },
    {
      title: "Other Investigations",
      color: "0D2545",
      accentC: C.red,
      items: [
        "LP: if CNS infection suspected (NOT during active seizure)",
        "Autoimmune panel: anti-NMDAR, anti-LGI1, anti-CASPR2",
        "Genetic testing: whole exome for suspected genetic epilepsy",
        "Neuropsychological testing: cognitive/memory lateralization",
        "PET, SPECT, intracranial EEG for presurgical planning",
      ]
    },
  ];
  invCols.forEach((col, i) => {
    const x = 0.18 + i * 2.46;
    card(s, x, 0.88, 2.28, 4.55, col.color);
    s.addText(col.title, { x: x + 0.1, y: 0.94, w: 2.08, h: 0.38, fontSize: 11, bold: true, color: col.accentC, fontFace: "Calibri", align: "center", margin: 0 });
    accentLine(s, x + 0.1, 1.34, 2.08);
    col.items.forEach((item, j) => {
      s.addText([{ text: "• ", options: { color: col.accentC } }, { text: item, options: { color: C.textLight } }], {
        x: x + 0.12, y: 1.42 + j * 0.58, w: 2.06, h: 0.54, fontSize: 10, fontFace: "Calibri", margin: 0
      });
    });
  });
}

// ═══════════════════════════════════════════════════════
// SLIDE 10 — STATUS EPILEPTICUS MANAGEMENT
// ═══════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);
  sectionBar(s, "08 | Status Epilepticus — Emergency Management");
  const steps = [
    { time: "0-5 min", title: "STABILIZE", color: "1A2E4A", textC: C.accentTeal, items: ["ABCs: Airway, Breathing, Circulation", "O₂, cardiac monitor, pulse oximetry, capnography", "Large-bore IV access + bedside glucose", "IV Normal Saline (NOT glucose — incompatible with phenytoin)", "Labs: BMP, Ca²⁺, Mg²⁺, lactate, toxicology, drug levels", "Treat hypoglycemia; monitor temperature"] },
    { time: "5-20 min", title: "BENZODIAZEPINES (1st Line)", color: "1A2E1A", textC: C.green, items: ["IV Lorazepam 2-4 mg (preferred; duration 12-24 h)", "IM Midazolam 10 mg (if no IV access; non-inferior)", "IV Diazepam 5-10 mg (faster onset; shorter duration)", "Goal: terminate seizure activity immediately"] },
    { time: "20-40 min", title: "2nd LINE AEDs", color: "2E2A10", textC: C.accentGold, items: ["Fosphenytoin IV 20 mg/kg (preferred over phenytoin)", "Valproate IV 20-40 mg/kg", "Levetiracetam IV 60 mg/kg (up to 4.5 g)", "Lacosamide IV 200-400 mg"] },
    { time: ">40-60 min", title: "REFRACTORY — ICU", color: "2E1010", textC: C.red, items: ["Intubation + general anesthesia", "Propofol IV infusion OR Midazolam infusion OR Pentobarbital", "Continuous EEG monitoring (mandatory post-paralytics)", "Do NOT perform LP during active status epilepticus", "CT/MRI once seizures controlled"] },
  ];
  steps.forEach((st, i) => {
    const x = 0.18 + i * 2.45;
    card(s, x, 0.88, 2.28, 4.55, st.color);
    s.addShape(pres.shapes.RECTANGLE, { x: x + 0.1, y: 0.94, w: 2.08, h: 0.25, fill: { color: st.textC }, line: { color: st.textC } });
    s.addText(st.time, { x: x + 0.1, y: 0.94, w: 2.08, h: 0.25, fontSize: 10, bold: true, color: C.darkBlue, fontFace: "Calibri", align: "center", margin: 0 });
    s.addText(st.title, { x: x + 0.1, y: 1.23, w: 2.08, h: 0.36, fontSize: 11, bold: true, color: st.textC, fontFace: "Calibri", align: "center", margin: 0 });
    accentLine(s, x + 0.1, 1.61, 2.08);
    st.items.forEach((item, j) => {
      s.addText([{ text: "► ", options: { color: st.textC } }, { text: item, options: { color: C.textLight } }], {
        x: x + 0.12, y: 1.7 + j * 0.5, w: 2.06, h: 0.47, fontSize: 10, fontFace: "Calibri", margin: 0
      });
    });
  });
}

// ═══════════════════════════════════════════════════════
// SLIDE 11 — ANTISEIZURE MEDICATIONS TABLE
// ═══════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);
  sectionBar(s, "09 | Antiseizure Medications (ASMs)");
  // Table header
  const headers = ["Drug (Generic)", "Trade Name", "Adult Dose", "Half-Life", "Target Level", "Main Use"];
  const widths = [1.9, 1.2, 1.55, 0.9, 1.0, 3.12];
  let xOff = 0.18;
  headers.forEach((h, i) => {
    s.addShape(pres.shapes.RECTANGLE, { x: xOff, y: 0.88, w: widths[i], h: 0.38, fill: { color: C.accentTeal }, line: { color: C.accentTeal } });
    s.addText(h, { x: xOff + 0.05, y: 0.9, w: widths[i] - 0.1, h: 0.34, fontSize: 10, bold: true, color: C.darkBlue, fontFace: "Calibri", margin: 0 });
    xOff += widths[i];
  });
  const rows = [
    ["Valproic Acid", "Depakote", "1,000-3,000 mg/d", "6-15 h", "50-100 µg/mL", "GTC, Absence, Myoclonic — broad spectrum"],
    ["Phenytoin", "Dilantin", "300-400 mg/d", "12-36 h", "10-20 µg/mL", "Focal, GTC"],
    ["Carbamazepine", "Tegretol", "600-1,200 mg/d", "14-25 h", "4-12 µg/mL", "Focal seizures"],
    ["Oxcarbazepine", "Trileptal", "900-2,400 mg/d", "1-5 h", "—", "Focal seizures"],
    ["Lamotrigine", "Lamictal", "300-500 mg/d", "15-60 h", "2-7 µg/mL", "Focal, Absence, GTC — broad spectrum"],
    ["Levetiracetam", "Keppra", "500-3,000 mg/d", "6-8 h", "—", "Focal, GTC — broad spectrum"],
    ["Ethosuximide", "Zarontin", "750-1,500 mg/d", "20-60 h", "50-100 µg/mL", "Absence seizures ONLY"],
    ["Lacosamide", "Vimpat", "300-400 mg/d", "13 h", "—", "Focal seizures"],
    ["Topiramate", "Topamax", "400 mg/d", "20-30 h", "—", "Focal, GTC"],
    ["Phenobarbital", "Luminal", "90-200 mg/d", "40-120 h", "15-40 µg/mL", "GTC, Focal (older agent)"],
  ];
  rows.forEach((row, ri) => {
    const bg = ri % 2 === 0 ? "0D1E30" : "0A1628";
    xOff = 0.18;
    row.forEach((cell, ci) => {
      s.addShape(pres.shapes.RECTANGLE, { x: xOff, y: 1.28 + ri * 0.4, w: widths[ci], h: 0.4, fill: { color: bg }, line: { color: bg } });
      const textColor = ci === 0 ? C.white : ci === 5 ? C.accentTeal : C.textLight;
      s.addText(cell, { x: xOff + 0.05, y: 1.31 + ri * 0.4, w: widths[ci] - 0.1, h: 0.34, fontSize: 9.5, color: textColor, fontFace: "Calibri", margin: 0 });
      xOff += widths[ci];
    });
  });
  s.addText("⚠  Never use carbamazepine/oxcarbazepine for absence/myoclonic seizures — may worsen them.", {
    x: 0.18, y: 5.27, w: 9.6, h: 0.28, fontSize: 10, color: C.red, fontFace: "Calibri", bold: true, margin: 0
  });
}

// ═══════════════════════════════════════════════════════
// SLIDE 12 — MECHANISMS OF ACTION
// ═══════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);
  sectionBar(s, "09b | Mechanisms of Action of ASMs");
  const mechs = [
    { title: "Na⁺ Channel Blockade", color: "0D2545", drugs: "Phenytoin, Carbamazepine,\nOxcarbazepine, Lamotrigine,\nLacosamide", text: "Reduces sustained high-frequency neuronal firing by blocking voltage-gated sodium channels in their inactivated state. Effective for focal and tonic-clonic seizures." },
    { title: "GABA Enhancement", color: "1A2E1A", drugs: "Benzodiazepines, Barbiturates,\nValproate, Vigabatrin,\nClobazam", text: "Potentiates GABAergic inhibition. BZDs and barbiturates act on GABA-A receptor. Valproate increases GABA synthesis/reduces catabolism. Vigabatrin irreversibly inhibits GABA-T." },
    { title: "T-type Ca²⁺ Channel Block", color: "2E2A10", drugs: "Ethosuximide, Valproate", text: "Specifically targets thalamocortical circuits underlying absence seizures. T-type calcium channels generate rhythmic 3 Hz spike-wave activity; their blockade abolishes absence seizures." },
    { title: "SV2A Modulation", color: "2E1010", drugs: "Levetiracetam, Brivaracetam", text: "Binds synaptic vesicle protein 2A — unique mechanism not shared by other ASMs. Reduces neurotransmitter release from presynaptic terminals." },
    { title: "AMPA Receptor Antagonism", color: "1A1A30", drugs: "Perampanel", text: "Non-competitive AMPA glutamate receptor antagonist. Reduces glutamate-mediated excitation. Approved for focal and generalized tonic-clonic seizures." },
    { title: "HCN Channel Modulation", color: "1A2040", drugs: "Lamotrigine, Gabapentin,\nPregabalin", text: "Gabapentin/pregabalin bind α2δ subunit of voltage-gated Ca²+ channels, reducing excitatory neurotransmitter release." },
  ];
  mechs.forEach((m, i) => {
    const col = i % 3;
    const row = Math.floor(i / 3);
    const x = 0.18 + col * 3.27;
    const y = 0.9 + row * 2.24;
    card(s, x, y, 3.1, 2.1, m.color);
    s.addText(m.title, { x: x + 0.12, y: y + 0.1, w: 2.86, h: 0.32, fontSize: 11.5, bold: true, color: C.accentTeal, fontFace: "Calibri", margin: 0 });
    s.addText(m.drugs, { x: x + 0.12, y: y + 0.44, w: 2.86, h: 0.48, fontSize: 9.5, color: C.accentGold, fontFace: "Calibri", italic: true, margin: 0 });
    s.addText(m.text, { x: x + 0.12, y: y + 0.96, w: 2.86, h: 1.0, fontSize: 10, color: C.textLight, fontFace: "Calibri", margin: 0 });
  });
}

// ═══════════════════════════════════════════════════════
// SLIDE 13 — NON-PHARMACOLOGICAL TREATMENT
// ═══════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);
  sectionBar(s, "10 | Non-Pharmacological Treatment");
  const nonPharm = [
    {
      title: "Epilepsy Surgery",
      icon: "🔬",
      color: "0D2545",
      textC: C.accentTeal,
      items: [
        "For pharmacoresistant epilepsy (failed ≥2 ASMs)",
        "Temporal lobectomy: 70% seizure-free",
        "Extratemporal resection: lower success",
        "Lesionectomy: curative for structural lesions",
        "Presurgical: Video-EEG, MRI, neuropsychology, PET, SPECT",
      ]
    },
    {
      title: "Neuromodulation",
      icon: "⚡",
      color: "1A2E1A",
      textC: C.green,
      items: [
        "VNS (Vagus Nerve Stimulator): open-loop; refractory focal seizures + LGS",
        "RNS (Responsive Neurostimulator): closed-loop intracranial device",
        "DBS (Deep Brain Stimulation): bilateral anterior thalamic nuclei",
        "All three devices approved for drug-refractory epilepsy",
      ]
    },
    {
      title: "Ketogenic Diet",
      icon: "🥑",
      color: "2E2A10",
      textC: C.accentGold,
      items: [
        "High fat, low carbohydrate, controlled protein",
        "First-line for GLUT1 deficiency syndrome",
        "Especially effective: myoclonic epilepsies, infantile spasms,",
        "Dravet syndrome, tuberous sclerosis, LGS",
        "Benefits both children and adults (Chen et al., 2023)",
      ]
    },
    {
      title: "Immunotherapy",
      icon: "💉",
      color: "2E1010",
      textC: C.red,
      items: [
        "For autoimmune/paraneoplastic epilepsy",
        "1st line: Corticosteroids, IVIG, Plasmapheresis",
        "2nd line: Rituximab, Mycophenolate, Azathioprine",
        "ACTH or Vigabatrin for West syndrome",
      ]
    },
  ];
  nonPharm.forEach((np, i) => {
    const x = 0.18 + i * 2.45;
    card(s, x, 0.88, 2.28, 4.55, np.color);
    s.addText(np.icon + " " + np.title, { x: x + 0.1, y: 0.94, w: 2.08, h: 0.38, fontSize: 11, bold: true, color: np.textC, fontFace: "Calibri", align: "center", margin: 0 });
    accentLine(s, x + 0.1, 1.34, 2.08);
    np.items.forEach((item, j) => {
      s.addText([{ text: "• ", options: { color: np.textC } }, { text: item, options: { color: C.textLight } }], {
        x: x + 0.12, y: 1.42 + j * 0.62, w: 2.06, h: 0.58, fontSize: 10, fontFace: "Calibri", margin: 0
      });
    });
  });
}

// ═══════════════════════════════════════════════════════
// SLIDE 14 — PREVENTION
// ═══════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);
  sectionBar(s, "11 | Prevention");
  const prevLevels = [
    {
      level: "PRIMARY PREVENTION",
      subtitle: "Avoiding the first seizure",
      color: "0D2545",
      textC: C.accentTeal,
      items: [
        "Prevent/treat CNS infections promptly",
        "Prevention of head trauma (helmets, seat belts)",
        "Good prenatal care (prevent birth injuries, HIE)",
        "Control cardiovascular risk factors → prevent stroke",
        "Avoid precipitants: sleep deprivation, alcohol excess",
        "Lead/heavy metal poisoning prevention (children)",
      ]
    },
    {
      level: "SECONDARY PREVENTION",
      subtitle: "Preventing seizure recurrence",
      color: "1A2E1A",
      textC: C.green,
      items: [
        "After 2 unprovoked seizures: ASM strongly recommended",
        "After 1 seizure + high recurrence risk: start ASM",
        "(structural lesion, epileptiform EEG, prior brain injury)",
        "AAN 2015 guideline (reaffirmed Feb 2024)",
        "Febrile seizures: prophylactic ASMs NOT routinely recommended",
        "Medication adherence: most important factor for seizure control",
      ]
    },
    {
      level: "TERTIARY PREVENTION",
      subtitle: "Reducing the impact of chronic epilepsy",
      color: "2E2A10",
      textC: C.accentGold,
      items: [
        "Regular follow-up, medication optimization",
        "SUDEP awareness: nocturnal supervision, detection devices",
        "Driving restriction counseling (seizure-free period required)",
        "Rescue benzodiazepines: intranasal midazolam, diastat",
        "Mental health support (anxiety/depression 2-3x higher)",
        "Seizure action plans for patients and caregivers",
      ]
    },
  ];
  prevLevels.forEach((pl, i) => {
    const x = 0.2 + i * 3.27;
    card(s, x, 0.88, 3.1, 4.55, pl.color);
    s.addText(pl.level, { x: x + 0.1, y: 0.94, w: 2.9, h: 0.35, fontSize: 12, bold: true, color: pl.textC, fontFace: "Calibri", align: "center", margin: 0 });
    s.addText(pl.subtitle, { x: x + 0.1, y: 1.3, w: 2.9, h: 0.28, fontSize: 10, color: "7A9CC0", fontFace: "Calibri", italic: true, align: "center", margin: 0 });
    accentLine(s, x + 0.1, 1.6, 2.9);
    pl.items.forEach((item, j) => {
      s.addText([{ text: "• ", options: { color: pl.textC } }, { text: item, options: { color: C.textLight } }], {
        x: x + 0.12, y: 1.68 + j * 0.52, w: 2.88, h: 0.48, fontSize: 10, fontFace: "Calibri", margin: 0
      });
    });
  });
}

// ═══════════════════════════════════════════════════════
// SLIDE 15 — SPECIAL POPULATIONS & PROGNOSIS
// ═══════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);
  sectionBar(s, "11b | Special Populations & Prognosis");
  // Special populations
  const pops = [
    { title: "Pregnancy", color: "1A2545", textC: C.accentTeal, items: ["Continue ASMs — uncontrolled seizures risk fetal hypoxia", "Valproate: highest teratogenicity — avoid if alternatives exist", "Lamotrigine / Levetiracetam: relatively safer", "Folic acid supplementation mandatory pre-conception"] },
    { title: "Elderly", color: "1A2545", textC: C.accentGold, items: ["Most common new-onset cause: cerebrovascular disease", "Drug interactions + polypharmacy hazards increased", "Enzyme-inducing ASMs accelerate bone metabolism", "Start low, go slow — increased drug sensitivity"] },
    { title: "Children", color: "1A2545", textC: C.green, items: ["Wide variety of age-specific syndromes", "West, Dravet, LGS, CAE, BECTS", "Many benign childhood epilepsies remit spontaneously", "ACTH/Vigabatrin first-line for infantile spasms"] },
  ];
  pops.forEach((p, i) => {
    const x = 0.2 + i * 3.27;
    card(s, x, 0.9, 3.1, 2.6, p.color);
    s.addText(p.title, { x: x + 0.12, y: 0.96, w: 2.86, h: 0.32, fontSize: 13, bold: true, color: p.textC, fontFace: "Calibri", align: "center", margin: 0 });
    accentLine(s, x + 0.12, 1.3, 2.86);
    p.items.forEach((item, j) => {
      s.addText([{ text: "• ", options: { color: p.textC } }, { text: item, options: { color: C.textLight } }], {
        x: x + 0.15, y: 1.38 + j * 0.5, w: 2.8, h: 0.46, fontSize: 10, fontFace: "Calibri", margin: 0
      });
    });
  });
  // Prognosis
  card(s, 0.2, 3.68, 9.6, 1.72, "0D1E30");
  s.addText("Prognosis", { x: 0.35, y: 3.74, w: 2.5, h: 0.34, fontSize: 14, bold: true, color: C.accentTeal, fontFace: "Calibri", margin: 0 });
  accentLine(s, 0.35, 4.1, 9.3);
  const progItems = [
    "~70% of patients achieve seizure freedom with appropriate treatment",
    "~30% develop pharmacoresistance",
    "After 2 failed ASM trials: only ~5-10% respond to further medications",
    "Temporal lobectomy: 50-70% achieve long-term seizure freedom",
    "SUDEP risk: ~1/1,000 person-years in general epilepsy; up to 1/150 in severe drug-resistant epilepsy",
  ];
  progItems.forEach((item, i) => {
    const x = i < 3 ? 0.35 : 5.2;
    const y = i < 3 ? 4.18 + i * 0.38 : 4.18 + (i - 3) * 0.38;
    s.addText([{ text: "✓  ", options: { color: C.green } }, { text: item, options: { color: C.textLight } }], {
      x, y, w: 4.6, h: 0.35, fontSize: 10.5, fontFace: "Calibri", margin: 0
    });
  });
}

// ═══════════════════════════════════════════════════════
// SLIDE 16 — REFERENCES
// ═══════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);
  sectionBar(s, "12 | References");
  const refs = [
    "1.  Adams and Victor's Principles of Neurology, 12th Ed. — Chapter 15: Epilepsy and Other Seizure Disorders",
    "2.  Bradley and Daroff's Neurology in Clinical Practice — Chapter 100: Seizures and Epilepsy Definitions",
    "3.  Katzung's Basic and Clinical Pharmacology, 16th Ed. — Chapter 24: Antiseizure Medications",
    "4.  Tintinalli's Emergency Medicine: A Comprehensive Study, 9th Ed. — Chapter 171: Treatment of Status Epilepticus",
    "5.  Eric Kandel's Principles of Neural Science, 6th Ed. — Seizure Focus and Surgical Treatment",
    "6.  Harriet Lane Handbook, 23rd Ed. — Status Epilepticus Treatment Guidelines",
    "7.  Fisher RS et al. ILAE Official Report: A practical clinical definition of epilepsy. Epilepsia 2014; 55(4):475-482",
    "8.  Scheffer IE et al. ILAE classification of the epilepsies. Epilepsia 2017; 58(4):512-521",
    "9.  WHO Epilepsy Fact Sheet, February 2024",
    "10. AAN/AES Practice Guideline: Management of an Unprovoked First Seizure in Adults. Neurology 2015; 84(16):1705. Reaffirmed Feb 2024",
    "11. Pressler RM et al. Treatment of seizures in the neonate: ILAE Task Force. Epilepsia 2023 Oct [PMID: 37655702]",
    "12. Chu H et al. Antiseizure medications for idiopathic generalized epilepsies. J Neurol 2023 [PMID: 37378757]",
    "13. Chen S et al. Ketogenic Diet and Multiple Health Outcomes: Umbrella Review. Nutrients 2023 [PMID: 37836444]",
    "14. NAEC 2023 Guidelines for Specialized Epilepsy Centers. Neurology 2024 Feb",
    "15. Hauser WA, Annegers JF. Epidemiology of epilepsy. Textbook of Epilepsy, 1992",
  ];
  refs.forEach((r, i) => {
    const col = i < 8 ? 0 : 1;
    const row = i < 8 ? i : i - 8;
    const x = col === 0 ? 0.3 : 5.15;
    const y = 0.96 + row * 0.56;
    s.addText(r, { x, y, w: 4.65, h: 0.5, fontSize: 9.5, color: C.textLight, fontFace: "Calibri", margin: 0 });
  });
}

// ═══════════════════════════════════════════════════════
// SLIDE 17 — CLOSING
// ═══════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  darkSlide(s);
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 0.12, fill: { color: C.accentTeal }, line: { color: C.accentTeal } });
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 5.505, w: 10, h: 0.12, fill: { color: C.accentTeal }, line: { color: C.accentTeal } });
  s.addText("KEY TAKEAWAYS", { x: 1, y: 0.4, w: 8, h: 0.5, fontSize: 20, bold: true, color: C.accentTeal, fontFace: "Calibri", align: "center", margin: 0 });
  accentLine(s, 2, 0.95, 6);
  const takeaways = [
    ["50 million people", "worldwide have epilepsy; 80% in low/middle-income countries"],
    ["ILAE 2014 definition", "requires ≥2 unprovoked seizures or 1 seizure with ≥60% recurrence risk"],
    ["Core mechanism", "is glutamate excess + GABA deficit → excessive synchronized neuronal discharge"],
    ["EEG + MRI", "are the cornerstone investigations for all seizure presentations"],
    ["Monotherapy first", "achieves seizure control in ~2/3 of patients; pharmacoresistance in ~30%"],
    ["Status epilepticus", "lorazepam → fosphenytoin/levetiracetam → anesthesia within 30 minutes"],
    ["Surgery, VNS, RNS/DBS", "and ketogenic diet are options for drug-refractory epilepsy"],
    ["Prevention", "addresses primary (avoid first seizure), secondary (prevent recurrence), tertiary (reduce impact)"],
  ];
  takeaways.forEach((t, i) => {
    const bg = i % 2 === 0 ? "0D1E30" : "0A1628";
    s.addShape(pres.shapes.RECTANGLE, { x: 0.4, y: 1.08 + i * 0.54, w: 9.2, h: 0.52, fill: { color: bg }, line: { color: bg } });
    s.addText(t[0] + ": ", { x: 0.52, y: 1.12 + i * 0.54, w: 2.2, h: 0.4, fontSize: 11, bold: true, color: C.accentGold, fontFace: "Calibri", margin: 0 });
    s.addText(t[1], { x: 2.72, y: 1.12 + i * 0.54, w: 6.76, h: 0.4, fontSize: 11, color: C.textLight, fontFace: "Calibri", margin: 0 });
  });
}

// ─── WRITE FILE ─────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/epilepsy-ppt/Epilepsy_and_Seizures.pptx" })
  .then(() => console.log("SUCCESS: /home/daytona/workspace/epilepsy-ppt/Epilepsy_and_Seizures.pptx"))
  .catch(e => { console.error("ERROR:", e); process.exit(1); });
Running Command

cd /home/daytona/workspace/epilepsy-ppt && node epilepsy.js

The issue is pres.shapes.ELLIPSE - let me check valid shape names and fix:
Running Command

node -e "const p = require('pptxgenjs'); const pres = new p(); console.log(Object.keys(pres.shapes).filter(k => k.includes('RECT') || k.includes('ELLIP') || k.includes('OVAL') || k.includes('ROUND')));"

Editing File

~/epilepsy-ppt/epilepsy.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/epilepsy-ppt/epilepsy.js'
Running Command

cd /home/daytona/workspace/epilepsy-ppt && node epilepsy.js

The presentation is ready! Here is your download link:

Epilepsy and Seizures

Presentation · PPTX


What's inside - 17 slides with a dark professional medical theme:
SlideContent
1Title slide
2Contents / outline
3Definitions (Seizure, Epilepsy ILAE 2014, Status Epilepticus)
4Epidemiology (stat cards + full data table)
5Etiology (4 column cards: Structural / Genetic / Metabolic / Immune-Infectious)
6Classification of Seizures - ILAE 2017 (Focal / Generalized / Unknown)
7Pathophysiology (PDS, ion channels, hippocampal sclerosis, chronic consequences)
8Clinical Presentation (seizure phases + aura localization table)
9Investigations (EEG, MRI, blood tests, other workup)
10Status Epilepticus Emergency Protocol (4-step timeline)
11Antiseizure Medications full table (10 drugs with doses, half-life, target levels)
12Mechanisms of Action (6 drug classes)
13Non-Pharmacological Treatment (Surgery, VNS/RNS/DBS, Ketogenic Diet, Immunotherapy)
14Prevention (Primary / Secondary / Tertiary)
15Special Populations + Prognosis
1615 References (textbooks + ILAE + AAN + PubMed PMIDs)
17Key Takeaways closing slide
This is a shared conversation. Sign in to Orris to start your own chat.