Prepare a notes for final year mbbs on topic 1) ocular injuries 2) Diseases of uveal tract 3)Neuro- opthalmology 4) Disease of lacrimal Appartus 5) Disorders of eyelids 6) squint and its disorders ophthalmology based on latest rguhs questions Include all 10, 5, 3 marks And highlight the important questions and topics In pdf format

Reading File
Finding Sources
Searching the Web

RGUHS final year MBBS ophthalmology previous year question papers ocular injuries uveal tract neuro-ophthalmology lacrimal eyelid squint

Finding Sources
Finding Sources
Finding Sources
Reading Web Page

https://rrmch.org/cms/pdf/question-bank/UG-Opthalmology-QP-J…

Reading File
Reading File
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading Web Page

https://www.slideshare.net/slideshow/ophthalmology-45564153/…

Reading File
Running Command

mkdir -p /home/daytona/workspace/rguhs-ophthalmology && ls /home/daytona/workspa…

Writing File

~/rguhs-ophthalmology/generate_notes.py

from reportlab.lib.pagesizes import A4
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.colors import HexColor, black, white, red
from reportlab.platypus import (SimpleDocTemplate, Paragraph, Spacer, Table,
                                 TableStyle, PageBreak, HRFlowable, KeepTogether)
from reportlab.lib.units import mm, cm
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.platypus import BalancedColumns
from reportlab.lib import colors

# ── colour palette ──────────────────────────────────────────────────────────
DARK_BLUE   = HexColor("#1a3a5c")
MED_BLUE    = HexColor("#2563a8")
LIGHT_BLUE  = HexColor("#dbeafe")
ACCENT      = HexColor("#e63946")   # red highlight for imp topics
GOLD        = HexColor("#f59e0b")
LIGHT_GOLD  = HexColor("#fef3c7")
GREEN       = HexColor("#166534")
LIGHT_GREEN = HexColor("#dcfce7")
GREY_BG     = HexColor("#f8fafc")
GREY_LINE   = HexColor("#e2e8f0")
WHITE       = white

# ── document ─────────────────────────────────────────────────────────────────
OUTPUT = "/home/daytona/workspace/rguhs-ophthalmology/RGUHS_Ophthalmology_Notes.pdf"
doc = SimpleDocTemplate(
    OUTPUT,
    pagesize=A4,
    leftMargin=18*mm, rightMargin=18*mm,
    topMargin=22*mm,  bottomMargin=22*mm,
    title="RGUHS Final Year MBBS – Ophthalmology Notes",
    author="Orris AI",
)

# ── styles ────────────────────────────────────────────────────────────────────
styles = getSampleStyleSheet()

def S(name, **kw):
    return ParagraphStyle(name, **kw)

cover_title = S("CoverTitle",
    fontSize=28, leading=34, textColor=WHITE, alignment=TA_CENTER,
    fontName="Helvetica-Bold", spaceBefore=0, spaceAfter=6)

cover_sub = S("CoverSub",
    fontSize=14, leading=18, textColor=LIGHT_BLUE, alignment=TA_CENTER,
    fontName="Helvetica", spaceBefore=4, spaceAfter=4)

cover_note = S("CoverNote",
    fontSize=10, leading=13, textColor=WHITE, alignment=TA_CENTER,
    fontName="Helvetica-Oblique")

ch_heading = S("ChHeading",
    fontSize=18, leading=22, textColor=WHITE, alignment=TA_LEFT,
    fontName="Helvetica-Bold", spaceBefore=0, spaceAfter=0)

section_h = S("SectionH",
    fontSize=13, leading=16, textColor=DARK_BLUE,
    fontName="Helvetica-Bold", spaceBefore=10, spaceAfter=3)

sub_h = S("SubH",
    fontSize=11, leading=14, textColor=MED_BLUE,
    fontName="Helvetica-Bold", spaceBefore=7, spaceAfter=2)

body = S("Body",
    fontSize=9.5, leading=13.5, textColor=HexColor("#1e293b"),
    fontName="Helvetica", spaceBefore=2, spaceAfter=2, alignment=TA_JUSTIFY)

bullet = S("Bullet",
    fontSize=9.5, leading=13, textColor=HexColor("#1e293b"),
    fontName="Helvetica", leftIndent=12, bulletIndent=0, spaceBefore=1)

imp_q = S("ImpQ",
    fontSize=9.5, leading=13, textColor=HexColor("#7c2d12"),
    fontName="Helvetica-Bold", leftIndent=12, spaceBefore=1,
    backColor=LIGHT_GOLD, borderPadding=(3,6,3,6))

marks_10 = S("Marks10",
    fontSize=9, leading=12, textColor=HexColor("#14532d"),
    fontName="Helvetica-Bold", leftIndent=14, spaceBefore=1)

marks_5 = S("Marks5",
    fontSize=9, leading=12, textColor=HexColor("#1e40af"),
    fontName="Helvetica-Bold", leftIndent=14, spaceBefore=1)

marks_3 = S("Marks3",
    fontSize=9, leading=12, textColor=HexColor("#7e22ce"),
    fontName="Helvetica-Bold", leftIndent=14, spaceBefore=1)

toc_style = S("TOC",
    fontSize=10, leading=14, textColor=DARK_BLUE,
    fontName="Helvetica", leftIndent=8, spaceBefore=2)

# ── helpers ───────────────────────────────────────────────────────────────────
def chapter_banner(title, color=DARK_BLUE):
    tbl = Table([[Paragraph(title, ch_heading)]], colWidths=[174*mm])
    tbl.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), color),
        ("TOPPADDING",  (0,0), (-1,-1), 8),
        ("BOTTOMPADDING",(0,0),(-1,-1), 8),
        ("LEFTPADDING", (0,0), (-1,-1), 12),
        ("RIGHTPADDING",(0,0), (-1,-1), 8),
        ("ROUNDEDCORNERS", [4]),
    ]))
    return tbl

def imp_box(text):
    """Yellow box for high-yield / frequently asked topics."""
    style = S("ImpBox"+text[:10].replace(" ",""),
        fontSize=9.5, leading=13.5, textColor=HexColor("#7c2d12"),
        fontName="Helvetica-Bold", leftIndent=8, spaceBefore=2, spaceAfter=2)
    tbl = Table([[Paragraph("★  " + text, style)]], colWidths=[170*mm])
    tbl.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), LIGHT_GOLD),
        ("LINEABOVE",  (0,0), (-1,-1), 1.5, GOLD),
        ("LINEBELOW",  (0,0), (-1,-1), 1.5, GOLD),
        ("LEFTPADDING",(0,0), (-1,-1), 10),
        ("RIGHTPADDING",(0,0),(-1,-1), 8),
        ("TOPPADDING", (0,0), (-1,-1), 5),
        ("BOTTOMPADDING",(0,0),(-1,-1), 5),
    ]))
    return tbl

def q_row(marks, text, important=False):
    mark_colors = {10: HexColor("#14532d"), 5: HexColor("#1e40af"), 3: HexColor("#7e22ce")}
    bg = LIGHT_GOLD if important else GREY_BG
    mark_bg = {10: LIGHT_GREEN, 5: LIGHT_BLUE, 3: HexColor("#f3e8ff")}
    mark_txt_color = mark_colors.get(marks, MED_BLUE)
    prefix = "★ " if important else ""
    txt_style = S(f"QRow{marks}{text[:8]}",
        fontSize=9.5, leading=13, textColor=HexColor("#7c2d12") if important else HexColor("#1e293b"),
        fontName="Helvetica-Bold" if important else "Helvetica",
        leftIndent=4, spaceBefore=1)
    tbl = Table([
        [Paragraph(f"<b>{marks}M</b>", S(f"Mx{marks}",
                fontSize=9, textColor=mark_txt_color, fontName="Helvetica-Bold",
                alignment=TA_CENTER, leading=11)),
         Paragraph(prefix + text, txt_style)]
    ], colWidths=[12*mm, 158*mm])
    tbl.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (0,0), mark_bg.get(marks, LIGHT_BLUE)),
        ("BACKGROUND", (1,0), (1,0), bg),
        ("VALIGN", (0,0), (-1,-1), "MIDDLE"),
        ("TOPPADDING", (0,0), (-1,-1), 3),
        ("BOTTOMPADDING", (0,0), (-1,-1), 3),
        ("LEFTPADDING", (0,0), (0,0), 4),
        ("RIGHTPADDING", (0,0), (-1,-1), 6),
        ("LINEBELOW", (0,0), (-1,-1), 0.3, GREY_LINE),
        ("BOX", (0,0), (-1,-1), 0.5, GREY_LINE),
    ]))
    return tbl

def section_label(text, color=DARK_BLUE):
    s = S("SecLbl"+text[:6],
        fontSize=11, leading=14, textColor=WHITE,
        fontName="Helvetica-Bold", spaceBefore=0, spaceAfter=0)
    tbl = Table([[Paragraph(text, s)]], colWidths=[174*mm])
    tbl.setStyle(TableStyle([
        ("BACKGROUND", (0,0),(-1,-1), color),
        ("TOPPADDING",(0,0),(-1,-1),4),
        ("BOTTOMPADDING",(0,0),(-1,-1),4),
        ("LEFTPADDING",(0,0),(-1,-1),10),
    ]))
    return tbl

def hr():
    return HRFlowable(width="100%", thickness=0.5, color=GREY_LINE, spaceAfter=4, spaceBefore=4)

def SP(n=6):
    return Spacer(1, n)

def B(text):
    return Paragraph("• " + text, bullet)

def T(text):
    return Paragraph(text, body)

def H2(text):
    return Paragraph(text, section_h)

def H3(text):
    return Paragraph(text, sub_h)

# ══════════════════════════════════════════════════════════════════════════════
# BUILD CONTENT
# ══════════════════════════════════════════════════════════════════════════════
story = []

# ── COVER PAGE ────────────────────────────────────────────────────────────────
cover_bg = Table([[""]], colWidths=[210*mm - 36*mm], rowHeights=[60*mm])
cover_bg.setStyle(TableStyle([
    ("BACKGROUND", (0,0),(-1,-1), DARK_BLUE),
    ("TOPPADDING",(0,0),(-1,-1),20),
    ("BOTTOMPADDING",(0,0),(-1,-1),20),
]))

