Diagram of GIT of good man gill man Book pharmacology pdf
"
| Drug Class | Site/Mechanism |
|---|---|
| Proton pump inhibitors (PPIs) | Block H⁺/K⁺-ATPase directly |
| Potassium-competitive acid blockers | Block K⁺-binding site of H⁺/K⁺-ATPase |
| H₂ antagonists | Block H₂ receptor on parietal cell |
| Muscarinic antagonists / Pirenzepine | Block M₁ and M₃ receptors |
| Antacids | Neutralize secreted H⁺ in lumen |
| Misoprostol | PGE₂ analogue - enhances mucosal defense via EPr₃ |
| Sucralfate / Carbenoxolone | Enhance cytoprotection at mucous layer |
| NSAIDs | Inhibit COX → reduce PGE₂ → reduce mucosal defense (ulcerogenic) |
| Bismuth, Metronidazole, Tetracycline, Clarithromycin, Amoxicillin | Target H. pylori |
Combine kDT diagram and send pdf of same topic
mkdir -p /home/daytona/workspace/git-pharmacology && ls /home/daytona/workspace/…
~/git-pharmacology/create_git_pdf.py
#!/usr/bin/env python3
"""
Create a PDF of GIT Pharmacology Diagrams
Sources: Goodman & Gilman's The Pharmacological Basis of Therapeutics
Katzung's Basic and Clinical Pharmacology, 16th Edition
"""
import requests
import os
from reportlab.lib.pagesizes import A4
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm, mm
from reportlab.lib.colors import HexColor, black, white, Color
from reportlab.platypus import (
SimpleDocTemplate, Paragraph, Spacer, Image, Table, TableStyle,
PageBreak, HRFlowable, KeepTogether
)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.platypus.flowables import Flowable
from io import BytesIO
from PIL import Image as PILImage
OUTPUT_PATH = "/home/daytona/workspace/git-pharmacology/GIT_Pharmacology_Diagrams.pdf"
# Image URLs from textbooks
IMAGES = [
{
"url": "https://cdn.orris.care/cdss_images/85c5979346652aece61f1a37f8416009df2f5c3beb6ace7529032eadf2c5ee41.png",
"figure": "Figure 53-1",
"source": "Goodman & Gilman's, Chapter 53 (p. 1094)",
"caption": (
"Pharmacologist's view of gastric secretion and its regulation — "
"the basis for therapy of acid-peptic disorders. Shows interactions among "
"neural input and enteroendocrine cells: ECL cell (histamine), ENS ganglion cell, "
"G cell (gastrin), parietal cell (H⁺ via H⁺/K⁺-ATPase), and superficial epithelial "
"cell (mucus and HCO₃⁻). Drug sites shown in red: PPIs, potassium-competitive acid "
"blockers, H₂ antagonists, muscarinic antagonists, antacids, misoprostol, sucralfate, "
"NSAIDs (ulcerogenic), and H. pylori antibiotics."
),
"topic": "Gastric Acid Secretion & Regulation"
},
{
"url": "https://cdn.orris.care/cdss_images/4c32c3abe2d61a4a7e07133c3250666bc5cd233354f8e409d484997cef488a6f.png",
"figure": "Figure 53-2",
"source": "Goodman & Gilman's, Chapter 53",
"caption": (
"Activation of a Proton Pump Inhibitor (PPI) from its prodrug form. "
"Omeprazole is converted to a sulfenamide in the acidic secretory canaliculi "
"of the parietal cell. The sulfenamide interacts covalently with sulfhydryl groups "
"in the proton pump (H⁺/K⁺-ATPase), thereby irreversibly inhibiting its activity. "
"Lansoprazole, rabeprazole, and pantoprazole undergo analogous conversions."
),
"topic": "PPI Activation Mechanism"
},
{
"url": "https://cdn.orris.care/cdss_images/1fca571dfe091ecfe747ca3aeb9f715037f18213d2f31a9534e22109885c35fe.png",
"figure": "Figure 53-3",
"source": "Goodman & Gilman's, Chapter 53",
"caption": (
"Structures of potassium-competitive acid blockers (P-CABs). "
"Revaprazan is a pyrimidine derivative; tegoprazan is a benzimidazole derivative; "
"vonoprazan is a pyrrole derivative. These agents bind reversibly to the K⁺-binding "
"site of the H⁺/K⁺-ATPase, acting more rapidly than PPIs and without requiring "
"acid-catalyzed activation."
),
"topic": "Potassium-Competitive Acid Blockers (P-CABs)"
},
]
# Key GIT pharmacology drug tables
DRUG_TABLES = [
{
"title": "Drugs Acting on Gastric Acid Secretion",
"headers": ["Drug Class", "Mechanism", "Examples", "Key Use"],
"rows": [
["Proton Pump Inhibitors\n(PPIs)", "Irreversibly block H⁺/K⁺-ATPase\n(require acid activation)", "Omeprazole, Lansoprazole,\nPantoprazole, Rabeprazole,\nEsomeprazole", "GERD, peptic ulcer,\nH. pylori eradication,\nZollinger-Ellison"],
["P-CABs\n(K⁺-competitive)", "Reversibly block K⁺-binding site\nof H⁺/K⁺-ATPase", "Vonoprazan, Tegoprazan,\nRevaprazan", "GERD, peptic ulcer\n(faster onset than PPIs)"],
["H₂ Receptor Antagonists", "Block H₂ receptors on\nparietal cells → ↓ cAMP", "Famotidine, Ranitidine,\nCimetidine, Nizatidine", "GERD, peptic ulcer\n(less potent than PPIs)"],
["Muscarinic Antagonists", "Block M₁/M₃ receptors;\nreduce ACh-driven secretion", "Pirenzepine (M₁-selective),\nAtropine", "Peptic ulcer (rarely used\ndue to side effects)"],
["Antacids", "Neutralize secreted H⁺\nin gastric lumen", "Mg(OH)₂, Al(OH)₃,\nCaCO₃", "Symptomatic relief\nof dyspepsia/GERD"],
["Mucosal Protective Agents", "PGE₂ analog → ↑ mucus,\n↑ HCO₃⁻, ↓ acid secretion", "Misoprostol (PGE₁ analog),\nSucralfate, Carbenoxolone", "NSAID-induced ulcer\nprevention; cytoprotection"],
["H. pylori Antibiotics", "Eradicate H. pylori\n(triple/quadruple therapy)", "Clarithromycin, Amoxicillin,\nMetronidazole, Tetracycline,\nBismuth", "Peptic ulcer disease\n(H. pylori-positive)"],
]
},
{
"title": "Drugs Acting on GI Motility",
"headers": ["Drug Class", "Mechanism", "Examples", "Key Use"],
"rows": [
["Prokinetics\n(D₂ antagonists)", "Block dopamine D₂ receptors\nin gut → ↑ ACh release", "Metoclopramide,\nDomperidone", "Gastroparesis, GERD,\nemesis (metoclopramide)"],
["Prokinetics\n(5-HT₄ agonists)", "Stimulate 5-HT₄ on ENS\nneurons → ↑ motility", "Prucalopride, Tegaserod,\nCisapride (withdrawn)", "Chronic constipation,\nIBS-C"],
["Motilin Agonists /\nMacrolide Antibiotics", "Stimulate motilin receptors\n→ phase III MMC contractions", "Erythromycin (low dose)", "Gastroparesis"],
["Laxatives\n(osmotic)", "Retain water in lumen\nby osmotic effect", "Lactulose, PEG,\nMg²⁺ salts", "Constipation, hepatic\nencephalopathy (lactulose)"],
["Laxatives\n(stimulant)", "Stimulate ENS; ↑ intestinal\nelectrolyte/water secretion", "Bisacodyl, Senna,\nCastor oil", "Acute constipation,\nbowel prep"],
["Antidiarrheals\n(opioid agonists)", "Activate μ/δ receptors\nin ENS → ↓ motility,\n↓ secretion", "Loperamide (peripheral),\nDiphenoxylate", "Acute/chronic diarrhea"],
["Antispasmodics", "Block M receptors or\ndirect smooth muscle relaxant", "Dicyclomine, Hyoscine,\nMebeverine", "IBS, biliary/renal colic"],
["5-HT₃ Antagonists", "Block 5-HT₃ on vagal\nafferents → ↓ gut motility", "Alosetron, Ondansetron", "IBS-D (alosetron);\nantiemetic (ondansetron)"],
]
},
{
"title": "Antiemetic Drug Classes",
"headers": ["Drug Class", "Mechanism", "Examples", "Indication"],
"rows": [
["5-HT₃ Antagonists", "Block 5-HT₃ in CTZ\nand gut vagal afferents", "Ondansetron, Granisetron,\nPalonosetron", "Chemotherapy-induced\nnausea (CINV)"],
["D₂ Antagonists\n(phenothiazines)", "Block D₂ in CTZ", "Prochlorperazine,\nChlorpromazine", "Nausea/vomiting from\nvarious causes"],
["D₂/5-HT₃ Antagonists", "Block D₂ and 5-HT₃", "Metoclopramide,\nDomperidone", "CINV, gastroparesis"],
["NK₁ Antagonists", "Block substance P at\nNK₁ receptors in NTS/CTZ", "Aprepitant, Fosaprepitant,\nNetupitant", "CINV (delayed phase);\ncombined with 5-HT₃"],
["H₁ Antihistamines", "Block H₁ and M receptors\nin vestibular pathways", "Promethazine, Dimenhydrinate,\nMeclizine", "Motion sickness,\nvestibular disorders"],
["Cannabinoids", "Activate CB₁ receptors\nin CNS and gut", "Dronabinol (THC),\nNabilone", "CINV refractory to\nstandard antiemetics"],
["Corticosteroids", "Mechanism unclear;\nmay reduce PG synthesis", "Dexamethasone", "Adjunct in CINV;\npotentiates 5-HT₃ agents"],
]
},
]
def download_image(url):
"""Download image and return BytesIO object."""
try:
resp = requests.get(url, timeout=30)
resp.raise_for_status()
img_bytes = BytesIO(resp.content)
# Verify it's valid
pil_img = PILImage.open(img_bytes)
pil_img.verify()
img_bytes.seek(0)
return img_bytes
except Exception as e:
print(f"Error downloading {url}: {e}")
return None
def create_pdf():
# Color palette
NAVY = HexColor('#1a3a5c')
TEAL = HexColor('#006d77')
LIGHT_TEAL = HexColor('#e8f4f8')
ORANGE = HexColor('#e76f51')
LIGHT_GRAY = HexColor('#f5f5f5')
MID_GRAY = HexColor('#cccccc')
DARK_TEXT = HexColor('#1a1a2e')
WHITE = white
doc = SimpleDocTemplate(
OUTPUT_PATH,
pagesize=A4,
rightMargin=1.8*cm,
leftMargin=1.8*cm,
topMargin=2*cm,
bottomMargin=2*cm,
title="GIT Pharmacology Diagrams",
author="Goodman & Gilman / Katzung Pharmacology",
)
styles = getSampleStyleSheet()
style_title = ParagraphStyle(
'MainTitle',
fontSize=22,
fontName='Helvetica-Bold',
textColor=WHITE,
alignment=TA_CENTER,
spaceAfter=6,
leading=28,
)
style_subtitle = ParagraphStyle(
'Subtitle',
fontSize=11,
fontName='Helvetica',
textColor=HexColor('#c8e6f0'),
alignment=TA_CENTER,
spaceAfter=4,
)
style_section = ParagraphStyle(
'SectionHead',
fontSize=14,
fontName='Helvetica-Bold',
textColor=WHITE,
alignment=TA_LEFT,
spaceBefore=6,
spaceAfter=4,
leading=18,
leftIndent=6,
)
style_figure_label = ParagraphStyle(
'FigureLabel',
fontSize=10,
fontName='Helvetica-Bold',
textColor=ORANGE,
alignment=TA_LEFT,
spaceBefore=8,
spaceAfter=2,
)
style_caption = ParagraphStyle(
'Caption',
fontSize=8.5,
fontName='Helvetica',
textColor=HexColor('#333333'),
alignment=TA_JUSTIFY,
spaceBefore=4,
spaceAfter=10,
leading=12,
leftIndent=10,
rightIndent=10,
)
style_source = ParagraphStyle(
'Source',
fontSize=7.5,
fontName='Helvetica-Oblique',
textColor=HexColor('#666666'),
alignment=TA_RIGHT,
spaceAfter=6,
)
style_topic = ParagraphStyle(
'TopicLabel',
fontSize=9,
fontName='Helvetica-Bold',
textColor=TEAL,
alignment=TA_LEFT,
spaceBefore=2,
spaceAfter=2,
)
style_body = ParagraphStyle(
'Body',
fontSize=9,
fontName='Helvetica',
textColor=DARK_TEXT,
alignment=TA_JUSTIFY,
spaceBefore=4,
spaceAfter=6,
leading=13,
)
style_table_header = ParagraphStyle(
'TableHeader',
fontSize=8,
fontName='Helvetica-Bold',
textColor=WHITE,
alignment=TA_CENTER,
)
style_table_cell = ParagraphStyle(
'TableCell',
fontSize=7.5,
fontName='Helvetica',
textColor=DARK_TEXT,
alignment=TA_LEFT,
leading=10,
)
story = []
# ─── COVER PAGE ──────────────────────────────────────────────────────
cover_data = [[
Paragraph("GASTROINTESTINAL TRACT<br/>PHARMACOLOGY", style_title),
]]
cover_subtitle = [[
Paragraph("Diagrams & Drug Reference", style_subtitle),
]]
cover_source = [[
Paragraph(
"Goodman & Gilman's: The Pharmacological Basis of Therapeutics, 14e<br/>"
"Katzung's Basic and Clinical Pharmacology, 16e",
style_subtitle
),
]]
cover_table = Table([[
Table(cover_data, colWidths=[16*cm]),
]], colWidths=[16.5*cm])
cover_table.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,-1), NAVY),
('ROUNDEDCORNERS', [8]),
('TOPPADDING', (0,0), (-1,-1), 24),
('BOTTOMPADDING', (0,0), (-1,-1), 8),
('LEFTPADDING', (0,0), (-1,-1), 16),
('RIGHTPADDING', (0,0), (-1,-1), 16),
]))
story.append(Spacer(1, 1.5*cm))
story.append(cover_table)
story.append(Spacer(1, 0.3*cm))
subtitle_table = Table([[
Paragraph("Diagrams & Drug Reference", style_subtitle),
]], colWidths=[16.5*cm])
subtitle_table.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,-1), TEAL),
('TOPPADDING', (0,0), (-1,-1), 6),
('BOTTOMPADDING', (0,0), (-1,-1), 6),
('LEFTPADDING', (0,0), (-1,-1), 16),
('RIGHTPADDING', (0,0), (-1,-1), 16),
]))
story.append(subtitle_table)
story.append(Spacer(1, 0.3*cm))
source_table = Table([[
Paragraph(
"<b>Sources:</b> Goodman & Gilman's The Pharmacological Basis of Therapeutics, 14th Ed | "
"Katzung's Basic and Clinical Pharmacology, 16th Ed",
ParagraphStyle('src', fontSize=8, fontName='Helvetica', textColor=HexColor('#444444'),
alignment=TA_CENTER)
),
]], colWidths=[16.5*cm])
source_table.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,-1), LIGHT_TEAL),
('TOPPADDING', (0,0), (-1,-1), 5),
('BOTTOMPADDING', (0,0), (-1,-1), 5),
('LEFTPADDING', (0,0), (-1,-1), 10),
('RIGHTPADDING', (0,0), (-1,-1), 10),
('BOX', (0,0), (-1,-1), 0.5, MID_GRAY),
]))
story.append(source_table)
story.append(Spacer(1, 0.8*cm))
# Contents list
toc_items = [
"Section 1: Gastric Acid Secretion & Regulation (Figure 53-1)",
"Section 2: PPI Activation Mechanism (Figure 53-2)",
"Section 3: Potassium-Competitive Acid Blockers — P-CABs (Figure 53-3)",
"Section 4: Drug Reference Tables — Acid Suppression, GI Motility & Antiemetics",
]
for i, item in enumerate(toc_items, 1):
story.append(Paragraph(
f"<b>{i}.</b> {item}",
ParagraphStyle('toc', fontSize=9.5, fontName='Helvetica',
textColor=DARK_TEXT, spaceBefore=5, spaceAfter=2,
leftIndent=12, leading=14)
))
story.append(PageBreak())
# ─── DIAGRAM SECTIONS ────────────────────────────────────────────────
for idx, img_info in enumerate(IMAGES):
# Section header bar
section_label = f"Section {idx+1} | {img_info['topic']}"
header_table = Table([[Paragraph(section_label, style_section)]],
colWidths=[16.5*cm])
header_table.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,-1), NAVY),
('TOPPADDING', (0,0), (-1,-1), 7),
('BOTTOMPADDING', (0,0), (-1,-1), 7),
('LEFTPADDING', (0,0), (-1,-1), 12),
('RIGHTPADDING', (0,0), (-1,-1), 12),
('ROUNDEDCORNERS', [4]),
]))
story.append(header_table)
story.append(Spacer(1, 0.3*cm))
# Figure label
story.append(Paragraph(img_info['figure'], style_figure_label))
# Download and embed image
img_data = download_image(img_info['url'])
if img_data:
try:
pil = PILImage.open(img_data)
w_px, h_px = pil.size
img_data.seek(0)
max_w = 15.5*cm
max_h = 14*cm
ratio = min(max_w / w_px, max_h / h_px)
img_w = w_px * ratio
img_h = h_px * ratio
rl_img = Image(img_data, width=img_w, height=img_h)
rl_img.hAlign = 'CENTER'
# Center image in a table
img_table = Table([[rl_img]], colWidths=[16.5*cm])
img_table.setStyle(TableStyle([
('ALIGN', (0,0), (-1,-1), 'CENTER'),
('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
('BACKGROUND', (0,0), (-1,-1), LIGHT_GRAY),
('BOX', (0,0), (-1,-1), 1, MID_GRAY),
('TOPPADDING', (0,0), (-1,-1), 10),
('BOTTOMPADDING', (0,0), (-1,-1), 10),
]))
story.append(img_table)
except Exception as e:
print(f"Error rendering image {idx}: {e}")
story.append(Paragraph(f"[Image unavailable: {e}]", style_body))
else:
story.append(Paragraph("[Image could not be downloaded]", style_body))
story.append(Spacer(1, 0.25*cm))
# Source line
story.append(Paragraph(f"Source: {img_info['source']}", style_source))
# Caption box
caption_table = Table([[
Paragraph(f"<b>{img_info['figure']}:</b> {img_info['caption']}", style_caption)
]], colWidths=[16.5*cm])
caption_table.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,-1), LIGHT_TEAL),
('BOX', (0,0), (-1,-1), 0.75, TEAL),
('LEFTPADDING', (0,0), (-1,-1), 10),
('RIGHTPADDING', (0,0), (-1,-1), 10),
('TOPPADDING', (0,0), (-1,-1), 8),
('BOTTOMPADDING', (0,0), (-1,-1), 8),
]))
story.append(caption_table)
story.append(Spacer(1, 0.6*cm))
# Page break between diagrams (except last)
if idx < len(IMAGES) - 1:
story.append(PageBreak())
story.append(PageBreak())
# ─── DRUG REFERENCE TABLES ───────────────────────────────────────────
table_header_bar = Table([[Paragraph("Section 4 | GIT Drug Reference Tables", style_section)]],
colWidths=[16.5*cm])
table_header_bar.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,-1), NAVY),
('TOPPADDING', (0,0), (-1,-1), 7),
('BOTTOMPADDING', (0,0), (-1,-1), 7),
('LEFTPADDING', (0,0), (-1,-1), 12),
('RIGHTPADDING', (0,0), (-1,-1), 12),
]))
story.append(table_header_bar)
story.append(Spacer(1, 0.4*cm))
for dt in DRUG_TABLES:
# Sub-header
sub_table = Table([[Paragraph(dt['title'], ParagraphStyle(
'sub', fontSize=11, fontName='Helvetica-Bold', textColor=WHITE,
alignment=TA_LEFT, spaceBefore=0, spaceAfter=0
))]], colWidths=[16.5*cm])
sub_table.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,-1), TEAL),
('TOPPADDING', (0,0), (-1,-1), 6),
('BOTTOMPADDING', (0,0), (-1,-1), 6),
('LEFTPADDING', (0,0), (-1,-1), 10),
('RIGHTPADDING', (0,0), (-1,-1), 10),
]))
story.append(sub_table)
# Build table data
col_widths = [3.8*cm, 4.5*cm, 4.2*cm, 4.0*cm]
table_data = []
# Header row
header_row = [Paragraph(f"<b>{h}</b>", style_table_header) for h in dt['headers']]
table_data.append(header_row)
for row in dt['rows']:
table_data.append([Paragraph(cell, style_table_cell) for cell in row])
t = Table(table_data, colWidths=col_widths, repeatRows=1)
row_count = len(table_data)
t.setStyle(TableStyle([
# Header
('BACKGROUND', (0,0), (-1,0), NAVY),
('TEXTCOLOR', (0,0), (-1,0), WHITE),
('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
('FONTSIZE', (0,0), (-1,0), 8),
('ALIGN', (0,0), (-1,0), 'CENTER'),
('VALIGN', (0,0), (-1,-1), 'TOP'),
# Alternating rows
*[('BACKGROUND', (0,i), (-1,i), LIGHT_GRAY if i % 2 == 0 else WHITE)
for i in range(1, row_count)],
# Grid
('GRID', (0,0), (-1,-1), 0.4, MID_GRAY),
('ROWBACKGROUNDS', (0,1), (-1,-1), [WHITE, LIGHT_GRAY]),
# Padding
('TOPPADDING', (0,0), (-1,-1), 4),
('BOTTOMPADDING', (0,0), (-1,-1), 4),
('LEFTPADDING', (0,0), (-1,-1), 5),
('RIGHTPADDING', (0,0), (-1,-1), 5),
# First col bold
('FONTNAME', (0,1), (0,-1), 'Helvetica-Bold'),
('TEXTCOLOR', (0,1), (0,-1), TEAL),
('FONTSIZE', (0,1), (0,-1), 7.5),
]))
story.append(t)
story.append(Spacer(1, 0.5*cm))
# Footer note
story.append(HRFlowable(width="100%", thickness=0.5, color=MID_GRAY))
story.append(Spacer(1, 0.2*cm))
story.append(Paragraph(
"This document contains figures and drug reference tables from "
"<i>Goodman & Gilman's The Pharmacological Basis of Therapeutics, 14th Ed</i> and "
"<i>Katzung's Basic and Clinical Pharmacology, 16th Ed</i>. "
"For educational use only.",
ParagraphStyle('footer', fontSize=7, fontName='Helvetica', textColor=HexColor('#888888'),
alignment=TA_CENTER, leading=10)
))
doc.build(story)
print(f"PDF created: {OUTPUT_PATH}")
return OUTPUT_PATH
if __name__ == "__main__":
create_pdf()
cd /home/daytona/workspace/git-pharmacology && python3 create_git_pdf.py 2>&1
~/git-pharmacology/create_git_pdf.py
Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/git-pharmacology/create_git_pdf.py'
cd /home/daytona/workspace/git-pharmacology && python3 create_git_pdf.py 2>&1
ls -lh /home/daytona/workspace/git-pharmacology/GIT_Pharmacology_Diagrams.pdf
GIT Pharmacology Diagrams
PDF Document · PDF