Liver thorax gall bladder bile ducts homeopathic medicine for surgery creative pdf

Asking for Preferences
Reading File
Searching the Web

homeopathic remedies liver gallbladder bile ducts indications materia medica

Finding Sources
Reading Web Page

https://www.homeobook.com/disorders-of-gall-bladder-and-homo…

Reading File
Running Command

mkdir -p /tmp/workspace/homeo-liver-pdf && ls /tmp/workspace/homeo-liver-pdf/

Writing File

~/homeo-liver-pdf/generate_pdf.py


from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import mm, cm
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    HRFlowable, KeepTogether, PageBreak
)
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.platypus import Flowable
from reportlab.graphics.shapes import Drawing, Rect, String, Circle, Line
from reportlab.graphics import renderPDF
import os

OUTPUT = "/tmp/workspace/homeo-liver-pdf/Homeopathic_Liver_Gallbladder_BileDucts.pdf"

# ── Colour palette ──────────────────────────────────────────────────────────
DARK_GREEN   = colors.HexColor("#1B5E20")
MID_GREEN    = colors.HexColor("#388E3C")
LIGHT_GREEN  = colors.HexColor("#A5D6A7")
PALE_GREEN   = colors.HexColor("#E8F5E9")
AMBER        = colors.HexColor("#FF8F00")
AMBER_LIGHT  = colors.HexColor("#FFF8E1")
TEAL         = colors.HexColor("#00695C")
TEAL_LIGHT   = colors.HexColor("#E0F2F1")
ORANGE       = colors.HexColor("#E65100")
ORANGE_LIGHT = colors.HexColor("#FBE9E7")
INDIGO       = colors.HexColor("#1A237E")
INDIGO_LIGHT = colors.HexColor("#E8EAF6")
PURPLE       = colors.HexColor("#4A148C")
PURPLE_LIGHT = colors.HexColor("#F3E5F5")
GOLD         = colors.HexColor("#F9A825")
WHITE        = colors.white
DARK_GREY    = colors.HexColor("#212121")
MID_GREY     = colors.HexColor("#616161")
LIGHT_GREY   = colors.HexColor("#F5F5F5")

# ── Custom Flowables ─────────────────────────────────────────────────────────
class ColorBanner(Flowable):
    """Full-width colored banner with title text."""
    def __init__(self, text, bg_color, text_color=WHITE, height=22*mm, font_size=20):
        Flowable.__init__(self)
        self.text = text
        self.bg_color = bg_color
        self.text_color = text_color
        self.height = height
        self.font_size = font_size

    def wrap(self, availWidth, availHeight):
        self.width = availWidth
        return self.width, self.height

    def draw(self):
        c = self.canv
        # background
        c.setFillColor(self.bg_color)
        c.roundRect(0, 0, self.width, self.height, 8, fill=1, stroke=0)
        # text
        c.setFillColor(self.text_color)
        c.setFont("Helvetica-Bold", self.font_size)
        c.drawCentredString(self.width / 2, self.height / 2 - self.font_size / 3, self.text)


class SectionHeader(Flowable):
    """Colored left-accent section header."""
    def __init__(self, text, accent_color, bg_color, text_color=WHITE, height=12*mm):
        Flowable.__init__(self)
        self.text = text
        self.accent_color = accent_color
        self.bg_color = bg_color
        self.text_color = text_color
        self.height = height

    def wrap(self, availWidth, availHeight):
        self.width = availWidth
        return self.width, self.height

    def draw(self):
        c = self.canv
        c.setFillColor(self.bg_color)
        c.roundRect(0, 0, self.width, self.height, 5, fill=1, stroke=0)
        c.setFillColor(self.accent_color)
        c.rect(0, 0, 5, self.height, fill=1, stroke=0)
        c.setFillColor(self.text_color)
        c.setFont("Helvetica-Bold", 13)
        c.drawString(14, self.height / 2 - 5, self.text)


class DividerLine(Flowable):
    def __init__(self, color=LIGHT_GREEN, thickness=1.5):
        Flowable.__init__(self)
        self.color = color
        self.thickness = thickness

    def wrap(self, availWidth, availHeight):
        self.width = availWidth
        return self.width, self.thickness + 2

    def draw(self):
        c = self.canv
        c.setStrokeColor(self.color)
        c.setLineWidth(self.thickness)
        c.line(0, 0, self.width, 0)


# ── Styles ───────────────────────────────────────────────────────────────────
base_styles = getSampleStyleSheet()

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

