https://pharmdguru.com/gastroesophageal-reflux-disease/ write notes for topic of GERD therapeutics 3 it should include intro definition etiology pathophysiology in flowchart clinical features diagnosis treatment goals non pharmac treatment pharmacological treatment including drug short intro class short moa in flowchart drug interaction adr dose indication contraindication and summary chart for pharmacological treatment
https://pharmdguru.com/gastroesophageal-reflux-disease/
mkdir -p /tmp/workspace/GERD-notes && ls /tmp/workspace/GERD-notes/
~/GERD-notes/create_gerd_notes.py
from docx import Document
from docx.shared import Pt, Inches, RGBColor, Cm
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.enum.table import WD_TABLE_ALIGNMENT, WD_ALIGN_VERTICAL
from docx.oxml.ns import qn
from docx.oxml import OxmlElement
import copy
doc = Document()
# ── Page margins ──────────────────────────────────────────────────────────────
section = doc.sections[0]
section.top_margin = Cm(1.8)
section.bottom_margin = Cm(1.8)
section.left_margin = Cm(2.0)
section.right_margin = Cm(2.0)
# ── Colour palette ────────────────────────────────────────────────────────────
DARK_BLUE = RGBColor(0x1A, 0x3A, 0x6B) # headings
MED_BLUE = RGBColor(0x23, 0x5E, 0xA3) # sub-headings
TEAL = RGBColor(0x00, 0x7B, 0x7B) # level-3
LIGHT_BLUE = RGBColor(0xDE, 0xEB, 0xF7) # table header fill
LIGHT_TEAL = RGBColor(0xE2, 0xF5, 0xF5) # alt row fill
DARK_TEXT = RGBColor(0x1C, 0x1C, 0x1C)
# ── Default font ──────────────────────────────────────────────────────────────
normal_style = doc.styles["Normal"]
normal_style.font.name = "Calibri"
normal_style.font.size = Pt(11)
normal_style.font.color.rgb = DARK_TEXT
# ── Helper: set cell background ───────────────────────────────────────────────
def set_cell_bg(cell, rgb: RGBColor):
tc = cell._tc
tcPr = tc.get_or_add_tcPr()
shd = OxmlElement('w:shd')
hex_color = '{:02X}{:02X}{:02X}'.format(rgb[0], rgb[1], rgb[2])
shd.set(qn('w:val'), 'clear')
shd.set(qn('w:color'), 'auto')
shd.set(qn('w:fill'), hex_color)
tcPr.append(shd)
def set_cell_borders(cell, border_color="235EA3"):
tc = cell._tc
tcPr = tc.get_or_add_tcPr()
tcBorders = OxmlElement('w:tcBorders')
for side in ['top', 'left', 'bottom', 'right']:
border = OxmlElement(f'w:{side}')
border.set(qn('w:val'), 'single')
border.set(qn('w:sz'), '4')
border.set(qn('w:space'), '0')
border.set(qn('w:color'), border_color)
tcBorders.append(border)
tcPr.append(tcBorders)
# ── Helper: heading paragraph ─────────────────────────────────────────────────
def add_heading(text, level=1, color=None):
if level == 1:
p = doc.add_heading(text, level=1)
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
for run in p.runs:
run.font.color.rgb = color or DARK_BLUE
run.font.size = Pt(16)
run.font.bold = True
elif level == 2:
p = doc.add_heading(text, level=2)
for run in p.runs:
run.font.color.rgb = color or MED_BLUE
run.font.size = Pt(13)
run.font.bold = True
elif level == 3:
p = doc.add_heading(text, level=3)
for run in p.runs:
run.font.color.rgb = color or TEAL
run.font.size = Pt(12)
run.font.bold = True
return p
def add_body(text, bold=False, italic=False, bullet=False, indent=0):
if bullet:
p = doc.add_paragraph(style='List Bullet')
else:
p = doc.add_paragraph()
if indent:
p.paragraph_format.left_indent = Pt(indent)
run = p.add_run(text)
run.font.name = "Calibri"
run.font.size = Pt(11)
run.bold = bold
run.italic = italic
return p
def add_hr():
p = doc.add_paragraph()
pPr = p._p.get_or_add_pPr()
pBdr = OxmlElement('w:pBdr')
bottom = OxmlElement('w:bottom')
bottom.set(qn('w:val'), 'single')
bottom.set(qn('w:sz'), '6')
bottom.set(qn('w:color'), '235EA3')
pBdr.append(bottom)
pPr.append(pBdr)
# ═══════════════════════════════════════════════════════════════════════════════
# COVER TITLE BLOCK
# ═══════════════════════════════════════════════════════════════════════════════
p = doc.add_paragraph()
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = p.add_run("PHARMACOTHERAPEUTICS - 3")
run.font.name = "Calibri"
run.font.size = Pt(13)
run.font.bold = True
run.font.color.rgb = MED_BLUE
p = doc.add_paragraph()
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = p.add_run("GASTROESOPHAGEAL REFLUX DISEASE (GERD)")
run.font.name = "Calibri"
run.font.size = Pt(20)
run.font.bold = True
run.font.color.rgb = DARK_BLUE
p = doc.add_paragraph()
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = p.add_run("Comprehensive Study Notes")
run.font.name = "Calibri"
run.font.size = Pt(12)
run.italic = True
run.font.color.rgb = TEAL
add_hr()
doc.add_paragraph()
# ═══════════════════════════════════════════════════════════════════════════════
# 1. INTRODUCTION
# ═══════════════════════════════════════════════════════════════════════════════
add_heading("1. INTRODUCTION", 1)
add_body(
"Gastroesophageal Reflux Disease (GERD) is one of the most common gastrointestinal disorders worldwide, "
"affecting approximately 10-30% of the Western population. It is a chronic condition in which stomach "
"contents - primarily acid and pepsin - flow back (reflux) into the esophagus, causing symptoms and/or "
"mucosal damage. GERD significantly impairs quality of life and, if untreated, may lead to serious "
"complications including Barrett's esophagus and esophageal adenocarcinoma. The prevalence of GERD has "
"increased in recent decades, paralleling rising rates of obesity.")
# ═══════════════════════════════════════════════════════════════════════════════
# 2. DEFINITION
# ═══════════════════════════════════════════════════════════════════════════════
add_heading("2. DEFINITION", 1)
# Definition box (single-row table)
tbl = doc.add_table(rows=1, cols=1)
tbl.alignment = WD_TABLE_ALIGNMENT.CENTER
cell = tbl.cell(0, 0)
set_cell_bg(cell, RGBColor(0xDE, 0xEB, 0xF7))
set_cell_borders(cell)
p = cell.paragraphs[0]
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = p.add_run(
'"GERD is a condition that develops when the reflux of stomach contents causes troublesome '
'symptoms and/or complications."\n— Montreal Consensus Definition (2006)')
run.font.name = "Calibri"
run.font.size = Pt(11)
run.italic = True
run.font.color.rgb = DARK_BLUE
doc.add_paragraph()
add_body("Key points of the definition:", bold=True)
add_body("Reflux of gastric contents (acid + pepsin ± bile) into the esophagus", bullet=True)
add_body("Causes troublesome symptoms (bothersome heartburn or regurgitation ≥2×/week)", bullet=True)
add_body("And/or mucosal complications (esophagitis, stricture, Barrett's, adenocarcinoma)", bullet=True)
add_body("Distinguishes pathological reflux from physiological 'postprandial' reflux", bullet=True)
# ═══════════════════════════════════════════════════════════════════════════════
# 3. ETIOLOGY
# ═══════════════════════════════════════════════════════════════════════════════
add_heading("3. ETIOLOGY", 1)
etiology_data = [
("Weak / Transient LES Relaxation (TLESR)",
"Most common cause. The LES normally maintains 15-25 mmHg resting pressure. Inappropriate relaxations allow acid escape."),
("Hiatal Hernia",
"The gastric cardia herniates through the diaphragmatic hiatus, disrupting the anti-reflux barrier."),
("Delayed Gastric Emptying",
"Gastroparesis increases gastric volume and pressure, promoting reflux."),
("Obesity / Increased Abdominal Pressure",
"Abdominal obesity (waist >88 cm women, >102 cm men) raises intra-abdominal pressure, lowers LES pressure."),
("Pregnancy",
"Progesterone relaxes smooth muscle including LES; enlarged uterus increases abdominal pressure."),
("Dietary Factors",
"Fatty/spicy foods, chocolate, caffeine, alcohol, peppermint - all reduce LES pressure."),
("Smoking",
"Reduces LES pressure, impairs esophageal clearance, decreases salivary bicarbonate."),
("Medications That Lower LES Pressure",
"Anticholinergics, nitrates, calcium channel blockers, benzodiazepines, theophylline, opioids."),
("Connective Tissue Disorders",
"Scleroderma - severe LES incompetence due to fibrosis of esophageal smooth muscle."),
]
tbl = doc.add_table(rows=1+len(etiology_data), cols=2)
tbl.style = 'Table Grid'
tbl.alignment = WD_TABLE_ALIGNMENT.CENTER
tbl.columns[0].width = Cm(6)
tbl.columns[1].width = Cm(10)
hdr = tbl.rows[0].cells
hdr[0].text = "Etiological Factor"
hdr[1].text = "Mechanism / Detail"
for c in hdr:
set_cell_bg(c, RGBColor(0x1A, 0x3A, 0x6B))
set_cell_borders(c, "FFFFFF")
for para in c.paragraphs:
for run in para.runs:
run.font.bold = True
run.font.color.rgb = RGBColor(0xFF, 0xFF, 0xFF)
run.font.size = Pt(11)
for i, (factor, detail) in enumerate(etiology_data):
row = tbl.rows[i+1].cells
row[0].text = factor
row[1].text = detail
bg = LIGHT_BLUE if i % 2 == 0 else LIGHT_TEAL
for c in row:
set_cell_bg(c, bg)
set_cell_borders(c)
for para in c.paragraphs:
for run in para.runs:
run.font.size = Pt(10.5)
doc.add_paragraph()
# ═══════════════════════════════════════════════════════════════════════════════
# 4. PATHOPHYSIOLOGY (Flowchart)
# ═══════════════════════════════════════════════════════════════════════════════
add_heading("4. PATHOPHYSIOLOGY", 1)
add_body("The fundamental imbalance: Aggressive forces > Defensive mechanisms", bold=True, italic=True)
doc.add_paragraph()
# Flowchart using bordered table cells
def add_flowbox(text, bg=None, bold=False, center=True):
tbl = doc.add_table(rows=1, cols=1)
tbl.alignment = WD_TABLE_ALIGNMENT.CENTER
tbl.columns[0].width = Cm(14)
cell = tbl.cell(0, 0)
set_cell_bg(cell, bg or LIGHT_BLUE)
set_cell_borders(cell)
p = cell.paragraphs[0]
p.alignment = WD_ALIGN_PARAGRAPH.CENTER if center else WD_ALIGN_PARAGRAPH.LEFT
run = p.add_run(text)
run.font.name = "Calibri"
run.font.size = Pt(11)
run.bold = bold
run.font.color.rgb = DARK_BLUE if bg != RGBColor(0x1A, 0x3A, 0x6B) else RGBColor(0xFF, 0xFF, 0xFF)
return tbl
def add_arrow():
p = doc.add_paragraph("▼")
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
for run in p.runs:
run.font.size = Pt(14)
run.font.color.rgb = MED_BLUE
flow_steps = [
(RGBColor(0x1A, 0x3A, 0x6B), "TRIGGER FACTORS\n(Obesity | Hiatal hernia | Diet | Pregnancy | Medications | Smoking)", True),
(LIGHT_BLUE, "↓ LES resting pressure OR ↑ Transient LES Relaxations (TLESRs)", False),
(LIGHT_BLUE, "Failure of Anti-Reflux Barrier\n(LES + Diaphragmatic crura + Phrenoesophageal ligament)", False),
(LIGHT_TEAL, "Retrograde flow of gastric contents into esophagus\n(Acid + Pepsin ± Bile salts)", False),
(LIGHT_TEAL, "Impaired Esophageal Clearance\n(Reduced peristalsis + Low salivary bicarbonate)", False),
(RGBColor(0xFF, 0xEA, 0xCC), "Prolonged acid exposure to esophageal mucosa\n(Normal pH < 4 exposure ≤ 4% of 24 hrs — in GERD this is exceeded)", False),
(LIGHT_TEAL, "Mucosal Injury:\nEpithelial damage → Inflammation → Erosion → Ulceration", False),
(RGBColor(0xFF, 0xCC, 0xCC), "COMPLICATIONS\nEsophagitis → Stricture → Barrett's Esophagus → Adenocarcinoma", True),
]
for bg, text, bold in flow_steps:
add_flowbox(text, bg, bold)
if (bg, text, bold) != flow_steps[-1]:
add_arrow()
doc.add_paragraph()
add_body("Defensive mechanisms (normally protect esophagus):", bold=True)
add_body("LES pressure (15-25 mmHg), esophageal peristalsis (acid clearance), salivary bicarbonate (neutralization), epithelial resistance, prostaglandins", bullet=True)
# ═══════════════════════════════════════════════════════════════════════════════
# 5. CLINICAL FEATURES
# ═══════════════════════════════════════════════════════════════════════════════
add_heading("5. CLINICAL FEATURES", 1)
add_heading("5.1 Typical (Esophageal) Symptoms", 2)
tbl = doc.add_table(rows=1+3, cols=3)
tbl.style = 'Table Grid'
tbl.alignment = WD_TABLE_ALIGNMENT.CENTER
headers = ["Symptom", "Description", "Timing"]
hdr = tbl.rows[0].cells
for i, h in enumerate(headers):
hdr[i].text = h
set_cell_bg(hdr[i], RGBColor(0x1A, 0x3A, 0x6B))
set_cell_borders(hdr[i], "FFFFFF")
for para in hdr[i].paragraphs:
for run in para.runs:
run.font.bold = True
run.font.color.rgb = RGBColor(0xFF, 0xFF, 0xFF)
run.font.size = Pt(11)
typical = [
("Heartburn (Pyrosis)", "Burning retrosternal discomfort radiating upward toward throat", "After meals, lying down, bending"),
("Acid Regurgitation", "Sour or bitter-tasting fluid rising to mouth/throat", "Postprandial, nocturnal"),
("Dysphagia", "Difficulty swallowing - may indicate stricture or motility disorder", "Persistent or progressive"),
]
for i, row_data in enumerate(typical):
row = tbl.rows[i+1].cells
for j, data in enumerate(row_data):
row[j].text = data
set_cell_bg(row[j], LIGHT_BLUE if i % 2 == 0 else LIGHT_TEAL)
set_cell_borders(row[j])
for para in row[j].paragraphs:
for run in para.runs:
run.font.size = Pt(10.5)
doc.add_paragraph()
add_heading("5.2 Atypical (Extra-Esophageal) Symptoms", 2)
atypical = [
"Chronic cough (nocturnal, non-productive) — due to microaspiration or vagal reflex",
"Laryngitis / hoarseness — posterior laryngitis from acid",
"Asthma exacerbation — aspiration of acid triggers bronchospasm",
"Non-cardiac chest pain — mimics angina",
"Globus sensation — 'lump in throat' feeling",
"Dental erosion — chronic acid exposure to teeth",
"Recurrent otitis media, sinusitis (especially in children)",
]
for item in atypical:
add_body(item, bullet=True)
doc.add_paragraph()
add_heading("5.3 ALARM Symptoms (Immediate Referral Required)", 2)
alarm_box = doc.add_table(rows=1, cols=1)
alarm_box.alignment = WD_TABLE_ALIGNMENT.CENTER
alarm_box.columns[0].width = Cm(14)
cell = alarm_box.cell(0, 0)
set_cell_bg(cell, RGBColor(0xFF, 0xCC, 0xCC))
set_cell_borders(cell, "CC0000")
p = cell.paragraphs[0]
run = p.add_run("⚠ ALARM SYMPTOMS — Require urgent investigation (endoscopy)\n\n")
run.font.bold = True
run.font.color.rgb = RGBColor(0xCC, 0x00, 0x00)
run.font.size = Pt(11)
alarms = ["Unexplained weight loss", "Dysphagia (progressive)", "Odynophagia (painful swallowing)",
"Hematemesis (blood in vomit)", "Melena (black tarry stools)", "Age >55 with new-onset symptoms",
"Palpable mass or lymphadenopathy"]
run2 = p.add_run(" • " + "\n • ".join(alarms))
run2.font.size = Pt(10.5)
run2.font.color.rgb = DARK_TEXT
doc.add_paragraph()
# ═══════════════════════════════════════════════════════════════════════════════
# 6. DIAGNOSIS
# ═══════════════════════════════════════════════════════════════════════════════
add_heading("6. DIAGNOSIS", 1)
add_body("Diagnosis is primarily clinical (history of heartburn + regurgitation). Investigations are reserved for atypical symptoms, alarm features, or treatment failure.", italic=True)
doc.add_paragraph()
diag_data = [
("Empirical PPI Trial", "First-line diagnostic approach for typical symptoms", "Clinical response in 1-2 weeks supports GERD diagnosis. Sensitivity ~78%, Specificity ~54%"),
("Upper GI Endoscopy (EGD)", "Gold standard for visualizing esophageal mucosa", "Identifies erosive esophagitis (LA Grade A-D), Barrett's esophagus, strictures, masses. Indicated for alarm symptoms"),
("24-hour Ambulatory pH Monitoring", "Gold standard for confirming pathological acid exposure", "DeMeester score >14.72 or pH < 4 for >4.2% of total time = abnormal. Useful pre-surgery"),
("Esophageal Manometry", "Measures LES pressure and esophageal peristalsis", "LES pressure <10 mmHg = hypotensive LES. Required before anti-reflux surgery"),
("Barium Swallow", "Detects hiatal hernia, strictures, motility disorders", "Low sensitivity for GERD; less used today"),
("Impedance-pH Monitoring", "Detects both acid and non-acid reflux episodes", "Useful in patients with persistent symptoms on PPIs"),
("Esophageal Capsule pH (Bravo™)", "Wireless 48-hour pH monitoring", "Better patient tolerance, captures day-to-day variability"),
]
tbl = doc.add_table(rows=1+len(diag_data), cols=3)
tbl.style = 'Table Grid'
tbl.alignment = WD_TABLE_ALIGNMENT.CENTER
diag_headers = ["Investigation", "Purpose", "Interpretation / Notes"]
hdr = tbl.rows[0].cells
for i, h in enumerate(diag_headers):
hdr[i].text = h
set_cell_bg(hdr[i], RGBColor(0x1A, 0x3A, 0x6B))
set_cell_borders(hdr[i], "FFFFFF")
for para in hdr[i].paragraphs:
for run in para.runs:
run.font.bold = True
run.font.color.rgb = RGBColor(0xFF, 0xFF, 0xFF)
run.font.size = Pt(11)
for i, row_data in enumerate(diag_data):
row = tbl.rows[i+1].cells
for j, data in enumerate(row_data):
row[j].text = data
set_cell_bg(row[j], LIGHT_BLUE if i % 2 == 0 else LIGHT_TEAL)
set_cell_borders(row[j])
for para in row[j].paragraphs:
for run in para.runs:
run.font.size = Pt(10)
doc.add_paragraph()
# Grading box
add_heading("Los Angeles (LA) Grading of Erosive Esophagitis", 3)
la_data = [
("Grade A", "One or more mucosal breaks ≤5 mm, NOT continuous between tops of folds"),
("Grade B", "One or more mucosal breaks >5 mm, NOT continuous between tops of folds"),
("Grade C", "Mucosal breaks continuous between tops of ≥2 folds, <75% of esophageal circumference"),
("Grade D", "Mucosal breaks involving ≥75% of the esophageal circumference"),
]
tbl = doc.add_table(rows=1+4, cols=2)
tbl.style = 'Table Grid'
hdr = tbl.rows[0].cells
for i, h in enumerate(["Grade", "Description"]):
hdr[i].text = h
set_cell_bg(hdr[i], MED_BLUE)
set_cell_borders(hdr[i])
for para in hdr[i].paragraphs:
for run in para.runs:
run.font.bold = True
run.font.color.rgb = RGBColor(0xFF, 0xFF, 0xFF)
run.font.size = Pt(11)
for i, (grade, desc) in enumerate(la_data):
row = tbl.rows[i+1].cells
row[0].text = grade
row[1].text = desc
set_cell_bg(row[0], LIGHT_BLUE)
set_cell_bg(row[1], LIGHT_TEAL if i % 2 else LIGHT_BLUE)
set_cell_borders(row[0])
set_cell_borders(row[1])
for c in row:
for para in c.paragraphs:
for run in para.runs:
run.font.size = Pt(10.5)
doc.add_paragraph()
# ═══════════════════════════════════════════════════════════════════════════════
# 7. TREATMENT GOALS
# ═══════════════════════════════════════════════════════════════════════════════
add_heading("7. TREATMENT GOALS", 1)
goals = [
("Symptom Relief", "Eliminate or reduce heartburn, regurgitation, and extra-esophageal symptoms"),
("Mucosal Healing", "Heal esophagitis (erosions/ulcerations) and prevent recurrence"),
("Prevent Complications", "Prevent stricture formation, Barrett's esophagus, adenocarcinoma"),
("Improve Quality of Life", "Restore normal daily activities, sleep, and diet"),
("Maintain Remission", "Long-term suppression of acid (especially erosive GERD — maintenance therapy)"),
("Avoid Surgery", "Medical management sufficient in most patients; surgery for refractory cases"),
]
tbl = doc.add_table(rows=1+len(goals), cols=2)
tbl.style = 'Table Grid'
hdr = tbl.rows[0].cells
for i, h in enumerate(["Goal", "Objective"]):
hdr[i].text = h
set_cell_bg(hdr[i], RGBColor(0x00, 0x7B, 0x7B))
set_cell_borders(hdr[i])
for para in hdr[i].paragraphs:
for run in para.runs:
run.font.bold = True
run.font.color.rgb = RGBColor(0xFF, 0xFF, 0xFF)
for i, (goal, obj) in enumerate(goals):
row = tbl.rows[i+1].cells
row[0].text = goal
row[1].text = obj
bg = LIGHT_BLUE if i % 2 == 0 else LIGHT_TEAL
for c in row:
set_cell_bg(c, bg)
set_cell_borders(c)
for para in c.paragraphs:
for run in para.runs:
run.font.size = Pt(10.5)
doc.add_paragraph()
# ═══════════════════════════════════════════════════════════════════════════════
# 8. NON-PHARMACOLOGICAL TREATMENT
# ═══════════════════════════════════════════════════════════════════════════════
add_heading("8. NON-PHARMACOLOGICAL TREATMENT", 1)
add_body("Lifestyle modifications are first-line treatment and should accompany all pharmacological therapy.", italic=True)
doc.add_paragraph()
non_pharm = [
("Dietary Modifications",
"Avoid trigger foods: fatty/fried foods, spicy foods, chocolate, citrus, tomato-based products, peppermint, caffeine, carbonated beverages. Eat smaller, more frequent meals. Avoid large meals 2-3 hours before bedtime."),
("Head-of-Bed Elevation",
"Elevate head end of bed by 15-20 cm (6-8 inches) using blocks or wedge pillow - reduces nocturnal reflux."),
("Weight Reduction",
"Most evidence-based lifestyle modification. Target BMI <25. Weight loss directly reduces LES pressure and intra-abdominal pressure."),
("Smoking Cessation",
"Smoking reduces LES pressure and salivary bicarbonate. Cessation significantly improves symptoms."),
("Alcohol Reduction",
"Alcohol relaxes LES and increases gastric acid secretion. Advise abstinence or significant reduction."),
("Avoid Lying Down Post-Meal",
"Remain upright for at least 2-3 hours after eating. Gravity assists in acid clearance."),
("Left-Lateral Sleep Position",
"Left-lateral position reduces nocturnal acid exposure compared to right-lateral or supine."),
("Loose-Fitting Clothing",
"Tight clothes increase intra-abdominal pressure and worsen reflux."),
("Stress Management",
"Psychological stress worsens symptom perception. Mindfulness, yoga, CBT may be adjuncts."),
("Surgical Options",
"Nissen Fundoplication (360° wrap of fundus around LES) or LINX device (magnetic ring) - for severe/refractory GERD or large hiatal hernia."),
]
tbl = doc.add_table(rows=1+len(non_pharm), cols=2)
tbl.style = 'Table Grid'
tbl.alignment = WD_TABLE_ALIGNMENT.CENTER
hdr = tbl.rows[0].cells
for i, h in enumerate(["Modification", "Details"]):
hdr[i].text = h
set_cell_bg(hdr[i], RGBColor(0x00, 0x7B, 0x7B))
set_cell_borders(hdr[i])
for para in hdr[i].paragraphs:
for run in para.runs:
run.font.bold = True
run.font.color.rgb = RGBColor(0xFF, 0xFF, 0xFF)
for i, (mod, detail) in enumerate(non_pharm):
row = tbl.rows[i+1].cells
row[0].text = mod
row[1].text = detail
bg = LIGHT_BLUE if i % 2 == 0 else LIGHT_TEAL
for c in row:
set_cell_bg(c, bg)
set_cell_borders(c)
for para in c.paragraphs:
for run in para.runs:
run.font.size = Pt(10)
doc.add_paragraph()
# ═══════════════════════════════════════════════════════════════════════════════
# 9. PHARMACOLOGICAL TREATMENT
# ═══════════════════════════════════════════════════════════════════════════════
add_heading("9. PHARMACOLOGICAL TREATMENT", 1)
add_body("Drug therapy aims to reduce gastric acid secretion (or neutralize it), improve motility, or enhance mucosal defense. Treatment is stepped as per symptom severity.", italic=True)
doc.add_paragraph()
add_heading("Step-Up Treatment Approach (Flowchart)", 2)
steps = [
(LIGHT_BLUE, "STEP 1 — MILD / INFREQUENT SYMPTOMS (<3×/week)\nLifestyle Modifications + Antacids / Alginate\n(On-demand basis)", False),
(LIGHT_TEAL, "STEP 2 — MODERATE / FREQUENT SYMPTOMS (≥3×/week)\nH2 Receptor Antagonists (H2RAs)\nOR On-demand / Short-course PPI", False),
(RGBColor(0xFF, 0xEA, 0xCC), "STEP 3 — EROSIVE ESOPHAGITIS / PERSISTENT SYMPTOMS\nProton Pump Inhibitors (PPIs) — Standard Dose\nOnce daily, 30-60 min before breakfast × 4-8 weeks", False),
(RGBColor(0xD5, 0xE8, 0xD4), "STEP 4 — REFRACTORY SYMPTOMS\nDouble-dose PPI (twice daily)\n± Prokinetics\n± Baclofen (GABA-B agonist for TLESRs)", False),
(RGBColor(0xFF, 0xCC, 0xCC), "STEP 5 — FAILED MEDICAL THERAPY / ANATOMICAL CAUSE\nSurgical: Nissen Fundoplication OR LINX Device", True),
]
for bg, text, bold in steps:
add_flowbox(text, bg, bold)
if (bg, text, bold) != steps[-1]:
add_arrow()
doc.add_paragraph()
# ───────────────────────────────────────────────────────────────────────────────
# 9.1 ANTACIDS
# ───────────────────────────────────────────────────────────────────────────────
add_heading("9.1 ANTACIDS", 2)
add_body("CLASS OVERVIEW: Weak bases that neutralize hydrochloric acid in the stomach. Provide rapid but short-lived symptomatic relief (1-2 hours). Used for mild, infrequent heartburn.")
doc.add_paragraph()
add_heading("Mechanism of Action (Flowchart)", 3)
antacid_moa = [
(LIGHT_BLUE, "Ingestion of antacid (Al(OH)₃, Mg(OH)₂, CaCO₃, NaHCO₃)", False),
(LIGHT_TEAL, "Neutralization reaction:\nAl(OH)₃ + 3HCl → AlCl₃ + 3H₂O\nMg(OH)₂ + 2HCl → MgCl₂ + 2H₂O\nCaCO₃ + 2HCl → CaCl₂ + H₂O + CO₂", False),
(LIGHT_BLUE, "↑ Gastric pH (target pH > 3.5-4)\nNeutralizes acid in gastric lumen\nReduces pepsin activity (pepsin inactive above pH 4)", False),
(LIGHT_TEAL, "Rapid symptom relief — onset 5-15 minutes\nDuration 1-2 hours (on empty stomach)\nCombinations (Al + Mg) balance constipation/diarrhea SEs", False),
]
for bg, text, bold in antacid_moa:
add_flowbox(text, bg, bold)
if (bg, text, bold) != antacid_moa[-1]:
add_arrow()
doc.add_paragraph()
antacid_drugs = [
("Aluminium Hydroxide\n[Al(OH)₃]", "Oral", "0.5-1 g\n3-6×/day\n(post-meals & HS)", "Constipation\nHypophosphataemia\nAluminium toxicity (renal failure)\nFoul taste",
"Peptic ulcer, heartburn,\nhyperacidity", "Phosphate binders\nFluoroquinolones (absorption↓)\nTetracyclines (chelation)",
"Renal failure (↑Al accumulation)\nDialysis patients"),
("Magnesium Hydroxide\n[Mg(OH)₂]", "Oral", "400-1200 mg\n3-4×/day", "Diarrhea\nHypermagnesemia (renal failure)\nNausea",
"Antacid, laxative,\nhyperacidity", "Tetracyclines, fluoroquinolones,\ndigoxin (absorption↓)",
"Renal failure\nMg-restricted diet"),
("Calcium Carbonate\n[CaCO₃]", "Oral", "0.5-1.5 g\n4-6×/day", "Constipation\nAcid rebound\nHypercalcemia\nMilk-alkali syndrome\n(excess use)",
"Antacid, Ca supplement,\nhyperacidity", "Iron, tetracyclines, bisphosphonates,\nfluoroquinolones (absorption↓)",
"Hypercalcemia\nRenal stones\nSarcoidosis"),
("Sodium Bicarbonate\n[NaHCO₃]", "Oral", "0.3-2 g PRN", "Metabolic alkalosis\nCO₂ release (belching, bloating)\nHypernatremia\nFluid retention",
"Rapid antacid action,\nurinary alkalinization", "Reduces absorption of many drugs\n(due to pH change)",
"Hypertension\nHeart failure\nSodium-restricted diet\nRenal failure"),
("Magnesium Trisilicate", "Oral", "1-2 g\n3×/day", "Diarrhea\nSilica-containing renal stones (chronic use)",
"Antacid, hyperacidity", "As per Mg compounds",
"Renal failure"),
("Alginate-Antacid\n(Gaviscon)", "Oral", "10-20 mL or\n2-4 tabs after\nmeals & HS", "Minimal SE\nBloating (due to CO₂)",
"GERD, non-erosive reflux\n(forms raft barrier)", "May reduce absorption of some drugs",
"Phenylketonuria (some formulations contain aspartame)"),
]
add_heading("Antacids - Drug Reference Table", 3)
tbl = doc.add_table(rows=1+len(antacid_drugs), cols=7)
tbl.style = 'Table Grid'
tbl.alignment = WD_TABLE_ALIGNMENT.CENTER
col_heads = ["Drug", "Route", "Dose", "ADR", "Indication", "Drug Interactions", "Contraindication"]
hdr = tbl.rows[0].cells
for i, h in enumerate(col_heads):
hdr[i].text = h
set_cell_bg(hdr[i], RGBColor(0x1A, 0x3A, 0x6B))
set_cell_borders(hdr[i], "FFFFFF")
for para in hdr[i].paragraphs:
for run in para.runs:
run.font.bold = True
run.font.color.rgb = RGBColor(0xFF, 0xFF, 0xFF)
run.font.size = Pt(9)
for i, row_data in enumerate(antacid_drugs):
row = tbl.rows[i+1].cells
for j, data in enumerate(row_data):
row[j].text = data
set_cell_bg(row[j], LIGHT_BLUE if i % 2 == 0 else LIGHT_TEAL)
set_cell_borders(row[j])
for para in row[j].paragraphs:
for run in para.runs:
run.font.size = Pt(9)
doc.add_paragraph()
# ───────────────────────────────────────────────────────────────────────────────
# 9.2 H2 RECEPTOR ANTAGONISTS
# ───────────────────────────────────────────────────────────────────────────────
add_heading("9.2 H2 RECEPTOR ANTAGONISTS (H2RAs)", 2)
add_body("CLASS OVERVIEW: Competitive, reversible inhibitors of the histamine H2 receptor on gastric parietal cells. Reduce basal (fasting) and meal-stimulated acid secretion by 70%. Onset within 1 hour; duration 6-10 hours. Tachyphylaxis (tolerance) can develop within 2 weeks of continuous use. Less effective than PPIs for erosive esophagitis but useful for mild-moderate GERD and nocturnal acid control.")
doc.add_paragraph()
add_heading("Mechanism of Action (Flowchart)", 3)
h2ra_moa = [
(LIGHT_BLUE, "Histamine released from ECL cells in gastric mucosa", False),
(LIGHT_TEAL, "Normally binds H2 receptors on parietal cells\n→ activates adenylyl cyclase\n→ ↑ cAMP\n→ activates PKA\n→ stimulates H+/K+-ATPase (proton pump)", False),
(RGBColor(0xFF, 0xEA, 0xCC), "H2 RECEPTOR ANTAGONIST administered\n(Famotidine, Ranitidine, Cimetidine, Nizatidine)", False),
(LIGHT_TEAL, "Competitive blockade of H2 receptors on parietal cell\n→ Blocks histamine stimulation\n→ ↓ cAMP production\n→ ↓ PKA activation\n→ ↓ H+/K+-ATPase activity", False),
(LIGHT_BLUE, "Result:\n• ↓ Basal acid secretion by ~70%\n• ↓ Nocturnal acid (most effective at night)\n• ↓ Meal-stimulated acid by ~60%\n• Duration: 6-10 hours", False),
(LIGHT_TEAL, "Note: Tachyphylaxis occurs with continuous use\n(upregulation of H2 receptors)\n→ Reduced efficacy after 2 weeks", False),
]
for bg, text, bold in h2ra_moa:
add_flowbox(text, bg, bold)
if (bg, text, bold) != h2ra_moa[-1]:
add_arrow()
doc.add_paragraph()
h2ra_drugs = [
("Famotidine\n(Pepcid)", "Oral, IV", "Oral: 20 mg BD\nor 40 mg HS\nIV: 20 mg BD\nSelf-treat: 10-20 mg\nbefore meals",
"Headache, dizziness\nDiarrhea or constipation\nRare: QT prolongation (IV, high dose)\nRare: thrombocytopenia",
"GERD, peptic ulcer disease,\nZES, NERD, stress ulcer prophylaxis",
"Minimal CYP450 interactions\nMay reduce absorption of ketoconazole,\nitraconazole, atazanavir",
"Renal impairment (reduce dose)\nQT prolongation history (IV high dose)"),
("Cimetidine\n(Tagamet)", "Oral, IV", "400-800 mg BD\nor 400 mg QID\nwith meals & HS",
"Multiple CNS effects (confusion,\nhallucinations — elderly)\nGynecomastia, impotence\n(anti-androgen effect)\nGalactorrhea\nElevated creatinine (tubular secretion↓)",
"GERD, peptic ulcer, ZES\n(less preferred — many interactions)",
"MAJOR CYP inhibitor:\nWarfarin, phenytoin, theophylline,\ntricyclics, lidocaine, metoprolol,\nmetronidazole (toxic levels ↑)",
"Liver disease\nRenal impairment\nConcomitant drugs with narrow TI"),
("Ranitidine\n(Zantac) — limited", "Oral, IV", "150 mg BD\nor 300 mg HS\n(NDMA concerns\nlimit use)",
"Headache, malaise\n(minimal systemic SE)\nNDMA contamination concern\n(some formulations withdrawn)",
"Historical GERD, peptic ulcer\nZES",
"Minimal - some antacid interaction\nReduced ketoconazole absorption",
"Pregnancy concerns (NDMA)\nActively limited in many countries"),
("Nizatidine\n(Axid)", "Oral", "150 mg BD\nor 300 mg HS",
"Minimal - headache, dizziness\nRare: urticaria, sweating",
"GERD, peptic ulcer\nNight-time heartburn",
"Minimal CYP450 interactions\nMay ↑ salicylate levels at high doses",
"Renal impairment (dose adjust)\nLiver impairment"),
]
add_heading("H2RAs - Drug Reference Table", 3)
tbl = doc.add_table(rows=1+len(h2ra_drugs), cols=6)
tbl.style = 'Table Grid'
tbl.alignment = WD_TABLE_ALIGNMENT.CENTER
col_heads = ["Drug", "Route", "Dose", "ADR", "Indication", "Drug Interactions & Contraindication"]
hdr = tbl.rows[0].cells
for i, h in enumerate(col_heads):
hdr[i].text = h
set_cell_bg(hdr[i], MED_BLUE)
set_cell_borders(hdr[i], "FFFFFF")
for para in hdr[i].paragraphs:
for run in para.runs:
run.font.bold = True
run.font.color.rgb = RGBColor(0xFF, 0xFF, 0xFF)
run.font.size = Pt(9)
for i, row_data in enumerate(h2ra_drugs):
row = tbl.rows[i+1].cells
for j, data in enumerate(row_data):
row[j].text = data
set_cell_bg(row[j], LIGHT_BLUE if i % 2 == 0 else LIGHT_TEAL)
set_cell_borders(row[j])
for para in row[j].paragraphs:
for run in para.runs:
run.font.size = Pt(9)
doc.add_paragraph()
# ───────────────────────────────────────────────────────────────────────────────
# 9.3 PROTON PUMP INHIBITORS (PPIs)
# ───────────────────────────────────────────────────────────────────────────────
add_heading("9.3 PROTON PUMP INHIBITORS (PPIs)", 2)
add_body("CLASS OVERVIEW: PPIs are the most effective drugs for acid suppression. They are prodrugs (benzimidazole derivatives) activated in the acidic environment of the parietal cell canaliculus. They irreversibly inhibit the H+/K+-ATPase (proton pump), the final common pathway of acid secretion. Full effect requires 3-4 days of daily dosing (as new pumps synthesize). Taken 30-60 minutes before the first meal of the day for maximum efficacy. Drug of choice for erosive esophagitis, Barrett's esophagus, and moderate-severe GERD.")
doc.add_paragraph()
add_heading("Mechanism of Action (Flowchart)", 3)
ppi_moa = [
(LIGHT_BLUE, "PPI administered (prodrug - inactive at neutral pH)\n[Omeprazole, Pantoprazole, Esomeprazole, Lansoprazole, Rabeprazole, Dexlansoprazole]", False),
(LIGHT_TEAL, "Absorbed in small intestine → enters bloodstream\n→ Taken up by parietal cell via H+/K+-ATPase canaliculi\n(Activation requires acidic pH < 2 in secretory canaliculus)", False),
(RGBColor(0xFF, 0xEA, 0xCC), "Prodrug protonated → converted to sulfenamide (active form)\nCovalent, irreversible bond to cysteine residues (Cys813, Cys892) on H+/K+-ATPase\n→ Complete, sustained inhibition of the proton pump", False),
(LIGHT_TEAL, "Blocks FINAL STEP of acid secretion regardless of stimulus\n(gastrin, histamine, acetylcholine — all pathways inhibited)\n→ ↓ Acid output by 95-98%\n→ ↑ Gastric pH to >4 for most of day", False),
(LIGHT_BLUE, "Acid secretion resumes only when NEW H+/K+-ATPase synthesized\n(t½ of pump ~54 hrs)\n→ Effect lasts 24-48 hours per dose", False),
(LIGHT_TEAL, "KEY POINT: Administer 30-60 min before first meal\nMeal stimulates pumps → more active pumps available for PPI to bind\nMaximum acid suppression only after 3-4 days of daily dosing", False),
(LIGHT_BLUE, "Result:\n• ↓ Basal acid by ~97%, meal-stimulated acid by ~95%\n• Sustained pH >4 for 15-21 hrs/day\n• Allows mucosal healing (erosive esophagitis) in 4-8 weeks", False),
]
for bg, text, bold in ppi_moa:
add_flowbox(text, bg, bold)
if (bg, text, bold) != ppi_moa[-1]:
add_arrow()
doc.add_paragraph()
ppi_drugs = [
("Omeprazole\n(Prilosec, Losec)", "Oral, IV", "20 mg OD before breakfast\n(GERD)\n40 mg OD (erosive)\nIV: 40 mg OD",
"Headache, diarrhea, nausea\nLong-term: Hypomagnesemia,\nVit B12 deficiency, C. diff infection,\nOsteoporosis/fracture risk\nHypergastrinemia\nFundic gland polyps",
"GERD, erosive esophagitis,\nPeptic ulcer (H. pylori eradication - part of triple therapy),\nZES",
"CYP2C19 inhibitor:\n↑ Clopidogrel (inactivation) - avoid\nMethotrexate excretion↓\n↑ Diazepam, phenytoin levels\nAtazanavir: do not use (needs acid for absorption)\nReduces: ketoconazole, itraconazole absorption",
"Hypersensitivity to PPIs\nOsteoporosis (use cautiously long-term)\nAtazanavir use (absolute)"),
("Pantoprazole\n(Protonix, Prazole)", "Oral, IV", "40 mg OD before breakfast\n(GERD)\nIV: 40-80 mg OD\nZES: up to 240 mg/day",
"Similar to omeprazole\nFewer CYP450 interactions\nHeadache, diarrhea\nHypomagnesemia (long-term)",
"GERD, erosive esophagitis,\nZollinger-Ellison syndrome\nStress ulcer prophylaxis (IV)",
"Minimal CYP450 interactions\nSAFEST PPI for patients on multiple drugs\nMay reduce methotrexate excretion",
"Hypersensitivity to PPIs\nSame class-wide long-term risks"),
("Esomeprazole\n(Nexium)", "Oral, IV", "20-40 mg OD before breakfast\nIV: 20-40 mg OD",
"As class - headache, diarrhea\nHypomagnesemia, B12 deficiency",
"GERD, erosive esophagitis,\nH. pylori eradication\nNSAID-related ulcer prevention",
"CYP2C19 substrate (S-isomer\nof omeprazole - less first-pass)\nAtazanavir: avoid\nReduced: ketoconazole, itraconazole",
"Hypersensitivity\nAtazanavir/nelfinavir use"),
("Lansoprazole\n(Prevacid)", "Oral", "15-30 mg OD before breakfast",
"As class\nHypertriglyceridemia (occasional)\nArthralgia (rare)",
"GERD, erosive esophagitis,\nH. pylori eradication,\nNSAID ulcer prevention",
"CYP2C19/3A4 substrate\nModerate clopidogrel interaction\nAtazanavir: avoid",
"Hypersensitivity\nConcomitant atazanavir"),
("Rabeprazole\n(Aciphex)", "Oral", "20 mg OD before breakfast\n10-20 mg (NERD)",
"As class - minimal CYP2C19\nHeadache, diarrhea",
"GERD, erosive esophagitis,\nNERD, H. pylori eradication",
"Least CYP2C19 interaction\n(non-enzymatic activation pathway)\nSafer with clopidogrel\nAtazanavir: avoid",
"Hypersensitivity\nAtazanavir use"),
("Dexlansoprazole\n(Dexilant)", "Oral", "30-60 mg OD\n(dual-release formulation)",
"As class\nDiarrhea, nausea (common)",
"GERD, erosive esophagitis\n(can be taken without regard to meals)",
"As per class\nAtazanavir: avoid",
"Hypersensitivity\nCan be taken without food (unique)"),
]
add_heading("PPIs - Drug Reference Table", 3)
tbl = doc.add_table(rows=1+len(ppi_drugs), cols=6)
tbl.style = 'Table Grid'
tbl.alignment = WD_TABLE_ALIGNMENT.CENTER
col_heads = ["Drug", "Route", "Dose", "ADR", "Indication", "Drug Interactions & Contraindication"]
hdr = tbl.rows[0].cells
for i, h in enumerate(col_heads):
hdr[i].text = h
set_cell_bg(hdr[i], RGBColor(0x1A, 0x3A, 0x6B))
set_cell_borders(hdr[i], "FFFFFF")
for para in hdr[i].paragraphs:
for run in para.runs:
run.font.bold = True
run.font.color.rgb = RGBColor(0xFF, 0xFF, 0xFF)
run.font.size = Pt(9)
for i, row_data in enumerate(ppi_drugs):
row = tbl.rows[i+1].cells
for j, data in enumerate(row_data):
row[j].text = data
set_cell_bg(row[j], LIGHT_BLUE if i % 2 == 0 else LIGHT_TEAL)
set_cell_borders(row[j])
for para in row[j].paragraphs:
for run in para.runs:
run.font.size = Pt(9)
doc.add_paragraph()
# ───────────────────────────────────────────────────────────────────────────────
# 9.4 PROKINETICS
# ───────────────────────────────────────────────────────────────────────────────
add_heading("9.4 PROKINETIC AGENTS", 2)
add_body("CLASS OVERVIEW: Prokinetics improve gastric emptying and increase LES tone, reducing the volume of gastric contents available for reflux. Used as adjuncts to PPIs in patients with delayed gastric emptying or bloating. Limited by significant side effect profiles (especially metoclopramide).")
doc.add_paragraph()
add_heading("Mechanism of Action (Flowchart)", 3)
prokin_moa = [
(LIGHT_BLUE, "GERD associated with:\n• Delayed gastric emptying\n• Reduced LES tone\n• Impaired esophageal peristalsis", False),
(LIGHT_TEAL, "PROKINETIC ADMINISTERED\nMetoclopramide (D2 antagonist + 5-HT4 agonist)\nDomperidone (Peripheral D2 antagonist)\nItopride (D2 + AChE inhibitor)\nMosapride (5-HT4 agonist)", False),
(LIGHT_BLUE, "Central & peripheral dopamine D2 blockade\n(+ 5-HT4 receptor agonism for metoclopramide/mosapride)\n→ Enhanced release of acetylcholine from myenteric neurons", False),
(LIGHT_TEAL, "↑ LES tone → reduces reflux\n↑ Gastric peristalsis → faster emptying\n↑ Esophageal peristalsis → better acid clearance\n↑ Pyloric relaxation → duodenal transit", False),
(LIGHT_BLUE, "Result: Less gastric content → Less reflux\nReduced symptoms, especially post-meal fullness/bloating", False),
]
for bg, text, bold in prokin_moa:
add_flowbox(text, bg, bold)
if (bg, text, bold) != prokin_moa[-1]:
add_arrow()
doc.add_paragraph()
prokin_drugs = [
("Metoclopramide\n(Reglan, Maxolon)", "Oral, IV, IM", "10 mg TDS\n30 min before meals\nIV: 10 mg slow IV\nMax: 0.5 mg/kg/day",
"CNS: EPS (tardive dyskinesia,\nakathisia, acute dystonia)\nSedation, drowsiness\nHyperprolactinemia:\nGalactorrhea, amenorrhea, gynecomastia\nDiarrhea (dose-dependent)\nBlack Box: TD risk with >3 months use",
"GERD with gastroparesis\nNausea/vomiting\nDiabetic gastroparesis\nChemotherapy-induced N/V (IV)",
"Anticholinergics (oppose prokinetic effect)\nOpioids (oppose effect)\nLevodopa (antagonized)\nAlcohol (sedation ↑)\nDigoxin (absorption altered)\nCNS depressants (↑ sedation)",
"GI obstruction/perforation\nPheochromocytoma\nParkinson's disease\nSeizure disorders\nSevere renal impairment"),
("Domperidone\n(Motilium)", "Oral", "10-20 mg TDS\n15-30 min before meals\n(Max 30 mg/day)",
"QT prolongation (RARE but serious)\nHyperprolactinemia: galactorrhea,\nmenstrual irregularity\nHeadache\nDry mouth (minimal CNS effects\n- doesn't cross BBB)",
"GERD, gastroparesis\nNausea/vomiting\nDiabetic gastroparesis\n(especially in elderly - safer CNS profile)",
"CYP3A4 inhibitors ↑ domperidone levels\n(risk of QT prolongation):\nKetoconazole, clarithromycin, erythromycin\nAntiarrhythmics (additive QT↑)\nAnticholinergics oppose effect",
"QT prolongation history\nCardiac arrhythmias\nProlactinoma\nGI obstruction\nHepatic impairment"),
("Itopride\n(Ganaton)", "Oral", "50 mg TDS\nbefore meals",
"Mild GI symptoms\nDiarrhea, abdominal discomfort\nMild ↑ prolactin\nLess EPS than metoclopramide",
"Functional dyspepsia with GERD\nGastroparesis",
"Anticholinesterase inhibitors (additive)\nMinimal CYP450 interactions",
"GI obstruction\nPheochromocytoma\nRenal/hepatic impairment (use cautiously)"),
("Mosapride\n(Mosarex)", "Oral", "5-10 mg TDS\nbefore meals",
"Mild nausea, diarrhea\nRare: QT changes\nNo CNS or anti-prolactin effects",
"GERD, functional dyspepsia\nGastroparesis\nHassle-free in elderly",
"Minimal drug interactions\nAnticholinergics may oppose effect",
"GI obstruction\nCaution in cardiac disease (QT)"),
]
add_heading("Prokinetics - Drug Reference Table", 3)
tbl = doc.add_table(rows=1+len(prokin_drugs), cols=6)
tbl.style = 'Table Grid'
col_heads = ["Drug", "Route", "Dose", "ADR", "Indication", "Drug Interactions & Contraindication"]
hdr = tbl.rows[0].cells
for i, h in enumerate(col_heads):
hdr[i].text = h
set_cell_bg(hdr[i], RGBColor(0x00, 0x7B, 0x7B))
set_cell_borders(hdr[i], "FFFFFF")
for para in hdr[i].paragraphs:
for run in para.runs:
run.font.bold = True
run.font.color.rgb = RGBColor(0xFF, 0xFF, 0xFF)
run.font.size = Pt(9)
for i, row_data in enumerate(prokin_drugs):
row = tbl.rows[i+1].cells
for j, data in enumerate(row_data):
row[j].text = data
set_cell_bg(row[j], LIGHT_BLUE if i % 2 == 0 else LIGHT_TEAL)
set_cell_borders(row[j])
for para in row[j].paragraphs:
for run in para.runs:
run.font.size = Pt(9)
doc.add_paragraph()
# ───────────────────────────────────────────────────────────────────────────────
# 9.5 MISC / BACLOFEN
# ───────────────────────────────────────────────────────────────────────────────
add_heading("9.5 OTHER AGENTS", 2)
add_body("Baclofen (GABA-B agonist): Reduces frequency of TLESRs (transient LES relaxations). Used as add-on in refractory GERD and in patients with excessive belching/regurgitation. Dose: 5-20 mg TID. ADRs: drowsiness, confusion, dizziness. Not first-line.", italic=False)
doc.add_paragraph()
add_body("Sucralfate: Aluminum salt of sucrose sulfate. Forms protective gel over ulcerated mucosa in acid pH. Minimal systemic absorption. Used in: stress ulcer prophylaxis, GERD in pregnancy (safe). Dose: 1 g QID. ADR: constipation, Al toxicity (chronic renal failure). Interaction: reduces absorption of fluoroquinolones, digoxin, phenytoin, warfarin (give 2 hours apart).", italic=False)
doc.add_paragraph()
# ═══════════════════════════════════════════════════════════════════════════════
# 10. SUMMARY COMPARISON CHART
# ═══════════════════════════════════════════════════════════════════════════════
add_heading("10. PHARMACOLOGICAL TREATMENT - SUMMARY COMPARISON CHART", 1)
add_body("Quick reference for clinical decision-making.", italic=True)
doc.add_paragraph()
summary = [
("ANTACIDS\n(Al(OH)₃, Mg(OH)₂, CaCO₃)",
"Neutralize acid in lumen\n↑ Gastric pH",
"5-15 min", "1-2 hrs",
"Mild, infrequent heartburn\n(PRN use)",
"Constipation (Al), Diarrhea (Mg),\nHypercalcemia (Ca), Alkalosis (NaHCO₃)",
"Chelation with tetracyclines,\nfluoroquinolones, iron",
"Renal failure (Al/Mg)\nHypercalcemia (CaCO₃)"),
("H2 RECEPTOR ANTAGONISTS\n(Famotidine, Cimetidine,\nRanitidine, Nizatidine)",
"Block H2 receptors on parietal cell\n↓ cAMP → ↓ H+/K+-ATPase\n↓ Acid 70% (basal, nocturnal)",
"1 hour", "6-10 hrs\nTachyphylaxis after 2 wks",
"Mild-moderate GERD\nNocturnal acid control\nPRN/short-course use",
"Headache, diarrhea\nCimetidine: gynecomastia, confusion,\nmany drug interactions",
"Cimetidine: CYP450 inhibitor\n(warfarin, phenytoin, theophylline)\nReduces ketoconazole/azole absorption",
"Renal impairment (dose adjust)\nCimetidine: hepatic disease, pregnancy"),
("PROTON PUMP INHIBITORS\n(Omeprazole, Pantoprazole,\nEsomeprazole, Lansoprazole,\nRabeprazole, Dexlansoprazole)",
"Irreversible H+/K+-ATPase inhibition\n↓ Acid 95-98% (all stimuli)\npH >4 for 15-21 hrs/day",
"3-4 days (full effect)\n1 hr (partial effect day 1)",
"24-48 hrs\nEffect builds over days",
"Erosive esophagitis (1st line)\nModerate-severe GERD\nBarrett's esophagus\nH. pylori eradication\nZES, peptic ulcer",
"Short-term: headache, diarrhea\nLong-term: hypomagnesemia,\nB12 deficiency, osteoporosis,\nC. difficile, hypergastrinemia",
"CYP2C19 interactions\nOmeprazole↓ clopidogrel effect\nAtazanavir: avoid with PPIs\nReduces azole antifungal absorption",
"Hypersensitivity\nAtazanavir/nelfinavir (absolute)\nOsteoporosis (long-term caution)"),
("PROKINETICS\n(Metoclopramide, Domperidone,\nItopride, Mosapride)",
"D2 blockade + 5-HT4 agonism\n↑ LES tone\n↑ Gastric emptying\n↑ Esophageal clearance",
"30-60 min", "4-6 hrs",
"GERD + gastroparesis\nAdjunct to PPIs\nPost-meal bloating",
"Metoclopramide: EPS, tardive dyskinesia\nDomperidone: QT prolongation\nHyperprolactinemia (all)",
"Anticholinergics oppose effect\nOpioids oppose effect\nDomperidone + CYP3A4 inhibitors: ↑QT",
"GI obstruction\nParkinson's (metoclopramide)\nQT prolongation (domperidone)\nPheochromocytoma"),
("SUCRALFATE\n(Aluminum sucrose sulfate)",
"Protective gel over mucosa\n(acid pH-dependent)\nLocal cytoprotection",
"30 min", "6 hrs",
"Stress ulcer prophylaxis\nGERD in pregnancy (safe)\nMild GERD adjunct",
"Constipation (main)\nAl toxicity (renal failure patients)",
"Reduces absorption of:\nFluoroquinolones, digoxin,\nphenytoin, warfarin (2h gap needed)",
"Renal failure (Al accumulation)\nSwallowing difficulties"),
("BACLOFEN\n(GABA-B agonist)",
"Reduces TLESR frequency\n↓ Reflux episodes\n(central + peripheral GABA-B agonism)",
"1-2 hrs", "6-8 hrs",
"Refractory GERD\nExcessive belching/regurgitation\nAdjunct to PPIs",
"Drowsiness, confusion, dizziness\nWithdrawal seizures (abrupt stop)\nMuscle weakness",
"CNS depressants (↑ sedation)\nAlcohol (↑ CNS depression)",
"Seizure disorders (abrupt withdrawal)\nRespiratory depression\nSevere hepatic/renal disease"),
]
tbl = doc.add_table(rows=1+len(summary), cols=8)
tbl.style = 'Table Grid'
tbl.alignment = WD_TABLE_ALIGNMENT.CENTER
summary_headers = ["Drug Class", "MOA", "Onset", "Duration", "Indication", "ADR", "Drug Interactions", "Contraindication"]
hdr = tbl.rows[0].cells
for i, h in enumerate(summary_headers):
hdr[i].text = h
set_cell_bg(hdr[i], RGBColor(0x1A, 0x3A, 0x6B))
set_cell_borders(hdr[i], "FFFFFF")
for para in hdr[i].paragraphs:
for run in para.runs:
run.font.bold = True
run.font.color.rgb = RGBColor(0xFF, 0xFF, 0xFF)
run.font.size = Pt(9)
row_colors = [LIGHT_BLUE, LIGHT_TEAL, RGBColor(0xD5, 0xE8, 0xD4), RGBColor(0xFF, 0xEA, 0xCC), LIGHT_BLUE, LIGHT_TEAL]
for i, row_data in enumerate(summary):
row = tbl.rows[i+1].cells
for j, data in enumerate(row_data):
row[j].text = data
set_cell_bg(row[j], row_colors[i])
set_cell_borders(row[j])
for para in row[j].paragraphs:
for run in para.runs:
run.font.size = Pt(8.5)
if j == 0:
run.bold = True
doc.add_paragraph()
# ═══════════════════════════════════════════════════════════════════════════════
# 11. COMPLICATIONS
# ═══════════════════════════════════════════════════════════════════════════════
add_heading("11. COMPLICATIONS OF UNTREATED GERD", 1)
comp_data = [
("Esophagitis (Erosive)", "LA Grade A-D esophageal mucosal inflammation/erosion. Resolves with PPI therapy."),
("Peptic Stricture", "Chronic scarring → fibrosis → narrowing. Presents with progressive dysphagia. Treat: dilation + long-term PPI."),
("Barrett's Esophagus", "Metaplastic change: normal squamous → specialized intestinal columnar epithelium. PRE-MALIGNANT. Risk: esophageal adenocarcinoma. Needs surveillance endoscopy."),
("Esophageal Adenocarcinoma", "Most serious complication. Arises from Barrett's esophagus. Risk 0.5%/year from Barrett's. Poor prognosis if advanced."),
("Chronic Cough / Asthma", "Extraesophageal GERD. Acid aspiration → bronchoconstriction. Difficult to treat."),
("Laryngitis / Hoarseness", "Posterior laryngitis from acid exposure. May cause vocal cord granuloma."),
("Dental Erosion", "Chronic acid exposure to teeth → enamel dissolution."),
]
tbl = doc.add_table(rows=1+len(comp_data), cols=2)
tbl.style = 'Table Grid'
hdr = tbl.rows[0].cells
for i, h in enumerate(["Complication", "Details"]):
hdr[i].text = h
set_cell_bg(hdr[i], RGBColor(0xCC, 0x44, 0x44))
set_cell_borders(hdr[i])
for para in hdr[i].paragraphs:
for run in para.runs:
run.font.bold = True
run.font.color.rgb = RGBColor(0xFF, 0xFF, 0xFF)
for i, (comp, detail) in enumerate(comp_data):
row = tbl.rows[i+1].cells
row[0].text = comp
row[1].text = detail
set_cell_bg(row[0], RGBColor(0xFF, 0xCC, 0xCC))
set_cell_bg(row[1], LIGHT_BLUE if i % 2 == 0 else LIGHT_TEAL)
set_cell_borders(row[0])
set_cell_borders(row[1])
for c in row:
for para in c.paragraphs:
for run in para.runs:
run.font.size = Pt(10.5)
doc.add_paragraph()
# ═══════════════════════════════════════════════════════════════════════════════
# 12. PHARMACIST'S ROLE
# ═══════════════════════════════════════════════════════════════════════════════
add_heading("12. ROLE OF THE PHARMACIST", 1)
pharma_role = [
"Educate patients on correct administration of PPIs (30-60 min before breakfast) for maximum efficacy",
"Counsel on lifestyle modifications as integral part of therapy, not optional",
"Identify and manage drug interactions (especially PPIs with clopidogrel, atazanavir; cimetidine with multiple drugs)",
"Monitor for long-term PPI adverse effects: hypomagnesemia, Vit B12 deficiency, osteoporosis",
"Identify inappropriate NSAID/aspirin use and recommend gastroprotection",
"Educate on tachyphylaxis with H2 blockers and when to switch to PPIs",
"Counsel on metoclopramide: Black Box warning for tardive dyskinesia with >3 months use",
"Recognize and urgently refer alarm symptoms (dysphagia, hematemesis, weight loss)",
"Advise on antacid-drug spacing (≥2 hours from other medications)",
"Support adherence: explain that PPIs take 3-4 days for full effect; do not stop prematurely",
]
for item in pharma_role:
add_body(item, bullet=True)
# ═══════════════════════════════════════════════════════════════════════════════
# Footer
# ═══════════════════════════════════════════════════════════════════════════════
doc.add_paragraph()
add_hr()
p = doc.add_paragraph()
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = p.add_run("Sources: Katzung's Basic & Clinical Pharmacology (16th Ed.) | Sleisenger & Fordtran's GI & Liver Disease | Yamada's Textbook of Gastroenterology | PharmD Guru (pharmdguru.com) | Montreal Consensus 2006")
run.font.size = Pt(8)
run.italic = True
run.font.color.rgb = RGBColor(0x66, 0x66, 0x66)
# ── Save ──────────────────────────────────────────────────────────────────────
output_path = "/tmp/workspace/GERD-notes/GERD_Therapeutics_3_Notes.docx"
doc.save(output_path)
print(f"Document saved: {output_path}")
cd /tmp/workspace/GERD-notes && python3 create_gerd_notes.py
cd /tmp/workspace/GERD-notes && python3 -c " antacid_drugs = [ ('Aluminium Hydroxide', 'Oral', '0.5-1 g', 'Constipation', 'Peptic ulcer', 'Fluoroquinolones', 'Renal failure'), ('Magnesium Hydroxide', 'Oral', '400-1200 mg', 'Diarrhea', 'Antacid', 'Tetracyclines', 'Renal failure'), ('Calcium Carbonate', 'Oral', '0.5-1.5 g', 'Constipation', 'Antacid', 'Iron', 'Hypercalcemia'), ('Sodium Bicarbonate', 'Oral', '0.3-2 g PRN', 'Alkalosis', 'Rapid antacid', 'pH change', 'Hypertension'), ('Magnesium Trisilicate', 'Oral', '1-2 g', 'Diarrhea', 'Antacid', 'Mg compounds', 'Renal failure'), ('Alginate-Antacid', 'Oral', '10-20 mL', 'Minimal SE', 'GERD', 'Some drugs', 'PKU'), ] for i, d in enumerate(antacid_drugs): print(f'Row {i}: {len(d)} items') "
cd /tmp/workspace/GERD-notes && grep -n "IndexError\|tbl.rows" create_gerd_notes.py | head -5; python3 -c " # Check h2ra_drugs tuple count h2ra_drugs = [ ('a', 'b', 'c', 'd', 'e', 'f', 'g'), # 7 items ] # The H2RA table has 6 columns (col_heads has 6) # But h2ra_drugs tuples have 7 items - that's ok, we iterate enumerate # Check summary table - 8 cols, each tuple should have 8 items summary = [ ('Drug Class', 'MOA', 'Onset', 'Duration', 'Indication', 'ADR', 'Drug Interactions', 'Contraindication'), # 8 items ] # h2ra_drugs - last item is 'Contraindication' but the table only has 6 cols... # BUT in the loop it uses 'for j, data in enumerate(row_data)' which would try row[6] on a 6-col table print('h2ra_drugs has 7 items (Drug, Route, Dose, ADR, Indication, Drug Interactions Contraindication)') print('Table has 6 cols - so j=6 would be out of range!') "
~/GERD-notes/create_gerd_notes.py
Successfully replaced 1 instance(s) of the string in '/tmp/workspace/GERD-notes/create_gerd_notes.py'
~/GERD-notes/create_gerd_notes.py
Successfully replaced 1 instance(s) of the string in '/tmp/workspace/GERD-notes/create_gerd_notes.py'
~/GERD-notes/create_gerd_notes.py
Successfully replaced 1 instance(s) of the string in '/tmp/workspace/GERD-notes/create_gerd_notes.py'
cd /tmp/workspace/GERD-notes && python3 create_gerd_notes.py 2>&1
GERD Therapeutics 3 Notes
Word Document · DOCX
| # | Section | Highlights |
|---|---|---|
| 1 | Introduction | Epidemiology, global burden, link to obesity |
| 2 | Definition | Montreal Consensus 2006 definition in a boxed quote + key points |
| 3 | Etiology | 9-row colour table covering LES weakness, hiatal hernia, obesity, drugs, scleroderma, etc. |
| 4 | Pathophysiology | Step-by-step flowchart from trigger factors → TLESR → mucosal injury → Barrett's → adenocarcinoma |
| 5 | Clinical Features | Typical symptoms table + atypical extra-esophageal symptoms list + red-highlighted ALARM symptoms box |
| 6 | Diagnosis | 7-investigation table (EGD, pH monitoring, manometry, impedance-pH, Bravo capsule) + LA Grading A-D table |
| 7 | Treatment Goals | 6 goals with objectives |
| 8 | Non-Pharmacological Treatment | 10-row table: diet, head-of-bed elevation, weight loss, smoking/alcohol, posture, surgery |
| 9 | Pharmacological Treatment | Step-up flowchart (Step 1-5), then full sections on: |
| 9.1 Antacids | MOA flowchart + 6-drug table (Al(OH)₃, Mg(OH)₂, CaCO₃, NaHCO₃, Mg trisilicate, Alginate) with dose/ADR/interactions/contraindications | |
| 9.2 H2 Receptor Antagonists | MOA flowchart + 4-drug table (Famotidine, Cimetidine, Ranitidine, Nizatidine) - cimetidine CYP interactions highlighted | |
| 9.3 Proton Pump Inhibitors | Full irreversible MOA flowchart (prodrug → sulfenamide → covalent bond at Cys813/Cys892) + 6-drug table (Omeprazole, Pantoprazole, Esomeprazole, Lansoprazole, Rabeprazole, Dexlansoprazole) | |
| 9.4 Prokinetics | MOA flowchart (D2 blockade + 5-HT4) + 4-drug table (Metoclopramide Black Box, Domperidone QT, Itopride, Mosapride) | |
| 9.5 Other agents | Baclofen (TLESR reduction) + Sucralfate (pregnancy-safe) | |
| 10 | Summary Comparison Chart | Master 8-column table: all drug classes side by side - MOA, onset, duration, indication, ADR, interactions, contraindications |
| 11 | Complications | Esophagitis → Stricture → Barrett's → Adenocarcinoma progression table |
| 12 | Pharmacist's Role | 10 counselling/monitoring points |