History assessment and complete physiotherapy protocol
~/
physiotherapy clinical practice guideline rehabilitation protocol post discharge assessment red flags 2025
~/attachments/268fa825-8ff4-43ee-b621-ef5d0669de70/
rehabilitation AND physiotherapy
python -c "import pdfplumber; p='/tmp/workspace/attachments/268fa825-8ff4-43ee-b621-ef5d0669de70/Suhas_Jagtap_ Discharge summary and Test Reports.pdf'; pdf=pdfplumber.open(p); print('PAGES',len(pdf.pages)); [print('\\n--- PAGE %d ---\\n%s'%(i+1,(page.extract_text() or '')[:12000])) for i,page in enumerate(pdf.pages)]"
mkdir -p "/tmp/workspace/physio_assessment/assets" && python -c "import fitz; p='/tmp/workspace/attachments/268fa825-8ff4-43ee-b621-ef5d0669de70/Suhas_Jagtap_ Discharge summary and Test Reports.pdf'; d=fitz.open(p); [d[i].get_pixmap(matrix=fitz.Matrix(1.5,1.5),alpha=False).save('/tmp/workspace/physio_assessment/assets/page_%02d.png'%(i+1)) for i in range(len(d))]; print(len(d))" && python -c "import pytesseract; print(pytesseract.get_tesseract_version())"
python -c "import pdfplumber; p='/tmp/workspace/attachments/268fa825-8ff4-43ee-b621-ef5d0669de70/Suhas_Jagtap_ Discharge summary and Test Reports.pdf'; pdf=pdfplumber.open(p); [print(i+1,len(page.images),[(im['width'],im['height'],im.get('name')) for im in page.images]) for i,page in enumerate(pdf.pages)]"
python -c "import pdfplumber,os; from PIL import Image; from io import BytesIO; p='/tmp/workspace/attachments/268fa825-8ff4-43ee-b621-ef5d0669de70/Suhas_Jagtap_ Discharge summary and Test Reports.pdf'; out='/tmp/workspace/physio_assessment/assets'; os.makedirs(out,exist_ok=True); pdf=pdfplumber.open(p);\nfor i,page in enumerate(pdf.pages):\n im=page.images[0]; data=im['stream'].get_data(); open(f'{out}/page_{i+1:02d}.bin','wb').write(data);\n try:\n x=Image.open(BytesIO(data)); x.save(f'{out}/page_{i+1:02d}.png'); print(i+1,x.format,x.size)\n except Exception as e: print(i+1,'ERR',str(e),len(data))"; which tesseract || true; python -c "import pytesseract; print('pytesseract installed')"
~/
python -c "import pdfplumber,os; p='/tmp/workspace/attachments/268fa825-8ff4-43ee-b621-ef5d0669de70/Suhas_Jagtap_ Discharge summary and Test Reports.pdf'; out='/tmp/workspace/physio_assessment/assets'; os.makedirs(out,exist_ok=True); pdf=pdfplumber.open(p); [(open(out+'/page_%02d.jpg'%(i+1),'wb').write(page.images[0]['stream'].get_data()), print(i+1,len(page.images[0]['stream'].get_data()))) for i,page in enumerate(pdf.pages)]"
python -c "from PIL import Image,ImageDraw; import os,glob; fs=sorted(glob.glob('/tmp/workspace/physio_assessment/assets/page_*.jpg')); thumbs=[]; [(lambda im,i: (im.thumbnail((250,360)), thumbs.append((i,im.copy()))))(Image.open(f).convert('RGB'),i+1) for i,f in enumerate(fs)]; out=Image.new('RGB',(1250,1440),'white'); d=ImageDraw.Draw(out); [(out.paste(im,((i%5)*250,(i//5)*360+20)),d.text(((i%5)*250+5,(i//5)*360+3),str(i),fill='red')) for i,im in thumbs]; out.save('/tmp/workspace/physio_assessment/assets/contact.jpg')"
Review the attached scanned PDF at /tmp/workspace/attachments/268fa825-8ff4-43ee-b621-ef5d0669de70/Suhas_Jagtap_ Discharge summary and Test Reports.pdf. It has 19 image-only pages, with extracted images in /tmp/workspace/physio_assessment/assets/page_01.jpg through page_19.jpg. Extract clinically relevant details exactly: demographics, admission/discharge dates, primary diagnosis, procedures/surgery and date, imaging/lab findings, comorbidities, medication/discharge instructions, mobility/weight-bearing restrictions, and any physiotherapy-relevant precautions. Return a compact page-referenced summary. Do not invent details.
~/physio_assessment/assets
python - <<'PY' from PIL import Image from pathlib import Path src=Path('/tmp/workspace/physio_assessment/assets') out=Path('/tmp/workspace/physio_assessment/thumbs'); out.mkdir(exist_ok=True) for p in sorted(src.glob('page_*.jpg')): im=Image.open(p); im.thumbnail((1100,1600)); im.save(out/p.name,quality=55,optimize=True) PY for f in /tmp/workspace/physio_assessment/assets/page_*.jpg; do tesseract "$f" "${f%.jpg}" 2>/dev/null; done
python - <<'PY' import importlib.util for x in ['pytesseract','easyocr','rapidocr_onnxruntime','keras_ocr','cv2']: print(x, bool(importlib.util.find_spec(x))) PY which tesseract || true; which pdftotext || true; ls -lh "/tmp/workspace/attachments/268fa825-8ff4-43ee-b621-ef5d0669de70/Suhas_Jagtap_ Discharge summary and Test Reports.pdf" /tmp/workspace/physio_assessment/thumbs/page_01.jpg
pdftotext "/tmp/workspace/attachments/268fa825-8ff4-43ee-b621-ef5d0669de70/Suhas_Jagtap_ Discharge summary and Test Reports.pdf" - | sed -n '1,120p'; which convert || true; which magick || true; python - <<'PY' from PIL import Image im=Image.open('/tmp/workspace/physio_assessment/thumbs/page_01.jpg') print(im.size,im.getbbox(),im.getextrema()) PY
python - <<'PY' from PIL import Image,ImageDraw from pathlib import Path ps=sorted(Path('/tmp/workspace/physio_assessment/assets').glob('page_*.jpg')) for n in range(0,19,4): out=Image.new('RGB',(1200,1600),'white') for j,p in enumerate(ps[n:n+4]): im=Image.open(p).convert('RGB'); im.thumbnail((580,760)) x=(j%2)*600;y=(j//2)*800 out.paste(im,(x,y+25)); ImageDraw.Draw(out).text((x+5,y+5),p.stem,fill='red') out.save(f'/tmp/workspace/physio_assessment/thumbs/grid_{n//4+1}.jpg',quality=65) PY ls -lh /tmp/workspace/physio_assessment/thumbs/grid_*.jpg; which gocr || true; which ocrad || true; which python
sudo apt-get update -qq && sudo apt-get install -y -qq tesseract-ocr 2>&1 | tail -20; which tesseract
ls /usr/bin | sed -n '/ocr\|tess/p'; ls /usr/share | sed -n '/tess\|ocr/p'; python -m pip install --quiet --disable-pip-version-check rapidocr_onnxruntime 2>&1 | tail -20
python - <<'PY' from rapidocr_onnxruntime import RapidOCR from pathlib import Path ocr=RapidOCR() out=[] for p in sorted(Path('/tmp/workspace/physio_assessment/assets').glob('page_*.jpg')): r,el=ocr(str(p)) out.append('\n\n===== '+p.stem+' =====\n') if r: out.extend(x[1] for x in r) Path('/tmp/workspace/physio_assessment/ocr.txt').write_text('\n'.join(out)) print('complete',len(out)) PY
"===== page_" in ~/physio_assessment/ocr.txt
sed -n '368,1400p' /tmp/workspace/physio_assessment/ocr.txt
anterior cervical discectomy fusion AND rehabilitation
ACDF postoperative rehabilitation protocol cervical collar exercises lifting restrictions hospital protocol
| Exercise | Dosage |
|---|---|
| Short, frequent indoor walking | 5-10 min, 3-5 times/day |
| Ankle pumps | 20 repetitions, 3-4 times/day |
| Deep diaphragmatic breathing | 5-10 breaths, 3-4 times/day |
| Hand opening/closing and finger opposition | 10-15 repetitions each, 2-3 times/day |
| Gentle wrist and elbow movements | 10-15 repetitions, 2-3 times/day |
| Gentle shoulder pendulum or supported shoulder flexion below shoulder height, only if comfortable | 10 repetitions, 1-2 times/day |
| Scapular setting: gently draw shoulder blades back and down, no neck movement | hold 3-5 sec, 8-10 repetitions, 2-3 times/day |
| Sit-to-stand using hip hinge and neutral neck | 5-10 repetitions, 1-2 times/day |
| Intervention | Dosage |
|---|---|
| Progressive walking | build toward 20-30 min/day, split into sessions if needed |
| Stationary bicycle, only if safe mounting/dismounting and surgeon agrees | 5-10 min initially, progress gradually |
| Scapular setting/retraction | 2 sets of 10-15 |
| Supported shoulder flexion/scaption, below symptom-provoking range | 2 sets of 10 |
| Elbow, wrist, grip strengthening using very light resistance | 1-2 sets of 10-15 |
| Seated heel raises, mini-squats, sit-to-stand | 2 sets of 8-12 |
| Standing hip abduction/extension while holding support | 2 sets of 10 each side |
| Static balance: feet together, semi-tandem stance near support | 3 x 20-30 sec |
| Hand dexterity tasks if myelopathy symptoms persist | 5-10 min/day |
| Exercise | Dosage |
|---|---|
| Walking or low-impact aerobic exercise | 25-35 min, most days |
| Thoracic extension over chair back or towel roll, neck supported | 8-10 repetitions |
| Pec minor/major stretch, gentle and without neck extension | 3 x 20-30 sec |
| Scapular retraction with light band | 2-3 sets of 10-15 |
| Low row with light band, elbows close to body | 2-3 sets of 10-15 |
| External rotation with light band, elbows at side | 2 sets of 10-15 |
| Wall slides below shoulder height, maintaining neutral neck | 2 sets of 8-12 |
| Sit-to-stand, step-ups, mini-squats, hip strengthening | 2-3 sets of 8-12 |
| Balance progression: tandem stance, supported single-leg stance, controlled turns | 3 x 20-30 sec |
| Time point | Review focus |
|---|---|
| 1-2 weeks | wound, collar fit, pain control, walking, red flags |
| Around 2 weeks | operating surgeon follow-up as stated in discharge plan |
| 4-6 weeks | neurological status, functional progress, collar and activity restrictions |
| 6-12 weeks | imaging/clinical fusion review, begin cervical mobility only if cleared |
| 12 weeks onward | strength, endurance, work and activity progression |