Tab doxycycline 100mg brief explanation for opd

Reading File
Finding Sources
Searching the Web

doxycycline 100mg OPD prescription indications dose duration

Finding Sources
Reading File
Finding Sources
Finding Sources
Reading File
I now have sufficient information for a clear, clinically useful OPD summary. Here it is:

Tab Doxycycline 100 mg - OPD Brief

Class: Tetracycline antibiotic (broad-spectrum, bacteriostatic)
Mechanism of Action Inhibits bacterial protein synthesis by binding to the 30S ribosomal subunit, blocking aminoacyl-tRNA attachment. It is predominantly bacteriostatic. Unlike older tetracyclines, doxycycline is a poor substrate for bacterial efflux pumps, giving it broader clinical utility.
  • Katzung's Basic and Clinical Pharmacology, 16th Ed.

Standard Dosing

SituationDoseDuration
General bacterial infections200 mg on Day 1 (100 mg BD), then 100 mg ODPer clinical response
Moderate-severe infections100 mg BD throughoutAs needed
Malaria prophylaxis100 mg ODStart 1-2 days before travel, continue 4 weeks after

Common OPD Indications with Dose & Duration

IndicationDoseDuration
Chlamydia (urethritis/cervicitis)100 mg BD7 days
Pelvic Inflammatory Disease100 mg BD14 days (with metronidazole)
Acne (moderate-severe)100 mg OD/BD3-4 months
Community-acquired Pneumonia100 mg BD5-7 days
Lyme disease (early)100 mg BD14-21 days
Rickettsia / RMSF / Scrub typhus100 mg BDUntil afebrile 3 days + minimum 5-7 days
MRSA skin/soft tissue infection100 mg BDAt least 5 days
Malaria prophylaxis100 mg ODDay before travel + 4 weeks after
Syphilis (pen-allergic, early)100 mg BD14 days
NGU (non-gonococcal urethritis)100 mg BD7 days
  • Goodman & Gilman's, 14th Ed. | GoodRx dosage guide | FDA prescribing information

Counselling Points for OPD (Tell the Patient)

  1. Take with food or a full glass of water - reduces GI upset and prevents esophageal ulceration
  2. Do not lie down for 30 minutes after taking the tablet
  3. Avoid dairy, antacids, iron supplements within 2 hours (chelation reduces absorption)
  4. Sun protection - photosensitivity is common; use sunscreen
  5. Complete the full course even if feeling better
  6. Not for children < 8 years - causes permanent tooth discoloration and bone growth inhibition
  7. Avoid in pregnancy (Category D) - same tooth/bone effects on fetus

Key Contraindications / Cautions

  • Pregnancy and children < 8 years (absolute contraindication)
  • Severe hepatic impairment (dose reduction/avoid)
  • Concurrent use with isotretinoin (risk of intracranial hypertension)
  • Concurrent antacids, iron, calcium - separate by 2 hours
  • Penicillin: antagonistic - avoid co-prescribing for infections where penicillin is primary

Common Side Effects

  • GI: Nausea, vomiting, diarrhea, esophageal irritation
  • Skin: Photosensitivity (common)
  • Others: Candidal superinfection (oral/vaginal thrush), intracranial hypertension (rare), hepatotoxicity at high doses

Quick OPD Prescription Tip: For most outpatient infections (RTI, chlamydia, skin infections), a simple regimen is Tab Doxycycline 100 mg BD x 7 days with food. For acne, use 100 mg OD x 3 months alongside topical therapy.

Create a quick reference PDF for doxycycline dosing & interactions

Reading File
Running Command

ls -la /tmp/workspace/ 2>/dev/null || mkdir -p /tmp/workspace && echo "created"

Running Command

mkdir -p /tmp/workspace/doxycycline-pdf

Writing File

~/doxycycline-pdf/generate_pdf.py

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

OUTPUT = "/tmp/workspace/doxycycline-pdf/Doxycycline_Quick_Reference.pdf"

# ─── Colour palette ───────────────────────────────────────────────────────────
TEAL       = colors.HexColor("#006D77")
TEAL_LIGHT = colors.HexColor("#E8F4F5")
ORANGE     = colors.HexColor("#E07B39")
ORANGE_LT  = colors.HexColor("#FDF3EC")
RED        = colors.HexColor("#C0392B")
RED_LIGHT  = colors.HexColor("#FDEDEC")
GREEN      = colors.HexColor("#1A7A4A")
GREEN_LT   = colors.HexColor("#E9F7EF")
YELLOW_LT  = colors.HexColor("#FFF8E1")
GREY       = colors.HexColor("#555555")
LGREY      = colors.HexColor("#F5F5F5")
WHITE      = colors.white
BLACK      = colors.black

doc = SimpleDocTemplate(
    OUTPUT,
    pagesize=A4,
    leftMargin=18*mm,
    rightMargin=18*mm,
    topMargin=16*mm,
    bottomMargin=16*mm,
)

W = A4[0] - 36*mm   # usable width

styles = getSampleStyleSheet()

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

H1   = style("H1", fontSize=20, textColor=WHITE, leading=26, alignment=TA_CENTER, fontName="Helvetica-Bold")
H2   = style("H2", fontSize=12, textColor=WHITE, leading=16, fontName="Helvetica-Bold")
H2S  = style("H2S", fontSize=11, textColor=TEAL, leading=15, fontName="Helvetica-Bold")
BODY = style("BODY", fontSize=9, textColor=BLACK, leading=13, fontName="Helvetica")
BOLD9= style("BOLD9", fontSize=9, textColor=BLACK, leading=13, fontName="Helvetica-Bold")
SM   = style("SM",  fontSize=8, textColor=GREY, leading=11, fontName="Helvetica")
SMB  = style("SMB", fontSize=8, textColor=GREY, leading=11, fontName="Helvetica-Bold")
WARN = style("WARN", fontSize=8.5, textColor=RED, leading=12, fontName="Helvetica-Bold")
CELLH= style("CELLH", fontSize=8.5, textColor=WHITE, leading=12, fontName="Helvetica-Bold", alignment=TA_CENTER)
CELLN= style("CELLN", fontSize=8.5, textColor=BLACK, leading=12, fontName="Helvetica")
CELLN_C= style("CELLN_C", fontSize=8.5, textColor=BLACK, leading=12, fontName="Helvetica", alignment=TA_CENTER)
CELLB= style("CELLB", fontSize=8.5, textColor=BLACK, leading=12, fontName="Helvetica-Bold")

story = []

# ════════════════════════════════════════════════════════════
# HEADER BANNER
# ════════════════════════════════════════════════════════════
header_data = [[Paragraph("Tab Doxycycline 100 mg — Quick Reference Card", H1)]]
header_tbl = Table(header_data, colWidths=[W])
header_tbl.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,-1), TEAL),
    ("ROUNDEDCORNERS", [6]),
    ("TOPPADDING", (0,0), (-1,-1), 10),
    ("BOTTOMPADDING", (0,0), (-1,-1), 10),
]))
story.append(header_tbl)
story.append(Spacer(1, 4*mm))

