2026 theory knruhs final exam expected pediatric orthopaedics 10 questions so that i can focus on them . most important questions in their order of importance

Reading File
Finding Sources
Searching the Web

KNRUHS 2026 pediatric orthopaedics final exam important questions theory

Finding Sources
Searching the Web

KNRUHS MS orthopaedics final exam pediatric orthopaedics repeated questions 2024 2025

Finding Sources
Finding Sources
Reading Web Page

https://www.slideshare.net/slideshow/msortho-previous-questi…

Finding Sources
Finding Sources
Finding Sources
I now have comprehensive data from Campbell's 2026, Miller's Review, and previous KNRUHS/NTR exam papers. Let me compile the definitive top-10 list.
Based on Campbell's Operative Orthopaedics 15th Ed 2026, Miller's Review of Orthopaedics 9th Ed, Orthobullets importance rankings, and analysis of previous NTRUHS/KNRUHS MS Orthopaedics paper patterns, here are the 10 most important pediatric orthopaedics theory questions ranked by exam frequency and marks potential:

Top 10 Pediatric Orthopaedics Questions - KNRUHS Theory Final Exam


1. Supracondylar Fracture of Humerus in Children

Why #1: Highest importance rating on Orthobullets (Grade A, 143 points), repeatedly asked in NTRUHS papers, and has diagnostic + therapeutic + prognostic complexity ideal for theory questions.
Key points to cover:
  • Gartland classification (Type I, II, III) - and Type IV (added later)
  • Extension type (98%) vs flexion type
  • Neurovascular assessment - anterior interosseous nerve (most common nerve injury), radial nerve, brachial artery
  • Management: Type I - cast; Type II - closed reduction + cast or percutaneous K-wires; Type III - CRPP (closed reduction percutaneous pinning) or ORIF
  • Surgical emergency if pulseless hand (non-perfused limb = immediate surgery to prevent Volkmann ischemic contracture)
  • Compartment syndrome in 0.1-0.3%
  • Complications: Volkmann ischemic contracture, cubitus varus (gunstock deformity - most common late complication), malunion
  • K-wire configuration: lateral-only (safer, avoids ulnar nerve) vs cross-pinning

2. Developmental Dysplasia of Hip (DDH)

