Define hypokalemic periodic paralysis and its type and explain about the Patho physiology and clinical features and management of hypokalemic periodic paralysis and make notes as MD medicine university examination

Reading File
Finding Sources
Finding Sources
Searching PubMed

"hypokalemic periodic paralysis" management pathophysiology

Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Finding Sources

HYPOKALEMIC PERIODIC PARALYSIS

MD Medicine - University Examination Notes


1. DEFINITION

Hypokalemic Periodic Paralysis (HypoKPP) is a channelopathy characterized by episodic attacks of skeletal muscle weakness or paralysis associated with a fall in serum potassium concentration (hypokalemia), caused by a shift of potassium from the extracellular to the intracellular compartment.
  • Prevalence: approximately 1 per 100,000
  • Inheritance: Autosomal dominant with reduced penetrance in women
  • Male-to-female ratio: 3-4:1
  • Age of onset: typically second decade of life (adolescence)

2. CLASSIFICATION / TYPES

PRIMARY (Genetic / Familial) Hypokalemic Periodic Paralysis

Type 1 - HypoKPP1 (Most Common - ~70% of cases)

FeatureDetail
Gene mutatedCACNA1S (chromosome 1q31-32 / 1q32.1)
Protein affectedAlpha-1 subunit (alpha-1S) of the dihydropyridine (DHP)-sensitive L-type voltage-gated Ca2+ channel (CaV1.1)
Function of channelActs as voltage sensor for ryanodine receptor; mediates excitation-contraction coupling in skeletal muscle
Key mutationsArg528His (DII S4) and Arg1239His (DIV S4) - arginine-to-histidine substitutions (most common); also arginine-to-glycine substitutions
HistologyVacuolar myopathy - round/oval vacuoles in sarcoplasm

Type 2 - HypoKPP2 (~10-20% of cases)

FeatureDetail
Gene mutatedSCN4A (chromosome 17q23.3)
Protein affectedAlpha-subunit of the skeletal muscle voltage-gated Na+ channel (Nav1.4)
Same gene asHyperKPP, paramyotonia congenita, potassium-aggravated myotonias
Distinguishing featuresMyalgias after attacks; tubular aggregates on biopsy (not vacuoles); older age of onset; shorter attack duration; acetazolamide may worsen symptoms

Type 3 - Andersen-Tawil Syndrome (Rare)

  • Gene: KCNJ2 (Kir2.1 inwardly rectifying K+ channel)
  • Triad: Episodic weakness + Cardiac arrhythmias + Dysmorphic features (hypertelorism, micrognathia, clinodactyly, short stature)
  • Potassium may be normo-, hypo-, or hyperkalemic

SECONDARY (Acquired) Hypokalemic Periodic Paralysis

CauseMechanism
Thyrotoxic Periodic Paralysis (TPP)Increased Na+/K+-ATPase activity via thyroid hormone; beta-adrenergic hyperstimulation
Primary aldosteronism (Conn syndrome)Mineralocorticoid-driven renal K+ wasting
Renal tubular acidosisRenal K+ loss (Fanconi, Gitelman, dRTA)
Excessive diuretic useK+-depleting diuretics (most common cause in practice)
Barium poisoningBlocks KIR channels
Licorice (glycyrrhizic acid)Mineralocorticoid-like activity
Abuse of laxativesGI K+ loss
17-alpha hydroxylase deficiencyMineralocorticoid excess
Note on Thyrotoxic Periodic Paralysis (TPP): Classically in Asian/Hispanic young adult males. Attacks are clinically identical to familial HypoKPP. Up to 8.9% of thyrotoxic men in Japan develop periodic paralysis. Treatment of hyperthyroidism prevents recurrence. Propranolol (3 mg/kg high-dose) rapidly reverses hypokalemia and paralysis. Caution: Aggressive K+ replacement carries 25% risk of rebound hyperkalemia.

3. PATHOPHYSIOLOGY

Molecular Basis - The "Gating Pore" Current Theory

All mutations in both HypoKPP1 (CACNA1S) and HypoKPP2 (SCN4A) involve the S4 voltage-sensor domain of the respective channels. The substitution of positively charged arginine residues (particularly in S4 domains of DII and DIV) with histidine or glycine:
  1. Creates an aberrant "gating pore" in the S4 voltage-sensor domain
  2. This gating pore is open at resting membrane potentials (hyperpolarized states)
  3. A cation leak current (mainly H+ or Na+) passes through this aberrant pore
  4. This leak current causes paradoxical membrane depolarization during hypokalemia
  5. At the equilibrium potential for Cl- (~-50 mV), voltage-dependent Na+ channels become largely inactivated - resulting in paralysis

Role of ATP-Sensitive K+ Channels (KATP)

  • Type 1 HypoKPP muscles show reduced KATP channel activity
  • The normal outward K+ flow through KATP is absent
  • This leads to unopposed Na+/K+-ATPase activity - pumping K+ into cells
  • Insulin inhibits residual KATP activity, potentiating hypokalemia
  • This causes a depolarizing shift toward the Cl- equilibrium potential, inactivating Na+ channels

Steps in Attack Generation (Simplified):

Trigger (carbs/exercise/rest)
        ↓
↑ Insulin secretion
        ↓
↑ Na+/K+-ATPase activity + reduced KATP channel activity
        ↓
K+ shifts INTO muscle cells (intracellular sequestration)
        ↓
Serum K+ falls (hypokalemia)
        ↓
Gating pore current activates at hyperpolarized potentials
        ↓
Paradoxical membrane depolarization (not hyperpolarization)
        ↓
Inactivation of voltage-gated Na+ channels
        ↓
Muscle inexcitable → Paralysis

Why Paradoxical Depolarization (Not Hyperpolarization)?

One would expect hypokalemia to hyperpolarize the membrane (since K+ equilibrium potential becomes more negative). However, in HypoKPP:
  • Increased Na+ conductance via the gating pore causes net depolarization
  • This is different from normal physiology and is the key mechanistic insight

Potassium Shifts During Attacks

  • Serum K+ can fall as low as 1.8 mEq/L
  • The fall is NOT associated with increased urinary K+ excretion - K+ enters muscle cells
  • ECG changes begin at serum K+ ~3 mEq/L
  • Some episodes occur at near-normal K+ levels, and weakness may persist after K+ is restored - suggesting additional mechanisms

4. CLINICAL FEATURES

Precipitating Factors (Triggers)

  • Rest following strenuous exercise (most characteristic)
  • High carbohydrate meal (especially the previous night)
  • High sodium intake
  • Sleep (attacks most common in early morning, between 1-6 AM)
  • Emotional stress
  • Epinephrine, norepinephrine, corticosteroids (less common)
  • Cold exposure

Prodromal Symptoms

  • Excessive hunger or thirst, dry mouth
  • Palpitations, sweating
  • Sensation of heaviness or aching in legs or back
  • Fatigue or sense of weariness
  • Diarrhea, nervousness

Attack Characteristics

  • Patient typically awakens from sleep to find weakness
  • Evolves over minutes to several hours
  • Duration: few hours to several days (usually several hours)
  • Frequency: can be several times per week to intervals of weeks-months

