Explain hypokalemic periodic paralysis,its types,Patho physiology and clinical features and management.add flow chart and diagram answer as per MD medicine university exam make notes

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

HYPOKALEMIC PERIODIC PARALYSIS (HypoKPP)

MD Medicine University Exam Notes


DEFINITION

Hypokalemic Periodic Paralysis is a channelopathy of skeletal muscle characterized by episodic attacks of flaccid muscle weakness or paralysis associated with a fall in serum potassium (due to shift of K+ into cells, not total body depletion). It is the most common form of periodic paralysis.

CLASSIFICATION / TYPES

A. PRIMARY (Familial / Genetic) Forms

FeatureType I (HypoKPP-1)Type II (HypoKPP-2)Andersen-Tawil Syndrome
GeneCACNA1S (chr 1q31-32)SCN4AKCNJ2
ChannelL-type Ca2+ channel (DHP receptor, alpha-1 subunit)Skeletal muscle Na+ channel (Nav1.4)Inwardly rectifying K+ channel (Kir2.1)
InheritanceAutosomal DominantAutosomal DominantAutosomal Dominant
Frequency~70% of cases~10% of casesRare
MutationArg→His substitution in S4 voltage sensor domainArg→His/Cys in S4 voltage sensor domainLoss-of-function
Response to acetazolamideUsually goodMay worsen with acetazolamideRequires separate management
Special featuresVacuoles in muscle biopsyTubular aggregates in muscle biopsyTriad: paralysis + cardiac arrhythmias + dysmorphic features

B. SECONDARY (Acquired) Forms