# Sub-header line
sub_data = [[
    Paragraph("Class: Tetracycline Antibiotic  |  Action: Bacteriostatic (30S ribosomal inhibitor)  |  Route: Oral", SM),
    Paragraph("Ref: Goodman & Gilman, Katzung, Harrison's", SM)
]]
sub_tbl = Table(sub_data, colWidths=[W*0.65, W*0.35])
sub_tbl.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,-1), TEAL_LIGHT),
    ("LEFTPADDING", (0,0), (-1,-1), 8),
    ("RIGHTPADDING", (0,0), (-1,-1), 8),
    ("TOPPADDING", (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("ALIGN", (1,0), (1,0), "RIGHT"),
]))
story.append(sub_tbl)
story.append(Spacer(1, 5*mm))

# ════════════════════════════════════════════════════════════
# SECTION 1 — DOSING TABLE
# ════════════════════════════════════════════════════════════
story.append(Paragraph("DOSING BY INDICATION", H2S))
story.append(HRFlowable(width=W, thickness=1.5, color=TEAL, spaceAfter=4))

dose_headers = [
    Paragraph("Indication", CELLH),
    Paragraph("Dose", CELLH),
    Paragraph("Frequency", CELLH),
    Paragraph("Duration", CELLH),
]

dose_rows = [
    ["Chlamydia / NGU", "100 mg", "BD", "7 days"],
    ["Pelvic Inflammatory Disease", "100 mg", "BD", "14 days (+metronidazole)"],
    ["Community-Acquired Pneumonia", "100 mg", "BD", "5–7 days"],
    ["Scrub Typhus / Rickettsia / RMSF", "100 mg", "BD", "Min 5–7 days (till afebrile 3d)"],
    ["Lyme Disease (early)", "100 mg", "BD", "14–21 days"],
    ["Syphilis (penicillin-allergic, early)", "100 mg", "BD", "14 days"],
    ["Syphilis (>1 year / latent)", "100 mg", "BD", "28 days"],
    ["MRSA Skin & Soft Tissue Infection", "100 mg", "BD", "At least 5 days"],
    ["Acne (moderate–severe)", "100 mg", "OD or BD", "3–4 months"],
    ["Malaria Prophylaxis", "100 mg", "OD", "Start 1–2d before; +4 wks after"],
    ["Brucellosis (with rifampicin)", "100 mg", "BD", "6 weeks"],
    ["Anthrax prophylaxis (post-exposure)", "100 mg", "BD", "60 days"],
]

dose_data = [dose_headers]
for i, row in enumerate(dose_rows):
    dose_data.append([
        Paragraph(row[0], CELLB if i % 2 == 0 else CELLN),
        Paragraph(row[1], CELLN_C),
        Paragraph(row[2], CELLN_C),
        Paragraph(row[3], CELLN),
    ])

dose_table = Table(dose_data, colWidths=[W*0.36, W*0.14, W*0.14, W*0.36])
ts = TableStyle([
    ("BACKGROUND", (0,0), (-1,0), TEAL),
    ("ROWBACKGROUNDS", (0,1), (-1,-1), [WHITE, LGREY]),
    ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#CCCCCC")),
    ("TOPPADDING", (0,0), (-1,-1), 4),
    ("BOTTOMPADDING", (0,0), (-1,-1), 4),
    ("LEFTPADDING", (0,0), (-1,-1), 6),
    ("RIGHTPADDING", (0,0), (-1,-1), 6),
    ("VALIGN", (0,0), (-1,-1), "MIDDLE"),
])
dose_table.setStyle(ts)
story.append(dose_table)
story.append(Spacer(1, 5*mm))

# ════════════════════════════════════════════════════════════
# SECTION 2 — TWO COLUMNS: Interactions + Counselling
# ════════════════════════════════════════════════════════════

# --- Drug Interactions sub-table ---
int_title = Table([[Paragraph("DRUG INTERACTIONS", H2S)]], colWidths=[W*0.48])
int_title.setStyle(TableStyle([("BOTTOMPADDING",(0,0),(-1,-1),2)]))

int_headers = [Paragraph("Interacting Drug/Food", CELLH), Paragraph("Effect / Action", CELLH)]
int_rows = [
    ["Antacids (Al, Mg, Ca)", "↓ Absorption — separate by 2 hrs"],
    ["Iron / Zinc supplements", "↓ Absorption — separate by 2 hrs"],
    ["Dairy products / milk", "↓ Absorption — separate by 2 hrs"],
    ["Oral contraceptives", "Possible ↓ efficacy — advise backup"],
    ["Warfarin / anticoagulants", "↑ INR — monitor closely"],
    ["Isotretinoin", "Risk of intracranial HTN — AVOID"],
    ["Penicillins", "Antagonism — avoid co-prescribing"],
    ["Barbiturates / Phenytoin / Carbamazepine", "↓ Doxycycline levels — monitor"],
    ["Rifampicin", "↓ Doxycycline levels — monitor"],
    ["Methoxyflurane (anaesthetic)", "Nephrotoxicity risk — AVOID"],
    ["Alcohol (heavy use)", "↓ Efficacy — advise moderation"],
]
int_data = [int_headers] + [
    [Paragraph(r[0], CELLN), Paragraph(r[1], CELLN)] for r in int_rows
]
int_table = Table(int_data, colWidths=[W*0.22, W*0.26])
int_table.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), ORANGE),
    ("ROWBACKGROUNDS", (0,1), (-1,-1), [WHITE, ORANGE_LT]),
    ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#CCCCCC")),
    ("TOPPADDING", (0,0), (-1,-1), 3),
    ("BOTTOMPADDING", (0,0), (-1,-1), 3),
    ("LEFTPADDING", (0,0), (-1,-1), 5),
    ("RIGHTPADDING", (0,0), (-1,-1), 5),
    ("VALIGN", (0,0), (-1,-1), "MIDDLE"),
]))

# --- Patient Counselling sub-table ---
coun_title = Table([[Paragraph("PATIENT COUNSELLING", H2S)]], colWidths=[W*0.48])
coun_title.setStyle(TableStyle([("BOTTOMPADDING",(0,0),(-1,-1),2)]))

coun_rows = [
    ["Take with food or full glass of water"],
    ["Do NOT lie down for 30 min after dose"],
    ["Avoid dairy, antacids, iron within 2 hrs"],
    ["Use sunscreen — photosensitivity common"],
    ["Complete full course — do not stop early"],
    ["Report severe headache / vision changes"],
    ["Thrush possible — report white patches"],
    ["Adequate hydration throughout course"],
]
coun_data = [[Paragraph("Key Counselling Point", CELLH)]] + [
    [Paragraph("✔  " + r[0], CELLN)] for r in coun_rows
]
coun_table = Table(coun_data, colWidths=[W*0.48])
coun_table.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), GREEN),
    ("ROWBACKGROUNDS", (0,1), (-1,-1), [WHITE, GREEN_LT]),
    ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#CCCCCC")),
    ("TOPPADDING", (0,0), (-1,-1), 3),
    ("BOTTOMPADDING", (0,0), (-1,-1), 3),
    ("LEFTPADDING", (0,0), (-1,-1), 5),
    ("RIGHTPADDING", (0,0), (-1,-1), 5),
    ("VALIGN", (0,0), (-1,-1), "MIDDLE"),
]))