Distribution of Weakness

PatternDetails
Proximal > DistalProximal muscles more susceptible
Legs > ArmsLegs typically affected first
Limbs > TrunkLimbs affected earlier and more severely
Spared musclesEyes, face, tongue, pharynx, larynx, diaphragm, sphincters (usually)
ReflexesTendon reflexes reduced or absent at peak; cutaneous reflexes may disappear
ConsciousnessPreserved - key distinguishing feature
SensationPreserved - key distinguishing feature

Recovery Pattern

  • Strength returns first to muscles last affected
  • Headache, exhaustion, diuresis may follow
  • Most patients recover full strength; mild weakness may persist days

Rare/Severe Manifestations

  • Respiratory paralysis (rare - potentially fatal)
  • Cardiac arrhythmias (ECG changes common)
  • Bulbar involvement (exceptional)
  • Death from respiratory paralysis or cardiac conduction derangements (pre-modern ICU era)

Late Complications

  • Progressive proximal myopathy - permanent vacuolated, degenerated fibers; myopathic EMG potentials. Develops in middle adult life, sometimes long after attacks cease.
  • Talipes deformity (in some patients from early life)

Important Negative Features

  • No myotonia (clinical or EMG evidence of myotonia essentially EXCLUDES the diagnosis)

5. INVESTIGATIONS AND LABORATORY FINDINGS

Serum Electrolytes

  • Serum K+: low, often 1.8-3.5 mEq/L (can be as low as 1.8 mEq/L)
  • Serum K+ returns to normal during recovery
  • Urine K+ NOT elevated (shift, not true K+ loss - distinguishes from renal wasting causes)
  • TTKG < 2-3 (distinguishes from renal K+ wasting where TTKG >4)

ECG Changes (begin when K+ ~3 mEq/L)

  • Prolonged PR interval
  • Prolonged QRS duration
  • Prolonged QT interval
  • T-wave flattening
  • Prominent U waves
  • Bradycardia

Electrophysiology (EMG/NCS)

  • Motor nerve conduction: reduced CMAP amplitudes or absent CMAPs in severe attacks
  • EMG: electrically silent (no activity in paralyzed muscle)
  • Between attacks: Long Exercise Test - baseline CMAP recorded, patient exercises 5 min, then CMAPs recorded every minute during exercise (may show increment), then at 10-20 min post-exercise - shows significant decrement (>40% in 10-20 min after exercise)

Serum CK

  • Usually mildly elevated during attacks (non-specific)

Thyroid Function Tests

  • Mandatory in all patients at first presentation (screen for TPP)

Provocative Tests (when patient is asymptomatic)

  • Oral glucose load: 50-100 g glucose (or 2g NaCl/hr x 7 doses + vigorous exercise)
  • Monitor with ECG
  • Attack terminated by 2-4 g oral KCl
  • Note: This is the OPPOSITE of HyperKPP where K+ precipitates attacks

Genetic Testing

  • Confirms specific subtype (CACNA1S vs SCN4A mutations)
  • Available for both HypoKPP1 and HypoKPP2

Muscle Biopsy

  • HypoKPP1 (CACNA1S): Round/oval vacuoles in sarcoplasm (proliferation/degeneration of sarcoplasmic reticulum and T-tubules membranes). PAS-positive granules. Focal glycogen increase.
  • HypoKPP2 (SCN4A): Tubular aggregates
  • Both: May be normal; or show myopathic changes

6. DIAGNOSIS

Diagnostic Criteria

  1. Episodic muscle weakness with hypokalemia during attacks
  2. No urinary K+ wasting (urine K+/creatinine < 2.5 mmol/mmol or TTKG < 2-3)
  3. Family history of periodic paralysis (in familial form)
  4. Age of onset: typically adolescence
  5. Characteristic triggers (exercise, carbohydrates, sleep)
  6. EMG: electrically silent muscle during attack
  7. Absence of myotonia
  8. Genetic confirmation

Differential Diagnosis

ConditionDistinguishing Feature
Hyperkalemic periodic paralysisK+ elevated; triggered by K+ supplementation; myotonia common
Andersen-Tawil syndromeTriad: weakness + arrhythmia + dysmorphic features
Myasthenia gravisFatigable weakness; ocular/bulbar involvement; AChR antibodies
Guillain-Barre syndromeAscending paralysis; CSF albuminocytological dissociation; no K+ change
Thyrotoxic periodic paralysisClinical hyperthyroidism; high T3/T4; TSH suppressed
Conn syndromeHypertension; hypernatremia; hypokalemia; elevated aldosterone
RTA/GitelmanMetabolic acidosis or alkalosis with renal K+ wasting; TTKG >4

7. MANAGEMENT

A. ACUTE ATTACK TREATMENT

Goal: Restore serum potassium and resolve weakness

Oral Potassium (Preferred)

  • KCl 0.2-0.4 mmol/kg every 30 minutes orally
  • First-line; safer than IV
  • Dose: 2-4 g oral KCl can abort/terminate an attack
  • May need 60-120 mEq total for a complete attack

Intravenous Potassium (Only when oral route not possible)

  • Indications: swallowing problems, vomiting, severe weakness
  • Initial bolus: 0.05-0.1 mEq/kg at a safe rate
  • Followed by: 20-40 mEq KCl in 5% mannitol
  • IMPORTANT: Use mannitol as the carrier - avoid glucose (worsens hypokalemia via insulin) and avoid NaCl (high sodium worsens attacks)
  • Avoid glucose-containing IV fluids and hyperventilation (both lower K+)

Monitoring During IV Therapy

  • Continuous ECG
  • Serial serum K+ measurements
  • Watch for rebound hyperkalemia (especially in TPP)

B. PROPHYLACTIC / PREVENTIVE TREATMENT

Lifestyle Modifications

  • Low-carbohydrate diet - avoid large carbohydrate loads
  • Low-sodium diet (< 160 mEq/day) - reduces attack frequency
  • Avoid intense exercise followed by prolonged rest
  • Avoid cold exposure
  • Avoid corticosteroids, epinephrine, insulin where possible
  • Regular moderate exercise to maintain fitness

Pharmacological Prophylaxis

DrugDoseMechanismNotes
Acetazolamide250 mg TIDCarbonic anhydrase inhibitor; produces mild metabolic acidosis; influences K+ shiftsFirst-line for HypoKPP1; may worsen HypoKPP2 - AVOID in SCN4A mutations; SE: digit tingling, nephrolithiasis, hypersensitivity
Dichlorphenamide50-150 mg/dayMore potent carbonic anhydrase inhibitor (FDA-approved for both HypoKPP and HyperKPP)Alternative to acetazolamide; evidence from RCT (Sansone et al., 2016); useful for progressive myopathy
Spironolactone25-100 mg/dayPotassium-sparing diuretic (aldosterone antagonist)Use when unresponsive to acetazolamide; adjunctive
Triamterene25-100 mg/dayPotassium-sparing diureticAlternative to spironolactone; adjunctive
Potassium supplementationVariableMaintenance of K+ levelsAdjunctive
Key Point: Acetazolamide is paradoxically effective despite being kaliuretic - it works likely through production of metabolic acidosis.

