Give me nerve wise muscle supply which nerve supplies which muscles in upper limb and lower limb

Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Finding Sources
Finding Sources
Reading File
Finding Sources
Loading Image
I now have all the information needed for a comprehensive answer. Here is the complete nerve-wise muscle supply for the upper and lower limbs:

Nerve-wise Muscle Supply: Upper & Lower Limb

Source: General Anatomy and Musculoskeletal System, THIEME Atlas; ROSEN's Emergency Medicine
Brachial plexus and upper limb nerves

UPPER LIMB

The brachial plexus (C5-T1) gives rise to all major nerves of the upper limb. Nerves from the posterior divisions (radial, axillary) supply extensors; nerves from the anterior divisions (musculocutaneous, median, ulnar) supply flexors.

1. Musculocutaneous Nerve (C5, C6, C7)

MuscleAction
CoracobrachialisFlexion & adduction of arm
Biceps brachiiElbow flexion, forearm supination
BrachialisElbow flexion
Mnemonic: "BBC" - Brachialis, Biceps, Coracobrachialis

2. Median Nerve (C6, C7, C8, T1)

In the forearm (via Anterior Interosseous Nerve branch):
MuscleAction
Pronator teresPronation
Flexor carpi radialisWrist flexion + radial deviation
Palmaris longusWrist flexion
Flexor digitorum superficialisFlexion of middle phalanges (digits 2-5)
Flexor digitorum profundus (lateral half - digits 2, 3)Flexion of distal phalanges
Flexor pollicis longusFlexion of thumb IP joint
Pronator quadratusPronation
In the hand (LOAF muscles):
MuscleAction
Lateral two lumbricals (1st & 2nd)MCP flexion, IP extension of digits 2 & 3
Opponens pollicisOpposition of thumb
Abductor pollicis brevisAbduction of thumb
Flexor pollicis brevis (superficial head)Flexion of thumb MCP
Mnemonic: "LOAF" - Lumbricals (1&2), Opponens pollicis, Abductor pollicis brevis, Flexor pollicis brevis (superficial head)
Clinical test: Thumb opposition / "A-OK" sign / pincer function (thumb + index finger)

3. Ulnar Nerve (C7, C8, T1)

In the forearm:
MuscleAction
Flexor carpi ulnarisWrist flexion + ulnar deviation
Flexor digitorum profundus (medial half - digits 4, 5)Flexion of distal phalanges of ring & little fingers
In the hand:
MuscleAction
Hypothenar muscles: Abductor digiti minimi, Flexor digiti minimi, Opponens digiti minimiLittle finger movements
Medial two lumbricals (3rd & 4th)MCP flexion, IP extension of digits 4 & 5
All dorsal interossei (4)Finger abduction (DAB)
All palmar interossei (3)Finger adduction (PAD)
Adductor pollicisAdduction of thumb
Flexor pollicis brevis (deep head)Flexion of thumb MCP
Palmaris brevisSkin wrinkling at hypothenar
Mnemonic: "All muscles in hand EXCEPT LOAF" = Ulnar nerve
Clinical test: Finger abduction/adduction; Froment's sign (adductor pollicis weakness)

4. Radial Nerve (C5-C8, T1)

In the arm:
MuscleAction
Triceps brachii (all 3 heads)Elbow extension
BrachioradialisElbow flexion (midpronation)
AnconeusElbow extension (assists triceps)
Extensor carpi radialis longusWrist extension + radial deviation
In the forearm (via Posterior Interosseous Nerve - deep branch):
MuscleAction
Extensor carpi radialis brevisWrist extension
SupinatorSupination of forearm
Extensor digitorumExtension of digits 2-5
Extensor digiti minimiExtension of little finger
Extensor carpi ulnarisWrist extension + ulnar deviation
Abductor pollicis longusAbduction + extension of thumb
Extensor pollicis longusExtension of thumb IP joint
Extensor pollicis brevisExtension of thumb MCP joint
Extensor indicisIndependent extension of index finger
Mnemonic: "BEST - Brachioradialis, Extensors (wrist & fingers), Supinator, Triceps"
Clinical test: Wrist extension / "Thumbs-up" sign

5. Axillary Nerve (C5, C6)

MuscleAction
Deltoid (all 3 parts)Shoulder abduction (middle), flexion (anterior), extension (posterior)
Teres minorLateral rotation of arm

6. Suprascapular Nerve (C5, C6)

MuscleAction
SupraspinatusShoulder abduction (initiates first 15°)
InfraspinatusLateral rotation of arm

7. Dorsal Scapular Nerve (C5)

MuscleAction
Rhomboid majorRetraction + elevation of scapula
Rhomboid minorRetraction + elevation of scapula
Levator scapulae (partial)Elevation of scapula

8. Long Thoracic Nerve (C5, C6, C7)

MuscleAction
Serratus anteriorProtraction + rotation of scapula (holds scapula against thorax)
"Winged scapula" results from long thoracic nerve injury

9. Thoracodorsal Nerve (C6, C7, C8)

MuscleAction
Latissimus dorsiExtension, adduction, medial rotation of arm

10. Subscapular Nerves (Upper C5-C6; Lower C5-C6)

NerveMuscleAction
Upper subscapularSubscapularis (upper part)Medial rotation of arm
Lower subscapularSubscapularis (lower part)Medial rotation of arm
Lower subscapularTeres majorExtension + medial rotation of arm

11. Medial & Lateral Pectoral Nerves

NerveMuscle
Medial pectoral (C8, T1)Pectoralis major (sternal head), Pectoralis minor
Lateral pectoral (C5, C6, C7)Pectoralis major (clavicular head)

LOWER LIMB

The lumbar (L1-L4) and sacral (L4-S3) plexuses supply the lower limb.

1. Femoral Nerve (L2, L3, L4)

MuscleAction
IliacusHip flexion
Psoas major (via direct lumbar branches + femoral)Hip flexion
SartoriusHip flexion + lateral rotation; knee flexion
PectineusHip flexion + adduction
Rectus femorisHip flexion + knee extension
Vastus lateralisKnee extension
Vastus medialisKnee extension
Vastus intermediusKnee extension
Quadriceps = main muscle group = femoral nerve; loss = inability to extend knee, absent knee jerk

2. Obturator Nerve (L2, L3, L4)

MuscleAction
Adductor longusHip adduction
Adductor brevisHip adduction
Adductor magnus (adductor part)Hip adduction
GracilisHip adduction; knee flexion
Obturator externusLateral rotation of hip
Pectineus (small contribution)Hip adduction
Mnemonic: "Adductors = Obturator"

3. Superior Gluteal Nerve (L4, L5, S1)

MuscleAction
Gluteus mediusHip abduction + medial rotation
Gluteus minimusHip abduction + medial rotation
Tensor fasciae lataeHip abduction + medial rotation; steadies knee via IT band
Injury: Trendelenburg gait (pelvis drops on opposite side when standing on affected leg)

4. Inferior Gluteal Nerve (L5, S1, S2)

MuscleAction
Gluteus maximusHip extension + lateral rotation; stair climbing, rising from sitting

5. Sciatic Nerve (L4, L5, S1, S2, S3)

The sciatic nerve divides into the Tibial and Common Peroneal (Fibular) nerves.
In the gluteal region/thigh (before division):
MuscleAction
Biceps femoris (long head)Knee flexion + lateral rotation of leg
SemitendinosusKnee flexion + medial rotation
SemimembranosusKnee flexion + medial rotation
Adductor magnus (hamstring part)Hip extension

6. Tibial Nerve (L4, L5, S1, S2, S3)

