Basics of neurology

Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Finding Sources
Reading File
Reading File
Reading File
Reading File
I now have excellent material from the two major neurology textbooks. Let me compile a comprehensive, well-structured overview of neurology basics.

Basics of Neurology

Sources: Bradley and Daroff's Neurology in Clinical Practice; Localization in Clinical Neurology, 8e; Adams and Victor's Principles of Neurology, 12th Edition

1. What Is Neurology?

Neurology is the branch of medicine that deals with disorders of the nervous system. What makes it unique among clinical disciplines is its dual emphasis on localization and phenomenology. When a patient presents with, say, a weak hand, the neurologist cannot assume the lesion is "in the hand" - it could be anywhere from the cerebral cortex down to the peripheral nerve or the muscle itself. The diagnostic goal is therefore twofold:
  1. Where is the lesion? (anatomical localization)
  2. What is causing it? (pathophysiological mechanism + differential diagnosis)
As Bradley and Daroff's notes: "What is unique to neurology is the emphasis on localization and phenomenology. When a patient presents to an internist or surgeon with abdominal or chest symptoms, the localization is practically established by the symptoms ... However, in clinical neurological practice, a patient with a weak hand may have a lesion localized" anywhere in the neuroaxis.

2. Organization of the Nervous System

The nervous system is divided into two major parts:

Central Nervous System (CNS)

  • Brain (cerebrum, brainstem, cerebellum)
  • Spinal cord

Peripheral Nervous System (PNS)

  • Cranial nerves (12 pairs)
  • Spinal nerves and roots
  • Autonomic nervous system (sympathetic + parasympathetic)
  • Neuromuscular junction
  • Muscle
This hierarchy is clinically essential - a "level of the lesion" must be assigned to one of these compartments before a sensible differential diagnosis can be formed.

3. The Neuron: The Fundamental Unit

The neuron is the basic structural and functional cell of the nervous system. Key features:
  • Cell body (soma): contains the nucleus and metabolic machinery
  • Dendrites: receive incoming signals from other neurons
  • Axon: transmits signals away from the cell body; can be myelinated (for fast conduction) or unmyelinated
  • Synapse: the junction between neurons where chemical (or electrical) signaling occurs

Membrane Polarity and Action Potentials

The neuron maintains a resting membrane potential (approximately -70 mV) through the sodium-potassium pump (Na⁺/K⁺-ATPase), which actively pumps Na⁺ out and K⁺ in. This requires constant energy expenditure.
  • Depolarization: when the membrane potential rises toward 0 mV (Na⁺ rushes in), an action potential is generated if threshold is crossed
  • Repolarization: K⁺ channels open, K⁺ flows out, restoring the resting potential
  • Refractory period: brief period during which the neuron cannot fire again, ensuring one-directional signal propagation
Epileptic seizures, for example, arise from inappropriate membrane depolarizations - complex interactions of excitatory/inhibitory synapses modulating the resting potential.

Synaptogenesis

Synapse formation follows dendritic development and membrane polarization. An excess of synapses forms initially, with subsequent elimination of those not reinforced by activity ("synaptic pruning"). This principle underlies learning, development, and neural plasticity.

4. Neurological Localization: The Core Skill

Localization is "the diagnostic exercise of determining from the signs (most often) or symptoms of the patient what site of the nervous system has been affected" (Localization in Clinical Neurology, 8e).

The Levels of the Nervous System

LevelKey Features When Damaged
Cerebral cortexHigher cognitive deficits, aphasia, apraxia, contralateral weakness/sensory loss
Internal capsuleDense contralateral hemiplegia (compact fiber tracts)
BrainstemIpsilateral cranial nerve palsy + contralateral limb weakness ("crossed" signs)
Spinal cordLevel below lesion: motor + sensory loss bilaterally
Nerve rootDermatomal sensory loss, myotomal weakness, reflex loss
Peripheral nerveDistal sensory loss, weakness in nerve territory
Neuromuscular junctionFatigable weakness (e.g., myasthenia gravis)
MuscleProximal > distal weakness, no sensory loss

The Corticospinal (Pyramidal) Tract

The corticospinal tract is the most clinically important motor pathway. Key anatomy:
  • Originates in the motor cortex (precentral gyrus)
  • Runs through the posterior limb of the internal capsule (somatotopic: hand fibers lateral, foot fibers medial)
  • Descends through the cerebral peduncle, pons (ventral), and medullary pyramid
  • At the pyramidal decussation (medulla-spinal cord junction), ~90% of fibers cross to become the lateral corticospinal tract
  • The remaining ~10% descend ipsilaterally as the anterior corticospinal tract, mostly crossing at lower spinal levels
  • Only ~2% remain truly ipsilateral (bundle of Barnes), controlling axial/trunk musculature
This is why a right hemisphere lesion causes left-sided weakness.

Upper vs. Lower Motor Neuron Signs

FeatureUMN (above the anterior horn)LMN (anterior horn or below)
ToneIncreased (spasticity)Decreased (flaccidity)
ReflexesHyperreflexiaHyporeflexia/areflexia
Plantar responseExtensor (Babinski sign)Flexor (normal)
WastingMild (disuse)Prominent
FasciculationsAbsentPresent

5. Principles of Occam's Razor in Neurology

Neurologists apply the principle of parsimony - striving to explain all findings with a single lesion. When this is impossible, multiple lesions or a systemic/diffuse disorder must be considered.
Example from Bradley and Daroff's: A patient with left-sided visual loss in both eyes AND left-sided weakness most likely has ONE right hemisphere lesion (stroke/tumor). But if the visual loss is monocular (left eye only) with upper motor neuron weakness of the left limbs - these cannot come from one lesion; they suggest TWO lesions (left optic nerve + right corticospinal tract below the medulla) - as seen in multiple sclerosis.

6. The Neurological Approach to Diagnosis

Step 1: The History

The history is the most powerful diagnostic tool. It should capture:
  • Chief complaint
  • History of the present illness (onset: sudden vs. gradual, progression, fluctuation)
  • Past medical/surgical history
  • Family history (hereditary neurological diseases)
  • Social history (toxin/drug exposures, occupation)
  • Systems review
Onset and progression are key clues to etiology:
  • Sudden onset → vascular (stroke)
  • Subacute + progressive → neoplasm, infection, demyelination
  • Chronic + progressive → degenerative disease
  • Episodic → migraine, epilepsy, transient ischemic attack

Step 2: The Neurological Examination

A structured examination covering:
  1. Mental status: orientation, memory, language, cognition
  2. Cranial nerves (CN I-XII): each tested individually
  3. Motor system: tone, bulk, power (graded 0-5 on MRC scale), coordination
  4. Sensory system: light touch, pain/temperature, vibration, proprioception
  5. Reflexes: deep tendon (biceps, triceps, supinator, knee, ankle), plantar
  6. Cerebellar function: finger-nose test, heel-shin test, gait
  7. Gait and stance: Romberg test, tandem walk

Step 3: Anatomical Localization

Synthesize the history and examination to identify the level and, if possible, the side of the lesion. This requires solid knowledge of neuroanatomy.

Step 4: Differential Diagnosis by Mechanism