C. THYROTOXIC PERIODIC PARALYSIS - SPECIFIC MANAGEMENT

  • Acute attack: KCl supplementation (but limit aggressive repletion due to ~25% rebound hyperkalemia risk)
  • Propranolol (high-dose, 3 mg/kg): Rapidly reverses hypokalemia, hypophosphatemia, and paralysis - no rebound hyperkalemia
  • Definitive: Treat hyperthyroidism - prevents recurrence completely
  • Screen all new HypoKPP patients for thyroid disease

8. SUMMARY TABLE - TYPES OF HYPOKALEMIC PERIODIC PARALYSIS

FeatureHypoKPP Type 1HypoKPP Type 2Thyrotoxic PP
GeneCACNA1SSCN4AKCNJ18 (Kir2.6)
ChannelL-type Ca2+ (CaV1.1)Na+ (Nav1.4)K+ (Kir2.6)
Chromosome1q31-3217q23.317p11.1
InheritanceADADAD (sporadic common)
% of HypoKPP~70%10-20%Secondary
Onset2nd decadeOlderAdult males
BiopsyVacuolesTubular aggregatesNon-specific
AcetazolamideHelpfulMay worsenNot indicated
Post-attack myalgiaUncommonMore common-
TreatmentK+, AcetazolamideK+, DichlorphenamideK+ + Propranolol + Treat thyroid

9. KEY EXAM POINTS (High-Yield)

  1. Most common mutation: Arg528His in DII S4 of CACNA1S gene (HypoKPP1)
  2. Mechanism: S4 voltage sensor mutations create aberrant gating pore current → paradoxical membrane depolarization → Na+ channel inactivation → paralysis
  3. Attack timing: Classically early morning, after exercise + carbohydrate-rich meal the night before
  4. Preserved in attacks: Consciousness, sensation, ocular muscles, diaphragm (usually), sphincters
  5. Absent in attacks: Tendon reflexes, motor nerve conduction, EMG activity
  6. No myotonia - presence of myotonia excludes HypoKPP
  7. K+ shift, not K+ loss - urinary K+ NOT elevated (TTKG <2-3)
  8. ECG: T-wave flattening + prominent U waves + prolonged PR/QT
  9. IV fluid: Use mannitol, NEVER glucose or saline, as carrier
  10. Acetazolamide: Works despite being kaliuretic; AVOID in HypoKPP2 (SCN4A)
  11. Dichlorphenamide: FDA-approved carbonic anhydrase inhibitor for both Hypo- and HyperKPP
  12. TPP: High-dose propranolol reverses attack; treat underlying hyperthyroidism definitively
  13. Late complication: Progressive proximal vacuolar myopathy
  14. Provocation test: Glucose 50-100g + NaCl + exercise → attack; terminated by 2-4g KCl oral

10. PATHOPHYSIOLOGY FLOWCHART - EXAM DIAGRAM

MUTATION in S4 voltage-sensor domain
(CACNA1S / SCN4A)
         |
         ↓
  ABERRANT "GATING PORE"
  (leak current at resting potential)
         |
         ↓
TRIGGERS: Exercise → Rest, Carbohydrates → ↑ Insulin
         |
         ↓
↑ Na+/K+-ATPase activity + ↓ KATP channel activity
         |
         ↓
         K+ shifts INTO muscle cells
         |
         ↓
    ↓ Serum K+ (Hypokalemia)
         |
         ↓
Gating pore current → paradoxical DEPOLARIZATION
(not hyperpolarization as expected)
         |
         ↓
Membrane potential ~ -50 mV (Cl- equilibrium potential)
         |
         ↓
Voltage-gated Na+ channels INACTIVATED
         |
         ↓
Muscle INEXCITABLE → PARALYSIS
         |
         ↓
    RECOVERY: K+ redistributes out of cells,
    membrane repolarizes, Na+ channels recover

Sources: Adams and Victor's Principles of Neurology 12e; Harrison's Principles of Internal Medicine 22e; Bradley and Daroff's Neurology in Clinical Practice; Brenner and Rector's The Kidney; Goldman-Cecil Medicine

Ok

Glad the notes were helpful! If you need any clarification, want me to expand on a specific section (like the gating pore mechanism in more detail, or ECG changes with diagrams), or need notes on a related topic like Hyperkalemic Periodic Paralysis, Andersen-Tawil Syndrome, or Thyrotoxic Periodic Paralysis for your MD Medicine exam, just let me know!

Create a Word document with these notes for quick reference

Reading File
Running Command

ls /home/daytona/workspace/ 2>/dev/null && ls /home/daytona/skills/docx/

Running Command

mkdir -p /home/daytona/workspace/hypokalemic-pp && node -e "require('docx'); con…

Writing File

~/hypokalemic-pp/build.js

const {
  Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell,
  HeadingLevel, AlignmentType, BorderStyle, WidthType, ShadingType,
  VerticalAlign, PageNumber, Header, Footer, TabStopType, TabStopPosition,
  TableOfContents, UnderlineType
} = require('docx');
const fs = require('fs');

// ── Color Palette ──────────────────────────────────────────────────────────
const C = {
  darkBlue:   "1B3A6B",
  medBlue:    "2D6FAD",
  lightBlue:  "D6E8F7",
  teal:       "1A7F8E",
  lightTeal:  "D6F0F3",
  accent:     "C0392B",   // red-accent for high-yield
  accentBg:   "FDECEA",
  headerBg:   "1B3A6B",
  tableHead:  "2D6FAD",
  tableAlt:   "EBF4FB",
  tableWhite: "FFFFFF",
  gray:       "555555",
  lightGray:  "F5F5F5",
  border:     "AAAAAA",
};

// ── Helpers ────────────────────────────────────────────────────────────────
const pt = (n) => n * 20;   // half-points (docx unit)
const twip = (cm) => Math.round(cm * 567);

function heading1(text) {
  return new Paragraph({
    children: [new TextRun({ text, bold: true, size: pt(16), color: C.darkBlue, font: "Calibri" })],
    spacing: { before: pt(14), after: pt(6) },
    border: { bottom: { style: BorderStyle.THICK, size: 6, color: C.darkBlue } },
  });
}

function heading2(text) {
  return new Paragraph({
    children: [new TextRun({ text, bold: true, size: pt(13), color: C.medBlue, font: "Calibri" })],
    spacing: { before: pt(10), after: pt(4) },
  });
}

function heading3(text) {
  return new Paragraph({
    children: [new TextRun({ text, bold: true, size: pt(11), color: C.teal, font: "Calibri" })],
    spacing: { before: pt(8), after: pt(3) },
  });
}

function body(text, opts = {}) {
  return new Paragraph({
    children: [new TextRun({
      text,
      size: pt(10.5),
      color: opts.color || "000000",
      bold: opts.bold || false,
      italics: opts.italic || false,
      font: "Calibri",
    })],
    spacing: { before: pt(2), after: pt(2) },
    indent: opts.indent ? { left: twip(opts.indent) } : undefined,
  });
}