In the leg (posterior compartment):
MuscleAction
GastrocnemiusPlantarflexion + knee flexion
SoleusPlantarflexion
PlantarisWeak plantarflexion + knee flexion
PopliteusMedial rotation of leg (unlocks knee)
Tibialis posteriorPlantarflexion + inversion
Flexor digitorum longusFlexion of lateral 4 toes; plantarflexion
Flexor hallucis longusFlexion of big toe; plantarflexion
In the foot (via medial and lateral plantar branches):
MuscleAction
Abductor hallucisAbduction of big toe
Flexor digitorum brevisFlexion of middle phalanges of toes 2-5
Flexor hallucis brevisFlexion of big toe MTP
Lumbricals (medial 1 - medial plantar; lateral 3 - lateral plantar)MTP flexion, IP extension
Quadratus plantaeModifies pull of FDL
Adductor hallucisAdduction of big toe
Flexor digiti minimi brevisFlexion of little toe
All interossei (dorsal & plantar)Toe abduction/adduction
Abductor digiti minimiAbduction of little toe

7. Common Peroneal (Fibular) Nerve (L4, L5, S1)

Divides into Deep and Superficial peroneal nerves.
Deep Peroneal Nerve (L4, L5):
MuscleAction
Tibialis anteriorDorsiflexion + inversion
Extensor hallucis longusExtension of big toe; dorsiflexion
Extensor digitorum longusExtension of toes 2-5; dorsiflexion
Peroneus tertiusDorsiflexion + eversion
Extensor digitorum brevisExtension of toes
Extensor hallucis brevisExtension of big toe (proximal)
Injury: "Foot drop" - loss of dorsiflexion; high-stepping gait
Superficial Peroneal Nerve (L5, S1):
MuscleAction
Peroneus (fibularis) longusEversion + plantarflexion
Peroneus (fibularis) brevisEversion

8. Nerve to Obturator Internus (L5, S1)

MuscleAction
Obturator internusLateral rotation of hip
Superior gemellusLateral rotation of hip

9. Nerve to Quadratus Femoris (L4, L5, S1)

MuscleAction
Quadratus femorisLateral rotation + adduction of hip
Inferior gemellusLateral rotation of hip

10. Pudendal Nerve (S2, S3, S4)

MuscleAction
External urethral sphincterUrinary continence
External anal sphincterFecal continence
Perineal musclesPerineal floor

Quick Summary Table

NerveKey MusclesClinical Test
MusculocutaneousBiceps, brachialis, coracobrachialisElbow flexion
MedianForearm flexors, LOAF hand musclesA-OK sign, thumb opposition
UlnarFCU, FDP (4,5), intrinsicsFinger abduction; Froment's sign
RadialTriceps, all extensorsWrist extension; thumbs up
AxillaryDeltoid, teres minorShoulder abduction
MusculocutaneousBiceps, brachialisElbow flexion
FemoralQuadriceps, iliopsoasKnee extension; knee jerk
ObturatorAdductorsHip adduction
Sup. GlutealGlut. med, min, TFLTrendelenburg test
Inf. GlutealGluteus maximusHip extension (stairs)
TibialPlantarflexors, toe flexorsPlantarflexion; ankle jerk
Deep peronealDorsiflexors, toe extensorsFoot drop test
Superficial peronealPeroneus longus & brevisFoot eversion

Key mnemonics to remember:
  • Median nerve in hand = LOAF (Lumbricals 1&2, Opponens pollicis, Abductor pollicis brevis, Flexor pollicis brevis)
  • Ulnar nerve = all other intrinsics ("everything else in the hand")
  • Radial nerve = all extensors of wrist and fingers
  • Foot drop = deep peroneal (anterior compartment)
  • Trendelenburg = superior gluteal nerve injury
  • "BBC" = musculocutaneous (Brachialis, Biceps, Coracobrachialis)

From this all which are used for the motor points

Finding Sources
Searching the Web

motor points upper limb lower limb muscles electrotherapy physiotherapy chart

Finding Sources
Reading Web Page

https://pmc.ncbi.nlm.nih.gov/articles/PMC3938308

I now have enough information for a thorough answer. Here is the complete motor points guide derived from the nerve-muscle supply covered previously:

Motor Points - Upper & Lower Limb

What is a Motor Point?

A motor point is the point on the skin surface where electrical stimulation produces the maximum muscle contraction with the minimum current intensity. It corresponds to the area where:
  • The motor nerve enters the muscle belly (motor entry point)
  • The highest concentration of neuromuscular junctions exists
  • The muscle is most electrically excitable
Clinical uses: NMES (Neuromuscular Electrical Stimulation), FES (Functional Electrical Stimulation), TENS for muscle re-education, botulinum toxin injection targeting, EMG electrode placement, physiotherapy muscle strengthening.
Key principle: MP stimulation produces greater mechanical output and metabolic demand than conventional electrode placement - PMC research confirms MP-based NMES is far superior to anatomical chart-based electrode placement.

UPPER LIMB MOTOR POINTS

Shoulder Region

NerveMuscleMotor Point Location
Axillary (C5,C6)Deltoid - anteriorAnterolateral shoulder, 2-3 cm below acromion (front)
Axillary (C5,C6)Deltoid - middleDirectly over lateral mid-deltoid, 4 cm below acromion tip
Axillary (C5,C6)Deltoid - posteriorPosterolateral shoulder, 3 cm below acromion (rear)
SuprascapularSupraspinatusSupraspinous fossa, midpoint between spine of scapula and acromion
SuprascapularInfraspinatusInfraspinous fossa, 3-4 cm below spine of scapula, medial to its midpoint
Long thoracicSerratus anteriorLateral chest wall, over the 4th-5th rib in midaxillary line

Arm (Upper)

NerveMuscleMotor Point Location
Musculocutaneous (C5,C6)Biceps brachiiAnterior arm, junction of upper and middle thirds (most commonly used)
MusculocutaneousBrachialisAnterior arm, lower third, just lateral to biceps tendon
Radial (C7,C8)Triceps - long headPosterior arm, upper third, medial to midline
RadialTriceps - lateral headPosterior arm, middle third, lateral aspect
RadialTriceps - medial headPosterior arm, distal third near olecranon

Forearm

NerveMuscleMotor Point Location
RadialBrachioradialisLateral forearm, proximal third (just below elbow)
Radial (PIN)Extensor carpi radialis longusLateral forearm, 4-5 cm below lateral epicondyle
Radial (PIN)Extensor digitorum communisPosterior forearm, 5-6 cm below lateral epicondyle
Radial (PIN)Extensor carpi ulnarisPosterior forearm, 6 cm below lateral epicondyle, ulnar side
MedianPronator teresAnterior forearm, medial aspect just below elbow crease
MedianFlexor carpi radialisAnterior forearm, proximal third, radial side
MedianFlexor digitorum superficialisAnterior forearm, middle third, center
Median (AIN)Flexor pollicis longusAnterior forearm, middle-lower third, radial side
UlnarFlexor carpi ulnarisAnterior forearm, ulnar border, proximal third
UlnarFlexor digitorum profundus (4,5)Anterior forearm, middle third, ulnar side

Hand

NerveMuscleMotor Point Location
Median (recurrent branch)Abductor pollicis brevisThenar eminence, midpoint on radial side
Median (recurrent branch)Opponens pollicisThenar eminence, deep to APB, radial border of 1st metacarpal
Ulnar (deep branch)Adductor pollicisWeb space between 1st and 2nd metacarpal, dorsal surface
UlnarAbductor digiti minimiHypothenar eminence, ulnar border of 5th metacarpal
UlnarFirst dorsal interosseousDorsum of hand, 1st web space (most accessible interosseous for stimulation)

LOWER LIMB MOTOR POINTS

Gluteal Region