two_col = Table(
    [[int_table, Spacer(4*mm, 1), coun_table]],
    colWidths=[W*0.48 + 2, 4*mm, W*0.48 + 2]
)
two_col.setStyle(TableStyle([
    ("VALIGN", (0,0), (-1,-1), "TOP"),
    ("LEFTPADDING", (0,0), (-1,-1), 0),
    ("RIGHTPADDING", (0,0), (-1,-1), 0),
]))

story.append(KeepTogether([
    Table([[Paragraph("DRUG INTERACTIONS", H2S)]], colWidths=[W*0.48]),
    HRFlowable(width=W, thickness=1.5, color=ORANGE, spaceAfter=4),
    two_col,
]))
story.append(Spacer(1, 5*mm))

# ════════════════════════════════════════════════════════════
# SECTION 3 — CONTRAINDICATIONS + SIDE EFFECTS (2 col)
# ════════════════════════════════════════════════════════════
ci_data = [
    [Paragraph("CONTRAINDICATIONS / CAUTIONS", style("x",parent=styles["Normal"],
        fontSize=11, textColor=RED, fontName="Helvetica-Bold", leading=15))],
]
ci_hdr = Table(ci_data, colWidths=[W])
ci_hdr.setStyle(TableStyle([("BOTTOMPADDING",(0,0),(-1,-1),2)]))

ci_rows = [
    ["Pregnancy (Category D)", "Tooth/bone development in fetus"],
    ["Children < 8 years", "Permanent tooth discolouration"],
    ["Severe hepatic impairment", "Avoid or reduce dose"],
    ["Known tetracycline hypersensitivity", "Absolute contraindication"],
    ["Concurrent isotretinoin use", "Intracranial hypertension risk"],
    ["Myasthenia gravis", "May worsen neuromuscular blockade"],
]
ci_table_data = [
    [Paragraph("Contraindication", CELLH), Paragraph("Reason", CELLH)]
] + [
    [Paragraph("✘  " + r[0], style("red9", parent=styles["Normal"], fontSize=8.5,
        textColor=RED, fontName="Helvetica-Bold", leading=12)),
     Paragraph(r[1], CELLN)]
    for r in ci_rows
]
ci_table = Table(ci_table_data, colWidths=[W*0.42, W*0.54])
ci_table.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), RED),
    ("ROWBACKGROUNDS", (0,1), (-1,-1), [WHITE, RED_LIGHT]),
    ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#CCCCCC")),
    ("TOPPADDING", (0,0), (-1,-1), 3),
    ("BOTTOMPADDING", (0,0), (-1,-1), 3),
    ("LEFTPADDING", (0,0), (-1,-1), 5),
    ("RIGHTPADDING", (0,0), (-1,-1), 5),
    ("VALIGN", (0,0), (-1,-1), "MIDDLE"),
]))

# Side Effects
se_rows = [
    ["GI upset, nausea, vomiting", "Common"],
    ["Photosensitivity", "Common"],
    ["Oesophageal ulceration", "If taken without water/lying down"],
    ["Oral/vaginal candidiasis", "Superinfection"],
    ["Intracranial hypertension", "Rare — stop if headache/visual Δ"],
    ["Hepatotoxicity", "Rare, high doses"],
    ["Diarrhoea / C. difficile colitis", "With prolonged use"],
]
se_table_data = [
    [Paragraph("Side Effect", CELLH), Paragraph("Notes", CELLH)]
] + [
    [Paragraph(r[0], CELLN), Paragraph(r[1], CELLN)] for r in se_rows
]
se_table = Table(se_table_data, colWidths=[W*0.48, W*0.48])
se_table.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), colors.HexColor("#7B68EE")),
    ("ROWBACKGROUNDS", (0,1), (-1,-1), [WHITE, colors.HexColor("#F4F3FF")]),
    ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#CCCCCC")),
    ("TOPPADDING", (0,0), (-1,-1), 3),
    ("BOTTOMPADDING", (0,0), (-1,-1), 3),
    ("LEFTPADDING", (0,0), (-1,-1), 5),
    ("RIGHTPADDING", (0,0), (-1,-1), 5),
    ("VALIGN", (0,0), (-1,-1), "MIDDLE"),
]))

se_title = Table([[Paragraph("COMMON SIDE EFFECTS", style("se_h", parent=styles["Normal"],
    fontSize=11, textColor=colors.HexColor("#5B4EBB"), fontName="Helvetica-Bold", leading=15))]],
    colWidths=[W])

bot_two = Table(
    [[ci_table, Spacer(4*mm, 1), se_table]],
    colWidths=[W*0.48, 4*mm, W*0.48]
)
bot_two.setStyle(TableStyle([
    ("VALIGN", (0,0), (-1,-1), "TOP"),
    ("LEFTPADDING", (0,0), (-1,-1), 0),
    ("RIGHTPADDING", (0,0), (-1,-1), 0),
]))

story.append(KeepTogether([
    ci_hdr,
    HRFlowable(width=W, thickness=1.5, color=RED, spaceAfter=4),
    bot_two,
]))
story.append(Spacer(1, 5*mm))

# ════════════════════════════════════════════════════════════
# SECTION 4 — SPECIAL POPULATIONS + QUICK TIPS
# ════════════════════════════════════════════════════════════
sp_data_rows = [
    ["Pregnancy", "AVOID (Category D) — tooth/bone effects", "RED"],
    ["Breastfeeding", "Avoid if possible — excreted in milk", "RED"],
    ["Children < 8 yrs", "Contraindicated — dental staining", "RED"],
    ["Children ≥ 8 yrs", "2.2 mg/kg/dose BD; max 100 mg/dose", "GREEN"],
    ["Renal impairment", "No dose adjustment needed (hepatically cleared)", "GREEN"],
    ["Hepatic impairment (severe)", "Use with caution; reduce dose/avoid", "ORANGE"],
    ["Elderly", "Standard dosing; watch GI side effects", "GREEN"],
]

sp_table_data = [
    [Paragraph("Population", CELLH), Paragraph("Recommendation", CELLH)]
]
for r in sp_data_rows:
    if r[2] == "RED":
        c1 = style("sp_r", parent=styles["Normal"], fontSize=8.5, textColor=RED, fontName="Helvetica-Bold", leading=12)
    elif r[2] == "ORANGE":
        c1 = style("sp_o", parent=styles["Normal"], fontSize=8.5, textColor=ORANGE, fontName="Helvetica-Bold", leading=12)
    else:
        c1 = style("sp_g", parent=styles["Normal"], fontSize=8.5, textColor=GREEN, fontName="Helvetica-Bold", leading=12)
    sp_table_data.append([Paragraph(r[0], c1), Paragraph(r[1], CELLN)])

sp_table = Table(sp_table_data, colWidths=[W*0.28, W*0.68])
sp_table.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), colors.HexColor("#37474F")),
    ("ROWBACKGROUNDS", (0,1), (-1,-1), [WHITE, LGREY]),
    ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#CCCCCC")),
    ("TOPPADDING", (0,0), (-1,-1), 3),
    ("BOTTOMPADDING", (0,0), (-1,-1), 3),
    ("LEFTPADDING", (0,0), (-1,-1), 5),
    ("RIGHTPADDING", (0,0), (-1,-1), 5),
    ("VALIGN", (0,0), (-1,-1), "MIDDLE"),
]))

