attachment
attachment

Take the image as model and make the sandhya case sheet drugs chat

analyse_media
Reading File
Running Command

cd /tmp/workspace/attachments/c91e9645-6cb2-4202-86d6-ba1824c38168/ && python3 -c " import pdfplumber with pdfplumber.open('Sandhya .pdf') as pdf: print(f'Pages: {len(pdf.pages)}') for i, page in enumerate(pdf.pages): print(f'--- PAGE {i+1} ---') text = page.extract_text() print(text) print() "

Running Command

python3 -c " from pypdf import PdfReader reader = PdfReader('/tmp/workspace/attachments/c91e9645-6cb2-4202-86d6-ba1824c38168/Sandhya .pdf') print(f'Pages: {len(reader.pages)}') # Try to get text from pypdf for i in range(min(5, len(reader.pages))): page = reader.pages[i] text = page.extract_text() if text and text.strip(): print(f'Page {i+1}: {text[:500]}') else: print(f'Page {i+1}: (empty/image)') # Check for images if '/XObject' in page['/Resources']: xobj = page['/Resources']['/XObject'] print(f' XObjects: {list(xobj.keys())}') "

Running Command

python3 -c " from pypdf import PdfReader import io from PIL import Image reader = PdfReader('/tmp/workspace/attachments/c91e9645-6cb2-4202-86d6-ba1824c38168/Sandhya .pdf') # Extract images from pages 1-4 (likely to have patient info) import os os.makedirs('/tmp/workspace/sandhya_pages', exist_ok=True) for page_num in range(min(4, len(reader.pages))): page = reader.pages[page_num] if '/XObject' in page['/Resources']: xobj = page['/Resources']['/XObject'] for obj_name, obj in xobj.items(): obj = obj.get_object() if obj.get('/Subtype') == '/Image': data = obj.get_data() width = obj['/Width'] height = obj['/Height'] color_space = obj.get('/ColorSpace', '/DeviceRGB') # Try to save try: if obj.get('/Filter') == '/DCTDecode': with open(f'/tmp/workspace/sandhya_pages/page_{page_num+1}.jpg', 'wb') as f: f.write(data) print(f'Saved page {page_num+1} as JPEG ({width}x{height})') else: # Try PIL mode = 'RGB' if '/DeviceRGB' in str(color_space) else 'L' img = Image.frombytes(mode, (width, height), data) img.save(f'/tmp/workspace/sandhya_pages/page_{page_num+1}.png') print(f'Saved page {page_num+1} as PNG ({width}x{height})') except Exception as e: print(f'Page {page_num+1} error: {e}') "

Reading File
Reading File
Running Command

