Describe the clinical features of Diseases of bone and Joints Osteoarthritis, Osteoporosis, Frozen Shoulder, Calcaneal spur/ Plantar fasciitis, Tennis elbow, Carpel tunnel syndrome; Muscular diseases - Muscular Dystrophy, Perform relevant clinical examination of Diseases of bone and Joints - Osteoarthritis, Osteoporosis. Frozen Shoulder, Calcaneal spur/ Plantar fasciitis, Tennis elbow, Carpel tunnel syndrome; Muscular diseases - Muscular Dystrophy, Order and interpret relevant investigations of Diseases of bone and Joints - Osteoarthritis, Osteoporosis. Frozen Shoulder, Calcaneal spur/ Plantar fasciitis, Tennis elbow, Carpel tunnel syndrome; Muscular diseases - Muscular Dystrophy...........make proper exam oriented notes, use authentic sources and standard textbooks like hutchinson etc, but language should be easy, dont use much complicated words or definitions, make simmple definition n all, just like even one reading would be enough to write in exam even if readding once, having zero knowledge about the topic, dont miss any point..make according to syllabus

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

🦴 DISEASES OF BONE AND JOINTS

Exam-Oriented Clinical Notes

Sources: Goldman-Cecil Medicine, Textbook of Family Medicine (9e), Campbell's Operative Orthopaedics (15e), Miller's Review of Orthopaedics (9e), Bailey & Love's Short Practice of Surgery (28e), Bradley & Daroff's Neurology, Grainger & Allison's Diagnostic Radiology

1. OSTEOARTHRITIS (OA)

What is it?

OA (also called "degenerative joint disease") is the most common form of arthritis. It happens when the cartilage covering joints slowly breaks down, causing pain, stiffness, and difficulty moving. Think of it as "wear and tear" arthritis, though genetic, metabolic, and developmental factors also play a role.

Who gets it?

  • Most common after age 45
  • After age 55: more common in women
  • Almost all people above 75 show OA on X-ray (most are symptom-free)
  • Risk factors: obesity, repetitive joint trauma, joint injury, previous inflammatory arthritis

Types of OA

TypeDetails
Primary (idiopathic)No clear cause; hereditary component
SecondaryDue to old injuries, infections, gout, RA, endocrine disease
GeneralizedInvolves 5+ joints
Erosive OAInvolves finger joints with inflammation; can evolve into RA

Clinical Features (Symptoms)

  • Pain - starts gradually; worse on using the joint; worse towards end of the day; relieved by rest
  • Morning stiffness - less than 30 minutes (key - this is NOT like RA which has >1 hour)
  • Gel phenomenon - stiffness after sitting still (e.g., getting up from a chair); disappears within minutes of moving
  • Crepitus - cracking/grinding sound and feel in the joint
  • No systemic symptoms (no fever, no weight loss - this differentiates from RA)
  • Damp/cold weather worsens symptoms
  • In severe OA: pain even at rest or at night
  • Knee OA: buckling or giving way, especially on stairs
  • Hip OA: pain in groin, radiating to front of thigh
  • Spine OA: neck/back pain, sometimes with arm/leg weakness or numbness

Joints Commonly Involved

  • Knee (most common), hip, spine (cervical & lumbar)
  • Hands: DIP joints (Heberden nodes) and PIP joints (Bouchard nodes) - very common exam question
  • First carpometacarpal joint (base of thumb), first metatarsophalangeal joint (big toe)
Mnemonics for hands:
  • Heberden = Distal IP (H comes before B, D comes before P)
  • Bouchard = Proximal IP

Physical Examination Findings

FindingMeaning
Joint tenderness on palpation along joint lineActive disease
CrepitusCartilage damage
Bony swelling (hard)Osteophytes (bone spurs)
Soft tissue swellingJoint effusion
Reduced range of motion (ROM)Advanced disease
Joint deformityLate stage
Varus deformity (bow leg)Medial compartment OA knee
Muscle wasting around the jointDisuse atrophy
Heberden/Bouchard nodesHand OA
Knee specific exam:
  • Patellofemoral compression test - pain under kneecap
  • Valgus/varus stress test for instability
  • Check for fixed flexion deformity
Hip specific:
  • Earliest sign: loss of internal rotation with pain at end of range
Important: OA joint is NOT hot or red - if a joint is hot, red, and very swollen, think infection or gout, NOT OA.

Investigations

Laboratory:
  • Blood tests are normal in OA (no raised ESR, CRP, no RF)
  • Synovial fluid: non-inflammatory (WBC < 2000 cells/mmΒ³, clear/straw-colored)
X-ray (Most important investigation - 4 key changes):
  1. Joint space narrowing
  2. Osteophytes (bone spurs at joint margins)
  3. Subchondral sclerosis (bone becomes denser/whiter)
  4. Subchondral cysts (holes in bone near joint)
Memory tip: JOSS - Joint space narrowing, Osteophytes, Subchondral Sclerosis, Subchondral cysts
MRI: Shows cartilage damage, synovitis (not routinely needed for diagnosis)

2. OSTEOPOROSIS

What is it?

Osteoporosis means "porous bones." It is a condition where bones become weak and fragile because bone strength decreases - either too much bone is broken down or too little is formed. The main danger is fractures from minor trauma (fragility fractures).
Simple definition: Normal bones are like solid brick walls. In osteoporosis, the bricks get thinner and the wall develops holes - it can fall easily.

Who gets it?

  • Postmenopausal women (most common) - loss of estrogen accelerates bone loss
  • Elderly men and women
  • ~50% of women and ~20% of men over 50 will have a fragility fracture in their lifetime

Types

Primary Osteoporosis:
  • Type 1: Postmenopausal (due to estrogen loss)
  • Type 2: Age-related (senile) - affects both men and women after 70
Secondary Osteoporosis (caused by another disease):
  • Steroid (glucocorticoid) excess - most common secondary cause
  • Estrogen/testosterone deficiency
  • Hyperthyroidism, hyperparathyroidism
  • Malabsorption (e.g., celiac disease)
  • Chronic liver/kidney disease
  • Chronic alcoholism
  • Rheumatoid arthritis

Clinical Features

Key point: Osteoporosis is called the "silent disease" because it has NO symptoms until a fracture occurs.
  • No pain, no symptoms in early stages
  • Fractures with minor trauma (fragility fractures) - the first sign in many patients
  • Common fracture sites:
    1. Vertebral fractures (spine) - sudden severe back pain after bending/lifting; loss of height
    2. Distal radius/Colles fracture - fracture at wrist after fall on outstretched hand
    3. Neck of femur (hip fracture) - after minimal trauma; very serious; 20% die within 1 year
  • Loss of height and kyphosis (curved/hunched back) from multiple vertebral fractures - called "Dowager's hump"
  • Chronic back pain from vertebral compression fractures

Risk Factors to Ask in History

  • Postmenopausal status
  • Family history of osteoporosis/hip fracture
  • Low body weight (BMI < 19)
  • Previous fragility fracture
  • Long-term steroid use (> 3 months)
  • Smoking, excessive alcohol
  • Sedentary lifestyle
  • Low calcium/Vitamin D intake
  • Rheumatoid arthritis

Physical Examination

FindingSignificance
Loss of height (compare to stated height)Vertebral compression fractures
Kyphosis (thoracic hump)Multiple vertebral fractures
Tenderness on spinal percussionVertebral fracture
Look for signs of secondary causesCushing's (moon face, striae), thyroid disease
Muscle wastingDisuse

Investigations

WHO Definition (T-score on DEXA):
  • Normal: T-score β‰₯ -1.0
  • Osteopenia: T-score between -1.0 and -2.5
  • Osteoporosis: T-score ≀ -2.5
DEXA scan (Dual Energy X-ray Absorptiometry):
  • Gold standard for diagnosing osteoporosis
  • Sites measured: lumbar spine and hip (femoral neck)
Plain X-ray:
  • Shows decreased bone density (translucent/lighter bones)
  • Only detects bone loss after 30-40% bone is already lost (so not useful for early diagnosis)
  • Vertebral wedge/crush fractures visible
  • "Codfish vertebrae" or "biconcave vertebrae" on spine X-ray
Blood tests (to rule out secondary causes):
  • Serum calcium, phosphate, ALP (alkaline phosphatase)
  • Serum 25-OH Vitamin D, PTH
  • Thyroid function tests (TFTs)
  • Renal and liver function tests
  • Testosterone in men
  • Complete blood count (CBC)
Bone turnover markers:
  • Serum bone-specific ALP (formation marker)
  • Urine deoxypyridinoline/NTx (resorption markers)

3. FROZEN SHOULDER (Adhesive Capsulitis)

What is it?

Frozen shoulder is a condition where the shoulder becomes very painful and stiff because the joint capsule (the bag around the shoulder joint) becomes inflamed, thickened, and then contracts (shrinks). The shoulder "freezes up" and almost all movements are restricted.

Who gets it?

  • Age 40-70 years
  • Women more than men
  • Non-dominant arm more often affected
  • Common in diabetics and thyroid disease patients
  • After prolonged immobilization, chest/breast surgery, or shoulder injury

3 Stages (Classic Exam Question)

StageNameDurationFeatures
1Freezing / Painful2-9 monthsSevere pain, gradual stiffness begins
2Frozen / Adhesive4-12 monthsLess pain but maximum stiffness
3Thawing5-26 monthsStiffness gradually improves
Total duration: 1-3 years in most patients; ~90% recover with conservative treatment

Clinical Features

  • Insidious onset of pain - starts gradually, often worse at night
  • Pain is diffuse over shoulder (not well localized)
  • Progressive restriction of ALL shoulder movements - especially external rotation (the hallmark/earliest restricted movement)
  • Active ROM = Passive ROM (both are equally limited - key distinguishing feature)
  • Cannot lift arm to comb hair, reach behind back, fasten bra strap

Physical Examination

Test/FindingResult
Active ROMMarkedly reduced in all directions
Passive ROMAlso equally reduced (same as active)
External rotationMost restricted - often only 0-10Β°
AbductionRestricted
Scapular compensationPatient shrugs shoulder to achieve abduction
TendernessDiffuse over shoulder
Key exam point: In Frozen Shoulder - BOTH active AND passive ROM are reduced. This differentiates it from rotator cuff tear where passive ROM is preserved.