CauseNotes
Thyrotoxic Periodic Paralysis (TPP)Most common secondary cause; Asian males predominantly; KCNJ18 gene (Kir2.6) susceptibility
Hyperaldosteronism (Conn's syndrome)True K+ depletion
Renal tubular acidosis (distal)Urinary K+ wasting
Gitelman syndromeRenal K+ and Mg2+ wasting
Fanconi syndromeProximal tubular dysfunction
Barium poisoningBlocks K+ efflux channels
GI losses (diarrhea, fistulas)True K+ depletion
Insulin + glucose infusionK+ shift into cells

EPIDEMIOLOGY

  • Prevalence: ~1 in 100,000
  • Primary form onset: second decade (most common), can begin before age 10
  • Sex: Male >> Female (3-4:1 ratio); reduced penetrance in females
  • Secondary TPP: most common in young Asian males with hyperthyroidism

PATHOPHYSIOLOGY

Core Mechanism - Voltage Sensor Defect (Gating Pore Current)

╔══════════════════════════════════════════════════════════════════════╗
║          NORMAL CHANNEL FUNCTION                                     ║
║                                                                      ║
║  Ca2+/Na+ Channel → S4 Voltage Sensor → Normal gating               ║
║  Membrane potential maintained → Normal action potential generation  ║
╚══════════════════════════════════════════════════════════════════════╝

                          MUTATION
                    (Arg → His in S4 domain)
                             ↓
╔══════════════════════════════════════════════════════════════════════╗
║          MUTANT CHANNEL - "GATING PORE CURRENT"                     ║
║                                                                      ║
║  Arginine replaced by Histidine in S4 voltage sensor domain         ║
║  → Aberrant cation leak through voltage sensor pore                 ║
║  → Paradoxic depolarization in presence of low K+                   ║
║  → Inactivation of voltage-gated Na+ channels                       ║
║  → MUSCLE INEXCITABILITY → PARALYSIS                                 ║
╚══════════════════════════════════════════════════════════════════════╝

Step-by-Step Pathophysiology:

Step 1 - Trigger factors (carbohydrate load, rest after exercise, insulin, catecholamines):
  • Cause shift of K+ from extracellular into intracellular space (NOT total body K+ loss)
  • Serum K+ falls (may fall to 1.8-2.5 mEq/L during attacks)
  • Urinary K+ excretion does NOT increase proportionally
Step 2 - Role of reduced KATP channels:
  • Type I HypoKPP muscles have reduced activity of ATP-sensitive inwardly rectifying K+ channels (KATP)
  • Unopposed Na+/K+-ATPase activity further drives K+ into cells
  • Insulin inhibits remaining KATP activity → potentiates hypokalemia
Step 3 - Depolarization paradox:
  • Despite K+ entering muscle (which should hyperpolarize), muscle becomes paradoxically depolarized
  • Depolarizing shift toward Cl- equilibrium potential (~-50 mV)
  • At -50 mV, voltage-dependent Na+ channels become largely inactivated
  • Result: muscle fiber electrically and mechanically inexcitable
Step 4 - Structural changes:
  • Proliferation and degeneration of sarcoplasmic reticulum and T-tubules → vacuole formation
  • Electron microscopy: vacuoles arise from membranous organelles within SR and transverse tubules

Thyrotoxic Periodic Paralysis - Distinct Mechanism:

  • Linked to KCNJ18 gene mutation (Kir2.6 - a muscle-specific thyroid hormone-responsive K+ channel)
  • Thyroid hormones + adrenergic surge → increased Na+/K+-ATPase activity → K+ shift intracellularly
  • Thyroxine has no effect on primary HypoKPP (distinguishing feature)

PATHOPHYSIOLOGY DIAGRAM

    TRIGGER FACTORS
    ┌─────────────────────────────────────────────────────┐
    │ High carbohydrate meal → ↑Insulin                  │
    │ Rest after strenuous exercise                       │
    │ Epinephrine / Norepinephrine / Corticosteroids      │
    │ Excess sodium intake / Cold exposure                │
    └──────────────────┬──────────────────────────────────┘
                       │
                       ▼
          ┌────────────────────────┐
          │  K+ SHIFT INTO CELLS  │
          │  (not K+ depletion)    │
          └────────────┬───────────┘
                       │
          ┌────────────▼───────────┐
          │  ↓ Serum K+ (1.8-3.0  │
          │  mEq/L during attack)  │
          └────────────┬───────────┘
                       │
         ┌─────────────▼──────────────────┐
         │  MUTANT Ca2+/Na+ CHANNEL       │
         │  S4 voltage sensor defect      │
         │  → Gating pore cation leak     │
         └──────────────┬─────────────────┘
                        │
          ┌─────────────▼──────────────────┐
          │  PARADOXIC DEPOLARIZATION      │
          │  (-50 mV, near Cl- equilibrium)│
          └─────────────┬──────────────────┘
                        │
          ┌─────────────▼──────────────────┐
          │  Inactivation of voltage-gated  │
          │  Na+ channels (Nav1.4)         │
          └─────────────┬──────────────────┘
                        │
          ┌─────────────▼──────────────────┐
          │  MUSCLE INEXCITABILITY         │
          │  • Failed action potential     │
          │  • Absent EMG activity         │
          │  • Reduced/absent CMAPs        │
          └─────────────┬──────────────────┘
                        │
                        ▼
              ╔═════════════════╗
              ║   PARALYSIS     ║
              ╚═════════════════╝

CLINICAL FEATURES

Prodromal Symptoms (may precede attack):

  • Excessive hunger or thirst
  • Dry mouth, palpitation, sweating
  • Sense of weariness or fatigue, nervousness
  • Diarrhea (not always present)

During Attack:

Onset:
  • Typically in second half of night or early morning hours (after nocturnal K+ shift during sleep)
  • Can occur diurnally, especially after nap following a large meal
  • Evolves over minutes to hours
Distribution of Weakness:
FeatureDescription
PatternProximal > Distal; Legs before Arms
SeverityMild to total paralysis (unable to call for help)
Spared musclesEyes, face, tongue, pharynx, larynx, diaphragm, sphincters (usually)
ReflexesReduced or absent (tendon + cutaneous) at peak
DurationFew hours (mild) to several days (severe)
MyotoniaAbsent - if present, diagnose excludes HypoKPP
Cardiac Manifestations (ECG changes):
  • Occur when K+ falls to ~3 mEq/L
  • Prolonged PR interval
  • Prolonged QT interval
  • QRS widening
  • T-wave flattening
  • Prominent U waves
  • Rarely: bradycardia; fatal cardiac arrhythmias (pre-ICU era)
Between Attacks:
  • Patient completely normal initially
  • With advancing age: progressive proximal myopathy may develop (vacuolated, degenerated fibers)
  • Attacks most frequent in 3rd-4th decade, then frequency decreases with age

LABORATORY INVESTIGATIONS

TestFinding
Serum K+Low (1.8-3.0 mEq/L during attack); returns to normal between attacks
Urinary K+NOT significantly increased (shift, not depletion)
Serum CKNormal or mildly elevated
TFTs (TSH, T3, T4)Mandatory - rule out thyrotoxic PP
Serum Na+Usually normal
ABGpH may shift; check for RTA
ECGPR prolongation, T-wave flattening, prominent U waves
EMGSilent during attack (no MUAPs); myopathic between attacks
Nerve conductionReduced CMAP amplitudes (or absent) during paralysis
Genetic testingCACNA1S (Type I), SCN4A (Type II) mutations

Exercise Test (Long-exercise NCS protocol - McManis test):

  1. Record baseline ulnar CMAPs
  2. Patient exercises muscle for 5 minutes
  3. Record CMAPs at 1-minute intervals during exercise - may show increment (incremental response)
  4. Continue periodic recording for 30-40 minutes post-exercise
  5. Significant CMAP decrement 10-20 minutes post-exercise = positive (not specific for subtype)

Provocative Test (use carefully with cardiac monitoring):

  • Oral glucose 50-100 g OR
  • NaCl loading 2 g/hour x 7 doses + vigorous exercise
  • Induces attack → terminated by oral KCl 2-4 g

Muscle Biopsy:

TypeHistological Finding
General HypoKPPVacuolation of sarcoplasm (round/oval vacuoles with clear fluid + PAS-positive granules)
Type II (SCN4A)Tubular aggregates
Chronic/advancedMyopathic changes - segmental degeneration
Electron microscopyVacuoles arise from proliferation/degeneration of SR and T-tubule membranes

DIAGNOSTIC FLOWCHART

Patient presents with EPISODIC FLACCID WEAKNESS
                    │
          ┌─────────▼──────────┐
          │ Check serum K+     │
          │ during attack      │
          └──────┬──────┬──────┘
                 │      │
          ↓K+        Normal/↑K+
         (<3.5)         │
                 │      └──→ Consider HyperKPP / Paramyotonia
                 ▼
    ┌─────────────────────────────────┐
    │   HYPOKALEMIC PERIODIC PARALYSIS│
    └──────────────┬──────────────────┘
                   │
     ┌─────────────▼──────────────┐
     │ Check urine K+ & TFTs      │
     └────────┬──────────┬────────┘
              │          │
       Urinary K+    Urinary K+ LOW
       HIGH / TFTs   (shift) + TFTs
       abnormal      NORMAL
              │          │
              ▼          ▼
    ┌──────────────┐  ┌──────────────────────────┐
    │ SECONDARY PP │  │ PRIMARY/FAMILIAL HypoKPP │
    │              │  └──────────┬───────────────┘
    │ - Thyrotoxic │             │
    │ - RTA        │   ┌─────────▼────────────┐
    │ - Gitelman   │   │ Genetic Testing       │
    │ - Conn's     │   │ CACNA1S → Type I      │
    │ - Fanconi    │   │ SCN4A  → Type II      │
    └──────────────┘   │ KCNJ2  → Andersen-    │
                       │          Tawil Syndrome│
                       └──────────────────────-─┘

COMPARISON TABLE: PRIMARY vs THYROTOXIC PP

FeaturePrimary HypoKPPThyrotoxic PP
InheritanceAutosomal DominantNOT familial
Age of onsetAdolescence (2nd decade)Early adulthood
SexMale >> Female (3-4:1)Predominantly Asian males
EthnicityAnyAsian, Hispanic
TFTsNormalAbnormal (hyperthyroidism)
GeneCACNA1S / SCN4AKCNJ18 (Kir2.6) susceptibility
Response to thyroxine treatmentNo effect>90% remission
Acute treatmentOral KClOral KCl + propranolol
Preventive treatmentAcetazolamide, dichlorphenamideTreat hyperthyroidism

MANAGEMENT

A. ACUTE ATTACK MANAGEMENT

╔══════════════════════════════════════════════════╗
║           ACUTE ATTACK - STEP BY STEP            ║
╚══════════════════════════════════════════════════╝

Step 1: Confirm hypokalemia (serum K+)
Step 2: ECG monitoring (cardiac arrhythmias)
Step 3: Assess severity

    Mild attack                    Severe attack
    (can swallow)                  (severe weakness, vomiting)
         │                                   │
         ▼                                   ▼
Oral KCl 0.2-0.4 mmol/kg       IV KCl (only when oral route
every 30 minutes                not feasible; RARELY needed)
         │
         ▼
Monitor K+ and symptoms
         │
         ▼
Repeat oral KCl as needed
until attack resolves

NOTE: IV KCl must be given SLOWLY
      In dextrose-free, saline-based solution
      (glucose triggers further K+ shift!)
Key Cautions for K+ Replacement:
  • Avoid IV glucose/dextrose (worsens hypokalemia)
  • IV route used ONLY for swallowing problems or vomiting
  • Monitor renal function before potassium administration
  • Do NOT over-replace (rebound hyperkalemia risk)

B. PREVENTIVE / LONG-TERM MANAGEMENT

DrugDoseMechanismNotes
Acetazolamide (first-line)250 mg TIDCarbonic anhydrase inhibitor → mild metabolic acidosisWorks paradoxically despite being kaluretic; avoid in Type II HypoKPP (may worsen)
Dichlorphenamide (alternative)50-150 mg/dayMore potent carbonic anhydrase inhibitorFor acetazolamide non-responders
Spironolactone25-100 mg/dayK+-sparing diuretic (aldosterone antagonist)Alternative
Triamterene25-100 mg/dayK+-sparing diureticAlternative
Oral KCl supplementsAs neededK+ replacementCaution with K+-sparing diuretics simultaneously

C. NON-PHARMACOLOGICAL MEASURES

  • Low carbohydrate diet (avoids insulin-mediated K+ shift)
  • Low sodium diet (<160 mEq/day)
  • Avoid large meals (especially carbohydrate-rich)
  • Avoid intense/strenuous exercise followed by rest
  • Avoid exposure to cold
  • Avoid trigger medications: insulin, corticosteroids, catecholamines, beta-agonists

D. THYROTOXIC PP - Specific Management:

  • Oral KCl acutely (100-200 mg terminates episodes)
  • Propranolol 160 mg/day in divided doses (prevents attacks by blocking adrenergic K+ shift)
  • Treat hyperthyroidism (antithyroid drugs / radioiodine / surgery) - abolishes attacks in >90%

MANAGEMENT FLOWCHART

        HYPOKALEMIC PERIODIC PARALYSIS - MANAGEMENT

  ACUTE ATTACK                    PREVENTION
      │                               │
      ▼                               ▼
 Mild Attack                   Lifestyle Measures
 (K+ > 2.5 mEq/L)              ├── Low-carb diet
      │                         ├── Low-sodium diet
      ▼                         ├── Avoid intense exercise
 Oral KCl                       └── Avoid cold exposure
 0.2-0.4 mmol/kg                        │
 q 30 min                               ▼
      │                        Pharmacological Prevention
 Severe Attack                          │
 (K+ < 2.5 mEq/L,              ┌───────┴────────┐
 can't swallow)                 │                │
      │                    Type I HypoKPP   Type II HypoKPP
      ▼                    (CACNA1S)         (SCN4A)
 IV KCl (SLOW,                  │                │
 saline-based,             Acetazolamide    Dichlorphenamide
 ECG monitoring)           250 mg TID       50-150 mg/day
                           OR               OR K+-sparing
                           Dichlorphenamide  diuretics
                                │
                           If secondary TPP:
                           Propranolol +
                           Treat hyperthyroidism

KEY DIFFERENTIATING POINTS (High-Yield for Exams)

PointHypoKPPHyperKPP
GeneCACNA1S, SCN4ASCN4A
ChannelCa2+ (type I), Na+ (type II)Na+
Serum K+↑ or normal
TriggerCarbs, rest after exerciseFasting, rest after exercise, K+ intake
MyotoniaABSENTPRESENT
Attack durationHours to days30 min to hours
Onset2nd decade1st decade (infancy/childhood)
Acute RxKCl (oral/IV)Calcium gluconate, inhaled salbutamol, avoid KCl
PreventionAcetazolamideAcetazolamide, mexiletine

EXAM HIGH-YIELD POINTS (Summary Box)

Remember these 10 facts:
  1. HypoKPP Type I = CACNA1S mutation (Ca2+ channel); Type II = SCN4A (Na+ channel)
  2. Inheritance: Autosomal Dominant; males >> females (3-4:1)
  3. Onset: 2nd decade; attacks worst in 3rd-4th decade, improve with age
  4. Mechanism: K+ shift INTO cells (not total body depletion) + gating pore cation leak
  5. Triggers: carbohydrate meal, rest after exercise, insulin, corticosteroids, catecholamines
  6. Attacks: proximal > distal, legs before arms; SPARES cranial/respiratory muscles (usually)
  7. Myotonia is ABSENT - if present, exclude HypoKPP
  8. ECG: prolonged PR, QT; T-wave flattening; prominent U waves
  9. Acute treatment: oral KCl 0.2-0.4 mmol/kg q30 min (IV rarely needed)
  10. Prevention: Acetazolamide (Type I); avoid in Type II (may worsen)

SOURCES

  • Adams and Victor's Principles of Neurology, 12th Edition, pp. 1465-1466
  • Harrison's Principles of Internal Medicine 22E (2025), p. 3690
  • Brenner and Rector's The Kidney, 2-Volume Set, pp. 752-753
  • Bradley and Daroff's Neurology in Clinical Practice, pp. 2825-2826
  • Goldman-Cecil Medicine, International Edition

Create a Word document summary for quick reference during rounds and exams

Reading File
Running Command

mkdir -p /home/daytona/workspace/hypoKPP-doc && ls /home/daytona/workspace/hypoK…

Browsing Directory

/home/daytona/skills/docx

Writing File

~/hypoKPP-doc/generate.js

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

// ─── Colour palette ───────────────────────────────────────────────────────────
const BLUE_DARK   = "1F4E79";   // section heading bg
const BLUE_MID    = "2E75B6";   // sub-heading bg
const BLUE_LIGHT  = "DEEAF1";   // table header bg
const TEAL        = "00B0A0";   // flowchart boxes
const TEAL_LIGHT  = "E0F5F3";   // flowchart light fill
const YELLOW      = "FFF2CC";   // highlight/exam tip bg
const YELLOW_DRK  = "BF8F00";   // exam tip border text
const RED_LIGHT   = "FCE4D6";   // danger/caution bg
const GREEN_LIGHT = "E2EFDA";   // management bg
const WHITE       = "FFFFFF";
const BLACK       = "000000";
const GREY_TEXT   = "595959";

// ─── Helpers ──────────────────────────────────────────────────────────────────
function hBold(text, size = 24, color = WHITE) {
  return new TextRun({ text, bold: true, size, color, font: "Calibri" });
}
function run(text, opts = {}) {
  return new TextRun({ text, font: "Calibri", size: opts.size || 20, bold: opts.bold || false,
    color: opts.color || BLACK, italics: opts.italics || false,
    underline: opts.underline ? { type: UnderlineType.SINGLE } : undefined });
}
function bullet(text, bold_start) {
  const runs = [];
  if (bold_start) {
    const idx = text.indexOf(' ');
    runs.push(run(bold_start, { bold: true, size: 20 }));
    runs.push(run(text, { size: 20 }));
  } else {
    runs.push(run(text, { size: 20 }));
  }
  return new Paragraph({
    bullet: { level: 0 },
    children: bold_start
      ? [run(bold_start, { bold: true }), run(text)]
      : [run(text)],
  });
}
function subBullet(text) {
  return new Paragraph({ bullet: { level: 1 }, children: [run(text, { size: 18, color: GREY_TEXT })] });
}

// Section heading (dark blue bar)
function sectionHeading(text) {
  return new Paragraph({
    heading: HeadingLevel.HEADING_1,
    shading: { type: ShadingType.CLEAR, fill: BLUE_DARK },
    spacing: { before: 240, after: 80 },
    children: [hBold("  " + text, 26, WHITE)],
  });
}

// Sub-heading (mid-blue bar)
function subHeading(text) {
  return new Paragraph({
    heading: HeadingLevel.HEADING_2,
    shading: { type: ShadingType.CLEAR, fill: BLUE_MID },
    spacing: { before: 180, after: 60 },
    children: [hBold("  " + text, 22, WHITE)],
  });
}

// Normal paragraph
function para(text, opts = {}) {
  return new Paragraph({
    spacing: { before: 60, after: 60 },
    alignment: opts.center ? AlignmentType.CENTER : AlignmentType.LEFT,
    children: [run(text, opts)],
  });
}

// Shaded paragraph (exam tip box)
function tipBox(text) {
  return new Paragraph({
    shading: { type: ShadingType.CLEAR, fill: YELLOW },
    spacing: { before: 100, after: 100 },
    indent: { left: convertInchesToTwip(0.15), right: convertInchesToTwip(0.15) },
    children: [
      new TextRun({ text: "★ EXAM TIP  ", bold: true, color: YELLOW_DRK, size: 20, font: "Calibri" }),
      run(text, { size: 20 })
    ],
  });
}

// Caution box
function cautionBox(text) {
  return new Paragraph({
    shading: { type: ShadingType.CLEAR, fill: RED_LIGHT },
    spacing: { before: 80, after: 80 },
    indent: { left: convertInchesToTwip(0.15) },
    children: [
      new TextRun({ text: "⚠ CAUTION  ", bold: true, color: "C00000", size: 20, font: "Calibri" }),
      run(text, { size: 20 })
    ],
  });
}

// ─── Table builder ────────────────────────────────────────────────────────────
function makeTable(headers, rows, colWidths, fillHeader = BLUE_LIGHT) {
  const headerRow = new TableRow({
    tableHeader: true,
    children: headers.map((h, i) =>
      new TableCell({
        width: { size: colWidths[i], type: WidthType.DXA },
        shading: { type: ShadingType.CLEAR, fill: BLUE_MID },
        verticalAlign: VerticalAlign.CENTER,
        children: [new Paragraph({
          alignment: AlignmentType.CENTER,
          children: [hBold(h, 19, WHITE)],
        })],
      })
    ),
  });

  const dataRows = rows.map((row, ri) =>
    new TableRow({
      children: row.map((cell, ci) =>
        new TableCell({
          width: { size: colWidths[ci], type: WidthType.DXA },
          shading: { type: ShadingType.CLEAR, fill: ri % 2 === 0 ? WHITE : BLUE_LIGHT },
          verticalAlign: VerticalAlign.CENTER,
          children: [new Paragraph({
            spacing: { before: 40, after: 40 },
            children: typeof cell === 'string'
              ? [run(cell, { size: 19 })]
              : cell,
          })],
        })
      ),
    })
  );

  return new Table({
    width: { size: 100, type: WidthType.PERCENTAGE },
    rows: [headerRow, ...dataRows],
  });
}

// ─── Flowchart box row (text-based, monospaced-style) ─────────────────────────
function flowBox(text, fill = TEAL_LIGHT, borderColor = "00B0A0", bold = false) {
  return new Paragraph({
    alignment: AlignmentType.CENTER,
    shading: { type: ShadingType.CLEAR, fill },
    border: {
      top: { style: BorderStyle.SINGLE, size: 12, color: borderColor },
      bottom: { style: BorderStyle.SINGLE, size: 12, color: borderColor },
      left: { style: BorderStyle.SINGLE, size: 12, color: borderColor },
      right: { style: BorderStyle.SINGLE, size: 12, color: borderColor },
    },
    spacing: { before: 60, after: 0 },
    indent: { left: convertInchesToTwip(0.5), right: convertInchesToTwip(0.5) },
    children: [run(text, { bold, size: 19 })],
  });
}
function flowArrow() {
  return new Paragraph({
    alignment: AlignmentType.CENTER,
    spacing: { before: 0, after: 0 },
    children: [run("▼", { size: 22, color: "00B0A0", bold: true })],
  });
}
function flowSpacer() {
  return new Paragraph({ spacing: { before: 60, after: 60 }, children: [run("")] });
}

// ─── Page break ───────────────────────────────────────────────────────────────
function pageBreak() {
  return new Paragraph({ children: [new PageBreak()] });
}

// ═══════════════════════════════════════════════════════════════════════════════
//  DOCUMENT CONTENT
// ═══════════════════════════════════════════════════════════════════════════════
const children = [];

// ── COVER / TITLE ──────────────────────────────────────────────────────────────
children.push(
  new Paragraph({ spacing: { before: 600, after: 100 }, alignment: AlignmentType.CENTER,
    children: [new TextRun({ text: "HYPOKALEMIC PERIODIC PARALYSIS", bold: true, size: 52,
      color: BLUE_DARK, font: "Calibri" })] }),
  new Paragraph({ alignment: AlignmentType.CENTER, spacing: { before: 80, after: 80 },
    children: [new TextRun({ text: "MD Medicine — Quick Reference Notes", size: 30,
      color: BLUE_MID, bold: true, font: "Calibri" })] }),
  new Paragraph({ alignment: AlignmentType.CENTER, spacing: { before: 40, after: 400 },
    children: [new TextRun({ text: "Rounds & Examination Guide  |  Based on Harrison's • Adams & Victor's • Goldman-Cecil • Brenner & Rector's",
      size: 18, italics: true, color: GREY_TEXT, font: "Calibri" })] }),
  pageBreak(),
);

// ══════════════════════════════════════════════════════════════════════════════
// SECTION 1 — DEFINITION & OVERVIEW
// ══════════════════════════════════════════════════════════════════════════════
children.push(sectionHeading("1.  DEFINITION & OVERVIEW"));
children.push(para(
  "Hypokalemic Periodic Paralysis (HypoKPP) is a skeletal muscle channelopathy characterised by " +
  "episodic attacks of flaccid muscle weakness or paralysis associated with a FALL in serum " +
  "potassium — due to shift of K⁺ into cells, NOT total body depletion.", { size: 20 }
));
children.push(para("Most common form of periodic paralysis. Prevalence ≈ 1 in 100,000.", { size: 20 }));

children.push(tipBox("K+ shifts INWARD during attack — urinary K+ excretion is NOT significantly elevated. This distinguishes it from renal/GI K+ loss."));

// ══════════════════════════════════════════════════════════════════════════════
// SECTION 2 — CLASSIFICATION / TYPES
// ══════════════════════════════════════════════════════════════════════════════
children.push(sectionHeading("2.  CLASSIFICATION"));
children.push(subHeading("A. Primary (Familial / Genetic) Forms"));

children.push(makeTable(
  ["Feature", "Type I (HypoKPP-1)", "Type II (HypoKPP-2)", "Andersen-Tawil Syndrome"],
  [
    ["Gene", "CACNA1S  (chr 1q31-32)", "SCN4A", "KCNJ2"],
    ["Channel", "L-type Ca²⁺ channel\n(DHP receptor, α1 subunit)", "Nav1.4 (skeletal Na⁺ channel)", "Kir2.1 (inwardly rectifying K⁺)"],
    ["Inheritance", "Autosomal Dominant", "Autosomal Dominant", "Autosomal Dominant"],
    ["Frequency", "~70% of cases", "~10% of cases", "Rare"],
    ["Mutation", "Arg→His in S4 voltage sensor", "Arg→His/Cys in S4 domain", "Loss-of-function"],
    ["Muscle biopsy", "Vacuoles", "Tubular aggregates", "Variable"],
    ["Acetazolamide", "GOOD response", "May WORSEN — avoid!", "Special management"],
    ["Triad", "–", "–", "Paralysis + Arrhythmia + Dysmorphic features"],
  ],
  [1900, 2200, 2200, 2400]
));

children.push(para(""));
children.push(subHeading("B. Secondary (Acquired) Causes"));
children.push(makeTable(
  ["Cause", "Mechanism / Notes"],
  [
    ["Thyrotoxic Periodic Paralysis (TPP)", "Most important secondary cause; predominantly Asian/Hispanic males; KCNJ18 (Kir2.6) susceptibility; treat hyperthyroidism to cure"],
    ["Hyperaldosteronism (Conn's)", "True K⁺ depletion; elevated aldosterone"],
    ["Distal Renal Tubular Acidosis", "Urinary K⁺ wasting + non-anion-gap metabolic acidosis"],
    ["Gitelman Syndrome", "Renal K⁺ and Mg²⁺ wasting"],
    ["Fanconi Syndrome", "Proximal tubular dysfunction"],
    ["Barium Poisoning", "Blocks K⁺ efflux channels"],
    ["GI Losses (diarrhoea, fistulas)", "True K⁺ depletion"],
    ["Insulin + Glucose Infusion", "K⁺ shift into cells; can unmask susceptibility"],
  ],
  [3000, 5600]
));

children.push(tipBox("Newly diagnosed HypoKPP → ALWAYS check TFTs to rule out thyrotoxic periodic paralysis."));

// ══════════════════════════════════════════════════════════════════════════════
// SECTION 3 — EPIDEMIOLOGY
// ══════════════════════════════════════════════════════════════════════════════
children.push(sectionHeading("3.  EPIDEMIOLOGY"));
children.push(makeTable(
  ["Parameter", "Details"],
  [
    ["Prevalence", "~1 in 100,000"],
    ["Onset age", "2nd decade (most common); can start before age 10"],
    ["Sex ratio", "Male : Female = 3–4 : 1 (reduced penetrance in females)"],
    ["Attack peak", "3rd–4th decade; frequency decreases with advancing age"],
    ["TPP", "Young Asian males; also Hispanic; in setting of hyperthyroidism"],
  ],
  [3000, 5600]
));

// ══════════════════════════════════════════════════════════════════════════════
// SECTION 4 — PATHOPHYSIOLOGY
// ══════════════════════════════════════════════════════════════════════════════
children.push(pageBreak());
children.push(sectionHeading("4.  PATHOPHYSIOLOGY"));

children.push(subHeading("4.1  Core Mechanism — Voltage Sensor (S4) Mutation"));
children.push(para(
  "~90% of HypoKPP mutations involve SUBSTITUTION OF ARGININE in the S4 voltage-sensor " +
  "domain of L-type Ca²⁺ channels (Type I) or skeletal Na⁺ channels (Type II). This generates " +
  "an aberrant GATING PORE CURRENT — a cation leak through the voltage sensor — distinct from " +
  "the main ion-conducting pore.", { size: 20 }
));

children.push(subHeading("4.2  Step-by-Step Cascade"));
children.push(makeTable(
  ["Step", "Event", "Result"],
  [
    ["1", "Trigger factor (carb meal / rest after exercise / insulin / catecholamines)", "K⁺ shifts from ECF → ICF"],
    ["2", "Serum K⁺ falls to 1.8–3.0 mEq/L", "Urinary K⁺ NOT significantly raised (shift, not loss)"],
    ["3", "Mutant channel → gating pore cation leak", "Paradoxic depolarisation of membrane"],
    ["4", "Membrane potential shifts toward Cl⁻ equilibrium (~–50 mV)", "Voltage-gated Na⁺ channels (Nav1.4) become INACTIVATED"],
    ["5", "Reduced KATP channel activity (Type I) → unopposed Na⁺/K⁺-ATPase", "Further K⁺ influx into muscle; potentiated by insulin"],
    ["6", "Muscle electrically and mechanically inexcitable", "PARALYSIS — no EMG activity, absent CMAPs"],
  ],
  [600, 3600, 3000]
));

children.push(para(""));
children.push(subHeading("4.3  Thyrotoxic PP — Distinct Mechanism"));
children.push(para(
  "Thyroid hormones + adrenergic surge → ↑ Na⁺/K⁺-ATPase activity → massive K⁺ shift " +
  "into cells → paralysis. KCNJ18 (Kir2.6) gene confers susceptibility. " +
  "Thyroxine has NO effect on primary HypoKPP.", { size: 20 }
));
children.push(para(""));

// PATHOPHYSIOLOGY FLOWCHART
children.push(subHeading("4.4  Pathophysiology Flowchart"));
children.push(flowSpacer());
children.push(flowBox("TRIGGER FACTORS", BLUE_LIGHT, BLUE_MID, true));
children.push(new Paragraph({ alignment: AlignmentType.CENTER, children: [
  run("High-carb meal  |  Rest after exercise  |  Insulin  |  Catecholamines  |  Cold / NaCl load", { size: 18, italics: true, color: GREY_TEXT })
]}));
children.push(flowArrow());
children.push(flowBox("K⁺ SHIFTS INTO MUSCLE CELLS  (serum K⁺ → 1.8–3.0 mEq/L)", TEAL_LIGHT, "00B0A0", true));
children.push(flowArrow());
children.push(flowBox("MUTANT CHANNEL — Gating Pore Cation Leak\n(S4 Arg→His mutation; L-type Ca²⁺ or Nav1.4)", TEAL_LIGHT, "00B0A0"));
children.push(flowArrow());
children.push(flowBox("PARADOXIC DEPOLARISATION\n(Membrane → ~ −50 mV, near Cl⁻ equilibrium)", TEAL_LIGHT, "00B0A0"));
children.push(flowArrow());
children.push(flowBox("Inactivation of Voltage-Gated Na⁺ Channels  +  ↓ KATP activity", TEAL_LIGHT, "00B0A0"));
children.push(flowArrow());
children.push(flowBox("MUSCLE INEXCITABILITY\n(No action potential, silent EMG, absent CMAPs)", RED_LIGHT, "C00000", true));
children.push(flowArrow());
children.push(flowBox("FLACCID PARALYSIS", "C00000", "C00000", true));
children.push(new Paragraph({ spacing: { before: 60, after: 60 },
  alignment: AlignmentType.CENTER,
  children: [run("(proximal > distal, legs before arms; cranial/respiratory muscles usually spared)", { size: 18, italics: true, color: GREY_TEXT })]
}));
children.push(flowSpacer());

// ══════════════════════════════════════════════════════════════════════════════
// SECTION 5 — TRIGGERS
// ══════════════════════════════════════════════════════════════════════════════
children.push(pageBreak());
children.push(sectionHeading("5.  PRECIPITATING FACTORS"));
children.push(makeTable(
  ["Trigger Category", "Specific Triggers"],
  [
    ["Dietary", "High-carbohydrate meal, high-sodium meal, large meals"],
    ["Exercise-related", "Strenuous exercise FOLLOWED BY rest or sleep"],
    ["Hormonal", "Insulin secretion, corticosteroids, epinephrine, norepinephrine"],
    ["Sleep-related", "Ion shifts across muscle membrane during sleep → morning attacks"],
    ["Environmental", "Cold exposure"],
    ["Iatrogenic", "IV glucose infusion, beta-agonists, thiazide diuretics"],
  ],
  [3000, 5600]
));

// ══════════════════════════════════════════════════════════════════════════════
// SECTION 6 — CLINICAL FEATURES
// ══════════════════════════════════════════════════════════════════════════════
children.push(sectionHeading("6.  CLINICAL FEATURES"));
children.push(subHeading("6.1  Prodrome (may precede attack)"));
[
  "Excessive hunger or thirst, dry mouth",
  "Palpitations, sweating",
  "Sense of weariness, fatigue, nervousness",
  "Diarrhoea (occasional)",
].forEach(t => children.push(bullet(t)));

children.push(para(""));
children.push(subHeading("6.2  During the Attack"));
children.push(makeTable(
  ["Feature", "Description"],
  [
    ["Onset timing", "Typically 2nd half of night or early morning; also after daytime nap following a large meal"],
    ["Onset speed", "Evolves over minutes to several hours"],
    ["Weakness pattern", "Proximal > Distal;  Legs before Arms (usually);  bulbar/respiratory spared"],
    ["Severity", "Mild weakness → complete paralysis (unable to call for help)"],
    ["Reflexes", "Reduced or ABSENT tendon reflexes AND cutaneous reflexes at peak"],
    ["Myotonia", "ABSENT — if present, diagnosis of HypoKPP is excluded"],
    ["Duration", "Few hours (mild) to several days (severe)"],
    ["Serum K⁺", "1.8–3.0 mEq/L during attack"],
    ["Muscle feel", "May feel swollen, firm to palpation"],
    ["Recovery order", "Strength returns to LAST affected muscles first"],
    ["Post-attack", "Headache, exhaustion, diuresis, occasional diarrhoea"],
  ],
  [2800, 5800]
));

children.push(para(""));
children.push(subHeading("6.3  Cardiac Manifestations (ECG Changes)"));
children.push(para("ECG changes begin when K⁺ falls to ~3 mEq/L:", { size: 20 }));
children.push(makeTable(
  ["ECG Finding", "Significance"],
  [
    ["Prolonged PR interval", "First-degree AV block — conduction slowing"],
    ["QRS widening", "Intraventricular conduction delay"],
    ["Prolonged QT interval", "Risk of ventricular arrhythmia"],
    ["T-wave flattening", "Classic hypokalemia sign"],
    ["Prominent U waves", "Hallmark of hypokalemia"],
    ["Bradycardia (rare)", "Severe attacks; potentially fatal (pre-ICU era)"],
  ],
  [3200, 5400]
));
children.push(cautionBox("U waves + T-wave flattening on ECG in a young male with morning paralysis → THINK HypoKPP until proven otherwise."));

children.push(para(""));
children.push(subHeading("6.4  Chronic / Long-Term Features"));
[
  "Attacks most frequent in 3rd–4th decade, then decrease in frequency with age",
  "Progressive PROXIMAL MYOPATHY may develop in middle adult life (vacuolated fibres)",
  "Permanent weakness may ensue after repeated severe attacks",
  "Fatality is rare (respiratory paralysis / cardiac arrhythmia — mostly pre-ICU era)",
].forEach(t => children.push(bullet(t)));

// ══════════════════════════════════════════════════════════════════════════════
// SECTION 7 — INVESTIGATIONS
// ══════════════════════════════════════════════════════════════════════════════
children.push(pageBreak());
children.push(sectionHeading("7.  INVESTIGATIONS"));

children.push(subHeading("7.1  Blood & Urine Tests"));
children.push(makeTable(
  ["Investigation", "Expected Finding", "Significance"],
  [
    ["Serum K⁺", "↓ (1.8–3.0 mEq/L during attack)", "Confirms hypokalemia during attack"],
    ["Urinary K⁺", "NOT significantly increased", "Distinguishes shift from renal/GI loss"],
    ["Serum Na⁺", "Usually normal", "Baseline"],
    ["Serum Mg²⁺", "Check (hypomagnesaemia worsens hypokalemia)", "Important in refractory cases"],
    ["TFTs (TSH, T3, T4)", "Abnormal in TPP; normal in primary HypoKPP", "MANDATORY in all new cases"],
    ["Aldosterone / Renin", "Elevated in Conn's syndrome", "Rule out secondary causes"],
    ["Arterial Blood Gas", "Metabolic alkalosis in Conn's / Gitelman; non-AG acidosis in dRTA", "Aetiology"],
    ["Serum CK", "Normal or mildly elevated", "Distinguishes from myositis"],
    ["Blood glucose / Insulin", "Usually normal", "Can unmask susceptibility"],
    ["Genetic testing", "CACNA1S (Type I), SCN4A (Type II), KCNJ2 (ATS)", "Confirms subtype"],
  ],
  [2400, 2800, 3200]
));

children.push(para(""));
children.push(subHeading("7.2  Electrodiagnostic Studies"));
children.push(makeTable(
  ["Test", "Findings in HypoKPP"],
  [
    ["EMG (during attack)", "SILENT — no motor unit action potentials (MUAPs); muscle electrically inexcitable"],
    ["Nerve Conduction (during attack)", "Reduced or ABSENT CMAP amplitudes; motor conduction velocity preserved"],
    ["Long-Exercise NCS (McManis test)", "CMAP increment during exercise (50% of patients); then SIGNIFICANT DECREMENT 10–20 min post-exercise"],
    ["EMG (between attacks)", "Myopathic changes in chronic disease; NO myotonic discharges"],
  ],
  [2800, 5800]
));

children.push(para(""));
children.push(subHeading("7.3  Muscle Biopsy"));
children.push(makeTable(
  ["HypoKPP Type", "Histological Findings"],
  [
    ["General / Acute", "Uniform enlargement of muscle fibres; VACUOLES (round/oval, clear fluid ± PAS-positive granules) in sarcoplasm"],
    ["Type II (SCN4A)", "TUBULAR AGGREGATES — key distinguishing feature"],
    ["Chronic/Advanced", "Myopathic changes: segmental degeneration, necrosis"],
    ["Electron Microscopy", "Vacuoles arise from proliferation/degeneration of SR and T-tubule membranes"],
  ],
  [2400, 6200]
));

children.push(para(""));
children.push(subHeading("7.4  Provocative Test (Supervised, with ECG monitoring)"));
children.push(para("ONLY when diagnosis unclear and patient is between attacks:", { size: 20, bold: true }));
[
  "Oral glucose 50–100 g  OR  NaCl 2 g/hour × 7 doses + vigorous exercise",
  "Induces attack → terminated by oral KCl 2–4 g",
  "Opposite response in HyperKPP (KCl worsens, not terminates)",
].forEach(t => children.push(bullet(t)));
children.push(cautionBox("Provocative test must be done with continuous ECG monitoring and IV KCl ready at bedside."));

// ══════════════════════════════════════════════════════════════════════════════
// SECTION 8 — DIAGNOSTIC FLOWCHART
// ══════════════════════════════════════════════════════════════════════════════
children.push(pageBreak());
children.push(sectionHeading("8.  DIAGNOSTIC FLOWCHART"));
children.push(flowSpacer());

children.push(flowBox("Patient: Episodic Flaccid Weakness / Paralysis", BLUE_LIGHT, BLUE_MID, true));
children.push(flowArrow());
children.push(flowBox("Check Serum K⁺ DURING ATTACK", TEAL_LIGHT, "00B0A0", true));
children.push(flowArrow());

// Split decision
children.push(new Paragraph({ alignment: AlignmentType.CENTER, spacing: { before: 20, after: 20 },
  children: [
    run("K⁺ LOW  (<3.5 mEq/L)", { bold: true, color: "C00000", size: 20 }),
    run("                                   ", {}),
    run("K⁺ NORMAL / HIGH", { bold: true, color: BLUE_DARK, size: 20 }),
  ]
}));
children.push(new Paragraph({ alignment: AlignmentType.CENTER, children: [
  run("↓                                                             ↓", { size: 20, color: GREY_TEXT })
]}));
children.push(new Paragraph({ alignment: AlignmentType.CENTER, children: [
  run("HYPOKALEMIC PP                            HyperKPP / Paramyotonia Congenita", { size: 19, color: GREY_TEXT, italics: true })
]}));
children.push(flowArrow());
children.push(flowBox("Check: Urinary K⁺  |  TFTs  |  Aldosterone/Renin  |  ABG  |  Serum Mg²⁺", TEAL_LIGHT, "00B0A0"));
children.push(flowArrow());

children.push(new Paragraph({ alignment: AlignmentType.CENTER, spacing: { before: 20, after: 20 },
  children: [
    run("TFTs ABNORMAL", { bold: true, color: "C00000", size: 20 }),
    run("              ←——→             ", { size: 20 }),
    run("TFTs NORMAL", { bold: true, color: "007030", size: 20 }),
  ]
}));
children.push(new Paragraph({ alignment: AlignmentType.CENTER, children: [
  run("↓                                                                         ↓", { size: 20, color: GREY_TEXT })
]}));
children.push(new Paragraph({ alignment: AlignmentType.CENTER, children: [
  run("THYROTOXIC PP                                              PRIMARY (Familial) HypoKPP", { size: 19, italics: true, color: GREY_TEXT })
]}));

children.push(flowArrow());
children.push(flowBox("Genetic Testing:  CACNA1S → Type I  |  SCN4A → Type II  |  KCNJ2 → Andersen-Tawil Syndrome", BLUE_LIGHT, BLUE_MID));
children.push(flowSpacer());

// ══════════════════════════════════════════════════════════════════════════════
// SECTION 9 — MANAGEMENT
// ══════════════════════════════════════════════════════════════════════════════
children.push(pageBreak());
children.push(sectionHeading("9.  MANAGEMENT"));

children.push(subHeading("9.1  Acute Attack Treatment"));
children.push(makeTable(
  ["Situation", "Treatment", "Dose / Detail"],
  [
    ["Mild attack (can swallow)", "Oral KCl", "0.2–0.4 mmol/kg every 30 min; monitor K⁺ and ECG"],
    ["Severe attack / vomiting / dysphagia", "IV KCl (RARE)", "Slow IV in SALINE (NOT dextrose); continuous ECG monitoring"],
    ["Cardiac arrhythmia", "ECG monitoring + KCl replacement + consider ICU", "Treat K⁺ deficit promptly"],
    ["Thyrotoxic PP — acute", "Oral KCl + Propranolol", "Propranolol 40 mg stat; blocks adrenergic K⁺ shift"],
  ],
  [2400, 2400, 3800]
));
children.push(cautionBox("NEVER give IV K⁺ in dextrose solution — glucose + insulin will worsen K⁺ shift and deepen paralysis."));
children.push(cautionBox("IV KCl is very rarely needed. Oral route is preferred and sufficient in most cases."));

children.push(para(""));
children.push(subHeading("9.2  Long-Term Pharmacological Prevention"));
children.push(makeTable(
  ["Drug", "Dose", "Mechanism", "Use in subtype", "Key Notes"],
  [
    ["Acetazolamide", "250 mg TID", "Carbonic anhydrase inhibitor → mild metabolic acidosis", "Type I (FIRST LINE)", "AVOID in Type II — may worsen attacks; kaluretic but works via acidosis"],
    ["Dichlorphenamide", "50–150 mg/day", "More potent carbonic anhydrase inhibitor", "Type I & II (alternative)", "For acetazolamide non-responders or intolerance"],
    ["Spironolactone", "25–100 mg/day", "K⁺-sparing diuretic (aldosterone antagonist)", "Alternative for both types", "Caution with oral K⁺ supplements simultaneously"],
    ["Triamterene", "25–100 mg/day", "K⁺-sparing diuretic", "Alternative", "Same caution as spironolactone"],
    ["Propranolol", "160 mg/day divided", "Blocks adrenergic K⁺ shift (Na/K-ATPase)", "Thyrotoxic PP", "Prevents attacks; treat underlying thyroid disease"],
  ],
  [1600, 1200, 2200, 1600, 2400]
));
children.push(tipBox("Type II HypoKPP (SCN4A mutation) → use Dichlorphenamide, NOT Acetazolamide (which can worsen this type)."));

children.push(para(""));
children.push(subHeading("9.3  Non-Pharmacological Measures"));
children.push(makeTable(
  ["Measure", "Rationale"],
  [
    ["Low-carbohydrate diet", "Reduces insulin-mediated K⁺ shift into cells"],
    ["Low-sodium diet  (<160 mEq/day)", "Reduces osmotic and hormonal triggers"],
    ["Avoid large meals", "Prevents post-prandial insulin surge"],
    ["Avoid intense exercise followed by rest", "Classic trigger — exercise OK if no prolonged rest after"],
    ["Avoid cold exposure", "Cold can precipitate attacks, especially in TPP"],
    ["Avoid trigger drugs", "Insulin, corticosteroids, beta-agonists, thiazides, glucose infusion"],
    ["Treat thyroid disease (TPP)", "Definitive cure — abolishes attacks in >90%"],
  ],
  [3200, 5400]
));

// MANAGEMENT FLOWCHART
children.push(para(""));
children.push(subHeading("9.4  Management Flowchart"));
children.push(flowSpacer());
children.push(flowBox("HYPOKALEMIC PERIODIC PARALYSIS — CONFIRMED", BLUE_LIGHT, BLUE_MID, true));
children.push(flowArrow());
children.push(new Paragraph({ alignment: AlignmentType.CENTER, children: [
  run("ACUTE ATTACK                                                     BETWEEN ATTACKS", { bold: true, size: 20, color: BLUE_DARK })
]}));
children.push(new Paragraph({ alignment: AlignmentType.CENTER, children: [
  run("↓                                                                            ↓", { size: 20, color: GREY_TEXT })
]}));
children.push(new Paragraph({ alignment: AlignmentType.CENTER, children: [
  run("ECG monitoring + Serum K⁺                      Lifestyle + Pharmacoprevention", { size: 19, italics: true, color: GREY_TEXT })
]}));
children.push(new Paragraph({ alignment: AlignmentType.CENTER, children: [
  run("↓", { size: 20, color: GREY_TEXT })
]}));
children.push(new Paragraph({ alignment: AlignmentType.CENTER, children: [
  run("Mild: Oral KCl 0.2–0.4 mmol/kg q30 min     Type I → Acetazolamide 250 mg TID", { size: 19, color: GREY_TEXT })
]}));
children.push(new Paragraph({ alignment: AlignmentType.CENTER, children: [
  run("Severe: IV KCl (saline, slow, ECG monitor)   Type II → Dichlorphenamide 50–150 mg/day", { size: 19, color: GREY_TEXT })
]}));
children.push(new Paragraph({ alignment: AlignmentType.CENTER, children: [
  run("TPP: Oral KCl + Propranolol                  TPP → Treat hyperthyroidism", { size: 19, color: GREY_TEXT })
]}));
children.push(flowSpacer());

// ══════════════════════════════════════════════════════════════════════════════
// SECTION 10 — COMPARISON TABLES
// ══════════════════════════════════════════════════════════════════════════════
children.push(pageBreak());
children.push(sectionHeading("10.  COMPARISON TABLES"));

children.push(subHeading("10.1  Primary HypoKPP vs Thyrotoxic PP"));
children.push(makeTable(
  ["Feature", "Primary HypoKPP", "Thyrotoxic PP"],
  [
    ["Inheritance", "Autosomal Dominant", "NOT familial"],
    ["Age of onset", "2nd decade (adolescence)", "Early adulthood"],
    ["Sex", "Male >> Female (3–4:1)", "Predominantly Asian males"],
    ["Ethnicity", "Any", "Asian, Hispanic predominantly"],
    ["TFTs", "NORMAL", "ABNORMAL (hyperthyroidism)"],
    ["Gene involved", "CACNA1S / SCN4A", "KCNJ18 (Kir2.6 susceptibility)"],
    ["Serum K⁺ in attack", "Low", "Low"],
    ["Acute treatment", "Oral KCl", "Oral KCl + Propranolol"],
    ["Prevention", "Acetazolamide / Dichlorphenamide", "Treat hyperthyroidism (>90% cure)"],
    ["Effect of thyroxine", "NO effect", "Definitive treatment"],
  ],
  [2400, 3300, 3300]
));

children.push(para(""));
children.push(subHeading("10.2  HypoKPP vs HyperKPP — Key Distinctions"));
children.push(makeTable(
  ["Feature", "HypoKPP", "HyperKPP"],
  [
    ["Gene", "CACNA1S (I), SCN4A (II)", "SCN4A"],
    ["Channel", "Ca²⁺ (Type I), Na⁺ (Type II)", "Na⁺"],
    ["Serum K⁺", "LOW (<3.5 mEq/L)", "HIGH or NORMAL"],
    ["Trigger", "Carbs, rest after exercise", "Fasting, rest, K⁺ intake"],
    ["Myotonia", "ABSENT", "PRESENT (EMG myotonic discharges)"],
    ["Attack duration", "Hours to days", "30 min to hours"],
    ["Onset age", "2nd decade", "1st decade (infancy/childhood)"],
    ["Acute Rx", "KCl (oral/IV)", "Ca²⁺ gluconate, salbutamol inhaled; AVOID KCl"],
    ["Prevention", "Acetazolamide (Type I)", "Acetazolamide, Mexiletine (for myotonia)"],
  ],
  [2400, 2800, 2800]
));

// ══════════════════════════════════════════════════════════════════════════════
// SECTION 11 — EXAM HIGH-YIELD SUMMARY
// ══════════════════════════════════════════════════════════════════════════════
children.push(pageBreak());
children.push(sectionHeading("11.  HIGH-YIELD EXAM SUMMARY"));

const examPoints = [
  "HypoKPP Type I = CACNA1S (Ca²⁺ channel); Type II = SCN4A (Na⁺ channel) — both autosomal dominant",
  "Male >> Female (3–4:1); onset in 2nd decade; attacks worst in 3rd–4th decade, then improve",
  "Mechanism: K⁺ shifts INTO cells (NOT total body depletion) + gating pore cation leak from S4 mutation",
  "Classic triggers: carbohydrate meal, rest after exercise, insulin, corticosteroids, catecholamines",
  "Attacks: proximal > distal, legs before arms; SPARES cranial, respiratory, sphincter muscles (usually)",
  "MYOTONIA IS ABSENT — presence of myotonia EXCLUDES the diagnosis of HypoKPP",
  "ECG: prolonged PR + QT, T-wave flattening, PROMINENT U WAVES (hallmark of hypokalemia)",
  "K⁺ during attack: 1.8–3.0 mEq/L; returns to NORMAL between attacks",
  "Acute Rx: ORAL KCl 0.2–0.4 mmol/kg q30 min; IV only when oral route impossible",
  "NEVER give K⁺ in dextrose — worsens paralysis!",
  "Prevention: Acetazolamide (Type I first-line); AVOID acetazolamide in Type II (use Dichlorphenamide)",
  "All new cases → MANDATORY TFTs to exclude Thyrotoxic PP",
  "TPP: treated with Propranolol + treat hyperthyroidism (abolishes attacks in >90%)",
  "Muscle biopsy: vacuoles (Type I); tubular aggregates (Type II)",
  "Andersen-Tawil Syndrome (KCNJ2): Triad = Paralysis + Cardiac arrhythmias (long QT, bidirectional VT) + Dysmorphic features",
];

examPoints.forEach((pt, i) => {
  children.push(new Paragraph({
    shading: { type: ShadingType.CLEAR, fill: i % 2 === 0 ? YELLOW : GREEN_LIGHT },
    spacing: { before: 40, after: 40 },
    indent: { left: convertInchesToTwip(0.15) },
    children: [
      new TextRun({ text: `${i + 1}.  `, bold: true, size: 20, color: BLUE_DARK, font: "Calibri" }),
      run(pt, { size: 20 }),
    ],
  }));
});

// ── SOURCES ───────────────────────────────────────────────────────────────────
children.push(para(""));
children.push(subHeading("References"));
[
  "Adams and Victor's Principles of Neurology, 12th Edition",
  "Harrison's Principles of Internal Medicine, 22nd Edition (2025)",
  "Brenner and Rector's The Kidney, 2-Volume Set",
  "Bradley and Daroff's Neurology in Clinical Practice",
  "Goldman-Cecil Medicine, International Edition",
].forEach(r => children.push(bullet(r)));

// ═══════════════════════════════════════════════════════════════════════════════
//  ASSEMBLE DOCUMENT
// ═══════════════════════════════════════════════════════════════════════════════
const doc = new Document({
  creator: "Orris MD Notes",
  title: "Hypokalemic Periodic Paralysis — MD Medicine Quick Reference",
  description: "Comprehensive MD Medicine exam notes on HypoKPP",
  styles: {
    default: {
      document: { run: { font: "Calibri", size: 20 } },
    },
  },
  sections: [{
    properties: {
      page: {
        margin: {
          top: convertInchesToTwip(0.9),
          bottom: convertInchesToTwip(0.9),
          left: convertInchesToTwip(1.0),
          right: convertInchesToTwip(1.0),
        },
      },
    },
    headers: {
      default: new Header({
        children: [new Paragraph({
          alignment: AlignmentType.RIGHT,
          children: [
            new TextRun({ text: "HypoKPP — MD Medicine Quick Reference  |  ", size: 16, color: GREY_TEXT, font: "Calibri" }),
            new TextRun({ children: [PageNumber.CURRENT], size: 16, color: GREY_TEXT, font: "Calibri" }),
          ],
        })],
      }),
    },
    footers: {
      default: new Footer({
        children: [new Paragraph({
          alignment: AlignmentType.CENTER,
          children: [new TextRun({ text: "Sources: Harrison's 22E | Adams & Victor's 12E | Goldman-Cecil | Brenner & Rector's", size: 16, italics: true, color: GREY_TEXT, font: "Calibri" })],
        })],
      }),
    },
    children,
  }],
});

Packer.toBuffer(doc).then(buf => {
  fs.writeFileSync("/home/daytona/workspace/hypoKPP-doc/HypoKPP_MD_Medicine_Notes.docx", buf);
  console.log("SUCCESS: File written.");
}).catch(err => { console.error("ERROR:", err); process.exit(1); });
Running Command

cd /home/daytona/workspace/hypoKPP-doc && node generate.js 2>&1

Running Command

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

Running Command

cd /home/daytona/workspace/hypoKPP-doc && python3 -c " import zipfile, os z = zi…

Running Command

ls -lh /home/daytona/workspace/hypoKPP-doc/HypoKPP_MD_Medicine_Notes.docx

Your Word document is ready for download:

HypoKPP MD Medicine Notes

Word Document · DOCX


Here is what is packed inside the document:
Structure (11 sections, ~15 pages):
SectionContent
Cover pageTitle + source attribution
1. DefinitionCore concept with exam tip box on K⁺ shift
2. ClassificationFull table - Type I / II / Andersen-Tawil + Secondary causes table
3. EpidemiologyAge, sex, ethnicity breakdown
4. PathophysiologyStep-by-step cascade table + colour-coded flowchart (trigger → paralysis)
5. TriggersCategorised table (dietary, exercise, hormonal, environmental, iatrogenic)
6. Clinical FeaturesProdrome, attack features, ECG changes table, chronic course
7. InvestigationsBloods/urine, EMG/NCS, muscle biopsy, provocative test
8. Diagnostic FlowchartBranched decision pathway from weakness → genetic subtype
9. ManagementAcute attack table + drug prevention table + non-pharmacological + management flowchart
10. Comparison TablesHypoKPP vs TPP; HypoKPP vs HyperKPP
11. Exam High-Yield15 colour-alternating numbered exam points (yellow/green)
Formatting features:
  • Dark blue / mid-blue section headers
  • Colour-coded flowcharts (teal boxes, red for danger, yellow for exam tips)
  • Alternating row shading in all tables
  • Red caution boxes for critical drug errors (no dextrose with K⁺, avoid acetazolamide in Type II)
  • Running header with page numbers, footer with references
  • All content sourced from Harrison's 22E, Adams & Victor's 12E, Goldman-Cecil, and Brenner & Rector's
attachment
attachment

Kindly give answer as MD medicine university exam Add diagrams and flow chart and make notes in word format

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

Kindly give answer as MD medicine university exam Add diagrams and flow chart and make notes in word format

Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Running Command

mkdir -p /home/daytona/workspace/mpmc-exam && echo "dir ready"

This is a shared conversation. Sign in to Orris to start your own chat.