piles all medicine in homeopathy

Reading File
Finding Sources
Finding Sources
Searching the Web

piles haemorrhoids homeopathy medicines treatment

Reading Web Page

https://www.peacehealth.org/medical-topics/id/hn-2229005

Finding Sources
Here is a comprehensive guide to homeopathic medicines for Piles (Haemorrhoids):

Piles (Haemorrhoids) — Homeopathic Medicines

Piles (haemorrhoids) are swollen, inflamed blood vessels in the rectum or anus. They can be internal or external, causing itching, pain, bleeding, and protrusion. Homeopathy selects remedies based on the totality of individual symptoms — not just the diagnosis.

Primary Remedies

1. 🌰 Aesculus hippocastanum (Horse Chestnut)

  • Sore, aching haemorrhoids with a swollen, full feeling in the rectum
  • Sensation of small sharp sticks poking inside the rectum
  • Pain lasts for hours after bowel movements
  • Sharp, shooting pains in the rectum and lower back
  • Often associated with low back problems
  • Worse: walking, stooping; Better: cool air

2. 🌿 Hamamelis virginiana (Witch Hazel)

  • Haemorrhoids with profuse, dark bleeding — passive, not from straining
  • Marked soreness and rawness in the rectum
  • Throbbing pain with easy bleeding
  • Improves venous circulation
  • Best for: bleeding piles with rawness

3. 🔥 Sulphur (Sulph.)

  • Itching, burning, oozing haemorrhoids
  • Anus is red, inflamed, and may protrude significantly
  • Feeling of fullness and pressure in the abdomen
  • Worse from warmth and bathing; offensive flatulence
  • Most frequently prescribed in clinical trials (most common constitutional remedy for piles)

4. 🌱 Nux Vomica

  • Piles caused by sedentary lifestyle, overeating, rich/spicy food, alcohol, coffee
  • Constant ineffectual urge to pass stool
  • Painful, itchy haemorrhoids with irregular bowel habits
  • Best for: office workers, people with poor lifestyle habits

5. 🍃 Aloe socotrina

  • Haemorrhoids that protrude like a bunch of grapes
  • Soothed by cold applications
  • Alternates with diarrhoea; lots of flatulence
  • Intense burning and itching at the anus
  • Bleeding may occur with loose stools

6. 🪻 Pulsatilla

  • Itchy, uncomfortable piles that protrude
  • Sticking pains; better lying down
  • Worse from warmth
  • Especially useful during pregnancy or around menstruation
  • Suited to mild, emotional, weepy patients

7. 🌸 Collinsonia canadensis (Stone Root)

  • Piles with stubborn constipation — dry, hard stools
  • Sensation of fullness or constriction in the rectum
  • Itching and pain during and after bowel movements
  • Often associated with heart conditions or portal congestion

8. 🎨 Graphites

  • Constipation with very large, dry, hard stools
  • Associated anal itching and burning
  • Feeling of heaviness in lower abdomen
  • Haemorrhoids with fissures and sticky discharge

Other Important Remedies

RemedyKey Indication
Arnica montanaSore, bruised-feeling piles after straining, childbirth, or heavy lifting
Calcarea fluoricaBleeding, itching piles; internal haemorrhoids with low back/sacral soreness
IgnatiaPiles with spasms and stabbing rectal pain; worsened by loose stools; emotional patients; rectal prolapse
Paeonia officinalisBurning pain after stool; rawness, itching, stitching in anus; also for anal fissures
Muriaticum acidumVery sensitive, swollen, bluish haemorrhoids; too painful to touch
Arsenicum albumBurning piles relieved by warm/hot water; restlessness and anxiety
PhosphorusBleeding piles with bright red blood; tall, thin, anxious patients
SepiaPiles with bearing-down sensation; associated with hormonal issues in women
Nitric acidumSharp, splinter-like pains in the rectum; bleeding after bowel movement
CapsicumBurning sensation, especially at anus; worse cold; associated with homesickness

Potency & Dosage (General Guidance)

SituationSuggested Potency
Acute symptoms30C, 3–4 times daily until improvement
Chronic/constitutional200C or higher — consult a practitioner
General self-care6C or 30C
Stop taking the remedy when symptoms improve. If there is no improvement after 3–4 doses, reconsider the remedy choice.

When to Seek Conventional Medical Care

Homeopathy is not a substitute for medical evaluation in these situations:
  • Grade IV piles (completely prolapsed, cannot be reduced)
  • Profuse or persistent rectal bleeding
  • Suspected rectal malignancy
  • Anal fissure or fistula requiring surgical intervention
  • Acute thrombosed external haemorrhoids

Clinical Note

A 2024 double-blind RCT (PMID: 38301138) found individualized homeopathic medicines significantly superior to placebo for Grade I–III haemorrhoids, with Sulphur being the most frequently prescribed remedy. However, larger Phase 3 trials are still needed to confirm these findings.

Create a quick reference PDF of homeopathic piles remedies

Reading File
Running Command

ls -la /home/daytona/workspace/ 2>/dev/null || echo "workspace not found"

Running Command

mkdir -p /home/daytona/workspace/homeopathy-piles && python3 -c "from reportlab.lib.pagesizes import A4; print('reportlab OK')"

Writing File

~/homeopathy-piles/generate_pdf.py

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

OUTPUT = "/home/daytona/workspace/homeopathy-piles/Homeopathic_Piles_Remedies_Quick_Reference.pdf"

# ── Colour palette ──────────────────────────────────────────────────────────
DARK_GREEN   = colors.HexColor("#1B5E20")
MED_GREEN    = colors.HexColor("#2E7D32")
LIGHT_GREEN  = colors.HexColor("#C8E6C9")
ACCENT_GREEN = colors.HexColor("#4CAF50")
PALE_GREEN   = colors.HexColor("#F1F8E9")
ORANGE       = colors.HexColor("#E65100")
GOLD         = colors.HexColor("#F9A825")
LIGHT_GOLD   = colors.HexColor("#FFF9C4")
WHITE        = colors.white
DARK_GREY    = colors.HexColor("#212121")
MID_GREY     = colors.HexColor("#424242")