sp_title = style("sp_title", parent=styles["Normal"],
    fontSize=11, textColor=colors.HexColor("#37474F"), fontName="Helvetica-Bold", leading=15)

# Quick OPD tip box
tip_txt = (
    "<b>Quick OPD Tip:</b>  For most outpatient infections (RTI, chlamydia, skin infections): "
    "Tab Doxycycline 100 mg BD × 7 days with food.  "
    "For acne: 100 mg OD × 3 months alongside topical therapy.  "
    "For malaria prophylaxis: 100 mg OD starting 1–2 days before travel, continuing 4 weeks after return."
)
tip_para = Paragraph(tip_txt, style("tip", parent=styles["Normal"],
    fontSize=8.5, textColor=colors.HexColor("#333333"), fontName="Helvetica", leading=13))

tip_box = Table([[tip_para]], colWidths=[W])
tip_box.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,-1), YELLOW_LT),
    ("BOX", (0,0), (-1,-1), 1, colors.HexColor("#F0C040")),
    ("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(KeepTogether([
    Table([[Paragraph("SPECIAL POPULATIONS", sp_title)]], colWidths=[W]),
    HRFlowable(width=W, thickness=1.5, color=colors.HexColor("#37474F"), spaceAfter=4),
    sp_table,
    Spacer(1, 4*mm),
    tip_box,
]))

# ════════════════════════════════════════════════════════════
# FOOTER
# ════════════════════════════════════════════════════════════
story.append(Spacer(1, 4*mm))
footer_data = [[
    Paragraph(
        "References: Goodman & Gilman's Pharmacological Basis of Therapeutics 14e | "
        "Katzung Basic & Clinical Pharmacology 16e | Harrison's Principles of Internal Medicine 22e | "
        "FDA Prescribing Information | StatPearls (NCBI). "
        "For educational use only. Always verify with current guidelines before prescribing.",
        style("footer", parent=styles["Normal"], fontSize=7, textColor=colors.HexColor("#888888"),
              fontName="Helvetica", leading=10, alignment=TA_CENTER)
    )
]]
footer_tbl = Table(footer_data, colWidths=[W])
footer_tbl.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,-1), LGREY),
    ("TOPPADDING", (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING", (0,0), (-1,-1), 8),
    ("RIGHTPADDING", (0,0), (-1,-1), 8),
]))
story.append(footer_tbl)

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

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

Editing File

~/doxycycline-pdf/generate_pdf.py

Successfully replaced 1 instance(s) of the string in '/tmp/workspace/doxycycline-pdf/generate_pdf.py'
Running Command

grep -n 'style("' /tmp/workspace/doxycycline-pdf/generate_pdf.py | grep 'parent=styles'

Running Command

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

The PDF has been generated successfully. Here it is:

Doxycycline Quick Reference

PDF Document · PDF


What's inside the PDF (single A4 page, colour-coded by section):
SectionColourContent
Header BannerTealDrug name, class, mechanism at a glance
Dosing by IndicationTeal12 indications with dose, frequency, duration
Drug InteractionsOrange11 interactions (antacids, warfarin, OCP, isotretinoin, etc.)
Patient CounsellingGreen8 key OPD counselling points
ContraindicationsRed6 absolute/relative contraindications with reasons
Side EffectsPurple7 common/serious adverse effects
Special PopulationsDark greyPregnancy, children, renal/hepatic, elderly dosing
Quick OPD Tip boxYellowReady-to-use prescription guidance
FooterGreyReferences + educational disclaimer
Print it, laminate it, and keep it at your OPD desk!

Tab udiliv 300mg brief explanation for opd for intern

Reading File
Finding Sources
Searching the Web

Udiliv 300mg ursodeoxycholic acid indications dose mechanism OPD uses

Reading File
Reading File
Excellent - rich textbook content retrieved. Here's the full OPD brief tailored for an intern:

Tab Udiliv 300 mg — OPD Brief for Interns

Generic Name: Ursodeoxycholic Acid (UDCA) Brand: Udiliv 300 mg (Abbott India) Class: Hydrophilic bile acid / Hepatoprotective agent

What Is It? (Simple Concept for Interns)

Udiliv is not an antibiotic or antacid - it is a naturally occurring bile acid. In normal humans, UDCA makes up less than 5% of the bile acid pool. When you give it orally, it gradually replaces toxic, hydrophobic bile acids with a gentler, non-toxic one. Think of it as "swapping bad bile for good bile" - this protects liver cells and helps dissolve cholesterol.
  • Katzung's Basic and Clinical Pharmacology, 16th Ed.

Mechanism of Action (4 Key Points)

#MechanismClinical Benefit
1Replaces/displaces toxic hydrophobic bile acidsProtects liver cells (cytoprotection)
2Reduces cholesterol secretion into bileDissolves/prevents cholesterol gallstones
3Stabilises hepatocyte canalicular membranesReduces cholestatic liver injury
4Anti-inflammatory / immunomodulatorySlows progression of autoimmune liver disease
  • Goodman & Gilman's Pharmacological Basis of Therapeutics, 14th Ed.

OPD Indications & Dosing

IndicationDoseDurationNotes
Primary Biliary Cholangitis (PBC)13–15 mg/kg/day in 2–4 divided doses with foodLong-term (months–years)First-line agent
Cholesterol Gallstone dissolution8–10 mg/kg/day in divided doses12–24 monthsOnly for small (<10mm), non-calcified, radiolucent stones
Gallstone prevention (obese patients on rapid weight loss)300 mg BDDuring weight loss periodPrevents sludge and new stones
Intrahepatic Cholestasis of Pregnancy (ICP)10–15 mg/kg/dayTill deliveryReduces bile acids, relieves pruritus
NAFLD / NASH (off-label)300 mg BD or TDS6–12 monthsImproves liver enzymes; not FDA-approved for this
Drug-induced / viral hepatitis (off-label adjunct)300 mg BDAs clinically indicatedHepatoprotective support
Chronic active hepatitis (adjunct)300 mg BD–TDSPer clinical responseEnzyme improvement
Udiliv 300 mg specific: Standard adult dose is usually 300 mg BD or TDS (i.e., 1 tablet 2-3 times a day with food). For PBC or gallstone dissolution in a 60 kg patient: 10 mg/kg = 600 mg/day = Tab Udiliv 300 mg BD. For 15 mg/kg = 900 mg/day = Tab Udiliv 300 mg TDS.

Counselling Points for Patients (Tell at OPD)

  1. Take with food - reduces GI side effects
  2. Take at bedtime dose if BD - bile is most concentrated at night, maximising stone-dissolving effect
  3. Long-term medicine - do not stop without asking doctor, especially in PBC
  4. Regular liver function tests needed during therapy
  5. Ultrasound abdomen will be repeated every 6-12 months to check gallstone response
  6. It will NOT work on calcified (radio-opaque) stones - X-ray/CT check is required first
  7. Pregnancy category B - generally considered safe; used specifically for cholestasis of pregnancy