STYLES = {
    "body": S("body", fontSize=10, leading=14, textColor=DARK_GREY,
              fontName="Helvetica", spaceAfter=4),
    "bold_body": S("bold_body", fontSize=10, leading=14, textColor=DARK_GREY,
                   fontName="Helvetica-Bold"),
    "small": S("small", fontSize=8.5, leading=12, textColor=MID_GREY,
               fontName="Helvetica-Oblique"),
    "remedy_name": S("remedy_name", fontSize=12, leading=16, textColor=DARK_GREEN,
                     fontName="Helvetica-Bold"),
    "latin": S("latin", fontSize=9, leading=13, textColor=TEAL,
               fontName="Helvetica-Oblique"),
    "center": S("center", fontSize=10, leading=14, textColor=DARK_GREY,
                fontName="Helvetica", alignment=TA_CENTER),
    "center_bold": S("center_bold", fontSize=11, leading=15, textColor=WHITE,
                     fontName="Helvetica-Bold", alignment=TA_CENTER),
    "disclaimer": S("disclaimer", fontSize=8, leading=11, textColor=MID_GREY,
                    fontName="Helvetica-Oblique", alignment=TA_CENTER),
    "toc_title": S("toc_title", fontSize=11, leading=16, textColor=INDIGO,
                   fontName="Helvetica-Bold"),
    "toc_entry": S("toc_entry", fontSize=10, leading=14, textColor=DARK_GREY,
                   fontName="Helvetica"),
    "organ_title": S("organ_title", fontSize=13, leading=18, textColor=WHITE,
                     fontName="Helvetica-Bold", alignment=TA_CENTER),
    "key_note": S("key_note", fontSize=9.5, leading=14, textColor=ORANGE,
                  fontName="Helvetica-Bold"),
    "symptom": S("symptom", fontSize=9.5, leading=13, textColor=DARK_GREY,
                 fontName="Helvetica", leftIndent=10),
}