NerveMuscleMotor Point Location
Inferior gluteal (L5,S1,S2)Gluteus maximusMidpoint of buttock (midway between PSIS and greater trochanter)
Superior gluteal (L4,L5,S1)Gluteus mediusLateral hip, midway between iliac crest and greater trochanter
Superior glutealGluteus minimusJust anterior and deep to gluteus medius MP
Superior glutealTensor fasciae lataeAnterolateral hip, just below ASIS, 4-5 cm lateral

Thigh - Anterior

NerveMuscleMotor Point Location
Femoral (L2,L3,L4)Rectus femorisAnterior thigh, proximal third, midline - 2 motor points (proximal + distal)
FemoralVastus medialisAnteromedial thigh, lower third, 5-8 cm above patella (VMO zone) - most important for patellofemoral rehab
FemoralVastus lateralisAnterolateral thigh, middle third - multiple MPs (proximal, central, distal)
FemoralVastus intermediusDeep anterior thigh, mid-thigh (accessed between RF and VL)
FemoralSartoriusAnteromedial thigh, upper third

Thigh - Posterior (Hamstrings)

NerveSciatic (L4-S3)Motor Point Location
SciaticBiceps femorisPosterior thigh, upper-middle third, lateral aspect
SciaticSemitendinosusPosterior thigh, middle third, medial aspect
SciaticSemimembranosusPosterior thigh, upper third, deep to semitendinosus

Thigh - Medial (Adductors)

NerveMuscleMotor Point Location
Obturator (L2,L3,L4)Adductor longusMedial thigh, 4-5 cm below groin crease
ObturatorGracilisMedial thigh, proximal third
ObturatorAdductor magnusMedial thigh, middle third, deep

Leg - Anterior & Lateral

NerveMuscleMotor Point Location
Deep peroneal (L4,L5)Tibialis anteriorAnterolateral leg, proximal third (most commonly stimulated - foot drop treatment)
Deep peronealExtensor digitorum longusAnterolateral leg, middle third, lateral to TA
Deep peronealExtensor hallucis longusAnterolateral leg, lower-middle third, between TA and EDL
Superficial peroneal (L5,S1)Peroneus longusLateral leg, just below fibular head
Superficial peronealPeroneus brevisLateral leg, lower third, just above lateral malleolus

Leg - Posterior

NerveMuscleMotor Point Location
Tibial (S1,S2)Gastrocnemius - medialPosterior leg, upper third, medial to midline (most used for ankle push-off)
TibialGastrocnemius - lateralPosterior leg, upper third, lateral to midline
TibialSoleusPosterior leg, middle third, deep to gastrocnemius
TibialTibialis posteriorDeep posterior leg, middle third (difficult to access - requires longer needle/deeper electrode)
TibialFlexor digitorum longusDeep posterior leg, middle-lower third, medial side

Most Clinically Used Motor Points (High Priority)

These are the motor points most commonly targeted in clinical physiotherapy practice:

Upper Limb - Top Priority

PriorityMuscleCommon Clinical Use
⭐⭐⭐Deltoid (all 3 heads)Shoulder subluxation, hemiplegia rehab
⭐⭐⭐Biceps brachiiElbow flexion training, spasticity
⭐⭐⭐TricepsElbow extension (SCI, stroke)
⭐⭐⭐Extensor digitorumHand opening, finger extension
⭐⭐⭐Wrist extensors (ECRL, ECRB)Wrist drop, radial nerve palsy
⭐⭐Flexor digitorum superficialisGrip training
⭐⭐Thenar muscles (APB, OP)Median nerve palsy, pinch grip
⭐⭐First dorsal interosseousUlnar nerve palsy
⭐⭐Serratus anteriorWinged scapula

Lower Limb - Top Priority

PriorityMuscleCommon Clinical Use
⭐⭐⭐Tibialis anteriorFoot drop (deep peroneal nerve palsy)
⭐⭐⭐Quadriceps (VL, RF, VM)Post-op knee, OA, muscle wasting
⭐⭐⭐Vastus medialis oblique (VMO)Patellofemoral pain, post-TKR
⭐⭐⭐Gastrocnemius/soleusPush-off re-training, DVT prevention
⭐⭐⭐Gluteus maximusHip extension, post-op hip rehab
⭐⭐⭐Gluteus mediusTrendelenburg gait correction
⭐⭐HamstringsKnee flexion, ACL rehab
⭐⭐Peroneus longusAnkle instability, foot eversion

Key Rules for Motor Point Stimulation

  1. Cathode (negative/black electrode) on the motor point - produces stronger contraction (more depolarization under negative pole)
  2. Anode (positive/red electrode) placed proximally along the nerve trunk or on an inactive area
  3. Motor points shift with muscle contraction - identify in relaxed state
  4. High inter-individual variability exists - always scan to find the best response rather than relying solely on charts
  5. Rectangular pulses at 0.1-1 ms pulse width work best for motor point identification
  6. Frequency: 20-50 Hz for tetanic contraction (strengthening); 1-4 Hz for denervated muscles (interrupted DC or surged faradic)

Special Note: Denervated vs Innervated Muscles

TypeNerve intact?Current type at motor pointFrequency
Innervated (e.g., disuse atrophy, stroke)YesFaradic / NMES / AC20-50 Hz
Partially denervated (e.g., nerve injury)PartialSurged faradic or exponential current1-10 Hz
Fully denervated (e.g., LMN lesion)NoInterrupted DC (galvanic)1-4 Hz
For denervated muscles, the motor point shifts and requires higher current - you stimulate the muscle fiber directly (not via nerve), so the motor point becomes the most excitable point on the muscle belly itself.

Muje sir ne bola hai ki u have to make assignment of the nerves of upper limbs and lowerlimbs supplies which muscle

Asking for Preferences
Reading File
Running Command

mkdir -p /home/daytona/workspace/nerve-assignment && ls /home/daytona/workspace/…

Writing File

~/nerve-assignment/create_assignment.js

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

// ─── Color palette ───────────────────────────────────────────────────
const DARK_BLUE   = "1F3864";
const MED_BLUE    = "2E74B5";
const LIGHT_BLUE  = "D6E4F0";
const LIGHT_GREY  = "F2F2F2";
const WHITE       = "FFFFFF";
const ACCENT      = "C00000";
const TABLE_HEAD  = "1F3864";

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

function heading1(text) {
  return new Paragraph({
    heading: HeadingLevel.HEADING_1,
    children: [new TextRun({ text, bold: true, color: WHITE, size: 28 })],
    shading: { type: ShadingType.SOLID, color: DARK_BLUE, fill: DARK_BLUE },
    spacing: { before: 240, after: 120 },
    indent: { left: 200, right: 200 },
  });
}

function heading2(text) {
  return new Paragraph({
    heading: HeadingLevel.HEADING_2,
    children: [new TextRun({ text, bold: true, color: WHITE, size: 24 })],
    shading: { type: ShadingType.SOLID, color: MED_BLUE, fill: MED_BLUE },
    spacing: { before: 200, after: 100 },
    indent: { left: 160 },
  });
}

function heading3(text) {
  return new Paragraph({
    heading: HeadingLevel.HEADING_3,
    children: [new TextRun({ text, bold: true, color: DARK_BLUE, size: 22 })],
    border: { bottom: { style: BorderStyle.SINGLE, size: 6, color: MED_BLUE } },
    spacing: { before: 160, after: 80 },
  });
}

function bodyPara(text, opts = {}) {
  return new Paragraph({
    children: [new TextRun({ text, size: 20, color: "000000", ...opts })],
    spacing: { before: 60, after: 60 },
    indent: { left: 200 },
  });
}

function bulletPara(text) {
  return new Paragraph({
    children: [new TextRun({ text, size: 20 })],
    bullet: { level: 0 },
    spacing: { before: 40, after: 40 },
    indent: { left: 360, hanging: 200 },
  });
}