# ── Styles ───────────────────────────────────────────────────────────────────
styles = getSampleStyleSheet()

title_style = ParagraphStyle(
    "Title", parent=styles["Normal"],
    fontSize=24, fontName="Helvetica-Bold",
    textColor=WHITE, alignment=TA_CENTER,
    spaceAfter=4
)
subtitle_style = ParagraphStyle(
    "Subtitle", parent=styles["Normal"],
    fontSize=11, fontName="Helvetica",
    textColor=colors.HexColor("#A5D6A7"), alignment=TA_CENTER,
    spaceAfter=2
)
section_heading = ParagraphStyle(
    "SectionH", parent=styles["Normal"],
    fontSize=13, fontName="Helvetica-Bold",
    textColor=WHITE, alignment=TA_CENTER,
    spaceAfter=0
)
remedy_name = ParagraphStyle(
    "RemedyName", parent=styles["Normal"],
    fontSize=10.5, fontName="Helvetica-Bold",
    textColor=DARK_GREEN, spaceAfter=2
)
remedy_latin = ParagraphStyle(
    "RemedyLatin", parent=styles["Normal"],
    fontSize=8, fontName="Helvetica-Oblique",
    textColor=MID_GREY, spaceAfter=3
)
body_style = ParagraphStyle(
    "Body", parent=styles["Normal"],
    fontSize=8.5, fontName="Helvetica",
    textColor=DARK_GREY, leading=13, spaceAfter=2
)
bullet_style = ParagraphStyle(
    "Bullet", parent=styles["Normal"],
    fontSize=8.5, fontName="Helvetica",
    textColor=DARK_GREY, leading=12,
    leftIndent=10, bulletIndent=2, spaceAfter=1
)
key_style = ParagraphStyle(
    "Key", parent=styles["Normal"],
    fontSize=8, fontName="Helvetica-Bold",
    textColor=ORANGE, spaceAfter=1
)
footer_style = ParagraphStyle(
    "Footer", parent=styles["Normal"],
    fontSize=7, fontName="Helvetica",
    textColor=colors.HexColor("#757575"), alignment=TA_CENTER
)
table_header_style = ParagraphStyle(
    "TH", parent=styles["Normal"],
    fontSize=9, fontName="Helvetica-Bold",
    textColor=WHITE, alignment=TA_CENTER
)
table_cell_style = ParagraphStyle(
    "TC", parent=styles["Normal"],
    fontSize=8.5, fontName="Helvetica",
    textColor=DARK_GREY, alignment=TA_LEFT, leading=11
)
warning_style = ParagraphStyle(
    "Warn", parent=styles["Normal"],
    fontSize=8.5, fontName="Helvetica",
    textColor=colors.HexColor("#B71C1C"), leading=13
)
note_style = ParagraphStyle(
    "Note", parent=styles["Normal"],
    fontSize=8, fontName="Helvetica-Oblique",
    textColor=MID_GREY, alignment=TA_CENTER, leading=11
)

# ── Helpers ──────────────────────────────────────────────────────────────────
def section_banner(text, color=MED_GREEN):
    data = [[Paragraph(text, section_heading)]]
    t = Table(data, colWidths=[175*mm])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), color),
        ("TOPPADDING",    (0,0), (-1,-1), 6),
        ("BOTTOMPADDING", (0,0), (-1,-1), 6),
        ("LEFTPADDING",   (0,0), (-1,-1), 8),
        ("RIGHTPADDING",  (0,0), (-1,-1), 8),
        ("ROUNDEDCORNERS", [4]),
    ]))
    return t

def remedy_card(name, latin, emoji, bullets, key_symptom):
    content = [
        Paragraph(f"{emoji}  {name}", remedy_name),
        Paragraph(latin, remedy_latin),
        Paragraph(f"<b>Key:</b> {key_symptom}", key_style),
    ]
    for b in bullets:
        content.append(Paragraph(f"• {b}", bullet_style))
    return content

# ── Document ─────────────────────────────────────────────────────────────────
doc = SimpleDocTemplate(
    OUTPUT, pagesize=A4,
    leftMargin=18*mm, rightMargin=18*mm,
    topMargin=15*mm, bottomMargin=18*mm
)

story = []

# ── HEADER BANNER ─────────────────────────────────────────────────────────────
header_data = [[
    Paragraph("🌿 Homeopathic Remedies for Piles", title_style),
    Paragraph("(Haemorrhoids) — Quick Reference Card", subtitle_style),
]]
header_table = Table([[
    Paragraph("🌿 Homeopathic Remedies for Piles (Haemorrhoids)", title_style),
], [
    Paragraph("Quick Reference Card  •  Symptom-Based Selection Guide", subtitle_style),
]], colWidths=[175*mm])
header_table.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,-1), DARK_GREEN),
    ("TOPPADDING",    (0,0), (-1,-1), 14),
    ("BOTTOMPADDING", (0,0), (-1,-1), 14),
    ("LEFTPADDING",   (0,0), (-1,-1), 10),
    ("RIGHTPADDING",  (0,0), (-1,-1), 10),
    ("ROUNDEDCORNERS", [6]),
]))
story.append(header_table)
story.append(Spacer(1, 8*mm))

# ── ABOUT BOX ────────────────────────────────────────────────────────────────
about_text = (
    "Homeopathy selects remedies based on the <b>totality of individual symptoms</b> — not diagnosis alone. "
    "The same condition may require different remedies in different patients. "
    "Use the symptom profiles below to identify the best-matching remedy."
)
about_data = [[Paragraph(about_text, body_style)]]
about_table = Table(about_data, colWidths=[175*mm])
about_table.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,-1), PALE_GREEN),
    ("BOX",           (0,0), (-1,-1), 1, ACCENT_GREEN),
    ("TOPPADDING",    (0,0), (-1,-1), 7),
    ("BOTTOMPADDING", (0,0), (-1,-1), 7),
    ("LEFTPADDING",   (0,0), (-1,-1), 10),
    ("RIGHTPADDING",  (0,0), (-1,-1), 10),
]))
story.append(about_table)
story.append(Spacer(1, 6*mm))