Contraindications

  • Calcified (radio-opaque) cholesterol stones - won't dissolve; surgery needed
  • Radiolucent bile pigment stones - not cholesterol-based
  • Non-functioning gallbladder (no bile secretion)
  • Acute cholecystitis, cholangitis, biliary obstruction, biliary fistula
  • Inflammatory bowel disease (Crohn's / UC) - impaired reabsorption
  • Severe hepatic impairment - may worsen condition

Side Effects (Generally Very Safe Drug)

Side EffectFrequency
Nausea, loose stools, mild diarrhoeaUncommon
HeadacheUncommon
Pruritus (itching)Rare
HepatotoxicityNot seen (unlike its predecessor, chenodeoxycholic acid)
Udiliv is practically free of serious adverse effects at therapeutic doses. - Katzung 16th Ed.

Drug Interactions

DrugInteractionAction
Cholestyramine / ColestipolBinds UDCA in gut - reduces absorptionGive UDCA 2 hrs apart
Aluminium hydroxide antacidsReduces absorptionSeparate by 2 hours
Oestrogens / OCPs / ClofibrateIncrease biliary cholesterol - oppose UDCA's gallstone actionCaution in gallstone patients
CyclosporineUDCA increases cyclosporine absorptionMonitor cyclosporine levels
CiprofloxacinMay increase UDCA levelsMonitor

Quick Intern Summary

FeatureDetail
Drug classHydrophilic bile acid
Main usePBC (first-line), gallstone dissolution/prevention, ICP
Dose in adults300 mg BD–TDS with food
Safety profileVery safe; no hepatotoxicity
Response monitoringLFTs every 3–6 months; USG abdomen every 6–12 months
When NOT to useCalcified stones, biliary obstruction, non-functioning GB
Key patient instructionTake with food; long-term compliance is key
Remember for OPD: The most common scenario you'll prescribe Udiliv in is (1) a patient with mildly elevated LFTs/fatty liver sent by gastro as hepatoprotective adjunct, (2) a pregnant patient with itching and elevated bile acids (ICP), and (3) a PBC patient on long-term follow-up. It is a well-tolerated, safe drug - but document the indication clearly.

Create a quick reference PDF for UDCA/Udiliv dosing and interactions

Running Command

ls -la /tmp/workspace/ && ls /tmp/workspace/doxycycline-pdf/

Running Command

mkdir -p /tmp/workspace/udiliv-pdf

Writing File

~/udiliv-pdf/generate_udiliv_pdf.py

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

OUTPUT = "/tmp/workspace/udiliv-pdf/Udiliv_UDCA_Quick_Reference.pdf"

# ─── Colour palette ───────────────────────────────────────────────────────────
TEAL       = colors.HexColor("#00695C")   # primary header
TEAL_LT    = colors.HexColor("#E0F2F1")
AMBER      = colors.HexColor("#E65100")   # interactions
AMBER_LT   = colors.HexColor("#FFF3E0")
RED        = colors.HexColor("#B71C1C")
RED_LT     = colors.HexColor("#FFEBEE")
GREEN      = colors.HexColor("#2E7D32")
GREEN_LT   = colors.HexColor("#E8F5E9")
PURPLE     = colors.HexColor("#4527A0")
PURPLE_LT  = colors.HexColor("#EDE7F6")
BLUE       = colors.HexColor("#1565C0")
BLUE_LT    = colors.HexColor("#E3F2FD")
SLATE      = colors.HexColor("#37474F")
LGREY      = colors.HexColor("#F5F5F5")
YELLOW_LT  = colors.HexColor("#FFFDE7")
WHITE      = colors.white

doc = SimpleDocTemplate(
    OUTPUT,
    pagesize=A4,
    leftMargin=17*mm, rightMargin=17*mm,
    topMargin=14*mm, bottomMargin=14*mm,
)

W = A4[0] - 34*mm
styles = getSampleStyleSheet()

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

# --- reusable paragraph styles ---
BANNER   = S("BANNER",  fontSize=19, textColor=WHITE, leading=25, alignment=TA_CENTER, fontName="Helvetica-Bold")
SUBBAN   = S("SUBBAN",  fontSize=8.5, textColor=WHITE, leading=12, alignment=TA_CENTER, fontName="Helvetica")
SECH     = S("SECH",    fontSize=11, textColor=TEAL, leading=15, fontName="Helvetica-Bold")
SECHA    = S("SECHA",   fontSize=11, textColor=AMBER, leading=15, fontName="Helvetica-Bold")
SECHR    = S("SECHR",   fontSize=11, textColor=RED, leading=15, fontName="Helvetica-Bold")
SECHP    = S("SECHP",   fontSize=11, textColor=PURPLE, leading=15, fontName="Helvetica-Bold")
SECHSL   = S("SECHSL",  fontSize=11, textColor=SLATE, leading=15, fontName="Helvetica-Bold")
CELLTOP  = S("CELLTOP", fontSize=8.5, textColor=WHITE, leading=12, fontName="Helvetica-Bold", alignment=TA_CENTER)
CELLN    = S("CELLN",   fontSize=8.5, textColor=colors.black, leading=12, fontName="Helvetica")
CELLNC   = S("CELLNC",  fontSize=8.5, textColor=colors.black, leading=12, fontName="Helvetica", alignment=TA_CENTER)
CELLB    = S("CELLB",   fontSize=8.5, textColor=colors.black, leading=12, fontName="Helvetica-Bold")
CELLRED  = S("CELLRED", fontSize=8.5, textColor=RED, leading=12, fontName="Helvetica-Bold")
CELLGRN  = S("CELLGRN", fontSize=8.5, textColor=GREEN, leading=12, fontName="Helvetica-Bold")
CELLAMB  = S("CELLAMB", fontSize=8.5, textColor=AMBER, leading=12, fontName="Helvetica-Bold")
CELLPUR  = S("CELLPUR", fontSize=8.5, textColor=PURPLE, leading=12, fontName="Helvetica-Bold")
SM       = S("SM",      fontSize=7.5, textColor=colors.HexColor("#555555"), leading=10, fontName="Helvetica")
TIP      = S("TIP",     fontSize=8.5, textColor=colors.HexColor("#333333"), leading=13, fontName="Helvetica")
TIPB     = S("TIPB",    fontSize=8.5, textColor=TEAL, leading=13, fontName="Helvetica-Bold")
FOOT     = S("FOOT",    fontSize=7, textColor=colors.HexColor("#888888"), leading=10, fontName="Helvetica", alignment=TA_CENTER)

story = []

# ════════════════════════════════════════════
# HEADER
# ════════════════════════════════════════════
hdr = Table([[Paragraph("Tab Udiliv 300 mg  (Ursodeoxycholic Acid — UDCA)", BANNER)]],
            colWidths=[W])
hdr.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,-1), TEAL),
    ("TOPPADDING", (0,0), (-1,-1), 10),
    ("BOTTOMPADDING", (0,0), (-1,-1), 6),
]))
story.append(hdr)

sub = Table([[Paragraph(
    "Class: Hydrophilic Bile Acid / Hepatoprotective  |  Mechanism: Displaces toxic bile acids, cytoprotection, immunomodulation  |  Route: Oral",
    SUBBAN)]],
    colWidths=[W])
