Take second PPT as the reference and make the SOAP analysis on the sandhya case sheet
python3 -c " import pdfplumber with pdfplumber.open('/tmp/workspace/attachments/7a031ae3-ca05-4ad9-97d2-3e811e0b5695/Sandhya .pdf') as pdf: print(f'Total pages: {len(pdf.pages)}') for i, page in enumerate(pdf.pages, 1): text = page.extract_text() print(f'--- PAGE {i} ---') print(text) print() "
python3 -c " from pptx import Presentation prs = Presentation('/tmp/workspace/attachments/7a031ae3-ca05-4ad9-97d2-3e811e0b5695/5_6095778492585089495 (1).pptx') print(f'Total slides: {len(prs.slides)}') for i, slide in enumerate(prs.slides, 1): print(f'--- SLIDE {i} ---') for shape in slide.shapes: if shape.has_text_frame and shape.text_frame.text.strip(): print(f'[{shape.name}]: {shape.text_frame.text}') print() "
analyse_media to extract visual content. Also, let me read the editing guide for the PPTX to understand the reference template better.python3 -c " from pypdf import PdfReader reader = PdfReader('/tmp/workspace/attachments/7a031ae3-ca05-4ad9-97d2-3e811e0b5695/Sandhya .pdf') print(f'Pages: {len(reader.pages)}') # Check if there are images for i, page in enumerate(reader.pages[:5], 1): print(f'Page {i}: images={len(page.images)}, text={repr(page.extract_text()[:200])}') "
python3 -c " import os from pypdf import PdfReader reader = PdfReader('/tmp/workspace/attachments/7a031ae3-ca05-4ad9-97d2-3e811e0b5695/Sandhya .pdf') os.makedirs('/tmp/workspace/sandhya_pages', exist_ok=True) # Extract images from first 20 pages for i, page in enumerate(reader.pages[:20], 1): if page.images: img = page.images[0] out = f'/tmp/workspace/sandhya_pages/page_{i:02d}.jpg' with open(out, 'wb') as f: f.write(img.data) print(f'Saved page {i}: {out} ({len(img.data)} bytes)') print('Done') "
python3 -c " # Try using pdf2image and pytesseract for OCR import subprocess result = subprocess.run(['python3', '-c', 'import pytesseract; print(\"pytesseract available\")'], capture_output=True, text=True) print('pytesseract:', result.stdout, result.stderr) result2 = subprocess.run(['python3', '-c', 'import pdf2image; print(\"pdf2image available\")'], capture_output=True, text=True) print('pdf2image:', result2.stdout, result2.stderr) result3 = subprocess.run(['python3', '-c', 'from PIL import Image; print(\"PIL available\")'], capture_output=True, text=True) print('PIL:', result3.stdout, result3.stderr) "
pip install --user pytesseract 2>&1 | tail -3; tesseract --version 2>&1 | head -2
python3 -c " # Try using markitdown as another approach import subprocess result = subprocess.run(['python3', '-m', 'markitdown', '/tmp/workspace/attachments/7a031ae3-ca05-4ad9-97d2-3e811e0b5695/Sandhya .pdf'], capture_output=True, text=True) print('STDOUT:', result.stdout[:3000]) print('STDERR:', result.stderr[:1000]) "
python3 -c " # Use pdf2image to convert pages then use PIL to encode as base64 for display from pdf2image import convert_from_path import base64, io pages = convert_from_path('/tmp/workspace/attachments/7a031ae3-ca05-4ad9-97d2-3e811e0b5695/Sandhya .pdf', first_page=1, last_page=5, dpi=200) for i, page in enumerate(pages, 1): page.save(f'/tmp/workspace/sandhya_pages/hires_page_{i:02d}.png') print(f'Saved hires page {i}') print('Done') "
python3 -c " from PIL import Image import os # Make smaller compressed versions for i in range(1, 6): path = f'/tmp/workspace/sandhya_pages/hires_page_{i:02d}.png' if os.path.exists(path): img = Image.open(path) # Resize to smaller ratio = 800 / max(img.size) new_size = (int(img.size[0]*ratio), int(img.size[1]*ratio)) img_resized = img.resize(new_size, Image.LANCZOS) out = f'/tmp/workspace/sandhya_pages/small_page_{i:02d}.jpg' img_resized.save(out, 'JPEG', quality=85) print(f'Page {i}: {img.size} -> {new_size}, saved {os.path.getsize(out)} bytes to {out}') "
python3 -c " from pdf2image import convert_from_path from PIL import Image import os # Convert pages 6-20 and make small versions pages = convert_from_path('/tmp/workspace/attachments/7a031ae3-ca05-4ad9-97d2-3e811e0b5695/Sandhya .pdf', first_page=6, last_page=20, dpi=200) for i, page in enumerate(pages, 6): ratio = 800 / max(page.size) new_size = (int(page.size[0]*ratio), int(page.size[1]*ratio)) page_resized = page.resize(new_size, Image.LANCZOS) out = f'/tmp/workspace/sandhya_pages/small_page_{i:02d}.jpg' page_resized.save(out, 'JPEG', quality=85) print(f'Saved page {i}') print('Done') "
python3 << 'PYEOF' from pptx import Presentation from pptx.util import Inches, Pt, Emu from pptx.dml.color import RGBColor from pptx.enum.text import PP_ALIGN from pptx.util import Inches, Pt from copy import deepcopy import copy # Load the reference PPT to use as template prs = Presentation('/tmp/workspace/attachments/7a031ae3-ca05-4ad9-97d2-3e811e0b5695/5_6095778492585089495 (1).pptx') # Check slide dimensions print(f"Slide width: {prs.slide_width.inches:.2f} in") print(f"Slide height: {prs.slide_height.inches:.2f} in") print(f"Number of slides: {len(prs.slides)}") # Check slide layouts print("\nSlide layouts:") for i, layout in enumerate(prs.slide_layouts): print(f" {i}: {layout.name}") PYEOF
| Field | Details |
|---|---|
| Patient | Mrs. K. Sandhiya, 27/F |
| IP No. | IP260406067 / UHID: 2507170487 |
| Admitted | 06-Apr-2026, Female Medical Unit-1 |
| Diagnosis | ALE of BA (Acute Exacerbation of Bronchial Asthma) |
| Complaints | Chest tightness, cough with expectoration, running nose x 6 days; fever 3 days ago; weight loss 8kg/20 days; anorexia; nausea; insomnia |
| Past History | Known wheezer x 14 years on inhaler; no DM/HTN/seizures |
| Vitals | Temp 98°F, BP 110/60, PR 86/min, RR 20/min, SpO2 98%, Wt 59kg |
| Systemic | CVS S1S2+; RS: BAE+ bilateral scattered wheeze; P/A: soft, non-tender; CNS: NFND |
| Medications | Inj. Taxim 1g IV BD, Inj. Hydrocort 100mg IV BD, Inj. MgSO4 2g IV OD, Inj. Pan 40mg IV BD, Inj. Deriphylline 2cc IV BD, T. Azee 500mg, T. Montelson, T. Pulmolear, T. Paracetamol 500mg, Inj. Emeset 4mg, Neb. Duolin+Budecort Q8H, Neb. NAC TDS, Syp. Ascoril 5ml TDS |
| Investigations | CBC, RBS, CRP, RFT, LFT, S. Electrolytes, CXR-PA, ECG, Urine R/E, Sputum C/S |
Continue
mkdir -p /tmp/workspace/sandhya_soap && python3 << 'PYEOF' from pptx import Presentation from pptx.util import Inches, Pt, Emu from pptx.dml.color import RGBColor from pptx.enum.text import PP_ALIGN from pptx.oxml.ns import qn from pptx.util import Inches, Pt from lxml import etree import copy # ── Colours matching reference PPT ────────────────────────────────────── DARK_BLUE = RGBColor(0x1F, 0x39, 0x64) # title slide bg MID_BLUE = RGBColor(0x2E, 0x74, 0xB5) # section headers LIGHT_BLUE = RGBColor(0xBD, 0xD7, 0xEE) # subtle highlight WHITE = RGBColor(0xFF, 0xFF, 0xFF) NEAR_BLACK = RGBColor(0x10, 0x10, 0x10) YELLOW = RGBColor(0xFF, 0xC0, 0x00) # accent # ── Helpers ────────────────────────────────────────────────────────────── def new_prs(): prs = Presentation() prs.slide_width = Inches(13.33) prs.slide_height = Inches(7.50) return prs def blank_slide(prs): layout = prs.slide_layouts[6] # Blank return prs.slides.add_slide(layout) def set_bg(slide, color: RGBColor): bg = slide.background fill = bg.fill fill.solid() fill.fore_color.rgb = color def add_textbox(slide, text, l, t, w, h, font_size=20, bold=False, color=WHITE, align=PP_ALIGN.LEFT, wrap=True): txb = slide.shapes.add_textbox(Inches(l), Inches(t), Inches(w), Inches(h)) tf = txb.text_frame tf.word_wrap = wrap p = tf.paragraphs[0] p.alignment = align run = p.add_run() run.text = text run.font.size = Pt(font_size) run.font.bold = bold run.font.color.rgb = color return txb def add_rect(slide, l, t, w, h, fill_color: RGBColor, line_color=None): shape = slide.shapes.add_shape( 1, # MSO_SHAPE_TYPE.RECTANGLE Inches(l), Inches(t), Inches(w), Inches(h)) shape.fill.solid() shape.fill.fore_color.rgb = fill_color if line_color: shape.line.color.rgb = line_color else: shape.line.fill.background() return shape def add_para(tf, text, font_size=16, bold=False, color=NEAR_BLACK, align=PP_ALIGN.LEFT, space_before=0): p = tf.add_paragraph() p.alignment = align p.space_before = Pt(space_before) run = p.add_run() run.text = text run.font.size = Pt(font_size) run.font.bold = bold run.font.color.rgb = color return p def section_slide(prs, title): """Dark blue slide with centred white title – mirrors reference section headers.""" slide = blank_slide(prs) set_bg(slide, DARK_BLUE) # Decorative top bar add_rect(slide, 0, 0, 13.33, 0.18, MID_BLUE) # Bottom bar add_rect(slide, 0, 7.32, 13.33, 0.18, MID_BLUE) # Title centred add_textbox(slide, title, 0.5, 2.8, 12.33, 1.5, font_size=44, bold=True, color=WHITE, align=PP_ALIGN.CENTER) return slide def content_slide(prs, title, body_lines, title_color=MID_BLUE, font_size=17, bullet=True): """White content slide with blue title bar.""" slide = blank_slide(prs) set_bg(slide, WHITE) # Title bar add_rect(slide, 0, 0, 13.33, 1.0, DARK_BLUE) add_textbox(slide, title, 0.3, 0.08, 12.7, 0.84, font_size=28, bold=True, color=WHITE, align=PP_ALIGN.LEFT) # Bottom accent add_rect(slide, 0, 7.32, 13.33, 0.18, MID_BLUE) # Body text box txb = slide.shapes.add_textbox(Inches(0.4), Inches(1.15), Inches(12.5), Inches(6.0)) tf = txb.text_frame tf.word_wrap = True first = True for line in body_lines: if first: p = tf.paragraphs[0] first = False else: p = tf.add_paragraph() p.alignment = PP_ALIGN.LEFT p.space_before = Pt(2) run = p.add_run() prefix = "• " if bullet and line and not line.startswith(" ") else "" run.text = prefix + line run.font.size = Pt(font_size) run.font.color.rgb = NEAR_BLACK return slide def two_col_slide(prs, title, left_title, left_lines, right_title, right_lines, font_size=15): slide = blank_slide(prs) set_bg(slide, WHITE) add_rect(slide, 0, 0, 13.33, 1.0, DARK_BLUE) add_textbox(slide, title, 0.3, 0.08, 12.7, 0.84, font_size=28, bold=True, color=WHITE, align=PP_ALIGN.LEFT) add_rect(slide, 0, 7.32, 13.33, 0.18, MID_BLUE) # Left column add_rect(slide, 0.3, 1.1, 5.9, 0.45, MID_BLUE) add_textbox(slide, left_title, 0.35, 1.1, 5.8, 0.45, font_size=16, bold=True, color=WHITE) txb = slide.shapes.add_textbox(Inches(0.4), Inches(1.6), Inches(5.8), Inches(5.6)) tf = txb.text_frame; tf.word_wrap = True; first = True for line in left_lines: p = tf.paragraphs[0] if first else tf.add_paragraph() first = False p.alignment = PP_ALIGN.LEFT; p.space_before = Pt(2) run = p.add_run(); run.text = "• " + line if line else "" run.font.size = Pt(font_size); run.font.color.rgb = NEAR_BLACK # Right column add_rect(slide, 6.8, 1.1, 6.2, 0.45, MID_BLUE) add_textbox(slide, right_title, 6.85, 1.1, 6.1, 0.45, font_size=16, bold=True, color=WHITE) txb2 = slide.shapes.add_textbox(Inches(6.9), Inches(1.6), Inches(6.1), Inches(5.6)) tf2 = txb2.text_frame; tf2.word_wrap = True; first2 = True for line in right_lines: p = tf2.paragraphs[0] if first2 else tf2.add_paragraph() first2 = False p.alignment = PP_ALIGN.LEFT; p.space_before = Pt(2) run = p.add_run(); run.text = "• " + line if line else "" run.font.size = Pt(font_size); run.font.color.rgb = NEAR_BLACK return slide # ════════════════════════════════════════════════════════════════════════ prs = new_prs() # ── SLIDE 1 : Title ────────────────────────────────────────────────────── slide1 = blank_slide(prs) set_bg(slide1, DARK_BLUE) add_rect(slide1, 0, 0, 13.33, 0.20, MID_BLUE) add_rect(slide1, 0, 7.30, 13.33, 0.20, MID_BLUE) # Gold horizontal rule add_rect(slide1, 1.5, 2.55, 10.33, 0.06, YELLOW) add_rect(slide1, 1.5, 4.85, 10.33, 0.06, YELLOW) add_textbox(slide1, "SECOND SESSIONAL PRACTICAL EXAMINATION", 0.5, 0.6, 12.33, 0.9, font_size=24, bold=True, color=YELLOW, align=PP_ALIGN.CENTER) add_textbox(slide1, "PHARMACOTHERAPEUTICS - I", 0.5, 1.55, 12.33, 0.9, font_size=32, bold=True, color=WHITE, align=PP_ALIGN.CENTER) add_textbox(slide1, "SOAP ANALYSIS", 0.5, 2.65, 12.33, 0.9, font_size=40, bold=True, color=WHITE, align=PP_ALIGN.CENTER) add_textbox(slide1, "CASE OF ACUTE EXACERBATION OF BRONCHIAL ASTHMA", 0.5, 3.55, 12.33, 0.75, font_size=22, bold=True, color=YELLOW, align=PP_ALIGN.CENTER) add_textbox(slide1, "Presented by,\nSandhiya K\n2nd Pharm D", 0.5, 4.95, 12.33, 1.3, font_size=18, bold=False, color=WHITE, align=PP_ALIGN.CENTER) # ── SLIDE 2 : SUBJECTIVE section header ────────────────────────────────── section_slide(prs, "SUBJECTIVE") # ── SLIDE 3 : Chief Complaints + HPI ───────────────────────────────────── content_slide(prs, "SUBJECTIVE", [ "Patient: Mrs. K. Sandhiya | Age/Sex: 27 years / Female", "IP No.: IP260406067 | UHID: 2507170487", "Date of Admission: 06-April-2026 at 1:08 PM", "Ward: Female Medical Unit-1 (RM-I), Nandha Medical College & Hospital", "Unit Chief: Dr. N. Sathya", "", "CHIEF COMPLAINTS", " c/o Chest tightness ─ 6 days", " c/o Cough with expectoration ─ 6 days", " c/o Running nose ─ 6 days", " c/o Fever ─ 3 days back", " H/O Loss of weight (8 kg in 20 days)", " H/O Loss of appetite", " H/O Nausea", " H/O Insomnia | H/O Disturbed sleep x 10 days", " No H/O chest pain / palpitation", " No H/O abdominal pain / burning micturition", " No H/O pet / dust / allergy exposure", ], font_size=16) # ── SLIDE 4 : Past History + Personal History ──────────────────────────── two_col_slide(prs, "SUBJECTIVE – History", "HISTORY OF PRESENT ILLNESS", [ "Patient with k/c/o Bronchial Asthma since 14 years", "On inhaler (Tiova Rotacaps 2 puff OD + Budamate Rotacaps 2 puff OD)", "Presented with chest tightness, cough with expectoration, running nose × 6 days", "Fever 3 days back", "Received from Respiratory Medicine Dept → General Medicine ward", "Shortness of breath × 3 days", "No specific complaints on review", ], "PAST HISTORY", [ "Known wheeze / Bronchial Asthma – 14 years", "On inhaler treatment", "NKICLO: DM, HTN, Seizures", "Nil surgical history", "Nil surgical / blood transfusion history", "", "FAMILY HISTORY: Nil significant", "", "PERSONAL HISTORY", "Mixed diet", "Insomnia present", "Normal bowel & bladder habits", "Menstrual History: Menarche @ 14 yrs; Regular 3-4/30; no clots/pain; 5 pads/day", ], font_size=14) # ── SLIDE 5 : OBJECTIVE section header ─────────────────────────────────── section_slide(prs, "OBJECTIVE") # ── SLIDE 6 : General Examination + Vitals ─────────────────────────────── two_col_slide(prs, "OBJECTIVE – General & Systemic Examination", "GENERAL EXAMINATION", [ "Conscious, Oriented, Afebrile", "Temperature : 98 °F", "Blood Pressure : 110/60 mmHg", "Pulse Rate : 86 beats/min", "Respiratory Rate : 20 breaths/min", "SpO₂ : 98 % @ Room Air", "Weight : 59 kg", "", "No Clubbing", "No Cyanosis", "No Jaundice", "No Pedal Oedema", "No Anaemia (clinically)", ], "SYSTEMIC EXAMINATION", [ "CVS : S1 S2 heard, no murmur", "RS : BAE +, Bilateral scattered wheeze present", "P/A : Soft, Non-tender", "CNS : No focal neurological deficit (NFND)", "", "On review (06-04-2026 8 PM):", " BP 110/80 | PR 82 | RR 20 | SpO₂ 98% | T 97.6 °F", " RS: BAE+, Bilateral wheeze +", "", "On review (07-04-2026):", " BP 120/80 | PR 85 | RR 19 | SpO₂ 99% | T 97.1 °F", " RS: BAE+, B/L wheeze +", "", "On review (08-04-2026):", " BP 110/70 | PR 79 | RR 18 | SpO₂ 98% | T 97.5 °F", " RS: BAE+, wheeze mild", ], font_size=13) # ── SLIDE 7 : Lab Investigations ───────────────────────────────────────── two_col_slide(prs, "OBJECTIVE – Laboratory Investigations", "HAEMATOLOGY & BIOCHEMISTRY (06-04-2026)", [ "CBC:", " Hb : 10.9 g/dL (↓ – Microcytic Anaemia)", " WBC : 9,800 cells/µL", " Platelets : 5,24,000 /µL", " PCV : 32.4 %", " MCV : 67.7 fL (↓)", " MCH : 22.8 pg (↓)", "", "RBS : 148 mg/dL", "CRP : Negative (4.44 mg/dL)", "", "LFT:", " Total Bilirubin : 0.44 mg/dL", " SGOT : 14 IU/L", " SGPT : 13 IU/L", " S. Globulin : 2.3 g/dL", "", "RFT:", " S. Urea : 26 mg/dL", " S. Creatinine : 0.7 mg/dL", ], "INVESTIGATIONS (cont.)", [ "Serum Electrolytes:", " Na⁺ : 138 mEq/L (Normal)", " K⁺ : 3.8 mEq/L (Normal)", " Cl⁻ : 104 mEq/L (Normal)", "", "Urine Routine/Examination:", " pH : 5.0 – 5.5", " Protein : Trace", " Sugar : Nil", " Ketone : Negative", " Pus cells : 4–6 /HPF", " RBC : 1–2 /HPF", " Bacteria : ++ (UTI likely)", "", "Pending Investigations:", " Chest X-ray PA view", " ECG", " Sputum C/S", " Urine C/S (follow-up)", " Peak Flow Rate / Spirometry", ], font_size=13) # ── SLIDE 8 : ASSESSMENT (Diagnosis) ────────────────────────────────────── section_slide(prs, "ASSESSMENT") content_slide(prs, "ASSESSMENT – Diagnosis", [ "PROVISIONAL DIAGNOSIS (Admission)", " ALE of BA → Acute Exacerbation of Bronchial Asthma", "", "FINAL DIAGNOSIS", " Acute Exacerbation of Bronchial Asthma (AE of BA)", " + Concurrent Urinary Tract Infection (Urine: Bacteria ++, Pus cells 4-6)", " + Microcytic Hypochromic Anaemia (Hb 10.9, MCV 67.7, MCH 22.8)", "", "CLINICAL REASONING", " Triggers: Possible RTI (cough + expectoration + running nose + low-grade fever)", " Bronchospasm evidenced by: Bilateral scattered wheeze, RR 20/min, SpO₂ 98%", " Known asthmatic (14 yrs) – stepped down treatment at home with inhalers", " Fever resolved – CRP mildly elevated (4.44) suggesting resolving infection", " Weight loss 8 kg / 20 days → monitor for other causes", " Urine bacteria ++ → antibiotic cover added (Norflox / Taxim)", " Insomnia documented – assess for steroid-induced or anxiety-related cause", ], font_size=16) # ── SLIDE 9 : PLAN section header ──────────────────────────────────────── section_slide(prs, "PLAN") # ── SLIDE 10 : Drug Chart ──────────────────────────────────────────────── content_slide(prs, "PLAN – Drug Chart (In-Patient Treatment)", [ "INJECTIONS (IV)", " 1. Inj. TAXIM (Cefotaxime) 1 g IV BD [ATD] – Antibiotic for RTI/UTI", " 2. Inj. HYDROCORT (Hydrocortisone) 100 mg IV BD – Anti-inflammatory / Bronchodilator", " 3. Inj. MgSO₄ 2 g in 100 mL NS IV OD over 20 mins – Bronchospasm relief", " 4. Inj. PAN (Pantoprazole) 40 mg IV BD – Gastroprotection (steroid cover)", " 5. Inj. DERIPHYLLINE (Etofylline + Theophylline) 2 cc IV BD – Bronchodilator", " 6. Inj. EMESET (Ondansetron) 4 mg IV 1-0-1 – Anti-emetic", "", "ORAL TABLETS", " 7. T. AZEE (Azithromycin) 500 mg 1-0-0 – Antibiotic (atypical cover)", " 8. T. MONDESELOR (Montelukast + Desloratadine) 1-0-1 – Leukotriene antagonist", " 9. T. PULMOLEAR (Acebrophylline) 1-0-1 – Mucolytic + Bronchodilator", " 10. T. PARA (Paracetamol) 500 mg 1-1-1 – Antipyretic / Analgesic", "", "NEBULISATIONS", " 11. Neb. DUOLIN + BUDECORT Q8H – Ipratropium + Salbutamol / Budesonide", " 12. Neb. NAC (N-Acetylcysteine) TDS – Mucolytic", "", "SYRUPS", " 13. Syp. ASCORIL LS 5 mL TDS – Expectorant (Levosalbutamol + Bromhexine)", " 14. Fluticasone Nasal Spray HS – Nasal corticosteroid for rhinitis", " 15. Syp. LACTULOSE 15 mL HS – Laxative (constipation precaution on opioids/codeine)", " 16. T. NORFLOX 100 mg 1-0-1 – Added for UTI (Bacteria ++ urine)", ], font_size=14) # ── SLIDE 11 : Non-pharmacological Plan ───────────────────────────────── content_slide(prs, "PLAN – Non-Pharmacological & Monitoring", [ "NON-PHARMACOLOGICAL MEASURES", " Bed rest; head-end elevation (semi-Fowler's position)", " Avoid known triggers: dust, smoke, cold air, allergens", " Adequate hydration (oral); Nutritious diet for weight gain", " Regular nebulization technique education", " Incentive spirometry / breathing exercises post-acute phase", " Patient counselled on inhaler technique (Tiova + Budamate Rotacaps)", "", "MONITORING PARAMETERS", " Vitals (BP, PR, RR, SpO₂, Temperature) – every 8 hours", " Peak Expiratory Flow Rate (PEFR) – daily", " Chest X-ray PA view – initial + follow-up", " CBC, S. Electrolytes – repeat as clinically indicated", " Urine C/S – follow-up to guide antibiotic change if needed", " Sputum C/S – to guide antibiotic sensitivity", " Blood glucose monitoring (steroid-induced hyperglycaemia – RBS 148 mg/dL on Day 1)", " Watch for hypokalaemia (Salbutamol + IV MgSO₄)", " Theophylline toxicity signs (Deriphylline): nausea, palpitation, tremors", ], font_size=16) # ── SLIDE 12 : Discharge Summary ──────────────────────────────────────── content_slide(prs, "PLAN – Discharge Summary", [ "Patient showed progressive clinical improvement:", " Day 1 → Day 4: wheeze decreased from 'scattered' to 'mild'", " Afebrile from Day 2 onwards", " No specific complaints on daily review", " SpO₂ maintained ≥ 98% on room air throughout", "", "DISCHARGE MEDICATIONS", " 1. T. Azithromycin (Azee) 500 mg 1-0-0", " 2. T. Montelukast+Desloratadine (Mondeselor) 1-0-1", " 3. T. Acebrophylline (Pulmolear) 1-0-1", " 4. T. Paracetamol 500 mg 1-1-1 (SOS)", " 5. Neb. Duolin + Budecort Q8H", " 6. Neb. NAC TDS", " 7. Syp. Ascoril LS 5 mL TDS", " 8. Fluticasone Nasal Spray HS", " 9. Syp. Lactulose 15 mL HS", " 10. T. Norflox 100 mg 1-0-1 (complete course)", "", "DISCHARGE ADVICE", " Continue home inhalers: Tiova Rotacaps + Budamate Rotacaps as prescribed", " Avoid triggers; follow-up in Respiratory Medicine OPD within 1 week", " Repeat CBC / Urine C/S at follow-up", " Return if breathlessness / wheeze worsens", ], font_size=15) # ── SLIDE 13 : Thank You ───────────────────────────────────────────────── slide13 = blank_slide(prs) set_bg(slide13, DARK_BLUE) add_rect(slide13, 0, 0, 13.33, 0.20, MID_BLUE) add_rect(slide13, 0, 7.30, 13.33, 0.20, MID_BLUE) add_rect(slide13, 1.5, 3.45, 10.33, 0.06, YELLOW) add_textbox(slide13, "THANK YOU", 0.5, 3.0, 12.33, 1.5, font_size=52, bold=True, color=WHITE, align=PP_ALIGN.CENTER) # ── Save ───────────────────────────────────────────────────────────────── out = "/tmp/workspace/sandhya_soap/Sandhya_SOAP_Analysis.pptx" prs.save(out) print(f"Saved: {out}") PYEOF
python3 -c " from pptx import Presentation prs = Presentation('/tmp/workspace/sandhya_soap/Sandhya_SOAP_Analysis.pptx') print(f'Slides: {len(prs.slides)}') for i, slide in enumerate(prs.slides, 1): texts = [] for shape in slide.shapes: if shape.has_text_frame: t = shape.text_frame.text.strip() if t: texts.append(t[:80]) print(f'Slide {i}: {\" | \".join(texts[:3])}') "
Sandhya SOAP Analysis
Presentation · PPTX
| Slide | Content |
|---|---|
| 1 | Title slide – "SOAP Analysis / Pharmacotherapeutics-I / AE of BA" |
| 2 | SUBJECTIVE section header |
| 3 | Patient details, Chief Complaints (chest tightness, cough, running nose × 6 days; fever; wt loss; nausea; insomnia) |
| 4 | HPI + Past History / Family / Menstrual / Personal History (two-column) |
| 5 | OBJECTIVE section header |
| 6 | General Examination + Vitals + Serial Systemic Examination (day-wise) |
| 7 | Lab values: CBC (Hb 10.9, MCV 67.7 - microcytic anaemia), LFT, RFT, CRP, Electrolytes, Urine R/E (UTI) |
| 8 | ASSESSMENT section header |
| 9 | Final Diagnosis: AE of Bronchial Asthma + UTI + Microcytic Anaemia + clinical reasoning |
| 10 | PLAN section header |
| 11 | Drug Chart: all 16 drugs with routes, frequencies, and pharmacological rationale |
| 12 | Non-pharmacological measures + monitoring parameters |
| 13 | Discharge summary + discharge medications |
| 14 | Thank You |
Why this drugs are given to the patient
| Drug | Class | Indication in DCLD |
|---|---|---|
| Inj. Thiamine | Vitamin B1 | Wernicke's encephalopathy prevention |
| Inj. Neurobion Forte | B1+B6+B12 | Alcoholic neuropathy / muscle cramps |
| T. Dytor | Loop diuretic | Ascites management |
| T. UDCA | Bile acid | Hepatoprotection / cholestasis |
| Cap. Rifaximin | Non-absorbable antibiotic | Hepatic encephalopathy (↓ gut NH₃) |
| T. Evion LC | Vit E + L-Carnitine | Antioxidant / muscle energy support |
| Syp. Lactulose | Osmotic laxative | Hepatic encephalopathy (NH₃ trapping) |
Make the drugs chat by using this Drugs
mkdir -p /tmp/workspace/sandhya_soap && python3 << 'PYEOF' from pptx import Presentation from pptx.util import Inches, Pt, Emu from pptx.dml.color import RGBColor from pptx.enum.text import PP_ALIGN from pptx.oxml.ns import qn from lxml import etree # ── Colours ────────────────────────────────────────────────────────────── DARK_BLUE = RGBColor(0x1F, 0x39, 0x64) MID_BLUE = RGBColor(0x2E, 0x74, 0xB5) ROW_BLUE = RGBColor(0xBD, 0xD7, 0xEE) WHITE = RGBColor(0xFF, 0xFF, 0xFF) NEAR_BLACK = RGBColor(0x10, 0x10, 0x10) YELLOW = RGBColor(0xFF, 0xC0, 0x00) HDR_BG = RGBColor(0x1F, 0x39, 0x64) prs = Presentation() prs.slide_width = Inches(13.33) prs.slide_height = Inches(7.50) def blank_slide(prs): return prs.slides.add_slide(prs.slide_layouts[6]) def set_bg(slide, color): bg = slide.background; fill = bg.fill fill.solid(); fill.fore_color.rgb = color def add_rect(slide, l, t, w, h, fill_color, line_color=None): shape = slide.shapes.add_shape(1, Inches(l), Inches(t), Inches(w), Inches(h)) shape.fill.solid(); shape.fill.fore_color.rgb = fill_color if line_color: shape.line.color.rgb = line_color else: shape.line.fill.background() return shape def add_textbox(slide, text, l, t, w, h, font_size=20, bold=False, color=WHITE, align=PP_ALIGN.LEFT, wrap=True): txb = slide.shapes.add_textbox(Inches(l), Inches(t), Inches(w), Inches(h)) tf = txb.text_frame; tf.word_wrap = wrap p = tf.paragraphs[0]; p.alignment = align run = p.add_run() run.text = text; run.font.size = Pt(font_size) run.font.bold = bold; run.font.color.rgb = color return txb # ─── helper: set a table cell's fill colour ────────────────────────────── def set_cell_color(cell, rgb: RGBColor): tc = cell._tc tcPr = tc.get_or_add_tcPr() # remove any existing solidFill for old in tcPr.findall(qn('a:solidFill')): tcPr.remove(old) solidFill = etree.SubElement(tcPr, qn('a:solidFill')) srgbClr = etree.SubElement(solidFill, qn('a:srgbClr')) srgbClr.set('val', f'{rgb[0]:02X}{rgb[1]:02X}{rgb[2]:02X}') def cell_text(cell, text, font_size=11, bold=False, color=NEAR_BLACK, align=PP_ALIGN.CENTER): tf = cell.text_frame; tf.word_wrap = True p = tf.paragraphs[0]; p.alignment = align # clear any existing runs for run in p.runs: run.text = '' run = p.add_run() run.text = text; run.font.size = Pt(font_size) run.font.bold = bold; run.font.color.rgb = color # ═══════════════════════════════════════════════════════════════════════════ # SLIDE 1 – Title card # ═══════════════════════════════════════════════════════════════════════════ slide1 = blank_slide(prs) set_bg(slide1, DARK_BLUE) add_rect(slide1, 0, 0, 13.33, 0.20, MID_BLUE) add_rect(slide1, 0, 7.30, 13.33, 0.20, MID_BLUE) add_rect(slide1, 1.5, 2.55, 10.33, 0.06, YELLOW) add_rect(slide1, 1.5, 4.85, 10.33, 0.06, YELLOW) add_textbox(slide1, "SECOND SESSIONAL PRACTICAL EXAMINATION", 0.5, 0.6, 12.33, 0.9, font_size=22, bold=True, color=YELLOW, align=PP_ALIGN.CENTER) add_textbox(slide1, "PHARMACOTHERAPEUTICS - I", 0.5, 1.55, 12.33, 0.9, font_size=30, bold=True, color=WHITE, align=PP_ALIGN.CENTER) add_textbox(slide1, "PLAN – DRUG CHART", 0.5, 2.65, 12.33, 0.9, font_size=40, bold=True, color=WHITE, align=PP_ALIGN.CENTER) add_textbox(slide1, "CASE: ACUTE EXACERBATION OF BRONCHIAL ASTHMA", 0.5, 3.6, 12.33, 0.65, font_size=20, bold=True, color=YELLOW, align=PP_ALIGN.CENTER) add_textbox(slide1, "Patient: Mrs. K. Sandhiya | 27 / F | IP No.: IP260406067\nDate of Admission: 06-April-2026 | Nandha Medical College & Hospital", 0.5, 4.95, 12.33, 1.0, font_size=16, bold=False, color=WHITE, align=PP_ALIGN.CENTER) # ═══════════════════════════════════════════════════════════════════════════ # SLIDE 2 – Drug Chart Part 1 (Drugs 1-8) # ═══════════════════════════════════════════════════════════════════════════ # Drug data: (No., Drug Name, Dose, Route, Frequency, Category, Indication) drugs_all = [ ("1", "Inj. TAXIM\n(Cefotaxime)", "1 g", "IV", "BD", "Injection", "Antibiotic – RTI / UTI"), ("2", "Inj. HYDROCORT\n(Hydrocortisone)", "100 mg", "IV", "BD", "Injection", "Anti-inflammatory / Bronchodilation"), ("3", "Inj. MgSO₄", "2 g in 100 mL NS","IV", "OD\n(20 min)","Injection","Bronchospasm relief / Smooth muscle relax."), ("4", "Inj. PAN\n(Pantoprazole)", "40 mg", "IV", "BD", "Injection", "Gastroprotection (steroid cover)"), ("5", "Inj. DERIPHYLLINE\n(Etofylline+Theophylline)","2 cc", "IV", "BD", "Injection", "Bronchodilator – Methylxanthine"), ("6", "Inj. EMESET\n(Ondansetron)", "4 mg", "IV", "1-0-1", "Injection", "Anti-emetic (5-HT₃ antagonist)"), ("7", "T. AZEE\n(Azithromycin)", "500 mg", "Oral", "1-0-0", "Tablet", "Antibiotic – Atypical/Macrolide cover"), ("8", "T. MONDESELOR\n(Montelukast+Desloratadine)","1 Tab", "Oral", "1-0-1", "Tablet", "Leukotriene antagonist + Antihistamine"), ("9", "T. PULMOLEAR\n(Acebrophylline)", "1 Tab", "Oral", "1-0-1", "Tablet", "Mucolytic + Bronchodilator"), ("10", "T. PARA\n(Paracetamol)", "500 mg", "Oral", "1-1-1", "Tablet", "Antipyretic / Analgesic"), ("11", "Neb. DUOLIN\n(Ipratropium+Salbutamol)","1 unit dose", "Neb.", "Q8H", "Nebulisation", "Bronchodilation – SABA + Anticholinergic"), ("12", "Neb. BUDECORT\n(Budesonide)", "1 unit dose", "Neb.", "Q8H", "Nebulisation", "Inhaled corticosteroid – Anti-inflammatory"), ("13", "Neb. NAC\n(N-Acetylcysteine)", "1 unit dose", "Neb.", "TDS", "Nebulisation", "Mucolytic – breaks disulphide bonds"), ("14", "Syp. ASCORIL LS\n(Levosalbutamol+Bromhexine)","5 mL", "Oral", "TDS", "Syrup", "Expectorant + Bronchodilator"), ("15", "Fluticasone\nNasal Spray", "2 puffs", "Nasal","HS", "Spray", "Nasal corticosteroid – Rhinitis control"), ("16", "Syp. LACTULOSE", "15 mL", "Oral", "HS", "Syrup", "Osmotic laxative – prevent constipation"), ("17", "T. NORFLOX\n(Norfloxacin)", "100 mg", "Oral", "1-0-1", "Tablet", "Antibiotic – UTI (Bacteria++ urine)"), ] # Column widths (total = 12.8 in) col_w = [0.45, 1.80, 1.20, 0.70, 0.90, 1.10, 4.65] col_headers = ["S.No", "Drug Name", "Dose", "Route", "Frequency", "Category", "Indication / Rationale"] def make_drug_table_slide(prs, title, drug_rows, slide_num, total_slides): slide = blank_slide(prs) set_bg(slide, WHITE) # Title bar add_rect(slide, 0, 0, 13.33, 0.95, DARK_BLUE) add_textbox(slide, title, 0.25, 0.08, 12.8, 0.80, font_size=26, bold=True, color=WHITE, align=PP_ALIGN.LEFT) # Bottom bar add_rect(slide, 0, 7.30, 13.33, 0.20, MID_BLUE) # Slide number add_textbox(slide, f"Slide {slide_num} of {total_slides}", 11.8, 7.25, 1.4, 0.25, font_size=10, bold=False, color=WHITE, align=PP_ALIGN.RIGHT) rows = len(drug_rows) + 1 # +1 for header tbl_top = Inches(1.05) tbl_h = Inches(6.10) tbl_l = Inches(0.26) tbl_w = Inches(12.80) table = slide.shapes.add_table(rows, len(col_w), tbl_l, tbl_top, tbl_w, tbl_h).table # Set column widths for ci, w in enumerate(col_w): table.columns[ci].width = Inches(w) # Header row for ci, hdr in enumerate(col_headers): cell = table.cell(0, ci) set_cell_color(cell, HDR_BG) cell_text(cell, hdr, font_size=12, bold=True, color=WHITE, align=PP_ALIGN.CENTER) # Data rows for ri, row_data in enumerate(drug_rows, start=1): no, name, dose, route, freq, cat, indication = row_data bg = ROW_BLUE if ri % 2 == 0 else WHITE values = [no, name, dose, route, freq, cat, indication] for ci, val in enumerate(values): cell = table.cell(ri, ci) set_cell_color(cell, bg) align = PP_ALIGN.LEFT if ci in (1, 6) else PP_ALIGN.CENTER cell_text(cell, val, font_size=10, bold=(ci==1), color=NEAR_BLACK, align=align) return slide # Split into 2 slides: drugs 1-9 and drugs 10-17 make_drug_table_slide(prs, "PLAN – Drug Chart (In-Patient Treatment) | Part 1: Drugs 1–9", drugs_all[:9], 2, 4) make_drug_table_slide(prs, "PLAN – Drug Chart (In-Patient Treatment) | Part 2: Drugs 10–17", drugs_all[9:], 3, 4) # ═══════════════════════════════════════════════════════════════════════════ # SLIDE 5 – Category-wise summary slide # ═══════════════════════════════════════════════════════════════════════════ slide5 = blank_slide(prs) set_bg(slide5, WHITE) add_rect(slide5, 0, 0, 13.33, 0.95, DARK_BLUE) add_textbox(slide5, "PLAN – Drug Chart Summary by Category", 0.25, 0.08, 12.8, 0.80, font_size=26, bold=True, color=WHITE, align=PP_ALIGN.LEFT) add_rect(slide5, 0, 7.30, 13.33, 0.20, MID_BLUE) categories = [ ("INJECTIONS (IV)", MID_BLUE, [ "1. Inj. Taxim (Cefotaxime) 1g IV BD – Antibiotic", "2. Inj. Hydrocort (Hydrocortisone) 100mg IV BD – Anti-inflammatory", "3. Inj. MgSO₄ 2g in 100 mL NS IV OD – Bronchospasm relief", "4. Inj. Pan (Pantoprazole) 40mg IV BD – Gastroprotection", "5. Inj. Deriphylline 2cc IV BD – Bronchodilator", "6. Inj. Emeset (Ondansetron) 4mg IV 1-0-1 – Anti-emetic", ]), ("ORAL TABLETS", MID_BLUE, [ "7. T. Azee (Azithromycin) 500mg 1-0-0 – Antibiotic", "8. T. Mondeselor (Montelukast+Desloratadine) 1-0-1 – Leukotriene antagonist", "9. T. Pulmolear (Acebrophylline) 1-0-1 – Mucolytic + Bronchodilator", "10. T. Para (Paracetamol) 500mg 1-1-1 – Antipyretic", "17. T. Norflox 100mg 1-0-1 – Antibiotic for UTI", ]), ("NEBULISATIONS", MID_BLUE, [ "11. Neb. Duolin (Ipratropium+Salbutamol) Q8H – SABA + Anticholinergic", "12. Neb. Budecort (Budesonide) Q8H – Inhaled corticosteroid", "13. Neb. NAC TDS – Mucolytic", ]), ("SYRUPS / SPRAYS", MID_BLUE, [ "14. Syp. Ascoril LS 5mL TDS – Expectorant + Bronchodilator", "15. Fluticasone Nasal Spray HS – Nasal corticosteroid", "16. Syp. Lactulose 15mL HS – Osmotic laxative", ]), ] # Left column: categories 0,1 | Right column: categories 2,3 def render_category(slide, cat_name, bg_color, items, l, t, w): # Section header bar add_rect(slide, l, t, w, 0.38, bg_color) add_textbox(slide, cat_name, l+0.05, t+0.02, w-0.1, 0.36, font_size=13, bold=True, color=WHITE) cur_t = t + 0.42 for item in items: add_textbox(slide, " " + item, l+0.05, cur_t, w-0.1, 0.28, font_size=11, bold=False, color=NEAR_BLACK) cur_t += 0.29 return cur_t # Left column t = 1.05 for cat in categories[:2]: t = render_category(slide5, cat[0], cat[1], cat[2], 0.26, t, 6.2) + 0.10 # Right column t2 = 1.05 for cat in categories[2:]: t2 = render_category(slide5, cat[0], cat[1], cat[2], 6.87, t2, 6.2) + 0.10 # ═══════════════════════════════════════════════════════════════════════════ # Save out = "/tmp/workspace/sandhya_soap/Sandhya_Drug_Chart.pptx" prs.save(out) print(f"Saved: {out}") print(f"Slides: {len(prs.slides)}") PYEOF
python3 -c " from pptx import Presentation prs = Presentation('/tmp/workspace/sandhya_soap/Sandhya_Drug_Chart.pptx') print(f'Total slides: {len(prs.slides)}') for i, slide in enumerate(prs.slides, 1): texts = [s.text_frame.text.strip()[:60] for s in slide.shapes if s.has_text_frame and s.text_frame.text.strip()] print(f'Slide {i}: {texts[:2]}') # count table rows if any for shape in slide.shapes: if shape.shape_type == 19: # TABLE print(f' Table: {shape.table.rows.__len__()} rows x {len(shape.table.columns)} cols') "
Sandhya Drug Chart
Presentation · PPTX
| Slide | Content |
|---|---|
| 1 | Title card - PLAN Drug Chart / Sandhya case / AE of BA |
| 2 | Drug table Part 1 - Drugs 1 to 9 (7 columns: S.No, Drug Name, Dose, Route, Frequency, Category, Indication) |
| 3 | Drug table Part 2 - Drugs 10 to 17 |
| 4 | Category-wise summary (Injections / Oral Tablets / Nebulisations / Syrups & Sprays) |
Why this drug is administered to this patient
Which drug would you like me to explain?
Diagnosis: Acute Exacerbation of Bronchial Asthma (AE of BA) + Urinary Tract Infection + Microcytic Anaemia Known asthmatic since 14 years, on home inhalers
| # | Drug | Class | Key Indication in Sandhiya's Case |
|---|---|---|---|
| 1 | Inj. Taxim | 3rd-gen Cephalosporin | RTI trigger + UTI (Bacteria++) |
| 2 | Inj. Hydrocort | Systemic corticosteroid | Airway inflammation in AE of BA |
| 3 | Inj. MgSO₄ | Smooth muscle relaxant | Bronchospasm – bilateral wheeze |
| 4 | Inj. Pan | PPI | Gastroprotection (steroid cover) |
| 5 | Inj. Deriphylline | Methylxanthine | Add-on bronchodilation |
| 6 | Inj. Emeset | 5-HT₃ antagonist | Nausea (symptom + drug side effect) |
| 7 | T. Azee | Macrolide antibiotic | Atypical pathogen cover + anti-inflam |
| 8 | T. Mondeselor | LTA + Antihistamine | Leukotrienes + allergic rhinitis |
| 9 | T. Pulmolear | Mucolytic + bronchodilator | Thick expectoration + airflow |
| 10 | T. Para | Antipyretic / analgesic | Fever (NSAIDs avoided in asthma) |
| 11 | Neb. Duolin | SABA + Anticholinergic | Primary bronchodilation (Q8H) |
| 12 | Neb. Budecort | Inhaled corticosteroid | Local airway anti-inflammation |
| 13 | Neb. NAC | Mucolytic | Break disulphide bonds in mucus |
| 14 | Syp. Ascoril LS | SABA + Mucolytic | Mucus clearance between nebulisations |
| 15 | Fluticasone Nasal | Nasal corticosteroid | United airway – rhinitis control |
| 16 | Syp. Lactulose | Osmotic laxative | Prevent medication-induced constipation |
| 17 | T. Norflox | Fluoroquinolone | UTI confirmed on urine microscopy |