# ── PRIMARY REMEDIES ─────────────────────────────────────────────────────────
story.append(section_banner("★  PRIMARY REMEDIES"))
story.append(Spacer(1, 4*mm))

primary_remedies = [
    {
        "name": "Aesculus hippocastanum", "latin": "Horse Chestnut", "emoji": "🌰",
        "key": "Sharp sticks sensation + low backache",
        "bullets": [
            "Sore, aching haemorrhoids with swollen, full feeling in rectum",
            "Sensation of many small sharp sticks poking inside the rectum",
            "Pain lasts for hours after bowel movements",
            "Sharp, shooting pains in rectum and lower back",
            "Worse: walking, stooping  |  Better: cool open air",
        ]
    },
    {
        "name": "Hamamelis virginiana", "latin": "Witch Hazel", "emoji": "🌿",
        "key": "Dark, profuse, passive bleeding with rawness",
        "bullets": [
            "Profuse dark bleeding — passive, not from straining",
            "Marked soreness and rawness in the rectum",
            "Throbbing, bruised pain in haemorrhoidal veins",
            "Improves venous circulation and reduces venous congestion",
            "Better: rest  |  Worse: touch, pressure",
        ]
    },
    {
        "name": "Sulphur (Sulph.)", "latin": "Elemental Sulphur", "emoji": "🔥",
        "key": "Itching, burning, redness — worse heat/bathing",
        "bullets": [
            "Intense itching, burning, oozing haemorrhoids",
            "Anus red, inflamed, may protrude significantly",
            "Fullness and pressure in abdomen; offensive flatulence",
            "Worse: warmth, bathing, standing  |  Better: dry, cool air",
            "Most frequently prescribed in clinical trials (RCT evidence)",
        ]
    },
    {
        "name": "Nux Vomica", "latin": "Poison Nut (Strychnos nux-vomica)", "emoji": "🌱",
        "key": "Sedentary lifestyle + spicy food/alcohol + ineffectual urge",
        "bullets": [
            "Piles from sedentary habits, overeating, spicy/rich food, alcohol, coffee",
            "Constant ineffectual urge to pass stool",
            "Painful, itchy haemorrhoids with irregular bowel movements",
            "Worse: morning, mental exertion  |  Better: rest, evening",
            "Ideal for: office workers, stressed professionals",
        ]
    },
    {
        "name": "Aloe socotrina (Aloe)", "latin": "Socotrine Aloe", "emoji": "🪴",
        "key": "Grape-like protrusion — relieved by cold",
        "bullets": [
            "Haemorrhoids protrude like a bunch of grapes",
            "Soothed by cold compresses or cold water",
            "Alternates with diarrhoea; marked flatulence",
            "Intense burning and itching at anus",
            "Worse: heat, summer  |  Better: cold applications",
        ]
    },
    {
        "name": "Pulsatilla", "latin": "Wind Flower (Pulsatilla pratensis)", "emoji": "🪻",
        "key": "Itchy, protruding piles — pregnancy/menstruation",
        "bullets": [
            "Itchy, uncomfortable piles with sticking pains",
            "Haemorrhoids protrude; better lying down",
            "Worse from warmth; better in open air",
            "Key remedy during pregnancy or around menstrual periods",
            "Suited to mild, emotional, weepy patients",
        ]
    },
    {
        "name": "Collinsonia canadensis", "latin": "Stone Root", "emoji": "🪨",
        "key": "Piles + chronic constipation — dry, hard stools",
        "bullets": [
            "Stubborn constipation with dry, hard stools",
            "Sensation of fullness or constriction in rectum",
            "Itching and pain during and after bowel movements",
            "Alternating constipation and diarrhoea",
            "Associated with portal congestion or heart conditions",
        ]
    },
    {
        "name": "Graphites", "latin": "Black Lead (Carbon)", "emoji": "✏️",
        "key": "Large dry stools + anal fissures + sticky discharge",
        "bullets": [
            "Constipation with very large, dry, knotty stools",
            "Anal itching, burning, and sticky discharge",
            "Feeling of heaviness in lower abdomen",
            "Haemorrhoids often associated with anal fissures",
            "Worse: warmth, night  |  Better: cold applications",
        ]
    },
]

# Build 2-column layout for primary remedies
col_left = []
col_right = []
for i, r in enumerate(primary_remedies):
    card_items = remedy_card(r["name"], r["latin"], r["emoji"], r["bullets"], r["key"])
    # wrap in a styled table
    card_data = [[item] for item in card_items]
    card_table = Table(card_data, colWidths=[83*mm])
    card_table.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,-1), WHITE),
        ("BOX",           (0,0), (-1,-1), 0.8, ACCENT_GREEN),
        ("LINEBELOW",     (0,0), (0,0), 0.5, LIGHT_GREEN),
        ("TOPPADDING",    (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 4),
        ("LEFTPADDING",   (0,0), (-1,-1), 7),
        ("RIGHTPADDING",  (0,0), (-1,-1), 5),
        ("ROWBACKGROUNDS", (0,0), (-1,-1), [WHITE]),
    ]))
    if i % 2 == 0:
        col_left.append(card_table)
        col_left.append(Spacer(1, 3*mm))
    else:
        col_right.append(card_table)
        col_right.append(Spacer(1, 3*mm))

# Pad shorter column
while len(col_left) < len(col_right):
    col_left.append(Spacer(1, 1))
while len(col_right) < len(col_left):
    col_right.append(Spacer(1, 1))

from reportlab.platypus import Frame, BaseDocTemplate, PageTemplate
from reportlab.platypus import BalancedColumns

