Ihi

Ihi! How can I help you today?

The foreskin is pulled back easily In flaccid state but when it get erected the foreskin is pulled only upto half a way on glans penis..and if hardly once it pulled back ..it takes efforts to bring it to normal forward ..and have no pain or swelling so what is the diagnosis and treatment

Reading File
Searching the Web

phimosis diagnosis treatment non-surgical stretching 2024

Finding Sources
Searching PubMed

phimosis topical steroid treatment

Reading File
Reading File
Reading File

Diagnosis: Relative (Functional) Phimosis

Your description fits a classic presentation of relative phimosis - specifically the type where the foreskin retracts fine when the penis is flaccid, but the tight preputial ring becomes apparent only during erection, preventing full retraction over the glans.
Key features that confirm this:
  • Foreskin retracts easily in flaccid state
  • Only retracts halfway over the glans when erect
  • Difficulty returning the foreskin forward after forced retraction (this is an early sign of near-paraphimosis risk - avoid forcing it)
  • No pain or swelling currently
Important warning: The difficulty returning the foreskin to its normal position is a red flag. If you ever forcibly retract it and it gets stuck behind the glans with swelling, that becomes paraphimosis - a urological emergency. Never force retraction.

Treatment Options (First Line: Non-Surgical)

1. Topical Steroid Cream (Most Effective First Step)

  • Apply 0.05% betamethasone cream (or 0.1% triamcinolone) to the tight preputial ring once or twice daily for 4-8 weeks
  • This softens and loosens the tight tissue
  • Success rate: ~75-95% in mild-to-moderate cases
  • Combine with gentle stretching for best results
  • Textbook of Family Medicine 9e specifically recommends this: "Low-potency topical corticosteroid therapy (0.05% betamethasone) combined with daily prepuce retraction appears effective for phimosis"

2. Gentle Manual Stretching

  • After a warm bath (makes tissue more pliable), gently stretch the preputial opening with two fingers
  • Hold the stretch for 30-60 seconds, repeat 2-3 times
  • Do this daily - never force it to the point of pain
  • Combine with the steroid cream application at the tight ring
  • Results typically seen over 4-8 weeks of consistent effort

3. Preputioplasty (Foreskin-Preserving Surgery)

  • If creams + stretching fail after 2-3 months
  • A small incision is made to widen the preputial opening without removing the foreskin
  • Preferred over circumcision when the patient wants to preserve the foreskin

4. Circumcision

  • Reserved for cases that fail all conservative treatment, or if there are recurrent infections
  • Definitively resolves the problem
  • As noted in Smith and Tanagho's General Urology: "Circumcision, if indicated, should be done after the infection is controlled" - and only when conservative measures have failed

What You Should Do Now

  1. See a urologist or GP for a proper assessment and to get a prescription for betamethasone cream
  2. Do not force retraction - the difficulty returning the foreskin is a warning sign
  3. Start a 4-8 week course of topical steroid + gentle daily stretching
  4. Most cases like yours resolve with this approach alone

Disclaimer: This information is for educational purposes only and is not a substitute for a consultation with a qualified medical professional. Please see a doctor for diagnosis and personalized treatment.

Create a PDF guide on phimosis self-care and stretching techniques

Reading File
Reading File
Running Command

mkdir -p /home/daytona/workspace/phimosis-guide

Writing File

~/phimosis-guide/create_guide.py

from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm, mm
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    HRFlowable, PageBreak, KeepTogether
)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.platypus import Flowable

# ── Colours ─────────────────────────────────────────────────────────────────
BLUE_DARK  = colors.HexColor("#1A3C5E")
BLUE_MID   = colors.HexColor("#2E6DA4")
BLUE_LIGHT = colors.HexColor("#D6E8F7")
TEAL       = colors.HexColor("#17718A")
ORANGE     = colors.HexColor("#E07B2A")
RED_WARN   = colors.HexColor("#C0392B")
WARN_BG    = colors.HexColor("#FDECEA")
TIP_BG     = colors.HexColor("#EAF4FB")
GREEN_BG   = colors.HexColor("#EAF7F0")
GREEN_ACC  = colors.HexColor("#27AE60")
LIGHT_GREY = colors.HexColor("#F5F6FA")
MID_GREY   = colors.HexColor("#7F8C8D")
WHITE      = colors.white

PAGE_W, PAGE_H = A4
MARGIN = 2*cm

# ── Styles ───────────────────────────────────────────────────────────────────
base = getSampleStyleSheet()

def S(name, **kw):
    s = ParagraphStyle(name, **kw)
    return s

cover_title = S("CoverTitle",
    fontName="Helvetica-Bold", fontSize=28, leading=34,
    textColor=WHITE, alignment=TA_CENTER, spaceAfter=6)

cover_sub = S("CoverSub",
    fontName="Helvetica", fontSize=14, leading=18,
    textColor=colors.HexColor("#BDD9F0"), alignment=TA_CENTER, spaceAfter=4)

cover_note = S("CoverNote",
    fontName="Helvetica-Oblique", fontSize=10,
    textColor=colors.HexColor("#AEC9E0"), alignment=TA_CENTER)

h1 = S("H1",
    fontName="Helvetica-Bold", fontSize=17, leading=22,
    textColor=BLUE_DARK, spaceBefore=18, spaceAfter=6)

h2 = S("H2",
    fontName="Helvetica-Bold", fontSize=13, leading=17,
    textColor=BLUE_MID, spaceBefore=14, spaceAfter=5)