Investigations

  • Diagnosis is clinical - no specific test needed
  • X-ray shoulder - mandatory to rule out other causes (glenohumeral OA, posterior dislocation)
  • Arthrography (Contrast injection): Shows reduced joint capsule volume / loss of axillary recess - confirms diagnosis
  • MRI: Shows capsule thickening, obliteration of subcoracoid fat triangle, rotator interval synovitis (not routinely needed)
  • Blood tests: Check fasting glucose (rule out diabetes), TFTs

4. CALCANEAL SPUR / PLANTAR FASCIITIS

What is it?

The plantar fascia is a thick band of tissue at the bottom of the foot that connects the heel bone to the toes. Plantar fasciitis is pain and inflammation/degeneration at the point where this tissue attaches to the heel bone (calcaneum). A calcaneal spur is a bony growth on the heel bone that often forms at this attachment site.
Simple explanation: Think of the plantar fascia like a tight rubber band. If overstretched repeatedly, it develops micro-tears at its attachment to the heel - causing pain.

Who gets it?

  • Age 40-60 years
  • Runners, athletes, people who stand for long periods
  • Obese individuals (increased load on feet)
  • People wearing flat or inappropriate footwear

Clinical Features

  • Heel pain - the most common complaint
  • Worst in the morning on first steps after getting up (classic feature - ask this!)
  • Also painful after sitting for long and then standing up
  • Improves slightly after a few minutes of walking, but then may worsen again with prolonged standing/walking
  • Pain described as sharp, stabbing, or burning at the heel
  • Pain located at the medial plantar aspect of the heel (inner underside)
  • No swelling, no numbness/tingling (these are uncommon)

Physical Examination

FindingDetail
TendernessOver medial calcaneal tubercle (heel bone - inner side) at origin of plantar fascia
Point tenderness~2 cm distal to heel center on plantar surface
Passive dorsiflexionReproduces pain (stretches plantar fascia)
ROM ankleUsually normal
Look at foot postureFlat foot (pes planus) or high arch (pes cavus) as predisposing factors

Investigations

  • Diagnosis is clinical - no special tests needed
  • X-ray heel (lateral view):
    • Shows calcaneal spur (bony projection at plantar surface of calcaneum)
    • Note: Spur may be present without pain; and pain can exist without spur
  • Ultrasound foot: Shows plantar fascia thickening > 4mm
  • MRI: Reserved for refractory cases - shows fascia thickening/tear

5. TENNIS ELBOW (Lateral Epicondylitis)

What is it?

Tennis elbow is pain at the outer (lateral) side of the elbow, at the point where the forearm muscles attach to the bone. Despite the name, it is more common in non-athletes (plumbers, painters, cooks, carpenters) than in tennis players. It is caused by micro-tears in the tendon of extensor carpi radialis brevis.

Who gets it?

  • Peak age: early 40s-50s (early fifth decade)
  • More in women, smokers, manual laborers
  • Activities with repetitive supination and pronation of forearm

Clinical Features

  • Pain on the outer (lateral) side of elbow
  • Pain radiates down the forearm (towards wrist and back of hand)
  • Worsened by:
    • Gripping objects (handshake, opening jars)
    • Resisted wrist extension (bending wrist back against resistance)
    • Lifting with forearm (e.g., picking up a kettle)
  • Morning stiffness in elbow may be present
  • Weak grip

Physical Examination

Test/FindingDetail
TendernessOver lateral epicondyle, ~5mm distal and anterior to its midpoint
Cozen's testResisted wrist dorsiflexion (extension) with elbow extended reproduces pain - most important test
Mill's testPassive wrist flexion with elbow extended reproduces pain
Grip strengthReduced
Elbow ROMUsually full/normal
Cozen's test = Ask patient to make a fist, extend elbow, pronate forearm, and extend wrist against resistance. Pain at lateral epicondyle = positive.

Investigations

  • Clinical diagnosis in most cases
  • X-ray elbow: Usually normal; occasionally shows calcification
  • MRI: Shows increased signal in ECRB tendon, tendon thickening (used in resistant cases before surgery)
  • Nerve conduction studies: If radial tunnel syndrome (pain 3-4 cm distal to epicondyle) is suspected

6. CARPAL TUNNEL SYNDROME (CTS)

What is it?

The carpal tunnel is a narrow passage at the wrist through which the median nerve and 9 flexor tendons pass. When this tunnel gets narrowed (by swelling, inflammation, or anything increasing pressure), the median nerve gets compressed - causing pain, numbness, and weakness in the hand. This is called CTS - it is the most common nerve entrapment syndrome.

Who gets it?

  • More in women than men (~3% of adult population)
  • Pregnancy (very common - resolves after delivery)
  • Repetitive wrist/hand activities (typing, assembly line work)
  • Diabetes, hypothyroidism, rheumatoid arthritis, acromegaly, amyloidosis

Clinical Features

  • Pain, numbness, and tingling (paresthesia) in the hand
  • Affects radial 3Β½ fingers - thumb, index, middle, and half of ring finger (median nerve distribution)
  • Worse at night - wakes patient from sleep
  • Relieved by shaking or elevating the hand (classic - "flick sign")
  • Symptoms worsen with repetitive hand activities
  • May radiate up to forearm and shoulder (diffuse brachialgia)
  • In severe/late cases: weakness of grip and thenar muscle wasting (wasting of the fleshy mound at the base of the thumb)
  • No sensory loss over thenar eminence (palmar cutaneous branch leaves above carpal tunnel - important exam point)

Physical Examination

TestHow to doPositive result
Tinel's signTap over carpal tunnel at wrist crease with finger/hammerTingling/pain in radial 3Β½ fingers
Phalen's testPatient holds wrists in maximum flexion (90Β°) for 60 seconds, dorsal surfaces back-to-backNumbness/tingling in median nerve distribution within 60 seconds
Carpal compression testDirect pressure over carpal tunnel for 30 secondsReproduction of symptoms
Thenar atrophyLook at base of thumb - flattening/wastingSevere/late CTS
Abductor pollicis brevis testAsk patient to abduct thumb against resistanceWeakness in advanced CTS
Sensation testingCheck pin-prick in radial 3Β½ fingers vs. ulnar 1Β½ fingersDecreased sensation in median distribution
Most sensitive test = Carpal Compression Test Phalen's test sensitivity ~74%

Investigations

  • Nerve conduction studies (NCS) + EMG - Gold standard for confirmation
    • Prolonged distal motor and sensory latency in median nerve
    • Polyphasic reinnervation potentials in thenar muscles (EMG)
    • Must be done before surgery
  • Blood tests to screen for secondary causes: fasting blood glucose, TFTs, RFTs, serum calcium
  • X-ray wrist: May show cause (OA, fracture)
  • Ultrasound: Shows enlarged median nerve cross-sectional area > 10 mmΒ²
  • MRI: Not routine; used when other pathology suspected

7. MUSCULAR DYSTROPHY

What is it?

Muscular dystrophies are a group of inherited diseases where the muscles progressively get weaker and waste away. They are caused by gene mutations that lead to absent or defective muscle proteins.

Types (Know these for exam)

TypeInheritanceGene/ProteinAge of onset
Duchenne MD (DMD)X-linked recessiveXp21 - Dystrophin absent2-5 years
Becker MD (BMD)X-linked recessiveDystrophin reduced/abnormalLater, milder
Emery-Dreifuss MDX-linked recessiveEmerin proteinChildhood-adolescence
Limb-Girdle MDAutosomal recessiveVariousVariable
Facioscapulohumeral MD (FSH)Autosomal dominant4q35 deletionAdolescence-adult
Myotonic DystrophyAutosomal dominantCTG repeat expansionAny age

DUCHENNE MUSCULAR DYSTROPHY (DMD) - Most Important

What happens?

The gene on chromosome X (Xp21) that makes a protein called dystrophin is mutated. Dystrophin keeps muscle cell membranes stable. Without it, muscle fibers tear with every contraction and are replaced by fat and fibrous tissue.
  • Affects males (1 in 3500 live male births)
  • Females are carriers (usually unaffected)
  • Family history in 70%; ~30% are new mutations

Clinical Features (Chronological - Exam loves this!)

Early (age 2-5 years):
  • Delayed walking or toe walking
  • Frequent falls, difficulty running
  • Waddling gait (duck walk) due to proximal muscle weakness
Characteristic sign:
  • Gower's sign - child uses hands to "walk up" own legs to stand from floor due to proximal hip/thigh muscle weakness (classic exam question)
Progressive features:
  • Weakness starts in proximal muscles first (hip and shoulder girdle) then distal
  • Pseudohypertrophy of calf muscles - calves look big but are actually replaced by fat and fibrous tissue (appear enlarged but are actually weak)
  • Lumbar lordosis (exaggerated inward curve of lower back)
  • Waddling gait
  • Difficulty climbing stairs, getting up from floor
  • Frequent falls
Late features:
  • Wheelchair bound by age 12 (typically 9-12 years)
  • Scoliosis develops after losing ambulation
  • Respiratory muscle weakness - recurrent chest infections, respiratory failure
  • Cardiomyopathy (dilated) - ECG changes, heart failure
  • Cognitive involvement - mild intellectual disability in some
Death:
  • Usually in late teens to 20s from respiratory failure or cardiomyopathy

Physical Examination

FindingSignificance
Gower's sign (positive)Proximal hip muscle weakness
Pseudohypertrophy of calvesFatty/fibrous replacement of muscle
Waddling gaitHip abductor weakness
Lumbar hyperlordosisCompensation for weak hip extensors
Reduced deep tendon reflexes (late)Muscle loss
Contractures (heel cord, hip flexors)Late disease
ScoliosisAfter losing ambulation
Cardiac exam - dilated cardiomyopathy signsLate disease

Investigations