# Use a simple 2-col table approach
max_rows = max(len(col_left), len(col_right))
two_col_data = []
for i in range(max_rows):
    l = col_left[i] if i < len(col_left) else Spacer(1,1)
    r = col_right[i] if i < len(col_right) else Spacer(1,1)
    two_col_data.append([l, r])

two_col_table = Table(two_col_data, colWidths=[86*mm, 86*mm], hAlign="CENTER")
two_col_table.setStyle(TableStyle([
    ("VALIGN",       (0,0), (-1,-1), "TOP"),
    ("LEFTPADDING",  (0,0), (-1,-1), 0),
    ("RIGHTPADDING", (0,0), (-1,-1), 0),
    ("TOPPADDING",   (0,0), (-1,-1), 0),
    ("BOTTOMPADDING",(0,0), (-1,-1), 0),
    ("COLPADDING",   (0,0), (-1,-1), 3),
]))
story.append(two_col_table)
story.append(Spacer(1, 6*mm))

# ── OTHER REMEDIES TABLE ──────────────────────────────────────────────────────
story.append(section_banner("◆  OTHER USEFUL REMEDIES", color=colors.HexColor("#1565C0")))
story.append(Spacer(1, 4*mm))

other_headers = ["Remedy", "Common Name", "Key Indication"]
other_data = [
    [Paragraph(h, table_header_style) for h in other_headers]
]
other_remedies = [
    ("Arnica montana",     "Leopard's Bane",   "Sore, bruised piles after straining, childbirth, or heavy lifting"),
    ("Calcarea fluorica",  "Calcium Fluoride",  "Bleeding + itching piles; internal haemorrhoids with sacral/back soreness"),
    ("Ignatia amara",      "St. Ignatius Bean", "Spasms + stabbing rectal pain; emotional patients; rectal prolapse tendency"),
    ("Paeonia officinalis","Peony",             "Burning pain after stool; rawness, stitching; also for anal fissures"),
    ("Muriaticum acidum",  "Muriatic Acid",     "Very sensitive, swollen, bluish haemorrhoids — too painful to touch"),
    ("Arsenicum album",    "Arsenic Trioxide",  "Burning piles RELIEVED by warm/hot water; restlessness and anxiety"),
    ("Phosphorus",         "White Phosphorus",  "Bright red bleeding; tall, thin, anxious patients"),
    ("Sepia",              "Cuttlefish Ink",    "Bearing-down sensation; hormonal association in women"),
    ("Nitric acidum",      "Nitric Acid",       "Sharp, splinter-like rectal pains; bleeding after bowel movement"),
    ("Capsicum annuum",    "Cayenne Pepper",    "Burning sensation at anus; worse cold; often linked to homesickness"),
]
row_colors = [PALE_GREEN, WHITE]
for i, (rem, common, indication) in enumerate(other_remedies):
    other_data.append([
        Paragraph(f"<b>{rem}</b>", table_cell_style),
        Paragraph(f"<i>{common}</i>", table_cell_style),
        Paragraph(indication, table_cell_style),
    ])