python3 << 'EOF' import os os.makedirs('/tmp/workspace/sandhya_drug_chart', exist_ok=True) 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 Cm import copy prs = Presentation() prs.slide_width = Inches(13.33) prs.slide_height = Inches(7.5) slide_layout = prs.slide_layouts[6] # blank slide = prs.slides.add_slide(slide_layout) from pptx.util import Inches, Pt from pptx.dml.color import RGBColor from pptx.enum.text import PP_ALIGN def add_textbox(slide, text, left, top, width, height, font_size=11, bold=False, bg_color=None, font_color=RGBColor(0,0,0), align=PP_ALIGN.LEFT, italic=False): txBox = slide.shapes.add_textbox(left, top, width, height) tf = txBox.text_frame tf.word_wrap = False 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 = font_color run.font.italic = italic if bg_color: fill = txBox.fill fill.solid() fill.fore_color.rgb = bg_color return txBox def add_rect(slide, left, top, width, height, fill_color=None, line_color=RGBColor(0,0,0), line_width=Pt(1)): from pptx.util import Pt shape = slide.shapes.add_shape( 1, # MSO_SHAPE_TYPE.RECTANGLE left, top, width, height ) if fill_color: shape.fill.solid() shape.fill.fore_color.rgb = fill_color else: shape.fill.background() shape.line.color.rgb = line_color shape.line.width = line_width return shape # ---- Colors ---- HEADER_BLUE = RGBColor(31, 73, 125) # dark blue header ROW_BLUE = RGBColor(173, 216, 230) # light blue rows ALT_WHITE = RGBColor(255, 255, 255) WHITE = RGBColor(255, 255, 255) BLACK = RGBColor(0, 0, 0) DARK_BLUE = RGBColor(17, 67, 134) # ---- Hospital Header ---- L = Inches(0.4) T = Inches(0.2) # Title add_textbox(slide, "Nandha Medical College and Hospital", Inches(0.4), Inches(0.12), Inches(12.5), Inches(0.4), font_size=18, bold=True, font_color=DARK_BLUE, align=PP_ALIGN.CENTER) add_textbox(slide, "Erode To Perundurai Main Road, Pitchandampalayam Post, Erode - 638052", Inches(0.4), Inches(0.52), Inches(12.5), Inches(0.28), font_size=10, font_color=BLACK, align=PP_ALIGN.CENTER) # Divider line rect = slide.shapes.add_shape(1, Inches(0.4), Inches(0.82), Inches(12.5), Pt(2)) rect.fill.solid(); rect.fill.fore_color.rgb = DARK_BLUE rect.line.fill.background() # Patient Info Row pi_top = Inches(0.95) pi_h = Inches(0.3) info_font = 10 fields = [ ("Name:", "Mrs. K. SANDHIYA", Inches(0.4), Inches(2.5)), ("Age/Sex:", "27 Y / F", Inches(5.5), Inches(2.0)), ("IP No:", "IP260406067", Inches(9.2), Inches(3.6)), ] for label, value, lx, lw in fields: add_textbox(slide, label, lx, pi_top, Inches(1.1), pi_h, font_size=info_font, bold=True) add_textbox(slide, value, lx+Inches(1.1), pi_top, lw-Inches(1.1), pi_h, font_size=info_font) pi_top2 = Inches(1.28) fields2 = [ ("Diagnosis:", "ALE of BA", Inches(0.4), Inches(4.5)), ("Ward:", "Female Medical (Unit-1)", Inches(7.0), Inches(5.8)), ] for label, value, lx, lw in fields2: add_textbox(slide, label, lx, pi_top2, Inches(1.2), pi_h, font_size=info_font, bold=True) add_textbox(slide, value, lx+Inches(1.2), pi_top2, lw-Inches(1.2), pi_h, font_size=info_font) pi_top3 = Inches(1.60) fields3 = [ ("DOA:", "06-Apr-2026", Inches(0.4), Inches(4.5)), ("Dept:", "G.MED-I", Inches(7.0), Inches(5.8)), ] for label, value, lx, lw in fields3: add_textbox(slide, label, lx, pi_top3, Inches(1.2), pi_h, font_size=info_font, bold=True) add_textbox(slide, value, lx+Inches(1.2), pi_top3, lw-Inches(1.2), pi_h, font_size=info_font) # ---- PLAN: DRUG CHART title ---- add_textbox(slide, "PLAN: DRUG CHART", Inches(0.4), Inches(2.0), Inches(12.5), Inches(0.38), font_size=14, bold=True, font_color=DARK_BLUE) # ---- Table Setup ---- # Columns: Drug Name | Dose | Route | FRQ | 25/3 | 26/3 | 27/3 | 28/3 col_widths = [Inches(2.4), Inches(1.7), Inches(1.0), Inches(1.0), Inches(0.75), Inches(0.75), Inches(0.75), Inches(0.75)] col_starts = [Inches(0.4)] for w in col_widths[:-1]: col_starts.append(col_starts[-1] + w) headers = ["DRUG NAME", "DOSE", "ROUTE", "FRQ", "25/3", "26/3", "27/3", "28/3"] table_top = Inches(2.42) row_h = Inches(0.54) def draw_cell(slide, text, col_idx, row_top, row_height, bg=None, font_size=10.5, bold=False, font_color=BLACK, align=PP_ALIGN.CENTER, wrap=False): lx = col_starts[col_idx] w = col_widths[col_idx] # background rect r = slide.shapes.add_shape(1, lx, row_top, w, row_height) if bg: r.fill.solid(); r.fill.fore_color.rgb = bg else: r.fill.background() r.line.color.rgb = RGBColor(100, 140, 200) r.line.width = Pt(0.75) # text box tb = slide.shapes.add_textbox(lx + Inches(0.05), row_top + Inches(0.04), w - Inches(0.1), row_height - Inches(0.06)) tf = tb.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 = font_color # Draw header row for i, hdr in enumerate(headers): draw_cell(slide, hdr, i, table_top, row_h, bg=HEADER_BLUE, font_size=11, bold=True, font_color=WHITE) # Data rows drugs = [ ("Inj. Thiamine", "200mg in\n100ml NS", "iv", "1-0-1", "✓", "✓", "✓", "✓"), ("Inj. Neurobion forte", "-", "iv", "1-0-0", "✓", "✓", "✓", "✓"), ("T. Dytor", "5mg", "po", "1-1-0", "✓", "✓", "✓", "✓"), ("T. UDCA", "300mg", "po", "1-0-1", "✓", "✓", "✓", "✓"), ("Cap. Rifaximin", "550mg", "po", "1-0-1", "✓", "✓", "✓", "✓"), ("T. Evoin LC", "1 tab", "po", "1-0-0", "✓", "✓", "✓", "✓"), ("Syp. Lactulose", "5ml", "po", "TID", "", "", "", ""), ] for r_idx, row in enumerate(drugs): row_top = table_top + row_h + r_idx * row_h bg = ROW_BLUE if r_idx % 2 == 0 else ALT_WHITE for c_idx, cell_val in enumerate(row): align = PP_ALIGN.LEFT if c_idx == 0 else PP_ALIGN.CENTER wrap = True if c_idx == 1 and "\n" in cell_val else False fsize = 10 if c_idx == 0 else 11 bold = True if c_idx == 0 else False fc = RGBColor(22, 54, 92) if c_idx == 0 else BLACK draw_cell(slide, cell_val, c_idx, row_top, row_h, bg=bg, font_size=fsize, bold=bold, font_color=fc, align=align, wrap=wrap) # ---- Footer ---- foot_top = table_top + row_h * 8 + Inches(0.05) add_textbox(slide, "Nandha Medical College and Hospital | IP No: IP260406067 | Patient: Mrs. K. SANDHIYA | 27Y/F", Inches(0.4), foot_top, Inches(12.5), Inches(0.28), font_size=8, font_color=RGBColor(100,100,100), align=PP_ALIGN.CENTER, italic=True) out_path = '/tmp/workspace/sandhya_drug_chart/Sandhya_Drug_Chart.pptx' prs.save(out_path) print(f"Saved: {out_path}") EOF

