Summarize spinal chord injury notes from the above attached pdf
python3 << 'EOF' import pdfplumber pdf_path = "/tmp/workspace/attachments/6071d0dc-3fa3-4191-9a3f-4177e2bab002/spinal cord injury.pdf" with pdfplumber.open(pdf_path) as pdf: print(f"Total pages: {len(pdf.pages)}") full_text = "" for i, page in enumerate(pdf.pages): text = page.extract_text() if text: full_text += f"\n\n--- PAGE {i+1} ---\n{text}" print(full_text) EOF
python3 << 'EOF' import pdfplumber pdf_path = "/tmp/workspace/attachments/6071d0dc-3fa3-4191-9a3f-4177e2bab002/spinal cord injury.pdf" with pdfplumber.open(pdf_path) as pdf: print(f"Total pages: {len(pdf.pages)}") full_text = "" for i, page in enumerate(pdf.pages): text = page.extract_text() if text: full_text += f"\n\n--- PAGE {i+1} ---\n{text}" with open("/tmp/workspace/sci_text.txt", "w") as f: f.write(full_text) print("Saved. Total chars:", len(full_text)) EOF
python3 << 'EOF' from pypdf import PdfReader pdf_path = "/tmp/workspace/attachments/6071d0dc-3fa3-4191-9a3f-4177e2bab002/spinal cord injury.pdf" reader = PdfReader(pdf_path) print(f"Pages: {len(reader.pages)}") full_text = "" for i, page in enumerate(reader.pages): text = page.extract_text() if text and text.strip(): full_text += f"\n\n--- PAGE {i+1} ---\n{text}" with open("/tmp/workspace/sci_text.txt", "w") as f: f.write(full_text) print("Total chars:", len(full_text)) print("First 2000 chars:", full_text[:2000]) EOF
python3 << 'EOF' # Try to convert PDF pages to images using PIL/Pillow + pypdf import subprocess result = subprocess.run(['pip', 'show', 'pdf2image'], capture_output=True, text=True) print(result.stdout) result2 = subprocess.run(['pip', 'show', 'pymupdf'], capture_output=True, text=True) print("pymupdf:", result2.stdout) result3 = subprocess.run(['python3', '-c', 'import fitz; print("fitz ok")'], capture_output=True, text=True) print("fitz:", result3.stdout, result3.stderr) EOF
python3 << 'EOF' # pdf2image uses pdftoppm under the hood - check if it's available import subprocess r = subprocess.run(['which', 'pdftoppm'], capture_output=True, text=True) print("pdftoppm:", r.stdout, r.stderr) r2 = subprocess.run(['which', 'pdftocairo'], capture_output=True, text=True) print("pdftocairo:", r2.stdout, r2.stderr) # Try using pypdf to render pages - check what's available r3 = subprocess.run(['pip', 'show', 'pillow'], capture_output=True, text=True) print("pillow:", r3.stdout[:100]) EOF
mkdir -p /tmp/workspace/sci_pages && pdftoppm -r 150 "/tmp/workspace/attachments/6071d0dc-3fa3-4191-9a3f-4177e2bab002/spinal cord injury.pdf" /tmp/workspace/sci_pages/page && ls /tmp/workspace/sci_pages/ | head -30
python3 << 'EOF' from PIL import Image import os pages_dir = "/tmp/workspace/sci_pages" png_dir = "/tmp/workspace/sci_pages_png" os.makedirs(png_dir, exist_ok=True) ppm_files = sorted([f for f in os.listdir(pages_dir) if f.endswith('.ppm')]) for ppm in ppm_files: img = Image.open(os.path.join(pages_dir, ppm)) png_name = ppm.replace('.ppm', '.png') img.save(os.path.join(png_dir, png_name)) print(f"Converted {len(ppm_files)} pages to PNG") print(os.listdir(png_dir)[:5]) EOF
python3 << 'EOF' from PIL import Image import os png_dir = "/tmp/workspace/sci_pages_png" out_dir = "/tmp/workspace/sci_batches" os.makedirs(out_dir, exist_ok=True) pages = sorted([os.path.join(png_dir, f) for f in os.listdir(png_dir) if f.endswith('.png')]) print(f"Total pages: {len(pages)}") # Check image size sample = Image.open(pages[0]) print(f"Page size: {sample.size}") # Create batches of 4 pages stacked vertically batch_size = 4 for batch_idx in range(0, len(pages), batch_size): batch_pages = pages[batch_idx:batch_idx+batch_size] imgs = [Image.open(p) for p in batch_pages] # Resize to consistent width target_w = 900 resized = [] for img in imgs: ratio = target_w / img.width new_h = int(img.height * ratio) resized.append(img.resize((target_w, new_h), Image.LANCZOS)) total_h = sum(r.height for r in resized) combined = Image.new('RGB', (target_w, total_h), 'white') y_offset = 0 for r in resized: combined.paste(r, (0, y_offset)) y_offset += r.height batch_num = batch_idx // batch_size + 1 out_path = os.path.join(out_dir, f"batch_{batch_num:02d}.jpg") combined.save(out_path, 'JPEG', quality=85) print(f"Batch {batch_num}: pages {batch_idx+1}-{min(batch_idx+batch_size, len(pages))}, size {combined.size}, saved to {out_path}") print("Done") EOF
cd /tmp/workspace/sci_batches && python3 -m http.server 8765 & sleep 2 curl -s -o /dev/null -w "%{http_code}" http://localhost:8765/batch_01.jpg
# Check file sizes and try serving individual pages ls -lh /tmp/workspace/sci_batches/ ls -lh /tmp/workspace/sci_pages_png/ | head -5 # Check if HTTP server is still running curl -s -o /dev/null -w "%{http_code}" http://localhost:8765/batch_01.jpg
python3 << 'EOF' from PIL import Image import os png_dir = "/tmp/workspace/sci_pages_png" small_dir = "/tmp/workspace/sci_small" os.makedirs(small_dir, exist_ok=True) pages = sorted([f for f in os.listdir(png_dir) if f.endswith('.png')]) for pg in pages: img = Image.open(os.path.join(png_dir, pg)) # Resize to smaller width for OCR-like reading target_w = 700 ratio = target_w / img.width new_h = int(img.height * ratio) resized = img.resize((target_w, new_h), Image.LANCZOS) out_name = pg.replace('.png', '.jpg') resized.save(os.path.join(small_dir, out_name), 'JPEG', quality=75) files = sorted(os.listdir(small_dir)) for f in files: size = os.path.getsize(os.path.join(small_dir, f)) print(f"{f}: {size/1024:.0f}KB") EOF
pkill -f "http.server 8765" 2>/dev/null; sleep 1 cd /tmp/workspace/sci_small && python3 -m http.server 8765 > /tmp/http_log.txt 2>&1 & sleep 2 curl -s -o /dev/null -w "%{http_code}" http://localhost:8765/page-01.jpg
cd /tmp/workspace/sci_small && nohup python3 -m http.server 8766 & sleep 3 STATUS=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:8766/page-01.jpg) echo "HTTP status: $STATUS"
Note: The uploaded PDF is a scanned image document with no selectable text layer, and the image analysis tools could not access the local files via URL. The summary below is based on comprehensive clinical knowledge of spinal cord injury as covered in standard medical/nursing notes. If specific content from your notes differs, please share key sections as text or a text-based PDF.
| Tract | Location | Function |
|---|---|---|
| Corticospinal tract | Lateral funiculus | Voluntary motor (ipsilateral below injury) |
| Dorsal columns | Posterior funiculus | Fine touch, vibration, proprioception (ipsilateral) |
| Spinothalamic tract | Anterior/lateral funiculus | Pain & temperature (contralateral, 1-2 levels below) |
| Anterior horn cells | Gray matter | Lower motor neurons |
| Grade | Description |
|---|---|
| A - Complete | No sensory or motor function preserved in sacral segments S4-S5 |
| B - Sensory Incomplete | Sensory but NO motor function below neurological level, includes S4-S5 |
| C - Motor Incomplete | Motor function preserved below level; >50% key muscles grade <3 |
| D - Motor Incomplete | Motor function preserved below level; >50% key muscles grade ≥3 |
| E - Normal | Sensory and motor function normal; may have abnormal reflexes |
| Level | Expected Functional Goals |
|---|---|
| C1-C3 | Power wheelchair (sip-and-puff), voice-activated devices, ventilator dependent |
| C4 | Power wheelchair; may operate with chin control; ventilator often needed |
| C5 | Manual wheelchair (with assistance); can feed self with adaptive equipment |
| C6 | Independent in manual wheelchair on flat surfaces; wrist extension allows tenodesis grasp |
| C7 | Nearly independent in wheelchair; transfers with minimal assist |
| C8-T1 | Independent wheelchair; most ADLs independent |
| T2-T9 | Wheelchair independent; some therapeutic ambulation |
| T10-L2 | Community ambulation with AFOs/KAFOs and crutches possible |
| L3 and below | Community ambulation; may need AFOs |
| Complication | Key Points |
|---|---|
| Syringomyelia | Progressive ascending myelopathy post-SCI; MRI diagnosis; requires surgical drainage |
| Charcot arthropathy | Neuropathic joint destruction; painless joint swelling |
| Cardiovascular disease | Sedentary lifestyle, dyslipidemia, insulin resistance |
| Osteoporosis | Below injury level; high fracture risk; bisphosphonates, calcium, vitamin D |
| Aging with SCI | Accelerated aging; pain, fatigue, overuse injuries common |
Make it simplet to understand
| Type | Meaning |
|---|---|
| Complete | Total loss of movement AND feeling below injury |
| Incomplete | Some movement or feeling still present below injury |
Key difference from blood loss shock: Blood loss = fast heart rate. Neurogenic = slow heart rate.
| Injury Level | Breathing Effect |
|---|---|
| C1-C3 | No breathing at all - needs ventilator forever |
| C4 | Partial breathing - may need ventilator |
| C5-T1 | Weak cough, risk of pneumonia |
| Below T12 | Near-normal breathing |
| Problem | Simple Explanation | Key Treatment |
|---|---|---|
| Pressure sores | Skin breaks down from lying still | Turn patient every 2 hours |
| DVT/Clots | Blood clots in legs (can go to lungs) | Blood thinners + compression stockings |
| Spasticity | Muscles become stiff and spasm | Baclofen (medication), physiotherapy |
| Neuropathic pain | Burning/shooting pain from nerve damage | Pregabalin or Gabapentin |
| Heterotopic ossification | Bone grows in wrong places (muscles/joints) | NSAIDs, physiotherapy |
| Low blood pressure on sitting | Blood pools in legs when upright | Slow position changes, compression, Midodrine |
| Temperature problems | Body can't regulate its own temperature | Control room temperature |
| Depression/Anxiety | Very common after SCI | Counseling, peer support, medication |
| Level | What They Can Manage |
|---|---|
| C1-C4 | Voice/breath-controlled wheelchair; needs full-time care |
| C5 | Can feed themselves with gadgets; power wheelchair |
| C6 | Can use wrist to grip things; mostly independent indoors |
| C7-C8 | Can do most daily tasks; mostly independent in wheelchair |
| T1-T9 | Fully independent in wheelchair |
| T10-L2 | Can walk short distances with braces and crutches |
| L3+ | Can walk in community, may just need ankle brace |