# ── Remedy Data ───────────────────────────────────────────────────────────────
REMEDIES = [
    {
        "name": "Chelidonium Majus",
        "common": "Greater Celandine",
        "color": MID_GREEN,
        "bg": PALE_GREEN,
        "organ": "Liver β€’ Gallbladder β€’ Bile Ducts",
        "keynote": "Constant pain under the right shoulder blade β€” the hallmark liver sign.",
        "indications": [
            "Jaundice with yellow-coated tongue and clay-coloured stools",
            "Pain in right hypochondrium radiating to right scapula",
            "Liver enlargement with tenderness on palpation",
            "Biliary colic and obstruction of bile flow",
            "Nausea and vomiting of bile; bitter taste in mouth",
            "Weakness and lethargy with hepatic congestion",
        ],
        "modalities": "Worse: motion, pressure, 4 a.m. / 4 p.m.  |  Better: hot food, warm drinks",
        "potency": "Q (mother tincture), 6C, 30C β€” 2–3Γ— daily",
    },
    {
        "name": "Lycopodium Clavatum",
        "common": "Club Moss",
        "color": TEAL,
        "bg": TEAL_LIGHT,
        "organ": "Liver β€’ Gallbladder β€’ Digestive System",
        "keynote": "Bloating and gas with right-sided liver trouble; 4–8 p.m. aggravation.",
        "indications": [
            "Right-sided hepatic pain; recurrent bilious attacks",
            "Gallstone colic β€” remedies tend to soften stones",
            "Sour belching; distension after eating even small amounts",
            "Liver sensitive; brown spots on abdomen; dropsy",
            "Craving for sweets; worse cold drinks, better warm",
            "Gradually declining digestive power with liver involvement",
        ],
        "modalities": "Worse: 4–8 p.m., cold drinks, tight clothing  |  Better: warm drinks, motion",
        "potency": "30C, 200C β€” once or twice daily",
    },
    {
        "name": "Berberis Vulgaris",
        "common": "Barberry",
        "color": AMBER,
        "bg": AMBER_LIGHT,
        "organ": "Liver β€’ Gallbladder β€’ Bile Ducts β€’ Kidneys",
        "keynote": "Radiating, bubbling pains from liver and gallbladder in all directions.",
        "indications": [
            "Gallstone colic β€” helps pass small stones through bile duct",
            "Stitching, bubbling pains that radiate from the liver region",
            "Biliary and renal calculi occurring together",
            "Jaundice; bile-stained urine; pale stools",
            "Fistula in ano associated with liver disease",
            "Kent: 'Berberis will let the small stone loose and it will pass through'",
        ],
        "modalities": "Worse: motion, jarring, fatigue  |  Better: rest, standing still",
        "potency": "Q, 6C, 30C β€” 3Γ— daily during colic",
    },
    {
        "name": "Carduus Marianus",
        "common": "Milk Thistle / St. Mary's Thistle",
        "color": PURPLE,
        "bg": PURPLE_LIGHT,
        "organ": "Liver β€’ Gallbladder β€’ Spleen",
        "keynote": "Engorged, congested liver with gallstones and portal hypertension.",
        "indications": [
            "Liver enlargement with engorged sensation",
            "Gallstones with a 'crawling sensation' through biliary duct",
            "White-coated tongue with red indented edges",
            "Cirrhosis and hepatic derangements",
            "Jaundice; heaviness; stitching pains in liver",
            "Haemorrhages associated with hepatic disease",
        ],
        "modalities": "Worse: lying on left side, exertion  |  Better: rest",
        "potency": "Q, 30C β€” twice daily",
    },
    {
        "name": "Nux Vomica",
        "common": "Poison Nut",
        "color": ORANGE,
        "bg": ORANGE_LIGHT,
        "organ": "Liver β€’ Gallbladder β€’ Digestive System",
        "keynote": "Over-indulgence, sedentary lifestyle, irritability β€” the 'city liver' remedy.",
        "indications": [
            "Liver disorders from over-eating, alcohol, drugs, and stress",
            "Gallbladder colic with extreme irritability and sensitivity",
            "Nausea, retching, cannot vomit or incomplete vomiting",
            "Constipation alternating with urge to stool without relief",
            "Chilly, oversensitive to light, noise, odours",
            "Bilious attacks in sedentary, type-A personalities",
        ],
        "modalities": "Worse: morning, cold, spices, stimulants  |  Better: rest, warmth, evening",
        "potency": "30C, 200C β€” single dose at bedtime",
    },
    {
        "name": "Phosphorus",
        "common": "Phosphorus",
        "color": INDIGO,
        "bg": INDIGO_LIGHT,
        "organ": "Liver β€’ Hepatic Parenchyma β€’ Bile Ducts",
        "keynote": "Fatty degeneration and necrosis of liver; haemorrhagic tendencies.",
        "indications": [
            "Hepatitis, fatty liver, early cirrhosis",
            "Jaundice; yellow atrophy of the liver",
            "Haemorrhages from liver disease (hepatic failure)",
            "Great thirst for cold water which is vomited when warm",
            "Left lobe of liver very sensitive",
            "Influenza when liver is prominently affected",
        ],
        "modalities": "Worse: lying on left side, warm food, evening  |  Better: cold drinks, sleep",
        "potency": "30C, 200C β€” under supervision",
    },
    {
        "name": "Calcarea Carbonica",
        "common": "Calcium Carbonate (Oyster Shell)",
        "color": colors.HexColor("#795548"),
        "bg": colors.HexColor("#EFEBE9"),
        "organ": "Liver β€’ Gallbladder β€’ Constitutional",
        "keynote": "Overweight, chilly, sluggish constitution prone to gallstone formation.",
        "indications": [
            "Gallstones in an obese, fair, flabby, chilly individual",
            "Biliary calculi with sluggish metabolism and hypothyroid tendency",
            "Liver sensitive and distended; acid eructations",
            "Profuse sweating on head and feet; worse cold damp weather",
            "Cravings for eggs, chalk, sweets, and indigestible things",
            "Constitutional base for recurrent gallbladder episodes",
        ],
        "modalities": "Worse: cold, exertion, full moon  |  Better: dry weather, lying on painful side",
        "potency": "200C, 1M β€” constitutional dose",
    },
    {
        "name": "Dioscorea Villosa",
        "common": "Wild Yam",
        "color": colors.HexColor("#006064"),
        "bg": colors.HexColor("#E0F7FA"),
        "organ": "Gallbladder β€’ Bile Ducts β€’ Colic",
        "keynote": "Sudden, radiating, twisting colic β€” better by stretching out or bending backward.",
        "indications": [
            "Gallbladder and bile duct colic at 7 p.m.",
            "Neuralgia and spasmodic affections of liver and bile ducts",
            "Pains dart from gall-ducts to all parts of the body",
            "Worse doubling up; dramatically better stretching backwards",
            "Cutting, twisting, griping pains β€” paroxysmal",
            "Constant dull ache between paroxysms of severe colic",
        ],
        "modalities": "Worse: doubling up, lying, evenings  |  Better: stretching, bending backward, hard pressure",
        "potency": "6C, 30C β€” during acute colic",
    },
    {
        "name": "Hydrastis Canadensis",
        "common": "Golden Seal",
        "color": colors.HexColor("#F57F17"),
        "bg": colors.HexColor("#FFFDE7"),
        "organ": "Liver β€’ Gallbladder β€’ Bile Ducts β€’ Mucous Membranes",
        "keynote": "Catarrhal inflammation of the mucous lining of gallbladder and biliary ducts.",
        "indications": [
            "Catarrhal cholecystitis and cholangitis",
            "Skin yellow; white, frequent stools",
            "Fullness and tenderness over the hepatic region",
            "Cutting pain from liver to right scapula; < lying on back",
            "Tongue yellow, thickly coated; bitter taste",
            "Mucus-laden bile; thick, stringy secretions",
        ],
        "modalities": "Worse: lying on back, cold air  |  Better: warmth, rest",
        "potency": "Q, 6C, 30C β€” twice daily",
    },
    {
        "name": "Cholesterinum",
        "common": "Cholesterol",
        "color": colors.HexColor("#BF360C"),
        "bg": colors.HexColor("#FBE9E7"),
        "organ": "Liver β€’ Gallbladder β€’ Cholesterol Metabolism",
        "keynote": "Cholesterol-based gallstones; hepatic cancer and obstruction (isopathic use).",
        "indications": [
            "Cholesterol gallstones β€” used isopathically",
            "Obstruction of the biliary tract with jaundice",
            "Liver enlargement; pain in the hepatic region",
            "Suspected hepatic malignancy or carcinoma",
            "Intractable and chronic liver conditions not responding to other remedies",
        ],
        "modalities": "Used constitutionally β€” no specific modalities documented",
        "potency": "3X, 6C, 30C β€” short courses",
    },
    {
        "name": "Podophyllum Peltatum",
        "common": "May Apple",
        "color": colors.HexColor("#558B2F"),
        "bg": colors.HexColor("#F1F8E9"),
        "organ": "Liver β€’ Gallbladder β€’ Biliary Colic",
        "keynote": "Bilious colic with clay-coloured stools; must rub the liver region.",
        "indications": [
            "Biliary colic; pain compelling patient to rub the liver area",
            "Constipation with clay-coloured or yellow stools",
            "Tongue yellow or white, with imprint of teeth",
            "Pain in liver region, inclined to rub the part",
            "Colic at daylight every morning",
            "Better bending forward; better external warmth",
        ],
        "modalities": "Worse: early morning, hot weather  |  Better: bending forward, external heat",
        "potency": "6C, 30C β€” twice daily",
    },
    {
        "name": "Mercurius Dulcis",
        "common": "Calomel",
        "color": colors.HexColor("#37474F"),
        "bg": colors.HexColor("#ECEFF1"),
        "organ": "Bile Ducts β€’ Gallbladder β€’ Mucous Membranes",
        "keynote": "Specific for catarrh and inflammatory thickening of the common bile duct.",
        "indications": [
            "Catarrh and stenosis of bile ducts (Eustachian and biliary)",
            "Jaundice from hepatic duct obstruction",
            "Icteric conditions with clay-coloured stools and bile in urine",
            "Used as a drainage remedy for biliary stasis",
            "Swelling and thickening of biliary mucous membranes",
        ],
        "modalities": "Used in low potency for drainage",
        "potency": "3X, 6X β€” drainage remedy",
    },
]