sub.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,-1), colors.HexColor("#00897B")),
    ("TOPPADDING", (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
]))
story.append(sub)
story.append(Spacer(1, 4*mm))

# ════════════════════════════════════════════
# SECTION 1 — DOSING TABLE
# ════════════════════════════════════════════
story.append(Paragraph("DOSING BY INDICATION", SECH))
story.append(HRFlowable(width=W, thickness=1.5, color=TEAL, spaceAfter=4))

dose_hdr = [
    Paragraph("Indication", CELLTOP),
    Paragraph("Dose", CELLTOP),
    Paragraph("Frequency / Day", CELLTOP),
    Paragraph("Duration", CELLTOP),
    Paragraph("Notes", CELLTOP),
]

dose_rows = [
    ["Primary Biliary Cholangitis (PBC)",
     "13–15 mg/kg/day",  "2–4 divided doses", "Long-term (years)", "First-line agent; with food"],
    ["Cholesterol Gallstone Dissolution",
     "8–10 mg/kg/day",   "2–3 divided doses", "12–24 months",       "Only radiolucent, <10 mm stones"],
    ["Gallstone Prevention\n(rapid weight loss / bariatric)",
     "300 mg BD",        "BD",                "During weight loss",  "Prevents biliary sludge & stones"],
    ["Intrahepatic Cholestasis\nof Pregnancy (ICP)",
     "10–15 mg/kg/day",  "BD–TDS",            "Until delivery",      "Relieves pruritus; safe in pregnancy"],
    ["NAFLD / NASH (off-label adjunct)",
     "300 mg BD–TDS",    "BD or TDS",         "6–12 months",         "Improves LFTs; not FDA-approved"],
    ["Drug-induced / Viral Hepatitis\n(hepatoprotective adjunct)",
     "300 mg BD",        "BD",                "Per clinical response","Enzyme improvement; adjunct use"],
    ["Primary Sclerosing Cholangitis (PSC)",
     "13–15 mg/kg/day",  "2–4 divided doses", "Long-term",           "Evidence limited; use controversial"],
    ["Cystic Fibrosis-related\nCholestasis",
     "20 mg/kg/day",     "BD–TDS",            "Long-term",           "Paediatric use common"],
]

dose_data = [dose_hdr]
for i, r in enumerate(dose_rows):
    bg_rows = [WHITE, LGREY]
    dose_data.append([
        Paragraph(r[0], CELLB if i % 2 == 0 else CELLN),
        Paragraph(r[1], CELLNC),
        Paragraph(r[2], CELLNC),
        Paragraph(r[3], CELLNC),
        Paragraph(r[4], CELLN),
    ])

dose_tbl = Table(dose_data, colWidths=[W*0.25, W*0.16, W*0.14, W*0.15, W*0.30])
dose_tbl.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), TEAL),
    ("ROWBACKGROUNDS", (0,1), (-1,-1), [WHITE, LGREY]),
    ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#CCCCCC")),
    ("TOPPADDING", (0,0), (-1,-1), 4),
    ("BOTTOMPADDING", (0,0), (-1,-1), 4),
    ("LEFTPADDING", (0,0), (-1,-1), 5),
    ("RIGHTPADDING", (0,0), (-1,-1), 5),
    ("VALIGN", (0,0), (-1,-1), "MIDDLE"),
]))
story.append(dose_tbl)
story.append(Spacer(1, 4*mm))

# ════════════════════════════════════════════
# DOSE CALCULATOR BOX
# ════════════════════════════════════════════
calc_rows = [
    ["Patient Weight", "Gallstone / NAFLD\n(10 mg/kg/day)", "PBC\n(13 mg/kg/day)", "PBC max\n(15 mg/kg/day)"],
    ["50 kg",  "500 mg/day\n= 300mg + 200mg*", "650 mg/day\n≈ 300mg TDS*",  "750 mg/day\n= 300mg TDS*"],
    ["60 kg",  "600 mg/day\n= 300mg BD",       "780 mg/day\n= 300mg TDS*",  "900 mg/day\n= 300mg TDS"],
    ["70 kg",  "700 mg/day\n= 300mg TDS*",     "910 mg/day\n= 300mg TDS",   "1050 mg/day\n= 300mg TDS + extra*"],
    ["80 kg",  "800 mg/day\n= 300mg TDS*",     "1040 mg/day\n= 300mg TDS*", "1200 mg/day\n= 300mg QID"],
]

calc_style_hdr = S("calch", fontSize=8, textColor=WHITE, leading=11, fontName="Helvetica-Bold", alignment=TA_CENTER)
calc_style_nrm = S("calcn", fontSize=8, textColor=colors.black, leading=11, fontName="Helvetica", alignment=TA_CENTER)
calc_style_key = S("calck", fontSize=8, textColor=TEAL, leading=11, fontName="Helvetica-Bold")

calc_data = []
for i, row in enumerate(calc_rows):
    if i == 0:
        calc_data.append([Paragraph(c, calc_style_hdr) for c in row])
    else:
        calc_data.append([
            Paragraph(row[0], calc_style_key),
            Paragraph(row[1], calc_style_nrm),
            Paragraph(row[2], calc_style_nrm),
            Paragraph(row[3], calc_style_nrm),
        ])

calc_tbl = Table(calc_data, colWidths=[W*0.14, W*0.28, W*0.28, W*0.28])
calc_tbl.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), colors.HexColor("#00897B")),
    ("ROWBACKGROUNDS", (0,1), (-1,-1), [TEAL_LT, WHITE]),
    ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#AAAAAA")),
    ("TOPPADDING", (0,0), (-1,-1), 3),
    ("BOTTOMPADDING", (0,0), (-1,-1), 3),
    ("LEFTPADDING", (0,0), (-1,-1), 4),
    ("RIGHTPADDING", (0,0), (-1,-1), 4),
    ("VALIGN", (0,0), (-1,-1), "MIDDLE"),
]))

calc_note = Paragraph("* Approximate — adjust to nearest available tablet strength. Udiliv 150 mg & 300 mg tablets available. Always prescribe with food.", SM)
calc_box = Table([
    [Paragraph("DOSE CALCULATOR (Udiliv 300 mg tablets)", S("cbox", fontSize=10,
        textColor=colors.HexColor("#00695C"), fontName="Helvetica-Bold", leading=14))],
    [calc_tbl],
    [calc_note],
], colWidths=[W])
calc_box.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,-1), TEAL_LT),
    ("BOX", (0,0), (-1,-1), 1, TEAL),
    ("TOPPADDING", (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING", (0,0), (-1,-1), 7),
    ("RIGHTPADDING", (0,0), (-1,-1), 7),
]))
story.append(calc_box)
story.append(Spacer(1, 4*mm))