function noteBox(text) {
  return new Paragraph({
    children: [new TextRun({ text: "📌 " + text, size: 18, italics: true, color: "5A5A5A" })],
    shading: { type: ShadingType.SOLID, color: "FFF9C4", fill: "FFF9C4" },
    border: {
      left: { style: BorderStyle.THICK, size: 8, color: ACCENT }
    },
    spacing: { before: 80, after: 80 },
    indent: { left: 200, right: 200 },
  });
}

function spacer(lines = 1) {
  return new Paragraph({ children: [new TextRun({ text: "", size: 20 })], spacing: { before: lines * 60 } });
}

// ─── Table builder ────────────────────────────────────────────────────
function makeTable(headers, rows, columnWidths) {
  const headerRow = new TableRow({
    tableHeader: true,
    children: headers.map((h, i) =>
      new TableCell({
        children: [new Paragraph({
          children: [new TextRun({ text: h, bold: true, color: WHITE, size: 18 })],
          alignment: AlignmentType.CENTER,
        })],
        shading: { type: ShadingType.SOLID, color: TABLE_HEAD, fill: TABLE_HEAD },
        width: { size: columnWidths[i], type: WidthType.DXA },
        verticalAlign: VerticalAlign.CENTER,
        margins: { top: 60, bottom: 60, left: 80, right: 80 },
      })
    ),
  });

  const dataRows = rows.map((row, rIdx) =>
    new TableRow({
      children: row.map((cell, cIdx) =>
        new TableCell({
          children: [new Paragraph({
            children: [new TextRun({ text: cell, size: 18 })],
            alignment: cIdx === 0 ? AlignmentType.LEFT : AlignmentType.LEFT,
          })],
          shading: {
            type: ShadingType.SOLID,
            color: rIdx % 2 === 0 ? WHITE : LIGHT_GREY,
            fill: rIdx % 2 === 0 ? WHITE : LIGHT_GREY,
          },
          width: { size: columnWidths[cIdx], type: WidthType.DXA },
          margins: { top: 50, bottom: 50, left: 80, right: 80 },
        })
      ),
    })
  );

  return new Table({
    rows: [headerRow, ...dataRows],
    width: { size: 9000, type: WidthType.DXA },
    margins: { top: 80, bottom: 80 },
  });
}

// ─── CONTENT ─────────────────────────────────────────────────────────

// ── TITLE PAGE ──
const titlePage = [
  spacer(4),
  new Paragraph({
    children: [new TextRun({ text: "ASSIGNMENT", bold: true, size: 52, color: DARK_BLUE, allCaps: true })],
    alignment: AlignmentType.CENTER,
    spacing: { before: 200, after: 80 },
  }),
  new Paragraph({
    children: [new TextRun({ text: "Nerve-wise Muscle Supply", bold: true, size: 44, color: MED_BLUE })],
    alignment: AlignmentType.CENTER,
    spacing: { before: 80, after: 80 },
  }),
  new Paragraph({
    children: [new TextRun({ text: "Upper Limb & Lower Limb", bold: true, size: 36, color: DARK_BLUE })],
    alignment: AlignmentType.CENTER,
    spacing: { before: 60, after: 240 },
  }),
  new Paragraph({
    children: [new TextRun({ text: "─────────────────────────────────────────", color: MED_BLUE, size: 24 })],
    alignment: AlignmentType.CENTER,
    spacing: { before: 60, after: 240 },
  }),
  new Paragraph({
    children: [new TextRun({ text: "Subject: Anatomy / Kinesiology", size: 22, color: "333333" })],
    alignment: AlignmentType.CENTER,
    spacing: { before: 60, after: 60 },
  }),
  new Paragraph({
    children: [new TextRun({ text: "Topic: Peripheral Nerve Innervation of Limb Muscles", size: 22, color: "333333" })],
    alignment: AlignmentType.CENTER,
    spacing: { before: 60, after: 60 },
  }),
  spacer(2),
  new Paragraph({
    children: [new TextRun({ text: "Submitted To:", bold: true, size: 22, color: DARK_BLUE })],
    alignment: AlignmentType.CENTER,
    spacing: { before: 80, after: 20 },
  }),
  new Paragraph({
    children: [new TextRun({ text: "Course Faculty", size: 22, color: "444444" })],
    alignment: AlignmentType.CENTER,
    spacing: { before: 20, after: 60 },
  }),
  spacer(4),
  pageBreak(),
];

// ── INTRODUCTION ──
const introduction = [
  heading1("INTRODUCTION"),
  spacer(),
  bodyPara(
    "The peripheral nervous system supplies the muscles of the upper and lower limbs through a well-organized network of nerves arising from the brachial plexus (C5–T1) and the lumbosacral plexus (L1–S3). Understanding nerve-wise muscle supply is fundamental in Anatomy, Physiology, Kinesiology, and Clinical Physiotherapy — especially for assessing motor deficits, diagnosing nerve injuries, and planning rehabilitation."
  ),
  spacer(),
  bodyPara(
    "Each peripheral nerve carries motor fibers that innervate specific muscles. When a nerve is injured, the resulting weakness or paralysis follows a predictable pattern — called a 'denervation pattern' — which helps clinicians localize the site of injury. This assignment systematically lists each major nerve and the muscles it supplies in both the upper and lower limbs."
  ),
  spacer(),
  noteBox("Key Principle: Nerves from posterior divisions (Radial, Axillary) supply EXTENSORS; nerves from anterior divisions (Musculocutaneous, Median, Ulnar) supply FLEXORS in the upper limb."),
  spacer(2),
  pageBreak(),
];

// ══════════════════════════════════════════════════════════════════════
//  UPPER LIMB
// ══════════════════════════════════════════════════════════════════════

const upperLimbIntro = [
  heading1("PART I: UPPER LIMB"),
  spacer(),
  bodyPara("The upper limb is supplied by the BRACHIAL PLEXUS (C5, C6, C7, C8, T1). The major terminal branches are:"),
  bulletPara("Musculocutaneous nerve (C5, C6, C7)"),
  bulletPara("Median nerve (C6, C7, C8, T1)"),
  bulletPara("Ulnar nerve (C7, C8, T1)"),
  bulletPara("Radial nerve (C5, C6, C7, C8, T1)"),
  bulletPara("Axillary nerve (C5, C6)"),
  bulletPara("Plus: Suprascapular, Long thoracic, Thoracodorsal, Subscapular, Pectoral nerves"),
  spacer(2),
];

// 1. Musculocutaneous
const musculocutaneous = [
  heading2("1. Musculocutaneous Nerve (C5, C6, C7)"),
  spacer(),
  bodyPara("Origin: Lateral cord of brachial plexus. Pierces coracobrachialis, runs between biceps and brachialis."),
  spacer(),
  makeTable(
    ["S.No.", "Muscle", "Action", "Clinical Importance"],
    [
      ["1", "Coracobrachialis", "Flexion & adduction of arm at shoulder", "Pierced by the nerve itself"],
      ["2", "Biceps brachii (both heads)", "Elbow flexion + forearm supination", "Most powerful supinator; absent biceps reflex"],
      ["3", "Brachialis", "Elbow flexion (pure flexor)", "Principal flexor of elbow joint"],
    ],
    [600, 2200, 3000, 3200]
  ),
  spacer(),
  noteBox("Mnemonic: 'BBC' — Brachialis, Biceps, Coracobrachialis"),
  spacer(),
  bodyPara("Injury result: Loss of elbow flexion and supination; sensory loss on lateral forearm."),
  spacer(2),
];