TestFinding
Serum Creatine Kinase (CK/CPK)Markedly elevated (10-100x normal) - earliest and most important test
EMG (Electromyography)Myopathic pattern (short, small, polyphasic potentials)
Muscle biopsyAbsence of dystrophin on immunostaining; muscle fiber necrosis, fat/fibrous replacement
Genetic testing (DNA)Deletion/duplication in dystrophin gene on Xp21 - confirms diagnosis
ECGTall R waves in V1, deep Q waves in lateral leads (cardiomyopathy pattern)
EchocardiographyDilated cardiomyopathy
Pulmonary function tests (PFTs)Reduced FVC (restrictive pattern)
LFTsALP, AST may be elevated (from muscle)

BECKER MUSCULAR DYSTROPHY (BMD)

  • Same gene as DMD but dystrophin is reduced in amount or abnormal (not totally absent)
  • Milder and later onset than DMD
  • Patients remain ambulant beyond age 15 (key difference from DMD)
  • Pseudohypertrophy of calves also present
  • Death usually in 30s-50s

FACIOSCAPULOHUMERAL DYSTROPHY (FSH)

  • Affects face, shoulder girdle, and upper arm muscles
  • Autosomal dominant
  • Features: Cannot close eyes fully, cannot whistle/smile (facial weakness), difficulty raising arms above head (shoulder girdle)
  • Onset in teens to young adult
  • Progress slowly; normal lifespan in many

SUMMARY TABLE FOR QUICK REVISION

DiseaseKey SymptomKey SignKey Investigation
OsteoarthritisPain worse end of day, <30 min morning stiffnessHeberden/Bouchard nodes, crepitusX-ray: JOSS
OsteoporosisSilent; fracture after minor traumaHeight loss, kyphosisDEXA scan (T-score)
Frozen ShoulderPain + global ROM restrictionBoth active & passive ROM reduced; external rotation most restrictedX-ray (exclude other causes); Arthrography
Plantar FasciitisHeel pain worst in morning, first stepsTenderness at medial calcaneal tubercleClinical; X-ray shows calcaneal spur
Tennis ElbowLateral elbow pain on grippingTenderness at lateral epicondyle; Cozen's test +veClinical; MRI (ECRB tendon)
Carpal Tunnel SyndromeNumbness/tingling thumb-middle finger, worse at night, relieved by shakingTinel's +ve, Phalen's +ve, thenar wastingNerve conduction studies
Duchenne MDProgressive proximal weakness, falls, toe walking in childGower's sign, calf pseudohypertrophy, waddling gaitSerum CK (markedly elevated), muscle biopsy, genetic testing

QUICK MNEMONICS AND HIGH-YIELD EXAM POINTS

  1. OA morning stiffness < 30 min vs. RA morning stiffness > 1 hour
  2. OA X-ray = JOSS (Joint space narrowing, Osteophytes, Subchondral Sclerosis, Subchondral cysts)
  3. Osteoporosis T-score ≀ -2.5 on DEXA (measured at spine and hip)
  4. Frozen shoulder = adhesive capsulitis = 3 stages: Freezing, Frozen, Thawing
  5. CTS affects radial 3Β½ fingers (median nerve); NOT the little finger
  6. Thenar eminence skin is NOT affected in CTS (palmar cutaneous branch exits proximal to tunnel)
  7. Gower's sign = DMD (proximal muscle weakness)
  8. Pseudohypertrophy of calves = DMD (calves look big, are actually weak)
  9. Serum CK is the first abnormal test in DMD (markedly elevated even before symptoms)
  10. Tennis elbow = lateral epicondyle; Golfer's elbow = medial epicondyle
  11. Heberden nodes (DIP) and Bouchard nodes (PIP) are features of OA, NOT RA
  12. In Frozen Shoulder, restrict external rotation first and most severely

Sources: Goldman-Cecil Medicine (2023), Textbook of Family Medicine 9e, Campbell's Operative Orthopaedics 15e 2026, Miller's Review of Orthopaedics 9e, Bailey & Love's Surgery 28e, Bradley & Daroff's Neurology, Grainger & Allison's Diagnostic Radiology

Make a presentation with clinical images of each condition..........along with flow charts,tables etc, whereever possible

Reading File
Reading File
Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Running Command

ls /home/daytona/workspace/ && mkdir -p /home/daytona/workspace/bone-joints-ppt

Writing File

~/bone-joints-ppt/create_presentation.js

const pptxgen = require("pptxgenjs");
const { execSync } = require("child_process");

// Fetch images helper
function fetchImages(urls) {
  try {
    const result = execSync(
      `node /home/daytona/skills/shared/scripts/fetch_images.js ${urls.map(u => `"${u}"`).join(" ")}`,
      { maxBuffer: 50 * 1024 * 1024 }
    ).toString();
    return JSON.parse(result);
  } catch (e) {
    console.error("Image fetch error:", e.message);
    return urls.map(u => ({ url: u, base64: null, error: e.message }));
  }
}

// ─────────────────────────────────────────────────────────────────
// IMAGE URLS from textbooks
// ─────────────────────────────────────────────────────────────────
const IMG_OA_KNEE_XRAY       = "https://cdn.orris.care/cdss_images/565858d1e88d71b07ae2a7dbcff9eac8ceec8bfce5e50ecb5e33dabf7b749b05.png"; // KL grades knee OA
const IMG_OA_PATHOLOGY       = "https://cdn.orris.care/cdss_images/c570c27d9b3a92fd7075d9e464bc9c47631ef7ff1301e84f69ac7823097b3f76.png"; // OA progression flowchart/pathology
const IMG_OA_HIP_XRAY        = "https://cdn.orris.care/cdss_images/f4a2f733a2cc160a0239f2b4f98df1b4fdf41c52151c51a81e785f8b6a52f6a8.png"; // OA hip/DIP xray
const IMG_OSTEOPOROSIS_SPINE = "https://cdn.orris.care/cdss_images/0d1169e464834402c43018a52a74a2b2aa023ffbf0d675ffc838a3c6d41d06d9.png"; // vertebral fractures CT
const IMG_OSTEOPOROSIS_CT    = "https://cdn.orris.care/cdss_images/bd33bba5188581d4f352c1b360c760cf8a11e35a0749c17644ceaa49faa6ff7b.png"; // advanced osteoporosis CT
const IMG_CARPAL_TUNNEL_ANATOMY = "https://cdn.orris.care/cdss_images/7fde2ad510505f006b3c2eb9fbf9142afcfc5d58e4e6cf6b466cf16cd707fbef.png"; // carpal tunnel cross-section
const IMG_THENAR_ATROPHY     = "https://cdn.orris.care/cdss_images/5490b409b11bd960a0e3ded032535a361c562b6591cfa70cf42da4e10a9b1af6.png"; // thenar muscle atrophy
const IMG_GOWER_SIGN         = "https://cdn.orris.care/cdss_images/4fdc7fe2ca7cc38fa418b9f4bdc1e4498486d443c0972788ad9cc00fc263ca60.png"; // Gower sign DMD child
const IMG_OA_INCIDENCE       = "https://cdn.orris.care/cdss_images/7926d19d34bcf59f822e9061ec3f156c41ad1c069f9e17dd8bdb5816e0beeedd.png"; // OA incidence graph
const IMG_OSTEOPOROSIS_LATERAL_SPINE = "https://cdn.orris.care/cdss_images/6bb6738270920d2e2734d97694cceb15f8b4468d21fb943466c198c67b337e9a.png"; // osteopenia lateral spine

// ─────────────────────────────────────────────────────────────────
// Fetch all images
// ─────────────────────────────────────────────────────────────────
console.log("Fetching images...");
const allUrls = [
  IMG_OA_KNEE_XRAY, IMG_OA_PATHOLOGY, IMG_OA_HIP_XRAY,
  IMG_OSTEOPOROSIS_SPINE, IMG_OSTEOPOROSIS_CT,
  IMG_CARPAL_TUNNEL_ANATOMY, IMG_THENAR_ATROPHY,
  IMG_GOWER_SIGN, IMG_OA_INCIDENCE, IMG_OSTEOPOROSIS_LATERAL_SPINE
];
const fetched = fetchImages(allUrls);
const imgMap = {};
allUrls.forEach((url, i) => { imgMap[url] = fetched[i]; });

function getImg(url) {
  const f = imgMap[url];
  if (f && f.base64 && !f.error) return { data: f.base64 };
  return null;
}

// ─────────────────────────────────────────────────────────────────
// COLOUR PALETTE  (medical/academic blue-teal theme)
// ─────────────────────────────────────────────────────────────────
const C = {
  dark:    "0D2137",   // deep navy – title/section bg
  mid:     "1A4A7A",   // medium blue – headers
  accent:  "1D8A99",   // teal – highlight bars
  light:   "EAF4F7",   // pale blue – content bg
  white:   "FFFFFF",
  text:    "1A2533",
  yellow:  "F5C842",   // accent for key points
  orange:  "E87722",   // attention colour
  green:   "2D9E6B",   // positive/normal
  red:     "C0392B",   // danger/abnormal
  gray:    "5A6474",
  ltgray:  "F0F4F8",
};

let pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.author  = "Medical Education";
pres.title   = "Diseases of Bone and Joints";

// ─────────────────────────────────────────────────────────────────
// HELPER FUNCTIONS
// ─────────────────────────────────────────────────────────────────
function titleSlide(title, subtitle) {
  const sl = pres.addSlide();
  sl.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:10, h:5.625, fill:{ color: C.dark } });
  sl.addShape(pres.shapes.RECTANGLE, { x:0, y:4.2, w:10, h:0.08, fill:{ color: C.accent } });
  sl.addShape(pres.shapes.RECTANGLE, { x:0, y:4.28, w:10, h:1.345, fill:{ color: C.mid } });
  sl.addText(title, {
    x:0.5, y:1.2, w:9, h:2.2, fontSize:36, bold:true, color:C.white,
    fontFace:"Calibri", align:"center", valign:"middle", wrap:true
  });
  sl.addText(subtitle, {
    x:0.5, y:4.3, w:9, h:1.0, fontSize:16, color:"AACFE0",
    fontFace:"Calibri", align:"center", valign:"middle"
  });
  return sl;
}