story.append(SP(20))
story.append(Table([
    [Paragraph("RGUHS Final Year MBBS", cover_title)],
    [Paragraph("Ophthalmology", S("CvT2", fontSize=32, leading=38,
        textColor=GOLD, alignment=TA_CENTER, fontName="Helvetica-Bold"))],
    [Paragraph("Complete Exam Notes", cover_sub)],
    [SP(6)],
    [Paragraph("Based on Latest RGUHS Question Papers (2008–2025)", cover_note)],
    [Paragraph("Includes 10-Mark | 5-Mark | 3-Mark Questions", cover_note)],
    [SP(10)],
    [Paragraph("★ High-Yield & Important Topics Highlighted ★", S("CvHL",
        fontSize=11, leading=14, textColor=GOLD, alignment=TA_CENTER,
        fontName="Helvetica-Bold"))],
], colWidths=[174*mm]))

story.append(SP(20))
cover_info = [
    ["Topics Covered:", "6 Core Ophthalmology Chapters"],
    ["Source:", "Kanski's Clinical Ophthalmology 10e, Wills Eye Manual"],
    ["Exam Body:", "RGUHS Karnataka – Phase III Part I"],
    ["Prepared by:", "Orris AI Medical Assistant"],
]
tbl = Table(cover_info, colWidths=[50*mm, 124*mm])
tbl.setStyle(TableStyle([
    ("BACKGROUND",(0,0),(0,-1), MED_BLUE),
    ("BACKGROUND",(1,0),(1,-1), LIGHT_BLUE),
    ("TEXTCOLOR",(0,0),(0,-1), WHITE),
    ("TEXTCOLOR",(1,0),(1,-1), DARK_BLUE),
    ("FONTNAME",(0,0),(-1,-1),"Helvetica-Bold"),
    ("FONTSIZE",(0,0),(-1,-1),9),
    ("TOPPADDING",(0,0),(-1,-1),6),
    ("BOTTOMPADDING",(0,0),(-1,-1),6),
    ("LEFTPADDING",(0,0),(-1,-1),8),
    ("GRID",(0,0),(-1,-1),0.5,WHITE),
]))
story.append(tbl)
story.append(PageBreak())

# ── TABLE OF CONTENTS ─────────────────────────────────────────────────────────
story.append(chapter_banner("📋  TABLE OF CONTENTS", MED_BLUE))
story.append(SP(10))
toc_items = [
    ("1", "Ocular Injuries", "Blunt trauma, chemical burns, corneal FB, sympathetic ophthalmia"),
    ("2", "Diseases of Uveal Tract", "Uveitis, iridocyclitis, choroiditis, Vogt-Koyanagi-Harada"),
    ("3", "Neuro-Ophthalmology", "Optic neuritis, optic atrophy, papilloedema, Argyll Robertson pupil"),
    ("4", "Disease of Lacrimal Apparatus", "Dacryocystitis, dry eye, DCR, epiphora"),
    ("5", "Disorders of Eyelids", "Ptosis, entropion, ectropion, chalazion, blepharitis, trichiasis"),
    ("6", "Squint and its Disorders", "Esotropia, exotropia, amblyopia, paralytic squint"),
]
for num, title, sub in toc_items:
    row_tbl = Table([
        [Paragraph(f"<b>Chapter {num}</b>", S(f"TN{num}", fontSize=10,
            textColor=WHITE, fontName="Helvetica-Bold", alignment=TA_CENTER, leading=13)),
         Paragraph(f"<b>{title}</b>", S(f"TT{num}", fontSize=10,
            textColor=DARK_BLUE, fontName="Helvetica-Bold", leading=13)),
         Paragraph(sub, S(f"TS{num}", fontSize=8.5, textColor=HexColor("#475569"),
            fontName="Helvetica-Oblique", leading=11)),
        ]
    ], colWidths=[22*mm, 52*mm, 100*mm])
    row_tbl.setStyle(TableStyle([
        ("BACKGROUND",(0,0),(0,0), MED_BLUE),
        ("BACKGROUND",(1,0),(-1,0), GREY_BG),
        ("TOPPADDING",(0,0),(-1,-1),5),
        ("BOTTOMPADDING",(0,0),(-1,-1),5),
        ("LEFTPADDING",(0,0),(-1,-1),8),
        ("LINEBELOW",(0,0),(-1,-1),0.5,GREY_LINE),
        ("VALIGN",(0,0),(-1,-1),"MIDDLE"),
    ]))
    story.append(row_tbl)
story.append(PageBreak())

# ══════════════════════════════════════════════════════════════════════════════
# CHAPTER 1 – OCULAR INJURIES
# ══════════════════════════════════════════════════════════════════════════════
story.append(chapter_banner("CHAPTER 1 — OCULAR INJURIES", DARK_BLUE))
story.append(SP(8))
story.append(imp_box("RGUHS Frequency: Blunt Injury to Eye (10M) | Sympathetic Ophthalmia (5M) | Chemical Burns (5M) | Corneal Foreign Body (3M) | Berlin's Oedema (3M)"))
story.append(SP(6))

# Questions table
story.append(section_label("RGUHS PREVIOUS YEAR QUESTIONS", MED_BLUE))
story.append(SP(4))
story.append(q_row(10, "Describe the various effects of blunt injury on the eye. (RGUHS 2012, 2009, 2013)", important=True))
story.append(q_row(10, "Classify ocular injuries. Describe clinical features and management of chemical burns of the eye.", important=True))
story.append(q_row(5, "Sympathetic ophthalmia – etiology, clinical features, management", important=True))
story.append(q_row(5, "Corneal foreign body – clinical features and management"))
story.append(q_row(5, "Traumatic cataract – causes, features, management"))
story.append(q_row(5, "Intraocular foreign body (IOFB) – clinical features and removal"))
story.append(q_row(3, "Berlin's oedema (Commotio retinae)", important=True))
story.append(q_row(3, "Hyphema – definition, grading, management"))
story.append(q_row(3, "Blow-out fracture of orbit"))
story.append(q_row(3, "Tetanus prophylaxis in ocular injuries"))
story.append(SP(6))

story.append(section_label("CLASSIFICATION OF OCULAR INJURIES", HexColor("#374151")))
story.append(SP(4))

classif_data = [
    ["Type", "Mechanism", "Examples"],
    ["Mechanical", "Blunt / Penetrating", "Contusion, laceration, IOFB, ruptured globe"],
    ["Chemical", "Acid / Alkali", "Lime burns (most common alkali), battery acid"],
    ["Thermal", "Heat / Cold", "Flash burns, arc eye"],
    ["Radiation", "UV, IR, X-ray", "Photokeratitis, cataract"],
]
tbl = Table(classif_data, colWidths=[35*mm, 45*mm, 94*mm])
tbl.setStyle(TableStyle([
    ("BACKGROUND",(0,0),(-1,0), DARK_BLUE),
    ("TEXTCOLOR",(0,0),(-1,0), WHITE),
    ("FONTNAME",(0,0),(-1,0),"Helvetica-Bold"),
    ("FONTNAME",(0,1),(-1,-1),"Helvetica"),
    ("FONTSIZE",(0,0),(-1,-1),9),
    ("BACKGROUND",(0,1),(-1,1), GREY_BG),
    ("BACKGROUND",(0,3),(-1,3), GREY_BG),
    ("GRID",(0,0),(-1,-1),0.5,GREY_LINE),
    ("TOPPADDING",(0,0),(-1,-1),5),
    ("BOTTOMPADDING",(0,0),(-1,-1),5),
    ("LEFTPADDING",(0,0),(-1,-1),6),
    ("VALIGN",(0,0),(-1,-1),"MIDDLE"),
]))
story.append(tbl)
story.append(SP(8))

story.append(H2("1.1 Blunt (Contusion) Injuries"))
story.append(imp_box("Most asked RGUHS topic – know ALL effects by structure (anterior to posterior)"))
story.append(SP(4))