# ── Quick-Reference Table Data ────────────────────────────────────────────────
QUICK_REF = [
    ["Remedy", "Primary Organ", "Key Symptom", "Potency"],
    ["Chelidonium", "Liver / Bile ducts", "Pain β†’ right shoulder blade", "Q / 30C"],
    ["Lycopodium", "Liver / Gallbladder", "Bloating, 4–8 PM worse", "30C / 200C"],
    ["Berberis Vulg.", "GB / Bile ducts", "Radiating, bubbling pain", "Q / 30C"],
    ["Carduus Mar.", "Liver / GB / Spleen", "Engorged liver, gallstones", "Q / 30C"],
    ["Nux Vomica", "Liver / Digestion", "Sedentary lifestyle toxicity", "30C / 200C"],
    ["Phosphorus", "Liver parenchyma", "Fatty degeneration, bleeding", "30C / 200C"],
    ["Calcarea Carb.", "Gallbladder / Const.", "Obese, chilly, sluggish", "200C / 1M"],
    ["Dioscorea", "GB / Bile ducts", "Radiating colic < doubling up", "6C / 30C"],
    ["Hydrastis", "GB / Bile ducts", "Catarrhal inflammation", "Q / 30C"],
    ["Cholesterinum", "Liver / Cholesterol", "Cholesterol stones (isopathic)", "3X / 6C"],
    ["Podophyllum", "Liver / GB", "Must rub liver; clay stools", "6C / 30C"],
    ["Merc. Dulcis", "Bile ducts", "Biliary duct stenosis", "3X / 6X"],
]