h3 = S("H3",
    fontName="Helvetica-Bold", fontSize=11, leading=14,
    textColor=TEAL, spaceBefore=10, spaceAfter=4)

body = S("Body",
    fontName="Helvetica", fontSize=10.5, leading=15,
    textColor=colors.HexColor("#2C3E50"), alignment=TA_JUSTIFY,
    spaceAfter=6)

bullet = S("Bullet",
    fontName="Helvetica", fontSize=10.5, leading=15,
    textColor=colors.HexColor("#2C3E50"),
    leftIndent=16, bulletIndent=4,
    spaceAfter=4)

bold_label = S("BoldLabel",
    fontName="Helvetica-Bold", fontSize=10.5, leading=14,
    textColor=BLUE_DARK, spaceAfter=2)

warn_text = S("WarnText",
    fontName="Helvetica", fontSize=10, leading=14,
    textColor=RED_WARN, alignment=TA_JUSTIFY)

tip_text = S("TipText",
    fontName="Helvetica", fontSize=10, leading=14,
    textColor=colors.HexColor("#154360"), alignment=TA_JUSTIFY)

green_text = S("GreenText",
    fontName="Helvetica", fontSize=10, leading=14,
    textColor=colors.HexColor("#1E6B3C"), alignment=TA_JUSTIFY)

footer_style = S("Footer",
    fontName="Helvetica-Oblique", fontSize=8,
    textColor=MID_GREY, alignment=TA_CENTER)

caption_style = S("Caption",
    fontName="Helvetica-Oblique", fontSize=9, leading=12,
    textColor=MID_GREY, alignment=TA_CENTER, spaceAfter=8)

# ── Custom Flowables ──────────────────────────────────────────────────────────

class ColourBox(Flowable):
    """A coloured background box with padding around a list of Paragraphs."""
    def __init__(self, paragraphs, bg_color, border_color=None, padding=10, radius=6):
        super().__init__()
        self.paragraphs = paragraphs
        self.bg_color = bg_color
        self.border_color = border_color or bg_color
        self.padding = padding
        self.radius = radius
        self._content_w = PAGE_W - 2*MARGIN - 2*padding
        self._built = False

    def _build(self, avail_w):
        self._content_w = avail_w - 2*self.padding
        for p in self.paragraphs:
            p.wrapOn(None, self._content_w, 9999)
        self._built = True

    def wrap(self, avail_w, avail_h):
        self._content_w = avail_w - 2*self.padding
        total_h = self.padding
        for p in self.paragraphs:
            w, h = p.wrapOn(None, self._content_w, avail_h)
            total_h += h + 4
        total_h += self.padding
        self._height = total_h
        self._width = avail_w
        return avail_w, total_h

    def draw(self):
        c = self.canv
        c.saveState()
        c.setFillColor(self.bg_color)
        c.setStrokeColor(self.border_color)
        c.setLineWidth(1.2)
        c.roundRect(0, 0, self._width, self._height,
                    self.radius, fill=1, stroke=1)
        y = self._height - self.padding
        for p in self.paragraphs:
            w, h = p.wrapOn(c, self._content_w, 9999)
            y -= h
            p.drawOn(c, self.padding, y)
            y -= 4
        c.restoreState()


class SectionDivider(Flowable):
    """A thin decorative horizontal rule with a left accent bar."""
    def wrap(self, w, h): return w, 12
    def draw(self):
        c = self.canv
        c.setFillColor(BLUE_MID)
        c.rect(0, 4, 40, 5, fill=1, stroke=0)
        c.setFillColor(BLUE_LIGHT)
        c.rect(44, 6, self._width - 44, 1, fill=1, stroke=0)


# ── Helper builders ───────────────────────────────────────────────────────────

def warning_box(title, text):
    paras = [
        Paragraph(f"<b>⚠ {title}</b>", warn_text),
        Paragraph(text, warn_text),
    ]
    return ColourBox(paras, bg_color=WARN_BG,
                     border_color=RED_WARN, padding=12)

def tip_box(title, text):
    paras = [
        Paragraph(f"<b>💡 {title}</b>", tip_text),
        Paragraph(text, tip_text),
    ]
    return ColourBox(paras, bg_color=TIP_BG,
                     border_color=BLUE_MID, padding=12)

def success_box(title, text):
    paras = [
        Paragraph(f"<b>✔ {title}</b>", green_text),
        Paragraph(text, green_text),
    ]
    return ColourBox(paras, bg_color=GREEN_BG,
                     border_color=GREEN_ACC, padding=12)

def step_table(steps):
    """steps: list of (number_str, title, description)"""
    data = []
    for num, title, desc in steps:
        data.append([
            Paragraph(num, S("StepNum",
                fontName="Helvetica-Bold", fontSize=16,
                textColor=WHITE, alignment=TA_CENTER)),
            [Paragraph(f"<b>{title}</b>", bold_label),
             Paragraph(desc, body)]
        ])
    t = Table(data, colWidths=[1.4*cm, PAGE_W - 2*MARGIN - 1.4*cm - 0.6*cm])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0, 0), (0, -1), BLUE_MID),
        ("VALIGN", (0, 0), (-1, -1), "TOP"),
        ("ALIGN", (0, 0), (0, -1), "CENTER"),
        ("TOPPADDING", (0, 0), (-1, -1), 8),
        ("BOTTOMPADDING", (0, 0), (-1, -1), 8),
        ("LEFTPADDING", (1, 0), (1, -1), 10),
        ("ROWBACKGROUNDS", (1, 0), (1, -1), [LIGHT_GREY, WHITE]),
        ("LINEBELOW", (0, 0), (-1, -2), 1, colors.HexColor("#D5D8DC")),
    ]))
    return t