effects_data = [
    ["Structure", "Effects of Blunt Trauma"],
    ["Eyelids", "Ecchymosis (black eye), oedema, laceration"],
    ["Conjunctiva", "Subconjunctival haemorrhage, chemosis"],
    ["Cornea", "Corneal abrasion, oedema, Descemet's folds"],
    ["Anterior Chamber", "Hyphema (blood in AC) – grade 1-4"],
    ["Iris", "Iridodialysis (root tear), iridoplegia (mydriasis), iris rupture"],
    ["Ciliary body", "Cyclodialysis, hypotony"],
    ["Lens", "Subluxation/dislocation, traumatic cataract (rosette), Vossius ring"],
    ["Vitreous", "Vitreous haemorrhage"],
    ["Retina", "Berlin's oedema (commotio retinae), retinal detachment, choroidal rupture"],
    ["Optic nerve", "Avulsion, traumatic optic neuropathy"],
    ["Sclera", "Scleral rupture (usually at limbus or posterior to muscle insertion)"],
]
tbl = Table(effects_data, colWidths=[40*mm, 134*mm])
tbl.setStyle(TableStyle([
    ("BACKGROUND",(0,0),(-1,0), MED_BLUE),
    ("TEXTCOLOR",(0,0),(-1,0), WHITE),
    ("FONTNAME",(0,0),(-1,0),"Helvetica-Bold"),
    ("FONTNAME",(0,1),(0,-1),"Helvetica-Bold"),
    ("FONTSIZE",(0,0),(-1,-1),9),
    ("GRID",(0,0),(-1,-1),0.5,GREY_LINE),
    ("BACKGROUND",(0,1),(-1,1), LIGHT_BLUE),
    ("BACKGROUND",(0,3),(-1,3), LIGHT_BLUE),
    ("BACKGROUND",(0,5),(-1,5), LIGHT_BLUE),
    ("BACKGROUND",(0,7),(-1,7), LIGHT_BLUE),
    ("BACKGROUND",(0,9),(-1,9), LIGHT_BLUE),
    ("BACKGROUND",(0,11),(-1,11), LIGHT_BLUE),
    ("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(tbl)
story.append(SP(6))

story.append(H2("1.2 Chemical Burns"))
story.append(imp_box("Alkali burns are MORE dangerous than acid burns – alkali penetrates deeper (saponification of fatty acids)"))
story.append(SP(4))

chem_data = [
    ["Feature", "Acid Burns", "Alkali Burns"],
    ["Mechanism", "Coagulative necrosis (self-limiting)", "Liquefactive necrosis (progressive penetration)"],
    ["Penetration", "Superficial – eschar limits spread", "Deep – penetrates all layers"],
    ["Common agents", "Battery acid (H₂SO₄), HCl", "Lime (Ca(OH)₂), NaOH, NH₃"],
    ["Prognosis", "Better", "Worse"],
]
tbl = Table(chem_data, colWidths=[30*mm, 70*mm, 74*mm])
tbl.setStyle(TableStyle([
    ("BACKGROUND",(0,0),(-1,0), ACCENT),
    ("TEXTCOLOR",(0,0),(-1,0), WHITE),
    ("FONTNAME",(0,0),(-1,0),"Helvetica-Bold"),
    ("FONTNAME",(0,1),(0,-1),"Helvetica-Bold"),
    ("FONTSIZE",(0,0),(-1,-1),9),
    ("GRID",(0,0),(-1,-1),0.5,GREY_LINE),
    ("BACKGROUND",(0,2),(-1,2), GREY_BG),
    ("BACKGROUND",(0,4),(-1,4), GREY_BG),
    ("TOPPADDING",(0,0),(-1,-1),5),
    ("BOTTOMPADDING",(0,0),(-1,-1),5),
    ("LEFTPADDING",(0,0),(-1,-1),6),
    ("VALIGN",(0,0),(-1,-1),"MIDDLE"),
]))
story.append(tbl)
story.append(SP(4))

story.append(H3("Roper-Hall Classification (Chemical Burns Grading)"))
grade_data = [
    ["Grade", "Cornea", "Limbal Ischaemia", "Prognosis"],
    ["I", "Epithelial erosion only", "0%", "Good"],
    ["II", "Hazy – iris visible", "< 1/3", "Good"],
    ["III", "Total epithelial loss, hazy stromal", "1/3 to 1/2", "Guarded"],
    ["IV", "Opaque – iris not visible", "> 1/2", "Poor"],
]
tbl = Table(grade_data, colWidths=[15*mm, 60*mm, 40*mm, 59*mm])
tbl.setStyle(TableStyle([
    ("BACKGROUND",(0,0),(-1,0), DARK_BLUE),
    ("TEXTCOLOR",(0,0),(-1,0), WHITE),
    ("FONTNAME",(0,0),(-1,0),"Helvetica-Bold"),
    ("FONTSIZE",(0,0),(-1,-1),9),
    ("GRID",(0,0),(-1,-1),0.5,GREY_LINE),
    ("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(tbl)
story.append(SP(4))
story.append(H3("Management of Chemical Burns"))
story.append(B("FIRST AID: Immediate copious irrigation with water/normal saline for at least 20–30 min (most important step)"))
story.append(B("Remove particulate lime particles with moist swab"))
story.append(B("Check pH – target normal (7.4)"))
story.append(B("Topical antibiotics, cycloplegics (atropine 1%), steroids (first 7–10 days)"))
story.append(B("Vitamin C (ascorbic acid) – reduces ulceration (inhibits collagenase)"))
story.append(B("Citric acid drops – inhibit PMN migration, reduce inflammation"))
story.append(B("Long-term: amniotic membrane transplant, limbal stem cell transplant, keratoplasty"))
story.append(SP(6))

story.append(H2("1.3 Sympathetic Ophthalmia"))
story.append(imp_box("5-mark question – Bilateral granulomatous panuveitis after penetrating injury to one eye"))
story.append(SP(4))
story.append(B("Exciting eye: injured/operated eye (source of antigen)"))
story.append(B("Sympathizing eye: fellow eye that develops sympathetic inflammation"))
story.append(B("Latent period: 2 weeks to years (most common: 4–8 weeks); rare < 2 weeks"))
story.append(B("Pathology: T-cell mediated autoimmune reaction to uveal antigens (melanin)"))
story.append(B("Pathology: Dalen-Fuchs nodules (epithelioid cell collections between Bruch's membrane and RPE)"))
story.append(B("Clinical features: Bilateral granulomatous uveitis, mutton-fat KP, Dalen-Fuchs nodules, papilloedema"))
story.append(B("Treatment: Enucleation of exciting eye within 2 weeks prevents sympathetic ophthalmia"))
story.append(B("After onset: topical + systemic steroids, immunosuppressants (azathioprine, cyclosporine)"))
story.append(SP(6))

story.append(H2("1.4 Penetrating / Perforating Ocular Injuries"))
story.append(B("Signs: flat/deep AC, peaked/irregular pupil, iris prolapse, positive Seidel test (fluorescein streaming)"))
story.append(B("Management: Hard shield (no patch), NPO, systemic antibiotics (cefazolin + ciprofloxacin), tetanus toxoid"))
story.append(B("Surgical repair as soon as possible"))
story.append(B("Enucleation of non-viable eye within 7–14 days to prevent sympathetic ophthalmia"))
story.append(SP(4))
story.append(H3("Hyphema Grading"))
hyph = [
    ["Grade", "Blood Fill (AC)", "Management"],
    ["0 (Microhyphema)", "RBCs visible, no layering", "Conservative"],
    ["Grade I", "< 1/3 of AC", "Bed rest, eye shield, cycloplegic, avoid NSAIDs"],
    ["Grade II", "1/3 to 1/2 of AC", "As above + aminocaproic acid"],
    ["Grade III", "> 1/2 of AC", "Surgical evacuation if IOP uncontrolled"],
    ["Grade IV (8-ball)", "Total AC fill", "Urgent surgical evacuation"],
]
tbl = Table(hyph, colWidths=[32*mm, 52*mm, 90*mm])
tbl.setStyle(TableStyle([
    ("BACKGROUND",(0,0),(-1,0), MED_BLUE),
    ("TEXTCOLOR",(0,0),(-1,0), WHITE),
    ("FONTNAME",(0,0),(-1,0),"Helvetica-Bold"),
    ("FONTSIZE",(0,0),(-1,-1),9),
    ("GRID",(0,0),(-1,-1),0.5,GREY_LINE),
    ("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(tbl)
story.append(PageBreak())

# ══════════════════════════════════════════════════════════════════════════════
# CHAPTER 2 – DISEASES OF UVEAL TRACT
# ══════════════════════════════════════════════════════════════════════════════
story.append(chapter_banner("CHAPTER 2 — DISEASES OF UVEAL TRACT", HexColor("#7c3aed")))
story.append(SP(8))
story.append(imp_box("RGUHS Frequency: Acute Iridocyclitis (10M – VERY IMPORTANT) | Classify Uveitis (5M) | Sympathetic Ophthalmia (5M) | Enumerate parts of uveal tract (3M) | VKH syndrome (3M)"))
story.append(SP(6))

story.append(section_label("RGUHS PREVIOUS YEAR QUESTIONS", HexColor("#7c3aed")))
story.append(SP(4))
story.append(q_row(10, "Discuss the clinical features, causes and complications of acute iridocyclitis. (RGUHS 2013, 2010, 2009)", important=True))
story.append(q_row(10, "Classify Uveitis and discuss etiology, clinical features and management of acute iridocyclitis. (RGUHS 2010)", important=True))
story.append(q_row(5, "Sympathetic ophthalmia – pathology, features, treatment", important=True))
story.append(q_row(5, "Vogt-Koyanagi-Harada (VKH) syndrome"))
story.append(q_row(5, "Posterior uveitis – causes, features"))
story.append(q_row(3, "Enumerate parts of uveal tract", important=True))
story.append(q_row(3, "VKH syndrome – short note"))
story.append(q_row(3, "Mutton fat KP – significance"))
story.append(q_row(3, "Causes of uveitis in AIDS"))
story.append(SP(6))

story.append(H2("2.1 Uveal Tract – Introduction"))
story.append(B("Uveal tract = Iris + Ciliary body + Choroid (vascular coat of eye)"))
story.append(B("Main functions: Nutrion of avascular structures, accommodation, aqueous production, regulation of light"))
story.append(SP(4))

story.append(H2("2.2 Classification of Uveitis"))
uv_class = [
    ["Type", "Location", "Examples"],
    ["Anterior uveitis", "Iris + anterior ciliary body", "Iritis, iridocyclitis"],
    ["Intermediate uveitis", "Posterior ciliary body, peripheral retina", "Pars planitis, peripheral uveitis"],
    ["Posterior uveitis", "Choroid + retina", "Choroiditis, retinochoroiditis"],
    ["Panuveitis", "Entire uveal tract", "Sympathetic ophthalmia, VKH, sarcoidosis"],
]
tbl = Table(uv_class, colWidths=[38*mm, 58*mm, 78*mm])
tbl.setStyle(TableStyle([
    ("BACKGROUND",(0,0),(-1,0), HexColor("#7c3aed")),
    ("TEXTCOLOR",(0,0),(-1,0), WHITE),
    ("FONTNAME",(0,0),(-1,0),"Helvetica-Bold"),
    ("FONTNAME",(0,1),(0,-1),"Helvetica-Bold"),
    ("FONTSIZE",(0,0),(-1,-1),9),
    ("GRID",(0,0),(-1,-1),0.5,GREY_LINE),
    ("BACKGROUND",(0,2),(-1,2), GREY_BG),
    ("BACKGROUND",(0,4),(-1,4), GREY_BG),
    ("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(tbl)
story.append(SP(6))

story.append(H2("2.3 Acute Anterior Uveitis (Iridocyclitis)"))
story.append(imp_box("Most frequently asked RGUHS 10-mark question – know fully"))
story.append(SP(4))
story.append(H3("Etiology"))
etio_data = [
    ["Category", "Causes"],
    ["Exogenous", "Trauma, surgery, corneal ulcer"],
    ["Endogenous (infectious)", "TB, syphilis, herpes simplex/zoster, toxoplasmosis, brucellosis"],
    ["Endogenous (non-infectious)", "HLA-B27 conditions (AS, Reiter's, IBD, psoriatic arthritis), sarcoidosis, JIA"],
    ["Idiopathic", "Most common (50%)"],
]
tbl = Table(etio_data, colWidths=[42*mm, 132*mm])
tbl.setStyle(TableStyle([
    ("BACKGROUND",(0,0),(-1,0), MED_BLUE),
    ("TEXTCOLOR",(0,0),(-1,0), WHITE),
    ("FONTNAME",(0,0),(-1,0),"Helvetica-Bold"),
    ("FONTNAME",(0,1),(0,-1),"Helvetica-Bold"),
    ("FONTSIZE",(0,0),(-1,-1),9),
    ("GRID",(0,0),(-1,-1),0.5,GREY_LINE),
    ("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(tbl)
story.append(SP(4))

story.append(H3("Clinical Features"))
story.append(B("Symptoms: Pain (dull aching), photophobia, lacrimation, blurred vision, consensual photophobia"))
story.append(B("Signs – Critical: Ciliary flush (perilimbal injection), cells and flare in AC, KP on corneal endothelium"))
story.append(B("Keratic Precipitates (KP):"))
story.append(T("  - Small/fine KP: Non-granulomatous (HLA-B27, Fuchs, Posner-Schlossman, herpes)"))
story.append(T("  - Large 'mutton-fat' KP: Granulomatous (TB, sarcoid, syphilis, sympathetic ophthalmia, VKH)"))
story.append(B("Posterior synechiae: Adhesion of iris to anterior lens capsule → irregular pupil, Seclusio pupillae, Occlusio pupillae"))
story.append(B("Other features: Hypopyon, iris bombe (360° PS), secondary glaucoma, complicated cataract (stellate posterior subcapsular)"))
story.append(SP(4))

story.append(H3("Grading of AC Cells (Standardization of Uveitis Nomenclature – SUN)"))
cell_data = [
    ["Grade", "Cells per 1×1 mm field"],
    ["0", "< 1"], ["0.5+", "1–5"], ["1+", "6–15"],
    ["2+", "16–25"], ["3+", "26–50"], ["4+", "> 50"],
]
tbl = Table(cell_data, colWidths=[30*mm, 144*mm])
tbl.setStyle(TableStyle([
    ("BACKGROUND",(0,0),(-1,0), MED_BLUE),
    ("TEXTCOLOR",(0,0),(-1,0), WHITE),
    ("FONTNAME",(0,0),(-1,0),"Helvetica-Bold"),
    ("FONTSIZE",(0,0),(-1,-1),9),
    ("GRID",(0,0),(-1,-1),0.5,GREY_LINE),
    ("TOPPADDING",(0,0),(-1,-1),3),
    ("BOTTOMPADDING",(0,0),(-1,-1),3),
    ("LEFTPADDING",(0,0),(-1,-1),6),
    ("VALIGN",(0,0),(-1,-1),"MIDDLE"),
]))
story.append(tbl)
story.append(SP(4))

story.append(H3("Management"))
story.append(B("Topical steroids: Prednisolone acetate 1% – hourly initially, taper over 4–6 weeks"))
story.append(B("Cycloplegics: Atropine 1% or homatropine – prevents posterior synechiae, relieves ciliary spasm"))
story.append(B("Systemic steroids: For severe/refractory cases"))
story.append(B("Treat underlying cause (anti-TB, antivirals, etc.)"))
story.append(B("Complications: Secondary glaucoma, complicated cataract, band keratopathy, cystoid macular oedema"))
story.append(SP(4))

story.append(H2("2.4 Vogt-Koyanagi-Harada (VKH) Syndrome"))
story.append(imp_box("3-mark short note – know the 4 phases and features"))
story.append(SP(4))
story.append(B("Bilateral granulomatous panuveitis + extraocular manifestations"))
story.append(B("More common in Asians, Hispanics; autoimmune against melanocytes"))
story.append(B("Phases: (1) Prodromal – meningismus, headache, tinnitus (2) Uveitic – bilateral panuveitis, exudative RD (3) Convalescent – vitiligo, poliosis, alopecia (4) Recurrent"))
story.append(B("Fundus: Sunset glow fundus (orange discoloration), Dalen-Fuchs nodules"))
story.append(B("Treatment: High-dose systemic steroids, long-term immunosuppression"))
story.append(PageBreak())

# ══════════════════════════════════════════════════════════════════════════════
# CHAPTER 3 – NEURO-OPHTHALMOLOGY
# ══════════════════════════════════════════════════════════════════════════════
story.append(chapter_banner("CHAPTER 3 — NEURO-OPHTHALMOLOGY", HexColor("#065f46")))
story.append(SP(8))
story.append(imp_box("RGUHS Frequency: Optic Atrophy (10M & 5M) | Papilloedema (5M) | Retrobulbar Neuritis (5M) | Argyll Robertson Pupil (3M) | Tobacco Amblyopia (5M)"))
story.append(SP(6))

story.append(section_label("RGUHS PREVIOUS YEAR QUESTIONS", HexColor("#065f46")))
story.append(SP(4))
story.append(q_row(10, "Describe optic atrophy – classification, clinical features, management. (RGUHS multiple years)", important=True))
story.append(q_row(5, "Describe the fundus picture in primary optic atrophy. Name 2 causes. (RGUHS 2013)", important=True))
story.append(q_row(5, "Retrobulbar neuritis (Retrobulbar optic neuritis) – features and management", important=True))
story.append(q_row(5, "Papilloedema – causes, clinical features, differentiation from papillitis", important=True))
story.append(q_row(5, "Tobacco (nutritional) amblyopia – features and management"))
story.append(q_row(5, "Cavernous sinus thrombosis – draw labelled diagram and describe"))
story.append(q_row(3, "Argyll Robertson pupil – features and causes", important=True))
story.append(q_row(3, "Consecutive optic atrophy"))
story.append(q_row(3, "Marcus Gunn pupil (RAPD)"))
story.append(q_row(3, "Visual field defects in optic pathway lesions"))
story.append(SP(6))

story.append(H2("3.1 Optic Neuritis"))
story.append(B("Inflammation of the optic nerve – can involve the optic nerve head (papillitis) or behind the disc (retrobulbar neuritis)"))
story.append(B("Most common cause: Multiple sclerosis (demyelination)"))
story.append(B("Other causes: TB, syphilis, diabetes, viral infections, methanol poisoning"))
story.append(SP(4))

on_diff = [
    ["Feature", "Papillitis", "Retrobulbar Neuritis"],
    ["Disc appearance", "Swollen, hyperaemic", "Normal initially (NOTHING to see)"],
    ["Vision loss", "Central scotoma + blurred disc", "Central scotoma, disc normal"],
    ["Pain on eye movement", "Less prominent", "Very prominent"],
    ["Association", "Children, post-viral", "Adults, MS (50–80%)"],
    ["Classic saying", "–", "Patient sees nothing, doctor sees nothing"],
]
tbl = Table(on_diff, colWidths=[38*mm, 68*mm, 68*mm])
tbl.setStyle(TableStyle([
    ("BACKGROUND",(0,0),(-1,0), HexColor("#065f46")),
    ("TEXTCOLOR",(0,0),(-1,0), WHITE),
    ("FONTNAME",(0,0),(-1,0),"Helvetica-Bold"),
    ("FONTNAME",(0,1),(0,-1),"Helvetica-Bold"),
    ("FONTSIZE",(0,0),(-1,-1),9),
    ("GRID",(0,0),(-1,-1),0.5,GREY_LINE),
    ("BACKGROUND",(0,2),(-1,2), GREY_BG),
    ("BACKGROUND",(0,4),(-1,4), GREY_BG),
    ("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(tbl)
story.append(SP(4))

story.append(H3("Clinical Features of Optic Neuritis"))
story.append(B("Sudden unilateral visual loss (hours to days)"))
story.append(B("Pain on eye movement (periocular pain)"))
story.append(B("Central or paracentral scotoma"))
story.append(B("RAPD (relative afferent pupillary defect) = Marcus Gunn pupil"))
story.append(B("Reduced colour vision (especially red desaturation)"))
story.append(B("Uhthoff's phenomenon: Vision worsens with heat/exercise"))
story.append(B("Pulfrich phenomenon: Moving objects appear to move in curved arc"))
story.append(H3("Management"))
story.append(B("IV methylprednisolone 1g/day × 3 days → oral prednisolone 1 mg/kg × 11 days (Optic Neuritis Treatment Trial – ONTT)"))
story.append(B("Hastens recovery but does not improve final visual outcome"))
story.append(B("MRI brain: to assess for MS plaques (periventricular white matter)"))
story.append(SP(6))

story.append(H2("3.2 Optic Atrophy"))
story.append(imp_box("RGUHS 10-mark: Primary vs Secondary vs Consecutive – know the fundus appearance"))
story.append(SP(4))
story.append(T("Optic atrophy = end-stage degeneration of optic nerve axons from retina to lateral geniculate body"))
story.append(SP(4))

oa_types = [
    ["Type", "Disc Appearance", "Causes"],
    ["Primary", "Flat, chalk-white, sharp margins, few vessels", "Compression (tumour, aneurysm), toxic (methanol, tobacco, quinine), demyelination, nutritional, hereditary (Leber's)"],
    ["Secondary", "Dirty grey disc, blurred margins (Paton's lines)", "Post-papilloedema, post-papillitis – from chronic disc swelling"],
    ["Consecutive/ Ascending", "Pallor – waxy disc", "Retinal causes: CRAO, retinitis pigmentosa, CRVO, diffuse chorioretinitis"],
    ["Glaucomatous", "Cupped disc, bean pot cupping, laminar dot sign", "Chronic open angle glaucoma"],
]
tbl = Table(oa_types, colWidths=[32*mm, 60*mm, 82*mm])
tbl.setStyle(TableStyle([
    ("BACKGROUND",(0,0),(-1,0), HexColor("#065f46")),
    ("TEXTCOLOR",(0,0),(-1,0), WHITE),
    ("FONTNAME",(0,0),(-1,0),"Helvetica-Bold"),
    ("FONTNAME",(0,1),(0,-1),"Helvetica-Bold"),
    ("FONTSIZE",(0,0),(-1,-1),9),
    ("GRID",(0,0),(-1,-1),0.5,GREY_LINE),
    ("BACKGROUND",(0,2),(-1,2), GREY_BG),
    ("BACKGROUND",(0,4),(-1,4), GREY_BG),
    ("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(tbl)
story.append(SP(6))

story.append(H2("3.3 Papilloedema"))
story.append(imp_box("5-mark: Bilateral disc swelling due to raised ICP – NOT loss of vision early (vs papillitis which causes early visual loss)"))
story.append(SP(4))
story.append(H3("Causes"))
story.append(B("Raised ICP: Space-occupying lesion (tumour, abscess), hydrocephalus, benign intracranial hypertension (BIH)"))
story.append(B("Malignant hypertension"))
story.append(B("Cavernous sinus thrombosis"))
story.append(B("Central retinal vein occlusion (unilateral)"))
story.append(H3("Differentiation: Papilloedema vs Papillitis"))
pp_diff = [
    ["Feature", "Papilloedema", "Papillitis"],
    ["Laterality", "Bilateral", "Usually unilateral"],
    ["Vision", "Normal early, late loss", "Early, marked visual loss"],
    ["Visual field", "Enlarged blind spot", "Central scotoma"],
    ["Pain", "No pain on movement", "Pain on eye movement"],
    ["Cause", "Raised ICP", "Optic nerve inflammation"],
    ["Disc", "Swollen, hyperaemic, haemorrhages", "Swollen, hyperaemic"],
]
tbl = Table(pp_diff, colWidths=[35*mm, 70*mm, 69*mm])
tbl.setStyle(TableStyle([
    ("BACKGROUND",(0,0),(-1,0), MED_BLUE),
    ("TEXTCOLOR",(0,0),(-1,0), WHITE),
    ("FONTNAME",(0,0),(-1,0),"Helvetica-Bold"),
    ("FONTNAME",(0,1),(0,-1),"Helvetica-Bold"),
    ("FONTSIZE",(0,0),(-1,-1),9),
    ("GRID",(0,0),(-1,-1),0.5,GREY_LINE),
    ("BACKGROUND",(0,2),(-1,2), GREY_BG),
    ("BACKGROUND",(0,4),(-1,4), GREY_BG),
    ("BACKGROUND",(0,6),(-1,6), GREY_BG),
    ("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(tbl)
story.append(SP(6))

story.append(H2("3.4 Argyll Robertson Pupil"))
story.append(imp_box("3-mark classic question – caused by syphilis (neurosyphilis)"))
story.append(SP(4))
story.append(B("Small, irregular, miotic pupils"))
story.append(B("Light-near dissociation: No reaction to light BUT near reflex preserved ('accommodates but does not react')"))
story.append(B("Lesion: Dorsal midbrain (periaqueductal area) – pupil light fibres affected, near-reflex fibres spared"))
story.append(B("Causes: Neurosyphilis (classic), diabetes, MS, Parinaud's syndrome (supranuclear lesion – near but NOT light)"))
story.append(PageBreak())

# ══════════════════════════════════════════════════════════════════════════════
# CHAPTER 4 – LACRIMAL APPARATUS
# ══════════════════════════════════════════════════════════════════════════════
story.append(chapter_banner("CHAPTER 4 — DISEASES OF LACRIMAL APPARATUS", HexColor("#9a3412")))
story.append(SP(8))
story.append(imp_box("RGUHS Frequency: Congenital Dacryocystitis (10M & 3M) | Acute Dacryocystitis (5M – 2024 exam) | Dry Eye (5M & 3M) | DCR diagram (5M)"))
story.append(SP(6))

story.append(section_label("RGUHS PREVIOUS YEAR QUESTIONS", HexColor("#9a3412")))
story.append(SP(4))
story.append(q_row(10, "Draw a labelled diagram of lacrimal apparatus and describe management of congenital dacryocystitis. (RGUHS 2010, 2009)", important=True))
story.append(q_row(10, "Describe clinical features and treatment of acute dacryocystitis. (RGUHS 2024 Jan)", important=True))
story.append(q_row(5, "Congenital dacryocystitis – clinical features and management"))
story.append(q_row(5, "Dacryocystorhinostomy (DCR) – indications, procedure, complications", important=True))
story.append(q_row(5, "Dry eye – causes, classification, diagnosis and treatment"))
story.append(q_row(3, "Congenital dacryocystitis (short note)", important=True))
story.append(q_row(3, "Dry eye (short note)"))
story.append(q_row(3, "Epiphora – causes and approach"))
story.append(SP(6))

story.append(H2("4.1 Lacrimal Apparatus – Anatomy"))
story.append(B("Secretory: Lacrimal gland (main) + accessory glands of Krause & Wolfring"))
story.append(B("Drainage: Puncta → Canaliculi (superior + inferior) → Common canaliculus → Lacrimal sac → Nasolacrimal duct → Inferior meatus (under inferior turbinate)"))
story.append(B("Valve of Hasner: Lower end of nasolacrimal duct – site of congenital obstruction"))
story.append(SP(4))

story.append(H2("4.2 Dacryocystitis"))
story.append(H3("Congenital Dacryocystitis"))
story.append(imp_box("Most important – obstruction at Valve of Hasner (lower end of NLD)"))
story.append(SP(4))
story.append(B("Cause: Failure of canalization of nasolacrimal duct at birth → persistent membrane at Valve of Hasner"))
story.append(B("Presentation: Epiphora + mucopurulent discharge from day 2–3 of life (before onset = amniotic fluid)"))
story.append(B("Regurgitation test: Pressure over lacrimal sac → mucopurulent material regurgitates from puncta"))
story.append(H3("Management (Step-ladder approach)"))
story.append(B("1. Lacrimal sac massage (Crigler's method) – downward pressure to force mucus through valve → 95% resolve by 1 year"))
story.append(B("2. Topical antibiotics – to control secondary infection"))
story.append(B("3. Probing (syringing and probing) – at 6–12 months if no resolution; success rate 95% < 1 year"))
story.append(B("4. DCR (Dacryocystorhinostomy) – if probing fails, or > 3 years age"))
story.append(SP(4))

story.append(H3("Acute Dacryocystitis"))
story.append(B("Cause: Obstruction of NLD → secondary infection (Staph aureus, Streptococcus most common)"))
story.append(B("Clinical features: Pain, redness, tender swelling at medial canthus below medial canthal tendon, epiphora, fever"))
story.append(B("May progress to abscess (pointing abscess)"))
story.append(B("Management: Warm compresses + systemic antibiotics (flucloxacillin/amoxicillin-clavulanate) → I&D if abscess → DCR after acute phase"))
story.append(B("Syringing and probing CONTRAINDICATED in acute phase"))
story.append(SP(4))

story.append(H3("Chronic Dacryocystitis"))
story.append(B("Presentation: Epiphora, recurrent mucopurulent discharge, mucocoele at inner canthus"))
story.append(B("Treatment: DCR (Gold standard)"))
story.append(SP(4))

story.append(H2("4.3 Dacryocystorhinostomy (DCR)"))
story.append(B("Definition: Surgical procedure creating anastomosis between lacrimal sac and nasal cavity (middle meatus)"))
story.append(B("Indications: Chronic dacryocystitis, mucocoele, failed probing in congenital obstruction, NLD stricture"))
story.append(B("Approaches: External DCR (Toti's operation – gold standard), Endonasal DCR, Endoscopic DCR"))
story.append(B("Complications: Haemorrhage, CSF leak, wound infection, failure"))
story.append(SP(4))

story.append(H2("4.4 Dry Eye (Keratoconjunctivitis Sicca)"))
story.append(imp_box("5-mark question – know Schirmer's test and rose bengal staining"))
story.append(SP(4))
story.append(B("Causes: Sjögren's syndrome (primary/secondary), post-menopausal state, medications (antihistamines, β-blockers), radiation, neurotrophic"))
story.append(B("Tear film layers (outer to inner): Lipid (meibomian) → Aqueous (lacrimal) → Mucin (goblet cells)"))
story.append(B("Symptoms: Foreign body sensation, burning, dryness, paradoxical epiphora (reflex tearing), blurred vision"))
story.append(H3("Tests for Dry Eye"))
test_data = [
    ["Test", "Method", "Normal Value", "Interpretation"],
    ["Schirmer's Test I (no anaesthesia)", "Filter paper in lower fornix × 5 min", "> 15 mm", "< 10 mm = dry eye; 5–10 mm = borderline"],
    ["Schirmer's Test II (with anaesthesia)", "After topical anaesthetic", "> 5 mm", "Tests basic/reflex secretion"],
    ["Rose Bengal staining", "1% rose bengal drops", "No staining", "Stains dead/devitalized epithelial cells"],
    ["Tear Break-up Time (TBUT)", "Fluorescein, slit lamp", "> 10 sec", "< 10 sec = deficient mucin/lipid"],
    ["Lissamine green", "Similar to rose bengal", "No staining", "Less irritating than rose bengal"],
]
tbl = Table(test_data, colWidths=[38*mm, 45*mm, 28*mm, 63*mm])
tbl.setStyle(TableStyle([
    ("BACKGROUND",(0,0),(-1,0), HexColor("#9a3412")),
    ("TEXTCOLOR",(0,0),(-1,0), WHITE),
    ("FONTNAME",(0,0),(-1,0),"Helvetica-Bold"),
    ("FONTNAME",(0,1),(0,-1),"Helvetica-Bold"),
    ("FONTSIZE",(0,0),(-1,-1),8.5),
    ("GRID",(0,0),(-1,-1),0.5,GREY_LINE),
    ("BACKGROUND",(0,2),(-1,2), GREY_BG),
    ("BACKGROUND",(0,4),(-1,4), GREY_BG),
    ("TOPPADDING",(0,0),(-1,-1),3),
    ("BOTTOMPADDING",(0,0),(-1,-1),3),
    ("LEFTPADDING",(0,0),(-1,-1),5),
    ("VALIGN",(0,0),(-1,-1),"MIDDLE"),
]))
story.append(tbl)
story.append(SP(4))
story.append(H3("Management"))
story.append(B("Mild: Artificial tears (hydroxyethylcellulose, carboxymethylcellulose) – preservative-free preferred"))
story.append(B("Moderate: Frequent artificial tears, cyclosporine 0.05% topical, punctal plugs"))
story.append(B("Severe: Moisture chamber glasses, autologous serum drops, scleral lenses"))
story.append(B("Underlying condition: Treat Sjögren's syndrome, pilocarpine (secretagogue)"))
story.append(PageBreak())

# ══════════════════════════════════════════════════════════════════════════════
# CHAPTER 5 – DISORDERS OF EYELIDS
# ══════════════════════════════════════════════════════════════════════════════
story.append(chapter_banner("CHAPTER 5 — DISORDERS OF EYELIDS", HexColor("#0f766e")))
story.append(SP(8))
story.append(imp_box("RGUHS Frequency: Entropion (3M–5M) | Ptosis classification (5M–10M) | Chalazion vs Stye (3M) | Blepharitis (3M) | Trichiasis (3M)"))
story.append(SP(6))

story.append(section_label("RGUHS PREVIOUS YEAR QUESTIONS", HexColor("#0f766e")))
story.append(SP(4))
story.append(q_row(10, "Classify ptosis. Describe the clinical features and surgical management of congenital ptosis.", important=True))
story.append(q_row(5, "Entropion – types, clinical features and management", important=True))
story.append(q_row(5, "Ectropion – types, clinical features and management"))
story.append(q_row(5, "Management of Stye (Hordeolum externum). (RGUHS 2006)"))
story.append(q_row(3, "Entropion – short note", important=True))
story.append(q_row(3, "Chalazion (Meibomian cyst) – features and management"))
story.append(q_row(3, "Difference between Stye and Chalazion"))
story.append(q_row(3, "Blepharitis – types and management"))
story.append(q_row(3, "Hordeolum internum (Chalazion) – short note"))
story.append(SP(6))

story.append(H2("5.1 Ptosis (Blepharoptosis)"))
story.append(imp_box("Classification is a common RGUHS question – know all types with levator function"))
story.append(SP(4))

ptosis_data = [
    ["Type", "Mechanism", "Levator Function", "Notes"],
    ["Congenital\n(Simple)", "Maldevelopment of levator muscle", "Poor (<4 mm)", "Amblyopia risk if covering pupil"],
    ["Aponeurotic\n(Involutional)", "Dehiscence/disinsertion of levator aponeurosis", "Good (>12 mm)", "Most common in elderly"],
    ["Myogenic", "Myasthenia gravis, CPEO, myotonic dystrophy", "Variable/poor", "Fatigable ptosis in MG"],
    ["Neurogenic", "3rd nerve palsy, Horner's syndrome", "Good but limited", "3rd nerve: ptosis + mydriasis; Horner's: ptosis + miosis"],
    ["Mechanical", "Tumour, oedema, scarring", "Good", "Pulled down by weight"],
    ["Traumatic", "Levator injury", "Variable", ""],
    ["Pseudoptosis", "Dermatochalasis, brow ptosis", "Normal", "No true levator dysfunction"],
]
tbl = Table(ptosis_data, colWidths=[28*mm, 52*mm, 34*mm, 60*mm])
tbl.setStyle(TableStyle([
    ("BACKGROUND",(0,0),(-1,0), HexColor("#0f766e")),
    ("TEXTCOLOR",(0,0),(-1,0), WHITE),
    ("FONTNAME",(0,0),(-1,0),"Helvetica-Bold"),
    ("FONTNAME",(0,1),(0,-1),"Helvetica-Bold"),
    ("FONTSIZE",(0,0),(-1,-1),8.5),
    ("GRID",(0,0),(-1,-1),0.5,GREY_LINE),
    ("BACKGROUND",(0,2),(-1,2), GREY_BG),
    ("BACKGROUND",(0,4),(-1,4), GREY_BG),
    ("BACKGROUND",(0,6),(-1,6), GREY_BG),
    ("TOPPADDING",(0,0),(-1,-1),4),
    ("BOTTOMPADDING",(0,0),(-1,-1),4),
    ("LEFTPADDING",(0,0),(-1,-1),5),
    ("VALIGN",(0,0),(-1,-1),"TOP"),
]))
story.append(tbl)
story.append(SP(4))

story.append(H3("Surgical Management of Congenital Ptosis"))
story.append(B("Levator resection (LR): Levator function >4 mm – procedure of choice"))
story.append(B("Fasanella-Servat operation: Mild ptosis with good levator function (>8 mm) – excise tarsus + Muller's muscle"))
story.append(B("Frontalis sling (Crawford's operation): Poor levator function (<4 mm) – connect lid to frontalis muscle via sling"))
story.append(B("Urgent correction if amblyopia risk (ptosis covering visual axis)"))
story.append(SP(6))

story.append(H2("5.2 Entropion"))
story.append(imp_box("Inturning of eyelid – lashes rub on cornea – 3-5 mark question"))
story.append(SP(4))

ent_data = [
    ["Type", "Cause", "Mechanism", "Treatment"],
    ["Involutional (Senile)", "Most common; elderly", "Horizontal lid laxity + preseptal orbicularis over-ride", "Wies procedure, Transverse everting sutures"],
    ["Cicatricial", "Trachoma, chemical burns, Stevens-Johnson", "Conjunctival/tarsal scarring pulling lid in", "Lamella repositioning, grafting"],
    ["Congenital", "Excess skin/hypertrophy of orbicularis", "Rare; mainly lower lid", "Usually resolves; if not – sutures"],
    ["Spastic", "Prolonged ocular irritation", "Orbicularis overaction", "Treat cause, botulinum toxin"],
]
tbl = Table(ent_data, colWidths=[30*mm, 35*mm, 56*mm, 53*mm])
tbl.setStyle(TableStyle([
    ("BACKGROUND",(0,0),(-1,0), MED_BLUE),
    ("TEXTCOLOR",(0,0),(-1,0), WHITE),
    ("FONTNAME",(0,0),(-1,0),"Helvetica-Bold"),
    ("FONTNAME",(0,1),(0,-1),"Helvetica-Bold"),
    ("FONTSIZE",(0,0),(-1,-1),8.5),
    ("GRID",(0,0),(-1,-1),0.5,GREY_LINE),
    ("BACKGROUND",(0,2),(-1,2), GREY_BG),
    ("BACKGROUND",(0,4),(-1,4), GREY_BG),
    ("TOPPADDING",(0,0),(-1,-1),4),
    ("BOTTOMPADDING",(0,0),(-1,-1),4),
    ("LEFTPADDING",(0,0),(-1,-1),5),
    ("VALIGN",(0,0),(-1,-1),"TOP"),
]))
story.append(tbl)
story.append(SP(6))

story.append(H2("5.3 Ectropion"))
story.append(B("Eversion of eyelid → exposed conjunctiva, epiphora, exposure keratitis"))
story.append(B("Types: Involutional (senile) – most common; Cicatricial; Paralytic (VII nerve palsy); Mechanical; Congenital"))
story.append(B("Treatment: Lateral tarsal strip procedure (main), medial spindle procedure, medial canthal tendon tightening"))
story.append(SP(6))

story.append(H2("5.4 Chalazion vs Hordeolum (Stye)"))
story.append(imp_box("Classic differentiation question – 3 marks"))
story.append(SP(4))
ch_data = [
    ["Feature", "Chalazion (Meibomian Cyst)", "Hordeolum Externum (Stye)"],
    ["Origin", "Meibomian gland (tarsal plate)", "Lash follicle / Zeis/Moll glands"],
    ["Nature", "Chronic, sterile lipogranuloma", "Acute, infected (Staph aureus)"],
    ["Pain", "Painless (usually)", "Painful, tender"],
    ["Location", "Within tarsal plate (internal)", "Lid margin (external)"],
    ["Discharge", "No pus typically", "Points with pus at lid margin"],
    ["Treatment", "Warm compress → I&C (incise & curettage) from conjunctival side", "Warm compress, topical antibiotics, avulsion of lash"],
    ["Recurrence", "May recur; biopsy if recurrent (rule out sebaceous cell carcinoma)", "Usually resolves with treatment"],
]
tbl = Table(ch_data, colWidths=[28*mm, 73*mm, 73*mm])
tbl.setStyle(TableStyle([
    ("BACKGROUND",(0,0),(-1,0), HexColor("#0f766e")),
    ("TEXTCOLOR",(0,0),(-1,0), WHITE),
    ("FONTNAME",(0,0),(-1,0),"Helvetica-Bold"),
    ("FONTNAME",(0,1),(0,-1),"Helvetica-Bold"),
    ("FONTSIZE",(0,0),(-1,-1),8.5),
    ("GRID",(0,0),(-1,-1),0.5,GREY_LINE),
    ("BACKGROUND",(0,2),(-1,2), GREY_BG),
    ("BACKGROUND",(0,4),(-1,4), GREY_BG),
    ("BACKGROUND",(0,6),(-1,6), GREY_BG),
    ("TOPPADDING",(0,0),(-1,-1),4),
    ("BOTTOMPADDING",(0,0),(-1,-1),4),
    ("LEFTPADDING",(0,0),(-1,-1),5),
    ("VALIGN",(0,0),(-1,-1),"TOP"),
]))
story.append(tbl)
story.append(SP(6))

story.append(H2("5.5 Blepharitis"))
story.append(B("Chronic inflammation of eyelid margins"))
story.append(B("Anterior blepharitis: Staph aureus – crusting around lashes, collarettes; seborrhoeic – dandruff-like scales"))
story.append(B("Posterior blepharitis (meibomian gland dysfunction): Meibomian gland obstruction → frothy secretion, poor tear lipid layer, dry eye"))
story.append(B("Treatment: Lid hygiene (warm compress + lid scrubs), topical antibiotics, artificial tears, tetracycline for posterior blepharitis"))
story.append(SP(4))

story.append(H2("5.6 Trichiasis vs Distichiasis"))
story.append(B("Trichiasis: Normally positioned lid, but lashes grow inward toward cornea (from trachoma, blepharitis)"))
story.append(B("Distichiasis: Extra row of lashes from meibomian gland orifices"))
story.append(B("Treatment trichiasis: Epilation, electrolysis, argon laser, cryotherapy"))
story.append(PageBreak())

# ══════════════════════════════════════════════════════════════════════════════
# CHAPTER 6 – SQUINT AND ITS DISORDERS
# ══════════════════════════════════════════════════════════════════════════════
story.append(chapter_banner("CHAPTER 6 — SQUINT AND ITS DISORDERS", HexColor("#b45309")))
story.append(SP(8))
story.append(imp_box("RGUHS Frequency: Paralytic vs Non-paralytic squint (10M) | Esotropia (10M) | Amblyopia (5M) | 3rd nerve palsy (5M) | Diplopia testing (3M) | Hirschberg test (3M)"))
story.append(SP(6))

story.append(section_label("RGUHS PREVIOUS YEAR QUESTIONS", HexColor("#b45309")))
story.append(SP(4))
story.append(q_row(10, "Discuss etiology, signs, symptoms and management of paralytic squint. Differentiate from non-paralytic squint. (RGUHS 2012)", important=True))
story.append(q_row(10, "Discuss the etiopathogenesis, signs, symptoms and management of Esotropia. (RGUHS 2007)", important=True))
story.append(q_row(5, "Amblyopia – classification and management", important=True))
story.append(q_row(5, "Third nerve palsy – causes, features, management"))
story.append(q_row(5, "Cover test and its types – methodology"))
story.append(q_row(3, "Hirschberg corneal reflex test", important=True))
story.append(q_row(3, "Prism cover test"))
story.append(q_row(3, "Krimsky test"))
story.append(q_row(3, "Binocular single vision (BSV)"))
story.append(q_row(3, "Convergent vs divergent squint – differences"))
story.append(SP(6))

story.append(H2("6.1 Terminology and Classification"))
story.append(B("Strabismus / Squint: Misalignment of visual axes"))
story.append(B("Heterophoria (latent squint): Deviation kept controlled by fusion – only manifest on cover test"))
story.append(B("Heterotropia (manifest squint): Constant deviation visible without cover test"))
story.append(SP(4))

sq_class = [
    ["Classification", "Type", "Description"],
    ["By direction", "Esotropia", "Convergent (eye turns inward)"],
    ["", "Exotropia", "Divergent (eye turns outward)"],
    ["", "Hypertropia/Hypotropia", "Vertical deviation"],
    ["", "Cyclotropia", "Torsional deviation"],
    ["By comitance", "Concomitant (Non-paralytic)", "Angle same in all positions of gaze"],
    ["", "Incomitant (Paralytic)", "Angle varies with direction of gaze (greatest in field of action of paretic muscle)"],
    ["By onset", "Congenital", "Before 6 months"],
    ["", "Acquired", "After 6 months"],
]
tbl = Table(sq_class, colWidths=[35*mm, 35*mm, 104*mm])
tbl.setStyle(TableStyle([
    ("BACKGROUND",(0,0),(-1,0), HexColor("#b45309")),
    ("TEXTCOLOR",(0,0),(-1,0), WHITE),
    ("FONTNAME",(0,0),(-1,0),"Helvetica-Bold"),
    ("FONTNAME",(0,1),(0,-1),"Helvetica-Bold"),
    ("FONTSIZE",(0,0),(-1,-1),9),
    ("GRID",(0,0),(-1,-1),0.5,GREY_LINE),
    ("BACKGROUND",(0,5),(-1,5), GREY_BG),
    ("BACKGROUND",(0,7),(-1,7), GREY_BG),
    ("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(tbl)
story.append(SP(6))

story.append(H2("6.2 Paralytic vs Non-Paralytic Squint"))
story.append(imp_box("The most important RGUHS 10-mark differentiation"))
story.append(SP(4))
para_diff = [
    ["Feature", "Non-paralytic (Concomitant)", "Paralytic (Incomitant)"],
    ["Cause", "Refractive error, fusion failure, hereditary", "CN palsy (3rd, 4th, 6th), trauma, tumour, inflammation, vascular"],
    ["Age of onset", "Usually childhood", "Any age (acute in adults)"],
    ["Angle of deviation", "Same in all positions (comitant)", "Varies – maximum in direction of paretic muscle"],
    ["Diplopia", "Absent (suppression)", "Present (false projection)"],
    ["Primary vs Secondary deviation", "Primary = Secondary", "Secondary deviation > Primary deviation"],
    ["Head posture", "No compensatory posture", "Compensatory head posture (away from paretic direction)"],
    ["Binocular vision", "Absent", "Was present before onset"],
    ["Tests", "Hirschberg, cover, Krimsky", "Hess chart, Bielschowsky head tilt, diplopia charting"],
    ["Treatment", "Optical, orthoptic, surgery", "Treat cause, prisms, patching, later surgery"],
]
tbl = Table(para_diff, colWidths=[38*mm, 68*mm, 68*mm])
tbl.setStyle(TableStyle([
    ("BACKGROUND",(0,0),(-1,0), MED_BLUE),
    ("TEXTCOLOR",(0,0),(-1,0), WHITE),
    ("FONTNAME",(0,0),(-1,0),"Helvetica-Bold"),
    ("FONTNAME",(0,1),(0,-1),"Helvetica-Bold"),
    ("FONTSIZE",(0,0),(-1,-1),8.5),
    ("GRID",(0,0),(-1,-1),0.5,GREY_LINE),
    ("BACKGROUND",(0,2),(-1,2), GREY_BG),
    ("BACKGROUND",(0,4),(-1,4), GREY_BG),
    ("BACKGROUND",(0,6),(-1,6), GREY_BG),
    ("BACKGROUND",(0,8),(-1,8), GREY_BG),
    ("TOPPADDING",(0,0),(-1,-1),4),
    ("BOTTOMPADDING",(0,0),(-1,-1),4),
    ("LEFTPADDING",(0,0),(-1,-1),5),
    ("VALIGN",(0,0),(-1,-1),"TOP"),
]))
story.append(tbl)
story.append(SP(6))

story.append(H2("6.3 Esotropia (Convergent Squint)"))
story.append(imp_box("10-mark RGUHS question 2007 – know fully accommodative and partially accommodative"))
story.append(SP(4))
story.append(H3("Classification"))
story.append(B("Accommodative esotropia: Refractive (fully accommodative – high hypermetropia) or non-refractive (convergence excess type)"))
story.append(B("Non-accommodative esotropia: Early-onset (infantile/essential esotropia < 6 months), convergence excess without significant refractive error"))
story.append(B("Mixed: Partial accommodative – correction of hypermetropia reduces but does not eliminate the squint"))
story.append(SP(4))
story.append(H3("Fully Accommodative Esotropia"))
story.append(B("Cause: High hypermetropia (+3 to +7D) → excess accommodation → excess convergence (AC/A normal)"))
story.append(B("Treatment: Full cycloplegic refraction correction with glasses → eliminates squint completely"))
story.append(B("No surgery needed if glasses fully correct the deviation"))
story.append(SP(4))
story.append(H3("Management Principles of Esotropia"))
story.append(B("Step 1: Correct refractive error (glasses) – cycloplegic refraction essential"))
story.append(B("Step 2: Treat amblyopia – occlusion therapy (patching of better eye)"))
story.append(B("Step 3: Orthoptic exercises"))
story.append(B("Step 4: Surgery – recession (weakening) of medial rectus ± resection of lateral rectus"))
story.append(SP(6))

story.append(H2("6.4 Amblyopia"))
story.append(imp_box("5-mark question – definition, types and treatment"))
story.append(SP(4))
story.append(T("Definition: Unilateral or rarely bilateral decrease in best corrected visual acuity WITHOUT identifiable structural pathology, caused by form deprivation or abnormal binocular interaction during visual sensitive period (0–7 years; critical period peak at 2–3 years)."))
story.append(SP(4))

amb_data = [
    ["Type", "Cause", "Notes"],
    ["Strabismic", "Manifest squint → suppression of deviating eye", "Most common type"],
    ["Anisometropic", "Refractive error difference between eyes (>1D)", "Frequently associated with microtropia"],
    ["Ametropic", "Bilateral high refractive error (both eyes blurred)", "Bilateral form deprivation"],
    ["Stimulus Deprivation", "Ptosis, cataract, corneal opacity blocking visual axis", "Worst prognosis; urgent treatment"],
    ["Meridional", "Uncorrected astigmatism", "Reduced vision in specific meridians"],
]
tbl = Table(amb_data, colWidths=[38*mm, 72*mm, 64*mm])
tbl.setStyle(TableStyle([
    ("BACKGROUND",(0,0),(-1,0), HexColor("#b45309")),
    ("TEXTCOLOR",(0,0),(-1,0), WHITE),
    ("FONTNAME",(0,0),(-1,0),"Helvetica-Bold"),
    ("FONTNAME",(0,1),(0,-1),"Helvetica-Bold"),
    ("FONTSIZE",(0,0),(-1,-1),9),
    ("GRID",(0,0),(-1,-1),0.5,GREY_LINE),
    ("BACKGROUND",(0,2),(-1,2), GREY_BG),
    ("BACKGROUND",(0,4),(-1,4), GREY_BG),
    ("TOPPADDING",(0,0),(-1,-1),4),
    ("BOTTOMPADDING",(0,0),(-1,-1),4),
    ("LEFTPADDING",(0,0),(-1,-1),5),
    ("VALIGN",(0,0),(-1,-1),"MIDDLE"),
]))
story.append(tbl)
story.append(SP(4))
story.append(H3("Treatment of Amblyopia"))
story.append(B("1. Correct the underlying cause (refractive correction, remove opacity)"))
story.append(B("2. Occlusion therapy (patching): Patch the better eye to force use of amblyopic eye – most important treatment"))
story.append(B("3. Penalisation: Atropine drops in better eye (optical penalisation)"))
story.append(B("4. Critical period: Treatment must be started early (< 7 years); after 9 years, prognosis poor"))
story.append(SP(6))

story.append(H2("6.5 Diagnostic Tests for Squint"))
sq_tests = [
    ["Test", "Purpose", "Method"],
    ["Hirschberg Corneal Reflex Test", "Estimate angle of squint", "Light reflection on cornea; each mm of decentration = ~7° (15 prism dioptres)"],
    ["Cover-Uncover Test", "Detect manifest squint (tropia)", "Cover one eye – look for movement of uncovered eye"],
    ["Alternate Cover Test", "Detect maximum deviation (phoria + tropia)", "Rapidly alternate cover; see movement when cover removed"],
    ["Prism Cover Test", "Measure angle of deviation", "Neutralise movement with prisms"],
    ["Krimsky Test", "Measure in uncooperative patients", "Prism placed over deviating eye to centre corneal reflex"],
    ["Maddox Rod Test", "Detect heterophoria", "Rod over one eye – red line position relative to white light"],
    ["Hess Chart", "Diagnose and follow-up paralytic squint", "Plots field of action of each muscle in 9 gaze positions"],
    ["Bielschowsky Head Tilt Test", "Diagnose superior oblique (IV nerve) palsy", "Tilt head to affected side → hypertropia increases"],
    ["4Δ Prism Test", "Detect microtropia/monofixation", "4 prism dioptre base-out prism in front of each eye"],
]
tbl = Table(sq_tests, colWidths=[42*mm, 42*mm, 90*mm])
tbl.setStyle(TableStyle([
    ("BACKGROUND",(0,0),(-1,0), DARK_BLUE),
    ("TEXTCOLOR",(0,0),(-1,0), WHITE),
    ("FONTNAME",(0,0),(-1,0),"Helvetica-Bold"),
    ("FONTNAME",(0,1),(0,-1),"Helvetica-Bold"),
    ("FONTSIZE",(0,0),(-1,-1),8.5),
    ("GRID",(0,0),(-1,-1),0.5,GREY_LINE),
    ("BACKGROUND",(0,2),(-1,2), GREY_BG),
    ("BACKGROUND",(0,4),(-1,4), GREY_BG),
    ("BACKGROUND",(0,6),(-1,6), GREY_BG),
    ("BACKGROUND",(0,8),(-1,8), GREY_BG),
    ("TOPPADDING",(0,0),(-1,-1),3),
    ("BOTTOMPADDING",(0,0),(-1,-1),3),
    ("LEFTPADDING",(0,0),(-1,-1),5),
    ("VALIGN",(0,0),(-1,-1),"TOP"),
]))
story.append(tbl)
story.append(PageBreak())

# ══════════════════════════════════════════════════════════════════════════════
# QUICK REVISION PAGE
# ══════════════════════════════════════════════════════════════════════════════
story.append(chapter_banner("QUICK REVISION — HIGH-YIELD FACTS FOR RGUHS", HexColor("#7f1d1d")))
story.append(SP(8))

story.append(imp_box("★ MNEMONICS AND ONE-LINERS – READ BEFORE EXAM ★"))
story.append(SP(6))

qr_data = [
    ["Topic", "High-Yield Fact / Mnemonic"],
    ["Chemical burns", "Alkali > Acid (worse) | First step = IMMEDIATE IRRIGATION | Roper-Hall Gr IV = > ½ limbal ischaemia"],
    ["Sympathetic ophthalmia", "Latent period 2 weeks – 2 years | Dalen-Fuchs nodules | Exciting + Sympathizing eye"],
    ["Iridocyclitis causes", "HLA-B27 conditions: AS, Reiter's, IBD, Psoriasis | Mutton-fat KP = granulomatous"],
    ["Uveitis grading", "AC Cells: 0.5 = 1-5, 1+ = 6-15, 2+ = 16-25, 3+ = 26-50, 4+ = >50 cells"],
    ["VKH syndrome", "4 phases: Prodromal → Uveitic → Convalescent (vitiligo/poliosis) → Recurrent | Sunset glow fundus"],
    ["Optic atrophy types", "Primary = chalk white, sharp margins | Secondary = dirty grey, blurred margins"],
    ["Argyll Robertson", "Syphilis | Accommodates but does NOT react to light | Bilateral, miotic, irregular"],
    ["Papilloedema vs Papillitis", "Papilloedema: BILATERAL, vision normal early | Papillitis: UNILATERAL, early visual loss"],
    ["Retrobulbar neuritis", "Patient sees nothing, doctor sees nothing | MS association | Pain on eye movement"],
    ["Congenital Dacryocystitis", "Obstruction at Valve of Hasner | Crigler's massage → Probing → DCR"],
    ["DCR (Toti's operation)", "Anastomosis: Lacrimal sac → Middle meatus | External approach gold standard"],
    ["Dry eye tests", "Schirmer's I: <10mm = dry | TBUT < 10 sec = abnormal | Rose Bengal stains dead cells"],
    ["Chalazion vs Stye", "Chalazion: chronic, painless, meibomian gland, I&C from conjunctival side | Stye: acute, painful, lash follicle"],
    ["Ptosis surgery", "Good LF (>4mm) → Levator resection | Poor LF (<4mm) → Frontalis sling | Mild + good LF → Fasanella-Servat"],
    ["Entropion types", "Involutional (senile) → Wies procedure | Cicatricial → trachoma/burns → lamella repositioning"],
    ["Paralytic squint", "Secondary deviation > Primary | Diplopia | Compensatory head posture | Hess chart for diagnosis"],
    ["Amblyopia treatment", "Patch BETTER eye | Critical period < 7 years | Penalise with atropine | Worst: stimulus deprivation"],
    ["Esotropia treatment", "Correct hypermetropia with glasses FIRST | Full accommodative = glasses alone cure | Surgery if partial"],
    ["Hirschberg test", "1 mm decentration of reflex = 7° = 15 prism dioptres | Pupil edge = ~45° = 90Δ"],
    ["Hyphema grading", "Grade I < 1/3 | Grade II 1/3–1/2 | Grade III > 1/2 | Grade IV (8-ball) = total AC fill"],
]
tbl = Table(qr_data, colWidths=[52*mm, 122*mm])
tbl.setStyle(TableStyle([
    ("BACKGROUND",(0,0),(-1,0), HexColor("#7f1d1d")),
    ("TEXTCOLOR",(0,0),(-1,0), WHITE),
    ("FONTNAME",(0,0),(-1,0),"Helvetica-Bold"),
    ("FONTSIZE",(0,0),(-1,-1),8.5),
    ("FONTNAME",(0,1),(0,-1),"Helvetica-Bold"),
    ("GRID",(0,0),(-1,-1),0.5,GREY_LINE),
    ("BACKGROUND",(0,2),(-1,2), HexColor("#fef2f2")),
    ("BACKGROUND",(0,4),(-1,4), HexColor("#fef2f2")),
    ("BACKGROUND",(0,6),(-1,6), HexColor("#fef2f2")),
    ("BACKGROUND",(0,8),(-1,8), HexColor("#fef2f2")),
    ("BACKGROUND",(0,10),(-1,10), HexColor("#fef2f2")),
    ("BACKGROUND",(0,12),(-1,12), HexColor("#fef2f2")),
    ("BACKGROUND",(0,14),(-1,14), HexColor("#fef2f2")),
    ("BACKGROUND",(0,16),(-1,16), HexColor("#fef2f2")),
    ("BACKGROUND",(0,18),(-1,18), HexColor("#fef2f2")),
    ("BACKGROUND",(0,20),(-1,20), HexColor("#fef2f2")),
    ("TOPPADDING",(0,0),(-1,-1),4),
    ("BOTTOMPADDING",(0,0),(-1,-1),4),
    ("LEFTPADDING",(0,0),(-1,-1),6),
    ("VALIGN",(0,0),(-1,-1),"TOP"),
]))
story.append(tbl)
story.append(SP(10))

# footer note
story.append(Table([[
    Paragraph("Sources: Kanski's Clinical Ophthalmology 10th Ed | Wills Eye Manual | RGUHS QP 2008–2025", 
              S("Footer", fontSize=8, textColor=HexColor("#64748b"), fontName="Helvetica-Oblique", alignment=TA_CENTER))
]], colWidths=[174*mm]))

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

cd /home/daytona/workspace/rguhs-ophthalmology && python generate_notes.py 2>&1

Running Command

ls -lh /home/daytona/workspace/rguhs-ophthalmology/RGUHS_Ophthalmology_Notes.pdf

Running Command

python3 -c "from pypdf import PdfReader; r = PdfReader('/home/daytona/workspace/…

Your RGUHS Final Year MBBS Ophthalmology Notes PDF is ready - 17 pages, professionally formatted.

RGUHS Ophthalmology Notes

PDF Document · PDF


What's Inside the PDF

The document is structured with colour-coded chapters, question tables showing 10M/5M/3M marks, and ★ gold-highlighted boxes for the most frequently asked RGUHS topics.

Chapter-by-Chapter Summary

Chapter 1 - Ocular Injuries
  • Full table of blunt trauma effects (structure by structure - anterior to posterior)
  • Roper-Hall grading of chemical burns (Grade I–IV)
  • Acid vs Alkali comparison table
  • Hyphema grading (0 to IV / 8-ball)
  • Sympathetic ophthalmia - exciting vs sympathising eye, Dalen-Fuchs nodules
  • ★ Blunt injury (10M) and Chemical burns (10M) highlighted
Chapter 2 - Diseases of Uveal Tract
  • Uveitis classification table (anterior/intermediate/posterior/panuveitis)
  • Acute Iridocyclitis - etiology, KP types (mutton-fat vs fine), grading of AC cells (SUN), management
  • VKH syndrome - 4 phases, sunset glow fundus
  • ★ Acute Iridocyclitis (10M) - most repeated RGUHS question
Chapter 3 - Neuro-Ophthalmology
  • Papillitis vs Retrobulbar Neuritis comparison table
  • Optic Atrophy types (Primary/Secondary/Consecutive/Glaucomatous) with disc appearances
  • Papilloedema vs Papillitis differentiation (very common 5M question)
  • Argyll Robertson Pupil - light-near dissociation, syphilis
  • Uhthoff's and Pulfrich phenomena
Chapter 4 - Lacrimal Apparatus
  • Anatomy of drainage pathway (puncta → Valve of Hasner)
  • Congenital Dacryocystitis - step-ladder management (Crigler's → Probing → DCR)
  • Acute vs Chronic dacryocystitis
  • Dry Eye tests table - Schirmer's I & II, TBUT, Rose Bengal, Lissamine green
Chapter 5 - Disorders of Eyelids
  • Ptosis classification with levator function values
  • Surgical options (LR vs Fasanella-Servat vs Frontalis sling)
  • Entropion - 4 types with surgical corrections
  • Chalazion vs Stye - 8-feature comparison table
  • Blepharitis - anterior vs posterior (meibomian gland dysfunction)
Chapter 6 - Squint and its Disorders
  • Paralytic vs Non-paralytic - 10-feature comparison table
  • Esotropia - fully vs partially accommodative
  • Amblyopia - all 5 types with critical period emphasis
  • Diagnostic tests (Hirschberg, Cover, Hess Chart, Bielschowsky, Krimsky, Maddox Rod)
Final Page - Quick Revision Table - 20 one-liner high-yield facts with mnemonics for last-night revision

Sources Used

  • Kanski's Clinical Ophthalmology 10th Edition
  • Wills Eye Manual (Office and Emergency Room Diagnosis)
  • RGUHS Question Papers 2008–2025 (collected from official RGUHS archives and previous year compilations)
This is a shared conversation. Sign in to Orris to start your own chat.