other_table = Table(other_data, colWidths=[52*mm, 38*mm, 85*mm])
other_ts = TableStyle([
    ("BACKGROUND",    (0,0), (-1,0), colors.HexColor("#1565C0")),
    ("TEXTCOLOR",     (0,0), (-1,0), WHITE),
    ("FONTNAME",      (0,0), (-1,0), "Helvetica-Bold"),
    ("FONTSIZE",      (0,0), (-1,0), 9),
    ("ALIGN",         (0,0), (-1,0), "CENTER"),
    ("TOPPADDING",    (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING",   (0,0), (-1,-1), 6),
    ("RIGHTPADDING",  (0,0), (-1,-1), 6),
    ("GRID",          (0,0), (-1,-1), 0.4, colors.HexColor("#BBDEFB")),
    ("VALIGN",        (0,0), (-1,-1), "MIDDLE"),
])
for i in range(1, len(other_data)):
    bg = PALE_GREEN if i % 2 == 1 else WHITE
    other_ts.add("BACKGROUND", (0, i), (-1, i), bg)
other_table.setStyle(other_ts)
story.append(other_table)
story.append(Spacer(1, 6*mm))

# ── POTENCY & DOSAGE TABLE ────────────────────────────────────────────────────
story.append(section_banner("💊  POTENCY & DOSAGE GUIDE", color=colors.HexColor("#6A1B9A")))
story.append(Spacer(1, 4*mm))

dosage_data = [
    [Paragraph(h, table_header_style) for h in ["Situation", "Potency", "Frequency", "Notes"]],
    [Paragraph("Acute symptoms", table_cell_style),
     Paragraph("<b>30C</b>", table_cell_style),
     Paragraph("3–4 times daily", table_cell_style),
     Paragraph("Stop when symptoms improve", table_cell_style)],
    [Paragraph("Sub-acute / recurring", table_cell_style),
     Paragraph("<b>6C or 12C</b>", table_cell_style),
     Paragraph("Twice daily", table_cell_style),
     Paragraph("Continue for 1–2 weeks", table_cell_style)],
    [Paragraph("Constitutional / chronic", table_cell_style),
     Paragraph("<b>200C or 1M</b>", table_cell_style),
     Paragraph("Single dose; wait & watch", table_cell_style),
     Paragraph("Consult qualified practitioner", table_cell_style)],
    [Paragraph("Self-care (home use)", table_cell_style),
     Paragraph("<b>6C or 30C</b>", table_cell_style),
     Paragraph("As needed", table_cell_style),
     Paragraph("3–4 doses max; reassess if no relief", table_cell_style)],
]
dosage_table = Table(dosage_data, colWidths=[42*mm, 28*mm, 42*mm, 63*mm])
dosage_ts = TableStyle([
    ("BACKGROUND",    (0,0), (-1,0), colors.HexColor("#6A1B9A")),
    ("TEXTCOLOR",     (0,0), (-1,0), WHITE),
    ("TOPPADDING",    (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING",   (0,0), (-1,-1), 6),
    ("RIGHTPADDING",  (0,0), (-1,-1), 6),
    ("GRID",          (0,0), (-1,-1), 0.4, colors.HexColor("#E1BEE7")),
    ("VALIGN",        (0,0), (-1,-1), "MIDDLE"),
])
for i in range(1, len(dosage_data)):
    bg = colors.HexColor("#F3E5F5") if i % 2 == 1 else WHITE
    dosage_ts.add("BACKGROUND", (0, i), (-1, i), bg)
dosage_table.setStyle(dosage_ts)
story.append(dosage_table)
story.append(Spacer(1, 6*mm))

# ── WARNING BOX ───────────────────────────────────────────────────────────────
warning_items = [
    "Grade IV piles (completely prolapsed, cannot be reduced manually)",
    "Profuse or persistent rectal bleeding (rule out malignancy)",
    "Suspected rectal or colon cancer",
    "Acute thrombosed external haemorrhoid",
    "Anal fissure or fistula requiring surgical assessment",
]
warn_content = [Paragraph("⚠️  Seek Conventional Medical Care If:", ParagraphStyle(
    "WH", parent=styles["Normal"], fontSize=10, fontName="Helvetica-Bold",
    textColor=colors.HexColor("#B71C1C"), spaceAfter=4
))]
for w in warning_items:
    warn_content.append(Paragraph(f"• {w}", warning_style))

warn_data = [[item] for item in warn_content]
warn_table = Table(warn_data, colWidths=[175*mm])
warn_table.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,-1), colors.HexColor("#FFEBEE")),
    ("BOX",           (0,0), (-1,-1), 1.2, colors.HexColor("#E53935")),
    ("TOPPADDING",    (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING",   (0,0), (-1,-1), 10),
    ("RIGHTPADDING",  (0,0), (-1,-1), 10),
]))
story.append(warn_table)
story.append(Spacer(1, 5*mm))

# ── EVIDENCE NOTE ─────────────────────────────────────────────────────────────
evidence_text = (
    "Clinical Evidence: A 2024 double-blind RCT (PMID: 38301138) found individualized homeopathic medicines "
    "significantly superior to placebo for Grade I–III haemorrhoids. Sulphur was the most frequently prescribed remedy. "
    "Larger Phase 3 trials are ongoing."
)
story.append(Paragraph(evidence_text, note_style))
story.append(Spacer(1, 3*mm))
story.append(HRFlowable(width="100%", thickness=0.5, color=ACCENT_GREEN))
story.append(Spacer(1, 2*mm))
story.append(Paragraph(
    "For educational purposes only. This card does not constitute medical advice. "
    "Consult a qualified homeopath or physician for diagnosis and treatment.",
    footer_style
))

# ── BUILD ─────────────────────────────────────────────────────────────────────
doc.build(story)
print(f"PDF created: {OUTPUT}")
Running Command

cd /home/daytona/workspace/homeopathy-piles && python3 generate_pdf.py 2>&1

Running Command

ls -lh /home/daytona/workspace/homeopathy-piles/

Your PDF is ready! Download it here:

Homeopathic Piles Remedies Quick Reference

PDF Document · PDF


What's inside the PDF:
SectionContent
Primary Remedies8 main remedies in a 2-column card layout — each with name, Latin source, key symptom, and full bullet-point profile
Other Useful Remedies10 additional remedies (Arnica, Calcarea fluor, Ignatia, Paeonia, etc.) in a colour-coded table
Potency & Dosage GuideAcute vs. chronic vs. constitutional dosing table
Warning BoxRed-flagged situations requiring conventional medical care
Evidence Note2024 RCT reference (PMID: 38301138)

Create a comparison chart of top 3 remedies for specific symptoms

Running Command

ls -la /home/daytona/workspace/homeopathy-piles/

Writing File

~/homeopathy-piles/generate_comparison_chart.py

from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import mm
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, HRFlowable
from reportlab.lib.enums import TA_CENTER, TA_LEFT

OUTPUT = "/home/daytona/workspace/homeopathy-piles/Piles_Remedy_Comparison_Chart.pdf"

# ── Colour palette ────────────────────────────────────────────────────────────
C1        = colors.HexColor("#1B5E20")   # dark green  — Aesculus
C2        = colors.HexColor("#0D47A1")   # dark blue   — Hamamelis
C3        = colors.HexColor("#E65100")   # deep orange — Sulphur
C1_LIGHT  = colors.HexColor("#E8F5E9")
C2_LIGHT  = colors.HexColor("#E3F2FD")
C3_LIGHT  = colors.HexColor("#FFF3E0")
ROW_ALT   = colors.HexColor("#FAFAFA")
HEADER_BG = colors.HexColor("#212121")
DIVIDER   = colors.HexColor("#BDBDBD")
WHITE     = colors.white
TICK      = colors.HexColor("#2E7D32")
CROSS     = colors.HexColor("#C62828")
PARTIAL   = colors.HexColor("#F57F17")

# ── Styles ────────────────────────────────────────────────────────────────────
styles = getSampleStyleSheet()

def S(name, **kw):
    return ParagraphStyle(name, parent=styles["Normal"], **kw)

TITLE   = S("T",  fontSize=20, fontName="Helvetica-Bold", textColor=WHITE, alignment=TA_CENTER)
SUBT    = S("ST", fontSize=10, fontName="Helvetica",      textColor=colors.HexColor("#B0BEC5"), alignment=TA_CENTER)
COL_HDR = S("CH", fontSize=11, fontName="Helvetica-Bold", textColor=WHITE, alignment=TA_CENTER, leading=14)
COL_SUB = S("CS", fontSize=8,  fontName="Helvetica-Oblique", textColor=colors.HexColor("#B0BEC5"), alignment=TA_CENTER)
SYM_HDR = S("SH", fontSize=9,  fontName="Helvetica-Bold", textColor=WHITE, alignment=TA_LEFT, leading=12)
CELL    = S("CE", fontSize=9,  fontName="Helvetica",      textColor=colors.HexColor("#212121"), alignment=TA_CENTER, leading=12)
CELL_L  = S("CL", fontSize=9,  fontName="Helvetica",      textColor=colors.HexColor("#212121"), alignment=TA_LEFT,   leading=12)
CELL_B  = S("CB", fontSize=9,  fontName="Helvetica-Bold", textColor=colors.HexColor("#1A237E"), alignment=TA_CENTER, leading=12)
NOTE    = S("N",  fontSize=7.5,fontName="Helvetica-Oblique", textColor=colors.HexColor("#757575"), alignment=TA_CENTER)
LEGEND  = S("LG", fontSize=8.5,fontName="Helvetica",      textColor=colors.HexColor("#424242"), alignment=TA_LEFT)
SEC_HDR = S("SEC",fontSize=10, fontName="Helvetica-Bold", textColor=WHITE, alignment=TA_LEFT)

# ── Symbols ───────────────────────────────────────────────────────────────────
def tick(txt="✔ Yes"):
    return Paragraph(f'<font color="#2E7D32"><b>{txt}</b></font>', CELL)

def cross(txt="✘ No"):
    return Paragraph(f'<font color="#C62828">{txt}</font>', CELL)

def partial(txt="~ Partial"):
    return Paragraph(f'<font color="#F57F17">{txt}</font>', CELL)

def strong(txt):
    return Paragraph(f'<b>{txt}</b>', CELL)

def cell(txt):
    return Paragraph(txt, CELL)

def lcell(txt):
    return Paragraph(txt, CELL_L)

# ── Document ──────────────────────────────────────────────────────────────────
doc = SimpleDocTemplate(
    OUTPUT, pagesize=A4,
    leftMargin=14*mm, rightMargin=14*mm,
    topMargin=12*mm, bottomMargin=14*mm
)
story = []

# ── HEADER ────────────────────────────────────────────────────────────────────
hdr = Table([
    [Paragraph("Homeopathic Piles Remedies — Comparison Chart", TITLE)],
    [Paragraph("Top 3 Remedies mapped against key symptoms  •  Select the best-fit remedy at a glance", SUBT)],
], colWidths=[182*mm])
hdr.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,-1), HEADER_BG),
    ("TOPPADDING",    (0,0), (-1,-1), 12),
    ("BOTTOMPADDING", (0,0), (-1,-1), 12),
    ("LEFTPADDING",   (0,0), (-1,-1), 8),
    ("RIGHTPADDING",  (0,0), (-1,-1), 8),
]))
story.append(hdr)
story.append(Spacer(1, 5*mm))