# ════════════════════════════════════════════
# SECTION 2 — TWO COLUMNS: Interactions + Counselling
# ════════════════════════════════════════════
# Left: Drug Interactions
int_hdr_row = [Paragraph("Interacting Drug/Food", CELLTOP), Paragraph("Effect & Action", CELLTOP)]
int_rows = [
    ["Cholestyramine / Colestipol", "↓ UDCA absorption — give UDCA 2 hrs before"],
    ["Aluminium hydroxide antacids", "↓ UDCA absorption — separate by 2 hrs"],
    ["Oestrogens / OCPs",            "Oppose gallstone dissolution — caution"],
    ["Clofibrate / Cholesterol drugs", "Oppose gallstone action — monitor"],
    ["Cyclosporine",                  "UDCA ↑ cyclosporine absorption — monitor levels"],
    ["Ciprofloxacin",                 "May ↑ UDCA levels — monitor LFTs"],
    ["Bile acid sequestrants (all)",  "Reduce enterohepatic recirculation of UDCA"],
    ["Antacids (Ca/Mg based)",        "May reduce absorption — separate doses"],
    ["Obeticholic acid",              "Synergistic in PBC non-responders — intentional combo"],
]
int_data = [int_hdr_row] + [
    [Paragraph(r[0], CELLN), Paragraph(r[1], CELLN)] for r in int_rows
]
int_tbl = Table(int_data, colWidths=[W*0.23, W*0.27])
int_tbl.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), AMBER),
    ("ROWBACKGROUNDS", (0,1), (-1,-1), [WHITE, AMBER_LT]),
    ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#DDDDDD")),
    ("TOPPADDING", (0,0), (-1,-1), 3),
    ("BOTTOMPADDING", (0,0), (-1,-1), 3),
    ("LEFTPADDING", (0,0), (-1,-1), 5),
    ("RIGHTPADDING", (0,0), (-1,-1), 5),
    ("VALIGN", (0,0), (-1,-1), "MIDDLE"),
]))

# Right: Patient Counselling
coun_hdr_row = [Paragraph("OPD Counselling Point", CELLTOP)]
coun_rows = [
    "Always take with food to reduce GI upset",
    "Take bedtime dose if on BD — bile concentrates at night (best for gallstone dissolution)",
    "This is a long-term medicine — do NOT stop without telling your doctor",
    "Regular blood tests (LFTs) every 3–6 months",
    "Ultrasound abdomen every 6–12 months to check stone response",
    "Drug will NOT dissolve calcified (hard) stones — X-ray needed first",
    "Report severe abdominal pain immediately (may indicate stone migration)",
    "Safe in pregnancy — tell doctor if pregnant or planning pregnancy",
    "Mild loose stools or nausea may occur initially — usually settles",
]
coun_data = [coun_hdr_row] + [
    [Paragraph("✔  " + r, CELLN)] for r in coun_rows
]
coun_tbl = Table(coun_data, colWidths=[W*0.46])
coun_tbl.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), GREEN),
    ("ROWBACKGROUNDS", (0,1), (-1,-1), [WHITE, GREEN_LT]),
    ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#DDDDDD")),
    ("TOPPADDING", (0,0), (-1,-1), 3),
    ("BOTTOMPADDING", (0,0), (-1,-1), 3),
    ("LEFTPADDING", (0,0), (-1,-1), 5),
    ("RIGHTPADDING", (0,0), (-1,-1), 5),
    ("VALIGN", (0,0), (-1,-1), "MIDDLE"),
]))

two_col = Table(
    [[int_tbl, Spacer(4*mm, 1), coun_tbl]],
    colWidths=[W*0.50 + 2, 4*mm, W*0.46 + 2]
)
two_col.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),
]))

story.append(KeepTogether([
    Paragraph("DRUG INTERACTIONS", SECHA),
    HRFlowable(width=W, thickness=1.5, color=AMBER, spaceAfter=4),
    two_col,
]))
story.append(Spacer(1, 4*mm))

# ════════════════════════════════════════════
# SECTION 3 — CONTRAINDICATIONS + SIDE EFFECTS (2 col)
# ════════════════════════════════════════════
ci_rows = [
    ["Calcified / radio-opaque gallstones",   "Won't dissolve — surgery needed"],
    ["Non-functioning gallbladder",            "No bile flow — drug ineffective"],
    ["Acute cholecystitis / cholangitis",      "Active inflammation — surgical emergency"],
    ["Biliary obstruction / fistula",          "Structural problem — surgery first"],
    ["Bile pigment stones (radiolucent but non-cholesterol)", "Wrong stone type"],
    ["Inflammatory bowel disease",             "Impaired enterohepatic recirculation"],
    ["Severe hepatic impairment",              "May not metabolise; may worsen"],
    ["Known hypersensitivity to bile acids",   "Absolute contraindication"],
]
ci_data = [
    [Paragraph("Contraindication", CELLTOP), Paragraph("Reason", CELLTOP)]
] + [
    [Paragraph("✘  " + r[0], CELLRED), Paragraph(r[1], CELLN)]
    for r in ci_rows
]
ci_tbl = Table(ci_data, colWidths=[W*0.30, W*0.18])
ci_tbl.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), RED),
    ("ROWBACKGROUNDS", (0,1), (-1,-1), [WHITE, RED_LT]),
    ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#DDDDDD")),
    ("TOPPADDING", (0,0), (-1,-1), 3),
    ("BOTTOMPADDING", (0,0), (-1,-1), 3),
    ("LEFTPADDING", (0,0), (-1,-1), 5),
    ("RIGHTPADDING", (0,0), (-1,-1), 5),
    ("VALIGN", (0,0), (-1,-1), "MIDDLE"),
]))

se_rows = [
    ["Nausea / loose stools", "Uncommon; take with food"],
    ["Mild diarrhoea",         "Bile-salt effect; usually settles"],
    ["Headache",               "Uncommon"],
    ["Pruritus (itching)",     "Rare"],
    ["Abdominal discomfort",   "Usually mild; monitor"],
    ["Hepatotoxicity",         "NOT seen — unlike chenodeoxycholic acid"],
    ["C. difficile colitis",   "Very rare (no antibiotic effect)"],
]
se_data = [
    [Paragraph("Side Effect", CELLTOP), Paragraph("Notes", CELLTOP)]
] + [
    [Paragraph(r[0], CELLPUR), Paragraph(r[1], CELLN)] for r in se_rows
]
se_tbl = Table(se_data, colWidths=[W*0.22, W*0.24])
se_tbl.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), PURPLE),
    ("ROWBACKGROUNDS", (0,1), (-1,-1), [WHITE, PURPLE_LT]),
    ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#DDDDDD")),
    ("TOPPADDING", (0,0), (-1,-1), 3),
    ("BOTTOMPADDING", (0,0), (-1,-1), 3),
    ("LEFTPADDING", (0,0), (-1,-1), 5),
    ("RIGHTPADDING", (0,0), (-1,-1), 5),
    ("VALIGN", (0,0), (-1,-1), "MIDDLE"),
]))

bot_two = Table(
    [[ci_tbl, Spacer(4*mm, 1), se_tbl]],
    colWidths=[W*0.48 + 2, 4*mm, W*0.46 + 2]
)
bot_two.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),
]))

story.append(KeepTogether([
    Paragraph("CONTRAINDICATIONS / CAUTIONS", SECHR),
    HRFlowable(width=W, thickness=1.5, color=RED, spaceAfter=4),
    bot_two,
]))
story.append(Spacer(1, 4*mm))

