Prepare gastroenetrology questions pdf from harrison and davidson latest editions combine, deatiled answers f, with highlight mcq Total wuestions 18 Give me pdf of all answers
mkdir -p /tmp/workspace/gastro-mcq && ls /tmp/workspace/gastro-mcq/
~/gastro-mcq/generate_pdf.py
#!/usr/bin/env python3
"""
Gastroenterology Question Bank PDF Generator
18 Questions from Harrison's & Davidson's (Latest Editions)
With MCQ Highlights
"""
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm, mm
from reportlab.platypus import (SimpleDocTemplate, Paragraph, Spacer,
Table, TableStyle, HRFlowable, PageBreak,
KeepTogether)
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_JUSTIFY
from reportlab.pdfgen import canvas
from reportlab.platypus.frames import Frame
from reportlab.platypus.doctemplate import PageTemplate
# ── Colors ──────────────────────────────────────────────────────────────────
DARK_TEAL = colors.HexColor("#006D5B") # header / question bg
MED_TEAL = colors.HexColor("#009B8D") # subheadings
LIGHT_TEAL = colors.HexColor("#E0F4F1") # answer bg rows
HIGHLIGHT_Y = colors.HexColor("#FFF176") # MCQ highlight yellow
HIGHLIGHT_G = colors.HexColor("#C8E6C9") # MCQ highlight green
MCQ_BOX = colors.HexColor("#FF7043") # MCQ label background
MCQ_TEXT = colors.white
WHITE = colors.white
DARK_GRAY = colors.HexColor("#212121")
MID_GRAY = colors.HexColor("#555555")
BORDER_GRAY = colors.HexColor("#BDBDBD")
HEADER_BG = colors.HexColor("#004D40")
SUBHDR_BG = colors.HexColor("#00897B")
WIDTH, HEIGHT = A4
# ── Document setup ──────────────────────────────────────────────────────────
def build_styles():
base = getSampleStyleSheet()
styles = {}
styles['cover_title'] = ParagraphStyle(
'cover_title', parent=base['Title'],
fontSize=28, textColor=WHITE, alignment=TA_CENTER,
spaceAfter=12, fontName='Helvetica-Bold', leading=34)
styles['cover_sub'] = ParagraphStyle(
'cover_sub', parent=base['Normal'],
fontSize=14, textColor=colors.HexColor("#B2DFDB"),
alignment=TA_CENTER, spaceAfter=6, fontName='Helvetica')
styles['cover_info'] = ParagraphStyle(
'cover_info', parent=base['Normal'],
fontSize=11, textColor=colors.HexColor("#E0F2F1"),
alignment=TA_CENTER, spaceAfter=4, fontName='Helvetica-Oblique')
styles['q_num'] = ParagraphStyle(
'q_num', parent=base['Normal'],
fontSize=11, textColor=WHITE, fontName='Helvetica-Bold',
alignment=TA_LEFT, leftIndent=6, spaceAfter=0)
styles['q_text'] = ParagraphStyle(
'q_text', parent=base['Normal'],
fontSize=12, textColor=WHITE, fontName='Helvetica-Bold',
alignment=TA_LEFT, leftIndent=6, spaceAfter=0, leading=16)
styles['section_head'] = ParagraphStyle(
'section_head', parent=base['Normal'],
fontSize=11, textColor=WHITE, fontName='Helvetica-Bold',
backColor=SUBHDR_BG, leftIndent=4, rightIndent=4,
spaceBefore=6, spaceAfter=4, leading=14,
borderPadding=(3, 6, 3, 6))
styles['body'] = ParagraphStyle(
'body', parent=base['Normal'],
fontSize=10.5, textColor=DARK_GRAY, fontName='Helvetica',
alignment=TA_JUSTIFY, leftIndent=8, rightIndent=8,
spaceAfter=4, leading=15)
styles['bullet'] = ParagraphStyle(
'bullet', parent=base['Normal'],
fontSize=10.5, textColor=DARK_GRAY, fontName='Helvetica',
leftIndent=20, firstLineIndent=-12, spaceAfter=3, leading=14)
styles['mcq_label'] = ParagraphStyle(
'mcq_label', parent=base['Normal'],
fontSize=10, textColor=MCQ_TEXT, fontName='Helvetica-Bold',
backColor=MCQ_BOX, alignment=TA_CENTER,
spaceBefore=8, spaceAfter=2, borderPadding=(3, 8, 3, 8))
styles['mcq_q'] = ParagraphStyle(
'mcq_q', parent=base['Normal'],
fontSize=10.5, textColor=DARK_GRAY, fontName='Helvetica-Bold',
leftIndent=8, spaceAfter=3, leading=14,
backColor=HIGHLIGHT_Y, borderPadding=(4, 6, 4, 6))
styles['mcq_opt'] = ParagraphStyle(
'mcq_opt', parent=base['Normal'],
fontSize=10.5, textColor=DARK_GRAY, fontName='Helvetica',
leftIndent=24, firstLineIndent=-16, spaceAfter=2, leading=13)
styles['mcq_ans'] = ParagraphStyle(
'mcq_ans', parent=base['Normal'],
fontSize=10.5, textColor=colors.HexColor("#1B5E20"),
fontName='Helvetica-Bold',
backColor=HIGHLIGHT_G, leftIndent=8, spaceAfter=4,
borderPadding=(3, 6, 3, 6))
styles['ref'] = ParagraphStyle(
'ref', parent=base['Normal'],
fontSize=9, textColor=MED_TEAL, fontName='Helvetica-Oblique',
leftIndent=8, spaceAfter=8)
styles['toc_head'] = ParagraphStyle(
'toc_head', parent=base['Normal'],
fontSize=16, textColor=WHITE, fontName='Helvetica-Bold',
alignment=TA_CENTER, spaceBefore=10, spaceAfter=8)
styles['toc_entry'] = ParagraphStyle(
'toc_entry', parent=base['Normal'],
fontSize=10.5, textColor=DARK_GRAY, fontName='Helvetica',
leftIndent=10, spaceAfter=3, leading=14)
return styles
def header_footer(canvas_obj, doc):
canvas_obj.saveState()
w, h = A4
# Header bar
canvas_obj.setFillColor(HEADER_BG)
canvas_obj.rect(0, h - 28*mm, w, 28*mm, fill=1, stroke=0)
canvas_obj.setFillColor(WHITE)
canvas_obj.setFont('Helvetica-Bold', 11)
canvas_obj.drawCentredString(w/2, h - 16*mm,
"GASTROENTEROLOGY QUESTION BANK | Harrison's & Davidson's")
canvas_obj.setFont('Helvetica', 9)
canvas_obj.setFillColor(colors.HexColor("#B2DFDB"))
canvas_obj.drawCentredString(w/2, h - 23*mm, "18 Questions with Detailed Answers & MCQ Highlights")
# Footer bar
canvas_obj.setFillColor(HEADER_BG)
canvas_obj.rect(0, 0, w, 16*mm, fill=1, stroke=0)
canvas_obj.setFillColor(WHITE)
canvas_obj.setFont('Helvetica', 9)
canvas_obj.drawString(20*mm, 6*mm, "Harrison's Principles of Internal Medicine, 21e | Davidson's Principles & Practice of Medicine, 23e")
canvas_obj.drawRightString(w - 20*mm, 6*mm, f"Page {doc.page}")
canvas_obj.restoreState()
def q_block(num, title, styles):
"""Returns a question-header table."""
data = [[
Paragraph(f"Q{num}.", styles['q_num']),
Paragraph(title, styles['q_text'])
]]
t = Table(data, colWidths=[1.2*cm, 15.8*cm])
t.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,-1), DARK_TEAL),
('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
('LEFTPADDING', (0,0), (-1,-1), 6),
('RIGHTPADDING', (0,0), (-1,-1), 6),
('TOPPADDING', (0,0), (-1,-1), 8),
('BOTTOMPADDING', (0,0), (-1,-1), 8),
('ROWBACKGROUNDS', (0,0), (-1,-1), [DARK_TEAL]),
]))
return t
def sh(text, styles):
"""Section heading paragraph."""
return Paragraph(f"<b>► {text}</b>", styles['section_head'])
def bp(items, styles):
"""Bullet list from a list of strings."""
out = []
for item in items:
out.append(Paragraph(f"• {item}", styles['bullet']))
return out
def mcq_block(question, options, correct_letter, explanation, styles):
"""Renders a single MCQ with highlighted answer."""
items = []
items.append(Paragraph(" MCQ ", styles['mcq_label']))
items.append(Paragraph(question, styles['mcq_q']))
for opt in options:
items.append(Paragraph(opt, styles['mcq_opt']))
items.append(Paragraph(f"Answer: {correct_letter} | {explanation}", styles['mcq_ans']))
return items
S = build_styles()
# ═══════════════════════════════════════════════════════════════════════════
# QUESTION DATA
# ═══════════════════════════════════════════════════════════════════════════
questions = [
# ─── Q1 ────────────────────────────────────────────────────────────────────
{
'num': 1,
'title': 'Complications of Ulcerative Colitis',
'ref': "Davidson's Principles & Practice of Medicine, 23rd ed., p. 818 | Harrison's 21e, Ch. 322",
'sections': [
('Definition', [
'Ulcerative colitis (UC) is a chronic relapsing inflammatory disorder confined to the colonic mucosa, starting at the rectum and extending proximally in a continuous pattern.',
]),
('Local / Intestinal Complications', [
'Toxic megacolon: life-threatening dilatation of colon (>6 cm transverse), occurs in severe colitis; risk of perforation.',
'Perforation: most feared; may occur with or without toxic megacolon; associated with high mortality.',
'Massive haemorrhage: requiring emergency colectomy in <5% of patients.',
'Stricture formation: benign fibrotic strictures; must exclude malignancy.',
'Colorectal carcinoma (CRC): 10–20× increased risk; risk rises with extent of colitis and duration >8–10 years; dysplasia surveillance colonoscopy every 1–2 years after 8 years.',
'Pseudopolyps: post-inflammatory regenerative; no malignant potential themselves.',
'Acute severe colitis (Truelove & Witts criteria): >6 bloody stools/day + systemic features.',
'Perianal disease: less common than Crohn\'s.',
]),
('Extraintestinal Complications', [
'Related to disease activity: peripheral arthropathy, oral aphthous ulcers, episcleritis, erythema nodosum.',
'Unrelated to disease activity: sacroiliitis, ankylosing spondylitis, anterior uveitis, pyoderma gangrenosum, primary sclerosing cholangitis (PSC).',
'PSC: associated in up to 5% of UC patients; risk of cholangiocarcinoma; colonoscopy surveillance needed even after liver transplant.',
]),
('Nutritional Complications', [
'Malnutrition, iron-deficiency anaemia, anaemia of chronic disease.',
'Hypoalbuminaemia in severe disease.',
]),
('Treatment-related', [
'Corticosteroid side-effects: osteoporosis, adrenal suppression, opportunistic infections.',
'Immunosuppressive therapy (azathioprine): lymphoma risk.',
'Anti-TNF therapy: reactivation of TB, opportunistic infections.',
]),
],
'mcq': {
'q': 'Which complication of ulcerative colitis requires urgent colectomy and carries the highest mortality?',
'opts': ['A. Pseudopolyps', 'B. Toxic megacolon with perforation', 'C. Primary sclerosing cholangitis', 'D. Iron-deficiency anaemia'],
'ans': 'B',
'exp': 'Toxic megacolon with perforation is the most life-threatening complication of UC. (Davidson\'s 23e, p.818)'
}
},
# ─── Q2 ────────────────────────────────────────────────────────────────────
{
'num': 2,
'title': 'Upper GI Bleed: Causes, Management & Variceal Bleeding',
'ref': "Davidson's 23rd ed., p. 782 | Harrison's 21e, Ch. 48",
'sections': [
('Definition', [
'Upper GI bleed (UGIB) is bleeding proximal to the ligament of Treitz. Presents as haematemesis (bright red/coffee-ground vomit), malaena (tarry black stool), or haematochezia if massive.',
]),
('Causes', [
'Peptic ulcer disease (PUD): most common cause (~40–50%); DU > GU.',
'Oesophageal/gastric varices: ~15%; high mortality (30–50% per episode).',
'Mallory-Weiss tear: mucosal tear at GOJ after forceful vomiting (~5%).',
'Erosive oesophagitis / gastritis / duodenitis.',
'Dieulafoy lesion: large submucosal artery; often no ulcer.',
'Gastric antral vascular ectasia (GAVE / "watermelon stomach").',
'Aorto-enteric fistula (rare but catastrophic, after aortic graft).',
'Hereditary haemorrhagic telangiectasia (Osler-Weber-Rendu).',
'Tumours: gastric carcinoma, GI stromal tumour (GIST).',
]),
('Initial Resuscitation', [
'Two large-bore IV cannulae; crossmatch 4–6 units blood.',
'Fluid resuscitation: target HR <100, SBP >100 mmHg.',
'Restrictive transfusion: Hb target 7–9 g/dL (or ≥10 if portal hypertension).',
'Proton-pump inhibitor (PPI): IV omeprazole 80 mg bolus then 8 mg/hr infusion.',
'Risk stratification: Glasgow-Blatchford Score (GBS) before endoscopy; Rockall score post-endoscopy.',
'Urgent OGD (upper endoscopy) within 24 hrs; within 12 hrs if haemodynamically unstable.',
]),
('Endoscopic Treatment', [
'Injection therapy: 1:10,000 adrenaline injection around bleeding vessel.',
'Thermal coagulation: heater probe, bipolar electrocoagulation, argon plasma coagulation.',
'Mechanical: haemostatic clips (metallic clips for Forrest Ia/Ib lesions).',
'Combination therapy preferred over monotherapy.',
'Forrest classification guides urgency: Ia (spurting) → Ib (oozing) → IIa (visible vessel) → IIb (clot) → IIc (flat spot) → III (clean base).',
]),
('Management of Variceal Bleeding', [
'Terlipressin: 2 mg IV 6-hourly (or octreotide 50 mcg bolus then 50 mcg/hr) — started immediately, reduces portal pressure.',
'Prophylactic antibiotics: IV ceftriaxone 1 g/day or ciprofloxacin (reduces bacterial translocation, rebleeding, mortality).',
'Urgent endoscopy within 12 hrs: oesophageal band ligation (EBL) — first choice for oesophageal varices.',
'Gastric varices: cyanoacrylate glue injection (N-butyl-2-cyanoacrylate).',
'Balloon tamponade (Sengstaken-Blakemore tube): as bridge if endoscopy fails; max 24 hrs.',
'TIPS (Transjugular Intrahepatic Portosystemic Shunt): rescue therapy for refractory/uncontrolled variceal bleed.',
'Secondary prophylaxis: non-selective beta-blocker (propranolol/carvedilol) + repeat EBL every 2–4 weeks until variceal obliteration.',
'Primary prophylaxis: NSBB or EBL for medium/large oesophageal varices.',
]),
],
'mcq': {
'q': 'What is the FIRST-LINE vasoactive drug used in acute variceal haemorrhage?',
'opts': ['A. Vasopressin', 'B. Terlipressin', 'C. Somatostatin', 'D. Propranolol'],
'ans': 'B',
'exp': 'Terlipressin is the preferred vasoactive drug (reduces splanchnic blood flow, reduces portal pressure); only agent shown to reduce mortality. (Davidson\'s 23e, p.782; Harrison\'s 21e)'
}
},
# ─── Q3 ────────────────────────────────────────────────────────────────────
{
'num': 3,
'title': 'Irritable Bowel Syndrome (IBS)',
'ref': "Davidson's 23rd ed., p. 824 | Harrison's 21e, Ch. 343",
'sections': [
('Definition', [
'IBS is a functional bowel disorder characterised by recurrent abdominal pain associated with defecation or a change in bowel habit, without identifiable structural or biochemical abnormality.',
]),
('Rome IV Diagnostic Criteria', [
'Recurrent abdominal pain ≥1 day/week (on average) for the last 3 months (onset ≥6 months ago).',
'Associated with ≥2 of: (1) related to defecation, (2) change in stool frequency, (3) change in stool form/appearance.',
]),
('Subtypes (Bristol Stool Scale)', [
'IBS-C: constipation predominant (BSS 1–2).',
'IBS-D: diarrhoea predominant (BSS 6–7).',
'IBS-M: mixed bowel habits.',
'IBS-U: unclassified.',
]),
('Pathophysiology', [
'Visceral hypersensitivity: enhanced response to normal gut stimuli.',
'Altered gut motility: accelerated (IBS-D) or delayed (IBS-C).',
'Gut-brain axis dysfunction: abnormal enteric nervous system signalling.',
'Low-grade mucosal inflammation and mast cell activation.',
'Dysbiosis: altered gut microbiome composition.',
'Post-infectious IBS: 10–25% of cases follow acute gastroenteritis.',
'Psychosocial factors: anxiety, depression, somatisation strongly associated.',
]),
('Clinical Features', [
'Crampy abdominal pain relieved by defecation.',
'Bloating and abdominal distension.',
'Altered stool form and frequency; mucus in stool.',
'Incomplete evacuation, urgency, straining.',
'Absence of nocturnal symptoms (differentiates from organic disease).',
'Red flags (requiring investigation): age >50, rectal bleeding, weight loss, anaemia, nocturnal symptoms, family history of CRC/IBD.',
]),
('Investigations', [
'Bloods: FBC, CRP, ESR, TTG (anti-tissue transglutaminase) to exclude coeliac disease, TSH.',
'Stool: calprotectin (elevated in IBD; normal in IBS), culture, C. diff toxin.',
'Colonoscopy / sigmoidoscopy: for red-flag features only.',
]),
('Management', [
'Reassurance, explanation, and lifestyle modification.',
'Diet: low-FODMAP diet (reduces fermentable carbohydrates) — first-line dietary intervention.',
'IBS-D: loperamide, rifaximin, low-dose tricyclics (amitriptyline), alosetron (women).',
'IBS-C: osmotic laxatives (macrogol), linaclotide, lubiprostone.',
'Pain: antispasmodics (mebeverine, hyoscine), low-dose TCAs, SSRIs.',
'Psychological therapies: CBT, hypnotherapy, mindfulness.',
'Probiotics: may help bloating (evidence emerging).',
]),
],
'mcq': {
'q': 'Which dietary approach is recommended as FIRST-LINE for IBS symptom management?',
'opts': ['A. High-fibre diet', 'B. Gluten-free diet', 'C. Low-FODMAP diet', 'D. Low-fat diet'],
'ans': 'C',
'exp': 'Low-FODMAP diet (reducing fermentable oligosaccharides, disaccharides, monosaccharides, and polyols) is the most evidence-based first-line dietary intervention for IBS. (Davidson\'s 23e, p.824)'
}
},
# ─── Q4 ────────────────────────────────────────────────────────────────────
{
'num': 4,
'title': 'Peptic Ulcer Disease: Pathogenesis, Clinical Features, Complications & Management',
'ref': "Davidson's 23rd ed., p. 798 | Harrison's 21e, Ch. 324",
'sections': [
('Definition', [
'Peptic ulcer disease (PUD) is defined as disruption of the mucosal integrity of the stomach or duodenum producing a local defect extending through the muscularis mucosae.',
'Duodenal ulcer (DU) is 4× more common than gastric ulcer (GU).',
]),
('Pathogenesis', [
'Imbalance between aggressive factors (acid, pepsin, H. pylori, NSAIDs) and defensive factors (mucus, bicarbonate, prostaglandins, mucosal blood flow, epithelial renewal).',
'H. pylori: causes 90% of DU and 70–75% of GU; cagA-positive strains more virulent.',
'NSAIDs/aspirin: inhibit COX-1 → reduce prostaglandins → impair mucosal defence; cause 15–20% of ulcers.',
'Acid hypersecretion: Zollinger-Ellison syndrome (gastrinoma), antral G-cell hyperplasia.',
'Stress ulcers: in critically ill patients (mechanical ventilation, coagulopathy).',
'Smoking and alcohol exacerbate ulceration.',
]),
('Clinical Features', [
'DU: epigastric pain 2–3 hours after food; relieved by food or antacids; may wake patient at night; hunger pain.',
'GU: pain may be precipitated by food; no characteristic relationship.',
'Nausea, waterbrash, heartburn.',
'Dyspepsia in elderly may be silent until complication occurs.',
'Anaemia (chronic blood loss), weight loss (especially GU — must exclude malignancy).',
]),
('Complications', [
'Haemorrhage: most common (15–20%); presents as haematemesis/malaena.',
'Perforation: 2–10%; DU anterior wall perforates; peritonitis; Rigids board-like rigidity, absent bowel sounds; erect CXR shows free air under diaphragm.',
'Penetration: ulcer erodes into adjacent organ (pancreas); pain radiates to back.',
'Pyloric stenosis/gastric outlet obstruction: succussion splash, projectile vomiting; metabolic alkalosis (hypochloraemia, hypokalaemia).',
'Malignant transformation: GU only (DU does not become malignant).',
]),
('Investigations', [
'OGD (endoscopy): gold standard; allows biopsy (GU should always be biopsied × 4–6 for malignancy).',
'H. pylori testing: rapid urease test (CLO test) on biopsy; urea breath test (gold standard non-invasive); stool antigen; serology (cannot confirm active infection).',
'Barium meal: largely replaced by endoscopy.',
'Fasting gastrin level: if ZES suspected (>1000 pg/mL highly suggestive).',
]),
('Management', [
'H. pylori eradication: FIRST-LINE for H. pylori-positive PUD.',
'Standard triple therapy (7–14 days): PPI (omeprazole 20 mg BD) + clarithromycin 500 mg BD + amoxicillin 1 g BD.',
'Bismuth quadruple therapy: PPI + bismuth + metronidazole + tetracycline (preferred in areas of high clarithromycin resistance).',
'PPIs: omeprazole/lansoprazole 20 mg OD; standard course 4 weeks (DU), 8 weeks (GU).',
'NSAIDs should be stopped; if unavoidable → add PPI co-prescription.',
'Surgical management (now rare): complications (haemorrhage not controlled endoscopically → oversewing; perforation → Graham patch; gastric outlet obstruction → balloon dilatation or surgery).',
'Confirm H. pylori eradication: urea breath test 4–6 weeks after completing eradication (not while on PPI).',
]),
],
'mcq': {
'q': 'A 45-year-old man with duodenal ulcer is found to be H. pylori positive. What is the FIRST-LINE treatment?',
'opts': ['A. PPI alone for 8 weeks', 'B. Triple therapy: PPI + clarithromycin + amoxicillin', 'C. Bismuth alone', 'D. Surgery (vagotomy)'],
'ans': 'B',
'exp': 'H. pylori-positive DU requires eradication therapy. Standard triple therapy (PPI + clarithromycin + amoxicillin for 7–14 days) is first-line. (Davidson\'s 23e, p.798; Harrison\'s 21e)'
}
},
# ─── Q5 ────────────────────────────────────────────────────────────────────
{
'num': 5,
'title': 'Acute Pancreatitis: Causes, Clinical Features, Investigations, Complications & Management',
'ref': "Davidson's 23rd ed., p. 837 | Harrison's 21e, Ch. 347",
'sections': [
('Definition', [
'Acute pancreatitis is an acute inflammatory process of the pancreas with variable involvement of other regional tissues or remote organ systems.',
]),
('Aetiology — "GET SMASHED"', [
'G — Gallstones (most common in UK/India, 40–50%): obstruction of pancreatic duct.',
'E — Ethanol (alcohol): 2nd most common (30–40%); acinar cell injury.',
'T — Trauma (blunt abdominal injury).',
'S — Steroids.',
'M — Mumps/infections (Coxsackie B, CMV, HIV).',
'A — Autoimmune (autoimmune pancreatitis type 1/2).',
'S — Scorpion sting / Hypertriglyceridaemia (>1000 mg/dL).',
'H — Hypercalcaemia / Hyperlipidaemia.',
'E — ERCP (post-ERCP pancreatitis 5–10%).',
'D — Drugs (azathioprine, valproate, tetracyclines, thiazides, furosemide, sulfonamides).',
'Idiopathic: ~10–15%.',
]),
('Clinical Features', [
'Severe epigastric pain radiating to the back ("boring pain"), onset over 30–60 min.',
'Nausea and vomiting (not relieved by vomiting).',
'Abdominal distension, guarding, reduced bowel sounds (ileus).',
'Fever (low-grade initially).',
'Grey Turner\'s sign: flank bruising (retroperitoneal haemorrhage — late sign).',
'Cullen\'s sign: periumbilical bruising — haemorrhagic pancreatitis.',
'Jaundice if biliary obstruction.',
]),
('Investigations', [
'Serum amylase: >3× upper limit normal is diagnostic; peaks at 24–48 hrs; not specific.',
'Serum lipase: more sensitive and specific; remains elevated longer than amylase.',
'FBC, U&E, LFTs, glucose (hyperglycaemia), calcium (hypocalcaemia = poor prognosis).',
'CRP: >150 mg/L at 48 hrs predicts severe disease.',
'USS: detects gallstones (done within 24 hrs of admission).',
'CT abdomen (contrast-enhanced): best for staging severity; assess for necrosis — CT Severity Index (Balthazar score); performed 48–72 hrs after onset if severe.',
'MRCP: for suspected biliary pancreatitis without USS confirmation.',
]),
('Severity Scoring', [
'Revised Atlanta Classification (2012): mild (no organ failure, no local complications), moderately severe (transient organ failure <48 hrs or local complications), severe (persistent organ failure >48 hrs).',
'Glasgow-Imrie Score (≥3 = severe): PANCREAS — PaO2, Age, Neutrophils, Calcium, Renal, Enzymes (LDH), Albumin, Sugar.',
'APACHE II score: ≥8 = severe.',
'BISAP score: ≥3 = increased mortality.',
]),
('Management', [
'Aggressive IV fluid resuscitation: Hartmann\'s (Lactated Ringer\'s) preferred over normal saline; 250–500 mL/hr initially.',
'Analgesia: IV morphine or pethidine; regular paracetamol.',
'Nil by mouth initially; early enteral nutrition (nasojejunal feeding) within 24–48 hrs — superior to parenteral nutrition.',
'NBM not required if mild — early oral refeeding when pain settles.',
'Antibiotics: NOT routinely given; use only for proven infected necrosis (carbapenems, e.g., meropenem, penetrate well).',
'ERCP + sphincterotomy within 24–72 hrs: if biliary obstruction or cholangitis.',
'Surgical intervention: necrosectomy for infected necrosis (step-up approach: percutaneous drainage → minimally invasive necrosectomy → open).',
'Cholecystectomy during same admission (mild biliary pancreatitis) or within 2 weeks to prevent recurrence.',
]),
('Complications', [
'Early (<2 weeks): SIRS, organ failure (ARDS, AKI, shock), DIC.',
'Late (>2 weeks): pancreatic necrosis, infected necrosis, pseudocyst, pancreatic fistula.',
'Walled-off necrosis: requires endoscopic or surgical drainage.',
'Pancreatic pseudocyst: fluid collection with fibrous wall; may resolve spontaneously; if symptomatic → endoscopic cystogastrostomy.',
'Chronic pancreatitis, diabetes mellitus, exocrine insufficiency.',
]),
],
'mcq': {
'q': 'A CRP of >150 mg/L at 48 hours in acute pancreatitis indicates:',
'opts': ['A. Mild pancreatitis', 'B. Severe pancreatitis', 'C. Pancreatic pseudocyst formation', 'D. Biliary aetiology'],
'ans': 'B',
'exp': 'CRP >150 mg/L at 48 hours is a reliable predictor of severe acute pancreatitis. (Davidson\'s 23e, p.837; Harrison\'s 21e)'
}
},
# ─── Q6 ────────────────────────────────────────────────────────────────────
{
'num': 6,
'title': 'Gastro-oesophageal Reflux Disease (GERD)',
'ref': "Davidson's 23rd ed., p. 791 | Harrison's 21e, Ch. 321",
'sections': [
('Definition', [
'GERD is a condition where gastric contents reflux into the oesophagus causing troublesome symptoms and/or complications. Defined as symptoms occurring ≥2 days/week that affect quality of life.',
]),
('Pathophysiology', [
'Lower oesophageal sphincter (LOS) incompetence: most important factor.',
'Transient LOS relaxations (TLOSRs): spontaneous, not triggered by swallowing.',
'Hiatus hernia: disrupts anti-reflux mechanism; associated with GERD.',
'Impaired oesophageal acid clearance and delayed gastric emptying.',
'Obesity, pregnancy, dietary triggers (fat, caffeine, chocolate, alcohol, mint).',
'Smoking reduces LOS pressure.',
]),
('Clinical Features', [
'Typical: heartburn (retrosternal burning), acid regurgitation, waterbrash.',
'Atypical: chronic cough, hoarseness, asthma, non-cardiac chest pain, globus sensation.',
'Dysphagia suggests stricture or Barrett\'s oesophagus.',
]),
('Investigations', [
'Clinical diagnosis in typical presentations; no investigation needed if no red flags.',
'OGD (endoscopy): for alarm symptoms (dysphagia, weight loss, haematemesis, anaemia, age >55 with new symptoms).',
'24-hour oesophageal pH monitoring: gold standard for diagnosis; DeMeester score >14.7 = abnormal.',
'Oesophageal manometry: to assess LOS pressure and exclude achalasia before anti-reflux surgery.',
'LA classification of oesophagitis: Grade A–D (A = small erosions; D = confluent circumferential).',
]),
('Complications', [
'Oesophagitis and erosions.',
'Peptic stricture: dysphagia; treated with dilatation.',
'Barrett\'s oesophagus: metaplasia of squamous → columnar (intestinal) epithelium; present in 10–15% of patients with chronic GERD; risk of adenocarcinoma (0.1–0.3% per year).',
'Oesophageal adenocarcinoma.',
'Respiratory: aspiration pneumonitis, worsening asthma, laryngitis.',
]),
('Management', [
'Lifestyle: weight loss, elevate bed head, small meals, avoid trigger foods, stop smoking.',
'Antacids/alginate (Gaviscon): symptomatic relief only.',
'H2 receptor antagonists (ranitidine/famotidine): for mild symptoms.',
'Proton pump inhibitors (PPIs): mainstay; omeprazole 20–40 mg OD (taken 30 min before meals); 4–8 week course.',
'Continuous or on-demand PPI for chronic GERD.',
'H. pylori testing and treatment: where indicated.',
'Anti-reflux surgery (Nissen fundoplication): for patients with proven GERD who are PPI-dependent or have large hiatus hernia.',
'Barrett\'s surveillance: endoscopy every 2–5 years; radiofrequency ablation (RFA) for high-grade dysplasia.',
]),
],
'mcq': {
'q': 'Barrett\'s oesophagus is a complication of GERD characterised by:',
'opts': ['A. Squamous cell hyperplasia', 'B. Columnar metaplasia replacing squamous epithelium', 'C. Submucosal fibrosis', 'D. H. pylori infection of the oesophagus'],
'ans': 'B',
'exp': 'Barrett\'s oesophagus = metaplasia of oesophageal squamous epithelium to intestinal-type columnar epithelium; precursor of oesophageal adenocarcinoma. (Davidson\'s 23e, p.791)'
}
},
# ─── Q7 ────────────────────────────────────────────────────────────────────
{
'num': 7,
'title': 'Causes of Malabsorption',
'ref': "Davidson's 23rd ed., p. 784 | Harrison's 21e, Ch. 334",
'sections': [
('Definition', [
'Malabsorption is a clinical state in which intestinal absorption of one or more nutrients is impaired. Can involve: fat (steatorrhoea), carbohydrates, proteins, vitamins, minerals.',
]),
('Classification of Causes', [
'1. LUMINAL PHASE: inadequate digestion',
' - Pancreatic exocrine insufficiency: chronic pancreatitis, cystic fibrosis, pancreatic carcinoma.',
' - Bile salt deficiency: cholestatic liver disease, ileal resection/disease (Crohn\'s), bacterial overgrowth (bile salt deconjugation).',
' - Zollinger-Ellison syndrome: inactivation of pancreatic enzymes by excess acid.',
' - Post-gastrectomy states: Billroth II, dumping syndrome, blind loop syndrome.',
'2. MUCOSAL PHASE: absorptive defect',
' - Coeliac disease (most common in UK/developed countries).',
' - Tropical sprue.',
' - Whipple\'s disease (Tropheryma whipplei).',
' - Small bowel Crohn\'s disease.',
' - Radiation enteritis.',
' - Drugs: neomycin, cholestyramine, metformin (B12).',
' - Intestinal lymphangiectasia (protein-losing enteropathy).',
' - Amyloidosis, eosinophilic gastroenteritis.',
'3. POST-MUCOSAL PHASE: lymphatic/vascular obstruction',
' - Lymphoma, mesenteric tuberculosis, lymphangiectasia.',
'4. SHORT GUT SYNDROME: reduced absorptive area after resection.',
]),
('Clinical Features', [
'Steatorrhoea: pale, bulky, greasy, offensive stools that float and are difficult to flush.',
'Weight loss despite adequate caloric intake.',
'Nutritional deficiencies: iron (anaemia), B12/folate (macrocytic anaemia), fat-soluble vitamins (A, D, E, K).',
'Vitamin D/calcium deficiency: osteomalacia, tetany.',
'Vitamin K deficiency: prolonged PT, bleeding tendency.',
'Oedema: hypoalbuminaemia.',
]),
],
'mcq': {
'q': 'Which vitamin deficiency in malabsorption causes night blindness?',
'opts': ['A. Vitamin D', 'B. Vitamin A', 'C. Vitamin K', 'D. Vitamin E'],
'ans': 'B',
'exp': 'Vitamin A (fat-soluble) deficiency in malabsorption causes night blindness and xerophthalmia. (Davidson\'s 23e, p.784)'
}
},
# ─── Q8 ────────────────────────────────────────────────────────────────────
{
'num': 8,
'title': 'Diagnosis, Investigations & Management of Malabsorption',
'ref': "Davidson's 23rd ed., p. 785 | Harrison's 21e, Ch. 334",
'sections': [
('Investigations', [
'Bloods: FBC (anaemia type — microcytic=iron, macrocytic=B12/folate), iron studies, B12, folate, albumin, calcium, phosphate, PT, 25-OH vitamin D.',
'LFTs: elevated ALP in liver/bone disease.',
'Anti-tissue transglutaminase (anti-TTG IgA) + total IgA: screen for coeliac disease; >95% sensitivity.',
'Anti-endomysial antibody (EMA): highly specific for coeliac.',
'Faecal fat (72-hr stool collection): >7 g/day = steatorrhoea; largely superseded by faecal elastase.',
'Faecal elastase-1: <200 mcg/g stool = pancreatic exocrine insufficiency.',
'Hydrogen breath test: for lactose intolerance, small intestinal bacterial overgrowth (SIBO), fructose malabsorption.',
'D-xylose test: reduced absorption = mucosal disease (normal in pancreatic insufficiency).',
'SeHCAT test (selenium homocholic acid taurine): for bile acid malabsorption.',
'Small bowel imaging: MRI enterography / CT enterography (Crohn\'s, tumours).',
'Capsule endoscopy: mucosal lesions; avoid in suspected stricture.',
'Duodenal/jejunal biopsy (OGD): gold standard for coeliac disease (Marsh grading), Whipple\'s disease (PAS-positive macrophages).',
]),
('Management', [
'Treat the underlying cause.',
'Coeliac disease: strict lifelong gluten-free diet.',
'Pancreatic insufficiency: high-dose pancreatic enzyme replacement (PERT) — creon with every meal.',
'SIBO: antibiotics (rifaximin, metronidazole, ciprofloxacin); treat underlying cause.',
'Bile acid malabsorption: cholestyramine (bile acid sequestrant).',
'Lactase deficiency: lactose-free diet; lactase enzyme supplements.',
'Nutritional supplementation: iron, B12 (IM if ileal disease), folate, fat-soluble vitamins (oral high-dose or IM).',
'Calcium + vitamin D supplementation; bisphosphonates for established osteoporosis.',
'Elemental or polymeric enteral nutrition in refractory cases.',
]),
],
'mcq': {
'q': 'Which test is gold standard for diagnosing pancreatic exocrine insufficiency non-invasively?',
'opts': ['A. Serum amylase', 'B. Faecal elastase-1', 'C. Hydrogen breath test', 'D. D-xylose absorption test'],
'ans': 'B',
'exp': 'Faecal elastase-1 <200 mcg/g stool indicates pancreatic exocrine insufficiency and is the best non-invasive test. (Davidson\'s 23e, p.785)'
}
},
# ─── Q9 ────────────────────────────────────────────────────────────────────
{
'num': 9,
'title': 'Ulcerative Colitis: Aetiology, Clinical Features, Investigations & Management',
'ref': "Davidson's 23rd ed., p. 818–819 | Harrison's 21e, Ch. 322",
'sections': [
('Definition & Epidemiology', [
'UC is a chronic relapsing-remitting inflammatory disease confined to the colorectal mucosa. Affects 100–200/100,000 in western countries. Peak onset 20–40 years.',
]),
('Aetiology & Pathogenesis', [
'Genetic: NOD2/CARD15 mutations (Crohn\'s more than UC); HLA-DR2 association in UC.',
'Immune dysregulation: Th2-mediated response in UC vs Th1/Th17 in Crohn\'s.',
'Environmental: smoking protective in UC (paradoxically worsens Crohn\'s); appendicectomy protective.',
'Dysbiosis of gut microbiota.',
'Defective mucosal barrier.',
]),
('Clinical Features', [
'Bloody diarrhoea: cardinal symptom; blood and mucus mixed with stool.',
'Urgency and tenesmus (sensation of incomplete evacuation).',
'Abdominal cramping (typically in left iliac fossa).',
'Severity classification (Truelove & Witts):',
' - Mild: <4 stools/day, blood±, no systemic features, normal ESR.',
' - Moderate: 4–6 stools/day, blood+, minimal systemic features.',
' - Severe: >6 bloody stools/day + ≥1 of: pulse >90, temp >37.8°C, Hb <10.5, ESR >30.',
'Montreal Classification: E1 (proctitis), E2 (left-sided/distal), E3 (extensive/pancolitis).',
]),
('Investigations', [
'Bloods: FBC (anaemia, leukocytosis), ESR, CRP, albumin, LFTs.',
'Stool cultures and C. diff: to exclude infective colitis before starting immunosuppression.',
'Flexible sigmoidoscopy/colonoscopy with biopsy: diagnostic; avoid in severe disease (perforation risk).',
'Histology: crypt architectural distortion, crypt abscesses, goblet cell depletion, mucosal inflammation.',
'AXR (severe colitis): assess colonic dilatation; dilation >6 cm = toxic megacolon.',
'Serological markers: pANCA positive in ~70% UC; ASCA positive in ~50–70% Crohn\'s.',
]),
('Medical Management', [
'Mild-moderate distal disease: rectal 5-ASA (mesalazine suppositories/enemas) ± oral 5-ASA.',
'Mild-moderate extensive disease: oral 5-ASA (mesalazine 2.4–4.8 g/day).',
'Remission induction: oral prednisolone 40 mg/day tapering over 8 weeks.',
'Severe disease (inpatient): IV hydrocortisone 100 mg QDS; if no response in 72 hrs → IV ciclosporin or infliximab ("rescue therapy").',
'Maintenance: 5-ASA, azathioprine/6-MP, biological agents (infliximab, adalimumab, vedolizumab, ustekinumab).',
'Biologic therapy (anti-TNF): infliximab, adalimumab for moderate-severe UC failing conventional therapy.',
]),
('Surgical Management', [
'Indications: medically refractory disease, complications (toxic megacolon, perforation, haemorrhage), dysplasia/carcinoma.',
'Procedure: proctocolectomy with ileal pouch-anal anastomosis (IPAA — "restorative proctocolectomy").',
'UC is potentially curable by surgery (unlike Crohn\'s).',
]),
],
'mcq': {
'q': 'The serological marker most commonly associated with Ulcerative Colitis is:',
'opts': ['A. ASCA (anti-Saccharomyces cerevisiae antibodies)', 'B. ANA (anti-nuclear antibody)', 'C. pANCA (perinuclear anti-neutrophil cytoplasmic antibody)', 'D. Anti-dsDNA'],
'ans': 'C',
'exp': 'pANCA is positive in ~70% of UC patients. ASCA is associated with Crohn\'s disease. (Davidson\'s 23e, p.819; Harrison\'s 21e)'
}
},
# ─── Q10 ────────────────────────────────────────────────────────────────────
{
'num': 10,
'title': 'Coeliac Disease in Adults (including Causes of Chronic Diarrhoea)',
'ref': "Davidson's 23rd ed., p. 805–808 | Harrison's 21e, Ch. 335",
'sections': [
('Causes of Chronic Diarrhoea (brief)', [
'Osmotic: lactose intolerance, laxative abuse, malabsorption.',
'Secretory: VIPoma, carcinoid syndrome, bile acid malabsorption, cholera — persists despite fasting.',
'Inflammatory/exudative: IBD (Crohn\'s, UC), infective colitis, microscopic colitis, radiation enteritis.',
'Motility disorders: IBS (diarrhoea type), hyperthyroidism, diabetic autonomic neuropathy.',
'Malabsorptive: coeliac disease, chronic pancreatitis, short bowel syndrome.',
'Structural: colorectal carcinoma, fistula, post-surgical.',
]),
('Coeliac Disease — Definition', [
'Autoimmune enteropathy triggered by dietary gluten (gliadin fraction of wheat, barley, rye) in genetically susceptible individuals (HLA-DQ2 in 90%, HLA-DQ8 in 8%).',
'Prevalence: ~1% of western population; female:male = 2:1.',
]),
('Pathogenesis', [
'Gliadin crosses epithelial barrier → deamidated by tissue transglutaminase (TTG) → presented by HLA-DQ2/DQ8 → Th1 immune response → villous atrophy.',
]),
('Clinical Features', [
'GI: diarrhoea, steatorrhoea, abdominal pain, bloating, weight loss, failure to thrive.',
'Non-GI: fatigue, iron-deficiency anaemia (most common presentation in adults), folate/B12 deficiency, osteoporosis, infertility, peripheral neuropathy, ataxia, elevated transaminases.',
'Dermatitis herpetiformis: intensely pruritic vesicular rash on extensor surfaces; IgA deposits at dermal-epidermal junction — pathognomonic of coeliac.',
'Silent/latent coeliac disease: positive serology + normal villi.',
]),
('Investigations (Diagnosis)', [
'Serology (while on gluten-containing diet):',
' - Anti-TTG IgA: >95% sensitivity, 97% specificity — first-line test.',
' - Anti-EMA (endomysial antibody) IgA: highly specific.',
' - Total IgA level: must check (IgA deficiency → false negative TTG IgA → use TTG IgG).',
' - Anti-deamidated gliadin peptide (DGP) IgG: use if IgA deficient.',
'Duodenal biopsy (OGD): gold standard; ≥4 biopsies from D1/D2.',
'Marsh Classification: 0 (normal) → 1 (increased IELs) → 2 (crypt hyperplasia) → 3a–c (villous atrophy, partial → subtotal → total).',
'HLA-DQ2/DQ8 typing: high negative predictive value (if negative → coeliac excluded).',
]),
('Management', [
'Strict lifelong gluten-free diet (GFD): eliminates wheat, barley, rye. Oats: contamination issue — reintroduce carefully.',
'Nutritional supplementation: iron, folate, B12, vitamin D, calcium.',
'Bone densitometry (DEXA scan): at diagnosis.',
'Repeat serology and biopsy after 6–12 months on GFD to confirm response.',
'Refractory coeliac disease (RCD): not responding after 1 year of strict GFD → immunosuppression (budesonide, azathioprine).',
'Increased risk: T-cell lymphoma (enteropathy-associated T-cell lymphoma — EATL), oesophageal/oropharyngeal carcinoma, small bowel adenocarcinoma.',
]),
],
'mcq': {
'q': 'A 32-year-old woman has diarrhoea, iron-deficiency anaemia, and osteoporosis. Anti-TTG IgA is elevated. Duodenal biopsy shows total villous atrophy. The MOST appropriate management is:',
'opts': ['A. Oral prednisolone', 'B. Strict gluten-free diet', 'C. Antibiotics', 'D. Proton pump inhibitors'],
'ans': 'B',
'exp': 'Coeliac disease is managed with strict, lifelong gluten-free diet — the only effective treatment. (Davidson\'s 23e, p.806–808; Harrison\'s 21e)'
}
},
# ─── Q11 ────────────────────────────────────────────────────────────────────
{
'num': 11,
'title': 'Ulcerative Colitis vs Crohn\'s Disease',
'ref': "Davidson's 23rd ed., p. 814 | Harrison's 21e, Ch. 322",
'sections': [
('Comparison Table', [
'Feature | Crohn\'s Disease | Ulcerative Colitis',
'Location | Mouth to anus (entire GI tract) | Colon only (rectum upward)',
'Distribution | Skip lesions | Continuous (no skip)',
'Rectum | Often spared | Always involved (proctitis)',
'Inflammation | Transmural (full thickness) | Mucosal only',
'Granulomas | Yes (non-caseating, 50–60%) | No',
'Fistulae | Common | Rare/never',
'Strictures | Common | Rare',
'Perianal disease | Common (fissures, fistulae, abscesses) | Rare',
'Ulcers | Deep "rose-thorn" / cobblestone | Superficial/continuous',
'Bleeding | Less common | Cardinal feature (bloody diarrhoea)',
'Smoking | Worsens disease | Protective',
'pANCA | <20% | ~70%',
'ASCA | ~50–70% | <20%',
'Surgery curative? | No (recurs in new bowel) | Yes (proctocolectomy)',
'Cancer risk | Increased (small bowel EATL, colorectal) | Increased colorectal cancer risk',
]),
('Shared Extraintestinal Manifestations', [
'Peripheral arthropathy (large joints), erythema nodosum, oral aphthous ulcers, uveitis/episcleritis — parallel disease activity.',
'Ankylosing spondylitis, sacroiliitis, pyoderma gangrenosum, PSC — independent of disease activity.',
]),
],
'mcq': {
'q': 'Which of the following features is characteristic of Crohn\'s disease but NOT ulcerative colitis?',
'opts': ['A. Bloody diarrhoea', 'B. Rectal involvement', 'C. Transmural inflammation with granulomas', 'D. Positive pANCA'],
'ans': 'C',
'exp': 'Transmural full-thickness inflammation and non-caseating granulomas are hallmarks of Crohn\'s disease. UC is limited to the mucosa. (Davidson\'s 23e, p.814; Harrison\'s 21e)'
}
},
# ─── Q12 ────────────────────────────────────────────────────────────────────
{
'num': 12,
'title': 'Tropical Sprue',
'ref': "Davidson's 23rd ed., p. 807 | Harrison's 21e, Ch. 336",
'sections': [
('Definition', [
'Tropical sprue is an acquired malabsorptive disorder occurring in residents of or visitors to tropical countries, characterised by chronic diarrhoea, nutritional deficiencies, and small intestinal mucosal changes.',
]),
('Epidemiology', [
'Prevalent in: India, South-East Asia, Caribbean, parts of Africa and South America.',
'Affects both residents and visitors (travellers); onset may be during or after travel.',
]),
('Aetiology', [
'Poorly understood; believed to be caused by persistent small bowel infection by one or more enteric pathogens (Klebsiella, E. coli, Enterobacter).',
'Possibly triggered by initial acute gastroenteritis with subsequent bacterial colonisation of small bowel.',
'Overgrowth leads to mucosal damage and malabsorption.',
]),
('Pathology', [
'Mucosal changes throughout small bowel (contrast with coeliac which predominantly affects duodenum/proximal jejunum).',
'Partial villous atrophy with crypt hyperplasia.',
'Increased intraepithelial lymphocytes.',
'Changes improve with treatment.',
]),
('Clinical Features', [
'Chronic diarrhoea (often large-volume, fatty stools).',
'Anorexia, weight loss, fatigue.',
'Megaloblastic anaemia (B12 and folate deficiency — due to mucosal damage impairing ileal B12 absorption + folate absorption from jejunum).',
'Oedema (hypoalbuminaemia).',
'Glossitis, stomatitis (B-vitamin deficiencies).',
]),
('Investigations', [
'FBC: macrocytic anaemia; low serum B12 and folate.',
'Faecal fat: increased.',
'Small bowel biopsy: partial villous atrophy (must distinguish from coeliac: anti-TTG negative; HLA-DQ2/DQ8 negative).',
'D-xylose absorption test: impaired.',
'Stool cultures: usually negative for conventional pathogens.',
'Response to treatment is confirmatory.',
]),
('Management', [
'Tetracycline 250 mg QDS for 3–6 months (drug of choice).',
'Folic acid supplementation: 5 mg/day for 6 months (often leads to rapid improvement).',
'Vitamin B12 IM injections if deficient.',
'Nutritional support and correction of deficiencies.',
'Most patients respond well; relapse can occur if treatment incomplete.',
]),
],
'mcq': {
'q': 'What is the drug of choice for treating tropical sprue?',
'opts': ['A. Metronidazole', 'B. Ciprofloxacin', 'C. Tetracycline', 'D. Rifaximin'],
'ans': 'C',
'exp': 'Tetracycline for 3–6 months along with folic acid supplementation is the standard treatment for tropical sprue. (Davidson\'s 23e, p.807; Harrison\'s 21e)'
}
},
# ─── Q13 ────────────────────────────────────────────────────────────────────
{
'num': 13,
'title': 'Haematemesis (Upper GI Bleed): Clinical Features, Aetiology, Diagnosis & Management',
'ref': "Davidson's 23rd ed., p. 782 | Harrison's 21e, Ch. 48",
'sections': [
('Definition', [
'Haematemesis is vomiting of blood (fresh or altered — "coffee-ground" — representing haematin from acid digestion of blood). Indicates upper GI source (above ligament of Treitz).',
]),
('Clinical Features', [
'Bright red blood vomitus: active brisk bleeding from oesophagus, stomach, or duodenum.',
'Coffee-ground vomitus: slower bleeding; blood has time to be acted on by gastric acid.',
'Associated malaena: black, tarry, offensive stools (blood in colon >200 mL).',
'Symptoms of haemodynamic compromise: pallor, dizziness, syncope, tachycardia, hypotension.',
'Stigmata of chronic liver disease: portal hypertension → varices (spider naevi, jaundice, ascites, splenomegaly, caput medusae).',
'Epigastric tenderness → peptic ulcer; painless bleeding → varices or GAVE.',
]),
('Aetiology', [
'Peptic ulcer disease: most common (~50%).',
'Oesophageal/gastric varices: ~15–20%; high mortality.',
'Mallory-Weiss tear: GOJ mucosal tear after retching.',
'Reflux oesophagitis.',
'Dieulafoy lesion, GAVE, vascular malformations.',
'Gastric carcinoma, GIST.',
'Haemobilia (blood in bile duct — post-procedure/trauma).',
]),
('Risk Stratification', [
'Glasgow-Blatchford Score (GBS): 0 = low risk → outpatient; ≥1 = hospital admission.',
'Components: blood urea, Hb, SBP, pulse, malaena, syncope, hepatic/cardiac disease.',
'Rockall Score (post-endoscopy): age, shock, comorbidities, diagnosis, endoscopic stigmata of bleeding.',
]),
('Management', [
'ABC resuscitation: O2, 2 large-bore IV lines, IV fluid/blood.',
'IV PPI: omeprazole 80 mg bolus then 8 mg/hr infusion.',
'Urgent OGD: within 24 hrs (12 hrs if haemodynamically unstable).',
'Endoscopic therapy: injection ± clipping ± thermal therapy for peptic ulcer.',
'Variceal bleed: terlipressin + prophylactic ceftriaxone + urgent EBL.',
'Failure of endoscopic haemostasis: interventional radiology (trans-arterial embolisation) or surgery.',
]),
],
'mcq': {
'q': 'A Glasgow-Blatchford score of 0 in a patient with haematemesis indicates:',
'opts': ['A. Emergency surgery needed', 'B. Immediate ICU admission', 'C. Safe for outpatient management', 'D. Variceal bleed likely'],
'ans': 'C',
'exp': 'GBS of 0 identifies very low-risk patients who can be safely managed as outpatients without urgent endoscopy. (Davidson\'s 23e, p.782; Harrison\'s 21e)'
}
},
# ─── Q14 ────────────────────────────────────────────────────────────────────
{
'num': 14,
'title': 'Extraintestinal Manifestations of Ulcerative Colitis',
'ref': "Davidson's 23rd ed., p. 818 | Harrison's 21e, Ch. 322",
'sections': [
('Overview', [
'Extraintestinal manifestations (EIMs) occur in 25–40% of patients with UC and can involve almost any organ system. Some parallel disease activity; others follow an independent course.',
]),
('Related to Disease Activity (improve with treatment of colitis)', [
'Peripheral arthropathy: Type 1 (pauciarticular — <5 large joints, e.g. knees, ankles) — parallels bowel disease; Type 2 (polyarticular — ≥5 small joints) — independent course.',
'Oral manifestations: aphthous ulcers (most common), cobblestone mucosa.',
'Ocular: episcleritis (benign, correlates with activity); anterior uveitis requires urgent treatment.',
'Skin: erythema nodosum (painful raised red nodules on shins); pyoderma gangrenosum (deep necrotic ulcer, independent of activity).',
]),
('Independent of Disease Activity', [
'Axial arthropathy: sacroiliitis, ankylosing spondylitis (progressive, not controlled by colectomy; HLA-B27 associated).',
'Primary sclerosing cholangitis (PSC): most severe EIM; biliary fibrosis; risk of cholangiocarcinoma; does NOT improve after colectomy.',
'Anterior uveitis (iritis): severe, requires ophthalmological treatment.',
'Pyoderma gangrenosum.',
]),
('Other Manifestations', [
'Thromboembolic complications: DVT, PE — due to hypercoagulable state (active IBD).',
'Renal: oxalate stones (increased oxalate absorption due to fat malabsorption).',
'Hepatic: fatty liver, autoimmune hepatitis, pericholangitis.',
'Amyloidosis (rare, with chronic active disease).',
'Bronchopulmonary disease (rare): bronchiectasis, organising pneumonia.',
]),
],
'mcq': {
'q': 'Which extraintestinal complication of UC does NOT improve after colectomy?',
'opts': ['A. Erythema nodosum', 'B. Type 1 arthropathy', 'C. Episcleritis', 'D. Primary sclerosing cholangitis'],
'ans': 'D',
'exp': 'PSC follows an independent course and does not improve after colectomy. Ankylosing spondylitis similarly is independent of bowel disease activity. (Davidson\'s 23e, p.818)'
}
},
# ─── Q15 ────────────────────────────────────────────────────────────────────
{
'num': 15,
'title': 'Chronic Pancreatitis',
'ref': "Davidson's 23rd ed., p. 839 | Harrison's 21e, Ch. 347",
'sections': [
('Definition', [
'Chronic pancreatitis is a progressive fibro-inflammatory disease of the pancreas characterised by irreversible morphological changes causing pain and permanent loss of exocrine and endocrine function.',
]),
('Causes — "TIGAR-O" Classification', [
'T — Toxic/metabolic: alcohol (most common, 70–80%), smoking, hypercalcaemia, hyperlipidaemia, drugs.',
'I — Idiopathic: tropical pancreatitis (young patients in developing countries with large ductal calculi).',
'G — Genetic: PRSS1 mutation (hereditary pancreatitis), CFTR mutation (cystic fibrosis), SPINK1 mutation.',
'A — Autoimmune: autoimmune pancreatitis type 1 (IgG4-related) and type 2.',
'R — Recurrent acute/obstructive: repeated acute pancreatitis, pancreatic duct obstruction.',
'O — Obstructive: pancreatic divisum, intraductal papillary mucinous neoplasm (IPMN), stricture.',
]),
('Clinical Features', [
'Chronic abdominal pain: dull, epigastric, often radiating to back; exacerbated by eating and alcohol; may reduce as gland "burns out".',
'Weight loss: due to avoidance of food (pain) and malabsorption.',
'Steatorrhoea: pale, fatty stools; occurs when >90% exocrine function lost.',
'Diabetes mellitus (type 3c): pancreatogenic diabetes; loss of both insulin and glucagon secretion → brittle diabetes, hypoglycaemic episodes.',
'Jaundice: biliary stricture from chronic inflammation.',
'Pseudocyst formation, pancreatic ascites.',
]),
('Investigations', [
'Imaging: CT abdomen — pancreatic calcification (pathognomonic), ductal dilatation, atrophy; MRCP for ductal anatomy; EUS — most sensitive.',
'Faecal elastase-1: <100 mcg/g = severe exocrine insufficiency.',
'HbA1c / fasting glucose: for endocrine insufficiency.',
'Serum IgG4: elevated in autoimmune pancreatitis type 1.',
'AXR/plain film: "chain of lakes" calcification in chronic pancreatitis.',
'ERCP: for therapeutic intervention (stenting strictures, stone removal) — not diagnostic first-line.',
]),
('Management', [
'Alcohol and smoking cessation: most important.',
'Analgesia: WHO analgesic ladder; pregabalin/gabapentin for neuropathic component; coeliac plexus block.',
'Pancreatic enzyme replacement therapy (PERT): high-dose creon (25,000–40,000 lipase units) with each meal — treats steatorrhoea and improves nutrition.',
'Fat-soluble vitamin supplementation (A, D, E, K).',
'Diabetes management: insulin (usually required; metformin less effective in type 3c).',
'Endoscopic therapy: ERCP + sphincterotomy, stone extraction, ductal stenting.',
'Surgical options: Frey procedure, Beger procedure, lateral pancreaticojejunostomy (Puestow) — for main duct dilatation ≥5 mm; distal pancreatectomy; total pancreatectomy + auto-islet transplantation.',
'Autoimmune pancreatitis: oral prednisolone 0.6 mg/kg/day for 4–8 weeks — dramatic response.',
]),
],
'mcq': {
'q': 'Pancreatic calcification on plain abdominal X-ray is pathognomonic of:',
'opts': ['A. Acute pancreatitis', 'B. Pancreatic carcinoma', 'C. Chronic pancreatitis', 'D. Autoimmune pancreatitis'],
'ans': 'C',
'exp': 'Pancreatic calcification visible on AXR or CT is pathognomonic of chronic pancreatitis, reflecting dystrophic calcification in areas of fibrous destruction. (Davidson\'s 23e, p.839; Harrison\'s 21e)'
}
},
# ─── Q16 ────────────────────────────────────────────────────────────────────
{
'num': 16,
'title': 'Zollinger-Ellison Syndrome',
'ref': "Davidson's 23rd ed., p. 802 | Harrison's 21e, Ch. 345",
'sections': [
('Definition', [
'Zollinger-Ellison syndrome (ZES) is caused by a gastrin-secreting tumour (gastrinoma) arising from G cells, usually in the pancreas or duodenum, leading to massive acid hypersecretion, severe peptic ulceration, and diarrhoea.',
]),
('Epidemiology', [
'Rare: 1–3 per million per year.',
'Sporadic in 75%; associated with MEN-1 (Multiple Endocrine Neoplasia type 1) in 25%.',
'MEN-1 association: hyperparathyroidism + pituitary adenoma + pancreatic islet cell tumours.',
]),
('Pathophysiology', [
'Gastrinoma → excess gastrin → parietal cell hypertrophy/hyperplasia → massive HCl secretion.',
'Excess acid → peptic ulcers in atypical locations (post-bulbar, jejunum), inactivates pancreatic enzymes → steatorrhoea.',
'Malignant potential: ~60–90% of gastrinomas are malignant with metastases to liver/lymph nodes.',
]),
('Clinical Features', [
'Severe, multiple, recurrent or refractory peptic ulcers (often post-bulbar — beyond the duodenal bulb).',
'Diarrhoea (steatorrhoea): from excess acid inactivating lipase + direct mucosal injury.',
'Oesophagitis (severe GERD due to acid hypersecretion).',
'Weight loss.',
'Symptoms of MEN-1: hypercalcaemia (hyperPTH), renal stones, hypoglycaemia (insulinoma), pituitary effects.',
]),
('Investigations', [
'Fasting serum gastrin: >1000 pg/mL (or >10× ULN) is highly suggestive. Also check gastric pH (must be <2 simultaneously — confirms acid is being secreted).',
'Secretin stimulation test: IV secretin → paradoxical rise in serum gastrin ≥200 pg/mL from baseline = positive for ZES (secretin normally suppresses gastrin secretion in health).',
'Gastric acid output: basal acid output (BAO) >15 mEq/hr (>5 in post-surgical patients).',
'Imaging (tumour localisation): CT/MRI abdomen; somatostatin receptor scintigraphy (OctreoScan) — most sensitive (>80%); EUS for small tumours; PET-CT with Ga-DOTATATE.',
'Screen for MEN-1: serum calcium, PTH, prolactin, pituitary MRI.',
]),
('Management', [
'High-dose PPI therapy: omeprazole 60–120 mg/day or IV infusion; effectively controls acid secretion.',
'Surgical resection: curative in 30–40% with localised tumours; improves survival even with metastases.',
'Metastatic disease: somatostatin analogues (octreotide/lanreotide) — control symptoms and may inhibit tumour growth.',
'Chemotherapy: streptozocin + 5-FU or temozolomide for progressive metastatic disease.',
'Peptide receptor radionuclide therapy (PRRT): lutetium-177-DOTATATE for somatostatin receptor-positive tumours.',
'MEN-1: treat hyperparathyroidism first (parathyroidectomy) as hypercalcaemia worsens gastrin secretion.',
]),
],
'mcq': {
'q': 'In the secretin stimulation test for Zollinger-Ellison syndrome, a positive result is:',
'opts': ['A. Paradoxical decrease in serum gastrin', 'B. Paradoxical rise in gastrin ≥200 pg/mL above baseline', 'C. Decrease in gastric acid output', 'D. Rise in serum cholecystokinin'],
'ans': 'B',
'exp': 'In ZES, IV secretin paradoxically increases gastrin by ≥200 pg/mL — confirming gastrinoma. (Normally, secretin inhibits gastrin release.) (Davidson\'s 23e, p.802; Harrison\'s 21e)'
}
},
# ─── Q17 ────────────────────────────────────────────────────────────────────
{
'num': 17,
'title': 'Role of H. pylori in Gastroduodenal Diseases',
'ref': "Davidson's 23rd ed., p. 791 | Harrison's 21e, Ch. 324",
'sections': [
('Microbiology', [
'Helicobacter pylori: gram-negative, microaerophilic, spiral-shaped bacterium.',
'Colonises gastric mucosa; produces urease (hydrolyses urea → NH3 → neutralises acid around bacterium).',
'Virulence factors: urease, vacuolating cytotoxin (VacA), cytotoxin-associated gene A (CagA — most important virulence factor), outer inflammatory protein (OipA).',
'Prevalence: >50% of world population; higher in developing countries (80–90%) vs developed (~30–40%).',
'Transmission: faeco-oral or oral-oral route.',
]),
('Diseases Caused / Associated', [
'1. Peptic ulcer disease: H. pylori present in 90% of DU and 75% of GU. Eradication leads to >90% cure of H. pylori-positive PUD.',
'2. Chronic atrophic gastritis (Type B gastritis): antral gastritis → pangastritis → atrophy → intestinal metaplasia → dysplasia → gastric adenocarcinoma.',
'3. Gastric adenocarcinoma: H. pylori is a WHO Group 1 carcinogen; 75–80% of gastric cancers attributable to H. pylori.',
'4. MALT lymphoma (Mucosa-Associated Lymphoid Tissue): low-grade B-cell lymphoma; H. pylori eradication alone achieves remission in ~80% of localised gastric MALT lymphoma.',
'5. Non-ulcer dyspepsia (functional dyspepsia): H. pylori eradication leads to modest symptom improvement (~10% reduction in symptoms).',
'6. GERD: complex relationship; H. pylori may be protective against severe GERD and Barrett\'s oesophagus (through reduced acid via pangastritis).',
]),
('Diagnosis', [
'Invasive (OGD required): rapid urease test (CLO test) — most rapid and widely used; histology; culture and sensitivity; PCR.',
'Non-invasive: 13C urea breath test (gold standard non-invasive — high sensitivity/specificity); stool antigen test (HpSAg); serology (IgG — cannot confirm active infection; does not indicate successful eradication).',
'Stop PPIs ≥2 weeks before UBT or stool antigen (may give false negative).',
]),
('Treatment', [
'Standard triple therapy (7–14 days): PPI BD + clarithromycin 500 mg BD + amoxicillin 1 g BD. Eradication rate ~80–85%.',
'Bismuth quadruple therapy (10–14 days): PPI + bismuth subcitrate + tetracycline + metronidazole. Preferred where clarithromycin resistance >15%.',
'Levofloxacin-based triple therapy: for clarithromycin-resistant strains.',
'Confirm eradication: 13C urea breath test or stool antigen — at least 4 weeks after completing therapy and 2 weeks off PPI.',
]),
],
'mcq': {
'q': 'H. pylori eradication therapy can achieve remission in which gastric malignancy?',
'opts': ['A. Gastric adenocarcinoma', 'B. Gastric MALT lymphoma (low-grade)', 'C. Gastric GIST', 'D. Diffuse large B-cell lymphoma'],
'ans': 'B',
'exp': 'H. pylori eradication alone achieves remission in ~80% of localised low-grade gastric MALT lymphoma. (Davidson\'s 23e, p.791; Harrison\'s 21e)'
}
},
# ─── Q18 ────────────────────────────────────────────────────────────────────
{
'num': 18,
'title': 'Inflammatory Bowel Disease (IBD): Types, Clinical Features & Management',
'ref': "Davidson's 23rd ed., p. 798 | Harrison's 21e, Ch. 322",
'sections': [
('Overview', [
'IBD comprises two main conditions: Crohn\'s disease (CD) and ulcerative colitis (UC) — chronic relapsing inflammatory disorders of the GI tract with shared and distinct features.',
]),
('Types of IBD', [
'1. Ulcerative Colitis (UC): inflammation limited to colonic mucosa; starts at rectum, extends proximally in continuity.',
'2. Crohn\'s Disease (CD): transmural inflammation; can affect any segment from mouth to anus; skip lesions; granulomatous.',
'3. IBD-Unclassified (IBDU) / Indeterminate Colitis: ~10% of patients cannot be categorised as UC or CD.',
'4. Microscopic Colitis: collagenous and lymphocytic colitis; normal colonoscopy but histological changes; presents with watery non-bloody diarrhoea.',
]),
('Clinical Features — UC', [
'Bloody diarrhoea (cardinal), urgency, tenesmus, lower abdominal cramps.',
'Systemic: weight loss, fever, anaemia in severe disease.',
'Truelove & Witts severity criteria.',
]),
('Clinical Features — Crohn\'s Disease', [
'Diarrhoea (may or may not be bloody), abdominal pain (RIF — ileocaecal disease), weight loss, fever.',
'Perianal disease: fissures, fistulae, abscesses, skin tags.',
'Malabsorption, B12 deficiency (terminal ileum disease).',
'Complications: strictures (obstruction), fistulae (enteroenteric, enterovesical, rectovaginal), abscesses.',
]),
('Medical Management — Principles', [
'Induction of remission: corticosteroids (oral prednisolone, IV hydrocortisone in severe disease, budesonide for CD involving ileocaecum).',
'5-ASA (mesalazine): maintenance in UC; limited role in CD.',
'Immunomodulators: azathioprine, 6-mercaptopurine (thiopurines) for maintenance; methotrexate (for CD).',
'Biological agents (moderate-severe IBD): anti-TNF (infliximab, adalimumab, certolizumab — CD; infliximab, adalimumab, golimumab — UC); anti-integrin (vedolizumab — gut-selective); anti-IL12/23 (ustekinumab); anti-IL23 (risankizumab, mirikizumab).',
'JAK inhibitors: tofacitinib, upadacitinib (for UC).',
]),
('Surgical Management', [
'UC: total proctocolectomy ± ileal pouch-anal anastomosis (IPAA) — curative.',
'Crohn\'s: aim to conserve bowel; resection for complications (stricture, fistula, abscess), stricturoplasty for short strictures.',
'Crohn\'s is NOT curable by surgery; post-operative recurrence common (neoterminal ileum).',
]),
('Monitoring & Surveillance', [
'Colonoscopic surveillance for colorectal cancer: after 8–10 years of extensive colitis; every 1–2 years.',
'Regular monitoring: FBC, CRP, albumin, faecal calprotectin, LFTs (thiopurine hepatotoxicity), TPMT (enzyme assay before azathioprine).',
'Vaccinations: pneumococcal, influenza, hepatitis B (before immunosuppression).',
'Bone health: DEXA scan in patients on long-term steroids.',
]),
],
'mcq': {
'q': 'Which biological agent is GUT-SELECTIVE and acts by inhibiting lymphocyte trafficking to the intestine?',
'opts': ['A. Infliximab', 'B. Adalimumab', 'C. Vedolizumab', 'D. Ustekinumab'],
'ans': 'C',
'exp': 'Vedolizumab (anti-α4β7 integrin) selectively blocks lymphocyte homing to the gut. This gut-selective action avoids systemic immunosuppression. (Davidson\'s 23e; Harrison\'s 21e)'
}
},
] # end of questions list
# ═══════════════════════════════════════════════════════════════════════════
# PDF BUILDER
# ═══════════════════════════════════════════════════════════════════════════
def build_pdf(output_path):
doc = SimpleDocTemplate(
output_path,
pagesize=A4,
rightMargin=2*cm, leftMargin=2*cm,
topMargin=3.2*cm, bottomMargin=2.5*cm
)
story = []
# ── COVER PAGE ──────────────────────────────────────────────────────────
from reportlab.platypus import Spacer
# Cover background table
cover_data = [[
Paragraph("GASTROENTEROLOGY", S['cover_title']),
]]
cover_tbl = Table(cover_data, colWidths=[17*cm])
cover_tbl.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,-1), DARK_TEAL),
('TOPPADDING', (0,0), (-1,-1), 24),
('BOTTOMPADDING', (0,0), (-1,-1), 12),
('LEFTPADDING', (0,0), (-1,-1), 10),
('RIGHTPADDING', (0,0), (-1,-1), 10),
]))
story.append(Spacer(1, 1.5*cm))
story.append(cover_tbl)
story.append(Spacer(1, 0.3*cm))
sub_data = [[
Paragraph("QUESTION BANK WITH DETAILED ANSWERS & MCQ HIGHLIGHTS", S['cover_sub']),
]]
sub_tbl = Table(sub_data, colWidths=[17*cm])
sub_tbl.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,-1), SUBHDR_BG),
('TOPPADDING', (0,0), (-1,-1), 10),
('BOTTOMPADDING', (0,0), (-1,-1), 10),
]))
story.append(sub_tbl)
story.append(Spacer(1, 1.5*cm))
info_lines = [
("Source", "Harrison's Principles of Internal Medicine, 21st Edition"),
("Source", "Davidson's Principles & Practice of Medicine, 23rd Edition"),
("Total Questions", "18"),
("Subject", "Gastroenterology"),
("Features", "Detailed Answers + MCQ Highlights (Yellow = Question, Green = Answer)"),
]
for label, val in info_lines:
row = [[
Paragraph(f"<b>{label}:</b>", S['body']),
Paragraph(val, S['body'])
]]
t = Table(row, colWidths=[4*cm, 13*cm])
t.setStyle(TableStyle([
('BACKGROUND', (0,0), (0,0), LIGHT_TEAL),
('GRID', (0,0), (-1,-1), 0.5, BORDER_GRAY),
('TOPPADDING', (0,0), (-1,-1), 5),
('BOTTOMPADDING', (0,0), (-1,-1), 5),
]))
story.append(t)
story.append(Spacer(1, 2*mm))
story.append(PageBreak())
# ── TABLE OF CONTENTS ───────────────────────────────────────────────────
toc_hdr = Table([[Paragraph("TABLE OF CONTENTS", S['toc_head'])]], colWidths=[17*cm])
toc_hdr.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,-1), DARK_TEAL),
('TOPPADDING', (0,0), (-1,-1), 10),
('BOTTOMPADDING', (0,0), (-1,-1), 10),
]))
story.append(toc_hdr)
story.append(Spacer(1, 0.4*cm))
for q in questions:
story.append(Paragraph(f"Q{q['num']}. {q['title']}", S['toc_entry']))
story.append(PageBreak())
# ── QUESTION ANSWERS ────────────────────────────────────────────────────
for q in questions:
story.append(Spacer(1, 3*mm))
story.append(q_block(q['num'], q['title'], S))
story.append(Paragraph(f"Reference: {q['ref']}", S['ref']))
for sec_title, items in q['sections']:
story.append(sh(sec_title, S))
# Special handling: lines containing "|" are comparison rows
if any('|' in item for item in items):
# Build a table
table_rows = []
for item in items:
if '|' in item:
cells = [c.strip() for c in item.split('|')]
row = [Paragraph(c, S['body']) for c in cells]
table_rows.append(row)
else:
story.append(Paragraph(f"• {item}", S['bullet']))
if table_rows:
# Check if first row looks like a header
col_count = max(len(r) for r in table_rows)
col_w = [17*cm / col_count] * col_count
tbl = Table(table_rows, colWidths=col_w, repeatRows=1)
style = [
('GRID', (0,0), (-1,-1), 0.5, BORDER_GRAY),
('TOPPADDING', (0,0), (-1,-1), 4),
('BOTTOMPADDING', (0,0), (-1,-1), 4),
('LEFTPADDING', (0,0), (-1,-1), 4),
('RIGHTPADDING', (0,0), (-1,-1), 4),
('ROWBACKGROUNDS', (0,0), (-1,-1), [WHITE, LIGHT_TEAL]),
('BACKGROUND', (0,0), (-1,0), MED_TEAL),
('TEXTCOLOR', (0,0), (-1,0), WHITE),
('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
('VALIGN', (0,0), (-1,-1), 'TOP'),
]
tbl.setStyle(TableStyle(style))
story.append(tbl)
story.append(Spacer(1, 2*mm))
else:
for item in items:
story.append(Paragraph(f"• {item}", S['bullet']))
story.append(Spacer(1, 1*mm))
# MCQ block
mcq = q['mcq']
for el in mcq_block(mcq['q'], mcq['opts'], mcq['ans'], mcq['exp'], S):
story.append(el)
story.append(HRFlowable(width='100%', thickness=1, color=BORDER_GRAY, spaceAfter=6))
story.append(PageBreak())
doc.build(story, onFirstPage=header_footer, onLaterPages=header_footer)
print(f"PDF saved: {output_path}")
if __name__ == '__main__':
out = '/tmp/workspace/gastro-mcq/Gastroenterology_Question_Bank.pdf'
build_pdf(out)
cd /tmp/workspace/gastro-mcq && python generate_pdf.py 2>&1
ls -lh /tmp/workspace/gastro-mcq/
Gastroenterology Question Bank
PDF Document · PDF
| Q# | Topic |
|---|---|
| Q1 | Complications of Ulcerative Colitis |
| Q2 | Upper GI Bleed: Causes + Variceal Bleeding Management |
| Q3 | Irritable Bowel Syndrome (IBS) |
| Q4 | Peptic Ulcer Disease: Pathogenesis, Complications, Management |
| Q5 | Acute Pancreatitis: GET SMASHED + Severity Scoring |
| Q6 | Gastro-oesophageal Reflux Disease (GERD) |
| Q7 | Causes of Malabsorption (Luminal / Mucosal / Post-mucosal) |
| Q8 | Diagnosis, Investigations & Management of Malabsorption |
| Q9 | Ulcerative Colitis: Full Clinical Coverage |
| Q10 | Coeliac Disease in Adults + Chronic Diarrhoea Causes |
| Q11 | UC vs Crohn's Disease (Comparison Table) |
| Q12 | Tropical Sprue |
| Q13 | Haematemesis: Clinical Features, Risk Scores, Management |
| Q14 | Extraintestinal Manifestations of UC |
| Q15 | Chronic Pancreatitis (TIGAR-O classification) |
| Q16 | Zollinger-Ellison Syndrome |
| Q17 | Role of H. pylori in Gastroduodenal Diseases |
| Q18 | Inflammatory Bowel Disease: Types, Features, Management |