# ── REMEDY IDENTITY ROW ───────────────────────────────────────────────────────
identity = Table([
    [
        Paragraph("", COL_HDR),
        Paragraph("AESCULUS\nhippocastanum", COL_HDR),
        Paragraph("HAMAMELIS\nvirginiana", COL_HDR),
        Paragraph("SULPHUR", COL_HDR),
    ],
    [
        Paragraph("", COL_SUB),
        Paragraph("Horse Chestnut", COL_SUB),
        Paragraph("Witch Hazel", COL_SUB),
        Paragraph("Elemental Sulphur", COL_SUB),
    ],
], colWidths=[52*mm, 43*mm, 43*mm, 43*mm])
identity.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (0,-1), colors.HexColor("#37474F")),
    ("BACKGROUND",    (1,0), (1,-1), C1),
    ("BACKGROUND",    (2,0), (2,-1), C2),
    ("BACKGROUND",    (3,0), (3,-1), C3),
    ("TOPPADDING",    (0,0), (-1,-1), 6),
    ("BOTTOMPADDING", (0,0), (-1,-1), 6),
    ("LEFTPADDING",   (0,0), (-1,-1), 4),
    ("RIGHTPADDING",  (0,0), (-1,-1), 4),
    ("LINEBELOW",     (0,0), (-1,0), 0.5, WHITE),
    ("BOX",           (0,0), (-1,-1), 0.5, DIVIDER),
]))
story.append(identity)
story.append(Spacer(1, 1*mm))

# ── SECTION BANNER HELPER ─────────────────────────────────────────────────────
def sec_banner(txt, color):
    t = Table([[Paragraph(f"  {txt}", SEC_HDR)]], colWidths=[182*mm])
    t.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,-1), color),
        ("TOPPADDING",    (0,0), (-1,-1), 4),
        ("BOTTOMPADDING", (0,0), (-1,-1), 4),
        ("LEFTPADDING",   (0,0), (-1,-1), 6),
        ("RIGHTPADDING",  (0,0), (-1,-1), 6),
    ]))
    return t

# ── MAIN COMPARISON TABLE ─────────────────────────────────────────────────────
#  Format: [symptom_label, aesculus_cell, hamamelis_cell, sulphur_cell]
#  Rows are grouped by symptom category.

COL_W = [52*mm, 43*mm, 43*mm, 43*mm]

def make_table(rows, alternate=True):
    t = Table(rows, colWidths=COL_W)
    style = [
        ("VALIGN",       (0,0), (-1,-1), "MIDDLE"),
        ("TOPPADDING",   (0,0), (-1,-1), 5),
        ("BOTTOMPADDING",(0,0), (-1,-1), 5),
        ("LEFTPADDING",  (0,0), (-1,-1), 6),
        ("RIGHTPADDING", (0,0), (-1,-1), 4),
        ("LINEBELOW",    (0,0), (-1,-2), 0.3, DIVIDER),
        ("BOX",          (0,0), (-1,-1), 0.5, DIVIDER),
        # Remedy column backgrounds (lighter tints)
        ("BACKGROUND",   (1,0), (1,-1), C1_LIGHT),
        ("BACKGROUND",   (2,0), (2,-1), C2_LIGHT),
        ("BACKGROUND",   (3,0), (3,-1), C3_LIGHT),
    ]
    if alternate:
        for i in range(0, len(rows), 2):
            style.append(("BACKGROUND", (0,i), (0,i), colors.HexColor("#ECEFF1")))
        for i in range(1, len(rows), 2):
            style.append(("BACKGROUND", (0,i), (0,i), ROW_ALT))
    t.setStyle(TableStyle(style))
    return t