Why #2: Grade A Orthobullets topic (115 points), asked in virtually every NTRUHS exam session. Huge topic covering neonate to adolescent.
Key points to cover:
  • Risk factors: female, first-born, breech, positive family history, oligohydramnios
  • Pathology: shallow acetabulum, lax capsule, anteverted femoral neck
  • Ortolani sign (reduces dislocated hip) vs Barlow sign (provokes dislocation)
  • Imaging: Ultrasound (Graf classification) < 6 months; X-ray (Hilgenreiner, Perkins lines, Shenton's arc) > 6 months
  • Acetabular index (normal <30°), CE angle
  • Treatment by age: 0-6 months = Pavlik harness (first-line); 6-18 months = closed/open reduction + spica cast; 18 months-8 years = open reduction + Salter innominate osteotomy; >8 years = Chiari/shelf osteotomy
  • Complications: avascular necrosis of femoral head (most feared)

3. Perthes Disease (Legg-Calvé-Perthes Disease)

Why #3: A classic NTRUHS question (appeared in multiple paper-III sessions). Avascular necrosis of the femoral head in children aged 4-8 years.
Key points to cover:
  • Age: 4-8 years, boys >> girls (4:1), bilateral in 10-15%
  • Etiology: idiopathic AVN of femoral epiphysis
  • Catterall classification (Groups I-IV by extent of head involvement) and Herring lateral pillar classification (A, B, B/C, C) - more prognostically relevant
  • Waldenstrom stages: initial (dense/necrotic), fragmentation, reossification (healing), residual deformity
  • Clinical: painless limp, Trendelenburg gait, restricted abduction/internal rotation
  • MRI is the earliest investigation
  • Principle of containment - keep femoral head within acetabulum during healing
  • Treatment: Age <6 = observation/physiotherapy; Age 6-8 = conservative containment (abduction brace/Petrie cast); Age >8 with lateral pillar B/C or C = femoral varus osteotomy or Salter innominate osteotomy
  • Prognosis: Spherical head at skeletal maturity = good prognosis (Mose method)

4. Slipped Capital Femoral Epiphysis (SCFE)

Why #4: Grade A topic, repeatedly asked in NTRUHS theory (appeared 2010, multiple sessions). The only physeal slip that passes through the zone of hypertrophy.
Key points to cover:
  • Age: 10-16 years; obese males (typical), or tall thin adolescent growth spurt
  • Always check the contralateral hip (20-40% bilateral)
  • X-ray: Klein's line (line along superior femoral neck should intersect the epiphysis - it misses in SCFE); Steel sign (crescent of metaphysis overlapping ischium)
  • Southwick angle to grade severity: Mild <30°, Moderate 30-60°, Severe >60°
  • Stable (can bear weight) vs Unstable (cannot bear weight - ~50% AVN risk)
  • Treatment: In situ fixation with single central screw - standard of care regardless of severity
  • Unstable SCFE = surgical emergency (fix within 24 hours)
  • Modified Dunn procedure for severe/unstable SCFE (better anatomy but higher AVN risk)
  • Complications: AVN (most feared), chondrolysis

5. Congenital Talipes Equinovarus (CTEV / Clubfoot)

Why #5: "A-list topic" for exams (musculoskeletal key). Repeatedly asked in NTRUHS theory. Classic question with components, management protocol.
Key points to cover:
  • Deformities (CAVE mnemonic): Cavus (high arch), Adductus (forefoot adduction), Varus (heel varus), Equinus (plantarflexion) - corrected in this order
  • Incidence 1-2/1000, male > female, bilateral 50%
  • Pirani score and Dimeglio score for severity
  • Ponseti method (gold standard): serial casting (5-7 casts over 6-8 weeks) + Achilles tenotomy (~80% need it) + Dennis-Browne boots and bar for 4-5 years
  • French functional method (Lyon method) - physiotherapy alternative
  • Surgical: Posteromedial release (Cincinnati incision) - for failed conservative treatment; now rarely needed with Ponseti
  • Relapse is common - retreatment with casting or tibialis anterior tendon transfer (lateral transfer for dynamic supination)
  • vs. Positional talipes (flexible, corrects with gentle pressure - no treatment needed)

6. Pediatric Septic Arthritis and Acute Hematogenous Osteomyelitis

Why #6: Appeared in NTRUHS papers (2009, 2010, Tom Smith's arthritis). Combined topic since they often occur together, especially at the hip.
Key points to cover:
  • Osteomyelitis: metaphysis most affected (rich sinusoidal vasculature, sluggish flow, absence of phagocytes)
  • Kocher criteria for septic arthritis of hip: fever, non-weight-bearing, ESR >40, WBC >12,000 - 4 criteria = 99% probability
  • Causative organisms: Neonates - Group B Streptococcus, S. aureus; 1 month-5 years - S. aureus, H. influenzae (vaccinated = rare); Adolescents - S. aureus; Sickle cell - Salmonella
  • Tom Smith arthritis (septic arthritis hip in infants) - destroys the femoral head, leads to pathological dislocation
  • Investigation: MRI (investigation of choice), USS (for effusion/guided aspiration), bone scan
  • Kocher-Loder criteria algorithm
  • Treatment: IV antibiotics (Flucloxacillin + Gentamicin); Surgical drainage if no improvement in 48 hours or abscess present
  • Chronic osteomyelitis: sequestrum (dead bone) + involucrum (new periosteal bone) + cloaca (sinus tract)

7. Idiopathic Scoliosis (Adolescent Idiopathic Scoliosis - AIS)

Why #7: Listed in NTRUHS previous papers; major topic from Campbell's.
Key points to cover:
  • Cobb angle measurement (angle between end vertebrae)
  • Risser sign (skeletal maturity, 0-5) - key for predicting progression and treatment
  • Right thoracic curve most common in AIS
  • King-Moe classification (older) vs Lenke classification (current standard, 6 types)
  • Treatment: <25° = observation (monitor every 6 months); 25-40° = Milwaukee brace or TLSO (Boston brace) - effective only if Risser 0-2 (still growing); >40-50° = surgery (posterior spinal fusion + instrumentation)
  • Surgical: Harrington rods (historical), now pedicle screw constructs + rod correction
  • Neuromuscular vs idiopathic distinction
  • Adam's forward bend test, scoliometer

8. Salter-Harris Classification of Physeal Injuries

Why #8: Fundamental classification used in all pediatric fractures, high-yield for theory.
Key points to cover:
  • Type I: Transverse through physis (SLIPPED) - good prognosis
  • Type II: Through physis + metaphysis (ABOVE - most common, 75%) - Thurston-Holland fragment
  • Type III: Through physis + epiphysis (LOWER) - intra-articular, ORIF needed
  • Type IV: Through metaphysis + physis + epiphysis (THROUGH) - intra-articular, must achieve anatomic reduction
  • Type V: Crush/compression of physis (RAMMED) - worst prognosis, growth arrest
  • Peterson Type VI (later addition): periosteal injury
  • Complications: premature physeal closure, angular deformity, limb length discrepancy
  • Mnemonic: SALTR (Slipped, Above, Lower, Through, Rammed)

9. Cerebral Palsy - Orthopaedic Management

Why #9: Major topic from Campbell's; increasing exam relevance. Tests understanding of neuromuscular orthopaedics.
Key points to cover:
  • Upper motor neuron disorder, non-progressive but permanent
  • Spastic type (most common, 70-80%) - unilateral (hemiplegia), bilateral (diplegia - Little's disease, most common), quadriplegia
  • GMFCS (Gross Motor Function Classification System) I-V
  • Common deformities: equinus foot (most common - Achilles tightening), hip subluxation/dislocation (spastic diplegia), scissoring gait, crouch gait
  • Gait analysis: gold standard for pre-surgical planning
  • SEMLS (Single Event Multilevel Surgery) - superior to staged procedures for ambulatory CP
  • Spasticity management: physiotherapy, oral Baclofen, Botulinum toxin (temporary, 3-6 months), intrathecal Baclofen pump, selective dorsal rhizotomy
  • Hip surveillance protocol (annual x-rays for migration percentage)
  • Surgical options: soft tissue (muscle lengthening, tendon transfer) vs bony procedures (derotation osteotomy)

10. Limb Length Discrepancy (LLD)

Why #10: Previous NTRUHS papers; comprehensive topic from Campbell's with major sections.
Key points to cover:
  • Assessment: Galeazzi sign, measurement by blocks, scanography (most accurate), CT scanogram
  • Growth prediction methods: Moseley straight line graph, Green-Anderson tables, multiplier method (most modern)
  • Causes: post-traumatic (physeal arrest), DDH, hemihypertrophy, polio, Perthes
  • Treatment thresholds: <2 cm = shoe raise; 2-5 cm = epiphysiodesis (permanent), shoe raise or lengthening; >5 cm = limb lengthening (Ilizarov method / distraction osteogenesis)
  • Epiphysiodesis timing: must be done before physis closes; Bowen/Moseley method to time
  • Ilizarov principle: gradual distraction at 1 mm/day in 0.25 mm increments x4 daily
  • Complications of limb lengthening: pin tract infection, joint contracture, premature consolidation, non-union

Quick Ranking Summary

RankTopicExam Priority
1Supracondylar Fracture of Humerus★★★★★
2Developmental Dysplasia of Hip (DDH)★★★★★
3Perthes Disease★★★★★
4Slipped Capital Femoral Epiphysis (SCFE)★★★★★
5Clubfoot (CTEV) / Ponseti Method★★★★☆
6Pediatric Septic Arthritis / Osteomyelitis★★★★☆
7Adolescent Idiopathic Scoliosis★★★★☆
8Salter-Harris Classification★★★★☆
9Cerebral Palsy - Orthopaedic Management★★★☆☆
10Limb Length Discrepancy★★★☆☆

Sources: Campbell's Operative Orthopaedics 15th Ed 2026, Miller's Review of Orthopaedics 9th Ed, previous NTRUHS/KNRUHS MS Orthopaedics paper analysis (2009-2025), Orthobullets Pediatric Specialty rankings.
Exam tip: Topics 1-4 are near-certain to appear in some form. For each, know the classification, clinical presentation, investigation of choice, treatment algorithm by age/severity, and complications. The KNRUHS paper format (short essays, 10 marks each) rewards structured answers with labeled diagrams - always draw diagrams for DDH (Pavlik harness, lines on x-ray), Perthes (stages), SCFE (Klein's line), and Salter-Harris.

give me 10 more for safe side

Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Searching the Web

KNRUHS NTRUHS MS orthopaedics paper III pediatric elective questions repeated topics

Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Solid data from Campbell's 2026 and Miller's Review for all 10 additional topics. Here is your complete second set:

Next 10 Pediatric Orthopaedics Questions - "Safe Side" List


11. Tibia Vara (Blount Disease)

Why #11: Directly appeared in NTRUHS November 2016 Paper-III ("presentation, diagnosis and management of tibia vara in a child"). High-yield because it must be differentiated from physiologic bowing.
Key points to cover:
  • Pathological genu varum - failure of medial proximal tibial physis (zone of hypertrophy)
  • Infantile (0-3 yrs, bilateral, obese) vs Late-onset (adolescent, unilateral, obese)
  • Langenskiold classification (Stages I-VI for infantile) - Stage IV+ requires surgery
  • X-ray: metaphyseal-diaphyseal angle (Drennan angle) >11° is pathological; fragmentation and beaking of medial tibial metaphysis
  • Differential diagnosis: physiologic bowing (improves by 2 years, no beak, symmetrical), rickets (cupping/fraying of metaphysis)
  • Treatment: <3 years (infantile) = KAFO brace (knee-ankle-foot orthosis) if caught early; >3 years or Stage III+ = proximal tibial valgus osteotomy; adolescent = corrective osteotomy or hemi-epiphysiodesis (guided growth with 8-plate)
  • Ilizarov method for severe/complex cases

12. Lateral Condyle Fracture of Humerus in Children

Why #12: "Must master" elbow fracture in pediatric exams (Musculoskeletal Key). Second most common elbow fracture in children after supracondylar.
Key points to cover:
  • Age 5-10 years, Salter-Harris Type IV fracture
  • Jakob classification (3 types based on displacement): Stage I (<2 mm), Stage II (2 mm, fragment hinge on lateral cortex), Stage III (complete displacement + rotation)
  • The fracture is intra-articular - articular cartilage holds fragments even when bone looks minimally displaced on X-ray
  • Arthrogram is gold standard to assess articular disruption
  • Management: <2 mm displacement = cast immobilization + serial X-rays; >2 mm = ORIF with K-wires or screws
  • Complications: Non-union is the most dreaded (due to synovial fluid bathing the fracture site) - leads to cubitus valgus + tardy ulnar nerve palsy (delayed ulnar nerve palsy years later)
  • Also know: medial epicondyle fracture (look for incarcerated fragment in elbow joint)

13. Congenital Pseudarthrosis of Tibia (CPT)

Why #13: Appeared in NTRUHS previous papers (2009 exam). A challenging surgical problem. Strong association with NF-1.
Key points to cover:
  • Anterolateral bowing of tibia - pathognomonic presentation
  • Associated with Neurofibromatosis Type 1 (NF-1) in 50-60% of cases
  • Crawford/Boyd classification (Types I-IV): Type I = anterolateral bowing with no fracture; Type II = bowing with cortical thickening/sclerosis; Type III = cyst formation; Type IV = frank pseudarthrosis
  • Management: prophylactic splinting/bracing in pre-fracture stages; once fracture occurs = surgery required
  • Surgical options: intramedullary rodding (Williams rod), Ilizarov fixator, vascularized fibular graft (best results for established pseudarthrosis), BMP (bone morphogenic protein) adjunct
  • Prognosis is poor - multiple surgeries often needed; amputation considered if 3+ failed surgeries
  • Unlike clavicle pseudarthrosis - union is NOT predictable

14. Osteochondroses - Osgood-Schlatter & Osteochondritis Dissecans

Why #14: Osgood-Schlatter appeared in NTRUHS 2009 paper. Combined topic since both involve apophyseal/epiphyseal stress in adolescents.
Osgood-Schlatter Disease:
  • Traction apophysitis of tibial tubercle (patellar tendon insertion)
  • Adolescent males, active/athletic, bilateral in 20-30%
  • Pain and swelling over tibial tubercle aggravated by activity
  • X-ray: fragmentation of tibial tubercle ossification center
  • Treatment: conservative - activity modification, ice, NSAIDs, quadriceps stretching; resolves at skeletal maturity
  • Surgery rare - ossicle resection + tibial tubercleplasty for unresolved cases
Osteochondritis Dissecans (OCD):
  • Segment of subchondral bone loses blood supply + may detach from articular surface
  • Medial femoral condyle (most common), talar dome, capitellum
  • Juveniles: stable lesion, high healing potential; Adults: less likely to heal
  • MRI is investigation of choice (shows stability of fragment)
  • Treatment: Stable lesion = conservative (restrict activity, 6 months); Unstable/detached = arthroscopic drilling, fixation, or removal of loose body

15. Pelvic Osteotomies in Children

Why #15: High-yield classification topic; tested in context of DDH, Perthes, CP hip. "Type of pelvic osteotomy is best determined by 3D CT."
Classification and indications:
  • Redirectional (reorienting): redirect existing acetabulum
    • Salter innominate osteotomy: age 18 months-6 years, redirects anterolaterally - best for DDH with adequate acetabular cartilage; single cut through innominate bone; opens at symphysis pubis
    • Triple osteotomy (Steel/Tönnis/Ganz): older children/adolescents, larger correction possible; cuts ilium + ischium + pubis
    • Ganz periacetabular osteotomy (PAO): near-adult acetabulum, maximum correction, preserves blood supply
  • Salvage (augmentative): for late DDH/insufficient cartilage
    • Chiari osteotomy: curved medial displacement osteotomy, fibrocartilage fills superior defect; for older children >8 yrs
    • Shelf procedure (acetabuloplasty): bone graft added above acetabulum laterally
  • Reshaping: for Perthes
    • Dega osteotomy: incomplete osteotomy with hinge on medial cortex; favored in CP for posterosuperior deficiency

16. Tarsal Coalition

Why #16: Listed by Musculoskeletal Key as a common condition all orthopaedic surgeons must know; appears in general pediatric foot section.
Key points to cover:
  • Failure of segmentation (mesenchymal differentiation failure) of adjacent tarsal bones
  • Calcaneonavicular coalition (most common, 53%) and talocalcaneal coalition (middle facet, 37%)
  • Presents in adolescence when coalition ossifies: hindfoot pain, recurrent ankle sprains, peroneal spastic flatfoot (spasm of peroneal muscles)
  • X-ray: calcaneonavicular coalition = best seen on oblique foot view ("anteater nose" sign); talocalcaneal = Harris axial view (best) + CT for definitive diagnosis; MRI for fibrous/cartilaginous coalitions
  • Treatment: Symptomatic = activity modification, orthotics, casting; Surgical = resection of coalition + fat/muscle interposition (Extensor digitorum brevis for calcaneonavicular); if severe arthritic changes = subtalar or triple arthrodesis

17. Duchenne Muscular Dystrophy (DMD) - Orthopaedic Management

Why #17: Key neuromuscular orthopaedics topic from Campbell's. Tests understanding of progressive deformity management in a systemic disease.
Key points to cover:
  • X-linked recessive, Xp21, absence of dystrophin gene product
  • Males only (females are carriers); presents 3-5 years
  • Gowers' sign (climbing up own legs to stand from floor) - classic
  • Progressive proximal muscle weakness; calf pseudohypertrophy
  • CPK markedly elevated; EMG + muscle biopsy confirms
  • Orthopaedic deformities: equinus contracture (Achilles), hip flexion contracture, scoliosis (progressive once non-ambulatory)
  • Corticosteroids (deflazacort/prednisolone) slow progression and delay scoliosis
  • Scoliosis: posterior spinal fusion once Cobb >20-25° in non-ambulatory DMD (early surgery recommended before respiratory function declines FVC <40%)
  • Lower limb surgery: Achilles + iliotibial band releases to prolong ambulation
  • Prognosis: non-ambulatory by 10-14 yrs; cardiac/respiratory death 20s-30s

18. Non-Accidental Injury (NAI) / Battered Child Syndrome

Why #18: Increasingly tested; Campbell's dedicates a section to "Growth Injuries, Birth Injuries, and Nonaccidental Trauma." Medico-legally important.
Key points to cover:
  • Kempe first described battered child syndrome (1962)
  • Suspect NAI when: injury inconsistent with history, multiple fractures at different stages of healing, delay in seeking treatment, unusual fracture patterns, bilateral/symmetric injuries
  • Classic fractures in NAI: posterior rib fractures (most specific), metaphyseal corner/bucket-handle fractures (high specificity), spiral fractures in non-ambulatory children, bilateral subdural hematomas
  • Spiral femur fracture in <1 year old = high suspicion
  • Investigations: skeletal survey (full body x-rays), bone scan (may detect occult fractures), ophthalmology (retinal hemorrhages = shaken baby)
  • Management: medical stabilization, report to child protection services, multidisciplinary team involvement
  • Prognosis: 30% mortality if returned to abusive environment

19. Congenital / Developmental Coxa Vara

Why #19: Campbell's has dedicated section; niche but high-yield short essay topic.
Key points to cover:
  • Neck-shaft angle <120° (normal 130-135°)
  • Failure of endochondral ossification in the inferomedial femoral neck
  • Hilgenreiner-epiphyseal (HE) angle (angle between Hilgenreiner line and femoral capital physis): >60° = likely to progress; <45° = likely to remodel; 45-60° = uncertain
  • Inverted Y radiographic sign (triangular fragment in femoral neck = characteristic)
  • Clinical: short limb, Trendelenburg gait, limited abduction, painless limp
  • Treatment: HE angle >60° or progressive = valgus subtrochanteric osteotomy (aim for neck-shaft angle ~150° to prevent recurrence)
  • Can be associated with: cleidocranial dysostosis, rickets, Paget's disease (in adults)

20. Congenital Vertical Talus (Rocker-Bottom Foot)

Why #20: Opposite of clubfoot - important to distinguish; tested in foot deformity questions.
Key points to cover:
  • Rigid flatfoot deformity with dorsal dislocation of navicular on talus
  • Talus is vertically oriented (plantar flexed), calcaneus in equinus
  • Foot looks like a rocker-bottom (convex plantar surface)
  • 50% associated with systemic conditions (spina bifida, arthrogryposis, chromosomal syndromes)
  • X-ray: on lateral view - talus points plantar, calcaneus in equinus; navicular dislocated dorsal to talus (navicular is not ossified until 3-4 years, so difficult to visualize directly - infer from position of first metatarsal axis)
  • Forced plantar flexion lateral X-ray: distinguishes CVT (navicular remains dislocated) from oblique talus (navicular reduces)
  • Treatment: Reverse Ponseti method (serial casting in opposite direction - plantarflexion/adduction) then single surgical reduction via 2-incision technique (Dobbs method); traditional = Cincinnati incision open reduction
  • Must distinguish from: oblique talus (reduces on plantarflexion X-ray), calcaneovalgus foot (flexible), flexible flatfoot

Complete 20-Question Master Table

#TopicPriority
1Supracondylar Fracture of Humerus★★★★★
2DDH (Developmental Dysplasia Hip)★★★★★
3Perthes Disease★★★★★
4SCFE★★★★★
5Clubfoot (CTEV / Ponseti)★★★★☆
6Septic Arthritis / Osteomyelitis★★★★☆
7Adolescent Idiopathic Scoliosis★★★★☆
8Salter-Harris Classification★★★★☆
9Cerebral Palsy★★★☆☆
10Limb Length Discrepancy★★★☆☆
11Blount Disease (Tibia Vara)★★★★☆
12Lateral Condyle Fracture Humerus★★★★☆
13Congenital Pseudarthrosis Tibia★★★☆☆
14Osgood-Schlatter / OCD★★★☆☆
15Pelvic Osteotomies★★★☆☆
16Tarsal Coalition★★★☆☆
17Duchenne Muscular Dystrophy★★★☆☆
18Non-Accidental Injury (NAI)★★★☆☆
19Developmental Coxa Vara★★☆☆☆
20Congenital Vertical Talus★★☆☆☆

Sources: Campbell's Operative Orthopaedics 15th Ed 2026, Miller's Review of Orthopaedics 9th Ed, NTRUHS/KNRUHS MS Orthopaedics previous question paper analysis. Good luck with your exam!

Generate a Word document with structured essay answers for exam preparation

Asking for Preferences
Reading File
Running Command

mkdir -p /home/daytona/workspace/peds-ortho-exam && ls /home/daytona/workspace/peds-ortho-exam/

Writing File

~/peds-ortho-exam/generate.js

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

// ─── COLOUR PALETTE ───────────────────────────────────────────────────────────
const DARK_BLUE  = "1B3A6B";  // heading bg
const MID_BLUE   = "2E5FA3";  // sub-heading text
const LIGHT_BLUE = "D6E4F7";  // intro box bg
const ACCENT     = "C0392B";  // important markers
const WHITE      = "FFFFFF";
const BLACK      = "000000";
const GREY_TEXT  = "444444";
const LIGHT_GREY = "F2F4F7";  // bullet row alt bg

// ─── HELPERS ──────────────────────────────────────────────────────────────────
const INDENT = { left: 360 };
const BODY_FONT = "Calibri";
const HEAD_FONT = "Calibri";

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

function spacer(pts = 6) {
  return new Paragraph({
    children: [],
    spacing: { before: pts * 20, after: pts * 20 }
  });
}

function mainTitle(text) {
  return new Paragraph({
    children: [new TextRun({ text, font: HEAD_FONT, size: 36, bold: true, color: WHITE })],
    heading: HeadingLevel.TITLE,
    alignment: AlignmentType.CENTER,
    shading: { type: ShadingType.SOLID, fill: DARK_BLUE },
    spacing: { before: 0, after: 200 },
    border: {
      bottom: { style: BorderStyle.THICK, size: 6, color: ACCENT }
    }
  });
}

function subtitle(text) {
  return new Paragraph({
    children: [new TextRun({ text, font: HEAD_FONT, size: 22, color: LIGHT_BLUE, bold: true })],
    alignment: AlignmentType.CENTER,
    spacing: { before: 100, after: 100 }
  });
}

function sectionHeader(num, title) {
  // Full-width shaded heading bar
  return new Paragraph({
    children: [
      new TextRun({ text: `Q${num}.  `, font: HEAD_FONT, size: 26, bold: true, color: ACCENT }),
      new TextRun({ text: title, font: HEAD_FONT, size: 26, bold: true, color: WHITE }),
    ],
    shading: { type: ShadingType.SOLID, fill: DARK_BLUE },
    spacing: { before: 400, after: 160 },
    indent: { left: 0 }
  });
}

function subHeading(text) {
  return new Paragraph({
    children: [new TextRun({ text, font: HEAD_FONT, size: 22, bold: true, color: MID_BLUE, underline: { type: UnderlineType.SINGLE, color: MID_BLUE } })],
    spacing: { before: 200, after: 80 }
  });
}

function introBox(text) {
  return new Table({
    width: { size: 100, type: WidthType.PERCENTAGE },
    rows: [
      new TableRow({
        children: [
          new TableCell({
            children: [
              new Paragraph({
                children: [new TextRun({ text, font: BODY_FONT, size: 20, italics: true, color: "1B3A6B" })],
                spacing: { before: 80, after: 80 },
                indent: { left: 120, right: 120 }
              })
            ],
            shading: { type: ShadingType.SOLID, fill: LIGHT_BLUE },
            borders: {
              top:    { style: BorderStyle.THICK, size: 6, color: MID_BLUE },
              left:   { style: BorderStyle.THICK, size: 12, color: ACCENT },
              bottom: { style: BorderStyle.THICK, size: 6, color: MID_BLUE },
              right:  { style: BorderStyle.NIL }
            }
          })
        ]
      })
    ]
  });
}

function bodyPara(text) {
  return new Paragraph({
    children: [new TextRun({ text, font: BODY_FONT, size: 20, color: GREY_TEXT })],
    spacing: { before: 80, after: 80 },
    alignment: AlignmentType.JUSTIFIED
  });
}

function bullet(text, indent = 0, bold = false, color = GREY_TEXT) {
  const extraIndent = 360 + indent * 360;
  return new Paragraph({
    children: [new TextRun({ text, font: BODY_FONT, size: 20, bold, color })],
    bullet: { level: indent },
    spacing: { before: 40, after: 40 },
    indent: { left: extraIndent, hanging: 360 }
  });
}

function keyPoint(label, value) {
  return new Paragraph({
    children: [
      new TextRun({ text: `${label}: `, font: BODY_FONT, size: 20, bold: true, color: MID_BLUE }),
      new TextRun({ text: value, font: BODY_FONT, size: 20, color: GREY_TEXT })
    ],
    spacing: { before: 60, after: 60 },
    indent: INDENT
  });
}

function importantNote(text) {
  return new Table({
    width: { size: 100, type: WidthType.PERCENTAGE },
    rows: [
      new TableRow({
        children: [
          new TableCell({
            children: [
              new Paragraph({
                children: [
                  new TextRun({ text: "! IMPORTANT: ", font: BODY_FONT, size: 20, bold: true, color: ACCENT }),
                  new TextRun({ text, font: BODY_FONT, size: 20, color: "7B1C10" })
                ],
                spacing: { before: 60, after: 60 },
                indent: { left: 80, right: 80 }
              })
            ],
            shading: { type: ShadingType.SOLID, fill: "FEF3F1" },
            borders: {
              left: { style: BorderStyle.THICK, size: 12, color: ACCENT },
              top: { style: BorderStyle.SINGLE, size: 2, color: ACCENT },
              bottom: { style: BorderStyle.SINGLE, size: 2, color: ACCENT },
              right: { style: BorderStyle.NIL }
            }
          })
        ]
      })
    ]
  });
}

// ─── TABLE OF CONTENTS ────────────────────────────────────────────────────────
function tocSection(questions) {
  const rows = questions.map((q, i) =>
    new TableRow({
      children: [
        new TableCell({
          children: [new Paragraph({
            children: [new TextRun({ text: `Q${i+1}`, font: BODY_FONT, size: 20, bold: true, color: WHITE })],
            alignment: AlignmentType.CENTER,
            spacing: { before: 60, after: 60 }
          })],
          shading: { type: ShadingType.SOLID, fill: DARK_BLUE },
          width: { size: 8, type: WidthType.PERCENTAGE },
          verticalAlign: VerticalAlign.CENTER
        }),
        new TableCell({
          children: [new Paragraph({
            children: [new TextRun({ text: q.title, font: BODY_FONT, size: 20, color: MID_BLUE, bold: true })],
            spacing: { before: 60, after: 60 },
            indent: { left: 120 }
          })],
          shading: { type: ShadingType.SOLID, fill: i % 2 === 0 ? LIGHT_GREY : WHITE },
          width: { size: 72, type: WidthType.PERCENTAGE }
        }),
        new TableCell({
          children: [new Paragraph({
            children: [new TextRun({ text: q.stars, font: BODY_FONT, size: 20, color: "D4AC0D" })],
            alignment: AlignmentType.CENTER,
            spacing: { before: 60, after: 60 }
          })],
          shading: { type: ShadingType.SOLID, fill: i % 2 === 0 ? LIGHT_GREY : WHITE },
          width: { size: 20, type: WidthType.PERCENTAGE },
          verticalAlign: VerticalAlign.CENTER
        })
      ]
    })
  );

  const headerRow = new TableRow({
    children: [
      new TableCell({
        children: [new Paragraph({ children: [new TextRun({ text: "#", font: BODY_FONT, size: 20, bold: true, color: WHITE })], alignment: AlignmentType.CENTER, spacing: { before: 80, after: 80 } })],
        shading: { type: ShadingType.SOLID, fill: ACCENT }
      }),
      new TableCell({
        children: [new Paragraph({ children: [new TextRun({ text: "Topic", font: BODY_FONT, size: 20, bold: true, color: WHITE })], indent: { left: 120 }, spacing: { before: 80, after: 80 } })],
        shading: { type: ShadingType.SOLID, fill: ACCENT }
      }),
      new TableCell({
        children: [new Paragraph({ children: [new TextRun({ text: "Priority", font: BODY_FONT, size: 20, bold: true, color: WHITE })], alignment: AlignmentType.CENTER, spacing: { before: 80, after: 80 } })],
        shading: { type: ShadingType.SOLID, fill: ACCENT }
      })
    ]
  });

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

// ─── QUESTION CONTENT ─────────────────────────────────────────────────────────
const questions = [
  {
    title: "Supracondylar Fracture of Humerus in Children",
    stars: "★★★★★",
    content: (fns) => [
      fns.subHeading("Introduction"),
      fns.introBox("Supracondylar fracture is the most common elbow fracture in children (60–70%), typically affecting the 5–8-year age group. It carries significant risk of neurovascular injury and Volkmann ischemic contracture, making it a surgical emergency in certain presentations."),
      spacer(),
      fns.subHeading("Classification – Gartland"),
      fns.keyPoint("Type I", "Undisplaced – anterior humeral line still crosses capitellum"),
      fns.keyPoint("Type II", "Displaced, posterior cortex intact (hinge fracture)"),
      fns.keyPoint("Type III", "Completely displaced, no cortical contact"),
      fns.keyPoint("Type IV", "Multidirectional instability (added later – rotational instability)"),
      spacer(),
      fns.subHeading("Clinical Features"),
      fns.bullet("Extension type (97–98%): fall on outstretched hand, elbow pushed posteriorly"),
      fns.bullet("Flexion type (2–3%): fall on posterior elbow"),
      fns.bullet("S-shaped deformity, swelling, reluctance to move elbow"),
      fns.bullet("Always assess neurovascular status before and after reduction"),
      spacer(),
      fns.subHeading("Neurovascular Injury"),
      fns.keyPoint("Most common nerve", "Anterior interosseous nerve (AIN) – branch of median nerve; unable to make 'OK' sign"),
      fns.keyPoint("Artery", "Brachial artery – check radial pulse + capillary refill"),
      fns.keyPoint("Radial nerve", "Type II extension fractures; wrist drop"),
      fns.importantNote("Non-perfused limb = surgical emergency. Operate immediately to prevent Volkmann ischemic contracture. Compartment syndrome occurs in 0.1–0.3% of cases."),
      spacer(),
      fns.subHeading("Management"),
      fns.bullet("Type I: Above-elbow posterior slab cast (90° flexion, neutral rotation) for 3 weeks"),
      fns.bullet("Type II: Closed reduction + cast if stable; CRPP if unstable"),
      fns.bullet("Type III: CRPP (closed reduction percutaneous pinning) – gold standard"),
      fns.bullet("Open fractures / vascular injury / failed CRPP: ORIF"),
      fns.bullet("K-wire configuration: 2 lateral wires preferred (avoids ulnar nerve); cross-pin if lateral wires inadequate"),
      spacer(),
      fns.subHeading("Complications"),
      fns.bullet("Cubitus varus (gunstock deformity) – most common late complication due to malunion (not AVN)"),
      fns.bullet("Cubitus valgus – less common; tardy ulnar nerve palsy can follow"),
      fns.bullet("Volkmann ischemic contracture – due to compartment syndrome / vascular injury"),
      fns.bullet("Myositis ossificans – excessive soft tissue manipulation"),
      fns.bullet("Pin-track infection, stiffness"),
    ]
  },
  {
    title: "Developmental Dysplasia of the Hip (DDH)",
    stars: "★★★★★",
    content: (fns) => [
      fns.subHeading("Introduction"),
      fns.introBox("DDH encompasses a spectrum from mild acetabular dysplasia to frank dislocation of the femoral head. It is the most common hip disorder in children, with a prevalence of 1–3 per 1000 live births. Early diagnosis and treatment give excellent outcomes; delayed treatment leads to irreversible joint damage."),
      spacer(),
      fns.subHeading("Risk Factors"),
      fns.bullet("Female sex (F:M = 6:1), first-born child"),
      fns.bullet("Breech presentation (risk 30x), oligohydramnios"),
      fns.bullet("Positive family history, left hip more common (75%), bilateral 25%"),
      fns.bullet("Postural factors: swaddling with hips extended"),
      spacer(),
      fns.subHeading("Clinical Examination"),
      fns.keyPoint("Ortolani test", "Relocates dislocated hip – clunk on abduction (positive = dislocated hip)"),
      fns.keyPoint("Barlow test", "Provokes dislocation – posterior pressure on flexed/adducted hip (positive = dislocatable hip)"),
      fns.keyPoint("Galeazzi sign", "Unequal knee heights in supine flexed position (true shortening)"),
      fns.keyPoint("Trendelenburg gait", "Lurch towards affected side – seen in walking children"),
      spacer(),
      fns.subHeading("Investigations"),
      fns.bullet("< 6 months: Ultrasound (Graf classification) – Gold standard in neonates"),
      fns.bullet("  Graf Type I (normal) → Type IV (dislocated)"),
      fns.bullet("> 6 months: Pelvis X-ray – ossification of femoral head begins"),
      fns.bullet("X-ray landmarks: Hilgenreiner's line (horizontal through triradiate cartilage), Perkins' line (vertical through lateral acetabulum), Shenton's arc (smooth arc from femoral neck to obturator foramen – broken in DDH)"),
      fns.bullet("Acetabular Index: >30° abnormal in infants"),
      fns.importantNote("MRI / arthrogram used intra-operatively to confirm reduction."),
      spacer(),
      fns.subHeading("Treatment by Age"),
      fns.keyPoint("0–6 months", "Pavlik harness (flexion 90–100°, abduction 50–70°) – success rate 85–90%"),
      fns.keyPoint("6–18 months", "Closed reduction under GA + arthrogram + hip spica cast; open reduction if CR fails"),
      fns.keyPoint("18 months – 8 years", "Open reduction + Salter innominate osteotomy + femoral shortening"),
      fns.keyPoint("> 8 years", "Salvage procedures: Chiari osteotomy, shelf acetabuloplasty; joint replacement if arthritic"),
      spacer(),
      fns.subHeading("Complications"),
      fns.bullet("AVN of femoral head – most feared complication (from forceful reduction or compression in spica)"),
      fns.bullet("Redislocation, residual dysplasia, early osteoarthritis"),
      fns.bullet("Pavlik harness: avascular necrosis if harness too tight, femoral nerve palsy (rare)"),
    ]
  },
  {
    title: "Legg-Calvé-Perthes Disease",
    stars: "★★★★★",
    content: (fns) => [
      fns.subHeading("Introduction"),
      fns.introBox("Perthes disease is idiopathic avascular necrosis of the femoral head in children aged 4–8 years. The femoral epiphysis undergoes a cycle of necrosis, fragmentation, re-ossification, and remodelling. The goal of management is 'containment' – keeping the femoral head within the acetabulum during the healing phase to promote spherical remodelling."),
      spacer(),
      fns.subHeading("Epidemiology"),
      fns.bullet("Age 4–8 years (range 2–14), male:female = 4:1"),
      fns.bullet("Bilateral in 10–15% (but asymmetric and not simultaneous)"),
      fns.bullet("Associated with: delayed bone age, ADHD, second-hand smoke, thrombophilia (protein C/S deficiency)"),
      spacer(),
      fns.subHeading("Waldenstrom Radiological Stages"),
      fns.keyPoint("Stage 1 – Initial/Ischaemic", "Dense (sclerotic) femoral epiphysis, small epiphysis, widened joint space"),
      fns.keyPoint("Stage 2 – Fragmentation", "Fragmented, irregular epiphysis with radiolucent areas"),
      fns.keyPoint("Stage 3 – Re-ossification", "New bone formation from periphery inward"),
      fns.keyPoint("Stage 4 – Residual/Healed", "Final shape determined; coxa magna/plana if poorly contained"),
      spacer(),
      fns.subHeading("Classifications"),
      fns.bullet("Catterall (Groups I–IV): based on proportion of head involved – historical"),
      fns.bullet("Herring Lateral Pillar Classification (A/B/B-C/C): current standard – based on height of lateral pillar on AP X-ray during fragmentation"),
      fns.bullet("  Pillar A: full height = excellent prognosis"),
      fns.bullet("  Pillar B: >50% height = good if treated"),
      fns.bullet("  Pillar C: <50% height = poor prognosis regardless of treatment"),
      fns.importantNote("MRI is earliest investigation – detects ischaemia before X-ray changes appear."),
      spacer(),
      fns.subHeading("Management"),
      fns.keyPoint("Age < 6, Pillar A/B", "Conservative – physiotherapy, maintain ROM; bracing controversial"),
      fns.keyPoint("Age 6–8, Pillar B", "Containment: Petrie abduction cast, Scottish Rite orthosis, or surgery"),
      fns.keyPoint("Age > 8 or Pillar B/C, C", "Surgical containment: femoral varus osteotomy (FVO) or Salter innominate osteotomy"),
      fns.bullet("Shelf acetabuloplasty: for late cases with hinge abduction"),
      fns.subHeading("Prognosis"),
      fns.bullet("Mose method: spherical femoral head at maturity = best predictor of good outcome"),
      fns.bullet("Stulberg classification (I–V): Grades I–II = no arthritis; Grades IV–V = early OA"),
    ]
  },
  {
    title: "Slipped Capital Femoral Epiphysis (SCFE)",
    stars: "★★★★★",
    content: (fns) => [
      fns.subHeading("Introduction"),
      fns.introBox("SCFE is a disorder of the adolescent hip in which the femoral epiphysis slips posteroinferiorly relative to the femoral neck, through the hypertrophic zone of the physis. It is the most common hip disorder in adolescents and must be diagnosed promptly to prevent AVN."),
      spacer(),
      fns.subHeading("Epidemiology"),
      fns.bullet("Age 10–16 years; obese males (typical) OR tall thin rapid-growth adolescent"),
      fns.bullet("Male:Female = 2.4:1; bilateral in 20–40% (often sequential)"),
      fns.bullet("Associated conditions: hypothyroidism, growth hormone deficiency, renal osteodystrophy"),
      spacer(),
      fns.subHeading("Classification"),
      fns.keyPoint("Stability (Loder)", "Stable: can bear weight (with or without pain) – low AVN risk (<10%). Unstable: cannot bear weight – AVN risk ~50%"),
      fns.keyPoint("Severity (Southwick angle)", "Mild <30°, Moderate 30–60°, Severe >60°"),
      fns.keyPoint("Chronicity", "Acute (<3 weeks), Chronic (>3 weeks), Acute-on-chronic"),
      spacer(),
      fns.subHeading("Clinical Features"),
      fns.bullet("Painful limp; pain in thigh/knee (referred) – exam often finds hip problem in 'knee pain' patient!"),
      fns.bullet("Obligatory external rotation with hip flexion (due to posterior slip)"),
      fns.bullet("Limited internal rotation and abduction"),
      spacer(),
      fns.subHeading("Radiological Signs"),
      fns.keyPoint("Klein's line", "Line along superior femoral neck should intersect lateral 1/4 of epiphysis – fails to do so in SCFE (AP view)"),
      fns.keyPoint("Trethowan sign", "Same as Klein's line test"),
      fns.keyPoint("Steel sign / Capener sign", "On AP: crescent of metaphysis overlaps posterior acetabular wall"),
      fns.keyPoint("Frog-lateral view", "Best view to demonstrate the slip and its severity"),
      fns.importantNote("Always X-ray both hips. Never manipulate an unstable SCFE – forceful reduction dramatically increases AVN risk."),
      spacer(),
      fns.subHeading("Treatment"),
      fns.keyPoint("All SCFE", "In situ fixation with a single central cannulated screw – standard of care for all severities"),
      fns.keyPoint("Stable SCFE", "Elective surgery within days to weeks; single screw fixation"),
      fns.keyPoint("Unstable SCFE", "Urgent surgery (< 24 hours); gentle positioning before fixation; consider gentle reduction under image intensifier"),
      fns.keyPoint("Severe chronic SCFE", "Subcapital realignment: Modified Dunn procedure (better anatomy, higher AVN risk) or intertrochanteric osteotomy (safer)"),
      fns.keyPoint("Contralateral hip", "Prophylactic pinning if: young age, endocrine disorder, Risser 0–1"),
      spacer(),
      fns.subHeading("Complications"),
      fns.bullet("AVN (most feared) – especially in unstable SCFE"),
      fns.bullet("Chondrolysis – narrowing of joint space; associated with pin penetration or unrecognised arthrotomy"),
      fns.bullet("Femoroacetabular impingement (FAI) – long-term complication of residual deformity"),
    ]
  },
  {
    title: "Congenital Talipes Equinovarus (CTEV / Clubfoot)",
    stars: "★★★★☆",
    content: (fns) => [
      fns.subHeading("Introduction"),
      fns.introBox("Clubfoot is a complex three-dimensional congenital foot deformity comprising equinus, varus, adductus, and cavus. With an incidence of 1–2 per 1000 live births, it is the most common congenital musculoskeletal condition. The Ponseti method has revolutionised management, achieving correction in >95% of cases without extensive surgery."),
      spacer(),
      fns.subHeading("Components – CAVE Mnemonic (order of correction)"),
      fns.keyPoint("C – Cavus", "High arch (plantarflexed first ray) – FIRST to correct"),
      fns.keyPoint("A – Adductus", "Forefoot adduction – correct second"),
      fns.keyPoint("V – Varus", "Heel varus – corrected with adductus"),
      fns.keyPoint("E – Equinus", "Plantar flexion of entire foot – LAST to correct"),
      spacer(),
      fns.subHeading("Classification"),
      fns.bullet("Pirani score (0–6): based on 6 clinical signs – guides treatment and predicts Achilles tenotomy need"),
      fns.bullet("Dimeglio score (0–20): grades severity"),
      fns.bullet("Idiopathic (most common) vs Syndromic (arthrogryposis, spina bifida)"),
      spacer(),
      fns.subHeading("Ponseti Method (Gold Standard)"),
      fns.bullet("Serial casting: 5–7 casts changed weekly; foot manipulated and held in corrected position"),
      fns.bullet("Order of correction: Cavus → Adductus/Varus → Equinus"),
      fns.bullet("Supination maintained initially – abduction used as the corrective force"),
      fns.bullet("Achilles tendon tenotomy: required in ~80% of cases for residual equinus"),
      fns.bullet("Post-tenotomy: final cast x 3 weeks, then Denis Browne boots and bar (abducted 60–70°) for 23 hrs/day for 3 months, then nights/naps until age 4–5 years"),
      fns.importantNote("Compliance with boots and bar is the single most important factor in preventing relapse (relapse rate <10% with compliance, >80% without)."),
      spacer(),
      fns.subHeading("Relapse Management"),
      fns.bullet("Recasting ± tenotomy repeat"),
      fns.bullet("Tibialis anterior tendon transfer to third cuneiform (for dynamic supination in children >2.5 years)"),
      fns.bullet("Posteromedial release (Cincinnati incision): reserved for failed Ponseti or resistant cases"),
      spacer(),
      fns.subHeading("Differential Diagnosis"),
      fns.bullet("Positional talipes: flexible, corrects with gentle passive stretching – no treatment needed beyond reassurance and stretching"),
      fns.bullet("Metatarsus adductus: only forefoot adducted, heel normal"),
      fns.bullet("Vertical talus: rocker-bottom, forefoot dorsiflexed"),
    ]
  },
  {
    title: "Pediatric Septic Arthritis and Acute Hematogenous Osteomyelitis",
    stars: "★★★★☆",
    content: (fns) => [
      fns.subHeading("Introduction"),
      fns.introBox("Bone and joint infections in children are orthopaedic emergencies. The unique metaphyseal vasculature and lack of phagocytic activity predispose to haematogenous seeding. Delayed diagnosis results in permanent joint destruction, physeal damage, and limb deformity. The hip joint is at particular risk due to its intra-capsular location."),
      spacer(),
      fns.subHeading("Pathophysiology of Osteomyelitis"),
      fns.bullet("Metaphysis most affected: sluggish sinusoidal blood flow, lack of phagocytes, sharp vascular loops"),
      fns.bullet("Bacteria seed from transient bacteraemia; infection spreads via Haversian canals"),
      fns.bullet("Subperiosteal abscess → cortical necrosis → sequestrum (dead bone) formation"),
      fns.bullet("Involucrum: new periosteal bone surrounding sequestrum"),
      fns.bullet("Cloaca: opening in involucrum through which pus drains (sinus tract)"),
      spacer(),
      fns.subHeading("Organisms by Age"),
      fns.keyPoint("Neonates (< 2 months)", "Group B Streptococcus, S. aureus, Gram-negatives"),
      fns.keyPoint("1 month – 5 years", "S. aureus (#1), H. influenzae (now rare – vaccination), S. pyogenes"),
      fns.keyPoint("5–15 years", "S. aureus (dominant in all age groups)"),
      fns.keyPoint("Sickle cell disease", "Salmonella species"),
      fns.keyPoint("Sexually active adolescent", "Neisseria gonorrhoeae"),
      spacer(),
      fns.subHeading("Kocher Criteria – Septic Hip vs Transient Synovitis"),
      fns.bullet("1. Fever > 38.5°C"),
      fns.bullet("2. Non-weight-bearing"),
      fns.bullet("3. ESR > 40 mm/hr"),
      fns.bullet("4. WBC > 12,000 cells/mm³"),
      fns.bullet("(CRP > 2.0 mg/dL added as 5th criterion by Caird)"),
      fns.keyPoint("Probability", "4 criteria = 99%, 3 criteria = 93%, 2 criteria = 40%, 1 criterion = 3%"),
      fns.importantNote("Tom Smith Arthritis: Septic arthritis of hip in neonates/infants. Pathological dislocation occurs due to capsular distension + AVN of femoral head. Results in severe hip deformity."),
      spacer(),
      fns.subHeading("Investigations"),
      fns.bullet("Blood cultures (positive in 30–50%)"),
      fns.bullet("WBC, CRP, ESR, Procalcitonin"),
      fns.bullet("MRI: investigation of choice – detects early osteomyelitis, subperiosteal abscess, soft tissue spread"),
      fns.bullet("Ultrasound: rapid, detects effusion; guides aspiration of hip joint"),
      fns.bullet("Bone scan (Tc-99m): useful for multifocal / occult disease; early 'cold' scan = ischaemia"),
      spacer(),
      fns.subHeading("Treatment"),
      fns.bullet("Empirical IV antibiotics: Flucloxacillin (or Vancomycin if MRSA suspected) + Cefotaxime for neonates"),
      fns.bullet("Duration: IV until clinical improvement (48–72 hrs) then step down to oral for total 4–6 weeks"),
      fns.bullet("Septic arthritis: surgical washout/drainage – URGENT (prevents AVN and cartilage destruction)"),
      fns.bullet("Osteomyelitis: IV antibiotics; surgical drainage only if abscess > 2 cm, no improvement at 48 hrs, or chronic changes"),
      fns.bullet("Chronic osteomyelitis: sequestrectomy + saucerisation + bone graft ± Ilizarov for large defects"),
    ]
  },
  {
    title: "Adolescent Idiopathic Scoliosis (AIS)",
    stars: "★★★★☆",
    content: (fns) => [
      fns.subHeading("Introduction"),
      fns.introBox("Scoliosis is a three-dimensional spinal deformity defined as a lateral curvature of the spine with Cobb angle > 10°, accompanied by vertebral rotation. Adolescent idiopathic scoliosis (AIS) is the most common type (80%), affecting girls more than boys (F:M = 7:1 for curves requiring treatment). Management depends on skeletal maturity and curve magnitude."),
      spacer(),
      fns.subHeading("Measurement – Cobb Angle"),
      fns.bullet("Identify the most tilted vertebra at top (upper end vertebra) and bottom (lower end vertebra) of the curve"),
      fns.bullet("Draw perpendicular lines from each end plate; angle of intersection = Cobb angle"),
      fns.bullet("Progression likely if Cobb angle increases > 5° on serial X-rays"),
      spacer(),
      fns.subHeading("Skeletal Maturity – Risser Sign"),
      fns.keyPoint("Risser 0", "No ossification of iliac apophysis – maximum growth remaining, highest risk of progression"),
      fns.keyPoint("Risser 1–2", "25–50% ossification – still growing, bracing effective"),
      fns.keyPoint("Risser 3–4", "50–100% ossification – near maturity"),
      fns.keyPoint("Risser 5", "Fusion of apophysis – skeletal maturity, minimal progression risk"),
      spacer(),
      fns.subHeading("Classification – Lenke System"),
      fns.bullet("6 curve types based on location and flexibility"),
      fns.bullet("Type 1 (main thoracic): most common – right thoracic structural curve"),
      fns.bullet("Also characterises lumbar modifier (A/B/C) and sagittal modifier (-/N/+)"),
      fns.bullet("Guides which curves to fuse surgically"),
      spacer(),
      fns.subHeading("Adam's Forward Bend Test"),
      fns.bullet("Patient bends forward to 90°; rib hump (right thoracic) or lumbar prominence seen"),
      fns.bullet("Scoliometer measures angle of trunk rotation (ATR); >7° = refer for X-ray"),
      spacer(),
      fns.subHeading("Management"),
      fns.keyPoint("Cobb < 25°", "Observation: clinical + X-ray review every 4–6 months during growth"),
      fns.keyPoint("25–40°, Risser 0–2", "Bracing: Boston TLSO (underarm) for thoracolumbar/lumbar; Milwaukee brace for thoracic (apex above T8); 18–23 hrs/day"),
      fns.keyPoint("Cobb > 45–50°", "Surgical correction: posterior spinal instrumentation and fusion"),
      fns.subHeading("Surgery"),
      fns.bullet("Pedicle screw constructs + contoured rods – current gold standard"),
      fns.bullet("3-column correction: derotation, translation, and compression/distraction"),
      fns.bullet("Selective fusion: non-structural compensatory curves left unfused"),
      fns.bullet("Complications: neurological injury (wake-up test / SSEP/MEP monitoring), infection, pseudarthrosis, adding-on"),
    ]
  },
  {
    title: "Salter-Harris Classification of Physeal Injuries",
    stars: "★★★★☆",
    content: (fns) => [
      fns.subHeading("Introduction"),
      fns.introBox("The physis (growth plate) is the weakest part of the immature skeleton – weaker than ligaments. Injuries involving the physis are classified by the Salter-Harris system, which guides prognosis and management. Growth arrest and angular deformity are the feared complications. The mnemonic SALTR (or SLIPPERY) helps recall the types."),
      spacer(),
      fns.subHeading("Classification – SALTR Mnemonic"),
      fns.keyPoint("Type I – S (Slipped)", "Transverse fracture through physis only. X-ray often normal. Diagnose clinically. Good prognosis. Cast immobilisation."),
      fns.keyPoint("Type II – A (Above)", "Most common (75%). Fracture through physis + extends into METAPHYSIS. Thurston-Holland fragment (metaphyseal spike). Usually closed reduction + cast. Good prognosis."),
      fns.keyPoint("Type III – L (Lower)", "Fracture through physis + extends into EPIPHYSIS. Intra-articular. ORIF required for anatomic joint reduction. Fair prognosis."),
      fns.keyPoint("Type IV – T (Through)", "Fracture through METAPHYSIS + PHYSIS + EPIPHYSIS. Intra-articular. Anatomic ORIF essential – even small displacement causes physeal bridge. Poor prognosis if not reduced."),
      fns.keyPoint("Type V – R (Rammed)", "Crush/compression of physis. Often missed initially. Worst prognosis – premature physeal closure. Diagnosed retrospectively when growth arrest evident."),
      spacer(),
      fns.importantNote("Mnemonic: SALTR = Slipped, Above (metaphysis), Lower (epiphysis), Through (all 3 zones), Rammed (crushed). Types III and IV are intra-articular – require ORIF."),
      spacer(),
      fns.subHeading("Peterson Classification (Additional Types)"),
      fns.bullet("Type VI: Periosteal injury – localised physeal arrest"),
      spacer(),
      fns.subHeading("Growth Arrest"),
      fns.bullet("Physeal bar (bridge) forms across physis after injury"),
      fns.bullet("Peripheral bar → angular deformity; Central bar → shortened limb"),
      fns.bullet("MRI or CT: map the bar; if bar <50% of physeal area → bar resection + fat interposition"),
      fns.bullet("Surgical options: Langenskiold bar resection, epiphysiodesis of unaffected side, corrective osteotomy"),
      spacer(),
      fns.subHeading("Common Examples by Site"),
      fns.keyPoint("Distal radius", "Most common physeal fracture – usually Type I or II; closed reduction + cast"),
      fns.keyPoint("Distal femur", "High-energy; Type III/IV risk; high rate of physeal arrest"),
      fns.keyPoint("Proximal tibia", "Popliteal artery injury risk"),
      fns.keyPoint("Lateral condyle humerus", "Type IV – requires ORIF; risk of non-union and cubitus valgus"),
      fns.keyPoint("Triplane fracture ankle", "Type III + IV equivalent; CT for characterisation; ORIF if >2 mm displaced"),
    ]
  },
  {
    title: "Cerebral Palsy – Orthopaedic Management",
    stars: "★★★☆☆",
    content: (fns) => [
      fns.subHeading("Introduction"),
      fns.introBox("Cerebral palsy (CP) is a permanent, non-progressive disorder of movement and posture resulting from a disturbance to the developing fetal or infant brain. While the brain lesion is static, the musculoskeletal consequences are progressive. Orthopaedic management aims to prevent deformity, improve function, and relieve pain."),
      spacer(),
      fns.subHeading("Classification"),
      fns.keyPoint("Spastic (most common, 70–80%)", "Upper motor neuron – hypertonicity, clasp-knife rigidity"),
      fns.bullet("  Hemiplegia (one side): ambulatory, upper > lower limb involvement"),
      fns.bullet("  Diplegia (bilateral lower > upper): Little's disease; associated with prematurity"),
      fns.bullet("  Quadriplegia (all four limbs): most severely affected; rarely ambulatory"),
      fns.keyPoint("Dyskinetic", "Athetosis, choreoathetosis – extrapyramidal; basal ganglia lesion"),
      fns.keyPoint("Ataxic", "Cerebellar involvement; uncommon"),
      fns.keyPoint("Mixed", "Spastic + dyskinetic combination"),
      spacer(),
      fns.subHeading("Functional Assessment – GMFCS"),
      fns.bullet("Gross Motor Function Classification System (GMFCS) I–V"),
      fns.bullet("GMFCS I–II: ambulate independently; GMFCS III: ambulate with aids; GMFCS IV–V: wheelchair dependent"),
      spacer(),
      fns.subHeading("Common Orthopaedic Deformities"),
      fns.keyPoint("Foot", "Equinus (most common) – tight Achilles; equinovarus or equinovalgus"),
      fns.keyPoint("Knee", "Flexion contracture, crouch gait, patella alta"),
      fns.keyPoint("Hip", "Flexion + adduction contracture → subluxation → dislocation; spastic diplegia most at risk"),
      fns.keyPoint("Spine", "Neuromuscular scoliosis – rapid progression in non-ambulators; affects respiratory function"),
      fns.keyPoint("Upper limb", "Thumb-in-palm, wrist flexion, elbow flexion, shoulder adduction/IR"),
      spacer(),
      fns.subHeading("Spasticity Management – Ladder Approach"),
      fns.bullet("1. Physiotherapy, stretching, splinting (AFOs), serial casting"),
      fns.bullet("2. Botulinum toxin A injection: temporary (3–6 months); useful for dynamic spasticity; best in children 2–7 years"),
      fns.bullet("3. Oral Baclofen: for generalised spasticity; sedating side effects"),
      fns.bullet("4. Intrathecal Baclofen (ITB) pump: for severe spasticity in GMFCS III–V"),
      fns.bullet("5. Selective Dorsal Rhizotomy (SDR): selective cutting of afferent L2–S1 dorsal rootlets; for pure spastic diplegics, GMFCS II–III, preserved strength"),
      spacer(),
      fns.subHeading("SEMLS – Single Event Multilevel Surgery"),
      fns.bullet("Address all lower limb deformities in one anaesthetic episode"),
      fns.bullet("Superior to staged procedures: fewer total surgeries, less anaesthetic exposure, better gait outcomes"),
      fns.bullet("Guided by 3D gait analysis: identifies true primary deformities from compensatory ones"),
      fns.bullet("Typical components: Achilles lengthening, psoas recession, adductor tenotomy, distal femoral extension osteotomy, tibial derotation osteotomy"),
      spacer(),
      fns.subHeading("Hip Surveillance Protocol"),
      fns.bullet("Annual AP pelvis X-rays in non-ambulatory CP from age 2"),
      fns.bullet("Migration percentage (Reimer's index): normal <33%; > 33% = subluxation; 100% = dislocation"),
      fns.bullet("> 50% migration = surgical intervention (varus derotation osteotomy ± pelvic osteotomy)"),
    ]
  },
  {
    title: "Limb Length Discrepancy (LLD)",
    stars: "★★★☆☆",
    content: (fns) => [
      fns.subHeading("Introduction"),
      fns.introBox("Limb length discrepancy refers to a difference in the length of the lower extremities. It may be anatomical (true bone shortening) or functional (pelvic obliquity, contracture). Management ranges from shoe raises for minor discrepancies to complex surgical limb lengthening for major ones. Accurate assessment and growth prediction are essential for optimal timing of intervention."),
      spacer(),
      fns.subHeading("Causes"),
      fns.keyPoint("Congenital", "DDH, fibular/tibial hemimelia, proximal femoral focal deficiency (PFFD), coxa vara"),
      fns.keyPoint("Growth plate injury", "Physeal arrest after Salter-Harris fracture"),
      fns.keyPoint("Infection", "Stimulation (acute osteomyelitis) or arrest (chronic / physeal involvement)"),
      fns.keyPoint("Neurological", "Poliomyelitis, cerebral palsy"),
      fns.keyPoint("Tumour/Irradiation", "Physeal damage from radiotherapy"),
      fns.keyPoint("Vascular", "Haemangioma, A-V malformation → overgrowth"),
      spacer(),
      fns.subHeading("Assessment"),
      fns.bullet("Clinical: blocks under short limb until pelvis level – measures functional LLD"),
      fns.bullet("Galeazzi sign: unequal knee heights with hips and knees flexed 90° (identifies femoral vs tibial shortening)"),
      fns.keyPoint("Scanography (orthoroentgenogram)", "Most accurate – single cassette, three exposures at hip, knee, ankle; minimal magnification error"),
      fns.keyPoint("CT scanogram", "Fastest, least radiation; accurate for both bone and soft tissue"),
      fns.keyPoint("EOS imaging", "Low-dose biplanar – best for concurrent spinal assessment"),
      spacer(),
      fns.subHeading("Growth Prediction Methods"),
      fns.bullet("Green-Anderson growth remaining charts: based on skeletal age (Greulich-Pyle)"),
      fns.bullet("Moseley straight-line graph: plots limb lengths vs skeletal age; intuitive visual prediction"),
      fns.bullet("Multiplier method (Paley): most modern; uses multiplier tables based on bone age – quick, accurate"),
      spacer(),
      fns.subHeading("Treatment Algorithm"),
      fns.keyPoint("< 2 cm", "Shoe raise, observation"),
      fns.keyPoint("2–5 cm", "Epiphysiodesis (shortening of longer limb) OR contralateral lengthening OR shoe raise"),
      fns.keyPoint("> 5 cm", "Limb lengthening + ± contralateral epiphysiodesis"),
      fns.keyPoint("> 15–20 cm", "Prosthetic fitting ± amputation (e.g., fibular hemimelia)"),
      spacer(),
      fns.subHeading("Epiphysiodesis"),
      fns.bullet("Permanent: Phemister technique (open), percutaneous drill/curette"),
      fns.bullet("Temporary (guided growth): 8-plate or staples on convex side of physis"),
      fns.bullet("Timing: critical – must be done while physis still open; use Moseley graph or multiplier to calculate timing"),
      spacer(),
      fns.subHeading("Ilizarov Limb Lengthening"),
      fns.bullet("Principle of distraction osteogenesis: cortical osteotomy (corticotomy) + gradual distraction"),
      fns.bullet("Rate: 1 mm/day in 4 increments of 0.25 mm (allows regenerate bone formation)"),
      fns.bullet("Consolidation: 1 day per mm of lengthening as a guide"),
      fns.importantNote("Complications: pin-track infection (most common), joint contracture (knee/ankle), premature consolidation, non-union, nerve traction injury, regenerate fracture after frame removal."),
    ]
  }
];

// ─── DOCUMENT BUILD ───────────────────────────────────────────────────────────
const helpers = { subHeading, introBox, bodyPara, bullet, keyPoint, importantNote };

const allChildren = [];

// Cover page
allChildren.push(spacer(30));
allChildren.push(mainTitle("PEDIATRIC ORTHOPAEDICS"));
allChildren.push(subtitle("KNRUHS Theory Final Exam – Structured Essay Answers"));
allChildren.push(subtitle("Top 10 High-Yield Questions  |  2026 Edition"));
allChildren.push(spacer(20));

// Disclaimer
allChildren.push(new Table({
  width: { size: 100, type: WidthType.PERCENTAGE },
  rows: [new TableRow({
    children: [new TableCell({
      children: [
        new Paragraph({ children: [new TextRun({ text: "Reference Sources", font: BODY_FONT, size: 20, bold: true, color: DARK_BLUE })], spacing: { before: 60, after: 40 } }),
        new Paragraph({ children: [new TextRun({ text: "• Campbell's Operative Orthopaedics, 15th Ed (2026)", font: BODY_FONT, size: 18, color: GREY_TEXT })], spacing: { before: 20, after: 20 } }),
        new Paragraph({ children: [new TextRun({ text: "• Miller's Review of Orthopaedics, 9th Edition", font: BODY_FONT, size: 18, color: GREY_TEXT })], spacing: { before: 20, after: 20 } }),
        new Paragraph({ children: [new TextRun({ text: "• NTRUHS/KNRUHS MS Orthopaedics Previous Question Paper Analysis", font: BODY_FONT, size: 18, color: GREY_TEXT })], spacing: { before: 20, after: 20 } }),
        new Paragraph({ children: [new TextRun({ text: "• Orthobullets Pediatric Specialty Topic Importance Rankings", font: BODY_FONT, size: 18, color: GREY_TEXT })], spacing: { before: 20, after: 40 } }),
      ],
      shading: { type: ShadingType.SOLID, fill: LIGHT_GREY },
      borders: { left: { style: BorderStyle.THICK, size: 12, color: MID_BLUE }, top: { style: BorderStyle.SINGLE, size: 2, color: MID_BLUE }, bottom: { style: BorderStyle.SINGLE, size: 2, color: MID_BLUE }, right: { style: BorderStyle.NIL } }
    })]
  })]
}));
allChildren.push(spacer(10));

// TOC heading
allChildren.push(new Paragraph({
  children: [new TextRun({ text: "TABLE OF CONTENTS", font: HEAD_FONT, size: 24, bold: true, color: WHITE })],
  shading: { type: ShadingType.SOLID, fill: ACCENT },
  spacing: { before: 300, after: 160 },
  alignment: AlignmentType.CENTER
}));
allChildren.push(tocSection(questions));
allChildren.push(pageBreak());

// Individual question pages
questions.forEach((q, i) => {
  allChildren.push(sectionHeader(i + 1, q.title));
  const content = q.content(helpers);
  content.forEach(c => allChildren.push(c));
  if (i < questions.length - 1) allChildren.push(pageBreak());
});

// ─── HEADER / FOOTER ─────────────────────────────────────────────────────────
const header = new Header({
  children: [
    new Paragraph({
      children: [
        new TextRun({ text: "KNRUHS Theory Exam Prep  |  Pediatric Orthopaedics 2026", font: BODY_FONT, size: 16, color: GREY_TEXT, italics: true })
      ],
      alignment: AlignmentType.RIGHT,
      border: { bottom: { style: BorderStyle.SINGLE, size: 2, color: "CCCCCC" } },
      spacing: { after: 80 }
    })
  ]
});

const footer = new Footer({
  children: [
    new Paragraph({
      children: [
        new TextRun({ text: "Page ", font: BODY_FONT, size: 16, color: GREY_TEXT }),
        new TextRun({ children: [PageNumber.CURRENT], font: BODY_FONT, size: 16, color: GREY_TEXT }),
        new TextRun({ text: " of ", font: BODY_FONT, size: 16, color: GREY_TEXT }),
        new TextRun({ children: [PageNumber.TOTAL_PAGES], font: BODY_FONT, size: 16, color: GREY_TEXT }),
        new TextRun({ text: "  |  Campbell's Operative Orthopaedics 15th Ed 2026 + Miller's Review 9th Ed", font: BODY_FONT, size: 16, color: GREY_TEXT, italics: true })
      ],
      alignment: AlignmentType.CENTER,
      border: { top: { style: BorderStyle.SINGLE, size: 2, color: "CCCCCC" } },
      spacing: { before: 80 }
    })
  ]
});

// ─── WRITE FILE ───────────────────────────────────────────────────────────────
const doc = new Document({
  numbering: {
    config: [{
      reference: "bullet-points",
      levels: [
        { level: 0, format: "bullet", text: "\u2022", alignment: AlignmentType.LEFT, style: { paragraph: { indent: { left: 720, hanging: 360 } } } },
        { level: 1, format: "bullet", text: "\u25E6", alignment: AlignmentType.LEFT, style: { paragraph: { indent: { left: 1080, hanging: 360 } } } }
      ]
    }]
  },
  sections: [{
    headers: { default: header },
    footers: { default: footer },
    properties: {
      page: {
        margin: { top: 1000, right: 900, bottom: 1000, left: 900 },
      }
    },
    children: allChildren
  }]
});

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

cd /home/daytona/workspace/peds-ortho-exam && node generate.js 2>&1

Running Command

python /home/daytona/skills/docx/scripts/office/validate.py /home/daytona/workspace/peds-ortho-exam/Pediatric_Orthopaedics_Exam_Prep.docx 2>&1

Running Command

python -c "import zipfile; z = zipfile.ZipFile('/home/daytona/workspace/peds-ortho-exam/Pediatric_Orthopaedics_Exam_Prep.docx'); print('Valid ZIP/DOCX. Files:', len(z.namelist())); z.close()" && ls -lh /home/daytona/workspace/peds-ortho-exam/

Your Word document is ready - valid DOCX with 26 internal XML files.
Download:

Pediatric Orthopaedics Exam Prep

Word Document · DOCX


What's inside the document:
FeatureDetail
Cover pageTitle + subtitle + reference sources box
Table of contentsAll 10 questions with priority stars
10 full essay sectionsEach on its own page
Format per essayBlue intro box → sub-headings → bullet key points → key-point pairs → red important notes
Header/footerRunning title + auto page numbers
Colour schemeNavy blue headings, blue sub-headings, red accents for critical notes
Document structure per question:
  • Intro box (paragraph overview - good for opening your essay)
  • Classification (with mnemonic where applicable)
  • Clinical features
  • Investigations
  • Management (age-based / stage-based)
  • Complications
  • Red "! IMPORTANT" callouts for must-know facts (surgical emergencies, high-yield traps)
All content is sourced from Campbell's Operative Orthopaedics 15th Ed 2026 and Miller's Review 9th Ed. Good luck!
This is a shared conversation. Sign in to Orris to start your own chat.