function bullet(text, level = 0, bold = false) {
  const indent = level === 0 ? twip(0.5) : twip(1);
  return new Paragraph({
    children: [new TextRun({ text: (level === 0 ? "• " : "  ◦ ") + text, size: pt(10.5), bold, font: "Calibri" })],
    spacing: { before: pt(1), after: pt(1) },
    indent: { left: indent },
  });
}

function note(text) {
  return new Paragraph({
    children: [
      new TextRun({ text: "★ Note: ", bold: true, size: pt(10.5), color: C.accent, font: "Calibri" }),
      new TextRun({ text, size: pt(10.5), italics: true, color: C.accent, font: "Calibri" }),
    ],
    spacing: { before: pt(4), after: pt(4) },
    indent: { left: twip(0.3) },
    shading: { type: ShadingType.CLEAR, color: "auto", fill: C.accentBg },
  });
}

function keyPoint(text) {
  return new Paragraph({
    children: [
      new TextRun({ text: "🔑 ", size: pt(10.5), font: "Calibri" }),
      new TextRun({ text, size: pt(10.5), bold: true, color: C.darkBlue, font: "Calibri" }),
    ],
    spacing: { before: pt(2), after: pt(2) },
    indent: { left: twip(0.3) },
  });
}

function hr() {
  return new Paragraph({
    children: [new TextRun({ text: "", size: pt(4) })],
    border: { bottom: { style: BorderStyle.SINGLE, size: 2, color: C.border } },
    spacing: { before: pt(6), after: pt(6) },
  });
}

function space(sz = 4) {
  return new Paragraph({ children: [new TextRun({ text: "", size: pt(sz) })] });
}

// ── Table Builder ──────────────────────────────────────────────────────────
function makeTable(headers, rows, opts = {}) {
  const colWidths = opts.colWidths;
  const totalWidth = 9000;

  // header row
  const headerRow = new TableRow({
    tableHeader: true,
    children: headers.map((h, i) => new TableCell({
      shading: { type: ShadingType.CLEAR, color: "auto", fill: C.tableHead },
      verticalAlign: VerticalAlign.CENTER,
      width: colWidths ? { size: colWidths[i], type: WidthType.DXA } : { size: Math.floor(totalWidth / headers.length), type: WidthType.DXA },
      children: [new Paragraph({
        alignment: AlignmentType.CENTER,
        children: [new TextRun({ text: h, bold: true, size: pt(10), color: "FFFFFF", font: "Calibri" })],
      })],
    })),
  });

  const dataRows = rows.map((row, ri) => new TableRow({
    children: row.map((cell, ci) => new TableCell({
      shading: { type: ShadingType.CLEAR, color: "auto", fill: ri % 2 === 0 ? C.tableWhite : C.tableAlt },
      verticalAlign: VerticalAlign.CENTER,
      width: colWidths ? { size: colWidths[ci], type: WidthType.DXA } : { size: Math.floor(totalWidth / row.length), type: WidthType.DXA },
      children: [new Paragraph({
        children: [new TextRun({ text: cell, size: pt(9.5), font: "Calibri" })],
        spacing: { before: pt(1), after: pt(1) },
      })],
    })),
  }));

  return new Table({
    width: { size: 100, type: WidthType.PERCENTAGE },
    rows: [headerRow, ...dataRows],
    margins: { top: 60, bottom: 60, left: 80, right: 80 },
  });
}

// ─────────────────────────────────────────────────────────────────────────
// TITLE PAGE
// ─────────────────────────────────────────────────────────────────────────
function titleSection() {
  return [
    space(12),
    new Paragraph({
      alignment: AlignmentType.CENTER,
      children: [new TextRun({ text: "HYPOKALEMIC PERIODIC PARALYSIS", bold: true, size: pt(22), color: C.darkBlue, font: "Calibri" })],
      spacing: { after: pt(6) },
    }),
    new Paragraph({
      alignment: AlignmentType.CENTER,
      children: [new TextRun({ text: "MD Medicine — University Examination Notes", size: pt(13), color: C.medBlue, italics: true, font: "Calibri" })],
      spacing: { after: pt(4) },
    }),
    new Paragraph({
      alignment: AlignmentType.CENTER,
      border: { bottom: { style: BorderStyle.THICK, size: 8, color: C.teal } },
      children: [new TextRun({ text: "Channelopathy | Neurology | Internal Medicine", size: pt(11), color: C.teal, font: "Calibri" })],
      spacing: { after: pt(8) },
    }),
    space(4),
    new Paragraph({
      alignment: AlignmentType.CENTER,
      children: [new TextRun({ text: "Sources: Harrison's 22e • Adams & Victor's Neurology 12e • Bradley & Daroff's Neurology • Brenner & Rector's Kidney • Goldman-Cecil Medicine", size: pt(9), color: C.gray, italics: true, font: "Calibri" })],
    }),
    space(6),
    hr(),
  ];
}

// ─────────────────────────────────────────────────────────────────────────
// SECTION 1 — DEFINITION
// ─────────────────────────────────────────────────────────────────────────
function section1() {
  return [
    heading1("1. DEFINITION"),
    body("Hypokalemic Periodic Paralysis (HypoKPP) is a channelopathy characterized by episodic attacks of skeletal muscle weakness or paralysis associated with a fall in serum potassium concentration, caused by a shift of potassium from the extracellular to the intracellular compartment."),
    space(2),
    makeTable(
      ["Parameter", "Detail"],
      [
        ["Prevalence", "~1 per 100,000"],
        ["Inheritance", "Autosomal Dominant with reduced penetrance in females"],
        ["Sex ratio", "Male : Female = 3–4 : 1"],
        ["Age of onset", "Typically 2nd decade (adolescence)"],
        ["Key feature", "Episodic paralysis + hypokalemia + intracellular K+ shift"],
      ],
      { colWidths: [3000, 6000] }
    ),
    space(3),
  ];
}