# ─── 1. PAIN PROFILE ──────────────────────────────────────────────────────────
story.append(sec_banner("1.  PAIN PROFILE", colors.HexColor("#4E342E")))
pain_rows = [
    [lcell("Type of pain"),
     cell("Aching, sore, dull"),
     cell("Bruised, throbbing, raw"),
     cell("Burning, stinging")],
    [lcell("Duration of pain"),
     cell("Hours after bowel\nmovement"),
     cell("During & immediately\nafter bowel movement"),
     cell("Persistent; worse\nat night")],
    [lcell("Sensation in rectum"),
     cell("'Sharp sticks'\npoking inside"),
     cell("Soreness &\nrawness"),
     cell("Heat, fullness,\npressure")],
    [lcell("Back/sacral pain"),
     tick("✔ Prominent\n(low back)"),
     cross("✘ Absent"),
     cross("✘ Usually absent")],
    [lcell("Spasms / cramps"),
     cross("✘ Rare"),
     cross("✘ Rare"),
     partial("~ Occasional")],
]
story.append(make_table(pain_rows))
story.append(Spacer(1, 2*mm))

# ─── 2. BLEEDING ─────────────────────────────────────────────────────────────
story.append(sec_banner("2.  BLEEDING", colors.HexColor("#880E4F")))
bleed_rows = [
    [lcell("Presence of bleeding"),
     partial("~ Mild / occasional"),
     tick("✔ Hallmark symptom"),
     partial("~ Mild to moderate")],
    [lcell("Blood colour"),
     cell("Bright red"),
     cell("Dark, venous"),
     cell("Bright red to dark")],
    [lcell("Blood quantity"),
     cell("Small"),
     cell("Profuse, passive"),
     cell("Moderate")],
    [lcell("Bleeding triggered by…"),
     cell("Bowel movement"),
     cell("Spontaneous\n(not straining)"),
     cell("Bowel movement\nor touch")],
    [lcell("Bleeding relieves\nhaemorrhoid pain?"),
     tick("✔ Yes — piles feel\nbetter when bleeding"),
     cross("✘ No"),
     cross("✘ No")],
]
story.append(make_table(bleed_rows))
story.append(Spacer(1, 2*mm))

# ─── 3. APPEARANCE & PROTRUSION ──────────────────────────────────────────────
story.append(sec_banner("3.  APPEARANCE & PROTRUSION", colors.HexColor("#1A237E")))
appear_rows = [
    [lcell("Haemorrhoid appearance"),
     cell("Swollen, purple,\nengorged"),
     cell("Congested, dark,\nvenous"),
     cell("Red, inflamed,\noozing")],
    [lcell("Protrusion"),
     partial("~ External; large\nand swollen"),
     partial("~ Variable"),
     tick("✔ Marked; may\nprotrude significantly")],
    [lcell("Anal appearance"),
     cell("Congested,\npurple-red"),
     cell("Swollen, raw"),
     cell("Red, hot,\ninflamed")],
    [lcell("Discharge / oozing"),
     cross("✘ Rare"),
     cross("✘ Rare"),
     tick("✔ Moist, oozing,\noffensive")],
]
story.append(make_table(appear_rows))
story.append(Spacer(1, 2*mm))

# ─── 4. ITCH & MODALITIES ────────────────────────────────────────────────────
story.append(sec_banner("4.  ITCHING & MODALITIES", colors.HexColor("#004D40")))
mod_rows = [
    [lcell("Itching at anus"),
     partial("~ Mild"),
     partial("~ Mild"),
     tick("✔ Intense, persistent")],
    [lcell("Better from"),
     cell("Cool open air;\nrest"),
     cell("Cold applications;\nrest"),
     cell("Dry, cool air;\nscratching (briefly)")],
    [lcell("Worse from"),
     cell("Walking, stooping,\nmorning"),
     cell("Touch, pressure,\nwarmth"),
     cell("Heat, bathing,\nwarmth, standing")],
    [lcell("Effect of bathing"),
     partial("~ Neutral"),
     partial("~ Neutral"),
     cross("✘ WORSE\n(key modality)")],
    [lcell("Time modality"),
     cell("Morning worse"),
     cell("None specific"),
     cell("Night worse;\nfeel worse on waking")],
]
story.append(make_table(mod_rows))
story.append(Spacer(1, 2*mm))

# ─── 5. BOWEL & DIGESTION ────────────────────────────────────────────────────
story.append(sec_banner("5.  BOWEL & DIGESTIVE SYMPTOMS", colors.HexColor("#3E2723")))
bowel_rows = [
    [lcell("Associated constipation"),
     tick("✔ Common"),
     partial("~ Occasional"),
     tick("✔ Common")],
    [lcell("Diarrhoea association"),
     cross("✘ Rare"),
     cross("✘ Rare"),
     partial("~ Alternating\nconstipation/diarrhoea")],
    [lcell("Flatulence"),
     partial("~ Mild"),
     cross("✘ Absent"),
     tick("✔ Marked; offensive\nsmell")],
    [lcell("Tenesmus (urge without\nresult)"),
     cross("✘ Not marked"),
     cross("✘ Not marked"),
     partial("~ Occasional")],
    [lcell("Portal / venous\ncongestion"),
     tick("✔ Pronounced"),
     tick("✔ Primary action"),
     partial("~ Secondary")],
]
story.append(make_table(bowel_rows))
story.append(Spacer(1, 2*mm))