# ── Page template with header/footer ─────────────────────────────────────────

def on_page(canvas, doc):
    canvas.saveState()
    # Header bar (skip cover page)
    if doc.page > 1:
        canvas.setFillColor(BLUE_DARK)
        canvas.rect(0, PAGE_H - 1.4*cm, PAGE_W, 1.4*cm, fill=1, stroke=0)
        canvas.setFillColor(WHITE)
        canvas.setFont("Helvetica-Bold", 9)
        canvas.drawString(MARGIN, PAGE_H - 0.9*cm,
                          "Phimosis Self-Care & Stretching Guide")
        canvas.setFont("Helvetica", 9)
        canvas.drawRightString(PAGE_W - MARGIN, PAGE_H - 0.9*cm,
                               f"Page {doc.page}")
        # Footer
        canvas.setFillColor(MID_GREY)
        canvas.setFont("Helvetica-Oblique", 7.5)
        canvas.drawCentredString(PAGE_W/2, 0.7*cm,
            "This guide is for educational purposes only. Consult a qualified doctor before starting any treatment.")
        canvas.setStrokeColor(BLUE_LIGHT)
        canvas.setLineWidth(0.5)
        canvas.line(MARGIN, 1.1*cm, PAGE_W - MARGIN, 1.1*cm)
    canvas.restoreState()


# ── Build story ───────────────────────────────────────────────────────────────