# ── Build PDF ─────────────────────────────────────────────────────────────────
doc = SimpleDocTemplate(
    OUTPUT,
    pagesize=A4,
    rightMargin=18*mm,
    leftMargin=18*mm,
    topMargin=16*mm,
    bottomMargin=16*mm,
    title="Homeopathic Remedies β€” Liver, Gallbladder & Bile Ducts",
    author="Orris Medical Reference",
)

story = []

# ── COVER / TITLE BANNER ──────────────────────────────────────────────────────
story.append(ColorBanner(
    "🌿  HOMEOPATHIC MATERIA MEDICA",
    DARK_GREEN, WHITE, height=28*mm, font_size=20
))
story.append(Spacer(1, 3*mm))
story.append(ColorBanner(
    "Liver Β· Gallbladder Β· Bile Ducts",
    AMBER, DARK_GREY, height=16*mm, font_size=15
))
story.append(Spacer(1, 4*mm))

intro = (
    "This reference guide covers 12 principal homeopathic remedies used in conditions affecting the liver, "
    "gallbladder, and biliary system β€” including hepatitis, fatty liver, cirrhosis, gallstone colic, "
    "cholecystitis, and bile duct obstruction. Each entry lists key indications, modalities, and "
    "suggested potencies from classical Materia Medica sources (Boericke, Kent, Clarke)."
)
story.append(Paragraph(intro, STYLES["body"]))
story.append(Spacer(1, 2*mm))

disclaimer = (
    "⚠  IMPORTANT: Homeopathic remedies should be selected by a qualified practitioner. "
    "This document is for educational/reference purposes only and does not replace medical diagnosis or treatment."
)
story.append(Paragraph(disclaimer, STYLES["disclaimer"]))
story.append(Spacer(1, 3*mm))
story.append(DividerLine(LIGHT_GREEN, 2))
story.append(Spacer(1, 4*mm))

# ── ANATOMY OVERVIEW BOX ─────────────────────────────────────────────────────
story.append(SectionHeader("  πŸ“š  BILIARY SYSTEM β€” OVERVIEW", DARK_GREEN, DARK_GREEN))
story.append(Spacer(1, 3*mm))

anatomy_text = [
    ["<b>Liver</b>", "Largest internal organ; produces 600–1000 mL bile/day; metabolises fats, drugs, toxins"],
    ["<b>Gallbladder</b>", "Stores and concentrates bile; releases bile into duodenum via cystic duct"],
    ["<b>Common Bile Duct</b>", "Joins cystic duct + hepatic duct; carries bile to the duodenum"],
    ["<b>Bile Canaliculi</b>", "Tiny channels within liver lobules β†’ collecting ducts β†’ hepatic ducts"],
    ["<b>Ampulla of Vater</b>", "Junction of bile duct and pancreatic duct entering the duodenum"],
]

anat_table = Table(anatomy_text, colWidths=[50*mm, 115*mm])
anat_table.setStyle(TableStyle([
    ("BACKGROUND", (0, 0), (0, -1), PALE_GREEN),
    ("BACKGROUND", (1, 0), (1, -1), WHITE),
    ("ROWBACKGROUNDS", (0, 0), (-1, -1), [PALE_GREEN, WHITE]),
    ("TEXTCOLOR", (0, 0), (-1, -1), DARK_GREY),
    ("FONTNAME", (0, 0), (0, -1), "Helvetica-Bold"),
    ("FONTSIZE", (0, 0), (-1, -1), 9.5),
    ("LEADING", (0, 0), (-1, -1), 13),
    ("TOPPADDING", (0, 0), (-1, -1), 5),
    ("BOTTOMPADDING", (0, 0), (-1, -1), 5),
    ("LEFTPADDING", (0, 0), (-1, -1), 8),
    ("GRID", (0, 0), (-1, -1), 0.5, LIGHT_GREEN),
    ("BOX", (0, 0), (-1, -1), 1, MID_GREEN),
]))
story.append(anat_table)
story.append(Spacer(1, 5*mm))

# ── REMEDY CARDS ─────────────────────────────────────────────────────────────
story.append(SectionHeader("  🌿  REMEDY PROFILES", DARK_GREEN, DARK_GREEN))
story.append(Spacer(1, 4*mm))

