A 25 yrs old female compliants of frequent urination and sometimes burning micturtion during less water intake she is not a hypertensive and diabetic
"urinary tract infections"[MeSH Terms] AND "women"[MeSH Terms]
Make a patient handout on UTI self-care
ls -la /tmp/workspace/ && mkdir -p /tmp/workspace/uti-handout
~/uti-handout/make_handout.py
from reportlab.lib.pagesizes import A4
from reportlab.lib.styles import ParagraphStyle
from reportlab.lib.units import mm
from reportlab.lib import colors
from reportlab.platypus import (SimpleDocTemplate, Paragraph, Spacer, Table,
TableStyle, KeepTogether)
OUT = "/tmp/workspace/uti-handout/UTI_Self_Care_Handout.pdf"
TEAL = colors.HexColor("#0F6E78")
LIGHT = colors.HexColor("#E6F4F5")
RED = colors.HexColor("#B3261E")
REDBG = colors.HexColor("#FDECEA")
GREY = colors.HexColor("#444444")
title = ParagraphStyle("t", fontName="Helvetica-Bold", fontSize=20, textColor=colors.white, leading=24)
sub = ParagraphStyle("s", fontName="Helvetica", fontSize=10.5, textColor=colors.white, leading=14)
h = ParagraphStyle("h", fontName="Helvetica-Bold", fontSize=12.5, textColor=TEAL, spaceBefore=9, spaceAfter=3, leading=15)
body = ParagraphStyle("b", fontName="Helvetica", fontSize=10, textColor=GREY, leading=13.5)
bul = ParagraphStyle("bl", parent=body, leftIndent=12, bulletIndent=2, spaceAfter=1.5)
redh = ParagraphStyle("rh", fontName="Helvetica-Bold", fontSize=12, textColor=RED, leading=15, spaceAfter=3)
small = ParagraphStyle("sm", parent=body, fontSize=8.5, leading=11, textColor=colors.HexColor("#666666"))
cell = ParagraphStyle("c", parent=body, fontSize=9.5, leading=12.5)
cellb = ParagraphStyle("cb", parent=cell, fontName="Helvetica-Bold", textColor=TEAL)
def bullets(items, style=bul):
return [Paragraph(i, style, bulletText="\u2022") for i in items]
story = []
# Header banner
banner = Table([[Paragraph("Urinary Tract Infection (UTI)", title)],
[Paragraph("A simple self-care guide for women with bladder infection symptoms", sub)]],
colWidths=[180 * mm])
banner.setStyle(TableStyle([
("BACKGROUND", (0, 0), (-1, -1), TEAL),
("LEFTPADDING", (0, 0), (-1, -1), 12), ("RIGHTPADDING", (0, 0), (-1, -1), 12),
("TOPPADDING", (0, 0), (0, 0), 10), ("BOTTOMPADDING", (0, -1), (-1, -1), 10),
]))
story += [banner, Spacer(1, 6)]
story += [Paragraph("What is a UTI?", h),
Paragraph("A UTI is an infection of the urinary system, most often the bladder (called cystitis). "
"Germs from the gut or skin travel up the short urethra into the bladder. "
"Women get UTIs more often than men because the urethra is shorter. "
"Most bladder infections are not dangerous when treated early.", body)]
story += [Paragraph("Common symptoms", h)]
sym = [
[Paragraph("Burning or pain when passing urine", cell), Paragraph("Passing urine very often, in small amounts", cell)],
[Paragraph("Strong, sudden urge to pass urine", cell), Paragraph("Pain or pressure in the lower tummy", cell)],
[Paragraph("Cloudy or strong-smelling urine", cell), Paragraph("Sometimes blood in the urine", cell)],
]
t = Table(sym, colWidths=[90 * mm, 90 * mm])
t.setStyle(TableStyle([("BACKGROUND", (0, 0), (-1, -1), LIGHT),
("BOX", (0, 0), (-1, -1), 0.5, TEAL),
("INNERGRID", (0, 0), (-1, -1), 0.25, colors.white),
("TOPPADDING", (0, 0), (-1, -1), 4), ("BOTTOMPADDING", (0, 0), (-1, -1), 4),
("LEFTPADDING", (0, 0), (-1, -1), 8)]))
story += [t]
story += [Spacer(1, 3), Paragraph("Symptoms can feel worse when you drink little water, because concentrated urine irritates the bladder lining.", body)]
story += [Paragraph("Please see a doctor (do not rely on self-care alone)", h),
Paragraph("A urine test confirms the diagnosis, and antibiotics are usually needed to clear a true bladder infection. "
"Self-care helps comfort and prevention. It does not replace treatment. "
"Tell your doctor if you could be pregnant, or if you have discharge or a new sexual partner, "
"because other infections can feel the same.", body)]
story += [Paragraph("Self-care while you have symptoms", h)]
story += bullets([
"<b>Take the full antibiotic course</b> if one is prescribed, even when you feel better after a day or two.",
"<b>Drink fluids regularly</b> through the day, enough to keep your urine pale yellow. "
"Fluids will not cure an infection on their own, but they help avoid concentrated, irritating urine.",
"<b>Pain relief:</b> paracetamol or an anti-inflammatory such as ibuprofen can ease discomfort. "
"Check with your doctor or pharmacist first if you have kidney, stomach or asthma problems, or are pregnant.",
"<b>Warmth:</b> a warm (not hot) water bottle on the lower tummy can ease cramping.",
"<b>Empty your bladder fully</b> each time. Do not hold urine.",
"<b>Cut down on bladder irritants</b> while you recover: coffee, strong tea, cola, alcohol, spicy food.",
"<b>Avoid sex</b> until symptoms settle, and avoid harsh soaps, douches and scented products in the genital area.",
])
story += [Paragraph("How to help prevent UTIs", h)]
story += bullets([
"<b>Drink enough water daily.</b> Regular drinking means regular voiding, which flushes bacteria out.",
"<b>Pass urine when you feel the need.</b> Do not hold it for long periods.",
"<b>Pass urine soon after sex.</b> This is one of the most useful habits for women prone to UTIs.",
"<b>Wipe from front to back</b> after using the toilet.",
"<b>Wash the genital area with plain water or mild soap.</b> Avoid douching, sprays and scented wipes.",
"<b>Wear cotton underwear</b> and avoid very tight clothing. Change out of wet swimwear or sweaty clothes promptly.",
"<b>Avoid spermicides and diaphragms</b> if you get repeated infections. Ask about other contraception.",
"<b>Do not rely on cranberry products.</b> Studies show little reliable benefit, so they are optional and not a substitute for the steps above.",
])
# Red flag box
flag_content = [Paragraph("Get medical help urgently if you have:", redh)] + bullets([
"Fever, chills or shaking",
"Pain in your back or side (below the ribs)",
"Nausea or vomiting, or you cannot keep fluids down",
"Blood in the urine that does not clear, or you cannot pass urine",
"Symptoms that are not improving after 2 to 3 days of treatment",
"You are pregnant, or symptoms come back soon after finishing antibiotics",
])
flag = Table([[flag_content]], colWidths=[180 * mm])
flag.setStyle(TableStyle([("BACKGROUND", (0, 0), (-1, -1), REDBG),
("BOX", (0, 0), (-1, -1), 1, RED),
("LEFTPADDING", (0, 0), (-1, -1), 10), ("RIGHTPADDING", (0, 0), (-1, -1), 10),
("TOPPADDING", (0, 0), (-1, -1), 7), ("BOTTOMPADDING", (0, 0), (-1, -1), 7)]))
story += [Spacer(1, 8), KeepTogether([flag])]
story += [Paragraph("When infections keep coming back", h),
Paragraph("Two or more UTIs in 6 months, or three or more in a year, are called recurrent UTIs. "
"See your doctor for a urine culture each time and a review of triggers. "
"Options include behaviour changes, and in some cases low-dose or after-sex antibiotics.", body)]
# Diary
story += [Paragraph("My notes", h)]
notes = Table([[Paragraph("Date symptoms started:", cellb), "", Paragraph("Antibiotic and days to take:", cellb), ""],
[Paragraph("Follow-up date:", cellb), "", Paragraph("Doctor or clinic number:", cellb), ""]],
colWidths=[38 * mm, 52 * mm, 42 * mm, 48 * mm], rowHeights=[9 * mm, 9 * mm])
notes.setStyle(TableStyle([("BOX", (0, 0), (-1, -1), 0.5, TEAL),
("INNERGRID", (0, 0), (-1, -1), 0.25, colors.lightgrey),
("VALIGN", (0, 0), (-1, -1), "MIDDLE"),
("BACKGROUND", (0, 0), (0, -1), LIGHT), ("BACKGROUND", (2, 0), (2, -1), LIGHT)]))
story += [notes, Spacer(1, 8),
Paragraph("This handout gives general information and does not replace advice from your own doctor. "
"Antibiotic choice depends on your health, pregnancy status and local resistance patterns. "
"Sources: Brenner and Rector's The Kidney; Tintinalli's Emergency Medicine; "
"Comprehensive Clinical Nephrology, 7th Ed; Textbook of Family Medicine, 9th Ed.", small)]
def footer(canvas, doc):
canvas.saveState()
canvas.setFont("Helvetica", 8)
canvas.setFillColor(colors.HexColor("#888888"))
canvas.drawString(15 * mm, 8 * mm, "UTI Self-Care Handout | Patient information")
canvas.drawRightString(A4[0] - 15 * mm, 8 * mm, "Page %d" % doc.page)
canvas.restoreState()
doc = SimpleDocTemplate(OUT, pagesize=A4, leftMargin=15 * mm, rightMargin=15 * mm,
topMargin=12 * mm, bottomMargin=15 * mm,
title="UTI Self-Care Handout", author="Orris")
doc.build(story, onFirstPage=footer, onLaterPages=footer)
print("ok")
cd /tmp/workspace/uti-handout && python make_handout.py && python -c " import pdfplumber with pdfplumber.open('UTI_Self_Care_Handout.pdf') as p: print(len(p.pages)) for pg in p.pages: print(pg.extract_text()[:200].replace('\n',' | ')); print('---') "
ls -la /tmp/workspace/uti-handout/ /tmp/workspace/
cd /tmp/workspace/uti-handout && python make_handout.py && python -c " import pdfplumber with pdfplumber.open('UTI_Self_Care_Handout.pdf') as p: print(len(p.pages)) for pg in p.pages: print(pg.extract_text()[:150].replace('\n',' | ')); print('---') "
cd /tmp/workspace/uti-handout && python -c " import pdfplumber with pdfplumber.open('UTI_Self_Care_Handout.pdf') as p: for i,pg in enumerate(p.pages): pg.to_image(resolution=60).save(f'p{i+1}.png') print('done') "; ls
UTI Self Care Handout
PDF Document · PDF
Patient couldn't control urinary urge sometimes leaking without voluntary action
"urinary bladder, overactive"[MeSH Terms] AND "female"[MeSH Terms]