Sle explain as 10 mark question
"systemic lupus erythematosus"[MeSH Terms] AND "pathogenesis"
| System | Feature | Frequency |
|---|---|---|
| Cutaneous | Malar (butterfly) rash, discoid lupus, photosensitivity, oral ulcers, alopecia | 88% |
| Musculoskeletal | Arthritis/arthralgias (non-erosive, migratory) | 76% |
| Neuropsychiatric | Cognitive dysfunction, seizures, psychosis, headache | 66% |
| Serositis | Pleuritis, pericarditis | 63% |
| Hematologic | Hemolytic anemia, leukopenia, thrombocytopenia | 57% |
| Vascular | Raynaud phenomenon, vasculitis | 44-43% |
| Renal | Lupus nephritis (proteinuria, hematuria, casts) | 31% |
| Cardiac | Libman-Sacks endocarditis (non-infective), premature atherosclerosis | 18% |

| Domain | Key Criterion | Points |
|---|---|---|
| Mucocutaneous | Acute cutaneous lupus | 6 |
| Musculoskeletal | Joint involvement | 6 |
| Immunologic | Anti-dsDNA antibody | 6 |
| Renal | Proteinuria >0.5g/24h | 4 |
| Complement | Low C3 AND C4 | 4 |
| Neuropsychiatric | Seizure | 5 |
| Constitutional | Fever | 2 |
Create pdf of this
ls -la /home/daytona/workspace/
mkdir -p /home/daytona/workspace/sle-pdf
~/sle-pdf/generate_sle_pdf.py
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, KeepTogether, Image
)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.platypus import PageBreak
import urllib.request
import os
OUTPUT = "/home/daytona/workspace/sle-pdf/SLE_10_Mark_Answer.pdf"
IMG_PATH = "/home/daytona/workspace/sle-pdf/malar_rash.png"
# Download malar rash image
IMG_URL = "https://cdn.orris.care/cdss_images/63e92f9b6cff976dbbdaa9b25ddb2ebd08650a7d6531f61b52945c31876bdae4.png"
try:
urllib.request.urlretrieve(IMG_URL, IMG_PATH)
except Exception as e:
print(f"Image download failed: {e}")
IMG_PATH = None
# Colors
DARK_BLUE = colors.HexColor("#1a3a5c")
MED_BLUE = colors.HexColor("#2563a8")
LIGHT_BLUE = colors.HexColor("#dbeafe")
ACCENT = colors.HexColor("#e63946")
LIGHT_GRAY = colors.HexColor("#f8fafc")
MID_GRAY = colors.HexColor("#64748b")
TABLE_HEAD = colors.HexColor("#1a3a5c")
TABLE_ALT = colors.HexColor("#f0f4ff")
doc = SimpleDocTemplate(
OUTPUT,
pagesize=A4,
rightMargin=2*cm, leftMargin=2*cm,
topMargin=2.2*cm, bottomMargin=2*cm,
title="Systemic Lupus Erythematosus - 10 Mark Answer",
author="Orris Medical AI"
)
styles = getSampleStyleSheet()
# Custom styles
title_style = ParagraphStyle(
"TitleStyle",
parent=styles["Title"],
fontSize=20,
textColor=DARK_BLUE,
spaceAfter=4,
spaceBefore=0,
alignment=TA_CENTER,
fontName="Helvetica-Bold",
leading=26,
)
subtitle_style = ParagraphStyle(
"SubtitleStyle",
fontSize=10,
textColor=MID_GRAY,
alignment=TA_CENTER,
spaceAfter=12,
fontName="Helvetica",
)
h1_style = ParagraphStyle(
"H1Style",
fontSize=12,
textColor=colors.white,
fontName="Helvetica-Bold",
spaceBefore=14,
spaceAfter=4,
leading=16,
leftIndent=6,
)
h2_style = ParagraphStyle(
"H2Style",
fontSize=10.5,
textColor=MED_BLUE,
fontName="Helvetica-Bold",
spaceBefore=10,
spaceAfter=3,
leading=14,
)
body_style = ParagraphStyle(
"BodyStyle",
fontSize=9.5,
textColor=colors.HexColor("#1e293b"),
fontName="Helvetica",
spaceBefore=2,
spaceAfter=4,
leading=14,
alignment=TA_JUSTIFY,
)
bullet_style = ParagraphStyle(
"BulletStyle",
fontSize=9.5,
textColor=colors.HexColor("#1e293b"),
fontName="Helvetica",
spaceBefore=1,
spaceAfter=1,
leading=13,
leftIndent=16,
bulletIndent=4,
)
caption_style = ParagraphStyle(
"CaptionStyle",
fontSize=8,
textColor=MID_GRAY,
fontName="Helvetica-Oblique",
alignment=TA_CENTER,
spaceAfter=6,
)
source_style = ParagraphStyle(
"SourceStyle",
fontSize=7.5,
textColor=MID_GRAY,
fontName="Helvetica-Oblique",
spaceBefore=2,
spaceAfter=2,
alignment=TA_CENTER,
)
def section_header(text):
"""Return a list: colored background paragraph acting as section header."""
data = [[Paragraph(text, h1_style)]]
t = Table(data, colWidths=[17*cm])
t.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), DARK_BLUE),
("TOPPADDING", (0,0), (-1,-1), 5),
("BOTTOMPADDING", (0,0), (-1,-1), 5),
("LEFTPADDING", (0,0), (-1,-1), 8),
("ROUNDEDCORNERS", [4]),
]))
return t
def bullet(text):
return Paragraph(f"<bullet>•</bullet> {text}", bullet_style)
story = []
# ── TITLE BLOCK ──────────────────────────────────────────────────────────────
story.append(Spacer(1, 4*mm))
story.append(Paragraph("Systemic Lupus Erythematosus (SLE)", title_style))
story.append(Paragraph("10-Mark Examination Answer | Medical Sciences", subtitle_style))
story.append(HRFlowable(width="100%", thickness=2, color=ACCENT, spaceAfter=10))
# ── 1. DEFINITION ─────────────────────────────────────────────────────────────
story.append(section_header("1. Definition"))
story.append(Spacer(1, 3*mm))
story.append(Paragraph(
"Systemic Lupus Erythematosus (SLE) is a <b>chronic, multisystem autoimmune disease</b> "
"characterised by the production of pathogenic autoantibodies (especially anti-double-stranded DNA "
"and anti-Sm), immune complex deposition, complement activation, and widespread tissue inflammation. "
"It predominantly affects women of childbearing age (F:M ratio ~9:1), with higher prevalence in "
"African American, Asian, and Hispanic populations.",
body_style
))
# ── 2. ETIOLOGY ───────────────────────────────────────────────────────────────
story.append(section_header("2. Etiology and Predisposing Factors"))
story.append(Spacer(1, 3*mm))
for b in [
"<b>Genetic:</b> HLA and non-HLA gene associations including IRF5, STAT4, PTPN22, BLK, FCGR2A; "
"deficiency of early complement proteins (C1q, C4) strongly predisposes to SLE.",
"<b>Hormonal:</b> Oestrogens promote autoimmunity; disease worsens during pregnancy and with oral "
"contraceptive use.",
"<b>Environmental triggers:</b> UV light (photosensitivity), drugs (hydralazine, procainamide, "
"isoniazid causing drug-induced lupus), EBV infection, and smoking.",
]:
story.append(bullet(b))
story.append(Spacer(1, 2*mm))
# ── 3. PATHOGENESIS ───────────────────────────────────────────────────────────
story.append(section_header("3. Pathogenesis"))
story.append(Spacer(1, 3*mm))
story.append(Paragraph(
"SLE is the prototype <b>Type III hypersensitivity (immune complex-mediated) disease</b>. "
"Key steps in pathogenesis:",
body_style
))
steps = [
("<b>Loss of self-tolerance:</b>",
"Failure to eliminate or suppress autoreactive B and T lymphocytes specific for nuclear antigens "
"(DNA, histones, Ro, Sm, RNP)."),
("<b>Autoantibody formation:</b>",
"B cells produce ANA, anti-dsDNA, anti-Sm antibodies. The earliest antibodies target "
"RNA-binding proteins (Ro), followed by anti-dsDNA, then anti-Sm/RNP at clinical diagnosis."),
("<b>Immune complex deposition:</b>",
"Antigen-antibody complexes deposit in kidneys (glomeruli), skin, joints, and vessels. "
"Complement activation (C3a, C5a) recruits neutrophils and macrophages causing fibrinoid necrosis."),
("<b>Type I Interferon (IFN) signature:</b>",
"Plasmacytoid dendritic cells and low-density granulocytes (LDGs) produce excess IFN-alpha, "
"amplifying B-cell activation, dendritic cell maturation, and breaking peripheral tolerance."),
("<b>NETosis (Neutrophil Extracellular Traps):</b>",
"LDGs form NETs excessively; NETs contain oxidised nucleic acids and modified self-proteins that "
"stimulate type I IFN via the cGAS/STING pathway and activate the NLRP3 inflammasome, releasing "
"IL-1 and IL-18 that perpetuate tissue damage and promote lupus nephritis."),
]
for num, (heading, body) in enumerate(steps, 1):
story.append(bullet(f"<b>Step {num} - </b>{heading} {body}"))
story.append(Spacer(1, 2*mm))
# ── 4. CLINICAL FEATURES ──────────────────────────────────────────────────────
story.append(section_header("4. Clinical Features"))
story.append(Spacer(1, 3*mm))
story.append(Paragraph(
"SLE is a relapsing-remitting, multisystem disease. Clinical manifestations (approximate frequency):",
body_style
))
story.append(Spacer(1, 2*mm))
cf_data = [
["System", "Feature", "~Frequency"],
["Cutaneous", "Malar (butterfly) rash, discoid lupus, photosensitivity, oral ulcers, alopecia", "88%"],
["Musculoskeletal", "Non-erosive migratory arthritis/arthralgias", "76%"],
["Neuropsychiatric", "Cognitive dysfunction, seizures, psychosis, headache", "66%"],
["Serositis", "Pleuritis, pericarditis", "63%"],
["Haematologic", "Haemolytic anaemia, leukopenia, thrombocytopenia", "57%"],
["Vascular", "Raynaud phenomenon, vasculitis", "43-44%"],
["Renal", "Lupus nephritis - proteinuria, haematuria, casts", "31%"],
["Cardiac", "Libman-Sacks endocarditis, premature atherosclerosis", "18%"],
]
cf_table = Table(cf_data, colWidths=[3.5*cm, 9*cm, 2.5*cm])
cf_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), TABLE_HEAD),
("TEXTCOLOR", (0,0), (-1,0), colors.white),
("FONTNAME", (0,0), (-1,0), "Helvetica-Bold"),
("FONTSIZE", (0,0), (-1,-1), 8.5),
("ROWBACKGROUNDS", (0,1), (-1,-1), [colors.white, TABLE_ALT]),
("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#cbd5e1")),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING",(0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 6),
("VALIGN", (0,0), (-1,-1), "MIDDLE"),
("ALIGN", (2,0), (2,-1), "CENTER"),
]))
story.append(cf_table)
story.append(Spacer(1, 4*mm))
# Malar rash image
if IMG_PATH and os.path.exists(IMG_PATH):
img = Image(IMG_PATH, width=5*cm, height=6*cm)
img.hAlign = "CENTER"
story.append(img)
story.append(Paragraph(
"Malar (butterfly) rash in SLE - note erythema across cheeks and nasal bridge, "
"characteristically sparing the nasolabial folds.",
caption_style
))
story.append(Paragraph("Goldman-Cecil Medicine (International Edition)", source_style))
story.append(Spacer(1, 2*mm))
# ── 5. INVESTIGATIONS ─────────────────────────────────────────────────────────
story.append(section_header("5. Investigations"))
story.append(Spacer(1, 3*mm))
inv_data = [
["Test", "Significance"],
["ANA (antinuclear antibody)", "Sensitive >95%; required entry criterion for diagnosis"],
["Anti-dsDNA", "Highly specific; titres correlate with disease activity (esp. nephritis)"],
["Anti-Sm antibody", "Highly specific for SLE but less sensitive"],
["Complement (C3, C4)", "Low levels = consumed in active disease; low C3+C4 = most specific"],
["Antiphospholipid antibodies", "Anticardiolipin, anti-beta2GPI, lupus anticoagulant (~30%); thrombosis risk"],
["CBC", "Haemolytic anaemia, lymphopenia, thrombocytopenia"],
["Urinalysis / 24h protein", "Proteinuria, red cell casts indicate active lupus nephritis"],
["Renal biopsy", "ISN/RPS Class I-VI classification of lupus nephritis"],
]
inv_table = Table(inv_data, colWidths=[5.5*cm, 11.5*cm])
inv_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), TABLE_HEAD),
("TEXTCOLOR", (0,0), (-1,0), colors.white),
("FONTNAME", (0,0), (-1,0), "Helvetica-Bold"),
("FONTSIZE", (0,0), (-1,-1), 8.5),
("ROWBACKGROUNDS",(0,1), (-1,-1), [colors.white, TABLE_ALT]),
("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#cbd5e1")),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING",(0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 6),
("VALIGN", (0,0), (-1,-1), "MIDDLE"),
]))
story.append(inv_table)
story.append(Spacer(1, 3*mm))
# ── 6. DIAGNOSIS / CLASSIFICATION CRITERIA ────────────────────────────────────
story.append(section_header("6. Diagnosis - 2019 ACR/EULAR Classification Criteria"))
story.append(Spacer(1, 3*mm))
story.append(Paragraph(
"SLE is classified when: (1) <b>ANA titer ≥1:80</b> (mandatory entry criterion) AND "
"(2) total score <b>≥10 points</b> from weighted clinical and immunologic domains.",
body_style
))
story.append(Spacer(1, 2*mm))
crit_data = [
["Domain", "Criterion", "Points"],
["Mucocutaneous", "Acute cutaneous lupus (e.g. malar rash)", "6"],
["Mucocutaneous", "Subacute cutaneous / discoid lupus", "4"],
["Mucocutaneous", "Oral ulcers / non-scarring alopecia", "2"],
["Musculoskeletal", "Joint involvement (synovitis ≥2 joints)", "6"],
["Serositis", "Pleural/pericardial effusion", "5"],
["Neuropsychiatric","Seizure", "5"],
["Neuropsychiatric","Psychosis / delirium", "3/2"],
["Renal", "Proteinuria >0.5 g/24h", "4"],
["Renal", "Class II-V lupus nephritis on biopsy", "8/10"],
["Complement", "Low C3 AND C4", "4"],
["Immunologic", "Anti-dsDNA antibody", "6"],
["Immunologic", "Antiphospholipid antibody", "2"],
]
crit_table = Table(crit_data, colWidths=[4.5*cm, 9.5*cm, 3*cm])
crit_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), TABLE_HEAD),
("TEXTCOLOR", (0,0), (-1,0), colors.white),
("FONTNAME", (0,0), (-1,0), "Helvetica-Bold"),
("FONTSIZE", (0,0), (-1,-1), 8.5),
("ROWBACKGROUNDS",(0,1), (-1,-1), [colors.white, TABLE_ALT]),
("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#cbd5e1")),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING",(0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 6),
("VALIGN", (0,0), (-1,-1), "MIDDLE"),
("ALIGN", (2,0), (2,-1), "CENTER"),
]))
story.append(crit_table)
story.append(Spacer(1, 3*mm))
# ── 7. MANAGEMENT ─────────────────────────────────────────────────────────────
story.append(section_header("7. Management"))
story.append(Spacer(1, 3*mm))
story.append(Paragraph("<b>Stepwise, disease activity-guided approach:</b>", body_style))
mgmt = [
("<b>Hydroxychloroquine (HCQ)</b>",
"Given to ALL SLE patients regardless of severity. Reduces flares, thrombosis risk, and mortality. "
"Mechanism: blocks TLR7/9 endosomal signalling."),
("<b>NSAIDs / Low-dose corticosteroids</b>",
"First-line for mild disease (arthritis, serositis, skin rash)."),
("<b>Moderate-high dose corticosteroids</b>",
"For major organ involvement - lupus nephritis, CNS disease, haemolytic anaemia."),
("<b>Immunosuppressives</b>",
"Mycophenolate mofetil (MMF) or cyclophosphamide for lupus nephritis induction; "
"azathioprine for maintenance; methotrexate for cutaneous/articular disease."),
("<b>Biologics</b>",
"Belimumab (anti-BAFF/BLyS monoclonal antibody) - approved for active SLE. "
"Anifrolumab (anti-type I IFN receptor) - for moderate-to-severe SLE refractory to standard therapy."),
("<b>Antiphospholipid antibody syndrome</b>",
"Long-term anticoagulation with warfarin for thrombotic events."),
("<b>Lifestyle and preventive measures</b>",
"Strict sun protection (SPF >50), avoid triggers, vaccinations (avoid live vaccines on "
"immunosuppression), manage cardiovascular risk factors."),
]
for heading, body in mgmt:
story.append(bullet(f"{heading}: {body}"))
story.append(Spacer(1, 1*mm))
# ── 8. COMPLICATIONS & PROGNOSIS ──────────────────────────────────────────────
story.append(section_header("8. Complications and Prognosis"))
story.append(Spacer(1, 3*mm))
for b in [
"Lupus nephritis progresses to end-stage renal disease in ~10-20% of patients.",
"Accelerated atherosclerosis and premature cardiovascular death (major cause of late mortality).",
"Infections - major cause of early mortality due to immunosuppression and complement deficiency.",
"Avascular (aseptic) necrosis of bone, particularly femoral head (from steroids/vasculitis).",
"Drug side effects: HCQ retinopathy, steroid osteoporosis/diabetes, cyclophosphamide gonadotoxicity.",
"10-year survival >90% with modern therapy. Adverse prognostic factors: nephritis, CNS involvement, "
"thrombocytopenia, early disease onset.",
]:
story.append(bullet(b))
story.append(Spacer(1, 3*mm))
# ── SUMMARY BOX ───────────────────────────────────────────────────────────────
summary_text = (
"<b>Summary:</b> SLE is the prototype systemic autoimmune disease driven by failure of self-tolerance, "
"autoantibody production (anti-dsDNA, anti-Sm), immune complex deposition (Type III hypersensitivity), "
"and type I IFN dysregulation. It presents as a relapsing, multisystem disorder diagnosed by positive "
"ANA (entry) plus scored ACR/EULAR criteria (threshold ≥10). Management is layered from hydroxychloroquine "
"(universal) through immunosuppressives to targeted biologics for refractory disease."
)
sum_data = [[Paragraph(summary_text, ParagraphStyle(
"SumStyle", parent=body_style, fontSize=9, leading=13, textColor=DARK_BLUE
))]]
sum_table = Table(sum_data, colWidths=[17*cm])
sum_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), LIGHT_BLUE),
("BOX", (0,0), (-1,-1), 1.2, MED_BLUE),
("TOPPADDING", (0,0), (-1,-1), 8),
("BOTTOMPADDING", (0,0), (-1,-1), 8),
("LEFTPADDING", (0,0), (-1,-1), 10),
("RIGHTPADDING", (0,0), (-1,-1), 10),
]))
story.append(sum_table)
story.append(Spacer(1, 4*mm))
# Sources
story.append(HRFlowable(width="100%", thickness=0.5, color=MID_GRAY, spaceAfter=4))
story.append(Paragraph(
"<i>Sources: Goldman-Cecil Medicine (International Edition, 2022); "
"Firestein & Kelley's Textbook of Rheumatology (2022, Elsevier); "
"Cellular and Molecular Immunology (Abbas et al.)</i>",
source_style
))
# Build PDF
doc.build(story)
print(f"PDF created: {OUTPUT}")
python /home/daytona/workspace/sle-pdf/generate_sle_pdf.py
ls -lh /home/daytona/workspace/sle-pdf/
SLE 10 Mark Answer
PDF Document · PDF
Explain dumping syndrom like above
~/sle-pdf/generate_dumping_pdf.py
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, KeepTogether
)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
OUTPUT = "/home/daytona/workspace/sle-pdf/Dumping_Syndrome_10_Mark_Answer.pdf"
# Colors
DARK_BLUE = colors.HexColor("#1a3a5c")
MED_BLUE = colors.HexColor("#2563a8")
LIGHT_BLUE = colors.HexColor("#dbeafe")
ACCENT = colors.HexColor("#e63946")
LIGHT_GRAY = colors.HexColor("#f8fafc")
MID_GRAY = colors.HexColor("#64748b")
TABLE_HEAD = colors.HexColor("#1a3a5c")
TABLE_ALT = colors.HexColor("#f0f4ff")
doc = SimpleDocTemplate(
OUTPUT,
pagesize=A4,
rightMargin=2*cm, leftMargin=2*cm,
topMargin=2.2*cm, bottomMargin=2*cm,
title="Dumping Syndrome - 10 Mark Answer",
author="Orris Medical AI"
)
styles = getSampleStyleSheet()
title_style = ParagraphStyle("TitleStyle", parent=styles["Title"],
fontSize=20, textColor=DARK_BLUE, spaceAfter=4, spaceBefore=0,
alignment=TA_CENTER, fontName="Helvetica-Bold", leading=26)
subtitle_style = ParagraphStyle("SubtitleStyle", fontSize=10, textColor=MID_GRAY,
alignment=TA_CENTER, spaceAfter=12, fontName="Helvetica")
h1_style = ParagraphStyle("H1Style", fontSize=12, textColor=colors.white,
fontName="Helvetica-Bold", spaceBefore=14, spaceAfter=4, leading=16, leftIndent=6)
body_style = ParagraphStyle("BodyStyle", fontSize=9.5, textColor=colors.HexColor("#1e293b"),
fontName="Helvetica", spaceBefore=2, spaceAfter=4, leading=14, alignment=TA_JUSTIFY)
bullet_style = ParagraphStyle("BulletStyle", fontSize=9.5, textColor=colors.HexColor("#1e293b"),
fontName="Helvetica", spaceBefore=1, spaceAfter=1, leading=13, leftIndent=16, bulletIndent=4)
caption_style = ParagraphStyle("CaptionStyle", fontSize=8, textColor=MID_GRAY,
fontName="Helvetica-Oblique", alignment=TA_CENTER, spaceAfter=6)
source_style = ParagraphStyle("SourceStyle", fontSize=7.5, textColor=MID_GRAY,
fontName="Helvetica-Oblique", spaceBefore=2, spaceAfter=2, alignment=TA_CENTER)
box_style = ParagraphStyle("BoxStyle", fontSize=9, textColor=DARK_BLUE,
fontName="Helvetica", spaceBefore=0, spaceAfter=0, leading=13, alignment=TA_JUSTIFY)
def section_header(text):
data = [[Paragraph(text, h1_style)]]
t = Table(data, colWidths=[17*cm])
t.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), DARK_BLUE),
("TOPPADDING", (0,0), (-1,-1), 5),
("BOTTOMPADDING", (0,0), (-1,-1), 5),
("LEFTPADDING", (0,0), (-1,-1), 8),
]))
return t
def bullet(text):
return Paragraph(f"<bullet>•</bullet> {text}", bullet_style)
def info_box(text):
data = [[Paragraph(text, box_style)]]
t = Table(data, colWidths=[17*cm])
t.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), LIGHT_BLUE),
("BOX", (0,0), (-1,-1), 1.2, MED_BLUE),
("TOPPADDING", (0,0), (-1,-1), 7),
("BOTTOMPADDING", (0,0), (-1,-1), 7),
("LEFTPADDING", (0,0), (-1,-1), 10),
("RIGHTPADDING", (0,0), (-1,-1), 10),
]))
return t
story = []
# ── TITLE BLOCK ──────────────────────────────────────────────────────────────
story.append(Spacer(1, 4*mm))
story.append(Paragraph("Dumping Syndrome", title_style))
story.append(Paragraph("10-Mark Examination Answer | Surgery / Gastroenterology", subtitle_style))
story.append(HRFlowable(width="100%", thickness=2, color=ACCENT, spaceAfter=10))
# ── 1. DEFINITION ─────────────────────────────────────────────────────────────
story.append(section_header("1. Definition"))
story.append(Spacer(1, 3*mm))
story.append(Paragraph(
"Dumping syndrome is a <b>constellation of gastrointestinal and vasomotor symptoms</b> caused by "
"rapid, unregulated emptying of gastric contents (particularly hyperosmolar/calorie-dense food) into "
"the small intestine, bypassing normal pyloric regulation. It is predominantly a <b>postgastrectomy "
"complication</b> and is classified into two distinct types: <b>early dumping</b> (within 10-30 minutes "
"of eating) and <b>late dumping</b> (1-3 hours after eating).",
body_style
))
story.append(Spacer(1, 2*mm))
# ── 2. ETIOLOGY / PREDISPOSING CAUSES ─────────────────────────────────────────
story.append(section_header("2. Etiology and Predisposing Causes"))
story.append(Spacer(1, 3*mm))
story.append(Paragraph("<b>Surgical causes (most common):</b>", body_style))
for b in [
"<b>Partial gastrectomy with Billroth II reconstruction</b> - most common cause; loss of pyloric "
"reservoir function.",
"<b>Billroth I (gastroduodenostomy)</b> and <b>Roux-en-Y reconstruction</b> - less commonly associated.",
"<b>Vagotomy with pyloroplasty or gastroenterostomy</b> - vagotomy abolishes receptive relaxation of "
"the proximal stomach, markedly accelerating liquid emptying.",
"<b>Roux-en-Y gastric bypass (bariatric surgery)</b> - mild early dumping common in first 1-2 months "
"postoperatively but usually resolves.",
"<b>Oesophageal surgery</b> (distal oesophagectomy, myotomy for achalasia) and <b>Whipple procedure</b> "
"(non-pylorus-sparing pancreaticoduodenectomy).",
]:
story.append(bullet(b))
story.append(Spacer(1, 2*mm))
story.append(Paragraph("<b>Non-surgical (idiopathic) causes:</b>", body_style))
for b in [
"Functional dyspepsia and early-stage <b>type 2 diabetes mellitus</b> (autonomic neuropathy accelerating "
"gastric emptying).",
"<b>Zollinger-Ellison syndrome (ZES)</b> - hypersecretion of acid accelerates emptying.",
"<b>Idiopathic rapid gastric emptying</b> - diagnosed when no prior surgery or other cause is identified.",
]:
story.append(bullet(b))
story.append(Spacer(1, 2*mm))
# ── 3. PATHOPHYSIOLOGY ────────────────────────────────────────────────────────
story.append(section_header("3. Pathophysiology"))
story.append(Spacer(1, 3*mm))
story.append(Paragraph("<b>A. Early Dumping Syndrome (within 10-30 minutes of meal)</b>", body_style))
story.append(Spacer(1, 1*mm))
for b in [
"Loss of pyloric reservoir function causes rapid delivery of <b>hyperosmolar, calorie-dense food</b> "
"into the duodenum/jejunum.",
"The hypertonic bolus drives a rapid <b>osmotic shift of extracellular fluid into the intestinal lumen</b> "
"to achieve isotonicity, causing luminal distension and intravascular volume contraction.",
"Loss of vagally mediated <b>receptive relaxation</b> of the proximal stomach (especially after vagotomy) "
"raises intragastric pressure, accelerating emptying further.",
"When intestinal content bypasses the duodenum (e.g. Billroth II, Roux-en-Y), the <b>duodenal feedback "
"mechanism</b> (mucosal receptors for acid, fat, sugar, osmolality that slow gastric emptying) is lost.",
"Rapid entry of nutrients into the jejunum triggers release of <b>vasoactive neurohormonal agents</b> "
"including neurotensin, VIP, GLP-1, serotonin, and substance P, causing the vasomotor symptoms.",
"Result: intestinal distension + neurohormonal response → GI symptoms (pain, bloating, nausea, diarrhoea) "
"+ vasomotor symptoms (flushing, tachycardia, diaphoresis, syncope).",
]:
story.append(bullet(b))
story.append(Spacer(1, 3*mm))
story.append(Paragraph("<b>B. Late Dumping Syndrome (1-3 hours after meal)</b>", body_style))
story.append(Spacer(1, 1*mm))
for b in [
"Carbohydrates delivered rapidly to the proximal intestine are <b>quickly absorbed</b>, causing a rapid "
"rise in blood glucose (hyperglycaemia).",
"This triggers an <b>exaggerated, excessive insulin release</b> (with key mediation by GLP-1), which "
"overshoots and results in <b>reactive hypoglycaemia</b>.",
"Hypoglycaemia stimulates the adrenal glands to release <b>catecholamines</b> (adrenaline/noradrenaline), "
"causing the characteristic sympathoadrenal symptoms.",
"Result: diaphoresis, tremulousness, lightheadedness, tachycardia, confusion, and weakness "
"(adrenergic hypoglycaemic symptoms).",
]:
story.append(bullet(b))
story.append(Spacer(1, 2*mm))
# Comparison table
story.append(info_box(
"<b>Key distinction:</b> Early dumping = osmotic + neurohormonal (GI + vasomotor symptoms). "
"Late dumping = reactive hypoglycaemia (adrenergic symptoms). Both stem from the same root cause: "
"rapid gastric emptying."
))
story.append(Spacer(1, 3*mm))
# ── 4. CLINICAL FEATURES ──────────────────────────────────────────────────────
story.append(section_header("4. Clinical Features"))
story.append(Spacer(1, 3*mm))
cf_data = [
["Feature", "Early Dumping\n(10-30 min after meal)", "Late Dumping\n(1-3 hours after meal)"],
["Mechanism", "Osmotic fluid shift + neurohormonal", "Reactive hypoglycaemia"],
["GI symptoms", "Nausea, vomiting, abdominal pain,\nbloating, early satiety, diarrhoea", "Minimal or absent"],
["Vasomotor\nsymptoms", "Flushing, tachycardia, palpitations,\ndiaphoresis, syncope, hypotension", "Diaphoresis, tremor, weakness,\nlightheadedness, confusion"],
["Posture", "Patients typically lie down\nfor 30-60 min to get relief", "Symptoms relieved by eating\n(glucose raises blood sugar)"],
["Frequency", "More common (~75% of cases)", "Less common (~25% of cases)"],
]
cf_table = Table(cf_data, colWidths=[3.5*cm, 6.75*cm, 6.75*cm])
cf_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), TABLE_HEAD),
("TEXTCOLOR", (0,0), (-1,0), colors.white),
("FONTNAME", (0,0), (-1,0), "Helvetica-Bold"),
("FONTSIZE", (0,0), (-1,-1), 8.5),
("ROWBACKGROUNDS",(0,1), (-1,-1), [colors.white, TABLE_ALT]),
("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#cbd5e1")),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING",(0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 6),
("VALIGN", (0,0), (-1,-1), "MIDDLE"),
("FONTNAME", (0,1), (0,-1), "Helvetica-Bold"),
]))
story.append(cf_table)
story.append(Spacer(1, 3*mm))
# ── 5. DIAGNOSIS ──────────────────────────────────────────────────────────────
story.append(section_header("5. Diagnosis"))
story.append(Spacer(1, 3*mm))
story.append(Paragraph(
"Diagnosis is primarily <b>clinical</b>, based on characteristic postprandial symptoms in the "
"appropriate surgical context. Confirmatory tests when indicated:",
body_style
))
for b in [
"<b>Modified oral glucose tolerance test (75 g glucose load after overnight fast):</b>"
"<br/>- Positive for <i>early</i> dumping: rise in haematocrit ≥3% OR heart rate increase ≥10 bpm at 30 min."
"<br/>- Positive for <i>late</i> dumping: blood glucose <50 mg/dL between 1-3 hours after ingestion.",
"<b>Radionuclide gastric emptying scintigraphy:</b> Can confirm rapid liquid emptying (>30% emptied "
"at 30 min or >70% at 60 min). Note: most standard tests use solid markers; a liquid marker must be "
"specifically requested. Sensitivity and specificity are low.",
"<b>Continuous glucose monitoring (CGM):</b> Useful for detecting reactive hypoglycaemia episodes in "
"late dumping.",
"<b>Mixed meal tolerance test:</b> Alternative confirmatory test in non-surgical (idiopathic) cases.",
]:
story.append(bullet(b))
story.append(Spacer(1, 2*mm))
# ── 6. DIFFERENTIAL DIAGNOSIS ─────────────────────────────────────────────────
story.append(section_header("6. Differential Diagnosis"))
story.append(Spacer(1, 3*mm))
for b in [
"<b>Gastroparesis</b> - delayed (not rapid) gastric emptying; symptoms overlap (bloating, nausea) "
"but occur later.",
"<b>Functional dyspepsia</b> - no identifiable structural cause; may have idiopathic rapid emptying.",
"<b>Afferent loop syndrome</b> - postprandial epigastric pain 1-2 hours after eating, relieved by "
"bilious vomiting (Billroth II specific).",
"<b>Reactive hypoglycaemia (non-surgical)</b> - late dumping pattern; distinguish by surgical history.",
"<b>Pancreatic insufficiency / malabsorption</b> - overlapping diarrhoea and bloating.",
"<b>Short bowel syndrome</b> - follows massive intestinal resection; persistent malabsorptive diarrhoea.",
]:
story.append(bullet(b))
story.append(Spacer(1, 2*mm))
# ── 7. MANAGEMENT ─────────────────────────────────────────────────────────────
story.append(section_header("7. Management"))
story.append(Spacer(1, 3*mm))
story.append(Paragraph("<b>Step 1 - Dietary Modification (first-line for all patients):</b>", body_style))
for b in [
"Eat small, frequent meals (6 small meals per day rather than 3 large meals).",
"<b>Separate liquids from solids</b> - drink fluids 30-45 minutes before or after eating, not during.",
"Avoid simple sugars, rapidly absorbed carbohydrates, and high-osmolarity foods.",
"Choose foods rich in protein, complex carbohydrates, and dietary fibre (slows intestinal transit).",
"Lie down for 30 minutes after meals (reduces gravitational effect on gastric emptying).",
"Add <b>pectin (15 g/meal)</b> or <b>guar gum</b> to meals to retard gastric emptying of liquids.",
]:
story.append(bullet(b))
story.append(Spacer(1, 2*mm))
story.append(Paragraph("<b>Step 2 - Pharmacologic Treatment (for diet-refractory cases):</b>", body_style))
pharm_data = [
["Drug", "Mechanism", "Dose / Notes"],
["Octreotide\n(somatostatin analogue)", "Inhibits gastric emptying, slows small bowel transit, inhibits GI hormone and insulin release", "25-100 mcg SC before meals; long-acting depot 10-20 mg IM monthly; ~20% respond dramatically"],
["Acarbose\n(alpha-glucosidase inhibitor)", "Blocks carbohydrate absorption in small bowel, blunts postprandial glucose spike and reactive hyperinsulinaemia", "50-100 mg orally TID with meals; effective specifically for late dumping/hypoglycaemia"],
["GLP-1 receptor agonists", "Promising for symptomatic reactive hypoglycaemia (late dumping)", "Emerging therapy; delays gastric emptying and modulates insulin secretion"],
["Loperamide / Opium tincture", "Reduce diarrhoea by slowing intestinal transit", "Symptomatic relief for diarrhoea-predominant dumping"],
["Meclizine / Antiemetics", "Control nausea", "Symptomatic adjunct"],
]
pharm_table = Table(pharm_data, colWidths=[4*cm, 7*cm, 6*cm])
pharm_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), TABLE_HEAD),
("TEXTCOLOR", (0,0), (-1,0), colors.white),
("FONTNAME", (0,0), (-1,0), "Helvetica-Bold"),
("FONTSIZE", (0,0), (-1,-1), 8.2),
("ROWBACKGROUNDS",(0,1), (-1,-1), [colors.white, TABLE_ALT]),
("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#cbd5e1")),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING",(0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 6),
("VALIGN", (0,0), (-1,-1), "MIDDLE"),
]))
story.append(pharm_table)
story.append(Spacer(1, 3*mm))
story.append(Paragraph("<b>Step 3 - Surgical Intervention (last resort for severe, refractory cases):</b>", body_style))
for b in [
"<b>Roux-en-Y conversion:</b> For patients with prior Billroth II distal gastrectomy; converting the "
"loop gastrojejunostomy to a Roux-en-Y reconstruction is the procedure of choice.",
"<b>Pyloric reconstruction:</b> Restoration of pyloric function can be attempted in select cases.",
"<b>Takedown of gastrojejunostomy:</b> If pylorus is intact and functional, reversing the gastroenteric "
"anastomosis is an option.",
"<b>Jejunal interposition:</b> Placing a segment of reversed jejunum between stomach remnant and duodenum "
"to slow emptying (rarely performed).",
"<b>Continuous jejunal tube feeding:</b> Bypasses the problem by delivering nutrients slowly; effective "
"but impractical long-term.",
]:
story.append(bullet(b))
story.append(Spacer(1, 2*mm))
# ── 8. PROGNOSIS ──────────────────────────────────────────────────────────────
story.append(section_header("8. Prognosis and Complications"))
story.append(Spacer(1, 3*mm))
for b in [
"Most patients improve significantly with <b>dietary modification alone</b>; symptoms usually "
"self-limit within 1-2 months after bariatric surgery.",
"Persistent, clinically relevant symptoms beyond 2-3 months are uncommon (approximately <b>2% of "
"gastrectomy patients</b>) and are most associated with concomitant vagotomy.",
"<b>Weight loss and malnutrition</b> from food avoidance can be significant long-term complications.",
"<b>Reactive hypoglycaemia</b> in late dumping can occasionally be severe enough to cause loss of "
"consciousness; continuous glucose monitoring helps identify these patients.",
"Overall prognosis is <b>good</b> with stepwise management (diet → pharmacotherapy → surgery).",
"Surgical correction achieves symptom relief in the majority of appropriately selected patients.",
]:
story.append(bullet(b))
story.append(Spacer(1, 3*mm))
# ── SUMMARY BOX ───────────────────────────────────────────────────────────────
story.append(info_box(
"<b>Summary:</b> Dumping syndrome is a postgastrectomy disorder of rapid gastric emptying. "
"<b>Early dumping</b> (10-30 min) results from osmotic fluid shifts and neurohormonal release into "
"the intestine, producing GI and vasomotor symptoms. <b>Late dumping</b> (1-3 h) results from "
"reactive hypoglycaemia driven by exaggerated GLP-1-mediated insulin release. Diagnosis is clinical; "
"a modified 75g OGTT can confirm. Management follows a stepwise approach: dietary modification "
"(first line) → acarbose/octreotide (pharmacotherapy) → surgical reconstruction (refractory cases)."
))
story.append(Spacer(1, 4*mm))
story.append(HRFlowable(width="100%", thickness=0.5, color=MID_GRAY, spaceAfter=4))
story.append(Paragraph(
"<i>Sources: Sabiston Textbook of Surgery (2024, Elsevier); Fischer's Mastery of Surgery (8th ed.); "
"Goldman-Cecil Medicine (International Edition, 2022); "
"Sleisenger & Fordtran's Gastrointestinal and Liver Disease; "
"Yamada's Textbook of Gastroenterology (7th ed.)</i>",
source_style
))
doc.build(story)
print(f"PDF created: {OUTPUT}")
python /home/daytona/workspace/sle-pdf/generate_dumping_pdf.py
ls -lh /home/daytona/workspace/sle-pdf/
Dumping Syndrome 10 Mark Answer
PDF Document · PDF
| Feature | Early Dumping (10-30 min) | Late Dumping (1-3 hours) |
|---|---|---|
| Mechanism | Osmotic + neurohormonal | Reactive hypoglycaemia |
| GI symptoms | Nausea, vomiting, pain, bloating, diarrhoea | Minimal |
| Vasomotor | Flushing, tachycardia, diaphoresis, syncope | Diaphoresis, tremor, weakness, confusion |
| Relief | Lying down for 30-60 min | Eating (raises blood glucose) |
| Frequency | ~75% of cases | ~25% of cases |
| Drug | Mechanism | Dose |
|---|---|---|
| Octreotide | Inhibits gastric emptying, slows bowel transit, inhibits GI hormones + insulin | 25-100 mcg SC before meals; depot 10-20 mg IM monthly |
| Acarbose | Blocks carb absorption, blunts glucose spike + hyperinsulinaemia | 50-100 mg TID with meals (late dumping) |
| GLP-1 receptor agonists | Delays gastric emptying, modulates insulin | Emerging therapy |
| Loperamide | Slows intestinal transit | For diarrhoea-predominant cases |
Explain ezcema like above but not give pdf
The term "eczema" is a morphological descriptor (meaning spongiotic dermatitis) that includes contact and other eczematous conditions. "Atopic dermatitis" is the preferred specific term for the disease.
| Age Group | Distribution | Morphology |
|---|---|---|
| Infants (<2 years) | Face (cheeks, forehead), scalp, extensor surfaces | Acute: erythema, weeping vesicles, crusting |
| Children (2-12 years) | Flexural areas: antecubital/popliteal fossa, wrists, ankles | Subacute: scaling, erythema; chronic: lichenification |
| Adolescents/Adults | Flexures, hands, feet, eyelids, neck | Lichenification, excoriation, post-inflammatory dyspigmentation |
Note: Routine allergy testing (skin prick test, RAST) is not recommended as standard workup - positive tests do not reliably predict causal allergens in AD. Testing is reserved for children <5 years with moderate-severe persistent AD failing treatment.