for i, rem in enumerate(REMEDIES):
    card_color = rem["color"]
    card_bg = rem["bg"]

    # Remedy name header
    name_data = [[
        Paragraph(f"<b>{rem['name']}</b>", ParagraphStyle(
            "rn", fontSize=13, textColor=WHITE, fontName="Helvetica-Bold"
        )),
        Paragraph(f"<i>{rem['common']}</i>", ParagraphStyle(
            "rc", fontSize=10, textColor=colors.HexColor("#FFFFFF"), fontName="Helvetica-Oblique", alignment=1
        )),
    ]]
    name_table = Table(name_data, colWidths=[90*mm, 75*mm])
    name_table.setStyle(TableStyle([
        ("BACKGROUND", (0, 0), (-1, -1), card_color),
        ("TOPPADDING", (0, 0), (-1, -1), 7),
        ("BOTTOMPADDING", (0, 0), (-1, -1), 7),
        ("LEFTPADDING", (0, 0), (-1, -1), 10),
        ("RIGHTPADDING", (0, 0), (-1, -1), 10),
        ("BOX", (0, 0), (-1, -1), 0, card_color),
    ]))

    # Organ row
    organ_data = [[
        Paragraph(f"πŸ«€  <b>Organ Affinity:</b>  {rem['organ']}", ParagraphStyle(
            "org", fontSize=9.5, textColor=card_color, fontName="Helvetica-Bold",
        )),
    ]]
    organ_table = Table(organ_data, colWidths=[165*mm])
    organ_table.setStyle(TableStyle([
        ("BACKGROUND", (0, 0), (-1, -1), card_bg),
        ("TOPPADDING", (0, 0), (-1, -1), 5),
        ("BOTTOMPADDING", (0, 0), (-1, -1), 5),
        ("LEFTPADDING", (0, 0), (-1, -1), 10),
        ("RIGHTPADDING", (0, 0), (-1, -1), 10),
    ]))

    # Keynote row
    keynote_data = [[
        Paragraph(f"⭐  <b>KEYNOTE:</b>  {rem['keynote']}", ParagraphStyle(
            "kn", fontSize=10, textColor=ORANGE, fontName="Helvetica-Bold",
        )),
    ]]
    keynote_table = Table(keynote_data, colWidths=[165*mm])
    keynote_table.setStyle(TableStyle([
        ("BACKGROUND", (0, 0), (-1, -1), AMBER_LIGHT),
        ("TOPPADDING", (0, 0), (-1, -1), 6),
        ("BOTTOMPADDING", (0, 0), (-1, -1), 6),
        ("LEFTPADDING", (0, 0), (-1, -1), 10),
        ("RIGHTPADDING", (0, 0), (-1, -1), 10),
        ("BOX", (0, 0), (-1, -1), 0.5, AMBER),
    ]))

    # Indications list
    indic_items = []
    for ind in rem["indications"]:
        indic_items.append(
            Paragraph(f"✦  {ind}", ParagraphStyle(
                "ind", fontSize=9.5, leading=13, textColor=DARK_GREY,
                fontName="Helvetica", leftIndent=5, spaceAfter=2,
            ))
        )

    indic_data = [[item] for item in indic_items]
    indic_table = Table(indic_data, colWidths=[165*mm])
    indic_table.setStyle(TableStyle([
        ("BACKGROUND", (0, 0), (-1, -1), card_bg),
        ("TOPPADDING", (0, 0), (-1, -1), 2),
        ("BOTTOMPADDING", (0, 0), (-1, -1), 2),
        ("LEFTPADDING", (0, 0), (-1, -1), 8),
        ("RIGHTPADDING", (0, 0), (-1, -1), 8),
    ]))

    # Modalities + Potency row
    mod_pot_data = [[
        Paragraph(f"<b>Modalities:</b>  {rem['modalities']}", ParagraphStyle(
            "mp", fontSize=9, leading=12, textColor=INDIGO, fontName="Helvetica",
        )),
        Paragraph(f"<b>Potency:</b>  {rem['potency']}", ParagraphStyle(
            "pp", fontSize=9, leading=12, textColor=PURPLE, fontName="Helvetica-Bold", alignment=1,
        )),
    ]]
    mod_pot_table = Table(mod_pot_data, colWidths=[100*mm, 65*mm])
    mod_pot_table.setStyle(TableStyle([
        ("BACKGROUND", (0, 0), (-1, -1), LIGHT_GREY),
        ("TOPPADDING", (0, 0), (-1, -1), 6),
        ("BOTTOMPADDING", (0, 0), (-1, -1), 6),
        ("LEFTPADDING", (0, 0), (-1, -1), 10),
        ("RIGHTPADDING", (0, 0), (-1, -1), 10),
        ("LINEBELOW", (0, 0), (-1, -1), 0.5, card_color),
    ]))

    card_block = [
        name_table,
        organ_table,
        keynote_table,
        indic_table,
        mod_pot_table,
        Spacer(1, 5*mm),
    ]
    story.append(KeepTogether(card_block))