def build():
    path = "/home/daytona/workspace/phimosis-guide/Phimosis_Self_Care_Guide.pdf"
    doc = SimpleDocTemplate(
        path, pagesize=A4,
        leftMargin=MARGIN, rightMargin=MARGIN,
        topMargin=MARGIN + 0.6*cm, bottomMargin=MARGIN + 0.2*cm,
        title="Phimosis Self-Care & Stretching Guide",
        author="Orris Medical Education",
        subject="Phimosis conservative management"
    )
    story = []

    # ────────────────────────── COVER ──────────────────────────────────────
    # Blue cover background table
    cover_data = [[
        Paragraph("Phimosis", cover_title),
    ]]
    cover = Table([[
        Paragraph("PHIMOSIS", S("CovMainTitle",
            fontName="Helvetica-Bold", fontSize=34, leading=40,
            textColor=WHITE, alignment=TA_CENTER)),
    ],
    [Paragraph("Self-Care &amp; Stretching Guide", cover_sub)],
    [Spacer(1, 0.4*cm)],
    [Paragraph("A practical, evidence-based guide for managing tight foreskin\n"
               "conservatively — without surgery", cover_note)],
    [Spacer(1, 1.5*cm)],
    [Paragraph("For Adult Males | Educational Reference", cover_note)],
    ],
    colWidths=[PAGE_W - 2*MARGIN])

    cover.setStyle(TableStyle([
        ("BACKGROUND", (0, 0), (-1, -1), BLUE_DARK),
        ("ALIGN", (0, 0), (-1, -1), "CENTER"),
        ("TOPPADDING", (0, 0), (-1, -1), 16),
        ("BOTTOMPADDING", (0, 0), (-1, -1), 16),
        ("LEFTPADDING", (0, 0), (-1, -1), 30),
        ("RIGHTPADDING", (0, 0), (-1, -1), 30),
        ("ROUNDEDCORNERS", [12]),
    ]))

    story.append(Spacer(1, 3*cm))
    story.append(cover)
    story.append(Spacer(1, 1*cm))

    # Disclaimer banner on cover
    disc = ColourBox([
        Paragraph("<b>Medical Disclaimer</b>", warn_text),
        Paragraph(
            "This guide is for educational purposes only. It does not replace "
            "professional medical advice, diagnosis, or treatment. Always consult "
            "a qualified urologist or general practitioner before starting any "
            "treatment programme.",
            warn_text)
    ], bg_color=WARN_BG, border_color=RED_WARN, padding=14)
    story.append(disc)
    story.append(PageBreak())

    # ────────────────────────── PAGE 2: WHAT IS PHIMOSIS ──────────────────
    story.append(Paragraph("1. What Is Phimosis?", h1))
    story.append(SectionDivider())
    story.append(Spacer(1, 0.3*cm))
    story.append(Paragraph(
        "Phimosis is a condition in which the foreskin (prepuce) cannot be fully "
        "retracted back over the head of the penis (glans). It is entirely normal "
        "in infants and young boys, resolving naturally as development continues. "
        "When it persists or develops in adults, it is classified as either "
        "<b>physiological</b> or <b>pathological</b>.",
        body))
    story.append(Spacer(1, 0.2*cm))

    # Types table
    types_data = [
        [Paragraph("<b>Type</b>", bold_label),
         Paragraph("<b>Description</b>", bold_label),
         Paragraph("<b>Typical Cause</b>", bold_label)],
        [Paragraph("Physiological", body),
         Paragraph("Normal in infants/children; foreskin gradually separates naturally.", body),
         Paragraph("Natural developmental process", body)],
        [Paragraph("Relative / Functional", body),
         Paragraph("Foreskin retracts fine when flaccid but not fully during erection.", body),
         Paragraph("Mild preputial ring tightness", body)],
        [Paragraph("Pathological", body),
         Paragraph("Tight foreskin due to scarring (BXO/Lichen Sclerosus) or chronic infection.", body),
         Paragraph("Inflammation, infection, trauma", body)],
    ]
    types_t = Table(types_data, colWidths=[3.5*cm, 8*cm, 4.5*cm])
    types_t.setStyle(TableStyle([
        ("BACKGROUND", (0, 0), (-1, 0), BLUE_DARK),
        ("TEXTCOLOR", (0, 0), (-1, 0), WHITE),
        ("ROWBACKGROUNDS", (0, 1), (-1, -1), [LIGHT_GREY, WHITE]),
        ("GRID", (0, 0), (-1, -1), 0.5, colors.HexColor("#BDC3C7")),
        ("TOPPADDING", (0, 0), (-1, -1), 7),
        ("BOTTOMPADDING", (0, 0), (-1, -1), 7),
        ("LEFTPADDING", (0, 0), (-1, -1), 8),
        ("VALIGN", (0, 0), (-1, -1), "TOP"),
    ]))
    story.append(types_t)
    story.append(Spacer(1, 0.4*cm))

    story.append(Paragraph("Grades of Phimosis", h2))
    grades = [
        ("Grade 1", "Full retraction possible but tight behind the glans"),
        ("Grade 2", "Partial retraction — glans partially exposed"),
        ("Grade 3", "Only urethral meatus visible on retraction"),
        ("Grade 4", "Foreskin cannot retract at all; meatus barely visible"),
        ("Grade 5", "Complete non-retractile prepuce; narrow meatus causing urinary difficulty"),
    ]
    grade_data = [[Paragraph(f"<b>{g}</b>", bullet), Paragraph(d, body)] for g, d in grades]
    grade_t = Table(grade_data, colWidths=[3*cm, 12.5*cm])
    grade_t.setStyle(TableStyle([
        ("BACKGROUND", (0, 0), (0, -1), BLUE_LIGHT),
        ("VALIGN", (0, 0), (-1, -1), "TOP"),
        ("TOPPADDING", (0, 0), (-1, -1), 6),
        ("BOTTOMPADDING", (0, 0), (-1, -1), 6),
        ("LEFTPADDING", (0, 0), (0, -1), 8),
        ("LINEBELOW", (0, 0), (-1, -2), 0.5, colors.HexColor("#D5D8DC")),
    ]))
    story.append(grade_t)
    story.append(Spacer(1, 0.4*cm))
    story.append(tip_box("Your situation",
        "Foreskin retracts easily when flaccid but only halfway during erection, "
        "with difficulty returning to normal = Grade 2 Relative Phimosis. "
        "This is very amenable to conservative (non-surgical) treatment."))
    story.append(PageBreak())

    # ────────────────────────── PAGE 3: WHEN TO SEE A DOCTOR ──────────────
    story.append(Paragraph("2. When to See a Doctor Immediately", h1))
    story.append(SectionDivider())
    story.append(Spacer(1, 0.3*cm))
    story.append(warning_box(
        "URGENT — Seek Emergency Care If:",
        "The foreskin has been retracted behind the glans AND cannot be returned "
        "to its normal forward position, AND you notice swelling, colour change, "
        "or severe pain. This is called PARAPHIMOSIS and is a urological emergency. "
        "Do NOT try to force it back yourself without medical guidance."))
    story.append(Spacer(1, 0.4*cm))

    story.append(Paragraph("See your GP or urologist (non-emergency) if you have:", h2))
    see_doc = [
        "Recurrent infections (redness, discharge, unpleasant odour) under the foreskin",
        "Scarring, white discolouration, or hardening of the foreskin tissue (possible Lichen Sclerosus / BXO)",
        "Difficulty or pain when urinating (this suggests tight meatus)",
        "Pain during sexual intercourse that does not resolve with lubrication",
        "No improvement after 8-12 weeks of consistent stretching and steroid cream",
        "Ballooning of the foreskin on urination",
    ]
    for item in see_doc:
        story.append(Paragraph(f"• {item}", bullet))

    story.append(Spacer(1, 0.5*cm))
    story.append(Paragraph("3. Conservative Treatment Overview", h1))
    story.append(SectionDivider())
    story.append(Spacer(1, 0.3*cm))
    story.append(Paragraph(
        "Most cases of Grade 1-3 phimosis in adults respond well to a combination "
        "of topical steroid cream and a daily stretching programme. Surgery is only "
        "considered when conservative measures fail after an adequate trial (usually "
        "8-12 weeks).",
        body))
    story.append(Spacer(1, 0.3*cm))

    overview_data = [
        [Paragraph("<b>Treatment</b>", bold_label),
         Paragraph("<b>Success Rate</b>", bold_label),
         Paragraph("<b>Duration</b>", bold_label),
         Paragraph("<b>Best For</b>", bold_label)],
        [Paragraph("Topical steroid cream", body),
         Paragraph("75-95%", body),
         Paragraph("4-8 weeks", body),
         Paragraph("Grade 1-3", body)],
        [Paragraph("Manual stretching only", body),
         Paragraph("~65%", body),
         Paragraph("8-16 weeks", body),
         Paragraph("Grade 1-2", body)],
        [Paragraph("Steroid cream + stretching (combined)", body),
         Paragraph("~90%", body),
         Paragraph("6-10 weeks", body),
         Paragraph("Grade 1-4", body)],
        [Paragraph("Preputioplasty (minor surgery)", body),
         Paragraph("~95%", body),
         Paragraph("Single procedure", body),
         Paragraph("Failed conservative Rx", body)],
        [Paragraph("Circumcision", body),
         Paragraph("100%", body),
         Paragraph("Single procedure", body),
         Paragraph("Severe / BXO cases", body)],
    ]
    ov_t = Table(overview_data, colWidths=[4.5*cm, 3*cm, 3*cm, 4.5*cm])
    ov_t.setStyle(TableStyle([
        ("BACKGROUND", (0, 0), (-1, 0), BLUE_DARK),
        ("TEXTCOLOR", (0, 0), (-1, 0), WHITE),
        ("ROWBACKGROUNDS", (0, 1), (-1, -1), [LIGHT_GREY, WHITE]),
        ("GRID", (0, 0), (-1, -1), 0.5, colors.HexColor("#BDC3C7")),
        ("TOPPADDING", (0, 0), (-1, -1), 7),
        ("BOTTOMPADDING", (0, 0), (-1, -1), 7),
        ("LEFTPADDING", (0, 0), (-1, -1), 8),
        ("VALIGN", (0, 0), (-1, -1), "TOP"),
    ]))
    story.append(ov_t)
    story.append(PageBreak())

    # ────────────────────────── PAGE 4: STEROID CREAM ─────────────────────
    story.append(Paragraph("4. Topical Steroid Cream", h1))
    story.append(SectionDivider())
    story.append(Spacer(1, 0.3*cm))
    story.append(Paragraph(
        "Topical corticosteroid cream is the first-line treatment recommended by "
        "urologists worldwide. It softens and loosens the tight preputial ring, "
        "making stretching safer and more effective.",
        body))
    story.append(Spacer(1, 0.3*cm))

    story.append(Paragraph("Recommended Creams", h2))
    cream_data = [
        [Paragraph("<b>Cream</b>", bold_label),
         Paragraph("<b>Strength</b>", bold_label),
         Paragraph("<b>Notes</b>", bold_label)],
        [Paragraph("Betamethasone 0.05%", body),
         Paragraph("Moderate", body),
         Paragraph("Most evidence-backed; first-line choice", body)],
        [Paragraph("Betamethasone 0.1%", body),
         Paragraph("Moderately strong", body),
         Paragraph("Used for more resistant cases", body)],
        [Paragraph("Triamcinolone 0.1%", body),
         Paragraph("Moderate", body),
         Paragraph("Good alternative if betamethasone unavailable", body)],
        [Paragraph("Clobetasol 0.05%", body),
         Paragraph("Very strong", body),
         Paragraph("Reserved for BXO / pathological phimosis", body)],
        [Paragraph("Hydrocortisone 1%", body),
         Paragraph("Mild", body),
         Paragraph("OTC; less effective but lowest risk of side effects", body)],
    ]
    cr_t = Table(cream_data, colWidths=[4.5*cm, 3.5*cm, 7.5*cm])
    cr_t.setStyle(TableStyle([
        ("BACKGROUND", (0, 0), (-1, 0), TEAL),
        ("TEXTCOLOR", (0, 0), (-1, 0), WHITE),
        ("ROWBACKGROUNDS", (0, 1), (-1, -1), [TIP_BG, WHITE]),
        ("GRID", (0, 0), (-1, -1), 0.5, colors.HexColor("#BDC3C7")),
        ("TOPPADDING", (0, 0), (-1, -1), 7),
        ("BOTTOMPADDING", (0, 0), (-1, -1), 7),
        ("LEFTPADDING", (0, 0), (-1, -1), 8),
        ("VALIGN", (0, 0), (-1, -1), "TOP"),
    ]))
    story.append(cr_t)
    story.append(Spacer(1, 0.4*cm))

    story.append(Paragraph("How to Apply the Cream", h2))
    cream_steps = [
        ("1", "Wash hands and the area thoroughly with warm water. Pat dry."),
        ("2", "Apply a pea-sized amount of cream directly to the tight ring of skin at the tip of the foreskin."),
        ("3", "Gently massage the cream into the skin for 30-60 seconds."),
        ("4", "Do this TWICE daily — once in the morning, once at night."),
        ("5", "After applying, perform your stretching routine (see Section 5) while the skin is softened."),
        ("6", "Continue for 4-8 weeks. Do not stop early if you see initial improvement."),
    ]
    for num, text in cream_steps:
        row_data = [[
            Paragraph(num, S("SmallNum", fontName="Helvetica-Bold", fontSize=13,
                             textColor=WHITE, alignment=TA_CENTER)),
            Paragraph(text, body)
        ]]
        rt = Table(row_data, colWidths=[1*cm, PAGE_W - 2*MARGIN - 1*cm - 0.4*cm])
        rt.setStyle(TableStyle([
            ("BACKGROUND", (0, 0), (0, 0), TEAL),
            ("VALIGN", (0, 0), (-1, -1), "MIDDLE"),
            ("TOPPADDING", (0, 0), (-1, -1), 6),
            ("BOTTOMPADDING", (0, 0), (-1, -1), 6),
            ("LEFTPADDING", (1, 0), (1, 0), 10),
            ("LINEBELOW", (0, 0), (-1, -1), 0.5, colors.HexColor("#D5D8DC")),
        ]))
        story.append(rt)

    story.append(Spacer(1, 0.4*cm))
    story.append(tip_box("Prescription Required",
        "Betamethasone 0.05% and stronger creams require a prescription in most "
        "countries. Visit your GP or urologist and explain your symptoms. They can "
        "prescribe the appropriate cream. Hydrocortisone 1% is available over-the-counter "
        "but is less effective."))
    story.append(Spacer(1, 0.3*cm))

    story.append(Paragraph("Possible Side Effects (Rare with Short-Term Use)", h2))
    se = [
        "Temporary mild skin thinning at the application site",
        "Slight lightening of skin colour (usually reversible)",
        "Increased susceptibility to local infections if used excessively",
    ]
    for item in se:
        story.append(Paragraph(f"• {item}", bullet))
    story.append(Spacer(1, 0.2*cm))
    story.append(Paragraph(
        "These effects are uncommon with a 4-8 week course. Do not use strong "
        "steroids beyond 12 weeks without medical supervision.",
        body))
    story.append(PageBreak())

    # ────────────────────────── PAGE 5: STRETCHING ────────────────────────
    story.append(Paragraph("5. Stretching Techniques", h1))
    story.append(SectionDivider())
    story.append(Spacer(1, 0.3*cm))
    story.append(Paragraph(
        "Stretching works by gradually widening the preputial opening through "
        "consistent, gentle tension on the tight ring. Consistency over weeks "
        "is far more effective than occasional forceful attempts. Never stretch "
        "to the point of pain.",
        body))
    story.append(Spacer(1, 0.3*cm))
    story.append(warning_box(
        "Golden Rules of Stretching",
        "NEVER force retraction. NEVER stretch to pain — mild tension only. "
        "NEVER retract fully during erection if it is difficult to return. "
        "Stop immediately if you feel sharp pain, see bleeding, or notice swelling."))
    story.append(Spacer(1, 0.4*cm))

    story.append(Paragraph("Before You Start — Preparation", h2))
    prep = [
        "Take a warm bath or shower first (10-15 min). Warm water relaxes the tissue and improves elasticity.",
        "Apply your steroid cream to the tight ring and wait 2-3 minutes.",
        "Use a lubricant such as petroleum jelly (Vaseline), coconut oil, or a water-based lubricant to reduce friction.",
        "Always work in a flaccid or semi-erect state, never fully erect.",
    ]
    for item in prep:
        story.append(Paragraph(f"• {item}", bullet))
    story.append(Spacer(1, 0.4*cm))

    story.append(Paragraph("Technique 1 — Two-Finger Stretch (Primary Method)", h2))
    t1_steps = [
        ("1", "Insert the tips of both index fingers (or thumb + index finger) into the foreskin opening."),
        ("2", "Gently stretch outward in opposite directions — left and right — until you feel mild tension (not pain)."),
        ("3", "Hold the stretch for 30-60 seconds. Breathe normally."),
        ("4", "Release, rest for 30 seconds, then repeat."),
        ("5", "Perform 3-5 repetitions per session. Do 1-2 sessions per day."),
    ]
    story.append(step_table(t1_steps))
    story.append(Spacer(1, 0.4*cm))

    story.append(Paragraph("Technique 2 — Retraction Stretch", h2))
    story.append(Paragraph(
        "This technique gradually stretches the opening by practicing controlled retraction.",
        body))
    t2_steps = [
        ("1", "Gently pull the foreskin back — only as far as it goes WITHOUT resistance or discomfort."),
        ("2", "Hold at that comfortable maximum point for 30 seconds."),
        ("3", "Slowly return the foreskin to its normal forward position."),
        ("4", "Repeat 5 times per session."),
        ("5", "Over days and weeks, you will find the comfortable maximum gradually increases."),
    ]
    story.append(step_table(t2_steps))
    story.append(Spacer(1, 0.4*cm))

    story.append(Paragraph("Technique 3 — Ring Pinch Stretch (for tighter cases)", h2))
    t3_steps = [
        ("1", "Use your thumb and forefinger of both hands to pinch the tight ring of skin at the tip."),
        ("2", "Gently pull the ring of skin outward (away from the body) and hold for 30 seconds."),
        ("3", "Combine with a gentle side-to-side stretch of the ring at the same time."),
        ("4", "Do 3-5 repetitions per session, once daily."),
    ]
    story.append(step_table(t3_steps))
    story.append(PageBreak())

    # ────────────────────────── PAGE 6: SCHEDULE + PROGRESS ───────────────
    story.append(Paragraph("6. Daily Routine & 8-Week Schedule", h1))
    story.append(SectionDivider())
    story.append(Spacer(1, 0.3*cm))

    story.append(Paragraph("Daily Routine (10-15 minutes)", h2))
    routine = [
        ("Morning", "Apply steroid cream to tight ring x1. Perform Technique 1 (2-finger stretch) — 5 reps x 30 sec. Perform Technique 2 (retraction stretch) — 5 reps."),
        ("Evening", "Warm bath/shower (10 min). Apply steroid cream x1. Perform Technique 1 — 5 reps. Perform Technique 3 (ring pinch) if needed. Return foreskin to forward position gently."),
    ]
    rout_data = [[
        Paragraph(f"<b>{time}</b>", bold_label),
        Paragraph(act, body)
    ] for time, act in routine]
    rout_t = Table(rout_data, colWidths=[3.5*cm, PAGE_W - 2*MARGIN - 3.5*cm - 0.4*cm])
    rout_t.setStyle(TableStyle([
        ("BACKGROUND", (0, 0), (0, -1), BLUE_LIGHT),
        ("VALIGN", (0, 0), (-1, -1), "TOP"),
        ("TOPPADDING", (0, 0), (-1, -1), 10),
        ("BOTTOMPADDING", (0, 0), (-1, -1), 10),
        ("LEFTPADDING", (0, 0), (-1, -1), 10),
        ("LINEBELOW", (0, 0), (-1, -2), 0.5, colors.HexColor("#D5D8DC")),
    ]))
    story.append(rout_t)
    story.append(Spacer(1, 0.4*cm))

    story.append(Paragraph("8-Week Progress Milestones", h2))
    milestones = [
        ("Weeks 1-2", "Skin feels softer. Slight increase in retraction ability. Mild redness after stretching is normal — it should fade within minutes."),
        ("Weeks 3-4", "Noticeable improvement in flaccid retraction. Erect retraction may start to improve. Maintain consistency."),
        ("Weeks 5-6", "Foreskin should now retract significantly further during erection. Two-finger stretch becoming easier."),
        ("Weeks 7-8", "Most Grade 1-2 cases achieve full or near-full retraction. Continue maintenance stretching 3x/week."),
    ]
    ms_data = [
        [Paragraph(f"<b>{w}</b>", S("MilestonePeriod",
            fontName="Helvetica-Bold", fontSize=10, textColor=WHITE)),
         Paragraph(d, body)]
        for w, d in milestones
    ]
    ms_t = Table(ms_data, colWidths=[3.5*cm, PAGE_W - 2*MARGIN - 3.5*cm - 0.4*cm])
    ms_t.setStyle(TableStyle([
        ("BACKGROUND", (0, 0), (0, -1), BLUE_MID),
        ("ROWBACKGROUNDS", (1, 0), (1, -1), [LIGHT_GREY, WHITE]),
        ("VALIGN", (0, 0), (-1, -1), "TOP"),
        ("TOPPADDING", (0, 0), (-1, -1), 9),
        ("BOTTOMPADDING", (0, 0), (-1, -1), 9),
        ("LEFTPADDING", (0, 0), (-1, -1), 10),
        ("LINEBELOW", (0, 0), (-1, -2), 0.5, colors.HexColor("#D5D8DC")),
    ]))
    story.append(ms_t)
    story.append(Spacer(1, 0.4*cm))
    story.append(success_box("Track Your Progress",
        "Keep a simple daily log: note the date, which technique you used, and "
        "how far the foreskin retracted. Even a few millimetres of improvement "
        "per week adds up. Take a photo if helpful. Bring your log to your "
        "follow-up appointment."))
    story.append(PageBreak())

    # ────────────────────────── PAGE 7: HYGIENE + FAQ ─────────────────────
    story.append(Paragraph("7. Hygiene & General Care", h1))
    story.append(SectionDivider())
    story.append(Spacer(1, 0.3*cm))
    story.append(Paragraph(
        "Good hygiene prevents the infections that cause or worsen phimosis. "
        "Poor hygiene under a tight foreskin is one of the most common reasons "
        "for phimosis in adults.",
        body))
    story.append(Spacer(1, 0.2*cm))

    hygiene = [
        ("Clean gently daily", "Use warm water only under the foreskin. Soap and harsh cleansers disrupt natural pH and can cause irritation. Rinse thoroughly."),
        ("Dry after washing", "Pat dry to prevent moisture accumulation under the foreskin, which promotes bacterial/fungal growth."),
        ("Avoid tight underwear", "Breathable, cotton underwear reduces friction and irritation."),
        ("No forceful cleaning", "Never aggressively retract or scrub to clean. Gentle retraction only."),
        ("After exercise", "Shower after heavy exercise to keep the area clean."),
        ("Watch for smegma", "A small amount of white smegma (natural secretion) is normal. Wash gently to remove it daily."),
    ]
    hyg_data = [
        [Paragraph(f"<b>{k}</b>", bold_label), Paragraph(v, body)]
        for k, v in hygiene
    ]
    hyg_t = Table(hyg_data, colWidths=[4.5*cm, PAGE_W - 2*MARGIN - 4.5*cm - 0.4*cm])
    hyg_t.setStyle(TableStyle([
        ("BACKGROUND", (0, 0), (0, -1), GREEN_BG),
        ("ROWBACKGROUNDS", (1, 0), (1, -1), [LIGHT_GREY, WHITE]),
        ("VALIGN", (0, 0), (-1, -1), "TOP"),
        ("TOPPADDING", (0, 0), (-1, -1), 8),
        ("BOTTOMPADDING", (0, 0), (-1, -1), 8),
        ("LEFTPADDING", (0, 0), (-1, -1), 8),
        ("LINEBELOW", (0, 0), (-1, -2), 0.5, colors.HexColor("#D5D8DC")),
    ]))
    story.append(hyg_t)
    story.append(Spacer(1, 0.5*cm))

    story.append(Paragraph("8. Frequently Asked Questions", h1))
    story.append(SectionDivider())
    story.append(Spacer(1, 0.3*cm))

    faqs = [
        ("Will phimosis resolve on its own without treatment?",
         "Mild relative phimosis may improve over time for some individuals, but "
         "active treatment with steroid cream and stretching produces much faster "
         "and more reliable results. Waiting without treatment risks worsening from "
         "infection or minor trauma."),
        ("Is phimosis a sexually transmitted infection?",
         "No. Phimosis is not an STI. It is a structural/dermatological condition "
         "of the foreskin. However, recurrent infections from poor hygiene can "
         "worsen it."),
        ("Can I have sex during treatment?",
         "Gentle sexual activity is generally fine. Avoid forced retraction during "
         "sex. Use adequate lubrication. If intercourse causes pain or difficulty "
         "returning the foreskin, abstain until the condition improves."),
        ("How long before I see results?",
         "Most people notice softening and slight improvement within 2-3 weeks of "
         "daily steroid cream + stretching. Significant functional improvement "
         "usually occurs by weeks 4-6. Full resolution may take 8-12 weeks."),
        ("Will I definitely need circumcision?",
         "No. The majority of adult phimosis cases (Grade 1-3) resolve with "
         "conservative treatment. Circumcision is only needed if conservative "
         "methods fail, there is significant scarring (BXO), or there are "
         "recurrent severe infections."),
        ("What is paraphimosis and how is it different?",
         "Paraphimosis occurs when a retracted foreskin gets stuck behind the "
         "glans and cannot return forward, causing a painful constricting ring "
         "and swelling. It is an emergency. Phimosis is the opposite: foreskin "
         "that cannot retract. Do not force retraction to the point where "
         "returning it becomes difficult."),
    ]
    for q, a in faqs:
        story.append(KeepTogether([
            Paragraph(f"Q: {q}", h3),
            Paragraph(a, body),
            Spacer(1, 0.1*cm),
        ]))
    story.append(PageBreak())

    # ────────────────────────── PAGE 8: WHEN TREATMENT FAILS ──────────────
    story.append(Paragraph("9. If Conservative Treatment Fails", h1))
    story.append(SectionDivider())
    story.append(Spacer(1, 0.3*cm))
    story.append(Paragraph(
        "If there is no improvement after 8-12 weeks of consistent steroid cream "
        "plus stretching, consult a urologist. Surgical options are effective and "
        "minimally invasive.",
        body))
    story.append(Spacer(1, 0.3*cm))

    surg = [
        ("Preputioplasty", "Foreskin-preserving procedure",
         "A small incision in the tight ring widens the opening. The foreskin is "
         "fully preserved. Quick recovery (~1-2 weeks). Best for men who want to "
         "retain their foreskin."),
        ("Dorsal Slit", "Minor procedure",
         "A single cut along the top of the foreskin relieves tightness. Simpler "
         "than circumcision. Used in emergency settings or as an interim measure."),
        ("Circumcision", "Complete foreskin removal",
         "The entire foreskin is surgically removed. 100% effective. Standard "
         "recommendation for pathological phimosis (BXO), recurrent infections, "
         "or failed conservative/preputioplasty treatment."),
    ]
    for proc, subtype, desc in surg:
        story.append(KeepTogether([
            Paragraph(proc, h2),
            Paragraph(f"<i>{subtype}</i>", S("Subtype",
                fontName="Helvetica-Oblique", fontSize=10, textColor=MID_GREY)),
            Paragraph(desc, body),
            Spacer(1, 0.1*cm),
        ]))

    story.append(Spacer(1, 0.4*cm))
    story.append(tip_box("Ask Your Urologist",
        "When you visit a urologist, ask specifically about preputioplasty if you "
        "prefer to preserve your foreskin. Many patients are only offered "
        "circumcision by default, but preputioplasty is a valid, well-established "
        "alternative for most cases."))
    story.append(Spacer(1, 0.5*cm))

    # ────────────────────────── FINAL DISCLAIMER ──────────────────────────
    story.append(HRFlowable(width="100%", thickness=1.5, color=BLUE_LIGHT))
    story.append(Spacer(1, 0.3*cm))
    story.append(Paragraph("Medical Disclaimer", h2))
    story.append(Paragraph(
        "This guide is produced for educational purposes only. The information "
        "contained herein does not constitute medical advice and should not be "
        "used as a substitute for professional medical consultation, diagnosis, "
        "or treatment. Always seek the advice of a qualified healthcare provider "
        "(urologist, general practitioner) with any questions you may have "
        "regarding a medical condition. Never disregard professional medical "
        "advice because of something you read in this guide.",
        body))
    story.append(Spacer(1, 0.2*cm))
    story.append(Paragraph(
        "References: Smith and Tanagho's General Urology 19e | Bailey and Love's "
        "Short Practice of Surgery 28e | Textbook of Family Medicine 9e | "
        "Campbell-Walsh-Wein Urology",
        caption_style))

    doc.build(story, onFirstPage=on_page, onLaterPages=on_page)
    print(f"PDF saved to: {path}")