// 2. Median Nerve
const medianNerve = [
  heading2("2. Median Nerve (C6, C7, C8, T1)"),
  spacer(),
  bodyPara("Origin: Lateral + Medial cords (dual root). Called the 'nerve of precision grip' and 'eye of the hand'."),
  spacer(),
  heading3("2A. In the Forearm"),
  spacer(),
  makeTable(
    ["S.No.", "Muscle", "Nerve Branch", "Action"],
    [
      ["1", "Pronator teres", "Main trunk", "Pronation of forearm"],
      ["2", "Flexor carpi radialis (FCR)", "Main trunk", "Wrist flexion + radial deviation"],
      ["3", "Palmaris longus", "Main trunk", "Wrist flexion (absent in 14%)"],
      ["4", "Flexor digitorum superficialis (FDS)", "Main trunk", "Flexion of middle phalanges (D2–D5)"],
      ["5", "Flexor digitorum profundus (FDP) — lateral half", "Anterior interosseous nerve (AIN)", "Flexion of distal phalanges D2 & D3"],
      ["6", "Flexor pollicis longus (FPL)", "Anterior interosseous nerve (AIN)", "Flexion of thumb IP joint"],
      ["7", "Pronator quadratus", "Anterior interosseous nerve (AIN)", "Pronation (powerful)"],
    ],
    [500, 2400, 2000, 3100]
  ),
  spacer(),
  heading3("2B. In the Hand (LOAF Muscles)"),
  spacer(),
  makeTable(
    ["S.No.", "Muscle", "Action", "Test"],
    [
      ["1", "Lateral 2 Lumbricals (1st & 2nd)", "MCP flexion + IP extension of D2 & D3", "Point to ceiling with index finger"],
      ["2", "Opponens pollicis", "Opposition of thumb (most important)", "Touch tip of thumb to little finger"],
      ["3", "Abductor pollicis brevis (APB)", "Abduction of thumb (palmar)", "Lift thumb perpendicular to palm"],
      ["4", "Flexor pollicis brevis — superficial head", "Flexion of thumb MCP joint", "Thumb flexion at MCP"],
    ],
    [500, 2500, 3000, 2000]
  ),
  spacer(),
  noteBox("Mnemonic: 'LOAF' — Lumbricals (1&2), Opponens pollicis, Abductor pollicis brevis, Flexor pollicis brevis (superficial head)"),
  spacer(),
  bodyPara("Injury result: 'Ape hand' deformity, loss of thumb opposition (most disabling), 'pen test' abnormal, carpal tunnel syndrome affects this nerve."),
  spacer(2),
];

// 3. Ulnar Nerve
const ulnarNerve = [
  heading2("3. Ulnar Nerve (C7, C8, T1)"),
  spacer(),
  bodyPara("Origin: Medial cord of brachial plexus. Passes behind medial epicondyle (ulnar groove). Called 'musician's nerve' — controls fine movements of fingers."),
  spacer(),
  heading3("3A. In the Forearm"),
  spacer(),
  makeTable(
    ["S.No.", "Muscle", "Action"],
    [
      ["1", "Flexor carpi ulnaris (FCU)", "Wrist flexion + ulnar deviation"],
      ["2", "Flexor digitorum profundus (FDP) — medial half", "Flexion of distal phalanges of D4 & D5"],
    ],
    [500, 2500, 6000]
  ),
  spacer(),
  heading3("3B. In the Hand"),
  spacer(),
  makeTable(
    ["S.No.", "Muscle", "Action"],
    [
      ["1", "Abductor digiti minimi", "Abduction of little finger"],
      ["2", "Flexor digiti minimi brevis", "Flexion of little finger MCP"],
      ["3", "Opponens digiti minimi", "Opposition of little finger"],
      ["4", "Medial 2 Lumbricals (3rd & 4th)", "MCP flexion + IP extension of D4 & D5"],
      ["5", "All 4 Dorsal interossei (DAB)", "Finger abduction"],
      ["6", "All 3 Palmar interossei (PAD)", "Finger adduction"],
      ["7", "Adductor pollicis", "Adduction of thumb"],
      ["8", "Flexor pollicis brevis — deep head", "Flexion of thumb MCP"],
      ["9", "Palmaris brevis", "Skin wrinkling over hypothenar"],
    ],
    [500, 2800, 5700]
  ),
  spacer(),
  noteBox("Mnemonic: 'All hand muscles EXCEPT LOAF = Ulnar nerve'. Intrinsics: DAB = Dorsal Abduct; PAD = Palmar Adduct"),
  spacer(),
  bodyPara("Injury result: 'Claw hand' (ring & little fingers), Froment's sign (adductor pollicis weakness), loss of finger abduction/adduction."),
  spacer(2),
];

// 4. Radial Nerve
const radialNerve = [
  heading2("4. Radial Nerve (C5, C6, C7, C8, T1)"),
  spacer(),
  bodyPara("Origin: Posterior cord of brachial plexus. Largest branch. Passes through spiral groove of humerus. Called 'great extensor nerve'."),
  spacer(),
  heading3("4A. In the Arm"),
  spacer(),
  makeTable(
    ["S.No.", "Muscle", "Action"],
    [
      ["1", "Triceps brachii (all 3 heads)", "Elbow extension"],
      ["2", "Anconeus", "Assists elbow extension"],
      ["3", "Brachioradialis", "Elbow flexion in midpronation"],
      ["4", "Extensor carpi radialis longus (ECRL)", "Wrist extension + radial deviation"],
    ],
    [500, 2800, 5700]
  ),
  spacer(),
  heading3("4B. In the Forearm (via Posterior Interosseous Nerve — PIN)"),
  spacer(),
  makeTable(
    ["S.No.", "Muscle", "Action"],
    [
      ["1", "Extensor carpi radialis brevis (ECRB)", "Wrist extension"],
      ["2", "Supinator", "Supination of forearm"],
      ["3", "Extensor digitorum communis (EDC)", "Extension of fingers D2–D5"],
      ["4", "Extensor digiti minimi (EDM)", "Extension of little finger"],
      ["5", "Extensor carpi ulnaris (ECU)", "Wrist extension + ulnar deviation"],
      ["6", "Abductor pollicis longus (APL)", "Abduction + extension of thumb"],
      ["7", "Extensor pollicis longus (EPL)", "Extension of thumb IP joint"],
      ["8", "Extensor pollicis brevis (EPB)", "Extension of thumb MCP joint"],
      ["9", "Extensor indicis proprius (EIP)", "Independent index finger extension"],
    ],
    [500, 2800, 5700]
  ),
  spacer(),
  noteBox("Mnemonic: 'BEST' — Brachioradialis, Extensors (all), Supinator, Triceps"),
  spacer(),
  bodyPara("Injury result: 'Wrist drop' (radial nerve palsy at spiral groove); loss of wrist and finger extension; 'Saturday night palsy'. Test: Thumbs-up sign."),
  spacer(2),
];

// 5. Axillary
const axillaryNerve = [
  heading2("5. Axillary Nerve (C5, C6)"),
  spacer(),
  bodyPara("Origin: Posterior cord. Passes through quadrangular space. Most commonly injured in shoulder dislocation / surgical neck humerus fracture."),
  spacer(),
  makeTable(
    ["S.No.", "Muscle", "Action"],
    [
      ["1", "Deltoid — anterior fibers", "Shoulder flexion + medial rotation"],
      ["2", "Deltoid — middle fibers", "Shoulder abduction (15°–90°)"],
      ["3", "Deltoid — posterior fibers", "Shoulder extension + lateral rotation"],
      ["4", "Teres minor", "Lateral rotation of arm"],
    ],
    [500, 2800, 5700]
  ),
  spacer(),
  bodyPara("Injury result: Loss of shoulder abduction, flattening of deltoid, sensory loss over regimental badge area (lateral upper arm)."),
  spacer(2),
];