function sectionSlide(title, color) {
  const bgColor = color || C.accent;
  const sl = pres.addSlide();
  sl.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:10, h:5.625, fill:{ color: bgColor } });
  sl.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:0.18, h:5.625, fill:{ color: C.yellow } });
  sl.addText(title, {
    x:0.5, y:1.5, w:9, h:2.5, fontSize:34, bold:true, color:C.white,
    fontFace:"Calibri", align:"center", valign:"middle", wrap:true
  });
  return sl;
}

function contentSlide(title, bullets, imgObj, note) {
  const sl = pres.addSlide();
  sl.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:10, h:5.625, fill:{ color: C.ltgray } });
  sl.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:10, h:0.65, fill:{ color: C.mid } });
  sl.addShape(pres.shapes.RECTANGLE, { x:0, y:0.65, w:10, h:0.06, fill:{ color: C.accent } });
  sl.addText(title, {
    x:0.2, y:0, w:9.6, h:0.65, fontSize:18, bold:true, color:C.white,
    fontFace:"Calibri", valign:"middle", margin:0
  });

  const hasImg = !!imgObj;
  const textW = hasImg ? 5.4 : 9.4;

  if (bullets && bullets.length) {
    const textItems = bullets.map((b, i) => {
      if (b.startsWith("##")) {
        return { text: b.replace("##","").trim(), options: { bold:true, color: C.mid, fontSize:13, breakLine: i < bullets.length-1 } };
      }
      return { text: b, options: { bullet:{ code:"2022" }, color: C.text, fontSize:12, breakLine: i < bullets.length-1 } };
    });
    sl.addText(textItems, {
      x:0.3, y:0.8, w:textW, h:4.6,
      fontFace:"Calibri", valign:"top", wrap:true
    });
  }

  if (hasImg) {
    sl.addShape(pres.shapes.RECTANGLE, { x:5.85, y:0.8, w:3.9, h:4.5,
      fill:{ color: C.white },
      shadow:{ type:"outer", color:"000000", blur:6, offset:2, angle:135, opacity:0.12 }
    });
    sl.addImage(Object.assign({}, imgObj, { x:5.95, y:0.85, w:3.7, h:4.2 }));
    if (note) {
      sl.addText(note, { x:5.9, y:5.05, w:3.8, h:0.35, fontSize:8, color:C.gray, italic:true, wrap:true });
    }
  }
  return sl;
}

function twoColSlide(title, leftBullets, rightBullets, leftTitle, rightTitle) {
  const sl = pres.addSlide();
  sl.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:10, h:5.625, fill:{ color: C.ltgray } });
  sl.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:10, h:0.65, fill:{ color: C.mid } });
  sl.addShape(pres.shapes.RECTANGLE, { x:0, y:0.65, w:10, h:0.06, fill:{ color: C.accent } });
  sl.addText(title, {
    x:0.2, y:0, w:9.6, h:0.65, fontSize:18, bold:true, color:C.white, fontFace:"Calibri", valign:"middle", margin:0
  });

  // Left column header
  if (leftTitle) {
    sl.addShape(pres.shapes.RECTANGLE, { x:0.2, y:0.82, w:4.6, h:0.38, fill:{ color: C.accent }, rectRadius:0 });
    sl.addText(leftTitle, { x:0.2, y:0.82, w:4.6, h:0.38, fontSize:12, bold:true, color:C.white, align:"center", valign:"middle", fontFace:"Calibri", margin:0 });
  }
  // Right column header
  if (rightTitle) {
    sl.addShape(pres.shapes.RECTANGLE, { x:5.2, y:0.82, w:4.6, h:0.38, fill:{ color: C.orange }, rectRadius:0 });
    sl.addText(rightTitle, { x:5.2, y:0.82, w:4.6, h:0.38, fontSize:12, bold:true, color:C.white, align:"center", valign:"middle", fontFace:"Calibri", margin:0 });
  }

  const makeItems = (arr) => arr.map((b,i) => {
    if (b.startsWith("##")) return { text: b.replace("##","").trim(), options:{ bold:true, color:C.mid, fontSize:11.5, breakLine: i<arr.length-1 }};
    return { text: b, options:{ bullet:{ code:"2022" }, color:C.text, fontSize:11.5, breakLine: i<arr.length-1 }};
  });

  sl.addText(makeItems(leftBullets),  { x:0.25, y:1.3, w:4.55, h:4.0, fontFace:"Calibri", valign:"top", wrap:true });
  sl.addText(makeItems(rightBullets), { x:5.25, y:1.3, w:4.55, h:4.0, fontFace:"Calibri", valign:"top", wrap:true });
  // Vertical divider
  sl.addShape(pres.shapes.RECTANGLE, { x:4.9, y:0.72, w:0.04, h:4.7, fill:{ color: C.accent } });
  return sl;
}

function tableSlide(title, headers, rows, notes) {
  const sl = pres.addSlide();
  sl.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:10, h:5.625, fill:{ color: C.ltgray } });
  sl.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:10, h:0.65, fill:{ color: C.mid } });
  sl.addShape(pres.shapes.RECTANGLE, { x:0, y:0.65, w:10, h:0.06, fill:{ color: C.accent } });
  sl.addText(title, {
    x:0.2, y:0, w:9.6, h:0.65, fontSize:18, bold:true, color:C.white, fontFace:"Calibri", valign:"middle", margin:0
  });
  const tableH = notes ? 4.1 : 4.7;
  const tableRows = [
    headers.map(h => ({ text:h, options:{ bold:true, color:C.white, fill:C.mid, align:"center", fontSize:11 } })),
    ...rows.map((row, ri) => row.map((cell, ci) => ({
      text: cell,
      options:{ color: C.text, fill: ri%2===0 ? C.white : "E8F4F8", fontSize:10.5, align: ci===0 ? "left":"center" }
    })))
  ];
  sl.addTable(tableRows, {
    x:0.2, y:0.78, w:9.6, h:tableH,
    border:{ type:"solid", color:"C8DDE8", pt:0.5 },
    fontFace:"Calibri"
  });
  if (notes) {
    sl.addText(notes, { x:0.2, y:4.95, w:9.6, h:0.5, fontSize:9.5, color:C.gray, italic:true, fontFace:"Calibri" });
  }
  return sl;
}

function flowSlide(title, steps, color) {
  const sl = pres.addSlide();
  sl.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:10, h:5.625, fill:{ color: C.ltgray } });
  sl.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:10, h:0.65, fill:{ color: C.mid } });
  sl.addShape(pres.shapes.RECTANGLE, { x:0, y:0.65, w:10, h:0.06, fill:{ color: C.accent } });
  sl.addText(title, {
    x:0.2, y:0, w:9.6, h:0.65, fontSize:18, bold:true, color:C.white, fontFace:"Calibri", valign:"middle", margin:0
  });

  const n = steps.length;
  const boxW = 1.55;
  const boxH = 1.1;
  const startX = 0.25;
  const gap = 0.28;
  const totalW = n * boxW + (n-1) * gap;
  const offX = (10 - totalW) / 2;
  const y = 1.9;
  const clr = color || C.accent;

  steps.forEach((s, i) => {
    const x = offX + i * (boxW + gap);
    sl.addShape(pres.shapes.ROUNDED_RECTANGLE, {
      x, y, w:boxW, h:boxH,
      fill:{ color: i%2===0 ? clr : C.mid },
      rectRadius:0.08,
      shadow:{ type:"outer", color:"000000", blur:5, offset:2, angle:135, opacity:0.15 }
    });
    sl.addText(s.label, {
      x, y, w:boxW, h:0.38, fontSize:10, bold:true, color:C.white,
      fontFace:"Calibri", align:"center", valign:"middle", margin:0
    });
    sl.addText(s.desc, {
      x, y:y+0.38, w:boxW, h:0.72, fontSize:9, color:C.white,
      fontFace:"Calibri", align:"center", valign:"top", margin:4, wrap:true
    });
    if (i < n-1) {
      const ax = x + boxW + 0.04;
      sl.addShape(pres.shapes.CHEVRON, { x:ax, y:y+0.3, w:gap-0.04, h:0.5, fill:{ color: C.yellow } });
    }
  });
  return sl;
}

function keyPointsBox(sl, items, x, y, w, h) {
  sl.addShape(pres.shapes.RECTANGLE, { x, y, w, h, fill:{ color:"FFF8E1" },
    line:{ color: C.yellow, pt:2 },
    shadow:{ type:"outer", color:"000000", blur:4, offset:1, angle:135, opacity:0.1 }
  });
  sl.addText("βš‘ KEY POINTS", { x:x+0.1, y, w:w-0.2, h:0.35, fontSize:10, bold:true, color:C.orange, fontFace:"Calibri", margin:4 });
  const textItems = items.map((t,i) => ({ text:t, options:{ bullet:{ code:"2713" }, color:C.text, fontSize:10, breakLine: i<items.length-1 } }));
  sl.addText(textItems, { x:x+0.1, y:y+0.35, w:w-0.2, h:h-0.4, fontFace:"Calibri", valign:"top", wrap:true });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 1  –  TITLE
// ═══════════════════════════════════════════════════════════════
titleSlide(
  "Diseases of Bone & Joints",
  "Osteoarthritis Β· Osteoporosis Β· Frozen Shoulder Β· Plantar Fasciitis Β· Tennis Elbow Β· Carpal Tunnel Syndrome Β· Muscular Dystrophy"
);

// ═══════════════════════════════════════════════════════════════
// SLIDE 2  –  INDEX
// ═══════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:10, h:5.625, fill:{ color: C.dark } });
  sl.addText("Topics Covered", { x:0.5, y:0.3, w:9, h:0.6, fontSize:24, bold:true, color:C.white, fontFace:"Calibri", align:"center" });

  const topics = [
    ["01", "Osteoarthritis", C.accent],
    ["02", "Osteoporosis", "#2980B9"],
    ["03", "Frozen Shoulder", "#8E44AD"],
    ["04", "Plantar Fasciitis / Calcaneal Spur", C.orange],
    ["05", "Tennis Elbow (Lateral Epicondylitis)", "#16A085"],
    ["06", "Carpal Tunnel Syndrome", C.green],
    ["07", "Muscular Dystrophy", "#C0392B"],
  ];

  topics.forEach(([num, name, color], i) => {
    const col = i < 4 ? 0 : 1;
    const row = col === 0 ? i : i - 4;
    const x = col === 0 ? 0.4 : 5.2;
    const y = 1.0 + row * 0.82;
    sl.addShape(pres.shapes.ROUNDED_RECTANGLE, { x, y, w:4.5, h:0.68, fill:{ color }, rectRadius:0.1 });
    sl.addText(num, { x:x+0.1, y, w:0.55, h:0.68, fontSize:18, bold:true, color:C.white, align:"center", valign:"middle", fontFace:"Calibri", margin:0 });
    sl.addShape(pres.shapes.RECTANGLE, { x:x+0.65, y:y+0.06, w:0.04, h:0.56, fill:{ color:"FFFFFF" } });
    sl.addText(name, { x:x+0.75, y, w:3.6, h:0.68, fontSize:13, color:C.white, valign:"middle", fontFace:"Calibri", wrap:true, margin:4 });
  });
}