# ─── 6. PATIENT PROFILE ──────────────────────────────────────────────────────
story.append(sec_banner("6.  PATIENT / CONSTITUTIONAL PROFILE", colors.HexColor("#263238")))
pt_rows = [
    [lcell("Typical patient"),
     cell("Middle-aged; tends\nto back problems;\noverweight"),
     cell("Any age; venous\nweakness; varicose\nveins tendency"),
     cell("Warm-blooded;\ntends to skin\nproblems; hot feet")],
    [lcell("Lifestyle trigger"),
     cell("Sedentary;\nlong standing/sitting"),
     cell("Venous stasis;\npregnancy"),
     cell("Any; aggravated\nby heat")],
    [lcell("Emotional state"),
     cell("Irritable,\ndepressed"),
     cell("Calm or\nneutral"),
     cell("Critical, self-\nopinionated")],
    [lcell("Skin tendency"),
     cell("Venous congestion\nelsewhere"),
     cell("Bruises easily;\nvascular weakness"),
     cell("Dry, itchy skin;\neczema history")],
    [lcell("Common potency used"),
     cell("30C — 200C"),
     cell("30C — Mother\nTincture (topical)"),
     cell("30C — 200C\n(constitutional)")],
]
story.append(make_table(pt_rows))
story.append(Spacer(1, 3*mm))

# ── QUICK-PICK SUMMARY BOX ────────────────────────────────────────────────────
summary_data = [
    [Paragraph("QUICK-PICK GUIDE", S("QP", fontSize=10, fontName="Helvetica-Bold",
        textColor=WHITE, alignment=TA_CENTER))],
]
sum_banner = Table(summary_data, colWidths=[182*mm])
sum_banner.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,-1), colors.HexColor("#37474F")),
    ("TOPPADDING",    (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
]))
story.append(sum_banner)

pick_rows = [
    [
        Paragraph("<b>Choose AESCULUS if:</b>", S("A1", fontSize=9, fontName="Helvetica-Bold", textColor=C1, leading=13)),
        Paragraph("<b>Choose HAMAMELIS if:</b>", S("A2", fontSize=9, fontName="Helvetica-Bold", textColor=C2, leading=13)),
        Paragraph("<b>Choose SULPHUR if:</b>", S("A3", fontSize=9, fontName="Helvetica-Bold", textColor=C3, leading=13)),
    ],
    [
        Paragraph(
            "• Aching piles + low backache<br/>"
            "• Sensation of sharp sticks inside<br/>"
            "• Pain lingers hours after stool<br/>"
            "• Piles bleed and then feel better<br/>"
            "• Purple, engorged, external piles",
            S("AP", fontSize=8.5, fontName="Helvetica", textColor=colors.HexColor("#212121"), leading=13, leftIndent=4)),
        Paragraph(
            "• Dark, passive, profuse bleeding<br/>"
            "• No straining needed for bleeding<br/>"
            "• Throbbing rawness in rectum<br/>"
            "• Venous weakness / varicose veins<br/>"
            "• Better with cold; worse with touch",
            S("HP", fontSize=8.5, fontName="Helvetica", textColor=colors.HexColor("#212121"), leading=13, leftIndent=4)),
        Paragraph(
            "• Intense itching + burning at anus<br/>"
            "• Red, inflamed, protruding piles<br/>"
            "• WORSE from heat & bathing<br/>"
            "• Offensive flatulence + fullness<br/>"
            "• Dry skin / eczema history",
            S("SP", fontSize=8.5, fontName="Helvetica", textColor=colors.HexColor("#212121"), leading=13, leftIndent=4)),
    ],
]
pick_table = Table(pick_rows, colWidths=[60*mm, 61*mm, 61*mm])
pick_table.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (0,-1), C1_LIGHT),
    ("BACKGROUND",    (1,0), (1,-1), C2_LIGHT),
    ("BACKGROUND",    (2,0), (2,-1), C3_LIGHT),
    ("LINEABOVE",     (0,0), (-1,0), 0.5, DIVIDER),
    ("LINEBELOW",     (0,0), (-1,0), 0.5, DIVIDER),
    ("BOX",           (0,0), (-1,-1), 0.8, DIVIDER),
    ("INNERGRID",     (0,0), (-1,-1), 0.3, DIVIDER),
    ("TOPPADDING",    (0,0), (-1,-1), 6),
    ("BOTTOMPADDING", (0,0), (-1,-1), 6),
    ("LEFTPADDING",   (0,0), (-1,-1), 7),
    ("RIGHTPADDING",  (0,0), (-1,-1), 5),
    ("VALIGN",        (0,0), (-1,-1), "TOP"),
]))
story.append(pick_table)
story.append(Spacer(1, 4*mm))

# ── LEGEND ────────────────────────────────────────────────────────────────────
legend_items = [
    ("✔ Yes / Prominent", TICK),
    ("✘ No / Absent",     CROSS),
    ("~ Partial / Variable", PARTIAL),
]
legend_cells = []
for txt, col in legend_items:
    legend_cells.append(Paragraph(
        f'<font color="#{col.hexval()[1:]}">{txt}</font>',
        S("LC", fontSize=8, fontName="Helvetica", textColor=colors.HexColor("#424242"))
    ))
leg_table = Table([legend_cells], colWidths=[60*mm, 61*mm, 61*mm])
leg_table.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,-1), colors.HexColor("#F5F5F5")),
    ("BOX",           (0,0), (-1,-1), 0.5, DIVIDER),
    ("TOPPADDING",    (0,0), (-1,-1), 4),
    ("BOTTOMPADDING", (0,0), (-1,-1), 4),
    ("LEFTPADDING",   (0,0), (-1,-1), 8),
    ("ALIGN",         (0,0), (-1,-1), "LEFT"),
]))
story.append(leg_table)
story.append(Spacer(1, 2*mm))
story.append(HRFlowable(width="100%", thickness=0.5, color=DIVIDER))
story.append(Spacer(1, 2*mm))
story.append(Paragraph(
    "For educational purposes only. Consult a qualified homeopath or physician for treatment. "
    "Evidence: RCT — PMID 38301138 (2024). Most commonly prescribed remedy: Sulphur.",
    NOTE
))

# ── BUILD ─────────────────────────────────────────────────────────────────────
doc.build(story)
print(f"PDF created: {OUTPUT}")
Your credits are exhausted. Your daily credits reset tomorrow, or you can purchase a top-up for more.
This is a shared conversation. Sign in to Orris to start your own chat.