| Agent | Use | Notes |
|---|---|---|
| Topical corticosteroids (TCs) | Cornerstone of active flare treatment | 7 potency classes; avoid high-potency on face/genitalia/intertriginous areas; twice-weekly maintenance dosing after remission |
| Topical calcineurin inhibitors (TCIs) - Tacrolimus, Pimecrolimus | Second-line; preferred for face, eyelids, skin folds | Avoid systemic absorption concerns; carry FDA boxed warning for theoretical malignancy risk |
| Topical PDE4 inhibitors - Crisaborole | Mild-moderate AD; steroid-sparing | Non-steroidal; suitable for sensitive areas |
| Topical JAK inhibitors - Ruxolitinib | Mild-moderate AD in adults ≥12 years | Blocks JAK1/JAK2 signalling driving Th2 inflammation and itch |
| Drug | Mechanism | Notes |
|---|---|---|
| Dupilumab (anti-IL-4Rα) | Blocks IL-4 and IL-13 signalling simultaneously | FDA-approved for ≥6 months age; 40-70% achieve clear/almost clear skin; first-line biologic |
| Tralokinumab (anti-IL-13) | Selectively blocks IL-13 | Approved for moderate-severe AD in adults |
| JAK inhibitors - Upadacitinib, Abrocitinib, Baricitinib | Oral; block JAK-STAT pathway | Rapid itch relief; monitor for infections, thrombosis, lipid changes |
| Cyclosporine | Calcineurin inhibitor; reduces T cell activation | Short-term only; renal toxicity, hypertension |
| Azathioprine / Methotrexate / Mycophenolate | Immunosuppression | Off-label; used when biologics unavailable |
| Oral corticosteroids | Reserved for acute, severe flares | Short courses only; rebound flares on withdrawal are problematic |
Summary: Eczema (atopic dermatitis) is a chronic Th2-driven inflammatory skin disease arising from a dual defect in skin barrier integrity (FLG mutations) and immune regulation (IL-4, IL-13, TSLP, IL-31 excess). It presents as pruritic eczematous dermatitis with age-specific distribution, diagnosed by the Hanifin-Rajka criteria. Management is stepwise: emollients + trigger avoidance → topical corticosteroids/TCIs → phototherapy → dupilumab/JAK inhibitors for severe refractory disease.