presightlite / create_overdose_sample.py
sabareesh4317
Initial deployment (clean)
8b8fa39
Raw History Blame Contribute Delete
1.97 kB
from PIL import Image, ImageDraw, ImageFont
import os
# Create sample prescription
width, height = 600, 800
image = Image.new('RGB', (width, height), 'white')
draw = ImageDraw.Draw(image)
# Use default font
try:
# Try to load a better font if available
font = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf", 16)
header_font = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf", 20)
except:
font = ImageFont.load_default()
header_font = ImageFont.load_default()
# Draw prescription content
y_pos = 50
draw.text((50, y_pos), "CITY HOSPITAL - EMERGENCY", fill='black', font=header_font)
y_pos += 40
draw.text((50, y_pos), "Dr. Test Danger, MD", fill='black', font=font)
y_pos += 30
draw.text((50, y_pos), "License: 999999", fill='black', font=font)
y_pos += 50
draw.text((50, y_pos), "Patient: Little Timmy", fill='black', font=font)
y_pos += 30
draw.text((50, y_pos), "Age: 5 Years Old", fill='black', font=font)
y_pos += 25
draw.text((50, y_pos), "Date: 12/04/2025", fill='black', font=font)
y_pos += 50
draw.text((50, y_pos), "Rx:", fill='black', font=header_font)
y_pos += 40
# High Dosage 1
draw.text((70, y_pos), "1. Paracetamol 2000mg", fill='black', font=font)
y_pos += 25
draw.text((70, y_pos), " Take 2 tablets every 4 hours", fill='black', font=font)
y_pos += 40
# High Dosage 2
draw.text((70, y_pos), "2. Amoxicillin 1000mg", fill='black', font=font)
y_pos += 25
draw.text((70, y_pos), " Take 1 tablet 3 times daily", fill='black', font=font)
y_pos += 40
# High Dosage 3
draw.text((70, y_pos), "3. Ibuprofen 800mg", fill='black', font=font)
y_pos += 25
draw.text((70, y_pos), " Take 1 tablet 4 times daily", fill='black', font=font)
y_pos += 40
draw.text((50, y_pos + 50), "Signature: _________________", fill='black', font=font)
# Save
output_path = "sample_prescriptions/overdose_sample.jpg"
image.save(output_path, "JPEG", quality=95)
print(f"Created {output_path}")