# ── QUICK REFERENCE TABLE ────────────────────────────────────────────────────
story.append(PageBreak())
story.append(ColorBanner("⚑  QUICK REFERENCE CHART", INDIGO, WHITE, height=18*mm, font_size=16))
story.append(Spacer(1, 4*mm))

qr_styles = [
    ("BACKGROUND", (0, 0), (-1, 0), INDIGO),
    ("TEXTCOLOR", (0, 0), (-1, 0), WHITE),
    ("FONTNAME", (0, 0), (-1, 0), "Helvetica-Bold"),
    ("FONTSIZE", (0, 0), (-1, 0), 10),
    ("ALIGN", (0, 0), (-1, -1), "LEFT"),
    ("FONTSIZE", (0, 1), (-1, -1), 9),
    ("TOPPADDING", (0, 0), (-1, -1), 5),
    ("BOTTOMPADDING", (0, 0), (-1, -1), 5),
    ("LEFTPADDING", (0, 0), (-1, -1), 8),
    ("ROWBACKGROUNDS", (0, 1), (-1, -1), [WHITE, INDIGO_LIGHT]),
    ("GRID", (0, 0), (-1, -1), 0.5, colors.HexColor("#C5CAE9")),
    ("BOX", (0, 0), (-1, -1), 1.2, INDIGO),
]

qr_table = Table(QUICK_REF, colWidths=[40*mm, 42*mm, 55*mm, 28*mm])
qr_table.setStyle(TableStyle(qr_styles))
story.append(qr_table)
story.append(Spacer(1, 6*mm))

# ── POTENCY SELECTION GUIDE ───────────────────────────────────────────────────
story.append(SectionHeader("  πŸ”¬  POTENCY SELECTION GUIDE", DARK_GREEN, DARK_GREEN))
story.append(Spacer(1, 3*mm))

potency_data = [
    ["Potency", "Use For", "Examples"],
    ["Mother Tincture (Q)", "Acute organ support, liver drainage", "Chelidonium Q, Carduus Mar. Q"],
    ["6C / 6X", "Drainage, first-aid colic", "Berberis 6C, Dioscorea 6C"],
    ["30C", "Acute & sub-acute conditions", "Nux Vom. 30C, Chelidonium 30C"],
    ["200C", "Sub-acute, recurrent conditions", "Lycopodium 200C, Phosphorus 200C"],
    ["1M and above", "Constitutional, chronic cases only", "Calcarea Carb. 1M"],
]
pot_table = Table(potency_data, colWidths=[40*mm, 75*mm, 50*mm])
pot_table.setStyle(TableStyle([
    ("BACKGROUND", (0, 0), (-1, 0), TEAL),
    ("TEXTCOLOR", (0, 0), (-1, 0), WHITE),
    ("FONTNAME", (0, 0), (-1, 0), "Helvetica-Bold"),
    ("FONTSIZE", (0, 0), (-1, 0), 9.5),
    ("FONTSIZE", (0, 1), (-1, -1), 9),
    ("ROWBACKGROUNDS", (0, 1), (-1, -1), [TEAL_LIGHT, WHITE]),
    ("TOPPADDING", (0, 0), (-1, -1), 5),
    ("BOTTOMPADDING", (0, 0), (-1, -1), 5),
    ("LEFTPADDING", (0, 0), (-1, -1), 8),
    ("GRID", (0, 0), (-1, -1), 0.5, LIGHT_GREEN),
    ("BOX", (0, 0), (-1, -1), 1, TEAL),
]))
story.append(pot_table)
story.append(Spacer(1, 6*mm))

# ── DIFFERENTIAL GUIDE ────────────────────────────────────────────────────────
story.append(SectionHeader("  🩺  DIFFERENTIAL SELECTION β€” CLINICAL POINTER", AMBER, AMBER))
story.append(Spacer(1, 3*mm))