// 6. Suprascapular
const suprascapularNerve = [
  heading2("6. Suprascapular Nerve (C5, C6)"),
  spacer(),
  bodyPara("Origin: Upper trunk of brachial plexus. Passes through suprascapular notch."),
  spacer(),
  makeTable(
    ["S.No.", "Muscle", "Action"],
    [
      ["1", "Supraspinatus", "Initiates shoulder abduction (0–15°); part of rotator cuff"],
      ["2", "Infraspinatus", "Lateral rotation of arm; rotator cuff"],
    ],
    [500, 2800, 5700]
  ),
  spacer(2),
];

// 7. Other nerves UL
const otherULNerves = [
  heading2("7. Other Important Nerves of Upper Limb"),
  spacer(),
  makeTable(
    ["Nerve", "Root", "Muscle(s) Supplied", "Key Action / Injury"],
    [
      ["Long thoracic nerve", "C5, C6, C7", "Serratus anterior", "'Winged scapula' on injury"],
      ["Dorsal scapular nerve", "C5", "Rhomboid major & minor; Levator scapulae", "Scapular retraction & elevation"],
      ["Thoracodorsal nerve", "C6, C7, C8", "Latissimus dorsi", "Arm extension, adduction, medial rotation"],
      ["Upper subscapular nerve", "C5, C6", "Subscapularis (upper part)", "Medial rotation of arm"],
      ["Lower subscapular nerve", "C5, C6", "Subscapularis (lower) + Teres major", "Medial rotation + extension"],
      ["Medial pectoral nerve", "C8, T1", "Pectoralis major (sternal) + Pectoralis minor", "Arm adduction + scapula depression"],
      ["Lateral pectoral nerve", "C5, C6, C7", "Pectoralis major (clavicular head)", "Arm flexion + adduction"],
    ],
    [1600, 900, 2700, 3800]
  ),
  spacer(2),
  pageBreak(),
];

// ══════════════════════════════════════════════════════════════════════
//  LOWER LIMB
// ══════════════════════════════════════════════════════════════════════

const lowerLimbIntro = [
  heading1("PART II: LOWER LIMB"),
  spacer(),
  bodyPara("The lower limb is supplied by the LUMBOSACRAL PLEXUS:"),
  bulletPara("Lumbar plexus (L1–L4): Femoral nerve, Obturator nerve, and smaller branches"),
  bulletPara("Sacral plexus (L4–S3): Sciatic nerve (Tibial + Common Peroneal), Superior & Inferior Gluteal nerves, Pudendal nerve"),
  spacer(2),
];

// 1. Femoral
const femoralNerve = [
  heading2("1. Femoral Nerve (L2, L3, L4)"),
  spacer(),
  bodyPara("Origin: Lumbar plexus. Largest branch. Passes beneath inguinal ligament (lateral to femoral artery). Supplies anterior thigh."),
  spacer(),
  makeTable(
    ["S.No.", "Muscle", "Action", "Note"],
    [
      ["1", "Iliacus", "Hip flexion", "Joined by psoas — iliopsoas most powerful hip flexor"],
      ["2", "Psoas major (partial)", "Hip flexion + lumbar spine stabilization", "Also direct lumbar branches L1–L3"],
      ["3", "Sartorius", "Hip flexion + lateral rotation; knee flexion", "Longest muscle in body; 'tailor's muscle'"],
      ["4", "Pectineus", "Hip flexion + adduction", "Also partial obturator supply"],
      ["5", "Rectus femoris", "Hip flexion + knee extension", "Only quadriceps crossing both hip & knee"],
      ["6", "Vastus lateralis", "Knee extension", "Largest quadriceps; site of IM injections"],
      ["7", "Vastus medialis", "Knee extension + patellar stabilization", "VMO important in patellofemoral rehab"],
      ["8", "Vastus intermedius", "Knee extension", "Deep to rectus femoris"],
    ],
    [500, 2000, 2800, 2700]
  ),
  spacer(),
  noteBox("Injury result: Loss of knee extension; absent knee jerk reflex (L3/L4); inability to walk upstairs. Quadriceps wasting prominent."),
  spacer(2),
];

// 2. Obturator
const obturatorNerve = [
  heading2("2. Obturator Nerve (L2, L3, L4)"),
  spacer(),
  bodyPara("Origin: Lumbar plexus. Passes through obturator canal. Supplies medial (adductor) compartment of thigh."),
  spacer(),
  makeTable(
    ["S.No.", "Muscle", "Action"],
    [
      ["1", "Adductor longus", "Hip adduction + slight flexion"],
      ["2", "Adductor brevis", "Hip adduction + slight flexion"],
      ["3", "Adductor magnus (adductor part)", "Hip adduction (hamstring part by tibial nerve)"],
      ["4", "Gracilis", "Hip adduction; knee flexion + medial rotation"],
      ["5", "Obturator externus", "Lateral rotation of hip"],
      ["6", "Pectineus (accessory)", "Hip adduction + flexion"],
    ],
    [500, 2800, 5700]
  ),
  spacer(),
  noteBox("Mnemonic: 'Adductors = Obturator nerve'. Injury: Weakness of hip adduction; difficulty crossing legs."),
  spacer(2),
];

// 3. Superior Gluteal
const supGluteal = [
  heading2("3. Superior Gluteal Nerve (L4, L5, S1)"),
  spacer(),
  bodyPara("Origin: Sacral plexus. Exits greater sciatic foramen above piriformis. Most vulnerable in hip surgery."),
  spacer(),
  makeTable(
    ["S.No.", "Muscle", "Action"],
    [
      ["1", "Gluteus medius", "Hip abduction + medial rotation; pelvic stabilization during walking"],
      ["2", "Gluteus minimus", "Hip abduction + medial rotation"],
      ["3", "Tensor fasciae latae (TFL)", "Hip abduction + medial rotation; steadies knee via IT band"],
    ],
    [500, 2800, 5700]
  ),
  spacer(),
  noteBox("Injury result: TRENDELENBURG GAIT — pelvis drops to opposite side when standing on affected leg. 'Waddling gait' if bilateral."),
  spacer(2),
];

// 4. Inferior Gluteal
const infGluteal = [
  heading2("4. Inferior Gluteal Nerve (L5, S1, S2)"),
  spacer(),
  bodyPara("Origin: Sacral plexus. Exits below piriformis."),
  spacer(),
  makeTable(
    ["S.No.", "Muscle", "Action"],
    [
      ["1", "Gluteus maximus", "Powerful hip extension + lateral rotation; rising from sitting, climbing stairs, running"],
    ],
    [500, 2800, 5700]
  ),
  spacer(),
  bodyPara("Injury result: Difficulty climbing stairs, rising from sitting. Gluteal fold flattening."),
  spacer(2),
];

// 5. Sciatic - hamstrings
const sciaticHamstrings = [
  heading2("5. Sciatic Nerve (L4, L5, S1, S2, S3)"),
  spacer(),
  bodyPara("The largest nerve in the body. Arises from sacral plexus, exits through greater sciatic foramen below piriformis. Divides into Tibial and Common Peroneal (Fibular) nerves usually at apex of popliteal fossa."),
  spacer(),
  heading3("5A. Muscles in Gluteal Region / Posterior Thigh (before division)"),
  spacer(),
  makeTable(
    ["S.No.", "Muscle", "Specific Branch", "Action"],
    [
      ["1", "Biceps femoris — long head", "Tibial division of sciatic", "Knee flexion + lateral rotation of leg"],
      ["2", "Semitendinosus", "Tibial division of sciatic", "Knee flexion + medial rotation"],
      ["3", "Semimembranosus", "Tibial division of sciatic", "Knee flexion + medial rotation"],
      ["4", "Adductor magnus — hamstring part", "Tibial division of sciatic", "Hip extension"],
      ["5", "Biceps femoris — short head", "Common peroneal division", "Knee flexion"],
    ],
    [500, 2200, 2400, 2900]
  ),
  spacer(2),
];