// ─────────────────────────────────────────────────────────────────────────
// SECTION 2 — CLASSIFICATION
// ─────────────────────────────────────────────────────────────────────────
function section2() {
  return [
    heading1("2. CLASSIFICATION / TYPES"),
    heading2("A. PRIMARY (Genetic / Familial) HypoKPP"),
    heading3("Type 1 — HypoKPP1 (~70% of cases)"),
    makeTable(
      ["Feature", "Detail"],
      [
        ["Gene", "CACNA1S (chromosome 1q31-32 / 1q32.1)"],
        ["Protein", "α1-subunit of dihydropyridine (DHP)-sensitive L-type Ca2+ channel (CaV1.1)"],
        ["Channel function", "Voltage sensor for ryanodine receptor; excitation-contraction coupling"],
        ["Key mutations", "Arg528His (DII S4) & Arg1239His (DIV S4) — arginine→histidine; also arginine→glycine"],
        ["Biopsy finding", "Vacuolar myopathy — round/oval vacuoles in sarcoplasm (PAS+)"],
      ],
      { colWidths: [3000, 6000] }
    ),
    space(2),
    heading3("Type 2 — HypoKPP2 (10–20% of cases)"),
    makeTable(
      ["Feature", "Detail"],
      [
        ["Gene", "SCN4A (chromosome 17q23.3)"],
        ["Protein", "α-subunit of voltage-gated Na+ channel (Nav1.4)"],
        ["Also involved in", "HyperKPP, paramyotonia congenita, K+-aggravated myotonias"],
        ["Distinguishing features", "Post-attack myalgias; tubular aggregates on biopsy (not vacuoles); older onset"],
        ["Acetazolamide", "MAY WORSEN symptoms — AVOID in HypoKPP2"],
      ],
      { colWidths: [3000, 6000] }
    ),
    space(2),
    heading3("Type 3 — Andersen-Tawil Syndrome (Rare)"),
    bullet("Gene: KCNJ2 (inwardly rectifying Kir2.1 K+ channel)"),
    bullet("Classic Triad: Episodic weakness + Cardiac arrhythmias (long QT, VT) + Dysmorphic features (hypertelorism, micrognathia, clinodactyly, short stature)"),
    bullet("K+ may be normo-, hypo-, or hyperkalemic"),
    space(3),
    heading2("B. SECONDARY (Acquired) HypoKPP"),
    makeTable(
      ["Cause", "Mechanism"],
      [
        ["Thyrotoxic Periodic Paralysis (TPP)", "↑ Na+/K+-ATPase via thyroid hormone; β-adrenergic hyperstimulation; Kir2.6 (KCNJ18) variants"],
        ["Primary Aldosteronism (Conn Syndrome)", "Mineralocorticoid-driven renal K+ wasting"],
        ["Renal Tubular Acidosis (Fanconi, Gitelman, dRTA)", "Renal K+ loss"],
        ["Diuretic overuse (thiazide/loop)", "K+-depleting effect (most common cause in practice)"],
        ["Barium poisoning", "Blocks KIR channels"],
        ["Licorice (glycyrrhizic acid)", "Mineralocorticoid-like activity"],
        ["Laxative abuse", "GI potassium loss"],
        ["17-α hydroxylase deficiency", "Mineralocorticoid excess"],
      ],
      { colWidths: [3500, 5500] }
    ),
    space(2),
    note("TPP is classically seen in young Asian/Hispanic adult males. Up to 8.9% of thyrotoxic men in Japan develop periodic paralysis. Clinically identical to familial HypoKPP. High-dose propranolol (3 mg/kg) rapidly reverses attacks. Treat hyperthyroidism for definitive prevention. Aggressive K+ replacement risks 25% rebound hyperkalemia."),
    space(3),
  ];
}

// ─────────────────────────────────────────────────────────────────────────
// SECTION 3 — PATHOPHYSIOLOGY
// ─────────────────────────────────────────────────────────────────────────
function section3() {
  return [
    heading1("3. PATHOPHYSIOLOGY"),
    heading2("A. Molecular Basis — The Gating Pore Current Theory"),
    body("All mutations in both HypoKPP1 and HypoKPP2 involve the S4 voltage-sensor domain. Substitution of positively charged arginine residues (in S4 domains of DII and DIV) with histidine or glycine:"),
    bullet("Creates an aberrant 'gating pore' in the S4 voltage-sensor domain"),
    bullet("This gating pore is open at resting membrane potentials (hyperpolarized states)"),
    bullet("A cation leak current (H+ or Na+) passes through this aberrant pore"),
    bullet("Causes paradoxical membrane DEPOLARIZATION during hypokalemia"),
    bullet("At Cl- equilibrium potential (~-50 mV), voltage-gated Na+ channels become INACTIVATED → Paralysis"),
    space(2),
    heading2("B. Role of KATP Channels and Insulin"),
    bullet("HypoKPP1 muscles: reduced KATP channel activity → unopposed Na+/K+-ATPase activity"),
    bullet("Insulin inhibits residual KATP → further depolarizing shift toward Cl- equilibrium potential"),
    bullet("Carbohydrate meals → ↑ insulin → ↑ K+ entry into cells → ↓ serum K+"),
    space(2),
    heading2("C. Steps in Attack Generation"),
    makeTable(
      ["Step", "Event"],
      [
        ["1", "Trigger: heavy carbohydrate meal + rest after exercise"],
        ["2", "↑ Insulin secretion → ↑ Na+/K+-ATPase activity"],
        ["3", "↓ KATP channel activity (in HypoKPP1)"],
        ["4", "K+ shifts INTO muscle cells (intracellular sequestration)"],
        ["5", "Serum K+ falls (hypokalemia, as low as 1.8 mEq/L)"],
        ["6", "Gating pore current activates at hyperpolarized potentials"],
        ["7", "Paradoxical membrane DEPOLARIZATION (not hyperpolarization)"],
        ["8", "Membrane potential ~-50 mV → Na+ channels INACTIVATED"],
        ["9", "Muscle becomes electrically inexcitable → PARALYSIS"],
        ["10", "Recovery: K+ redistributes out of cells; Na+ channels recover"],
      ],
      { colWidths: [800, 8200] }
    ),
    space(2),
    note("Why paradoxical depolarization? One would expect hypokalemia to hyperpolarize the membrane (K+ equilibrium potential more negative). However, increased Na+ conductance via the gating pore causes net depolarization — the key mechanistic insight in HypoKPP."),
    space(2),
    heading2("D. Potassium Dynamics During Attacks"),
    bullet("Serum K+ can fall to 1.8 mEq/L"),
    bullet("Fall NOT associated with increased urinary K+ excretion — K+ enters muscle cells"),
    bullet("ECG changes begin at serum K+ ~3 mEq/L"),
    bullet("Some episodes occur at near-normal K+ — weakness persists after K+ restoration"),
    bullet("Serum K+ returns to normal during recovery"),
    space(3),
  ];
}

// ─────────────────────────────────────────────────────────────────────────
// SECTION 4 — CLINICAL FEATURES
// ─────────────────────────────────────────────────────────────────────────
function section4() {
  return [
    heading1("4. CLINICAL FEATURES"),
    heading2("A. Precipitating Factors (Triggers)"),
    bullet("Rest following strenuous exercise (most characteristic)", 0, true),
    bullet("High carbohydrate meal (especially the previous night)", 0, true),
    bullet("High sodium intake"),
    bullet("Sleep (attacks most common 1–6 AM, early morning)"),
    bullet("Emotional stress"),
    bullet("Epinephrine, norepinephrine, corticosteroids"),
    bullet("Cold exposure"),
    space(2),
    heading2("B. Prodromal Symptoms"),
    bullet("Excessive hunger, thirst, dry mouth"),
    bullet("Palpitations, sweating, diarrhea"),
    bullet("Sensation of heaviness or aching in legs or back"),
    bullet("Fatigue or sense of weariness, nervousness"),
    space(2),
    heading2("C. Attack Characteristics"),
    makeTable(
      ["Feature", "Detail"],
      [
        ["Onset", "Patient awakens from sleep with weakness (typical)"],
        ["Evolution", "Minutes to several hours"],
        ["Duration", "Few hours to several days (usually several hours)"],
        ["Frequency", "Several times/week to intervals of weeks–months"],
        ["Recovery", "Strength returns first to muscles LAST affected"],
        ["Post-attack", "Headache, exhaustion, diuresis may follow"],
      ],
      { colWidths: [3000, 6000] }
    ),
    space(2),
    heading2("D. Distribution of Weakness"),
    makeTable(
      ["Pattern", "Details"],
      [
        ["Proximal > Distal", "Proximal muscles more susceptible"],
        ["Legs > Arms", "Legs typically affected first"],
        ["Limbs > Trunk", "Limbs affected earlier and more severely"],
        ["SPARED muscles (usual)", "Eyes, face, tongue, pharynx, larynx, DIAPHRAGM, sphincters"],
        ["Reflexes", "Tendon reflexes REDUCED or ABSENT at peak; cutaneous reflexes may disappear"],
        ["Consciousness", "PRESERVED (key feature)"],
        ["Sensation", "PRESERVED (key feature)"],
        ["Myotonia", "ABSENT — presence of myotonia EXCLUDES HypoKPP"],
      ],
      { colWidths: [3000, 6000] }
    ),
    space(2),
    heading2("E. Severe / Rare Manifestations"),
    bullet("Respiratory paralysis (rare — potentially fatal)"),
    bullet("Cardiac arrhythmias and conduction disturbances"),
    bullet("Bulbar involvement (exceptional)"),
    space(2),
    heading2("F. Late Complications"),
    bullet("Progressive proximal vacuolar myopathy — permanent; develops in middle adult life"),
    bullet("Talipes deformity (some patients from early life)"),
    space(3),
  ];
}