// ═══════════════════════════════════════════════════════════════
// β–Ά  SECTION 1: OSTEOARTHRITIS
// ═══════════════════════════════════════════════════════════════
sectionSlide("01  OSTEOARTHRITIS\n(Degenerative Joint Disease)", C.accent);

// Definition + Epidemiology
{
  const sl = contentSlide(
    "Osteoarthritis – Definition & Epidemiology",
    [
      "##Definition",
      "Most common form of arthritis; degeneration of articular cartilage with bone changes",
      "Failed repair of synovial joint after intra-articular stress β†’ pain, stiffness, disability",
      "##Who Gets It?",
      "Most common after age 45; more in women after 55",
      "Almost all 75-year-olds show OA on X-ray (most asymptomatic)",
      "Knee OA: lifetime risk 40% (men), 47% (women)",
      "##Types",
      "Primary (idiopathic) – no clear cause, genetic component",
      "Secondary – previous injury, gout, RA, endocrine (obesity, hemochromatosis)",
      "Generalized – 5+ joints involved",
      "Erosive OA – inflammatory, DIP + PIP of hands; 15% evolve to RA",
    ],
    getImg(IMG_OA_INCIDENCE),
    "OA incidence by age/sex (Goldman-Cecil Medicine)"
  );
  keyPointsBox(sl, [
    "OA β‰  just 'wear and tear' β€” genetic, metabolic & mechanical factors all play a role",
    "OA of knee accounts for ~85% of global OA burden",
  ], 0.25, 4.6, 5.2, 0.85);
}

// Clinical Features
{
  const sl = contentSlide(
    "Osteoarthritis – Clinical Features (Symptoms)",
    [
      "##Pain",
      "Gradual onset; worse with activity / end of day; relieved by rest",
      "Severe OA: pain even at rest / at night",
      "##Stiffness",
      "Morning stiffness < 30 minutes (KEY: differentiates from RA > 1 hr)",
      "Gel phenomenon – stiffness after inactivity, resolves within minutes",
      "##Other Symptoms",
      "Crepitus (grating/cracking sound and feel)",
      "No fever, no weight loss (no systemic symptoms)",
      "Cold/damp weather worsens symptoms (↓ barometric pressure)",
      "Knee OA: buckling on stairs; Hip OA: groin pain to anterior thigh",
      "##Joints Affected",
      "Knee, hip, spine, hands (DIP β†’ Heberden nodes; PIP β†’ Bouchard nodes)",
      "First CMC joint (base of thumb), 1st MTP joint (big toe)",
    ],
    null, null
  );
  keyPointsBox(sl, [
    "Morning stiffness < 30 min in OA vs. > 1 hour in RA",
    "Heberden = DIP (Distal); Bouchard = PIP (Proximal) β€” H before B, D before P",
    "Gel phenomenon = stiffness after rest, resolves quickly with movement",
  ], 0.25, 4.25, 9.5, 1.1);
}

// Physical Examination
twoColSlide(
  "Osteoarthritis – Physical Examination",
  [
    "##General",
    "Joint tenderness along joint line",
    "Crepitus on movement",
    "Bony swelling (hard) β†’ osteophytes",
    "Soft tissue swelling β†’ effusion",
    "Reduced range of motion (late)",
    "Joint deformity (advanced)",
    "Muscle wasting (disuse atrophy)",
    "##Hands",
    "Heberden nodes (DIP joints)",
    "Bouchard nodes (PIP joints)",
    "First CMC joint squaring",
  ],
  [
    "##Knee",
    "Varus deformity (bow-leg) β†’ medial compartment OA",
    "Fixed flexion deformity",
    "Patellofemoral compression test β†’ pain",
    "Valgus/varus stress test for instability",
    "##Hip",
    "Earliest sign: loss of internal rotation with pain at end of range",
    "FABER test (flexion, abduction, external rotation) β†’ hip pain",
    "##Important",
    "Hot, red, very swollen joint = NOT OA β†’ think infection or gout",
    "Both active and passive ROM reduced",
  ],
  "Examination Findings", "Joint-Specific Features"
);

// X-ray Slide with image
{
  const sl = contentSlide(
    "Osteoarthritis – X-ray Features (Kellgren-Lawrence Grading)",
    [
      "##4 Key X-ray Changes (JOSS)",
      "J – Joint space narrowing",
      "O – Osteophytes (bone spurs at joint margins)",
      "S – Subchondral Sclerosis (denser/whiter bone)",
      "S – Subchondral Cysts (holes in bone near joint)",
      "##Kellgren-Lawrence (KL) Grading",
      "Grade 0 – Normal",
      "Grade 1 – Doubtful (small osteophyte, suspected JSN)",
      "Grade 2 – Minimal (osteophytes, JSN < 50%)",
      "Grade 3 – Moderate (JSN > 50%, tibial sclerosis)",
      "Grade 4 – Severe (no joint space, cysts, bone deformity)",
      "##MRI",
      "Shows cartilage damage, synovitis (not routine)",
      "##Lab tests",
      "NORMAL – blood tests; Synovial fluid non-inflammatory (<2000 WBC)",
    ],
    getImg(IMG_OA_KNEE_XRAY),
    "Kellgren-Lawrence grades 0–4 knee OA (Miller's Orthopaedics)"
  );
}

// OA Investigations Table
tableSlide(
  "Osteoarthritis – Summary of Investigations",
  ["Investigation", "Findings", "Purpose"],
  [
    ["X-ray (weight-bearing)", "JOSS: JSN, Osteophytes, Sclerosis, Cysts", "First-line / grading"],
    ["Blood tests (ESR, CRP, RF)", "NORMAL", "Rule out inflammatory arthritis"],
    ["Synovial fluid analysis", "Non-inflammatory (<2000 WBC/mmΒ³), clear", "Rule out infection/crystal disease"],
    ["MRI", "Cartilage loss, bone marrow lesions, synovitis", "Atypical/pre-surgical cases"],
    ["CT scan", "Bony anatomy detail", "Pre-operative planning"],
  ],
  "βš‘ Diagnosis of OA is clinical. Imaging confirms and grades severity. Labs are done mainly to exclude other diagnoses."
);

// ═══════════════════════════════════════════════════════════════
// β–Ά  SECTION 2: OSTEOPOROSIS
// ═══════════════════════════════════════════════════════════════
sectionSlide("02  OSTEOPOROSIS\n(The Silent Disease)", "#2980B9");

// Definition
contentSlide(
  "Osteoporosis – Definition, Types & Risk Factors",
  [
    "##Definition",
    "Bones become weak & fragile because bone strength decreases",
    "Result: fractures from MINOR trauma (fragility fractures)",
    "WHO: T-score ≀ βˆ’2.5 on DEXA scan",
    "##Types",
    "Primary Type 1 – Postmenopausal (estrogen loss)",
    "Primary Type 2 – Age-related / Senile (after 70 yrs)",
    "Secondary – Due to steroids, hyperthyroidism, malabsorption, RA, etc.",
    "##Key Risk Factors",
    "Postmenopausal, elderly, low BMI (< 19)",
    "Long-term steroid use (most common secondary cause)",
    "Smoking, alcohol, sedentary lifestyle",
    "Previous fragility fracture, family history",
    "Low calcium / Vitamin D intake",
    "Rheumatoid arthritis, chronic liver/kidney disease",
  ],
  null, null
);

// Clinical Features + Examination
twoColSlide(
  "Osteoporosis – Clinical Features & Examination",
  [
    "##Symptoms",
    "SILENT – no pain until fracture occurs",
    "Fracture from minor trauma = first sign",
    "##Common Fracture Sites",
    "1. Vertebral crush fracture (spine)",
    "   – Sudden back pain after bending/lifting",
    "2. Distal radius (Colles fracture – wrist)",
    "   – After fall on outstretched hand",
    "3. Neck of femur (hip fracture)",
    "   – After minimal trauma; VERY serious",
    "   – 20% die within 1 year of hip fracture",
    "##Late Features",
    "Loss of height (from vertebral fractures)",
    "Dowager's hump (thoracic kyphosis)",
    "Chronic back pain",
  ],
  [
    "##Physical Examination",
    "Measure height (compare to stated height)",
    "Thoracic kyphosis (Dowager's hump)",
    "Tenderness on spinal percussion β†’ fracture",
    "Look for signs of secondary causes:",
    "Cushing's β†’ moon face, striae, buffalo hump",
    "Hyperthyroidism β†’ goitre, exophthalmos",
    "##Key Exam Signs",
    "Loss of > 4 cm height β†’ suspect vertebral fracture",
    "Single level kyphosis β†’ recent fracture",
    "FABER, SLR to assess hip/spine pain",
    "##WHO T-Score Classification",
    "Normal: T β‰₯ βˆ’1.0",
    "Osteopenia: T = βˆ’1.0 to βˆ’2.5",
    "Osteoporosis: T ≀ βˆ’2.5",
  ],
  "Symptoms & Fracture Sites", "Examination & WHO Classification"
);