diff_data = [
    ["Clinical Picture", "First Remedy to Consider"],
    ["Pain shoots to RIGHT shoulder blade", "Chelidonium Majus"],
    ["Bloating, gas, 4–8 PM aggravation", "Lycopodium Clavatum"],
    ["Radiating, bubbling pain in all directions", "Berberis Vulgaris"],
    ["Colic β€” BETTER stretching, WORSE doubling up", "Dioscorea Villosa"],
    ["Colic β€” WORSE stretching, BETTER bending forward", "Colocynthis / Nux Vomica"],
    ["Catarrhal inflammation of bile ducts/GB lining", "Hydrastis / Merc. Dulcis"],
    ["Fatty liver, hepatitis, bleeding tendency", "Phosphorus"],
    ["Gallstones in obese/chilly constitution", "Calcarea Carbonica"],
    ["Sedentary lifestyle, over-indulgence, irritable", "Nux Vomica"],
    ["Engorged, congested liver; portal hypertension", "Carduus Marianus"],
    ["Cholesterol gallstones (isopathic approach)", "Cholesterinum"],
    ["Must rub liver region; clay-coloured stools", "Podophyllum"],
]
diff_table = Table(diff_data, colWidths=[95*mm, 70*mm])
diff_table.setStyle(TableStyle([
    ("BACKGROUND", (0, 0), (-1, 0), AMBER),
    ("TEXTCOLOR", (0, 0), (-1, 0), DARK_GREY),
    ("FONTNAME", (0, 0), (-1, 0), "Helvetica-Bold"),
    ("FONTSIZE", (0, 0), (-1, 0), 9.5),
    ("FONTSIZE", (0, 1), (-1, -1), 9),
    ("ROWBACKGROUNDS", (0, 1), (-1, -1), [AMBER_LIGHT, WHITE]),
    ("TOPPADDING", (0, 0), (-1, -1), 5),
    ("BOTTOMPADDING", (0, 0), (-1, -1), 5),
    ("LEFTPADDING", (0, 0), (-1, -1), 8),
    ("GRID", (0, 0), (-1, -1), 0.5, GOLD),
    ("BOX", (0, 0), (-1, -1), 1, AMBER),
]))
story.append(diff_table)
story.append(Spacer(1, 5*mm))

# ── FOOTER DISCLAIMER ────────────────────────────────────────────────────────
story.append(DividerLine(LIGHT_GREEN, 1.5))
story.append(Spacer(1, 3*mm))
footer = (
    "Sources: Boericke's Materia Medica (9th Ed.) Β· Kent's Repertory Β· Clarke's Dictionary Β· "
    "homeobook.com Β· homoeopathicjournal.com  |  Compiled by Orris, July 2026. "
    "Always consult a qualified homeopathic physician. This guide does not substitute professional medical care."
)
story.append(Paragraph(footer, STYLES["disclaimer"]))

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

cd /tmp/workspace/homeo-liver-pdf && python generate_pdf.py 2>&1

Running Command

ls -lh /tmp/workspace/homeo-liver-pdf/Homeopathic_Liver_Gallbladder_BileDucts.pdf

Your colorful infographic-style PDF is ready! Here is the download link:

Homeopathic Liver Gallbladder BileDucts

PDF Document Β· PDF


What's Inside the PDF

The document is laid out in a multi-color infographic style with green, amber, teal, indigo, and purple color-coded sections. It contains:

πŸ“š Biliary System Overview

A quick anatomy table covering Liver, Gallbladder, Common Bile Duct, Bile Canaliculi, and Ampulla of Vater.

🌿 12 Remedy Profile Cards (color-coded per remedy)

Each card shows:
  • Remedy name + common plant/substance name
  • Organ affinity
  • Keynote (highlighted in amber)
  • Detailed indications with bullet points
  • Modalities (worse/better)
  • Recommended potency
RemedyKey Focus
Chelidonium MajusLiver/bile ducts; pain to right shoulder blade
Lycopodium ClavatumGallstones; bloating; 4-8 PM worse
Berberis VulgarisRadiating colic; helps pass small gallstones
Carduus MarianusEngorged liver; cirrhosis; portal congestion
Nux VomicaToxic/sedentary liver; irritability
PhosphorusFatty degeneration; hepatitis; bleeding
Calcarea CarbonicaObese/chilly constitution; gallstone tendency
Dioscorea VillosaBiliary colic better stretching backward
HydrastisCatarrhal cholecystitis/cholangitis
CholesterinumCholesterol stones (isopathic)
PodophyllumMust rub liver; clay stools
Mercurius DulcisBile duct stenosis/drainage

⚑ Quick Reference Chart

All 12 remedies in a single color-coded comparison table.

πŸ”¬ Potency Selection Guide

When to use Q, 6C, 30C, 200C, and 1M.

🩺 Differential Selection Guide

13 clinical pictures matched to the most indicated remedy at a glance.

Disclaimer: Homeopathic remedies should always be selected by a qualified practitioner based on the complete individual symptom picture. This guide is for educational reference only and does not replace professional medical diagnosis or treatment.
This is a shared conversation. Sign in to Orris to start your own chat.