build()
Running Command

cd /home/daytona/workspace/phimosis-guide && python create_guide.py 2>&1

Editing File

~/phimosis-guide/create_guide.py

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/phimosis-guide/create_guide.py'
Running Command

cd /home/daytona/workspace/phimosis-guide && python create_guide.py 2>&1

Editing File

~/phimosis-guide/create_guide.py

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/phimosis-guide/create_guide.py'
Running Command

cd /home/daytona/workspace/phimosis-guide && python create_guide.py 2>&1

Your PDF guide is ready! Here's what's included across its 8 pages:

Phimosis Self Care Guide

PDF Document · PDF


Guide Contents:
  1. What Is Phimosis? - Types (physiological, relative, pathological) and a 5-grade severity scale
  2. When to See a Doctor - Emergency signs (paraphimosis) and non-urgent red flags
  3. Conservative Treatment Overview - Comparison table of all options with success rates
  4. Topical Steroid Cream - Which creams to use (betamethasone 0.05% etc.), step-by-step application instructions, side effects
  5. Stretching Techniques - Three detailed methods (two-finger stretch, retraction stretch, ring pinch) with numbered steps
  6. 8-Week Schedule & Milestones - Daily morning/evening routine + what to expect week by week
  7. Hygiene & General Care - Daily hygiene tips to prevent infection and worsening
  8. FAQ + Surgical Options - Common questions answered; preputioplasty vs circumcision explained
The guide references standard urology textbooks (Smith & Tanagho, Bailey & Love, Campbell-Walsh-Wein) and carries a clear medical disclaimer throughout.
This is a shared conversation. Sign in to Orris to start your own chat.