# ════════════════════════════════════════════
# SECTION 4 — SPECIAL POPULATIONS
# ════════════════════════════════════════════
sp_rows = [
    ("Pregnancy",          "SAFE — Category B; actively used for ICP", "G"),
    ("Breastfeeding",      "Use with caution; limited data; consult specialist", "A"),
    ("Children",           "Dosing same as adults (mg/kg); used for CF-related cholestasis", "G"),
    ("Renal impairment",   "No dose adjustment needed; hepatically metabolised", "G"),
    ("Hepatic impairment (mild-mod)", "Use cautiously; monitor LFTs closely", "A"),
    ("Hepatic impairment (severe)",   "Avoid — may not metabolise; may worsen", "R"),
    ("Elderly",            "Standard dosing; monitor LFTs; well-tolerated", "G"),
]
sp_data = [
    [Paragraph("Population", CELLTOP), Paragraph("Recommendation", CELLTOP), Paragraph("Status", CELLTOP)]
]
for r in sp_rows:
    if r[2] == "R":
        c1 = CELLRED; status = Paragraph("AVOID", CELLRED)
    elif r[2] == "A":
        c1 = CELLAMB; status = Paragraph("CAUTION", CELLAMB)
    else:
        c1 = CELLGRN; status = Paragraph("SAFE", CELLGRN)
    sp_data.append([Paragraph(r[0], c1), Paragraph(r[1], CELLN), status])

sp_tbl = Table(sp_data, colWidths=[W*0.22, W*0.63, W*0.12])
sp_tbl.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), SLATE),
    ("ROWBACKGROUNDS", (0,1), (-1,-1), [WHITE, LGREY]),
    ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#CCCCCC")),
    ("TOPPADDING", (0,0), (-1,-1), 3),
    ("BOTTOMPADDING", (0,0), (-1,-1), 3),
    ("LEFTPADDING", (0,0), (-1,-1), 5),
    ("RIGHTPADDING", (0,0), (-1,-1), 5),
    ("VALIGN", (0,0), (-1,-1), "MIDDLE"),
    ("ALIGN", (2,0), (2,-1), "CENTER"),
]))

# Quick OPD tip
tip_content = (
    "<b>Quick OPD Tip for Interns:</b>  Three common scenarios — "
    "(1) <b>PBC follow-up patient:</b> Tab Udiliv 300 mg TDS with food, check LFTs every 3 months. "
    "(2) <b>ICP (itchy pregnant patient with raised bile acids):</b> Tab Udiliv 300 mg BD–TDS till delivery. "
    "(3) <b>Fatty liver / elevated LFTs (adjunct):</b> Tab Udiliv 300 mg BD with food, review at 3 months. "
    "Always confirm the gallstone is radiolucent before prescribing for dissolution."
)
tip_para = Paragraph(tip_content, TIP)
tip_box = Table([[tip_para]], colWidths=[W])
tip_box.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,-1), YELLOW_LT),
    ("BOX", (0,0), (-1,-1), 1, colors.HexColor("#F9A825")),
    ("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(KeepTogether([
    Paragraph("SPECIAL POPULATIONS", SECHSL),
    HRFlowable(width=W, thickness=1.5, color=SLATE, spaceAfter=4),
    sp_tbl,
    Spacer(1, 4*mm),
    tip_box,
]))

# ════════════════════════════════════════════
# MONITORING TABLE
# ════════════════════════════════════════════
story.append(Spacer(1, 4*mm))
mon_rows = [
    ["Liver Function Tests (LFTs)", "Every 3–6 months", "Primary response marker; expect improvement in ALP, GGT, bilirubin"],
    ["Ultrasound Abdomen",          "Every 6–12 months", "Assess gallstone dissolution / biliary changes"],
    ["Serum bile acids",            "As clinically indicated", "Especially in ICP — target normalisation"],
    ["Symptoms review",             "Each OPD visit", "Pruritus, jaundice, pain — assess disease progression"],
]
mon_data = [
    [Paragraph("Parameter", CELLTOP), Paragraph("Frequency", CELLTOP), Paragraph("Why", CELLTOP)]
] + [
    [Paragraph(r[0], CELLB), Paragraph(r[1], CELLNC), Paragraph(r[2], CELLN)] for r in mon_rows
]
mon_tbl = Table(mon_data, colWidths=[W*0.24, W*0.20, W*0.54])
mon_tbl.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), BLUE),
    ("ROWBACKGROUNDS", (0,1), (-1,-1), [WHITE, BLUE_LT]),
    ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#CCCCCC")),
    ("TOPPADDING", (0,0), (-1,-1), 3),
    ("BOTTOMPADDING", (0,0), (-1,-1), 3),
    ("LEFTPADDING", (0,0), (-1,-1), 5),
    ("RIGHTPADDING", (0,0), (-1,-1), 5),
    ("VALIGN", (0,0), (-1,-1), "MIDDLE"),
]))

story.append(KeepTogether([
    Paragraph("MONITORING", S("mh", fontSize=11, textColor=BLUE, fontName="Helvetica-Bold", leading=15)),
    HRFlowable(width=W, thickness=1.5, color=BLUE, spaceAfter=4),
    mon_tbl,
]))

# ════════════════════════════════════════════
# FOOTER
# ════════════════════════════════════════════
story.append(Spacer(1, 4*mm))
foot_tbl = Table([[Paragraph(
    "References: Goodman & Gilman's Pharmacological Basis of Therapeutics 14e | "
    "Katzung Basic & Clinical Pharmacology 16e | StatPearls — UDCA (NCBI NBK545303) | "
    "Pediatric Oncall Drug Index | FDA Prescribing Information.  "
    "For educational/OPD reference only. Always verify dose with current guidelines before prescribing.",
    FOOT)]], colWidths=[W])
foot_tbl.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,-1), LGREY),
    ("TOPPADDING", (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING", (0,0), (-1,-1), 8),
    ("RIGHTPADDING", (0,0), (-1,-1), 8),
]))
story.append(foot_tbl)

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

cd /tmp/workspace/udiliv-pdf && python generate_udiliv_pdf.py 2>&1

Your PDF is ready:

Udiliv UDCA Quick Reference

PDF Document · PDF


What's inside (single A4, colour-coded):
SectionColourContent
HeaderTealDrug name, class, mechanism at a glance
Dosing by IndicationTeal8 indications - PBC, gallstone dissolution/prevention, ICP, NAFLD, PSC, CF
Dose CalculatorTeal (box)Weight-based dose guide for 50–80 kg patients using 300 mg tablets
Drug InteractionsOrange9 interactions (cholestyramine, antacids, OCPs, cyclosporine, etc.)
Patient CounsellingGreen9 key OPD counselling points
ContraindicationsRed8 absolute/relative contraindications with reasons
Side EffectsPurple7 adverse effects (notably: no hepatotoxicity)
Special PopulationsSlatePregnancy (SAFE/ICP), renal, hepatic, elderly - colour coded
MonitoringBlueLFTs, USG, bile acids - when and why
Quick OPD Tip boxYellow3 common intern scenarios with ready-to-use prescriptions
This is a shared conversation. Sign in to Orris to start your own chat.