// Osteoporosis X-ray image
{
  contentSlide(
    "Osteoporosis – Radiological Features",
    [
      "##Plain X-ray",
      "Decreased bone density (translucent / lighter bones)",
      "Only detects > 30–40% bone loss (not for early diagnosis)",
      "Vertebral wedge fractures, biconcave 'codfish' vertebrae",
      "Vertical striations in vertebral bodies (horizontal trabecular loss)",
      "##CT Scan (Spine)",
      "Shows severe vertebral fractures with detail",
      "Protrusion of dorsal border into spinal canal in severe cases",
      "Prominent vertical trabeculae β†’ striated appearance",
      "##DEXA Scan",
      "GOLD STANDARD – measures bone mineral density (BMD)",
      "Sites: Lumbar spine (L1-L4) and femoral neck (hip)",
      "T-score compared to young healthy adult reference",
      "##Ultrasound (QUS)",
      "Portable screening tool; not for definitive diagnosis",
    ],
    getImg(IMG_OSTEOPOROSIS_SPINE),
    "Vertebral fractures L1, TH12 on CT – severe osteoporosis (Grainger & Allison)"
  );
}

// Osteoporosis Investigations Table
tableSlide(
  "Osteoporosis – Summary of Investigations",
  ["Test", "What it shows", "When to use"],
  [
    ["DEXA scan", "T-score: gold standard for BMD", "All at-risk patients"],
    ["X-ray spine/hip", "Fractures, decreased density (late finding)", "Symptomatic patients"],
    ["Serum calcium, phosphate", "Usually normal in primary OP; abnormal in secondary", "All patients"],
    ["Serum 25-OH Vit D + PTH", "Vitamin D deficiency, hyperparathyroidism", "Routine screening"],
    ["TFTs (thyroid)", "Hyperthyroidism as secondary cause", "All patients"],
    ["Serum cortisol / urine free cortisol", "Cushing's syndrome", "If features present"],
    ["Bone turnover markers (ALP, NTx)", "Assess bone remodelling activity", "Monitoring treatment"],
    ["Testosterone (men)", "Hypogonadism as secondary cause", "Men with OP"],
  ],
  "βš‘ FRAX score (WHO fracture risk assessment tool) uses clinical factors to estimate 10-year fracture probability."
);

// ═══════════════════════════════════════════════════════════════
// β–Ά  SECTION 3: FROZEN SHOULDER
// ═══════════════════════════════════════════════════════════════
sectionSlide("03  FROZEN SHOULDER\n(Adhesive Capsulitis)", "#8E44AD");

// Clinical Features
twoColSlide(
  "Frozen Shoulder – Definition & Clinical Features",
  [
    "##Definition",
    "Pain + global restriction of shoulder movement due to thickening and contraction of the joint capsule",
    "##Who Gets It?",
    "Age 40–70 years; women > men",
    "Non-dominant arm more affected",
    "Associated: Diabetes, thyroid disease",
    "Also: Immobilisation, trauma, post-surgery",
    "##Symptoms",
    "Insidious onset of diffuse shoulder pain",
    "Progressive restriction of ALL movements",
    "External rotation restricted most (first and worst)",
    "Cannot comb hair, reach behind back",
    "Pain worse at night",
  ],
  [
    "##3 Classic Stages",
    "Stage 1 – FREEZING (2–9 months)",
    "   Severe pain, gradual stiffness begins",
    "Stage 2 – FROZEN (4–12 months)",
    "   Less pain but maximum stiffness",
    "Stage 3 – THAWING (5–26 months)",
    "   Stiffness gradually resolves",
    "##Total Duration",
    "1–3 years; ~90% recover with conservative Rx",
    "##Key Differentiator",
    "Active ROM = Passive ROM (BOTH reduced equally)",
    "In rotator cuff tear: passive ROM preserved",
    "In glenohumeral OA: X-ray shows joint changes",
    "Posterior shoulder dislocation: X-ray abnormal",
  ],
  "Definition, Causes & Symptoms", "Stages & Key Points"
);

// Frozen Shoulder Examination
contentSlide(
  "Frozen Shoulder – Physical Examination",
  [
    "##Inspection",
    "Guarded posture, arm held close to body",
    "Scapular hitching on attempted abduction",
    "##Palpation",
    "Diffuse tenderness over shoulder",
    "##Range of Motion (most important)",
    "External rotation: 0–10Β° (severely restricted)",
    "Abduction: typically < 90Β°",
    "Internal rotation: restricted (can't reach back pocket)",
    "Flexion: restricted",
    "ALL movements restricted – ACTIVE = PASSIVE",
    "##Special Tests",
    "Rotator cuff tests (Supraspinatus/Hawkins) – negative",
    "##Mandatory",
    "Always X-ray shoulder to rule out OA, posterior dislocation",
  ],
  null, null
);

// Investigations – Frozen Shoulder
tableSlide(
  "Frozen Shoulder – Investigations",
  ["Investigation", "Finding", "Purpose"],
  [
    ["X-ray shoulder (AP + lateral)", "Usually normal OR slight disuse osteopenia", "Rule out OA, dislocation, fracture – MANDATORY first step"],
    ["Arthrography (contrast injection)", "Reduced joint capsule volume, loss of axillary recess", "Confirms diagnosis (gold standard imaging)"],
    ["MRI shoulder", "Capsule thickening, obliteration of subcoracoid fat triangle, rotator interval synovitis", "If doubt about diagnosis"],
    ["Fasting blood glucose (HbA1c)", "Elevated in undiagnosed diabetes", "Screen for associated diabetes"],
    ["Thyroid function tests (TFTs)", "Abnormal if thyroid disease related", "Screen for thyroid cause"],
    ["Ultrasound", "Capsule thickening, rotator interval changes", "Assess rotator cuff"],
  ],
  "βš‘ Diagnosis is primarily clinical. X-ray is mandatory to exclude other shoulder pathology."
);

// ═══════════════════════════════════════════════════════════════
// β–Ά  SECTION 4: PLANTAR FASCIITIS / CALCANEAL SPUR
// ═══════════════════════════════════════════════════════════════
sectionSlide("04  PLANTAR FASCIITIS\nCalcaneal Spur", C.orange);

// Clinical Features
twoColSlide(
  "Plantar Fasciitis / Calcaneal Spur – Features",
  [
    "##Definition",
    "Pain and degeneration at the origin of plantar fascia at the medial calcaneal tuberosity",
    "Calcaneal spur = bony growth at fascia attachment on heel bone",
    "##Mechanism",
    "Overuse β†’ microtears at fascia-bone junction",
    "NOT primarily inflammatory (degenerative)",
    "##Who Gets It?",
    "Age 40–60 years",
    "Runners, athletes, prolonged standing",
    "Obese patients (high foot load)",
    "Flat feet (pes planus) or high arch (pes cavus)",
    "Inappropriate footwear",
  ],
  [
    "##Classic Symptoms",
    "Heel pain worst in morning on FIRST STEPS (classic!)",
    "Also painful after prolonged sitting then standing",
    "Sharp, stabbing, burning pain at heel",
    "Pain at medial plantar heel (anteromedial calcaneum)",
    "Improves slightly after a few minutes of walking",
    "Then worsens with prolonged standing / walking",
    "No swelling, numbness, or tingling (uncommon)",
    "##Physical Examination",
    "Point tenderness: medial calcaneal tubercle",
    "Passive dorsiflexion reproduces pain",
    "Ankle ROM: normal",
    "Look for pes planus / pes cavus",
    "Tight Achilles tendon often co-exists",
  ],
  "Definition, Mechanism & Risk Factors", "Symptoms & Clinical Examination"
);

// Plantar Fasciitis Investigations
tableSlide(
  "Plantar Fasciitis / Calcaneal Spur – Investigations",
  ["Investigation", "Finding", "Notes"],
  [
    ["Clinical examination", "Point tenderness at medial calcaneal tubercle", "Usually sufficient to diagnose"],
    ["X-ray heel (lateral view)", "Calcaneal spur – bony projection on plantar calcaneum", "Spur may exist without pain; pain may exist without spur"],
    ["Ultrasound foot", "Plantar fascia thickening > 4 mm", "Good for confirming and monitoring"],
    ["MRI foot", "Fascia thickening, oedema, partial tears", "For refractory/atypical cases"],
    ["Bone scan", "Increased uptake at calcaneum", "Rarely needed"],
  ],
  "βš‘ Diagnosis is clinical. X-ray is done to look for calcaneal spur and rule out stress fractures."
);

// ═══════════════════════════════════════════════════════════════
// β–Ά  SECTION 5: TENNIS ELBOW
// ═══════════════════════════════════════════════════════════════
sectionSlide("05  TENNIS ELBOW\n(Lateral Epicondylitis)", "#16A085");

// Clinical Features
twoColSlide(
  "Tennis Elbow – Clinical Features & Examination",
  [
    "##Definition",
    "Microtears in extensor carpi radialis brevis (ECRB) tendon at the lateral epicondyle",
    "##Who Gets It?",
    "Peak: early 40s–50s; women > men",
    "Repetitive supination/pronation with elbow extended",
    "Plumbers, painters, cooks, carpenters (not just tennis!)",
    "Risk: smoking, manual labour, statin use",
    "##Symptoms",
    "Pain at lateral (outer) side of elbow",
    "Radiates down forearm to wrist",
    "Weak grip (difficulty lifting kettle, turning door knob)",
    "Worsened by gripping and lifting",
    "Tender ~5mm distal + anterior to lateral epicondyle midpoint",
  ],
  [
    "##Physical Examination",
    "Tenderness over lateral epicondyle",
    "Cozen's test – MOST IMPORTANT:",
    "   Patient: fist, extended elbow, pronated forearm",
    "   Examiner: resists wrist dorsiflexion (extension)",
    "   Positive: pain at lateral epicondyle",
    "Mill's test:",
    "   Passive wrist flexion with elbow extended β†’ pain",
    "Grip strength: reduced",
    "Elbow ROM: usually FULL (preserved)",
    "##Differentiating Radial Tunnel Syndrome",
    "Pain 3–4 cm DISTAL to lateral epicondyle (not at it)",
    "Long finger extension against resistance β†’ pain",
    "No tenderness at epicondyle",
  ],
  "Definition, Risk Factors & Symptoms", "Clinical Tests & Examination"
);