// ─────────────────────────────────────────────────────────────────────────
// SECTION 5 — INVESTIGATIONS
// ─────────────────────────────────────────────────────────────────────────
function section5() {
  return [
    heading1("5. INVESTIGATIONS AND LABORATORY FINDINGS"),
    heading2("A. Serum Electrolytes"),
    bullet("Serum K+: LOW — often 1.8–3.5 mEq/L during attacks"),
    bullet("Urine K+: NOT elevated (intracellular shift, not renal loss)"),
    bullet("TTKG < 2–3 (distinguishes from renal K+ wasting where TTKG >4)"),
    bullet("Urine K+/Creatinine ratio < 2.5 mmol/mmol in HypoKPP vs. >4 in renal wasting"),
    bullet("Serum K+ returns to NORMAL during recovery"),
    space(2),
    heading2("B. ECG Changes (begin when K+ ~3 mEq/L)"),
    makeTable(
      ["ECG Finding", "Significance"],
      [
        ["Prolonged PR interval", "Conduction delay"],
        ["Prolonged QRS", "Intraventricular conduction delay"],
        ["Prolonged QT interval", "Risk of arrhythmia"],
        ["T-wave flattening", "Hypokalemia marker"],
        ["Prominent U waves", "Classic hypokalemia finding"],
        ["Bradycardia", "May occur during severe attacks"],
      ],
      { colWidths: [3500, 5500] }
    ),
    space(2),
    heading2("C. Electrophysiology (EMG/NCS)"),
    bullet("During attack: CMAP amplitudes REDUCED or absent; EMG electrically SILENT in paralyzed muscle"),
    bullet("Between attacks: Long Exercise Test"),
    bullet("Baseline CMAP recorded → exercise 5 min → CMAPs every minute (may show INCREMENT)", 1),
    bullet("10–20 min post-exercise: significant DECREMENT of CMAPs (>40%)", 1),
    bullet("Test not specific for subtype; genetic testing needed for confirmation", 1),
    space(2),
    heading2("D. Other Investigations"),
    makeTable(
      ["Test", "Indication / Finding"],
      [
        ["Thyroid function tests (TSH, T3, T4)", "MANDATORY at first presentation — screen for TPP"],
        ["Serum CK", "Mildly elevated during attacks"],
        ["Genetic testing (CACNA1S, SCN4A)", "Confirms specific subtype"],
        ["Muscle biopsy", "HypoKPP1: vacuoles; HypoKPP2: tubular aggregates"],
        ["Urine aldosterone / serum aldosterone", "If Conn syndrome suspected"],
      ],
      { colWidths: [3500, 5500] }
    ),
    space(2),
    heading2("E. Provocative Tests (when patient asymptomatic)"),
    bullet("Oral glucose 50–100 g OR 2 g NaCl/hr × 7 doses + vigorous exercise"),
    bullet("Monitor with continuous ECG throughout"),
    bullet("Attack terminated by 2–4 g oral KCl"),
    note("This is the OPPOSITE of HyperKPP — potassium terminates attacks in HypoKPP and precipitates them in HyperKPP."),
    space(2),
    heading2("F. Muscle Biopsy Findings"),
    makeTable(
      ["Type", "Histological Finding"],
      [
        ["HypoKPP1 (CACNA1S)", "Round/oval VACUOLES in sarcoplasm; PAS-positive granules; myofibril separation; increased glycogen; EM: proliferation/degeneration of SR and T-tubule membranes"],
        ["HypoKPP2 (SCN4A)", "TUBULAR AGGREGATES"],
        ["Both", "May be normal; or show non-specific myopathic changes"],
      ],
      { colWidths: [2500, 6500] }
    ),
    space(3),
  ];
}

// ─────────────────────────────────────────────────────────────────────────
// SECTION 6 — DIAGNOSIS & DIFFERENTIAL
// ─────────────────────────────────────────────────────────────────────────
function section6() {
  return [
    heading1("6. DIAGNOSIS & DIFFERENTIAL DIAGNOSIS"),
    heading2("A. Diagnostic Criteria"),
    bullet("Episodic muscle weakness with hypokalemia during attacks"),
    bullet("No urinary K+ wasting (TTKG < 2–3; urine K+/Cr < 2.5 mmol/mmol)"),
    bullet("Family history of periodic paralysis (in familial form)"),
    bullet("Age of onset: typically adolescence"),
    bullet("Characteristic triggers (exercise, carbohydrates, sleep)"),
    bullet("EMG: electrically silent muscle during attack"),
    bullet("Absence of myotonia"),
    bullet("Genetic confirmation: CACNA1S or SCN4A mutations"),
    space(2),
    heading2("B. Differential Diagnosis"),
    makeTable(
      ["Condition", "Distinguishing Feature"],
      [
        ["Hyperkalemic Periodic Paralysis", "K+ elevated; triggered by K+ supplementation; myotonia common"],
        ["Andersen-Tawil Syndrome", "Triad: weakness + arrhythmia + dysmorphic features"],
        ["Myasthenia Gravis", "Fatigable weakness; ocular/bulbar involvement; AChR antibodies"],
        ["Guillain-Barré Syndrome", "Ascending paralysis; CSF albuminocytological dissociation; no K+ change"],
        ["Thyrotoxic Periodic Paralysis", "High T3/T4; suppressed TSH; hyperthyroidism signs"],
        ["Primary Aldosteronism (Conn)", "Hypertension; hypernatremia; elevated aldosterone; TTKG >4"],
        ["RTA / Gitelman syndrome", "Metabolic acidosis/alkalosis with RENAL K+ wasting (TTKG >4)"],
        ["Paramyotonia Congenita", "Cold-induced weakness with MYOTONIA (paradoxical — worsens with exercise)"],
      ],
      { colWidths: [3500, 5500] }
    ),
    space(3),
  ];
}

