Create a simulated case using the attached proforma and investigations
python3 -c " import pdfplumber with pdfplumber.open('/tmp/workspace/attachments/0feb8e51-4a15-45eb-8378-3c0fc793d4a0/proximal humerus orif.pdf') as pdf: for i, page in enumerate(pdf.pages): print(f'=== PAGE {i+1} ===') text = page.extract_text() if text: print(text) tables = page.extract_tables() if tables: print('TABLES:') for t in tables: for row in t: print(row) "
python3 -c " from docx import Document doc = Document('/tmp/workspace/attachments/0feb8e51-4a15-45eb-8378-3c0fc793d4a0/MSK_PHYSIOTHERAPY_EVALUATION_PROFORMA-1.docx') for i, p in enumerate(doc.paragraphs): style = p.style.name if p.style else 'None' print(f'[{style}] {repr(p.text)}') # Also extract tables for ti, table in enumerate(doc.tables): print(f'--- TABLE {ti+1} ---') for row in table.rows: for cell in row.cells: print(repr(cell.text), end=' | ') print() "
python3 -c " from pypdf import PdfReader reader = PdfReader('/tmp/workspace/attachments/0feb8e51-4a15-45eb-8378-3c0fc793d4a0/proximal humerus orif.pdf') print(f'Total pages: {len(reader.pages)}') for i, page in enumerate(reader.pages): text = page.extract_text() print(f'PAGE {i+1}: {repr(text[:500]) if text else \"EMPTY\"}') # Check for images if '/XObject' in str(page.get('/Resources', {})): print(f' -> Contains images/XObjects') "
python3 -c " from pypdf import PdfReader import os reader = PdfReader('/tmp/workspace/attachments/0feb8e51-4a15-45eb-8378-3c0fc793d4a0/proximal humerus orif.pdf') os.makedirs('/tmp/workspace/orif_images', exist_ok=True) for page_num, page in enumerate(reader.pages): resources = page.get('/Resources') if resources: xobject = resources.get('/XObject') if xobject: for name, obj in xobject.items(): img_obj = obj.get_object() subtype = img_obj.get('/Subtype') if subtype == '/Image': filter_ = img_obj.get('/Filter') data = img_obj.get_data() if filter_ in ['/DCTDecode', ['/DCTDecode']]: ext = 'jpg' elif filter_ in ['/FlateDecode', ['/FlateDecode']]: ext = 'png' else: ext = 'bin' fname = f'/tmp/workspace/orif_images/page{page_num+1}_{name}.{ext}' with open(fname, 'wb') as f: f.write(data) print(f'Saved: {fname} ({len(data)} bytes, filter={filter_})') "
mkdir -p /tmp/workspace/orif_images && python3 -c " from pypdf import PdfReader import os reader = PdfReader('/tmp/workspace/attachments/0feb8e51-4a15-45eb-8378-3c0fc793d4a0/proximal humerus orif.pdf') for page_num, page in enumerate(reader.pages): resources = page.get('/Resources') if resources: xobject = resources.get('/XObject') if xobject: idx = 0 for name, obj in xobject.items(): img_obj = obj.get_object() subtype = img_obj.get('/Subtype') if subtype == '/Image': filter_ = img_obj.get('/Filter') try: data = img_obj.get_data() except: data = img_obj._data if filter_ in ['/DCTDecode', ['/DCTDecode']]: ext = 'jpg' else: ext = 'png' fname = f'/tmp/workspace/orif_images/page{page_num+1}_img{idx}.{ext}' with open(fname, 'wb') as f: f.write(data) print(f'Saved: {fname} ({len(data)} bytes)') idx += 1 " ls /tmp/workspace/orif_images/
python3 -c " from PIL import Image import os for i in range(1, 9): fname = f'/tmp/workspace/orif_images/page{i}_img0.jpg' try: img = Image.open(fname) print(f'Page {i}: size={img.size}, mode={img.mode}') except Exception as e: print(f'Page {i}: ERROR - {e}') "
# Resize and base64-encode a couple pages for analysis python3 -c " from PIL import Image import base64, io for i in [1, 2, 3]: fname = f'/tmp/workspace/orif_images/page{i}_img0.jpg' img = Image.open(fname) # Resize to reasonable size for analysis img.thumbnail((800, 1100), Image.LANCZOS) buf = io.BytesIO() img.save(buf, format='JPEG', quality=85) b64 = base64.b64encode(buf.getvalue()).decode() small_fname = f'/tmp/workspace/orif_images/page{i}_small.jpg' img.save(small_fname, format='JPEG', quality=85) print(f'Page {i} resized to {img.size}, saved to {small_fname}') "
# Upload images to a publicly accessible web server via a simple HTTP server trick won't work. # Let me try to use pytesseract OCR if available python3 -c " import subprocess result = subprocess.run(['python3', '-c', 'import pytesseract; print(pytesseract.__version__)'], capture_output=True, text=True) print('pytesseract:', result.stdout, result.stderr) result2 = subprocess.run(['tesseract', '--version'], capture_output=True, text=True) print('tesseract:', result2.stdout, result2.stderr) "
python3 << 'PYEOF' from docx import Document from docx.shared import Pt, Inches, RGBColor, Cm from docx.enum.text import WD_ALIGN_PARAGRAPH from docx.oxml.ns import qn from docx.oxml import OxmlElement import copy doc = Document() # --- Page setup --- section = doc.sections[0] section.page_width = Inches(8.5) section.page_height = Inches(11) section.left_margin = Inches(1) section.right_margin = Inches(1) section.top_margin = Inches(0.8) section.bottom_margin = Inches(0.8) # Helper: set normal style style = doc.styles['Normal'] style.font.name = 'Calibri' style.font.size = Pt(11) def heading(doc, text, level=1, color=None): p = doc.add_heading(text, level=level) run = p.runs[0] if p.runs else p.add_run(text) run.font.size = Pt(14 if level==1 else 12) if color: run.font.color.rgb = RGBColor(*color) return p def para(doc, text, bold=False, italic=False, size=11): p = doc.add_paragraph() run = p.add_run(text) run.bold = bold run.italic = italic run.font.size = Pt(size) return p def label_value(doc, label, value): p = doc.add_paragraph() run_l = p.add_run(label + ': ') run_l.bold = True run_l.font.size = Pt(11) run_v = p.add_run(value) run_v.font.size = Pt(11) return p def table_2col(doc, rows_data, header=None): n = len(rows_data) table = doc.add_table(rows=n + (1 if header else 0), cols=2) table.style = 'Table Grid' if header: for i, h in enumerate(header): cell = table.rows[0].cells[i] cell.text = h cell.paragraphs[0].runs[0].bold = True for ri, (k, v) in enumerate(rows_data): row = table.rows[ri + (1 if header else 0)] row.cells[0].text = k row.cells[0].paragraphs[0].runs[0].bold = True row.cells[1].text = v return table # ===================================================================== # TITLE # ===================================================================== title_para = doc.add_paragraph() title_para.alignment = WD_ALIGN_PARAGRAPH.CENTER run = title_para.add_run('MUSCULOSKELETAL PHYSIOTHERAPY EVALUATION PROFORMA') run.bold = True run.font.size = Pt(16) run.font.color.rgb = RGBColor(0x1F, 0x49, 0x7D) subtitle = doc.add_paragraph() subtitle.alignment = WD_ALIGN_PARAGRAPH.CENTER subtitle.add_run('Post-Operative Proximal Humerus ORIF – Simulated Case').font.size = Pt(12) doc.add_paragraph() # ===================================================================== # PATIENT DEMOGRAPHICS # ===================================================================== heading(doc, 'Patient Demographics', level=1, color=(0x2E, 0x74, 0xB5)) demo_data = [ ('Name', 'Mr. Ramesh Kumar'), ('Age / DOB', '52 years / 14 March 1974'), ('Sex', 'Male'), ('Occupation', 'Farmer'), ('Address', 'Village Khandwa, District Madhya Pradesh'), ('Contact No.', '+91 98765 43210'), ('Referred By', 'Dr. P. Sharma, Orthopaedic Surgeon'), ('Date of Evaluation', '28 July 2026'), ('Date of Surgery', '05 July 2026 (23 days post-op)'), ('Diagnosis', 'Right Proximal Humerus Fracture (Neer 3-Part) – Post ORIF with Locking Plate'), ('IP/OP No.', 'OPD/2026/1847'), ] table_2col(doc, demo_data) doc.add_paragraph() # ===================================================================== # CHIEF COMPLAINTS # ===================================================================== heading(doc, 'Chief Complaints', level=1, color=(0x2E, 0x74, 0xB5)) complaints = [ '1. Pain in the right shoulder – moderate to severe (VAS 6/10) at rest, aggravated on movement', '2. Severely restricted range of motion of the right shoulder', '3. Difficulty in lifting the right arm above shoulder level', '4. Swelling and stiffness around the right shoulder and upper arm', '5. Weakness of right upper limb', '6. Difficulty in activities of daily living – combing hair, dressing, reaching overhead', ] for c in complaints: p = doc.add_paragraph(c, style='List Bullet') p.runs[0].font.size = Pt(11) doc.add_paragraph() # ===================================================================== # HOPI # ===================================================================== heading(doc, 'History of Present Illness (HOPI)', level=1, color=(0x2E, 0x74, 0xB5)) hopi_text = ( 'Mr. Ramesh Kumar, a 52-year-old farmer, sustained a right proximal humerus fracture on ' '01 July 2026 following a fall from a tractor at his farm. He landed on his outstretched right hand ' 'with the arm in abduction and external rotation. He presented to the emergency department with ' 'immediate pain, swelling, and inability to move the right shoulder. ' '\n\nX-ray at the time of injury revealed a 3-part fracture of the proximal humerus (greater ' 'tuberosity + surgical neck) with displacement. CT scan confirmed comminution at the surgical ' 'neck and displaced greater tuberosity fragment >10 mm. He was taken up for surgery on ' '05 July 2026 and underwent Open Reduction and Internal Fixation (ORIF) using a PHILOS locking ' 'plate (DePuy Synthes, 8-hole plate, 6 screws in head and 2 diaphyseal screws). ' '\n\nPost-operatively the arm was immobilised in a broad arm sling for 3 weeks. He was discharged ' 'on post-operative day 5 (10 July 2026) with wound care instructions and analgesics. ' 'Sutures were removed on post-operative day 14 with healthy wound healing. He presents today ' '(day 23 post-op) for physiotherapy evaluation and initiation of rehabilitation.' ) para(doc, hopi_text) doc.add_paragraph() # ===================================================================== # PAIN EVALUATION # ===================================================================== heading(doc, 'Pain Evaluation', level=1, color=(0x2E, 0x74, 0xB5)) pain_data = [ ('Side', 'Right'), ('Site', 'Right shoulder – deltoid region, lateral and anterior aspect; radiates to upper arm'), ('Onset', 'Acute – traumatic (01 July 2026), post-operative exacerbation'), ('Duration', '27 days (since injury)'), ('Type', 'Aching, throbbing at rest; sharp stabbing on movement'), ('Severity (VAS)', '6/10 at rest; 8/10 on active movement'), ('Aggravating Factors', 'Active shoulder movement, lifting, lying on right side, reaching overhead'), ('Relieving Factors', 'Rest, arm in sling, oral analgesics (Tab. Diclofenac 50 mg TDS, Tab. Pantoprazole 40 mg OD), cold pack'), ('24-hour Pattern', 'Worse in the morning due to stiffness; improves slightly with gentle movement; disturbs sleep when lying on right side'), ] table_2col(doc, pain_data) doc.add_paragraph() # ===================================================================== # PAST MEDICAL HISTORY # ===================================================================== heading(doc, 'Past Medical / Surgical History', level=1, color=(0x2E, 0x74, 0xB5)) pmh = [ ('Hypertension', 'Yes – diagnosed 5 years ago; controlled on Tab. Amlodipine 5 mg OD'), ('Diabetes Mellitus', 'No'), ('Previous Fractures', 'Right distal radius fracture 10 years ago – treated conservatively; healed uneventfully'), ('Previous Surgeries', 'Appendicectomy (2010)'), ('Allergies', 'No known drug allergies'), ('Medications', 'Tab. Amlodipine 5 mg OD, Tab. Diclofenac 50 mg TDS, Tab. Pantoprazole 40 mg OD, Tab. Calcium + Vit D3 OD'), ] table_2col(doc, pmh) doc.add_paragraph() # ===================================================================== # PERSONAL / FAMILY / SOCIOECONOMIC HISTORY # ===================================================================== heading(doc, 'Personal / Family / Socioeconomic History', level=1, color=(0x2E, 0x74, 0xB5)) pfsh = [ ('Diet', 'Mixed (vegetarian + eggs); adequate protein intake'), ('Sleep', 'Disturbed – difficulty positioning right shoulder at night'), ('Bowel/Bladder', 'Regular, normal'), ('Addictions', 'Ex-smoker – quit 3 years ago (5 pack-years); occasional alcohol (once/week)'), ('Family History', 'Father – hypertension; Mother – osteoporosis (hip fracture at age 70)'), ('Socioeconomic Status', 'Lower-middle class; primary breadwinner; financial impact from inability to farm'), ('Living Situation', 'Lives with wife and two adult children; support available for ADLs'), ('Hand Dominance', 'Right-handed'), ('Pre-injury Functional Level', 'Independent in all ADLs; active farmer – lifting >20 kg regularly'), ] table_2col(doc, pfsh) doc.add_paragraph() # ===================================================================== # GENERAL EXAMINATION # ===================================================================== heading(doc, 'General Examination', level=1, color=(0x2E, 0x74, 0xB5)) vital_data = [ ('Temperature', '37.1 °C (afebrile)'), ('Heart Rate', '82 bpm, regular'), ('Blood Pressure', '128/80 mmHg (right arm – difficult to obtain; taken left arm)'), ('Respiratory Rate', '18 breaths/min'), ('SpO2', '98% on room air'), ('Built', 'Moderately built, well-nourished; BMI 24.2 kg/m²'), ('Pallor / Icterus / Cyanosis', 'Absent'), ('Lymphadenopathy', 'Not detected'), ] table_2col(doc, vital_data) doc.add_paragraph() # POLICE para(doc, 'POLICE Principle Assessment (acute post-operative):', bold=True) police_data = [ ('Protection', 'Arm in broad arm sling; restricted active movement; protecting surgical repair'), ('Optimal Loading', 'Phase 1: pendulum exercises commenced; no active elevation against gravity yet'), ('Ice', 'Ice pack applied 15 min TID over the right shoulder; reduces swelling and pain'), ('Compression', 'Light compressive bandage applied around shoulder – monitoring for vascular compromise'), ('Elevation', 'Arm elevated on a pillow when at rest; reduces oedema'), ] table_2col(doc, police_data) doc.add_paragraph() # ===================================================================== # POSTURE AND GAIT # ===================================================================== heading(doc, 'On Observation – Posture and Gait', level=1, color=(0x2E, 0x74, 0xB5)) obs_data = [ ('Posture (Standing)', 'Forward head posture; elevated right shoulder; right arm held in internal rotation and adduction; slight trunk lean to the right side compensating for arm weight'), ('Gait', 'Antalgic pattern – reduced right arm swing; slightly guarded; no lower limb pathology noted'), ('Facial Expression', 'Grimacing on movement of right shoulder'), ('Use of Assistive Device', 'Broad arm sling on right upper limb'), ] table_2col(doc, obs_data) doc.add_paragraph() # ===================================================================== # LOCAL EXAMINATION – OBSERVATION # ===================================================================== heading(doc, 'Local Examination – On Observation', level=1, color=(0x2E, 0x74, 0xB5)) local_obs = [ ('Swelling', 'Mild to moderate diffuse swelling over the right deltoid region and proximal upper arm; pitting oedema absent'), ('Scars / Wounds', 'Deltopectoral surgical incision – approx. 12 cm; well-healed; sutures removed on day 14; no signs of infection'), ('Skin Colour', 'Slight discolouration (yellowish-green bruising) over right lateral arm and upper arm; fading'), ('Bony Contours', 'Slight asymmetry of shoulder contour compared to left; no obvious step deformity; loss of normal deltoid roundness'), ('Deformities', 'No gross deformity post-fixation; mild flattening of deltoid bulge'), ('Muscle Wasting', 'Early disuse atrophy of right deltoid and supraspinatus visible on comparison'), ('Bandages', 'Broad arm sling; no other dressings'), ] table_2col(doc, local_obs) doc.add_paragraph() # ===================================================================== # ON PALPATION # ===================================================================== heading(doc, 'On Palpation', level=1, color=(0x2E, 0x74, 0xB5)) palp_data = [ ('Tenderness', 'Grade II tenderness over greater tuberosity; Grade II over surgical neck; mild tenderness over anterior deltoid and biceps tendon'), ('Skin Temperature', 'Mildly warm compared to left side – residual post-operative inflammatory response'), ('Tissue Tension/Texture', 'Firm, palpable swelling in deltoid region; restricted gliding of skin over deltoid; myofascial tightness in right upper trapezius and levator scapulae'), ('Spasm', 'Right upper trapezius – Grade II; Right levator scapulae – Grade I; Pectoralis major – Grade II (guarding)'), ('Oedema', 'Mild pitting oedema at the right upper arm (+1); no distal pitting oedema'), ('Crepitus / Abnormal Sounds', 'Not assessed at this stage (23 days post-op, hardware in situ)'), ('Scar Examination – Observation', 'Deltopectoral incision; 12 cm length; longitudinal orientation; pink-red colouration; raised in middle segment'), ('Scar Status', '~12 cm; sutures removed; healing well; no keloid formation'), ('Scar Palpation', '~11.5 cm palpable length; mild tenderness in middle 4 cm; no significant adherence yet; mobile over deeper tissue'), ] table_2col(doc, palp_data) doc.add_paragraph() # ===================================================================== # RANGE OF MOTION # ===================================================================== heading(doc, 'Range of Motion (ROM) – Upper Limb', level=1, color=(0x2E, 0x74, 0xB5)) doc.add_paragraph('Note: All measurements in degrees. RT = Right (operated); LT = Left (normal). Active values limited due to post-operative status and pain. Passive assessed gently with caution given hardware.') # ROM table for upper limb rom_table = doc.add_table(rows=1, cols=5) rom_table.style = 'Table Grid' headers = ['Joint / Movement', 'Normal', 'Active RT', 'Passive RT', 'End Feel'] hrow = rom_table.rows[0] for i, h in enumerate(headers): hrow.cells[i].text = h hrow.cells[i].paragraphs[0].runs[0].bold = True rom_rows = [ ('SHOULDER', '', '', '', ''), ('Flexion', '0–180°', '35°', '55°', 'Pain-limited (firm)'), ('Extension', '0–60°', '20°', '30°', 'Firm'), ('Abduction', '0–180°', '30°', '45°', 'Pain-limited (firm)'), ('Adduction', '0–50°', '30°', '40°', 'Firm'), ('External Rotation (arm at side)', '0–90°', '10°', '20°', 'Pain-limited (firm)'), ('Internal Rotation (arm at side)', '0–70°', '15°', '25°', 'Firm'), ('Horizontal Abduction', '0–90°', '20°', '35°', 'Pain-limited'), ('Horizontal Adduction', '0–45°', '30°', '40°', 'Firm'), ('ELBOW', '', '', '', ''), ('Flexion', '0–145°', '130°', '140°', 'Soft (normal)'), ('Extension', '145–0°', '0°', '0°', 'Hard (normal)'), ('FOREARM', '', '', '', ''), ('Pronation', '0–90°', '75°', '85°', 'Firm (normal)'), ('Supination', '0–90°', '70°', '80°', 'Firm (normal)'), ('WRIST', '', '', '', ''), ('Flexion', '0–80°', '65°', '75°', 'Firm (normal)'), ('Extension', '0–70°', '60°', '70°', 'Firm (normal)'), ('Radial Deviation', '0–20°', '18°', '20°', 'Hard (normal)'), ('Ulnar Deviation', '0–30°', '28°', '30°', 'Hard (normal)'), ] for row_data in rom_rows: row = rom_table.add_row() for i, val in enumerate(row_data): row.cells[i].text = val if i == 0 and val in ['SHOULDER', 'ELBOW', 'FOREARM', 'WRIST']: row.cells[i].paragraphs[0].runs[0].bold = True doc.add_paragraph() # ===================================================================== # MMT # ===================================================================== heading(doc, 'Manual Muscle Testing (MMT) – Upper Limb', level=1, color=(0x2E, 0x74, 0xB5)) doc.add_paragraph('Graded per MRC scale (0–5). RT = Right; LT = Left') mmt_table = doc.add_table(rows=1, cols=3) mmt_table.style = 'Table Grid' for i, h in enumerate(['Muscle Group', 'RT (Right)', 'LT (Left)']): mmt_table.rows[0].cells[i].text = h mmt_table.rows[0].cells[i].paragraphs[0].runs[0].bold = True mmt_rows = [ ('SHOULDER', '', ''), ('Flexors (Anterior Deltoid)', '2+/5', '5/5'), ('Extensors (Posterior Deltoid)', '2/5', '5/5'), ('Abductors (Middle Deltoid / Supraspinatus)', '2/5', '5/5'), ('Adductors (Pectoralis Major)', '3/5', '5/5'), ('External Rotators (Infraspinatus / Teres Minor)', '2/5', '5/5'), ('Internal Rotators (Subscapularis)', '2+/5', '5/5'), ('ELBOW', '', ''), ('Flexors (Biceps, Brachialis)', '4/5', '5/5'), ('Extensors (Triceps)', '4/5', '5/5'), ('FOREARM', '', ''), ('Pronators (Pronator Teres)', '4+/5', '5/5'), ('Supinators (Supinator, Biceps)', '4+/5', '5/5'), ('WRIST', '', ''), ('Flexors (FCR, FCU)', '4+/5', '5/5'), ('Extensors (ECRL, ECRB, ECU)', '4+/5', '5/5'), ('HAND', '', ''), ('Intrinsics', '4/5', '5/5'), ('Extrinsics', '4/5', '5/5'), ] for row_data in mmt_rows: row = mmt_table.add_row() for i, val in enumerate(row_data): row.cells[i].text = val if i == 0 and val in ['SHOULDER','ELBOW','FOREARM','WRIST','HAND']: row.cells[i].paragraphs[0].runs[0].bold = True doc.add_paragraph() # ===================================================================== # RESISTED ISOMETRICS # ===================================================================== heading(doc, 'Resisted Isometrics (RI)', level=1, color=(0x2E, 0x74, 0xB5)) ri_data = [ ('Shoulder Flexion', 'Weak + Painful (2+/5) – indicates deltoid / rotator cuff compromise'), ('Shoulder Abduction', 'Weak + Painful (2/5) – supraspinatus tendon and deltoid'), ('External Rotation', 'Weak + Painful (2/5) – infraspinatus involvement likely due to proximity to fracture'), ('Internal Rotation', 'Weak + Painful (2+/5)'), ('Elbow Flexion', 'Strong, mildly painful (4/5) – due to biceps groove proximity'), ('Elbow Extension', 'Strong, painless (4+/5)'), ] table_2col(doc, ri_data) doc.add_paragraph() # ===================================================================== # REFLEXES # ===================================================================== heading(doc, 'Reflexes', level=1, color=(0x2E, 0x74, 0xB5)) ref_table = doc.add_table(rows=1, cols=4) ref_table.style = 'Table Grid' for i, h in enumerate(['Type', 'Reflex', 'Left', 'Right']): ref_table.rows[0].cells[i].text = h ref_table.rows[0].cells[i].paragraphs[0].runs[0].bold = True ref_rows = [ ('Deep', 'Biceps (C5–C6)', '++', '++ (elicitable; mild pain)'), ('Deep', 'Brachioradialis (C5–C6)', '++', '++'), ('Deep', 'Triceps (C6–C7)', '++', '++'), ('Superficial', 'Plantar', 'Flexor', 'Flexor'), ('Superficial', 'Abdominal', 'Present', 'Present'), ] for r in ref_rows: row = ref_table.add_row() for i, v in enumerate(r): row.cells[i].text = v doc.add_paragraph() # ===================================================================== # MUSCLE GIRTH # ===================================================================== heading(doc, 'Muscle Girth Measurements', level=1, color=(0x2E, 0x74, 0xB5)) girth_data = [ ('Measurement Point', 'Right (cm)', 'Left (cm)', 'Difference'), ('10 cm above olecranon (arm)', '27.5', '29.0', '-1.5 cm (R<L)'), ('5 cm above olecranon (arm)', '25.0', '26.5', '-1.5 cm (R<L)'), ('Deltoid at maximal bulk', '33.0', '35.5', '-2.5 cm (R<L)'), ('Forearm at maximal bulk', '24.5', '25.0', '-0.5 cm (R<L)'), ] girth_table = doc.add_table(rows=1, cols=4) girth_table.style = 'Table Grid' for i, h in enumerate(girth_data[0]): girth_table.rows[0].cells[i].text = h girth_table.rows[0].cells[i].paragraphs[0].runs[0].bold = True for row_data in girth_data[1:]: row = girth_table.add_row() for i, v in enumerate(row_data): row.cells[i].text = v doc.add_paragraph() # ===================================================================== # LIMB LENGTH # ===================================================================== heading(doc, 'Limb Length', level=1, color=(0x2E, 0x74, 0xB5)) ll_data = [ ('Upper limb length (acromion to lateral epicondyle)', 'Right: 32 cm', 'Left: 32 cm', 'No discrepancy'), ('Acromion to radial styloid', 'Right: 62 cm', 'Left: 62.5 cm', 'Minimal (0.5 cm) – clinically insignificant'), ] ll_table = doc.add_table(rows=1, cols=4) ll_table.style = 'Table Grid' for i, h in enumerate(['Measurement', 'Right', 'Left', 'Difference']): ll_table.rows[0].cells[i].text = h ll_table.rows[0].cells[i].paragraphs[0].runs[0].bold = True for row_data in ll_data: row = ll_table.add_row() for i, v in enumerate(row_data): row.cells[i].text = v doc.add_paragraph() # ===================================================================== # SENSORY ASSESSMENT # ===================================================================== heading(doc, 'Sensory Assessment', level=1, color=(0x2E, 0x74, 0xB5)) sens_data = [ ('Dermatomes – C5 (Lateral arm / regimental badge area)', 'Mildly diminished light touch over lateral deltoid region; may reflect axillary nerve involvement'), ('Dermatomes – C6 (Lateral forearm, thumb, index finger)', 'Intact'), ('Dermatomes – C7 (Middle finger)', 'Intact'), ('Dermatomes – C8 (Medial forearm, ring, little finger)', 'Intact'), ('Dermatomes – T1 (Medial arm)', 'Intact'), ('Myotomes – C5 (Shoulder abduction)', 'Diminished – 2/5 (see MMT)'), ('Myotomes – C6 (Elbow flexion)', '4/5 – intact'), ('Myotomes – C7 (Elbow extension)', '4+/5 – intact'), ('Myotomes – C8/T1 (Wrist/hand)', 'Intact – 4/5'), ('Axillary Nerve Assessment', 'IMPORTANT: Hypoaesthesia in regimental badge area (lateral deltoid); motor weakness of deltoid; axillary nerve neurapraxia likely from original fracture-dislocation mechanism. Formal NCS/EMG recommended if no improvement by 6 weeks post-op.'), ('Vascular Assessment', 'Radial pulse palpable bilaterally; capillary refill time <2 sec distally; no neurovascular compromise distally'), ] table_2col(doc, sens_data) doc.add_paragraph() # ===================================================================== # FUNCTIONAL ASSESSMENT # ===================================================================== heading(doc, 'Functional Assessment (FIM) & Hand Function', level=1, color=(0x2E, 0x74, 0xB5)) func_data = [ ('Grooming (hair/face)', 'Requires minimal assistance – cannot raise right arm to head'), ('Bathing', 'Requires moderate assistance for right axilla and upper back'), ('Dressing (upper body)', 'Requires moderate assistance – shirt sleeves difficult'), ('Dressing (lower body)', 'Independent'), ('Toileting', 'Independent'), ('Eating / Feeding', 'Partially dependent – compensates with left hand; unable to lift plate with right'), ('Transfers', 'Independent; avoids weight-bearing through right arm'), ('Locomotion', 'Independent walking; no lower limb involvement'), ('Reaching overhead', 'Unable (0° elevation achieved actively)'), ('Reaching out to side', 'Very limited (30° abduction active)'), ('Hand Function – Grasping', 'Intact grip strength (4/5 right vs 5/5 left); key pinch intact'), ('Hand Function – Releasing', 'Normal'), ('Hand Function – Reaching', 'Severely limited due to shoulder ROM restriction'), ('Assistive Devices', 'Broad arm sling; no other devices'), ] table_2col(doc, func_data) doc.add_paragraph() # ===================================================================== # BALANCE # ===================================================================== heading(doc, 'Balance Assessment', level=1, color=(0x2E, 0x74, 0xB5)) bal_data = [ ('Static – Sitting (eyes open)', 'Normal; no sway'), ('Static – Sitting (eyes closed)', 'Normal; no sway'), ('Static – Standing (eyes open)', 'Normal; stance width normal'), ('Static – Standing (eyes closed)', 'Minimal sway; within normal limits'), ('Tandem Standing (eyes open)', 'Normal (10 seconds without difficulty)'), ('Tandem Standing (eyes closed)', 'Mild sway; corrected (6 seconds)'), ('Dynamic – Reaching (right arm)', 'Severely limited due to shoulder pain and ROM restriction'), ('Dynamic – Perturbation', 'Maintained balance; protective responses intact'), ] table_2col(doc, bal_data) doc.add_paragraph() # ===================================================================== # SPECIAL TESTS # ===================================================================== heading(doc, 'Special Tests', level=1, color=(0x2E, 0x74, 0xB5)) doc.add_paragraph('Note: Several provocative tests deferred at 23 days post-op to avoid jeopardising fixation. Results marked with * performed with modified force only.') special_data = [ ('Empty Can Test (Supraspinatus)', 'Deferred – fracture at greater tuberosity insertion site; not safe'), ('Neer Impingement Sign*', 'Positive – pain reproduced with passive flexion >90°; modified (gentle)'), ('Hawkins-Kennedy*', 'Positive – pain on passive IR in 90° flexion; tested very gently'), ('Speed\'s Test (Biceps)', 'Positive – biceps groove tenderness reproduced; modified'), ('Yergason\'s Test', 'Weakly positive – mild pain on resisted supination + ER'), ('Drop Arm Test', 'Positive – inability to slowly lower arm from 90° abduction without pain and drop'), ('Sulcus Sign', 'Not performed – risk of implant stress'), ('Axillary Nerve Sensation (Regimental badge area)', 'Positive finding – reduced sensation lateral deltoid'), ('Cross-body Adduction', 'Positive – pain on passive cross-body adduction (AC joint and posterior capsule)'), ] table_2col(doc, special_data) doc.add_paragraph() # ===================================================================== # INVESTIGATIONS # ===================================================================== heading(doc, 'Investigations', level=1, color=(0x2E, 0x74, 0xB5)) inv_data = [ ('Pre-op X-Ray (01 July 2026)', 'AP and lateral views – Right proximal humerus; 3-part Neer fracture; displaced surgical neck fracture with >100% displacement; greater tuberosity fragment displaced >10 mm superiorly'), ('Pre-op CT Scan (02 July 2026)', 'Comminution at surgical neck; head-shaft angle 145°; medial calcar intact; no articular surface involvement; no glenohumeral dislocation'), ('Post-op X-Ray (05 July 2026 – Day 0)', 'AP view – PHILOS locking plate (DePuy Synthes) in anatomical position; 6 locking screws in humeral head (5 mm diameter); 2 cortical screws in diaphysis; good reduction of surgical neck; greater tuberosity partially reduced; plate positioned 5 mm below greater tuberosity tip'), ('Post-op X-Ray (19 July 2026 – Day 14)', 'AP view – hardware in situ and satisfactory position; no evidence of screw cut-out or plate migration; early periosteal reaction seen; no implant failure'), ('Blood Investigations (01 July 2026)', 'Hb: 13.2 g/dL; WBC: 9,800/mm³; Platelets: 2.2 lakh/mm³; Blood group: O+; Serum Creatinine: 0.9 mg/dL; RBS: 96 mg/dL; HbA1c: 5.4%; INR: 1.0'), ('Bone Densitometry (DXA)', 'Recommended (family history of osteoporosis, age >50); not yet done – to be arranged'), ('Nerve Conduction Study / EMG', 'Recommended given axillary nerve sensory changes; to be done at 6 weeks post-op if no improvement'), ] table_2col(doc, inv_data) doc.add_paragraph() # ===================================================================== # ICF FRAMEWORK # ===================================================================== heading(doc, 'ICF Framework', level=1, color=(0x2E, 0x74, 0xB5)) icf_data = [ ('Body Structure / Function Impairments', '• Right shoulder ROM severely restricted (all planes)\n• Muscle weakness – deltoid, rotator cuff (grades 2–3/5)\n• Pain (VAS 6–8/10)\n• Soft tissue oedema right shoulder and upper arm\n• Post-surgical scar – deltopectoral region\n• Axillary nerve neurapraxia (possible)\n• Disuse muscle wasting of right deltoid'), ('Activity Limitations', '• Unable to lift right arm above shoulder height\n• Difficulty with overhead activities\n• Unable to reach across body independently\n• Impaired upper limb dressing and grooming\n• Reduced grip / carry capacity with right arm'), ('Participation Restrictions', '• Unable to return to farming (primary occupation)\n• Unable to drive\n• Restricted social/community activities\n• Financial impact due to inability to work'), ('Environmental Factors (Barriers)', '• Farm work requires heavy lifting (barrier)\n• Rural setting – limited physiotherapy access\n• Financial constraints for prolonged rehabilitation'), ('Environmental Factors (Facilitators)', '• Family support at home\n• Motivated patient\n• Good bone healing (calcar intact, early periosteal reaction)\n• Surgeon follow-up at 6 weeks'), ('Personal Factors', '• Age 52; right-hand dominance; physically active prior to injury; high motivation to return to farming'), ] table_2col(doc, icf_data) doc.add_paragraph() # ===================================================================== # FUNCTIONAL DIAGNOSIS # ===================================================================== heading(doc, 'Functional Diagnosis', level=1, color=(0x2E, 0x74, 0xB5)) fd = ( 'Post-ORIF Right Proximal Humerus Fracture (Neer 3-Part) – Day 23 Post-operative\n\n' 'Key functional deficits:\n' '1. Severely restricted right shoulder ROM (all planes, active > passive)\n' '2. Significant right shoulder girdle muscle weakness (Grade 2–3/5) – deltoid and rotator cuff\n' '3. Moderate to severe shoulder pain (VAS 6–8/10) limiting function\n' '4. Post-operative scar – deltopectoral; currently non-adherent but requires monitoring\n' '5. Possible axillary nerve neurapraxia – sensory changes in regimental badge area\n' '6. Activity limitation in ADLs requiring right upper limb function\n' '7. Participation restriction – unable to engage in occupation (farming)\n' '8. Early disuse atrophy – right deltoid and upper arm (-1.5 to -2.5 cm girth deficit)' ) para(doc, fd) doc.add_paragraph() # ===================================================================== # GOALS # ===================================================================== heading(doc, 'Rehabilitation Goals', level=1, color=(0x2E, 0x74, 0xB5)) goals_table = doc.add_table(rows=1, cols=2) goals_table.style = 'Table Grid' for i, h in enumerate(['Short Term Goals (0–6 weeks post-op)', 'Long Term Goals (3–6 months post-op)']): goals_table.rows[0].cells[i].text = h goals_table.rows[0].cells[i].paragraphs[0].runs[0].bold = True row = goals_table.add_row() row.cells[0].text = ( '1. Pain reduction to VAS ≤3/10 at rest\n' '2. Achieve passive ROM: shoulder flexion 90°, abduction 60°, ER 30°\n' '3. Begin active-assisted ROM exercises\n' '4. Reduce oedema and improve scar mobility\n' '5. Maintain elbow/wrist/hand function\n' '6. Improve shoulder girdle posture\n' '7. Independence in home exercise program\n' '8. Monitor axillary nerve recovery' ) row.cells[1].text = ( '1. Achieve functional ROM: flexion ≥150°, abduction ≥150°, ER ≥60°\n' '2. MMT 4+/5 or 5/5 for all shoulder girdle muscles\n' '3. Return to full ADL independence\n' '4. Gradual return to light farming activities (by 4–5 months)\n' '5. Full return to occupation – heavy farming (by 6 months)\n' '6. Resolve axillary nerve neurapraxia\n' '7. VAS 0–1/10 at rest and on activity\n' '8. DASH score improvement to <20' ) doc.add_paragraph() # ===================================================================== # TREATMENT PLAN # ===================================================================== heading(doc, 'Treatment Plan', level=1, color=(0x2E, 0x74, 0xB5)) phase_data = [ ('PHASE 1 (Weeks 1–6: Protection & Pain Relief)', '• PRICE / POLICE principle: ice, elevation, sling protection\n' '• Pendulum (Codman) exercises – 3×10 reps, 3×/day\n' '• Active ROM: elbow, wrist, hand (full range encouraged)\n' '• Passive shoulder ROM (therapist-guided): careful, pain-free range only\n' '• Scapular retraction exercises (isometric)\n' '• TENS / IFT for pain management (low frequency, over deltoid)\n' '• Gentle oedema management: retrograde massage, elevation\n' '• Scar massage once healed (from ~3 weeks post-op)\n' '• Patient education: posture, precautions, sleeping position, sling use\n' '• Monitor axillary nerve status weekly'), ('PHASE 2 (Weeks 6–12: Active Movement & Strengthening)', '• Active-assisted ROM: pulleys, wand exercises, wall walking\n' '• Progressive active ROM within pain-free limits\n' '• Rotator cuff strengthening: isometric → isotonic (light Theraband)\n' '• Deltoid strengthening: gravity-eliminated → against gravity\n' '• Scapular stabiliser exercises: rows, serratus anterior activation\n' '• Postural correction exercises\n' '• Proprioceptive training – CKC, perturbation training\n' '• Ultrasound therapy over surgical site if swelling persists\n' '• Scar desensitisation and mobility exercises\n' '• Review NCS/EMG at 6 weeks if axillary nerve not recovering'), ('PHASE 3 (Months 3–6: Return to Function)', '• Progressive resistance training: shoulder press, lateral raises, rows\n' '• Functional task training: overhead activities, carrying, work simulation\n' '• Sport-specific/occupation-specific training (farm work simulation)\n' '• Advanced proprioceptive and coordination exercises\n' '• Functional outcome measures (DASH, Oxford Shoulder Score)\n' '• X-ray review at 3 months to confirm fracture union\n' '• Criteria for full clearance: ≥80% ROM vs contralateral, MMT 4+/5, VAS ≤1/10'), ] table_2col(doc, phase_data) doc.add_paragraph() # ===================================================================== # HOME PROGRAMME # ===================================================================== heading(doc, 'Home Programme', level=1, color=(0x2E, 0x74, 0xB5)) home_data = [ ('Pendulum Exercises', '10 repetitions × 3 sets × 3 times daily; lean forward, let arm hang, draw small circles'), ('Elbow/Wrist/Hand Exercises', 'Full active ROM of elbow, wrist, fingers 3×/day to prevent stiffness'), ('Ice Pack Application', '15 minutes × 3 times daily over right shoulder; cloth between ice and skin'), ('Sling Use', 'Wear broad arm sling at all times except during exercises; remove under supervision after 3 weeks or per surgeon advice'), ('Sleeping Position', 'Semi-reclined (pillow behind back); right arm supported on pillow to side; avoid lying fully on right shoulder'), ('Posture Awareness', 'Avoid shoulder elevation/shrugging; keep head neutral; scapular retraction reminders'), ('Scar Massage (from week 3)', 'Gentle circular massage over scar 5 minutes twice daily using coconut/vitamin E oil after wound fully healed'), ('Activity Restrictions', 'No lifting >0.5 kg with right arm; no driving; no overhead activities; no weight-bearing on right arm'), ('Red Flags – Seek immediate review', 'Increased redness/warmth/discharge at wound site; sudden severe increase in pain; loss of sensation in hand; fever >38°C'), ] table_2col(doc, home_data) doc.add_paragraph() doc.add_paragraph() p = doc.add_paragraph() p.alignment = WD_ALIGN_PARAGRAPH.RIGHT run = p.add_run('Evaluated by: ___________________________\nPhysiotherapist\nDate: 28 July 2026') run.font.size = Pt(11) run.bold = True # Save outpath = '/tmp/workspace/Proximal_Humerus_ORIF_Simulated_Case.docx' doc.save(outpath) print(f'Saved: {outpath}') PYEOF
python3 -c " from docx import Document doc = Document('/tmp/workspace/Proximal_Humerus_ORIF_Simulated_Case.docx') print(f'Paragraphs: {len(doc.paragraphs)}') print(f'Tables: {len(doc.tables)}') # Check file size import os size = os.path.getsize('/tmp/workspace/Proximal_Humerus_ORIF_Simulated_Case.docx') print(f'File size: {size/1024:.1f} KB') print('First 5 paragraphs:') for p in doc.paragraphs[:5]: print(f' [{p.style.name}] {p.text[:80]}') "
Proximal Humerus ORIF Simulated Case
Word Document · DOCX
| Section | Key Findings |
|---|---|
| Demographics | 52M, farmer, right-hand dominant, hypertensive |
| Chief Complaints | Pain VAS 6/10, severe ROM restriction, weakness, ADL difficulty |
| HOPI | Trauma on 01 July 2026; 3-part Neer fracture; PHILOS plate surgery 05 July 2026 |
| Pain Evaluation | VAS 6/10 rest, 8/10 on movement; aching/throbbing; aggravated by movement |
| Past History | Hypertension, previous distal radius fracture, no DM |
| General Exam / POLICE | Vitals stable; POLICE principle applied; mild swelling |
| Observation | Elevated shoulder, forward head, arm in sling/IR; deltopectoral scar 12 cm |
| Palpation | Grade II tenderness greater tuberosity; warm; upper trapezius spasm; scar non-adherent |
| ROM | Shoulder flexion active 35° / passive 55°; abduction active 30° / passive 45°; elbow/wrist/hand near-normal |
| MMT | Shoulder muscles 2–2+/5 (right); elbow/hand 4–4+/5 |
| Resisted Isometrics | Weak + painful for all shoulder movements |
| Reflexes | Normal biceps, BR, triceps bilaterally |
| Girth | 1.5–2.5 cm deficit right vs left (deltoid region) |
| Sensory | Reduced sensation regimental badge area - probable axillary nerve neurapraxia; distal intact |
| Functional (FIM) | Moderate assistance for upper body dressing, grooming, bathing; independent lower body/ambulation |
| Special Tests | Positive Neer, Hawkins-Kennedy, Drop Arm, Speed's; sulcus/empty can deferred |
| Investigations | Pre-op X-ray (3-part), CT (comminution), post-op X-rays (plate in situ, day 0 & 14), bloods, BMD/NCS recommended |
| ICF | Full body structure/function, activity, participation, environmental and personal factors |
| Goals | STG (6 weeks): pain ≤3, passive ROM 90°/60°; LTG (6 months): full ROM, return to farming |
| Treatment Plan | 3-phase protocol: protection → active movement → return to function |
| Home Programme | Pendulum exercises, ice, sling precautions, scar massage, red flags |