// Tennis Elbow Investigations
tableSlide(
  "Tennis Elbow – Investigations",
  ["Investigation", "Finding", "Purpose"],
  [
    ["Clinical examination (Cozen's test)", "Positive: pain with resisted wrist extension", "Primary diagnostic tool – clinical diagnosis"],
    ["X-ray elbow", "Usually normal; occasionally calcification", "Rule out bony pathology / arthritis"],
    ["MRI elbow", "Increased signal T1/T2 in ECRB tendon; tendon thickening", "Resistant cases / pre-surgical assessment"],
    ["Nerve conduction studies (NCS)", "Normal in tennis elbow; abnormal in radial tunnel", "If radial tunnel syndrome suspected"],
    ["Ultrasound elbow", "Tendon thickening, hypoechogenicity at ECRB origin", "Alternative to MRI; guides injection"],
  ],
  "βš‘ Tennis elbow = lateral epicondyle. Golfer's elbow = medial epicondyle. MRI shows ECRB tendon changes in resistant cases."
);

// ═══════════════════════════════════════════════════════════════
// β–Ά  SECTION 6: CARPAL TUNNEL SYNDROME
// ═══════════════════════════════════════════════════════════════
sectionSlide("06  CARPAL TUNNEL SYNDROME\n(Median Nerve Entrapment)", C.green);

// CTS - Clinical Features
{
  const sl = contentSlide(
    "Carpal Tunnel Syndrome – Definition & Clinical Features",
    [
      "##Definition",
      "Compression of median nerve within the carpal tunnel at the wrist",
      "Most common entrapment neuropathy",
      "##Who Gets It?",
      "Women > men; 3% of adult population",
      "Pregnancy (resolves after delivery)",
      "Repetitive wrist activities (typing, assembly line)",
      "Associated diseases: Diabetes, hypothyroidism, RA, acromegaly, amyloidosis",
      "##Symptoms (Median nerve territory = radial 3Β½ fingers)",
      "Pain, numbness, tingling in thumb, index, middle, Β½ ring finger",
      "WORSE AT NIGHT – wakes patient from sleep",
      "Relieved by shaking / elevating the hand ('flick sign')",
      "Weak grip in advanced cases",
      "May radiate up forearm to shoulder (brachialgia)",
      "##KEY: No sensory loss over THENAR EMINENCE",
      "(Palmar cutaneous branch leaves ABOVE the tunnel)",
    ],
    getImg(IMG_CARPAL_TUNNEL_ANATOMY),
    "Cross-section of carpal tunnel β€” median nerve + 9 flexor tendons (Family Medicine 9e)"
  );
}

// CTS Examination
{
  const sl = contentSlide(
    "Carpal Tunnel Syndrome – Physical Examination",
    [
      "##Inspection",
      "Thenar atrophy (wasting of fleshy mound at thumb base) – late/severe CTS",
      "##Provocative Tests",
      "Phalen's test: wrists in max flexion 60 sec β†’ numbness/tingling in median distribution; Sensitivity ~74%",
      "Tinel's sign: tap over carpal tunnel β†’ tingling in radial 3Β½ fingers",
      "Carpal compression test: direct pressure over tunnel β†’ symptoms; MOST SENSITIVE",
      "##Motor Tests",
      "Abductor pollicis brevis: abduct thumb against resistance β†’ weakness",
      "Opponens pollicis: touch thumb to little finger tip, resist β†’ weakness",
      "##Sensory Tests",
      "Pin-prick in thumb, index, middle fingers vs. ring/little fingers",
      "Decreased in median distribution; thenar eminence SPARED",
    ],
    getImg(IMG_THENAR_ATROPHY),
    "Thenar muscle atrophy in chronic CTS (Rheumatology, Elsevier)"
  );
}

// CTS Investigations Table
tableSlide(
  "Carpal Tunnel Syndrome – Investigations",
  ["Investigation", "Finding", "Purpose"],
  [
    ["Nerve conduction study (NCS)", "Prolonged distal motor + sensory latency in median nerve", "GOLD STANDARD – confirms diagnosis; mandatory before surgery"],
    ["EMG (electromyography)", "Polyphasic reinnervation potentials in thenar muscles", "Confirms denervation; done with NCS"],
    ["Ultrasound wrist", "Median nerve cross-sectional area > 10 mmΒ²", "Non-invasive confirmation; guides injection"],
    ["X-ray wrist", "Bony abnormalities (OA, fracture)", "If trauma or bony cause suspected"],
    ["Fasting blood glucose / HbA1c", "Elevated in diabetes", "Screen for secondary causes"],
    ["TFTs (thyroid)", "Hypothyroidism", "Screen for secondary causes"],
    ["Serum calcium, uric acid", "Abnormal in specific secondary causes", "Targeted screening"],
  ],
  "βš‘ NCS has up to 25% false-negative rate. Clinical diagnosis + NCS together are most accurate. NCS must be done before surgery."
);

// ═══════════════════════════════════════════════════════════════
// β–Ά  SECTION 7: MUSCULAR DYSTROPHY
// ═══════════════════════════════════════════════════════════════
sectionSlide("07  MUSCULAR DYSTROPHY", "#C0392B");

// Overview Table
tableSlide(
  "Muscular Dystrophy – Types Overview",
  ["Type", "Inheritance", "Gene/Protein", "Onset", "Key Feature"],
  [
    ["Duchenne (DMD)", "X-linked recessive", "Dystrophin ABSENT (Xp21)", "2–5 yrs", "Wheelchair by age 12; calf pseudohypertrophy"],
    ["Becker (BMD)", "X-linked recessive", "Dystrophin REDUCED/abnormal", "Later, milder", "Ambulant beyond 15 yrs"],
    ["Emery-Dreifuss", "X-linked recessive", "Emerin protein", "Childhood", "Contractures + cardiomyopathy"],
    ["Limb-Girdle (LGMD)", "Autosomal recessive", "Various sarcoglycans", "Variable", "Pelvic + shoulder girdle weakness"],
    ["Facioscapulohumeral (FSH)", "Autosomal dominant", "4q35 deletion", "Teens–adult", "Face + shoulder weakness; normal lifespan"],
    ["Myotonic (DM1)", "Autosomal dominant", "CTG repeat – DMPK gene", "Any age", "Myotonia + systemic features"],
  ],
  "βš‘ Duchenne MD is the most common and severe X-linked type. Females are carriers; only males are typically affected."
);

// DMD Clinical Features
{
  const sl = contentSlide(
    "Duchenne MD – Clinical Features (Chronological)",
    [
      "##Neonates / Infancy",
      "Normal at birth; hypotonia may be noted",
      "##Age 2–5 years",
      "Delayed walking, toe walking, frequent falls",
      "Waddling gait (hip abductor weakness)",
      "GOWER'S SIGN – climbs up own legs to stand",
      "##Progression",
      "Proximal muscle weakness (hip, shoulder girdle first)",
      "Pseudohypertrophy of calf muscles (looks big, is weak)",
      "Lumbar lordosis, waddling gait worsens",
      "##By Age 12",
      "WHEELCHAIR BOUND (non-ambulant)",
      "Scoliosis develops after losing ambulation",
      "##Late Features",
      "Respiratory muscle failure (main cause of death)",
      "Dilated cardiomyopathy",
      "Mild intellectual disability (some patients)",
      "Death usually in late teens–20s",
    ],
    getImg(IMG_GOWER_SIGN),
    "Gower's sign – 7-year-old boy with DMD (Bradley & Daroff's Neurology)"
  );
}

// DMD Examination
twoColSlide(
  "Duchenne MD – Physical Examination",
  [
    "##Gait & Posture",
    "Waddling gait (Trendelenburg gait pattern)",
    "Toe walking (early)",
    "Lumbar hyperlordosis (compensation)",
    "Waddling / Trendelenburg on hip abduction test",
    "##Gower's Sign",
    "Ask child to stand from floor",
    "Uses hands to 'walk up' own thighs",
    "Indicates proximal hip/pelvic muscle weakness",
    "##Muscles",
    "Pseudohypertrophy of calves (pathognomonic)",
    "Shoulder girdle and pelvic girdle weakness",
    "Face and eyes spared (unlike FSH)",
    "Scapular winging",
  ],
  [
    "##Reflexes",
    "Reduced/absent deep tendon reflexes (late)",
    "##Contractures",
    "Heel cord contracture (equinus deformity)",
    "Hip flexor contracture",
    "ITB contracture",
    "##Spine",
    "Progressive scoliosis (especially after loss of ambulation)",
    "##Cardiac",
    "Signs of dilated cardiomyopathy",
    "Tachycardia, S3, features of heart failure",
    "##Respiratory",
    "Reduced chest expansion",
    "Weak cough",
    "Signs of chronic respiratory insufficiency",
  ],
  "Gait, Posture & Muscle Signs", "Reflexes, Contractures & Systemic"
);

// DMD Investigations
tableSlide(
  "Duchenne MD – Investigations",
  ["Test", "Finding", "Importance"],
  [
    ["Serum Creatine Kinase (CK)", "10–100Γ— elevated even before symptoms", "FIRST and MOST SENSITIVE test"],
    ["Genetic testing (DNA)", "Deletion/duplication at Xp21 (dystrophin gene)", "CONFIRMS diagnosis; preferred over biopsy now"],
    ["Muscle biopsy", "Absent dystrophin on immunostaining; fibre necrosis, fatty replacement", "Gold standard when genetic test inconclusive"],
    ["EMG", "Myopathic pattern: small, short, polyphasic potentials", "Confirms muscle (not nerve) disease"],
    ["ECG", "Tall R waves in V1, deep Q waves in lateral leads", "Cardiomyopathy screening"],
    ["Echocardiography", "Dilated cardiomyopathy", "Annual cardiac surveillance"],
    ["Pulmonary function tests (PFTs)", "Restrictive pattern; reduced FVC", "Monitor respiratory muscle strength"],
    ["LFTs (AST, ALT, ALP)", "Elevated (from muscle, not liver)", "Distinguish from liver disease"],
  ],
  "βš‘ Serum CK is elevated 10–100Γ— normal even before symptoms. Genetic testing is now first-line over muscle biopsy."
);