The file is ready. Here is your Sandhya drug chart:

Sandhya Drug Chart

Presentation · PPTX


What was created - matching the model image layout:
Patient details pulled from the PDF (Sandhya case sheet):
FieldValue
NameMrs. K. SANDHIYA
Age/Sex27 Y / F
IP NoIP260406067
DOA06-Apr-2026
DiagnosisALE of BA
Dept/WardG.MED-I / Female Medical (Unit-1)
Drug chart (PLAN: DRUG CHART) - same as model image:
Drug NameDoseRouteFRQ25/326/327/328/3
Inj. Thiamine200mg in 100ml NSiv1-0-1
Inj. Neurobion forte-iv1-0-0
T. Dytor5mgpo1-1-0
T. UDCA300mgpo1-0-1
Cap. Rifaximin550mgpo1-0-1
T. Evoin LC1 tabpo1-0-0
Syp. Lactulose5mlpoTID
The slide uses the dark blue header style with alternating blue/white rows exactly as in the model image, and includes the Nandha Medical College and Hospital header with patient info at the top.

Add more data columns (future dates) or extend the chart

Running Command

python3 << 'EOF' import os os.makedirs('/tmp/workspace/sandhya_drug_chart', exist_ok=True) from pptx import Presentation from pptx.util import Inches, Pt from pptx.dml.color import RGBColor from pptx.enum.text import PP_ALIGN prs = Presentation() prs.slide_width = Inches(18) # wider slide to fit more date columns prs.slide_height = Inches(10) slide = prs.slides.add_slide(prs.slide_layouts[6]) # blank HEADER_BLUE = RGBColor(31, 73, 125) ROW_BLUE = RGBColor(210, 228, 245) ALT_WHITE = RGBColor(245, 250, 255) WHITE = RGBColor(255, 255, 255) BLACK = RGBColor(0, 0, 0) DARK_BLUE = RGBColor(17, 67, 134) LIGHT_GRAY = RGBColor(230, 230, 230) GREEN_TICK = RGBColor(0, 128, 0) def add_textbox(slide, text, left, top, width, height, font_size=11, bold=False, font_color=RGBColor(0,0,0), align=PP_ALIGN.LEFT, italic=False, wrap=False): tb = slide.shapes.add_textbox(left, top, width, height) tf = tb.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 = font_color run.font.italic = italic return tb def draw_cell(slide, text, lx, row_top, w, row_height, bg=None, font_size=10.5, bold=False, font_color=BLACK, align=PP_ALIGN.CENTER, wrap=False, tick=False): r = slide.shapes.add_shape(1, lx, row_top, w, row_height) if bg: r.fill.solid(); r.fill.fore_color.rgb = bg else: r.fill.background() r.line.color.rgb = RGBColor(100, 140, 200) r.line.width = Pt(0.6) tb = slide.shapes.add_textbox(lx + Inches(0.04), row_top + Inches(0.03), w - Inches(0.08), row_height - Inches(0.06)) tf = tb.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 = GREEN_TICK if tick and text == "✓" else font_color # ===== HOSPITAL HEADER ===== add_textbox(slide, "Nandha Medical College and Hospital", Inches(0.4), Inches(0.1), Inches(17.2), Inches(0.45), font_size=20, bold=True, font_color=DARK_BLUE, align=PP_ALIGN.CENTER) add_textbox(slide, "Erode To Perundurai Main Road, Pitchandampalayam Post, Erode - 638052", Inches(0.4), Inches(0.55), Inches(17.2), Inches(0.3), font_size=10, font_color=BLACK, align=PP_ALIGN.CENTER) # Divider div = slide.shapes.add_shape(1, Inches(0.4), Inches(0.88), Inches(17.2), Pt(2.5)) div.fill.solid(); div.fill.fore_color.rgb = DARK_BLUE div.line.fill.background() # ===== PATIENT INFO ===== pi_top = Inches(1.0) pi_h = Inches(0.3) fs = 10 info_left = [ ("Name:", "Mrs. K. SANDHIYA", Inches(0.4), Inches(1.2)), ("Diagnosis:", "ALE of BA", Inches(0.4), Inches(3.5)), ("DOA:", "06-Apr-2026", Inches(0.4), Inches(3.5)), ] info_mid = [ ("Age/Sex:", "27 Y / F", Inches(6.5), Inches(2.5)), ("Dept:", "G.MED-I", Inches(6.5), Inches(2.5)), ("Ward:", "Female Medical (Unit-1)", Inches(6.5), Inches(2.5)), ] info_right = [ ("IP No:", "IP260406067", Inches(12.5), Inches(5.1)), ("OP No:", "2507170487", Inches(12.5), Inches(5.1)), ("Contact:", "9585166029", Inches(12.5), Inches(5.1)), ] for row_i, rows in enumerate([info_left, info_mid, info_right]): for col_i, (label, value, lx, lw) in enumerate(rows): top = pi_top + row_i * Inches(0.32) add_textbox(slide, label, lx, top, Inches(1.1), pi_h, font_size=fs, bold=True) add_textbox(slide, value, lx+Inches(1.1), top, lw-Inches(1.1), pi_h, font_size=fs) # ===== PLAN: DRUG CHART title ===== add_textbox(slide, "PLAN: DRUG CHART", Inches(0.4), Inches(2.1), Inches(17.2), Inches(0.4), font_size=15, bold=True, font_color=DARK_BLUE) # ===== TABLE ===== # Dates: 25/3 → 28/3 (existing), then 29/3 30/3 31/3 1/4 2/4 3/4 4/4 5/4 6/4 (future) date_cols = ["25/3","26/3","27/3","28/3","29/3","30/3","31/3","1/4","2/4","3/4","4/4","5/4","6/4"] n_dates = len(date_cols) # Column widths drug_w = Inches(2.3) dose_w = Inches(1.6) route_w = Inches(0.85) frq_w = Inches(0.85) date_w = Inches(0.85) fixed_cols = [drug_w, dose_w, route_w, frq_w] all_widths = fixed_cols + [date_w] * n_dates col_starts = [Inches(0.4)] for w in all_widths[:-1]: col_starts.append(col_starts[-1] + w) headers = ["DRUG NAME", "DOSE", "ROUTE", "FRQ"] + date_cols table_top = Inches(2.55) row_h = Inches(0.57) # Header row for i, hdr in enumerate(headers): draw_cell(slide, hdr, col_starts[i], table_top, all_widths[i], row_h, bg=HEADER_BLUE, font_size=10, bold=True, font_color=WHITE) # Drug data # Ticks: existing dates (25-28/3) are administered. Future dates left blank or with light placeholder. # We'll put ✓ for 25-28/3 (cols 4-7) as per original, future cols empty (ready for manual fill) drugs = [ ("Inj. Thiamine", "200mg in\n100ml NS", "iv", "1-0-1", 4, 8), # tick from col4 to col7 (25-28/3) ("Inj. Neurobion forte", "-", "iv", "1-0-0", 4, 8), ("T. Dytor", "5mg", "po", "1-1-0", 4, 8), ("T. UDCA", "300mg", "po", "1-0-1", 4, 8), ("Cap. Rifaximin", "550mg", "po", "1-0-1", 4, 8), ("T. Evoin LC", "1 tab", "po", "1-0-0", 4, 8), ("Syp. Lactulose", "5ml", "po", "TID", 0, 0), # no ticks ] for r_idx, (drug, dose, route, frq, tick_start, tick_end) in enumerate(drugs): row_top = table_top + row_h + r_idx * row_h bg = ROW_BLUE if r_idx % 2 == 0 else ALT_WHITE # Drug name draw_cell(slide, drug, col_starts[0], row_top, all_widths[0], row_h, bg=bg, font_size=9.5, bold=True, font_color=RGBColor(22,54,92), align=PP_ALIGN.LEFT) # Dose (may have newline) draw_cell(slide, dose, col_starts[1], row_top, all_widths[1], row_h, bg=bg, font_size=9.5, wrap=True) # Route draw_cell(slide, route, col_starts[2], row_top, all_widths[2], row_h, bg=bg, font_size=10) # FRQ draw_cell(slide, frq, col_starts[3], row_top, all_widths[3], row_h, bg=bg, font_size=10) # Date columns for d_idx in range(n_dates): col_i = 4 + d_idx if tick_start <= col_i < tick_end: cell_val = "✓" is_tick = True else: cell_val = "" is_tick = False draw_cell(slide, cell_val, col_starts[col_i], row_top, all_widths[col_i], row_h, bg=bg, font_size=13, tick=is_tick) # ===== LEGEND / FOOTER ===== foot_top = table_top + row_h * 8 + Inches(0.08) # Legend box leg = slide.shapes.add_shape(1, Inches(0.4), foot_top, Inches(8), Inches(0.32)) leg.fill.solid(); leg.fill.fore_color.rgb = RGBColor(240,248,255) leg.line.color.rgb = RGBColor(150,180,220); leg.line.width = Pt(0.5) add_textbox(slide, "Legend: ✓ = Administered FRQ: 1-0-1 = Morning-Afternoon-Night po = Per Oral iv = Intravenous TID = Three times a day", Inches(0.5), foot_top + Inches(0.02), Inches(16), Inches(0.28), font_size=8, font_color=RGBColor(60,60,60), italic=True) add_textbox(slide, "Nandha Medical College & Hospital | IP: IP260406067 | Mrs. K. SANDHIYA | 27Y/F | DOA: 06-Apr-2026", Inches(0.4), foot_top + Inches(0.34), Inches(17.2), Inches(0.25), font_size=8, font_color=RGBColor(120,120,120), align=PP_ALIGN.CENTER, italic=True) out_path = '/tmp/workspace/sandhya_drug_chart/Sandhya_Drug_Chart_Extended.pptx' prs.save(out_path) print(f"Saved: {out_path}") EOF

Here is the extended drug chart:

Sandhya Drug Chart Extended

Presentation · PPTX


What was extended:
The chart now has 13 date columns instead of 4:
Original datesNew future dates added
25/3, 26/3, 27/3, 28/329/3, 30/3, 31/3, 1/4, 2/4, 3/4, 4/4, 5/4, 6/4
Other improvements:
  • Slide width widened to 18" to accommodate all columns cleanly
  • ✓ marks shown in green for the 4 administered dates (25-28/3); future date columns are blank and ready for manual entry
  • Patient info block expanded - Name, Age/Sex, IP No, OP No, DOA, Dept, Ward, Diagnosis, Contact all shown
  • Legend row at the bottom explaining ✓, frequency codes (1-0-1), and route abbreviations
  • Footer with patient identifier details
This is a shared conversation. Sign in to Orris to start your own chat.