// ─────────────────────────────────────────────────────────────────────────
// SECTION 7 — MANAGEMENT
// ─────────────────────────────────────────────────────────────────────────
function section7() {
  return [
    heading1("7. MANAGEMENT"),
    heading2("A. ACUTE ATTACK TREATMENT"),
    heading3("Oral Potassium (Preferred — First Line)"),
    bullet("KCl 0.2–0.4 mmol/kg orally every 30 minutes"),
    bullet("2–4 g oral KCl can terminate an attack"),
    bullet("May need 60–120 mEq total for a complete attack"),
    bullet("Mild attacks may not require treatment"),
    space(2),
    heading3("Intravenous Potassium (Only when oral route not possible)"),
    bullet("Indications: swallowing problems, vomiting, severe weakness"),
    bullet("Initial bolus: 0.05–0.1 mEq/kg at a safe rate"),
    bullet("Then: 20–40 mEq KCl in 5% MANNITOL as carrier"),
    note("CRITICAL: Use 5% mannitol — NEVER glucose (worsens hypokalemia via insulin) and NEVER NaCl (high sodium worsens attacks). Avoid glucose-containing IV fluids and hyperventilation (both lower serum K+)."),
    bullet("Monitor continuously with ECG; serial serum K+ measurements"),
    bullet("Watch for rebound hyperkalemia (especially in TPP)"),
    space(3),
    heading2("B. PROPHYLACTIC / PREVENTIVE TREATMENT"),
    heading3("Lifestyle Modifications"),
    makeTable(
      ["Measure", "Detail"],
      [
        ["Low-carbohydrate diet", "Avoid large carbohydrate loads"],
        ["Low-sodium diet", "< 160 mEq/day — reduces attack frequency"],
        ["Avoid intense exercise", "Especially followed by prolonged rest or sleep"],
        ["Avoid cold exposure", "Precipitates attacks"],
        ["Avoid triggers", "Corticosteroids, epinephrine, insulin where possible"],
        ["Regular moderate exercise", "To maintain fitness (not strenuous)"],
      ],
      { colWidths: [3000, 6000] }
    ),
    space(2),
    heading3("Pharmacological Prophylaxis"),
    makeTable(
      ["Drug", "Dose", "Mechanism", "Notes"],
      [
        ["Acetazolamide", "250 mg TID", "Carbonic anhydrase inhibitor; metabolic acidosis; influences K+ shifts", "FIRST-LINE for HypoKPP1. AVOID in HypoKPP2 (SCN4A) — may worsen. SE: digit tingling, nephrolithiasis, hypersensitivity."],
        ["Dichlorphenamide", "50–150 mg/day", "More potent carbonic anhydrase inhibitor (FDA-approved for HypoKPP + HyperKPP)", "Alternative to acetazolamide. RCT evidence (Sansone et al., 2016). Useful for progressive myopathy."],
        ["Spironolactone", "25–100 mg/day", "K+-sparing diuretic (aldosterone antagonist)", "When unresponsive to acetazolamide; adjunctive"],
        ["Triamterene", "25–100 mg/day", "K+-sparing diuretic", "Alternative to spironolactone; adjunctive"],
        ["Oral KCl supplements", "Variable", "Maintenance of serum K+ levels", "Adjunctive to diet modifications"],
      ],
      { colWidths: [1800, 1500, 3200, 2500] }
    ),
    space(2),
    note("Acetazolamide is paradoxically effective despite being kaliuretic. It likely works by producing metabolic acidosis, which influences the K+ shifts during attacks."),
    space(3),
    heading2("C. THYROTOXIC PERIODIC PARALYSIS — SPECIFIC MANAGEMENT"),
    bullet("Acute attack: KCl supplementation (limit aggressive repletion — 25% rebound hyperkalemia risk)"),
    bullet("Propranolol high-dose (3 mg/kg): rapidly reverses hypokalemia, hypophosphatemia, and paralysis — NO rebound hyperkalemia"),
    bullet("Definitive: Treat underlying hyperthyroidism — prevents recurrence completely"),
    bullet("Screen ALL new HypoKPP patients for thyroid disease (TSH, free T3/T4)"),
    space(3),
  ];
}

// ─────────────────────────────────────────────────────────────────────────
// SECTION 8 — COMPARISON TABLE
// ─────────────────────────────────────────────────────────────────────────
function section8() {
  return [
    heading1("8. COMPARISON TABLE — TYPES OF HYPOKALEMIC PERIODIC PARALYSIS"),
    makeTable(
      ["Feature", "HypoKPP Type 1", "HypoKPP Type 2", "Thyrotoxic PP"],
      [
        ["Gene", "CACNA1S", "SCN4A", "KCNJ18 (Kir2.6)"],
        ["Channel", "L-type Ca2+ (CaV1.1)", "Na+ (Nav1.4)", "K+ (Kir2.6)"],
        ["Chromosome", "1q31-32", "17q23.3", "17p11.1"],
        ["Inheritance", "Autosomal Dominant", "Autosomal Dominant", "AD (sporadic common)"],
        ["% of HypoKPP", "~70%", "10–20%", "Secondary"],
        ["Age of onset", "2nd decade", "Older", "Adult males"],
        ["Biopsy", "Vacuoles", "Tubular aggregates", "Non-specific"],
        ["Acetazolamide", "Helpful", "May WORSEN — AVOID", "Not indicated"],
        ["Post-attack myalgia", "Uncommon", "More common", "—"],
        ["Treatment", "K+, Acetazolamide", "K+, Dichlorphenamide", "K+ + Propranolol + Treat thyroid"],
      ],
      { colWidths: [2000, 2333, 2333, 2334] }
    ),
    space(3),
  ];
}

// ─────────────────────────────────────────────────────────────────────────
// SECTION 9 — HIGH-YIELD EXAM POINTS
// ─────────────────────────────────────────────────────────────────────────
function section9() {
  return [
    heading1("9. HIGH-YIELD EXAM POINTS"),
    new Paragraph({
      children: [new TextRun({ text: "KEY POINTS TO REMEMBER FOR UNIVERSITY EXAMINATION", bold: true, size: pt(11), color: C.accent, font: "Calibri" })],
      shading: { type: ShadingType.CLEAR, color: "auto", fill: C.accentBg },
      spacing: { before: pt(4), after: pt(4) },
      indent: { left: twip(0.3) },
    }),
    space(1),
    keyPoint("Most common mutation: Arg528His in DII S4 of CACNA1S gene (HypoKPP1)"),
    keyPoint("Mechanism: S4 voltage sensor mutations → aberrant gating pore → paradoxical depolarization → Na+ channel inactivation → paralysis"),
    keyPoint("Attack timing: classically early morning (1–6 AM), after exercise + carbohydrate-rich meal the night before"),
    keyPoint("Preserved in attacks: consciousness, sensation, ocular muscles, diaphragm (usually), sphincters"),
    keyPoint("Absent in attacks: tendon reflexes, motor nerve conduction, EMG activity"),
    keyPoint("No myotonia — presence of myotonia EXCLUDES HypoKPP"),
    keyPoint("K+ SHIFT (not loss) — urinary K+ NOT elevated; TTKG < 2–3"),
    keyPoint("ECG: T-wave flattening + prominent U waves + prolonged PR/QT"),
    keyPoint("IV fluid carrier: use 5% MANNITOL — NEVER glucose or saline"),
    keyPoint("Acetazolamide: works despite being kaliuretic; AVOID in HypoKPP2 (SCN4A)"),
    keyPoint("Dichlorphenamide: FDA-approved carbonic anhydrase inhibitor for both Hypo- and HyperKPP"),
    keyPoint("TPP: high-dose propranolol reverses attack; treat hyperthyroidism definitively"),
    keyPoint("Late complication: progressive proximal vacuolar myopathy"),
    keyPoint("Provocation test: glucose 50–100g + NaCl + exercise → attack; terminated by 2–4g KCl oral"),
    keyPoint("Histology HypoKPP1: vacuoles (SR + T-tubule degeneration); HypoKPP2: tubular aggregates"),
    space(3),
  ];
}