// ═══════════════════════════════════════════════════════════════
// MEGA COMPARISON TABLE
// ═══════════════════════════════════════════════════════════════
tableSlide(
  "Quick Comparison – All Conditions at a Glance",
  ["Condition", "Key Symptom", "Key Sign", "Key Investigation"],
  [
    ["Osteoarthritis", "Pain worse at end of day; <30 min morning stiffness", "Heberden/Bouchard nodes, crepitus", "X-ray: JOSS (4 features)"],
    ["Osteoporosis", "Silent β†’ fracture from minor trauma", "Height loss, Dowager's kyphosis", "DEXA scan: T-score ≀ βˆ’2.5"],
    ["Frozen Shoulder", "Global pain + ROM restriction; external rotation worst", "Active = Passive ROM reduced equally", "X-ray to exclude OA; Arthrography confirms"],
    ["Plantar Fasciitis", "Heel pain worst on first morning steps", "Tenderness at medial calcaneal tubercle", "X-ray: calcaneal spur; U/S: fascia >4mm"],
    ["Tennis Elbow", "Lateral elbow pain on gripping/wrist extension", "Cozen's test positive", "Clinical; MRI shows ECRB tendon changes"],
    ["Carpal Tunnel", "Numbness/tingling radial 3Β½ fingers, worse at night, relieved by shaking", "Phalen +ve, Tinel +ve, thenar wasting", "Nerve conduction study (NCS) – gold standard"],
    ["Muscular Dystrophy", "Progressive proximal weakness, falls, toe walking (child)", "Gower's sign, calf pseudohypertrophy", "Serum CK ↑↑↑ + genetic testing (Xp21)"],
  ],
  null
);

// ═══════════════════════════════════════════════════════════════
// OA vs RA DIFFERENTIATING SLIDE
// ═══════════════════════════════════════════════════════════════
tableSlide(
  "OA vs RA – Key Differences (Exam Favourite)",
  ["Feature", "Osteoarthritis", "Rheumatoid Arthritis"],
  [
    ["Morning stiffness", "< 30 minutes", "> 1 hour"],
    ["Pain pattern", "Worse at end of day / with activity", "Worse in morning, improves with use"],
    ["Systemic features", "ABSENT", "Present (fever, weight loss, fatigue)"],
    ["Joints affected", "DIP (Heberden), weight-bearing joints", "MCP, PIP (spares DIP), symmetrical"],
    ["Swelling type", "Bony (osteophytes)", "Soft tissue (synovitis)"],
    ["Blood tests", "Normal (ESR, CRP, RF)", "Elevated ESR/CRP, RF positive"],
    ["X-ray", "JOSS – JSN, osteophytes, sclerosis, cysts", "Periarticular osteopenia, erosions, JSN"],
    ["Treatment", "NSAIDs, physio, joint replacement", "DMARDs (methotrexate), biologics"],
  ],
  null
);

// ═══════════════════════════════════════════════════════════════
// FLOWCHART – APPROACH TO JOINT PAIN
// ═══════════════════════════════════════════════════════════════
flowSlide(
  "Approach to a Patient with Joint Pain – Diagnostic Flow",
  [
    { label:"History", desc:"Duration, onset, pattern, morning stiffness, systemic symptoms" },
    { label:"Examination", desc:"Single vs. multiple joints; active vs. passive ROM; inflammatory signs" },
    { label:"Investigations", desc:"X-ray, ESR/CRP, RF, FBC, synovial fluid" },
    { label:"Diagnose", desc:"OA vs. RA vs. crystal vs. septic vs. spondyloarthropathy" },
    { label:"Manage", desc:"Analgesia, physio, DMARDs, surgery (joint replacement)" },
  ],
  C.mid
);

// ═══════════════════════════════════════════════════════════════
// MNEMONICS / KEY EXAM POINTS SLIDE
// ═══════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:10, h:5.625, fill:{ color: C.dark } });
  sl.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:10, h:0.65, fill:{ color: C.yellow } });
  sl.addText("βš‘  EXAM MNEMONICS & KEY POINTS", {
    x:0.2, y:0, w:9.6, h:0.65, fontSize:18, bold:true, color:C.dark, fontFace:"Calibri", valign:"middle", margin:0
  });

  const points = [
    ["JOSS", "OA X-ray: Joint space narrowing, Osteophytes, Subchondral Sclerosis, Subchondral cysts"],
    ["OA < 30 min", "Morning stiffness in OA < 30 min | RA > 1 hour"],
    ["H before B, D before P", "Heberden nodes = DIP | Bouchard nodes = PIP"],
    ["Gower's sign = DMD", "Child uses hands to climb up own thighs (proximal weakness)"],
    ["CK first", "In DMD, Serum CK is elevated 10-100Γ— BEFORE symptoms appear"],
    ["Radial 3Β½ fingers", "Carpal Tunnel = median nerve = thumb, index, middle, Β½ ring finger"],
    ["Thenar eminence spared", "Palmar cutaneous branch leaves proximal to tunnel β†’ no sensory loss at thenar"],
    ["Flick sign", "CTS symptoms relieved by shaking/elevating hand at night"],
    ["Tennis = lateral, Golf = medial", "Tennis elbow = lateral epicondyle | Golfer's elbow = medial"],
    ["Morning heel pain", "Plantar fasciitis: worst on FIRST steps of morning"],
    ["T ≀ βˆ’2.5", "WHO: T-score ≀ βˆ’2.5 = Osteoporosis on DEXA"],
    ["Active = Passive", "Frozen shoulder: BOTH active and passive ROM equally restricted"],
  ];

  const cols = 2;
  const rows = Math.ceil(points.length / cols);
  points.forEach(([mnem, desc], i) => {
    const col = i < rows ? 0 : 1;
    const row = col === 0 ? i : i - rows;
    const x = col === 0 ? 0.2 : 5.1;
    const y = 0.78 + row * 0.62;
    sl.addShape(pres.shapes.ROUNDED_RECTANGLE, { x, y, w:4.65, h:0.55, fill:{ color: C.mid }, rectRadius:0.07 });
    sl.addText(mnem, { x:x+0.12, y, w:1.6, h:0.55, fontSize:10.5, bold:true, color:C.yellow, fontFace:"Calibri", valign:"middle", margin:4 });
    sl.addShape(pres.shapes.RECTANGLE, { x:x+1.72, y:y+0.08, w:0.03, h:0.39, fill:{ color: C.accent } });
    sl.addText(desc, { x:x+1.82, y, w:2.72, h:0.55, fontSize:9.5, color:C.white, fontFace:"Calibri", valign:"middle", margin:4, wrap:true });
  });
}

// ═══════════════════════════════════════════════════════════════
// END SLIDE
// ═══════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  sl.addShape(pres.shapes.RECTANGLE, { x:0, y:0, w:10, h:5.625, fill:{ color: C.dark } });
  sl.addShape(pres.shapes.RECTANGLE, { x:0, y:2.5, w:10, h:0.08, fill:{ color: C.accent } });
  sl.addText("Thank You", { x:0.5, y:0.8, w:9, h:1.4, fontSize:42, bold:true, color:C.white, fontFace:"Calibri", align:"center" });
  sl.addText("Sources: Goldman-Cecil Medicine Β· Family Medicine 9e Β· Campbell's Operative Orthopaedics 15e\nMiller's Orthopaedics 9e Β· Bailey & Love's Surgery 28e Β· Bradley & Daroff's Neurology Β· Grainger & Allison's Diagnostic Radiology",
    { x:0.5, y:2.7, w:9, h:1.4, fontSize:13, color:"AACFE0", fontFace:"Calibri", align:"center", wrap:true }
  );
}

// ─────────────────────────────────────────────────────────────────
// WRITE FILE
// ─────────────────────────────────────────────────────────────────
const outPath = "/home/daytona/workspace/bone-joints-ppt/Bone_and_Joint_Diseases.pptx";
pres.writeFile({ fileName: outPath }).then(() => {
  console.log("βœ… Presentation saved:", outPath);
}).catch(err => {
  console.error("❌ Error saving:", err);
  process.exit(1);
});
Running Command

cd /home/daytona/workspace/bone-joints-ppt && node create_presentation.js 2>&1

Running Command

ls -lh /home/daytona/workspace/bone-joints-ppt/

Your presentation is ready!

Bone and Joint Diseases

Presentation Β· PPTX


What's Inside (8.6 MB, ~22 slides)

The presentation uses a professional navy-blue and teal medical theme throughout. Here's a breakdown of every slide:
#SlideType
1Title slideDark navy with accent bar
2Index / Topics OverviewColour-coded blocks per condition
3Osteoarthritis – Definition & EpidemiologyBullet content + OA incidence graph image
4OA – Clinical Features (Symptoms)Bullets + key-points yellow box
5OA – Physical ExaminationTwo-column (general vs. joint-specific)
6OA – X-ray / KL GradingContent + clinical X-ray images of knee grades 0–4
7OA – Investigations SummaryTable
8Osteoporosis – Definition, Types & Risk FactorsBullets
9Osteoporosis – Clinical Features & ExaminationTwo-column
10Osteoporosis – Radiological FeaturesContent + CT spine images (vertebral fractures)
11Osteoporosis – InvestigationsTable
12Frozen Shoulder – Features & 3 StagesTwo-column (symptoms vs. stages)
13Frozen Shoulder – Physical ExaminationBullets
14Frozen Shoulder – InvestigationsTable
15Plantar Fasciitis / Calcaneal SpurTwo-column
16Plantar Fasciitis – InvestigationsTable
17Tennis Elbow – Features & Cozen's TestTwo-column
18Tennis Elbow – InvestigationsTable
19Carpal Tunnel Syndrome – FeaturesContent + cross-section anatomy image
20CTS – Physical ExaminationContent + thenar atrophy clinical image
21CTS – InvestigationsTable
22Muscular Dystrophy – Types OverviewTable (all 6 types)
23Duchenne MD – Clinical Features (chronological)Content + Gower's sign clinical photo
24DMD – Physical ExaminationTwo-column
25DMD – InvestigationsTable
26All Conditions – Mega Comparison TableTable
27OA vs. RA DifferencesTable
28Approach to Joint Pain – Diagnostic Flowchart5-step chevron flowchart
29Mnemonics & Key Exam PointsDark slide with colour-coded memory cards
30Thank You / SourcesEnd slide
This is a shared conversation. Sign in to Orris to start your own chat.