// 5B Tibial
const tibialNerve = [
  heading3("5B. Tibial Nerve (L4, L5, S1, S2, S3)"),
  spacer(),
  bodyPara("Medial terminal branch of sciatic. Runs through posterior compartment of leg to foot."),
  spacer(),
  makeTable(
    ["S.No.", "Muscle", "Action"],
    [
      ["1", "Gastrocnemius (medial & lateral heads)", "Plantarflexion + knee flexion"],
      ["2", "Soleus", "Plantarflexion (main postural muscle)"],
      ["3", "Plantaris", "Weak plantarflexion + knee flexion"],
      ["4", "Popliteus", "'Unlocks' knee (medial rotation of tibia on femur)"],
      ["5", "Tibialis posterior", "Plantarflexion + inversion (maintains medial arch)"],
      ["6", "Flexor digitorum longus (FDL)", "Flexion of lateral 4 toes; plantarflexion"],
      ["7", "Flexor hallucis longus (FHL)", "Flexion of big toe; plantarflexion ('push-off' muscle)"],
    ],
    [500, 2800, 5700]
  ),
  spacer(),
  heading3("Tibial Nerve in Foot (via Medial & Lateral Plantar Nerves)"),
  spacer(),
  makeTable(
    ["S.No.", "Muscle", "Branch", "Action"],
    [
      ["1", "Abductor hallucis", "Medial plantar", "Abduction + flexion of big toe"],
      ["2", "Flexor digitorum brevis", "Medial plantar", "Flexion of middle phalanges of toes 2–5"],
      ["3", "Flexor hallucis brevis", "Medial plantar", "Flexion of big toe MTP"],
      ["4", "1st Lumbrical", "Medial plantar", "MTP flexion + IP extension of 2nd toe"],
      ["5", "Quadratus plantae", "Lateral plantar", "Modifies pull of FDL; toe flexion"],
      ["6", "Lumbricals 2nd–4th", "Lateral plantar", "MTP flexion + IP extension"],
      ["7", "Abductor digiti minimi", "Lateral plantar", "Abduction of little toe"],
      ["8", "Flexor digiti minimi brevis", "Lateral plantar", "Flexion of little toe"],
      ["9", "Adductor hallucis", "Lateral plantar", "Adduction of big toe"],
      ["10", "All interossei (dorsal & plantar)", "Lateral plantar", "Toe abduction / adduction"],
    ],
    [500, 2200, 1800, 3500]
  ),
  spacer(),
  noteBox("Injury result: Loss of plantarflexion, absent ankle jerk (S1/S2); 'claw toes'; loss of push-off in gait. Tarsal tunnel syndrome affects tibial nerve."),
  spacer(2),
];

// Common Peroneal
const peronealNerve = [
  heading3("5C. Common Peroneal (Fibular) Nerve (L4, L5, S1)"),
  spacer(),
  bodyPara("Lateral terminal branch of sciatic. Winds around neck of fibula — most vulnerable to compression here. Divides into Deep and Superficial peroneal nerves."),
  spacer(),
  makeTable(
    ["S.No.", "Muscle", "Branch", "Action", "Injury Effect"],
    [
      ["1", "Tibialis anterior", "Deep peroneal", "Dorsiflexion + inversion", "FOOT DROP — most characteristic sign"],
      ["2", "Extensor hallucis longus", "Deep peroneal", "Extension of big toe; dorsiflexion", "Cannot extend big toe"],
      ["3", "Extensor digitorum longus", "Deep peroneal", "Extension of toes 2–5; dorsiflexion", "Toe drop"],
      ["4", "Peroneus tertius", "Deep peroneal", "Dorsiflexion + eversion", "Weak dorsiflexion"],
      ["5", "Extensor digitorum brevis", "Deep peroneal", "Toe extension (proximal)", "Weak toe extension"],
      ["6", "Extensor hallucis brevis", "Deep peroneal", "Big toe extension", "Weak extension"],
      ["7", "Peroneus (fibularis) longus", "Superficial peroneal", "Eversion + plantarflexion; maintains transverse arch", "Loss of foot eversion"],
      ["8", "Peroneus (fibularis) brevis", "Superficial peroneal", "Eversion of foot", "Loss of eversion; ankle instability"],
    ],
    [400, 1800, 1400, 2200, 2200]
  ),
  spacer(),
  noteBox("Injury result: FOOT DROP — patient cannot dorsiflex foot; 'high-stepping gait' (steppage gait). Most common peroneal injury = fibula neck fracture / prolonged leg crossing."),
  spacer(2),
];

// Other LL nerves
const otherLLNerves = [
  heading2("6. Other Nerves of Lower Limb"),
  spacer(),
  makeTable(
    ["Nerve", "Root", "Muscle(s) Supplied", "Action / Injury"],
    [
      ["Nerve to obturator internus", "L5, S1", "Obturator internus + Superior gemellus", "Lateral rotation of hip"],
      ["Nerve to quadratus femoris", "L4, L5, S1", "Quadratus femoris + Inferior gemellus", "Lateral rotation + adduction of hip"],
      ["Nerve to piriformis", "S1, S2", "Piriformis", "Lateral rotation of hip; 'piriformis syndrome'"],
      ["Pudendal nerve", "S2, S3, S4", "External urethral & anal sphincters; perineal muscles", "Bladder & bowel continence"],
    ],
    [1800, 900, 2600, 3700]
  ),
  spacer(2),
  pageBreak(),
];

// ── CLINICAL SUMMARY ──
const clinicalSummary = [
  heading1("PART III: CLINICAL SUMMARY"),
  spacer(),
  heading2("Nerve Injury Patterns — Quick Reference"),
  spacer(),
  makeTable(
    ["Nerve Injured", "Deformity / Sign", "Key Test"],
    [
      ["Musculocutaneous", "Weak elbow flexion and supination", "Biceps reflex absent"],
      ["Median (wrist)", "'Ape hand' — thenar wasting; loss of opposition", "A-OK sign; pen test"],
      ["Median (elbow)", "Above + forearm pronators weak; 'pointing index'", "Anterior interosseous test"],
      ["Ulnar (wrist)", "'Claw hand' (ring & little fingers)", "Froment's sign; card test"],
      ["Ulnar (elbow)", "Claw hand + FCU + FDP(4,5) weak", "More severe clawing at wrist level"],
      ["Radial (spiral groove)", "'Wrist drop'; finger extension lost; triceps spared", "Thumbs-up sign fails"],
      ["Radial (axilla)", "Wrist drop + triceps weakness + loss of elbow extension", "Triceps reflex absent"],
      ["Axillary", "Deltoid paralysis — loss of abduction; flattened shoulder", "Shoulder ABD < 15°"],
      ["Long thoracic", "'Winged scapula' on wall push-up", "Push-up / wall push test"],
      ["Femoral", "Quadriceps paralysis; absent knee jerk", "Cannot extend knee"],
      ["Obturator", "Weak adduction; difficulty crossing legs", "Adduction against resistance"],
      ["Superior gluteal", "Trendelenburg gait; waddling (bilateral)", "Trendelenburg test positive"],
      ["Inferior gluteal", "Weak hip extension; difficulty climbing stairs", "Hip extension against resistance"],
      ["Common peroneal", "'Foot drop'; steppage gait", "Dorsiflexion absent"],
      ["Tibial", "Loss of plantarflexion; absent ankle jerk; claw toes", "Stand on tiptoes impossible"],
    ],
    [2000, 2800, 3200]
  ),
  spacer(2),
];