// ─────────────────────────────────────────────────────────────────────────
// SECTION 10 — PATHOPHYSIOLOGY FLOWCHART (text version)
// ─────────────────────────────────────────────────────────────────────────
function section10() {
  return [
    heading1("10. PATHOPHYSIOLOGY FLOWCHART"),
    new Paragraph({
      children: [new TextRun({ text: "STEP-BY-STEP MECHANISM OF PARALYSIS", bold: true, size: pt(11), color: C.medBlue, font: "Calibri" })],
      spacing: { before: pt(4), after: pt(6) },
    }),
    makeTable(
      ["Step", "Event", "Key Actor"],
      [
        ["1", "MUTATION in S4 voltage-sensor domain (CACNA1S / SCN4A)", "Arginine→Histidine substitution"],
        ["2", "Aberrant 'GATING PORE' formed in S4 domain", "Cation leak at resting potential"],
        ["3", "TRIGGER: Exercise → rest + carbohydrate load", "↑ Insulin secretion"],
        ["4", "↑ Na+/K+-ATPase activity + ↓ KATP channel activity", "Insulin effect on muscle"],
        ["5", "K+ shifts INTO muscle cells (intracellular sequestration)", "Net K+ influx"],
        ["6", "↓ Serum K+ (hypokalemia — as low as 1.8 mEq/L)", "Extracellular K+ depletion"],
        ["7", "Gating pore current active at hyperpolarized potential", "Cation leak (H+/Na+)"],
        ["8", "Paradoxical MEMBRANE DEPOLARIZATION", "NOT hyperpolarization as expected"],
        ["9", "Membrane potential → ~-50 mV (Cl- equilibrium)", "Na+ channels inactivated"],
        ["10", "Muscle ELECTRICALLY INEXCITABLE → PARALYSIS", "No action potential possible"],
        ["11", "Recovery: K+ redistributes out, membrane repolarizes, Na+ channels recover", "Normal physiology restores"],
      ],
      { colWidths: [600, 5700, 2700] }
    ),
    space(3),
    heading2("Why Paradoxical Depolarization?"),
    body("In normal physiology, hypokalemia would hyperpolarize the membrane (as K+ equilibrium potential becomes more negative). However, in HypoKPP, the increased Na+ conductance from the gating pore current overrides this effect and causes NET DEPOLARIZATION — this is the fundamental paradox that explains the disease mechanism."),
    space(3),
    hr(),
    space(2),
    new Paragraph({
      alignment: AlignmentType.CENTER,
      children: [new TextRun({ text: "Sources: Adams & Victor's Principles of Neurology 12e • Harrison's Principles of Internal Medicine 22e • Bradley & Daroff's Neurology in Clinical Practice • Brenner & Rector's The Kidney • Goldman-Cecil Medicine", size: pt(8.5), italics: true, color: C.gray, font: "Calibri" })],
    }),
  ];
}

// ─────────────────────────────────────────────────────────────────────────
// ASSEMBLE DOCUMENT
// ─────────────────────────────────────────────────────────────────────────
const doc = new Document({
  styles: {
    default: {
      document: {
        run: { font: "Calibri", size: pt(10.5), color: "000000" },
      },
    },
  },
  sections: [{
    properties: {
      page: {
        margin: { top: twip(2), bottom: twip(2), left: twip(2.5), right: twip(2.5) },
      },
    },
    headers: {
      default: new Header({
        children: [
          new Paragraph({
            children: [
              new TextRun({ text: "HYPOKALEMIC PERIODIC PARALYSIS — MD Medicine Notes", size: pt(8.5), color: C.gray, font: "Calibri" }),
            ],
            border: { bottom: { style: BorderStyle.SINGLE, size: 2, color: C.border } },
          }),
        ],
      }),
    },
    footers: {
      default: new Footer({
        children: [
          new Paragraph({
            alignment: AlignmentType.CENTER,
            children: [
              new TextRun({ text: "Page ", size: pt(9), color: C.gray, font: "Calibri" }),
              new TextRun({ children: [PageNumber.CURRENT], size: pt(9), color: C.gray, font: "Calibri" }),
              new TextRun({ text: " | Orris Medical Study Notes", size: pt(9), color: C.gray, font: "Calibri" }),
            ],
            border: { top: { style: BorderStyle.SINGLE, size: 2, color: C.border } },
          }),
        ],
      }),
    },
    children: [
      ...titleSection(),
      ...section1(),
      ...section2(),
      ...section3(),
      ...section4(),
      ...section5(),
      ...section6(),
      ...section7(),
      ...section8(),
      ...section9(),
      ...section10(),
    ],
  }],
});

Packer.toBuffer(doc).then(buffer => {
  fs.writeFileSync("/home/daytona/workspace/hypokalemic-pp/HypoKPP_MD_Medicine_Notes.docx", buffer);
  console.log("Done!");
});
Running Command

cd /home/daytona/workspace/hypokalemic-pp && node build.js

Running Command

python3 /home/daytona/skills/docx/scripts/office/validate.py /home/daytona/works…

Running Command

ls -lh /home/daytona/workspace/hypokalemic-pp/HypoKPP_MD_Medicine_Notes.docx && …

The document is valid and ready. Here it is:

HypoKPP MD Medicine Notes

Word Document · DOCX


What's inside the Word document:
SectionContent
Title PageTopic heading, speciality tags, source credits
Section 1Definition + quick-reference table
Section 2Full classification — HypoKPP1, HypoKPP2, Andersen-Tawil, Secondary causes (with TPP note)
Section 3Pathophysiology — gating pore theory, KATP channels, step-by-step attack table
Section 4Clinical features — triggers, prodrome, distribution, spared muscles, complications
Section 5Investigations — electrolytes, ECG, EMG/NCS, exercise test, muscle biopsy, provocative test
Section 6Diagnosis and differential diagnosis table
Section 7Management — acute attack (oral/IV KCl), prophylaxis table, TPP-specific management
Section 8Comparison table — HypoKPP1 vs 2 vs TPP
Section 915 high-yield exam key points
Section 10Pathophysiology flowchart (step table) + paradox explanation
Formatted with color-coded headings (dark blue/teal), alternating-row tables, red highlighted notes, and page headers/footers for easy navigation.
This is a shared conversation. Sign in to Orris to start your own chat.