Once the site is identified, systematically work through all pathophysiological mechanisms (Table 1.2, Bradley and Daroff's):
  • Inflammatory: infectious (bacterial, viral, fungal), autoimmune
  • Vascular: arterial (ischemia/hemorrhage), venous
  • Compressive/infiltrative: neoplastic, non-neoplastic (e.g., disc herniation)
  • Degenerative/hereditary
  • Toxic/metabolic/nutritional (e.g., Wernicke encephalopathy, heavy metals)
  • Mechanical: trauma, disorders of intracranial pressure

Step 5: Investigations

Investigations confirm the clinical hypothesis - they do not replace it. Ordered investigations include:
  • Neuroimaging: MRI (preferred), CT scan
  • Electrodiagnostics: EEG (seizures), nerve conduction studies + EMG (peripheral nerve/muscle)
  • CSF analysis (lumbar puncture): infections, demyelination, subarachnoid hemorrhage
  • Blood tests: metabolic panels, autoimmune antibodies, genetic testing
  • Neuropsychological testing: for cognitive disorders

7. Key Neurological Syndromes (Overview)

SyndromeLocalizationClassic Cause
Hemiplegia + hemisensory lossContralateral hemisphere or internal capsuleStroke
"Crossed" syndrome (ipsilateral CN palsy + contralateral hemiplegia)BrainstemStroke
Paraplegia + sensory levelSpinal cordTrauma, MS, tumor
Dermatomal pain + weaknessNerve rootDisc herniation
Stocking-glove sensory lossPeripheral neuropathyDiabetes, alcohol
Fatigable ptosis/diplopiaNeuromuscular junctionMyasthenia gravis
Proximal limb weakness, no sensory lossMyopathyInflammatory myopathy
Tremor, bradykinesia, rigidityBasal gangliaParkinson disease
Ataxia, dysmetria, nystagmusCerebellumCerebellar stroke/MS
AphasiaDominant hemisphereStroke (MCA territory)

8. Approach to Common Presentations

Weakness

  • Is it UMN or LMN?
  • Is it focal (one limb), hemiplegic (one side), paraplegic (both legs), or quadriplegic?
  • Sudden onset = stroke until proven otherwise

Sensory Disturbance

  • Dermatomal = nerve root
  • "Glove and stocking" = peripheral neuropathy
  • Hemisensory = contralateral thalamus/hemisphere
  • Sensory level = spinal cord

Altered Consciousness

  • Always consider toxic/metabolic causes first (hypoglycemia, drugs, sepsis)
  • Structural causes: herniation syndromes require urgent imaging
  • The ARAS (ascending reticular activating system) in the brainstem and thalamus maintains wakefulness

Headache

  • New, severe, sudden = "thunderclap" - subarachnoid hemorrhage until proven otherwise
  • Progressive + worse in morning = raised intracranial pressure
  • Episodic with aura = migraine

9. The Autonomic Nervous System

The autonomic nervous system (ANS) regulates involuntary functions: heart rate, blood pressure, digestion, bladder, and sweating.
  • Sympathetic ("fight or flight"): thoracolumbar origin (T1-L2); noradrenergic postganglionic fibers
  • Parasympathetic ("rest and digest"): craniosacral origin (CN III, VII, IX, X + S2-S4); cholinergic postganglionic fibers
Autonomic dysfunction can manifest as orthostatic hypotension, bowel/bladder dysfunction, anhidrosis, or pupillary abnormalities - important in many neurological diseases (e.g., Parkinson disease, multiple system atrophy).

Summary

The essence of neurology can be distilled into a simple framework:
History → Examination → Localization → Mechanism → Investigation → Diagnosis
Mastery of neuroanatomy is non-negotiable for localization. Understanding disease mechanisms allows systematic generation of differential diagnoses. Clinical examination findings - particularly the distinction between upper and lower motor neuron signs, cortical vs. subcortical, central vs. peripheral - narrow the diagnostic possibilities dramatically before any test is ordered.

References: Bradley and Daroff's Neurology in Clinical Practice, 7e | Localization in Clinical Neurology, 8e (Brazis et al.) | Adams and Victor's Principles of Neurology, 12th Edition

Make a presentation on this summary for study or teaching

Reading File
Reading File
Reading File
Running Command

ls -la /tmp/workspace/ 2>/dev/null || echo "workspace missing"

Running Command

mkdir -p /tmp/workspace/neurology-basics-pptx

Writing File

~/neurology-basics-pptx/build.py

from pptx import Presentation
from pptx.util import Inches, Pt, Emu
from pptx.dml.color import RGBColor
from pptx.enum.text import PP_ALIGN, MSO_ANCHOR
from pptx.enum.shapes import MSO_SHAPE_TYPE
from io import BytesIO

# ── Colour palette ────────────────────────────────────────────────────────────
NAVY      = RGBColor(0x0D, 0x2B, 0x55)   # deep navy  – primary bg
TEAL      = RGBColor(0x00, 0x7B, 0x8E)   # teal       – accent / heading bar
LIGHT_BG  = RGBColor(0xF4, 0xF8, 0xFF)   # very light blue-white – body bg
WHITE     = RGBColor(0xFF, 0xFF, 0xFF)
YELLOW    = RGBColor(0xFF, 0xD0, 0x00)   # highlight accent
DARK_TEXT = RGBColor(0x1A, 0x1A, 0x2E)   # near-black body text
MID_GREY  = RGBColor(0x55, 0x66, 0x77)   # sub-text
LIGHT_TEAL= RGBColor(0xCC, 0xED, 0xF2)   # table row alt
RED_ACCENT= RGBColor(0xC0, 0x39, 0x2B)
GREEN_ACC = RGBColor(0x27, 0xAE, 0x60)

W = Inches(13.333)
H = Inches(7.5)

prs = Presentation()
prs.slide_width  = W
prs.slide_height = H
blank = prs.slide_layouts[6]   # fully blank – we paint everything

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

def add_rect(slide, x, y, w, h, fill_color, alpha=None, line_color=None, line_width=0):
    from pptx.enum.shapes import MSO_SHAPE
    shp = slide.shapes.add_shape(MSO_SHAPE.RECTANGLE, x, y, w, h)
    shp.fill.solid()
    shp.fill.fore_color.rgb = fill_color
    shp.line.fill.background() if line_color is None else None
    if line_color:
        shp.line.color.rgb = line_color
        shp.line.width = Pt(line_width)
    else:
        shp.line.fill.background()
    shp.shadow.inherit = False
    return shp

def add_tb(slide, x, y, w, h, text, size, bold=False, color=WHITE,
           align=PP_ALIGN.LEFT, wrap=True, italic=False, font="Calibri"):
    tb = slide.shapes.add_textbox(x, y, w, h)
    tf = tb.text_frame
    tf.word_wrap = wrap
    tf.margin_left = tf.margin_right = tf.margin_top = tf.margin_bottom = 0
    p = tf.paragraphs[0]
    p.alignment = align
    run = p.add_run()
    run.text = text
    run.font.name = font
    run.font.size = Pt(size)
    run.font.bold = bold
    run.font.italic = italic
    run.font.color.rgb = color
    return tb

def add_multi_para(slide, x, y, w, h, items, size, color=DARK_TEXT,
                   bold_first=False, line_spacing=1.15, font="Calibri",
                   align=PP_ALIGN.LEFT):
    """items = list of (text, level, bold)"""
    tb = slide.shapes.add_textbox(x, y, w, h)
    tf = tb.text_frame
    tf.word_wrap = True
    tf.margin_left = Inches(0.05)
    tf.margin_right = 0
    tf.margin_top = 0
    tf.margin_bottom = 0
    from pptx.util import Pt as _Pt
    from pptx.oxml.ns import qn
    from lxml import etree
    first = True
    for text, level, bold in items:
        if first:
            p = tf.paragraphs[0]
            first = False
        else:
            p = tf.add_paragraph()
        p.alignment = align
        p.level = level
        # line spacing
        p.line_spacing = line_spacing
        run = p.add_run()
        run.text = text
        run.font.name = font
        run.font.size = _Pt(size)
        run.font.bold = bold
        run.font.color.rgb = color
    return tb

def slide_header(slide, title, subtitle=None):
    """Paints navy top bar + title text."""
    add_rect(slide, 0, 0, W, Inches(1.05), NAVY)
    add_rect(slide, 0, Inches(1.05), Inches(0.08), H - Inches(1.05), TEAL)  # left accent stripe
    add_tb(slide, Inches(0.25), Inches(0.15), Inches(12.5), Inches(0.75),
           title, 30, bold=True, color=WHITE, align=PP_ALIGN.LEFT)
    if subtitle:
        add_tb(slide, Inches(0.25), Inches(0.75), Inches(12.5), Inches(0.35),
               subtitle, 14, bold=False, color=LIGHT_TEAL, align=PP_ALIGN.LEFT)
    # light background for body
    add_rect(slide, Inches(0.08), Inches(1.05), W - Inches(0.08), H - Inches(1.05), LIGHT_BG)

def slide_footer(slide, page_num, total):
    add_tb(slide, Inches(11.8), Inches(7.2), Inches(1.4), Inches(0.25),
           f"{page_num} / {total}", 9, color=MID_GREY, align=PP_ALIGN.RIGHT)
    add_tb(slide, Inches(0.2), Inches(7.2), Inches(6), Inches(0.25),
           "Basics of Neurology  |  Orris Medical", 9, color=MID_GREY)

TOTAL = 18   # total slides

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 1 – Title slide
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
add_rect(s, 0, 0, W, H, NAVY)
# teal bottom stripe
add_rect(s, 0, Inches(6.2), W, Inches(1.3), TEAL)
# yellow accent bar
add_rect(s, Inches(1.5), Inches(2.9), Inches(0.08), Inches(1.7), YELLOW)

add_tb(s, Inches(1.7), Inches(2.0), Inches(10), Inches(0.9),
       "BASICS OF NEUROLOGY", 48, bold=True, color=WHITE)
add_tb(s, Inches(1.7), Inches(3.0), Inches(9), Inches(0.55),
       "Foundations for Study & Clinical Practice", 22, color=LIGHT_TEAL)
add_tb(s, Inches(1.7), Inches(3.65), Inches(9), Inches(0.4),
       "Based on Bradley & Daroff's Neurology in Clinical Practice | Localization in Clinical Neurology, 8e",
       12, italic=True, color=MID_GREY)
add_tb(s, Inches(1.7), Inches(6.3), Inches(10), Inches(0.5),
       "Orris Medical Education", 14, bold=True, color=WHITE)
slide_footer(s, 1, TOTAL)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 2 – What Is Neurology?
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
slide_header(s, "What Is Neurology?", "Definition & Unique Features")

points = [
    ("Branch of medicine dealing with disorders of the nervous system", 0, True),
    ("Unique dual emphasis: LOCALIZATION + PHENOMENOLOGY", 0, True),
    ("", 0, False),
    ("The Fundamental Question:", 0, True),
    ("Where is the lesion?  →  Anatomical localization", 1, False),
    ("What is causing it?  →  Pathophysiological mechanism + Differential diagnosis", 1, False),
    ("", 0, False),
    ("Unlike other specialties, symptoms alone do NOT establish localization:", 0, True),
    ("A weak hand could arise from: cerebral cortex, internal capsule, brainstem,", 1, False),
    ("  spinal cord, nerve root, peripheral nerve, NMJ, or muscle", 1, False),
    ("", 0, False),
    ('"Neurological diagnosis is sometimes easy, sometimes quite challenging"', 0, False),
    ("— Bradley and Daroff's Neurology in Clinical Practice", 1, False),
]
add_multi_para(s, Inches(0.4), Inches(1.15), Inches(12.6), Inches(6.0),
               points, 17, color=DARK_TEXT)
slide_footer(s, 2, TOTAL)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 3 – Organisation of the Nervous System
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
slide_header(s, "Organisation of the Nervous System", "CNS and PNS")

# Two column boxes
def box(slide, x, y, w, h, title, items, title_col, body_col, bg_col):
    add_rect(slide, x, y, w, Inches(0.45), title_col)
    add_tb(slide, x+Inches(0.1), y+Inches(0.04), w-Inches(0.2), Inches(0.38),
           title, 15, bold=True, color=WHITE)
    add_rect(slide, x, y+Inches(0.45), w, h-Inches(0.45), bg_col)
    txt_items = [(it, 0, False) for it in items]
    add_multi_para(slide, x+Inches(0.15), y+Inches(0.52), w-Inches(0.25), h-Inches(0.55),
                   txt_items, 15, color=DARK_TEXT)

CNS_items = [
    "Cerebral cortex",
    "Subcortical white matter",
    "Basal ganglia",
    "Thalamus & hypothalamus",
    "Brainstem (midbrain, pons, medulla)",
    "Cerebellum",
    "Spinal cord",
]
PNS_items = [
    "12 Cranial nerves",
    "Spinal nerve roots & plexuses",
    "Peripheral nerves",
    "Autonomic nervous system",
    "  - Sympathetic",
    "  - Parasympathetic",
    "Neuromuscular junction",
    "Muscle",
]
box(s, Inches(0.4), Inches(1.2), Inches(5.8), Inches(5.8),
    "Central Nervous System (CNS)", CNS_items, NAVY, DARK_TEXT, LIGHT_BG)
box(s, Inches(6.8), Inches(1.2), Inches(6.1), Inches(5.8),
    "Peripheral Nervous System (PNS)", PNS_items, TEAL, DARK_TEXT, LIGHT_BG)

add_tb(s, Inches(6.2), Inches(3.5), Inches(0.6), Inches(0.5),
       "→", 32, bold=True, color=TEAL)
add_tb(s, Inches(6.05), Inches(4.0), Inches(0.9), Inches(0.3),
       "Neuroaxis", 10, italic=True, color=MID_GREY, align=PP_ALIGN.CENTER)
slide_footer(s, 3, TOTAL)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 4 – The Neuron
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
slide_header(s, "The Neuron", "Fundamental Unit of the Nervous System")

parts = [
    ("Cell Body (Soma)", "Contains nucleus, organelles, metabolic machinery"),
    ("Dendrites", "Receive incoming synaptic signals from other neurons"),
    ("Axon", "Transmits signals away from soma; may be myelinated (fast) or unmyelinated"),
    ("Myelin Sheath", "Produced by oligodendrocytes (CNS) or Schwann cells (PNS); speeds conduction"),
    ("Synapse", "Junction between neurons; chemical (neurotransmitter) or electrical signalling"),
    ("Node of Ranvier", "Gaps in myelin; site of saltatory (jumping) conduction"),
]

y_start = Inches(1.2)
row_h   = Inches(0.88)
for i, (title, desc) in enumerate(parts):
    y = y_start + i * row_h
    col = NAVY if i % 2 == 0 else TEAL
    add_rect(s, Inches(0.3), y, Inches(3.2), row_h - Inches(0.05), col)
    add_tb(s, Inches(0.4), y + Inches(0.15), Inches(3.0), Inches(0.55),
           title, 14, bold=True, color=WHITE)
    add_rect(s, Inches(3.5), y, Inches(9.5), row_h - Inches(0.05), LIGHT_BG)
    add_tb(s, Inches(3.65), y + Inches(0.12), Inches(9.2), Inches(0.65),
           desc, 14, color=DARK_TEXT)

slide_footer(s, 4, TOTAL)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 5 – Action Potential
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
slide_header(s, "Membrane Polarity & Action Potential", "The Electrical Signal")

steps = [
    ("1", "Resting Membrane Potential (~-70 mV)", "Na⁺/K⁺-ATPase pumps 3 Na⁺ OUT, 2 K⁺ IN. Maintained by constant energy expenditure.", NAVY),
    ("2", "Depolarisation", "Stimulus opens voltage-gated Na⁺ channels. Na⁺ rushes IN → membrane potential rises toward +30 mV. Threshold must be crossed.", TEAL),
    ("3", "Action Potential", "All-or-nothing spike. Propagates along axon without decrement. Saltatory in myelinated fibres.", RGBColor(0x00, 0x5F, 0x73)),
    ("4", "Repolarisation", "K⁺ channels open → K⁺ flows OUT → membrane returns toward resting potential.", RGBColor(0x01, 0x94, 0x8A)),
    ("5", "Refractory Period", "Brief absolute (no firing) then relative refractory period. Ensures one-directional propagation.", RGBColor(0x0A, 0x99, 0x66)),
]

for i, (num, title, desc, col) in enumerate(steps):
    y = Inches(1.2) + i * Inches(1.1)
    # number circle
    circle = s.shapes.add_shape(1, Inches(0.3), y + Inches(0.15), Inches(0.7), Inches(0.7))
    circle.fill.solid()
    circle.fill.fore_color.rgb = col
    circle.line.fill.background()
    circle.shadow.inherit = False
    tf = circle.text_frame
    tf.margin_left = tf.margin_right = tf.margin_top = tf.margin_bottom = 0
    p2 = tf.paragraphs[0]
    p2.alignment = PP_ALIGN.CENTER
    r2 = p2.add_run()
    r2.text = num
    r2.font.size = Pt(18)
    r2.font.bold = True
    r2.font.color.rgb = WHITE
    # title + desc
    add_tb(s, Inches(1.15), y + Inches(0.05), Inches(4.5), Inches(0.4),
           title, 14, bold=True, color=col)
    add_tb(s, Inches(1.15), y + Inches(0.45), Inches(11.8), Inches(0.55),
           desc, 13, color=DARK_TEXT, wrap=True)

# Clinical note box
add_rect(s, Inches(6.5), Inches(1.25), Inches(6.5), Inches(2.0), RGBColor(0xFF, 0xF3, 0xCD))
add_tb(s, Inches(6.65), Inches(1.35), Inches(6.2), Inches(0.4),
       "Clinical relevance", 12, bold=True, color=RGBColor(0x85, 0x65, 0x04))
add_tb(s, Inches(6.65), Inches(1.78), Inches(6.2), Inches(1.35),
       "Seizures = inappropriate membrane depolarisations.\n"
       "Electrolyte imbalances (Na⁺, Ca²⁺) shift the threshold.\n"
       "Channel mutations → inherited epilepsies, myotonias, periodic paralysis.",
       12, color=DARK_TEXT, wrap=True)

slide_footer(s, 5, TOTAL)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 6 – Neurological Localization Overview
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
slide_header(s, "Neurological Localization", "The Core Diagnostic Skill")

add_tb(s, Inches(0.4), Inches(1.12), Inches(12.5), Inches(0.42),
       "Localization = determining which site of the nervous system is affected, from signs and symptoms.",
       15, bold=True, color=NAVY)

# Table: levels
headers = ["Level", "Site", "Hallmark Features"]
rows = [
    ["Cortex", "Cerebral cortex", "Aphasia, apraxia, neglect, cortical sensory loss"],
    ["Subcortical", "Internal capsule, corona radiata", "Dense hemiplegia without cortical signs"],
    ["Brainstem", "Midbrain, pons, medulla", "Crossed signs: ipsilateral CN palsy + contralateral limb deficit"],
    ["Cerebellum", "Cerebellar hemispheres / vermis", "Ipsilateral limb ataxia / truncal ataxia, dysmetria, nystagmus"],
    ["Spinal Cord", "Cervical, thoracic, lumbar cord", "Sensory level, bilateral motor/sensory loss below lesion"],
    ["Nerve Root", "C/T/L/S roots", "Dermatomal pain/sensory loss, myotomal weakness, reflex loss"],
    ["Peripheral Nerve", "Individual nerves / plexus", "Nerve territory loss; stocking-glove in neuropathy"],
    ["NMJ", "Neuromuscular junction", "Fatigable weakness (worse later in day), preserved reflexes early"],
    ["Muscle", "Myopathy", "Proximal > distal weakness, NO sensory loss, NO reflex change early"],
]

col_w = [Inches(1.8), Inches(3.0), Inches(7.2)]
x_starts = [Inches(0.15), Inches(1.95), Inches(4.95)]
y0 = Inches(1.65)
row_h2 = Inches(0.54)

# Header row
for j, hdr in enumerate(headers):
    add_rect(s, x_starts[j], y0, col_w[j], row_h2 - Inches(0.04), NAVY)
    add_tb(s, x_starts[j]+Inches(0.05), y0+Inches(0.07), col_w[j]-Inches(0.1), row_h2-Inches(0.1),
           hdr, 12, bold=True, color=WHITE)

for i, row in enumerate(rows):
    y = y0 + (i+1)*row_h2
    bg = LIGHT_TEAL if i % 2 == 0 else WHITE
    for j, cell in enumerate(row):
        add_rect(s, x_starts[j], y, col_w[j], row_h2 - Inches(0.03), bg,
                 line_color=RGBColor(0xCC, 0xCC, 0xCC), line_width=0.3)
        bold = (j == 0)
        col_text = TEAL if j == 0 else DARK_TEXT
        add_tb(s, x_starts[j]+Inches(0.05), y+Inches(0.04), col_w[j]-Inches(0.1), row_h2-Inches(0.07),
               cell, 11, bold=bold, color=col_text, wrap=True)

slide_footer(s, 6, TOTAL)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 7 – Corticospinal Tract
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
slide_header(s, "The Corticospinal (Pyramidal) Tract", "Most Important Motor Pathway")

facts = [
    ("Origin", "Primary motor cortex (precentral gyrus, M1) – layer V Betz cells"),
    ("Internal Capsule", "Posterior limb; somatotopic: hand lateral, foot medial/posterior"),
    ("Cerebral Peduncle", "Middle 3/5 of the crus cerebri in the midbrain"),
    ("Pons", "Scattered in basis pontis (interspersed with pontine nuclei)"),
    ("Medullary Pyramid", "Gathered again; lower limb fibres most lateral"),
    ("Pyramidal Decussation", "~90% cross at medulla-cord junction → lateral corticospinal tract"),
    ("Anterior CS Tract", "~10% remain ipsilateral, mostly crossing at lower spinal levels"),
    ("Bundle of Barnes", "~2% truly ipsilateral → axial/trunk musculature only"),
]

y0 = Inches(1.18)
rh = Inches(0.66)
for i, (loc, detail) in enumerate(facts):
    y = y0 + i * rh
    col = NAVY if i % 2 == 0 else TEAL
    add_rect(s, Inches(0.25), y, Inches(2.8), rh-Inches(0.04), col)
    add_tb(s, Inches(0.35), y+Inches(0.12), Inches(2.6), rh-Inches(0.15),
           loc, 12, bold=True, color=WHITE)
    add_rect(s, Inches(3.05), y, Inches(9.95), rh-Inches(0.04), LIGHT_BG)
    add_tb(s, Inches(3.15), y+Inches(0.1), Inches(9.7), rh-Inches(0.12),
           detail, 13, color=DARK_TEXT)

# Key clinical note
add_rect(s, Inches(7.5), Inches(1.18), Inches(5.6), Inches(1.5), RGBColor(0xFF, 0xF3, 0xCD))
add_tb(s, Inches(7.65), Inches(1.28), Inches(5.3), Inches(0.35),
       "Why does a RIGHT brain lesion cause LEFT weakness?", 12, bold=True,
       color=RGBColor(0x85, 0x65, 0x04))
add_tb(s, Inches(7.65), Inches(1.65), Inches(5.3), Inches(0.9),
       "Because 90% of corticospinal fibres decussate at the pyramidal decussation "
       "in the lower medulla — BEFORE entering the spinal cord.",
       12, color=DARK_TEXT, wrap=True)

slide_footer(s, 7, TOTAL)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 8 – UMN vs LMN
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
slide_header(s, "Upper vs Lower Motor Neuron (UMN vs LMN)", "Critical Distinction in Clinical Neurology")

features = [
    ("Tone",            "Increased (spasticity / clasp-knife)",  "Decreased (flaccidity)"),
    ("Deep Tendon\nReflexes", "Hyperreflexia",              "Hyporeflexia / Areflexia"),
    ("Plantar Response","Extensor – Babinski sign (POSITIVE)",  "Flexor (Normal)"),
    ("Clonus",          "Present (sustained beats)",            "Absent"),
    ("Muscle Wasting",  "Mild (disuse only)",                   "Prominent, early"),
    ("Fasciculations",  "Absent",                               "Present (spontaneous firing)"),
    ("Distribution",    "Pyramidal pattern: extensors arm, flexors leg", "Focal muscle groups or diffuse"),
]

hdr_w = [Inches(2.5), Inches(5.0), Inches(5.0)]
x_cols = [Inches(0.25), Inches(2.75), Inches(7.75)]
y0 = Inches(1.2)
rh = Inches(0.75)

# Header
hdr_labels = ["Feature", "UMN (Lesion ABOVE anterior horn)", "LMN (Anterior horn or below)"]
hdr_cols_bg = [NAVY, RGBColor(0x1A, 0x53, 0x76), TEAL]
for j, (lbl, bg) in enumerate(zip(hdr_labels, hdr_cols_bg)):
    add_rect(s, x_cols[j], y0, hdr_w[j], rh-Inches(0.05), bg)
    add_tb(s, x_cols[j]+Inches(0.08), y0+Inches(0.1), hdr_w[j]-Inches(0.15), rh-Inches(0.1),
           lbl, 13, bold=True, color=WHITE, wrap=True)

for i, (feat, umn, lmn) in enumerate(features):
    y = y0 + (i+1)*rh
    bg = LIGHT_BG if i % 2 == 0 else WHITE
    cells = [feat, umn, lmn]
    cell_cols_txt = [NAVY, RED_ACCENT, GREEN_ACC]
    for j, (cell, ctxt) in enumerate(zip(cells, cell_cols_txt)):
        add_rect(s, x_cols[j], y, hdr_w[j], rh-Inches(0.04), bg,
                 line_color=RGBColor(0xCC, 0xCC, 0xCC), line_width=0.3)
        bold2 = (j == 0)
        add_tb(s, x_cols[j]+Inches(0.08), y+Inches(0.05), hdr_w[j]-Inches(0.15), rh-Inches(0.08),
               cell, 12, bold=bold2, color=ctxt if j > 0 else DARK_TEXT, wrap=True)

slide_footer(s, 8, TOTAL)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 9 – Occam's Razor in Neurology
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
slide_header(s, "Occam's Razor in Neurology", "The Principle of Parsimony")

add_tb(s, Inches(0.4), Inches(1.15), Inches(12.5), Inches(0.5),
       '"Strive to explain ALL findings with the FEWEST possible lesions."', 17,
       bold=True, color=NAVY, italic=True)

# Two example boxes
def case_box(slide, x, y, w, title, body_lines, bg, hdr_col):
    add_rect(slide, x, y, w, Inches(0.42), hdr_col)
    add_tb(slide, x+Inches(0.1), y+Inches(0.05), w-Inches(0.2), Inches(0.35),
           title, 13, bold=True, color=WHITE)
    total_h = len(body_lines) * Inches(0.38) + Inches(0.15)
    add_rect(slide, x, y+Inches(0.42), w, total_h, bg)
    items = [(line, 0, False) for line in body_lines]
    add_multi_para(slide, x+Inches(0.15), y+Inches(0.5), w-Inches(0.25), total_h,
                   items, 13, color=DARK_TEXT)

case1_lines = [
    "Presentation: Left-sided visual loss (both eyes) + left-sided weakness",
    "→ Likely ONE lesion: right cerebral hemisphere",
    "→ Cause: stroke or tumour",
    "→ Occam satisfied: single lesion explains all findings",
]
case2_lines = [
    "Presentation: Central scotoma LEFT eye only + left-limb UMN weakness",
    "→ These CANNOT arise from one lesion",
    "→ TWO lesions: left optic nerve + right corticospinal tract",
    "→ Diagnosis: Multiple Sclerosis (demyelination at multiple sites)",
]

case_box(s, Inches(0.3), Inches(1.85), Inches(6.1),
         "Case 1 – One Lesion (Occam satisfied)", case1_lines,
         RGBColor(0xE8, 0xF8, 0xE8), GREEN_ACC)
case_box(s, Inches(6.8), Inches(1.85), Inches(6.2),
         "Case 2 – Two Lesions (Occam violated)", case2_lines,
         RGBColor(0xFF, 0xEB, 0xEB), RED_ACCENT)

add_tb(s, Inches(0.3), Inches(5.5), Inches(12.7), Inches(0.42),
       "When Occam's Razor is violated, consider: Multiple Sclerosis | Metastatic disease | "
       "Systemic/metabolic disorders | Vasculitis",
       14, bold=True, color=TEAL)
add_tb(s, Inches(0.3), Inches(5.95), Inches(12.7), Inches(0.35),
       "Note: Complex vascular anatomy can occasionally produce multifocal deficits from ONE vascular abnormality "
       "(e.g. vertebral artery occlusion → emboli to multiple posterior fossa sites).",
       13, italic=True, color=MID_GREY)

slide_footer(s, 9, TOTAL)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 10 – Neurological History
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
slide_header(s, "The Neurological History", "Most Powerful Diagnostic Tool")

categories = [
    ("Chief Complaint", "What bothers the patient most — in their own words"),
    ("History of Present Illness", "Onset (sudden vs. gradual), progression (stable/improving/worsening), "
     "fluctuation, duration, triggers"),
    ("Past Medical & Surgical History", "Previous neurological events, systemic diseases, medications, "
     "allergies, prior surgeries"),
    ("Family History", "Hereditary neurological diseases (Huntington's, CMT, familial ALS, migraine)"),
    ("Social History", "Occupation, alcohol, tobacco, recreational drugs, toxin exposures, travel"),
    ("Review of Systems", "Headache, vision, hearing, swallowing, bladder/bowel, gait, cognition"),
]

y0 = Inches(1.18)
rh = Inches(0.85)
icon_w = Inches(0.08)
for i, (cat, desc) in enumerate(categories):
    y = y0 + i * rh
    add_rect(s, Inches(0.25), y, icon_w, rh-Inches(0.06),
             TEAL if i % 2 == 0 else NAVY)
    add_rect(s, Inches(0.33), y, Inches(3.5), rh-Inches(0.06), LIGHT_BG)
    add_tb(s, Inches(0.42), y+Inches(0.15), Inches(3.3), rh-Inches(0.2),
           cat, 13, bold=True, color=NAVY)
    add_rect(s, Inches(3.83), y, Inches(9.2), rh-Inches(0.06), WHITE)
    add_tb(s, Inches(3.95), y+Inches(0.1), Inches(9.0), rh-Inches(0.12),
           desc, 13, color=DARK_TEXT, wrap=True)

# Onset clues
add_rect(s, Inches(0.25), Inches(6.3), Inches(12.7), Inches(0.88), RGBColor(0xFF, 0xF3, 0xCD))
add_tb(s, Inches(0.4), Inches(6.35), Inches(12.5), Inches(0.3),
       "Onset & Progression → Key to Aetiology:", 12, bold=True, color=RGBColor(0x85, 0x65, 0x04))
add_tb(s, Inches(0.4), Inches(6.65), Inches(12.5), Inches(0.45),
       "Sudden (seconds-minutes) → Vascular (stroke, TIA, SAH) | "
       "Subacute (days-weeks) → Infection, inflammation, tumour | "
       "Chronic-progressive → Degeneration | Episodic → Epilepsy, migraine, TIA",
       12, color=DARK_TEXT, wrap=True)
slide_footer(s, 10, TOTAL)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 11 – Neurological Examination
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
slide_header(s, "The Neurological Examination", "Structured Assessment")

domains = [
    ("1", "Mental Status", "Orientation, memory, language, attention, executive function, mood"),
    ("2", "Cranial Nerves", "CN I–XII each tested individually (olfaction → tongue deviation)"),
    ("3", "Motor System", "Tone, bulk, power (MRC 0–5), coordination (finger-nose, heel-shin)"),
    ("4", "Sensory System", "Light touch, pain/temperature, vibration, proprioception (joint position sense)"),
    ("5", "Reflexes", "DTRs (biceps C5/6, triceps C7, knee L3/4, ankle S1), plantar response"),
    ("6", "Cerebellar Function", "Dysdiadochokinesia, dysmetria, intention tremor, nystagmus"),
    ("7", "Gait & Stance", "Romberg test, tandem gait, heel-toe walking, observe base width"),
]

y0 = Inches(1.18)
rh = Inches(0.78)
for i, (num, domain, detail) in enumerate(domains):
    y = y0 + i * rh
    # number badge
    badge = s.shapes.add_shape(1, Inches(0.2), y+Inches(0.1), Inches(0.55), Inches(0.55))
    badge.fill.solid()
    badge.fill.fore_color.rgb = TEAL if i % 2 == 0 else NAVY
    badge.line.fill.background()
    badge.shadow.inherit = False
    bt = badge.text_frame
    bt.margin_left = bt.margin_right = bt.margin_top = bt.margin_bottom = 0
    bp = bt.paragraphs[0]
    bp.alignment = PP_ALIGN.CENTER
    br = bp.add_run()
    br.text = num
    br.font.size = Pt(16)
    br.font.bold = True
    br.font.color.rgb = WHITE
    add_tb(s, Inches(0.9), y+Inches(0.07), Inches(2.8), rh-Inches(0.1),
           domain, 14, bold=True, color=NAVY)
    add_tb(s, Inches(3.7), y+Inches(0.07), Inches(9.4), rh-Inches(0.1),
           detail, 13, color=DARK_TEXT, wrap=True)

# MRC Scale callout
add_rect(s, Inches(8.8), Inches(5.55), Inches(4.3), Inches(1.7), RGBColor(0xE8, 0xF0, 0xFF))
add_tb(s, Inches(8.95), Inches(5.62), Inches(4.1), Inches(0.3),
       "MRC Motor Power Scale", 11, bold=True, color=NAVY)
mrc = "0: No movement  |  1: Flicker  |  2: Movement without gravity\n3: Against gravity  |  4: Against resistance (reducible)  |  5: Normal"
add_tb(s, Inches(8.95), Inches(5.95), Inches(4.1), Inches(1.15),
       mrc, 11, color=DARK_TEXT, wrap=True)
slide_footer(s, 11, TOTAL)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 12 – Pathophysiological Mechanisms / Differential Diagnosis
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
slide_header(s, "Differential Diagnosis by Mechanism", "After Localisation: ASK — Why Is the Lesion There?")

mechs = [
    ("Vascular", "Ischaemic stroke, haemorrhage, TIA, venous sinus thrombosis", RGBColor(0xC0, 0x39, 0x2B)),
    ("Infectious", "Bacterial meningitis, viral encephalitis, brain abscess, TB, HIV", RGBColor(0xE6, 0x78, 0x00)),
    ("Inflammatory\n/ Autoimmune", "Multiple sclerosis, ADEM, autoimmune encephalitis (NMDAR, LGI1)", TEAL),
    ("Neoplastic", "Primary brain tumour (GBM, meningioma), metastases, paraneoplastic", NAVY),
    ("Degenerative\n/ Hereditary", "Alzheimer's, Parkinson's, ALS, hereditary ataxias, CMT", RGBColor(0x6C, 0x35, 0x7B)),
    ("Toxic / Metabolic\n/ Nutritional", "Wernicke encephalopathy (B1), B12 deficiency (subacute combined), "
     "alcohol, heavy metals, uraemia, hepatic encephalopathy", RGBColor(0x00, 0x7B, 0x3E)),
    ("Traumatic", "TBI, spinal cord injury, peripheral nerve injury", RGBColor(0x8B, 0x5C, 0x1A)),
    ("Compressive", "Disc herniation, tumour compression, syrinx, epidural haematoma", RGBColor(0x2C, 0x3E, 0x50)),
]

col_count = 4
cols = [(Inches(0.2), Inches(3.2)), (Inches(3.5), Inches(3.2)),
        (Inches(6.8), Inches(3.15)), (Inches(10.05), Inches(3.2))]

y0 = Inches(1.18)
bh = Inches(1.32)
gap = Inches(0.08)
for i, (mech, example, col) in enumerate(mechs):
    row, cidx = divmod(i, 4)
    x, bw = cols[cidx]
    y = y0 + row * (bh + gap)
    add_rect(s, x, y, bw, Inches(0.38), col)
    add_tb(s, x+Inches(0.07), y+Inches(0.04), bw-Inches(0.12), Inches(0.33),
           mech, 11, bold=True, color=WHITE, wrap=True)
    add_rect(s, x, y+Inches(0.38), bw, bh-Inches(0.38), LIGHT_BG)
    add_tb(s, x+Inches(0.07), y+Inches(0.42), bw-Inches(0.12), bh-Inches(0.44),
           example, 10, color=DARK_TEXT, wrap=True)

slide_footer(s, 12, TOTAL)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 13 – Investigations
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
slide_header(s, "Neurological Investigations", "Confirm the Clinical Hypothesis — Do NOT Replace It")

inv = [
    ("MRI Brain & Spine", "Gold standard for structural lesions; sequences: T1, T2, FLAIR, DWI, "
     "T1+Gad. DWI detects acute ischaemia within minutes.", NAVY),
    ("CT Scan", "First-line for acute presentations: haemorrhage, bone, mass effect. "
     "Rapid, widely available. Less sensitive than MRI for posterior fossa.", TEAL),
    ("EEG", "Electroencephalography — records cortical electrical activity. "
     "Diagnoses epilepsy, encephalopathy, sleep disorders.", RGBColor(0x00, 0x5F, 0x73)),
    ("Nerve Conduction\nStudies (NCS) + EMG", "NCS assesses peripheral nerve function (conduction velocity, amplitude). "
     "EMG records muscle electrical activity — distinguishes neuropathy from myopathy from NMJ disorder.", RGBColor(0x01, 0x94, 0x8A)),
    ("Lumbar Puncture\n(CSF Analysis)", "Meningitis/encephalitis (cells, protein, glucose, culture), "
     "MS (oligoclonal bands), SAH (xanthochromia), GBS (albuminocytological dissociation).", RGBColor(0x0A, 0x77, 0x50)),
    ("Blood Tests", "FBC, U&E, LFTs, glucose, B12, folate, thyroid, autoimmune antibodies "
     "(ANA, ANCA, anti-neuronal), genetics.", RGBColor(0x6C, 0x35, 0x7B)),
]

y0 = Inches(1.18)
rh2 = Inches(1.02)
for i, (name, detail, col) in enumerate(inv):
    y = y0 + i * rh2
    add_rect(s, Inches(0.2), y, Inches(2.6), rh2-Inches(0.05), col)
    add_tb(s, Inches(0.3), y+Inches(0.18), Inches(2.4), rh2-Inches(0.22),
           name, 12, bold=True, color=WHITE, wrap=True)
    add_rect(s, Inches(2.8), y, Inches(10.3), rh2-Inches(0.05), LIGHT_BG)
    add_tb(s, Inches(2.95), y+Inches(0.08), Inches(10.1), rh2-Inches(0.1),
           detail, 13, color=DARK_TEXT, wrap=True)

slide_footer(s, 13, TOTAL)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 14 – Key Neurological Syndromes Table
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
slide_header(s, "Key Neurological Syndromes at a Glance", "Syndrome → Localization → Classic Cause")

syn_data = [
    ("Contralateral hemiplegia + hemisensory loss", "Contralateral hemisphere / internal capsule", "Stroke"),
    ("Crossed signs: ipsilateral CN palsy + contralateral hemiplegia", "Brainstem", "Stroke / demyelination"),
    ("Paraplegia + sensory level + bladder dysfunction", "Spinal cord", "Trauma, MS, tumour"),
    ("Dermatomal pain + single root weakness", "Nerve root", "Disc herniation"),
    ("Stocking-glove sensory loss + distal weakness", "Peripheral neuropathy", "Diabetes, alcohol, B12 deficiency"),
    ("Fatigable ptosis + diplopia (worse later in day)", "Neuromuscular junction", "Myasthenia gravis"),
    ("Proximal weakness, NO sensory loss", "Myopathy", "Inflammatory myopathy, dystrophy"),
    ("Rest tremor + bradykinesia + rigidity", "Substantia nigra / basal ganglia", "Parkinson disease"),
    ("Gait ataxia + dysmetria + nystagmus", "Cerebellum", "Stroke, MS, alcohol"),
    ("Aphasia (non-fluent)", "Dominant (left) frontal / Broca area", "Stroke (MCA)"),
]

headers2 = ["Syndrome / Presentation", "Localization", "Classic Cause"]
cw2 = [Inches(5.0), Inches(4.3), Inches(3.6)]
xs2 = [Inches(0.2), Inches(5.2), Inches(9.5)]
y0 = Inches(1.18)
rh3 = Inches(0.55)

for j, hdr in enumerate(headers2):
    add_rect(s, xs2[j], y0, cw2[j], rh3-Inches(0.04), NAVY)
    add_tb(s, xs2[j]+Inches(0.06), y0+Inches(0.08), cw2[j]-Inches(0.1), rh3-Inches(0.1),
           hdr, 12, bold=True, color=WHITE)

for i, (synd, loc, cause) in enumerate(syn_data):
    y = y0 + (i+1) * rh3
    bg = LIGHT_TEAL if i % 2 == 0 else WHITE
    for j, cell in enumerate([synd, loc, cause]):
        add_rect(s, xs2[j], y, cw2[j], rh3-Inches(0.03), bg,
                 line_color=RGBColor(0xBB, 0xCC, 0xDD), line_width=0.3)
        add_tb(s, xs2[j]+Inches(0.06), y+Inches(0.05), cw2[j]-Inches(0.1), rh3-Inches(0.07),
               cell, 11, color=TEAL if j == 1 else DARK_TEXT, bold=(j==1), wrap=True)

slide_footer(s, 14, TOTAL)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 15 – Approach to Common Presentations
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
slide_header(s, "Approach to Common Presentations", "Weakness | Sensory Loss | Altered Consciousness | Headache")

pres_data = [
    ("WEAKNESS", [
        "UMN or LMN? → check tone, reflexes, Babinski",
        "Distribution: focal / hemiplegic / paraplegic / quadriplegic?",
        "Sudden onset = STROKE until proven otherwise",
        "Painless, slowly progressive → degenerative (MND, myopathy)",
    ], RED_ACCENT),
    ("SENSORY LOSS", [
        "Dermatomal pattern → nerve root lesion",
        "'Glove and stocking' distribution → peripheral neuropathy",
        "Hemisensory loss → contralateral thalamus or cortex",
        "Sensory LEVEL on trunk → SPINAL CORD (urgent MRI)",
    ], TEAL),
    ("ALTERED CONSCIOUSNESS", [
        "ALWAYS exclude metabolic causes FIRST: glucose, Na⁺, O₂, drugs",
        "Structural causes produce focal signs or herniation patterns",
        "ARAS (ascending reticular activating system) in brainstem/thalamus maintains wakefulness",
        "Glasgow Coma Scale (GCS): eyes (4) + verbal (5) + motor (6) = max 15",
    ], NAVY),
    ("HEADACHE", [
        "Thunderclap (worst ever, instantaneous) → SAH UNTIL PROVEN OTHERWISE",
        "Progressive + worse in morning → raised ICP (space-occupying lesion)",
        "Episodic + visual aura → migraine",
        "Neck stiffness + fever + photophobia → meningitis (LP after CT)",
    ], RGBColor(0x6C, 0x35, 0x7B)),
]

col_w3 = Inches(3.0)
col_x = [Inches(0.15), Inches(3.35), Inches(6.55), Inches(9.75)]
y0 = Inches(1.18)
for i, (title3, pts, col3) in enumerate(pres_data):
    x3 = col_x[i]
    add_rect(s, x3, y0, col_w3, Inches(0.42), col3)
    add_tb(s, x3+Inches(0.08), y0+Inches(0.05), col_w3-Inches(0.15), Inches(0.35),
           title3, 12, bold=True, color=WHITE)
    body_h = Inches(5.6)
    add_rect(s, x3, y0+Inches(0.42), col_w3, body_h, LIGHT_BG)
    items3 = [(f"• {pt}", 0, False) for pt in pts]
    add_multi_para(s, x3+Inches(0.08), y0+Inches(0.5), col_w3-Inches(0.12), body_h-Inches(0.1),
                   items3, 12, color=DARK_TEXT)

slide_footer(s, 15, TOTAL)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 16 – Autonomic Nervous System
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
slide_header(s, "The Autonomic Nervous System", "Involuntary Control of Vital Functions")

# Two columns: Sympathetic vs Parasympathetic
def ans_col(slide, x, y, w, h, title, items_list, hdr_col, bg_col):
    add_rect(slide, x, y, w, Inches(0.45), hdr_col)
    add_tb(slide, x+Inches(0.1), y+Inches(0.06), w-Inches(0.18), Inches(0.35),
           title, 14, bold=True, color=WHITE)
    add_rect(slide, x, y+Inches(0.45), w, h, bg_col)
    items4 = [(it, 0, False) for it in items_list]
    add_multi_para(slide, x+Inches(0.1), y+Inches(0.55), w-Inches(0.18), h-Inches(0.1),
                   items4, 13, color=DARK_TEXT)

symp_items = [
    "Origin: Thoracolumbar (T1–L2) spinal cord",
    "Pre-ganglionic: SHORT  |  Post-ganglionic: LONG",
    "Ganglia: paravertebral chain + prevertebral",
    "Neurotransmitter: Noradrenaline (NE) at post-ganglionic",
    "  (Acetylcholine at ganglia and adrenal medulla)",
    "",
    "Effects ('Fight or Flight'):",
    "  Tachycardia, ↑BP, pupil dilation (mydriasis)",
    "  Bronchodilation, ↓bowel motility",
    "  Sweating (cholinergic sweat glands)",
    "  Piloerection, glycogenolysis",
]
para_items = [
    "Origin: Craniosacral — CN III, VII, IX, X + S2–S4",
    "Pre-ganglionic: LONG  |  Post-ganglionic: SHORT",
    "Ganglia: terminal or intramural (in or near target organ)",
    "Neurotransmitter: Acetylcholine (ACh) throughout",
    "",
    "Effects ('Rest and Digest'):",
    "  Bradycardia, ↓BP, pupil constriction (miosis)",
    "  Bronchoconstriction, ↑bowel motility",
    "  Salivation, lacrimation, urination, defaecation",
    "  Penile erection (point = parasympathetic!)",
]

ans_col(s, Inches(0.2), Inches(1.18), Inches(6.0), Inches(5.3),
        "Sympathetic Nervous System", symp_items,
        RGBColor(0xC0, 0x39, 0x2B), RGBColor(0xFF, 0xEB, 0xEB))
ans_col(s, Inches(7.0), Inches(1.18), Inches(6.0), Inches(5.3),
        "Parasympathetic Nervous System", para_items,
        GREEN_ACC, RGBColor(0xE8, 0xF8, 0xE8))

# Middle vs label
add_tb(s, Inches(6.2), Inches(3.5), Inches(0.8), Inches(0.45),
       "vs", 28, bold=True, color=NAVY, align=PP_ALIGN.CENTER)

# Clinical note
add_rect(s, Inches(0.2), Inches(6.6), Inches(12.8), Inches(0.65), RGBColor(0xFF, 0xF3, 0xCD))
add_tb(s, Inches(0.35), Inches(6.65), Inches(12.5), Inches(0.28),
       "Autonomic dysfunction in neurology:", 12, bold=True, color=RGBColor(0x85, 0x65, 0x04))
add_tb(s, Inches(0.35), Inches(6.93), Inches(12.5), Inches(0.28),
       "Orthostatic hypotension (MSA, Parkinson's) | Horner syndrome (ptosis + miosis + anhidrosis) | "
       "Neurogenic bladder | Anhidrosis | Cardiac arrhythmias in GBS",
       12, color=DARK_TEXT)
slide_footer(s, 16, TOTAL)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 17 – Diagnostic Framework Summary
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
slide_header(s, "The Neurological Diagnostic Framework", "Step-by-Step Approach")

steps_fw = [
    ("1  HISTORY", "Chief complaint, onset, progression, family history, exposures", NAVY),
    ("2  EXAMINATION", "Structured 7-domain neurological examination", TEAL),
    ("3  LOCALIZATION", "Where is the lesion? (Apply neuroaxis levels)", RGBColor(0x00, 0x5F, 0x73)),
    ("4  MECHANISM", "Vascular? Inflammatory? Neoplastic? Degenerative? Toxic?", RGBColor(0x01, 0x94, 0x8A)),
    ("5  INVESTIGATION", "MRI, EEG, NCS/EMG, LP, bloods — to confirm hypothesis", RGBColor(0x0A, 0x77, 0x50)),
    ("6  DIAGNOSIS", "Integrate all data → final diagnosis + management plan", RGBColor(0x6C, 0x35, 0x7B)),
]

y0 = Inches(1.18)
rh5 = Inches(0.98)
arr_x = Inches(6.5)
for i, (step, desc, col5) in enumerate(steps_fw):
    y = y0 + i * rh5
    add_rect(s, Inches(0.3), y, Inches(2.8), rh5-Inches(0.06), col5)
    add_tb(s, Inches(0.42), y+Inches(0.2), Inches(2.6), rh5-Inches(0.22),
           step, 16, bold=True, color=WHITE)
    add_rect(s, Inches(3.1), y, Inches(9.9), rh5-Inches(0.06), LIGHT_BG)
    add_tb(s, Inches(3.25), y+Inches(0.2), Inches(9.6), rh5-Inches(0.22),
           desc, 15, color=DARK_TEXT)
    # arrow between steps
    if i < len(steps_fw) - 1:
        add_tb(s, Inches(1.1), y+rh5-Inches(0.12), Inches(0.8), Inches(0.22),
               "↓", 14, bold=True, color=col5, align=PP_ALIGN.CENTER)

slide_footer(s, 17, TOTAL)

# ═════════════════════════════════════════════════════════════════════════════
# SLIDE 18 – Summary & Key Takeaways
# ═════════════════════════════════════════════════════════════════════════════
s = prs.slides.add_slide(blank)
add_rect(s, 0, 0, W, H, NAVY)
add_rect(s, 0, Inches(5.8), W, Inches(1.7), TEAL)
add_rect(s, 0, 0, Inches(0.12), H, YELLOW)

add_tb(s, Inches(0.4), Inches(0.15), Inches(12.5), Inches(0.65),
       "Key Takeaways", 34, bold=True, color=WHITE)
add_tb(s, Inches(0.4), Inches(0.75), Inches(12.5), Inches(0.28),
       "Basics of Neurology", 14, italic=True, color=LIGHT_TEAL)

takeaways = [
    "Neurology's unique power lies in precise anatomical localization from history & examination alone.",
    "Master the neuroaxis: cortex → internal capsule → brainstem → cord → root → nerve → NMJ → muscle.",
    "UMN signs: spasticity, hyperreflexia, Babinski+   |   LMN signs: flaccidity, wasting, fasciculations.",
    "Apply Occam's Razor — one lesion if possible; multiple lesions if not.",
    "Onset matters: sudden = vascular | subacute = inflammatory/infective | chronic = degenerative.",
    "Investigations confirm your clinical hypothesis — never replace it.",
    "The corticospinal tract decussates at ~90% in the medulla → contralateral weakness.",
]

y_start = Inches(1.15)
rh6 = Inches(0.62)
for i, txt in enumerate(takeaways):
    y = y_start + i * rh6
    # bullet dot
    dot = s.shapes.add_shape(1, Inches(0.4), y+Inches(0.18), Inches(0.25), Inches(0.25))
    dot.fill.solid()
    dot.fill.fore_color.rgb = YELLOW
    dot.line.fill.background()
    dot.shadow.inherit = False
    add_tb(s, Inches(0.8), y+Inches(0.05), Inches(12.3), rh6-Inches(0.05),
           txt, 14, color=WHITE, wrap=True)

add_tb(s, Inches(0.4), Inches(5.9), Inches(10), Inches(0.4),
       "Sources: Bradley and Daroff's Neurology in Clinical Practice | "
       "Localization in Clinical Neurology, 8e | Adams and Victor's Principles of Neurology, 12th ed.",
       11, italic=True, color=WHITE)
add_tb(s, Inches(0.4), Inches(6.35), Inches(6), Inches(0.35),
       "Orris Medical Education", 13, bold=True, color=WHITE)
slide_footer(s, 18, TOTAL)

# ═════════════════════════════════════════════════════════════════════════════
# Save
# ═════════════════════════════════════════════════════════════════════════════
out = "/tmp/workspace/neurology-basics-pptx/Basics_of_Neurology.pptx"
buf = BytesIO()
prs.save(buf)
with open(out, "wb") as f:
    f.write(buf.getvalue())
print(f"Saved: {out}")
print(f"Slides: {len(prs.slides)}")
Running Command

cd /tmp/workspace/neurology-basics-pptx && python build.py 2>&1

Built and saved successfully. Here is your presentation:

Basics of Neurology

Presentation · PPTX


18 slides, 16:9 widescreen, professional navy/teal colour scheme. Here is what is inside:
SlideContent
1Title slide
2What Is Neurology? (definition, dual emphasis)
3Organisation of the Nervous System (CNS vs PNS two-column layout)
4The Neuron (soma, dendrites, axon, myelin, synapse, Node of Ranvier)
5Membrane Polarity & Action Potential (5-step numbered flow + clinical box)
6Neurological Localization (full table: level → hallmark features)
7The Corticospinal Tract (anatomy level by level + "why contralateral weakness?" callout)
8UMN vs LMN (colour-coded comparison table: red = UMN, green = LMN)
9Occam's Razor (two worked case boxes: one lesion vs two lesions)
10The Neurological History (6 categories + onset-to-aetiology callout bar)
11The Neurological Examination (7 domains + MRC scale box)
12Differential Diagnosis by Mechanism (8 mechanism tiles: vascular, infective, etc.)
13Neurological Investigations (MRI, CT, EEG, NCS/EMG, LP, bloods)
14Key Neurological Syndromes (10-syndrome table: syndrome → localization → cause)
15Approach to Common Presentations (4 columns: weakness, sensory, consciousness, headache)
16Autonomic Nervous System (sympathetic vs parasympathetic side-by-side)
17Diagnostic Framework (6-step flow: History → Examination → Localization → Mechanism → Investigation → Diagnosis)
18Key Takeaways (dark closing slide with 7 bullet highlights)
This is a shared conversation. Sign in to Orris to start your own chat.