Create a prescription for ibs

Asking for Preferences
Asking for Preferences
Reading File
Reading File
Finding Sources
Reading File
Reading File
Reading File
Running Command

mkdir -p /home/daytona/workspace/ibs-prescription && python3 - <<'PYEOF' from reportlab.lib.pagesizes import letter from reportlab.lib import colors from reportlab.lib.units import inch from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, HRFlowable from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_RIGHT import datetime output_path = "/home/daytona/workspace/ibs-prescription/IBS_D_Prescription.pdf" doc = SimpleDocTemplate( output_path, pagesize=letter, rightMargin=0.75*inch, leftMargin=0.75*inch, topMargin=0.6*inch, bottomMargin=0.6*inch ) styles = getSampleStyleSheet() # Custom styles header_style = ParagraphStyle( "ClinicHeader", parent=styles["Normal"], fontSize=15, fontName="Helvetica-Bold", textColor=colors.HexColor("#1a3a5c"), alignment=TA_CENTER, spaceAfter=2 ) sub_header_style = ParagraphStyle( "SubHeader", parent=styles["Normal"], fontSize=9, fontName="Helvetica", textColor=colors.HexColor("#444444"), alignment=TA_CENTER, spaceAfter=2 ) label_style = ParagraphStyle( "Label", parent=styles["Normal"], fontSize=8, fontName="Helvetica-Bold", textColor=colors.HexColor("#555555"), spaceAfter=1 ) value_style = ParagraphStyle( "Value", parent=styles["Normal"], fontSize=10, fontName="Helvetica", textColor=colors.black, spaceAfter=2 ) rx_symbol_style = ParagraphStyle( "RxSymbol", parent=styles["Normal"], fontSize=26, fontName="Helvetica-Bold", textColor=colors.HexColor("#1a3a5c"), spaceAfter=4 ) drug_name_style = ParagraphStyle( "DrugName", parent=styles["Normal"], fontSize=12, fontName="Helvetica-Bold", textColor=colors.black, spaceAfter=2 ) drug_detail_style = ParagraphStyle( "DrugDetail", parent=styles["Normal"], fontSize=10, fontName="Helvetica", leftIndent=20, spaceAfter=2 ) sig_style = ParagraphStyle( "Sig", parent=styles["Normal"], fontSize=10, fontName="Helvetica-Oblique", leftIndent=20, spaceAfter=6 ) note_style = ParagraphStyle( "Note", parent=styles["Normal"], fontSize=8.5, fontName="Helvetica", textColor=colors.HexColor("#333333"), spaceAfter=3 ) footer_style = ParagraphStyle( "Footer", parent=styles["Normal"], fontSize=8, fontName="Helvetica", textColor=colors.HexColor("#777777"), alignment=TA_CENTER, spaceAfter=2 ) diag_style = ParagraphStyle( "Diagnosis", parent=styles["Normal"], fontSize=10, fontName="Helvetica-Bold", textColor=colors.HexColor("#1a3a5c"), spaceAfter=4 ) today = datetime.date.today().strftime("%B %d, %Y") story = [] # ── CLINIC HEADER ──────────────────────────────────────────────── story.append(Paragraph("Gastroenterology & Internal Medicine Associates", header_style)) story.append(Paragraph("1234 Wellness Boulevard, Suite 200 · Springfield, ST 00000", sub_header_style)) story.append(Paragraph("Phone: (555) 123-4567 | Fax: (555) 123-4568", sub_header_style)) story.append(Paragraph("NPI: 1234567890 | DEA: AB1234567", sub_header_style)) story.append(HRFlowable(width="100%", thickness=2, color=colors.HexColor("#1a3a5c"), spaceAfter=8)) # ── PRESCRIBER / DATE ROW ──────────────────────────────────────── presciber_data = [ [ Paragraph("<b>Prescriber:</b>", label_style), Paragraph("<b>Date:</b>", label_style), Paragraph("<b>License #:</b>", label_style), ], [ Paragraph("Dr. Jane A. Smith, MD", value_style), Paragraph(today, value_style), Paragraph("MD-987654", value_style), ], ] prescriber_table = Table(presciber_data, colWidths=[3*inch, 2*inch, 2*inch]) prescriber_table.setStyle(TableStyle([ ("VALIGN", (0,0), (-1,-1), "TOP"), ("LEFTPADDING", (0,0), (-1,-1), 0), ("RIGHTPADDING", (0,0), (-1,-1), 4), ("BOTTOMPADDING", (0,0), (-1,-1), 2), ])) story.append(prescriber_table) story.append(HRFlowable(width="100%", thickness=0.5, color=colors.HexColor("#aaaaaa"), spaceBefore=6, spaceAfter=8)) # ── PATIENT INFO ROW ───────────────────────────────────────────── patient_data = [ [ Paragraph("<b>Patient Name:</b>", label_style), Paragraph("<b>Date of Birth:</b>", label_style), Paragraph("<b>MRN:</b>", label_style), ], [ Paragraph("John Q. Patient", value_style), Paragraph("MM/DD/YYYY", value_style), Paragraph("MRN-000001", value_style), ], [ Paragraph("<b>Address:</b>", label_style), Paragraph("<b>Phone:</b>", label_style), Paragraph("<b>Allergies:</b>", label_style), ], [ Paragraph("123 Main Street, Springfield, ST 00001", value_style), Paragraph("(555) 000-0000", value_style), Paragraph("NKDA", value_style), ], ] patient_table = Table(patient_data, colWidths=[3*inch, 2*inch, 2*inch]) patient_table.setStyle(TableStyle([ ("VALIGN", (0,0), (-1,-1), "TOP"), ("LEFTPADDING", (0,0), (-1,-1), 0), ("RIGHTPADDING", (0,0), (-1,-1), 4), ("BOTTOMPADDING", (0,0), (-1,-1), 2), ("BACKGROUND", (0,0), (-1,-1), colors.HexColor("#f4f8fc")), ("ROUNDEDCORNERS", [4,4,4,4]), ("BOX", (0,0), (-1,-1), 0.5, colors.HexColor("#c0cfe0")), ])) story.append(patient_table) story.append(HRFlowable(width="100%", thickness=0.5, color=colors.HexColor("#aaaaaa"), spaceBefore=8, spaceAfter=6)) # ── DIAGNOSIS ──────────────────────────────────────────────────── story.append(Paragraph("Diagnosis: Irritable Bowel Syndrome - Diarrhea Predominant (IBS-D) | ICD-10: K58.0", diag_style)) story.append(HRFlowable(width="100%", thickness=0.5, color=colors.HexColor("#aaaaaa"), spaceAfter=6)) # ── Rx SYMBOL ──────────────────────────────────────────────────── story.append(Paragraph("℞", rx_symbol_style)) # ── MEDICATION 1: RIFAXIMIN ────────────────────────────────────── story.append(Paragraph("1. Rifaximin (Xifaxan) 550 mg tablets", drug_name_style)) story.append(Paragraph("Quantity: 42 tablets (14-day supply)", drug_detail_style)) story.append(Paragraph("Sig: Take 1 tablet (550 mg) by mouth THREE TIMES DAILY for 14 days.", sig_style)) story.append(Paragraph("Refills: 0 | Substitution: Permitted", drug_detail_style)) story.append(Paragraph( "<i>Note: Retreatment course may be repeated if symptoms recur. " "Rifaximin is a non-absorbed antibiotic; minimal systemic side effects expected.</i>", note_style )) story.append(Spacer(1, 0.1*inch)) # ── MEDICATION 2: LOPERAMIDE ───────────────────────────────────── story.append(Paragraph("2. Loperamide HCl (Imodium) 2 mg capsules", drug_name_style)) story.append(Paragraph("Quantity: 60 capsules (PRN supply)", drug_detail_style)) story.append(Paragraph( "Sig: Take 2 capsules (4 mg) by mouth after first loose stool, then 1 capsule (2 mg) after each subsequent " "loose stool. MAX 8 mg/day (OTC) or 16 mg/day (Rx). Use on an as-needed basis.", sig_style )) story.append(Paragraph("Refills: 2 | Substitution: Permitted", drug_detail_style)) story.append(Paragraph( "<i>Note: Loperamide reduces stool frequency and urgency but does not relieve abdominal pain or bloating. " "Discontinue if constipation develops.</i>", note_style )) story.append(Spacer(1, 0.1*inch)) # ── MEDICATION 3: DICYCLOMINE (antispasmodic) ──────────────────── story.append(Paragraph("3. Dicyclomine HCl (Bentyl) 20 mg capsules", drug_name_style)) story.append(Paragraph("Quantity: 90 capsules (30-day supply)", drug_detail_style)) story.append(Paragraph( "Sig: Take 1 capsule (20 mg) by mouth FOUR TIMES DAILY, 30–60 minutes before meals and at bedtime. " "May increase to 40 mg four times daily if tolerated after 1 week.", sig_style )) story.append(Paragraph("Refills: 1 | Substitution: Permitted", drug_detail_style)) story.append(Paragraph( "<i>Note: Anticholinergic antispasmodic for abdominal cramping and pain. " "Advise patient to report urinary retention, dry mouth, or blurred vision.</i>", note_style )) story.append(Spacer(1, 0.1*inch)) # ── NON-PHARMACOLOGICAL INSTRUCTIONS ──────────────────────────── story.append(HRFlowable(width="100%", thickness=0.5, color=colors.HexColor("#aaaaaa"), spaceBefore=4, spaceAfter=6)) story.append(Paragraph("<b>Non-Pharmacological Instructions:</b>", label_style)) instructions = [ "• Trial of low-FODMAP diet; eliminate lactose, beans, onions, cauliflower, and carbonated drinks.", "• Increase soluble dietary fiber (psyllium husk 1 tsp daily in water if tolerated).", "• Regular physical activity (30 min/day, 5 days/week).", "• Stress reduction techniques (CBT, mindfulness, or gut-directed hypnotherapy).", "• Probiotic supplement containing Bifidobacterium species may be considered.", "• Avoid NSAID overuse; hydrate adequately.", ] for item in instructions: story.append(Paragraph(item, note_style)) story.append(Spacer(1, 0.12*inch)) # ── FOLLOW-UP ──────────────────────────────────────────────────── story.append(Paragraph( "<b>Follow-up:</b> Return to clinic in 4 weeks to assess treatment response. " "Call office immediately for worsening symptoms, rectal bleeding, or fever.", note_style )) # ── SIGNATURE LINE ─────────────────────────────────────────────── story.append(HRFlowable(width="100%", thickness=0.5, color=colors.HexColor("#aaaaaa"), spaceBefore=12, spaceAfter=6)) sig_data = [ [ Paragraph("___________________________________", value_style), Paragraph("___________________________________", value_style), ], [ Paragraph("Prescriber Signature", label_style), Paragraph("Date", label_style), ], ] sig_table = Table(sig_data, colWidths=[4*inch, 3*inch]) sig_table.setStyle(TableStyle([ ("LEFTPADDING", (0,0), (-1,-1), 0), ("RIGHTPADDING", (0,0), (-1,-1), 0), ])) story.append(sig_table) # ── SECURITY NOTICE ────────────────────────────────────────────── story.append(Spacer(1, 0.1*inch)) story.append(HRFlowable(width="100%", thickness=1, color=colors.HexColor("#1a3a5c"), spaceAfter=4)) story.append(Paragraph( "⚠ This prescription is valid for 1 year from the date written. " "Unauthorized alteration is a criminal offense. " "For educational / illustrative purposes — not a legally valid prescription.", footer_style )) doc.build(story) print(f"PDF generated: {output_path}") PYEOF

The prescription PDF is ready. Here's your download link:

IBS D Prescription

PDF Document · PDF


Here's a summary of what's included in the prescription:
Diagnosis: IBS-D (K58.0)
Medications prescribed (evidence-based, sourced from Yamada's Textbook of Gastroenterology & Symptom to Diagnosis):
#DrugDoseRationale
1Rifaximin (Xifaxan) 550 mg3x daily x 14 daysNNT ~10.5; ACG/AGA Grade 2B
2Loperamide 2 mgPRN after loose stool, max 16 mg/dayReduces stool frequency/urgency
3Dicyclomine (Bentyl) 20 mg4x daily before mealsAntispasmodic for cramping/pain
Non-pharmacological instructions included: low-FODMAP diet, soluble fiber, exercise, stress reduction, and probiotics (Bifidobacterium).
Placeholders used: Dr. Jane A. Smith MD (prescriber), John Q. Patient (patient) - replace with actual details before use.
Disclaimer: This is a template for educational/illustrative purposes only and is not a legally valid prescription. Always have a licensed clinician review and sign before use.
This is a shared conversation. Sign in to Orris to start your own chat.