// ── MNEMONICS ──
const mnemonics = [
  heading2("Important Mnemonics"),
  spacer(),
  makeTable(
    ["Nerve", "Mnemonic", "Stands For"],
    [
      ["Musculocutaneous", "BBC", "Brachialis, Biceps, Coracobrachialis"],
      ["Median (hand)", "LOAF", "Lumbricals 1&2, Opponens pollicis, Abductor pollicis brevis, Flexor pollicis brevis (superficial)"],
      ["Ulnar (interossei)", "DAB / PAD", "Dorsal = Abduct; Palmar = Adduct"],
      ["Radial", "BEST", "Brachioradialis, Extensors (all wrist & finger), Supinator, Triceps"],
      ["Brachial plexus cords", "MLP", "Medial cord → Ulnar; Lateral cord → Musculocutaneous; Posterior cord → Radial + Axillary"],
      ["Rotator cuff", "SITS", "Supraspinatus, Infraspinatus, Teres minor, Subscapularis"],
    ],
    [1800, 900, 6300]
  ),
  spacer(2),
  pageBreak(),
];

// ── CONCLUSION ──
const conclusion = [
  heading1("CONCLUSION"),
  spacer(),
  bodyPara(
    "A thorough knowledge of nerve-wise muscle supply is indispensable for any healthcare professional. By understanding which nerve supplies which muscle, clinicians can:"
  ),
  bulletPara("Accurately diagnose the level and site of a peripheral nerve injury"),
  bulletPara("Differentiate between upper motor neuron (UMN) and lower motor neuron (LMN) lesions"),
  bulletPara("Plan targeted physiotherapy, NMES, and nerve re-education programs"),
  bulletPara("Guide surgical planning for nerve repair, tendon transfers, and joint stabilization"),
  bulletPara("Predict functional recovery and establish realistic rehabilitation goals"),
  spacer(),
  bodyPara(
    "In the upper limb, the radial nerve is the 'great extensor nerve', the median nerve is the 'nerve of precision grip', and the ulnar nerve controls the intrinsic fine movements of the hand. In the lower limb, the femoral nerve is critical for knee extension and ambulation, while the sciatic nerve and its branches govern all ankle and foot movements. Injury to any of these nerves results in characteristic, predictable deficits that form the basis of clinical neurological examination."
  ),
  spacer(2),
  pageBreak(),
];

// ── REFERENCES ──
const references = [
  heading1("REFERENCES"),
  spacer(),
  bodyPara("1. Standring S. (Ed.). Gray's Anatomy: The Anatomical Basis of Clinical Practice. 41st ed. Elsevier; 2015."),
  bodyPara("2. Moore KL, Dalley AF, Agur AMR. Clinically Oriented Anatomy. 8th ed. Wolters Kluwer; 2017."),
  bodyPara("3. Sinnatamby CS. Last's Anatomy: Regional and Applied. 12th ed. Churchill Livingstone; 2011."),
  bodyPara("4. THIEME Atlas of Anatomy: General Anatomy and Musculoskeletal System. 3rd ed. Thieme; 2020."),
  bodyPara("5. Rosen's Emergency Medicine: Concepts and Clinical Practice. 9th ed. Elsevier; 2018."),
  bodyPara("6. Aids to the Examination of the Peripheral Nervous System. 5th ed. Saunders; 2010."),
  spacer(2),
];

// ─── ASSEMBLE DOCUMENT ────────────────────────────────────────────────
const allContent = [
  ...titlePage,
  ...introduction,
  ...upperLimbIntro,
  ...musculocutaneous,
  ...medianNerve,
  ...ulnarNerve,
  ...radialNerve,
  ...axillaryNerve,
  ...suprascapularNerve,
  ...otherULNerves,
  ...lowerLimbIntro,
  ...femoralNerve,
  ...obturatorNerve,
  ...supGluteal,
  ...infGluteal,
  ...sciaticHamstrings,
  ...tibialNerve,
  ...peronealNerve,
  ...otherLLNerves,
  ...clinicalSummary,
  ...mnemonics,
  ...conclusion,
  ...references,
];

const doc = new Document({
  styles: {
    default: {
      document: {
        run: { font: "Calibri", size: 20, color: "000000" },
        paragraph: { spacing: { line: 276 } },
      },
    },
  },
  sections: [
    {
      headers: {
        default: new Header({
          children: [
            new Paragraph({
              children: [
                new TextRun({ text: "Nerve-wise Muscle Supply: Upper & Lower Limb", bold: true, size: 18, color: MED_BLUE }),
                new TextRun({ text: "\t\t", size: 18 }),
                new TextRun({ text: "Assignment", size: 18, color: "888888" }),
              ],
              border: { bottom: { style: BorderStyle.SINGLE, size: 4, color: MED_BLUE } },
              tabStops: [{ type: "right", position: 9000 }],
            }),
          ],
        }),
      },
      footers: {
        default: new Footer({
          children: [
            new Paragraph({
              children: [
                new TextRun({ text: "Anatomy / Kinesiology | ", size: 16, color: "888888" }),
                new TextRun({ text: "Peripheral Nerve Innervation", size: 16, color: "888888" }),
                new TextRun({ text: "\t\tPage ", size: 16, color: "888888" }),
                new PageNumber(),
              ],
              border: { top: { style: BorderStyle.SINGLE, size: 4, color: MED_BLUE } },
              tabStops: [{ type: "right", position: 9000 }],
            }),
          ],
        }),
      },
      children: allContent,
    },
  ],
});

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

cd /home/daytona/workspace/nerve-assignment && node create_assignment.js 2>&1

Editing File

~/nerve-assignment/create_assignment.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/nerve-assignment/create_assignment.js'
Editing File

~/nerve-assignment/create_assignment.js

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

cd /home/daytona/workspace/nerve-assignment && node create_assignment.js 2>&1

Running Command

node -e "const d = require('docx'); console.log(Object.keys(d).filter(k => k.toL…

Running Command

node -e "const {PageNumberElement} = require('docx'); console.log(typeof PageNum…

Editing File

~/nerve-assignment/create_assignment.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/nerve-assignment/create_assignment.js'
Editing File

~/nerve-assignment/create_assignment.js

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

cd /home/daytona/workspace/nerve-assignment && node create_assignment.js 2>&1

Running Command

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

Running Command

ls -lh /home/daytona/workspace/nerve-assignment/Nerve_Muscle_Supply_Assignment.d…

Your assignment is ready! Download it here:

Nerve Muscle Supply Assignment

Word Document · DOCX


Assignment mein ye sab included hai:
Structure (Professional format with colored headings, tables, page numbers):
PART I - UPPER LIMB
  1. Musculocutaneous Nerve - BBC muscles (Brachialis, Biceps, Coracobrachialis)
  2. Median Nerve - Forearm muscles + LOAF hand muscles with AIN branch details
  3. Ulnar Nerve - FCU, FDP (medial) + all intrinsics in hand
  4. Radial Nerve - Triceps, all extensors + PIN branch muscles
  5. Axillary Nerve - Deltoid (3 heads), Teres minor
  6. Suprascapular Nerve - Supraspinatus, Infraspinatus
  7. Other nerves - Long thoracic, Thoracodorsal, Subscapular, Pectoral nerves
PART II - LOWER LIMB
  1. Femoral Nerve - Quadriceps, Iliopsoas, Sartorius
  2. Obturator Nerve - All adductors
  3. Superior Gluteal Nerve - Glut. medius/minimus, TFL
  4. Inferior Gluteal Nerve - Gluteus maximus
  5. Sciatic Nerve - Hamstrings + Tibial + Common Peroneal (deep & superficial) with full foot muscles
PART III - Clinical Summary
  • Injury patterns table (deformity + test for each nerve)
  • All mnemonics (LOAF, DAB/PAD, BEST, BBC, SITS, etc.)
  • Conclusion + References (Gray's Anatomy, Moore, Last's, THIEME Atlas)
This is a shared conversation. Sign in to Orris to start your own chat.