Tell me what to do in ophthalmology postings like how to take history and what and how to do examination

Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Reading File
Reading File
I now have enough detailed material from Kanski to compose a thorough, well-organized guide. Let me write the comprehensive answer:

Ophthalmology Postings: History Taking & Examination Guide

Source: Kanski's Clinical Ophthalmology: A Systematic Approach, 10th edition

PART 1 - HISTORY TAKING

The Ophthalmic History Framework

A basic ophthalmic history has the following components:

1. Main Complaint

For every symptom, ask:
  • Rapidity of onset - sudden vs. gradual? Sudden painless loss of vision suggests vascular causes (CRAO, CRVO, vitreous hemorrhage); gradual suggests refractive error, cataract, glaucoma.
  • Circumstances of onset - after trauma, on waking, after reading?
  • Severity - how much vision is affected? Can they count fingers, read, drive?
  • Duration - hours, days, weeks, months?
  • Frequency - constant, intermittent, episodic (e.g., amaurosis fugax)?

Common presenting symptoms to probe:

SymptomKey questions
Blurred visionNear or distance? One eye or both? Transient or persistent?
PainAching (raised IOP), sharp/gritty (corneal/conjunctival), deep boring (uveitis, scleritis)
RednessUnilateral/bilateral? Discharge? Painful or painless?
DiplopiaMonocular (corneal/lens) vs. binocular (muscle/nerve)? Horizontal/vertical?
Flashes (photopsia)Duration, frequency - suggests retinal traction or migraine
FloatersNew or longstanding? Sudden shower of floaters = vitreous hemorrhage/retinal tear
Haloes around lightsCorneal oedema (acute glaucoma) vs. lens changes
Distortion (metamorphopsia)Central - suggests macular pathology (AMD, CSCR)
Field lossWhich part of vision - central, peripheral, one side?
PhotophobiaUveitis, corneal abrasion, keratitis, meningitis
DischargeMucopurulent (bacterial), watery (viral), stringy/ropy (allergic)
Watering (epiphora)Excessive tear production vs. impaired drainage?

2. Past Ocular History

  • Previous eye surgery (cataract, vitrectomy, strabismus, laser)
  • Previous ocular inflammation (uveitis, scleritis)
  • Previous trauma
  • Glasses/contact lens use - which type, how long?
  • Previous laser or intravitreal injections
  • Amblyopia or squint in childhood

3. Past Medical History

Important systemic associations:
  • Diabetes - diabetic retinopathy, cataract, cranial nerve palsies
  • Hypertension - hypertensive retinopathy, BRAO, BRVO
  • Thyroid disease - thyroid eye disease (proptosis, lid lag, diplopia)
  • Rheumatoid arthritis / SLE - dry eye, scleritis, uveitis
  • HIV/immunosuppression - CMV retinitis, toxoplasmosis
  • Sarcoidosis - uveitis, retinal vasculitis
  • Multiple sclerosis - optic neuritis

4. Systemic Medications

  • Corticosteroids (topical or systemic) - posterior subcapsular cataract, raised IOP
  • Tamsulosin / alpha blockers - intraoperative floppy iris syndrome (IFIS) - critical to know before cataract surgery
  • Hydroxychloroquine - bull's eye maculopathy
  • Amiodarone - corneal verticillata, optic neuropathy
  • Ethambutol - toxic optic neuropathy
  • Vigabatrin - visual field defects
  • Topiramate - acute angle closure

5. Allergies

  • Antibiotic drops (neomycin, chloramphenicol)
  • Topical glaucoma medications
  • Contact lens solution preservatives

6. Family History

  • Glaucoma - most important; first-degree relatives have 4-9x risk
  • Macular degeneration (AMD)
  • Inherited retinal dystrophies (retinitis pigmentosa, Stargardt disease)
  • Squint or amblyopia
  • Refractive error (high myopia)

7. Social History

  • Occupation (VDU use, outdoor work, occupational hazards)
  • Driving (legal requirement to mention if affected)
  • Smoking (major risk factor for AMD and diabetic retinopathy progression)
  • Alcohol

PART 2 - OPHTHALMIC EXAMINATION

The examination is systematic and follows the path of light from the outside in: lids → conjunctiva → cornea → anterior chamber → iris/pupil → lens → vitreous → fundus.

Step 1: Visual Acuity (VA) - The Single Most Important Test

Distance VA:
  • Use a Snellen chart at 6 metres (or LogMAR/ETDRS chart which is preferred in trials for accuracy)
  • Test each eye separately - cover the other eye
  • Always test with best correction (glasses/contact lenses)
  • If the patient cannot see the top letter at 6m, move them closer and record (e.g., 3/60)
  • If still no letters: Count Fingers (CF), Hand Motion (HM), Perception of Light (PL), or No Perception of Light (NPL)
  • Use a pinhole if VA is reduced - improvement with pinhole suggests a refractive cause rather than organic pathology
Near VA:
  • Use a near vision chart (e.g., Jaeger test types) held at a comfortable distance (~33cm)
  • Sensitive for early macular disease
  • Note if patient uses reading glasses

Step 2: Colour Vision

  • Use Ishihara plates (test for red-green deficiency - screens for optic nerve disease)
  • Useful in optic neuritis (red desaturation is an early sign)
  • A light brightness comparison test can be done informally: hold a pen torch alternately in front of each eye and ask the patient to compare brightness - a dim perception in one eye suggests relative afferent pupillary defect (RAPD) or optic neuropathy

Step 3: Visual Fields

  • Confrontation testing (bedside): Sit opposite the patient at arm's length. Cover one eye each. Bring a finger in from the periphery in each quadrant. Compare with your own field as reference.
  • For subtle defects use a red hatpin - colour desaturation in a scotoma is detected before white-target loss
  • Formal fields: Humphrey automated perimetry (standard in glaucoma monitoring), Goldmann kinetic perimetry
  • Amsler grid - for central/macular distortion; the patient fixates on the central dot and reports if any lines appear wavy or missing (metamorphopsia in AMD, CSCR)

Step 4: Pupil Examination

Always examine pupils before dilating the eye.
  • Size and symmetry at rest (anisocoria?)
  • Direct light reflex - shine a light in one eye, the same pupil constricts
  • Consensual reflex - the opposite pupil also constricts
  • Swinging flashlight test for RAPD (Relative Afferent Pupillary Defect): Swing a torch from eye to eye every 2-3 seconds. If the pupil dilates when the light is swung to it (paradoxical dilation), there is an RAPD in that eye - indicating optic nerve disease or severe retinal disease on that side.
  • Accommodation reflex - ask patient to look at a distant object then at your finger close up; pupil should constrict and eyes converge

Step 5: Ocular Motility & Cover Test

Ocular movements:
  • Ask patient to follow your finger through the 9 positions of gaze (H-pattern)
  • Note any limitation, pain, or diplopia in any position
  • Look for nystagmus
Cover test (for squint/strabismus):
  • Cover-uncover test: Cover one eye; watch the uncovered eye for movement (movement = manifest deviation/tropia)
  • Alternating cover test: Rapidly alternate cover from eye to eye; detects latent deviation (phoria)

Step 6: External Examination

Systematic inspection from outside in:
  • Periorbital: Swelling, bruising, skin lesions, ptosis
  • Lids:
    • Ptosis (measure levator function: MRD1 = margin-to-reflex distance)
    • Entropion, ectropion, trichiasis
    • Lid margin - styes, chalazion, blepharitis (look for meibomian gland dysfunction, lid margin telangiectasia, crusting)
    • Eversion of upper lid to look for foreign bodies (papillae, follicles)
  • Conjunctiva:
    • Injection pattern: conjunctival (peripheral/fornices, mobile with conjunctiva), ciliary/circumcorneal (limbal, fixed - suggests corneal/anterior segment disease)
    • Discharge: purulent, mucopurulent, serous
    • Follicles (viral, chlamydial) vs. papillae (allergic, bacterial)
    • Subconjunctival hemorrhage, chemosis, pterygium, pinguecula
  • Cornea:
    • Clarity - opacities, scars, infiltrates, ulcers
    • Size - microcornea, megalocornea, buphthalmos
    • Fluorescein staining under cobalt blue light - reveals epithelial defects (abrasion, ulcer, exposure, HSV dendrite)
  • Anterior chamber:
    • Depth (shallow = angle closure risk)
    • Hyphema (blood), hypopyon (pus - white/yellow level)
    • Look obliquely across with a slit lamp for flare and cells (uveitis)
  • Iris:
    • Colour, posterior synechiae (adhesions to lens from uveitis), rubeosis (new vessels - suggests ischaemia)
    • Iridodonesis (trembling = aphakia or lens subluxation)
  • Lens:
    • Clarity - nuclear sclerosis (yellow/brown), posterior subcapsular (PSC), anterior/posterior cortical cataracts
    • Position - subluxation in Marfan syndrome, homocystinuria

Step 7: Slit Lamp Biomicroscopy (Anterior Segment)

This is the core examination tool in ophthalmology. It provides a binocular, magnified, illuminated view of the anterior segment.
Slit lamp techniques:
  • Diffuse broad beam - general survey, gross abnormalities
  • Direct focal illumination (narrow slit beam) - assess depth and layering of corneal lesions, lens opacities
  • Scleral scatter - decenter the beam to the limbus; detects subtle corneal stromal haze/infiltrates
  • Retroillumination - reflects light from iris or fundus to illuminate cornea from behind; shows epithelial cysts, keratic precipitates (KPs), corneal blood vessels
  • Specular reflection - assess corneal endothelium; shows guttata, reduced cell density
Key things to document at slit lamp:
  • Keratic precipitates (KPs): small/stellate (non-granulomatous uveitis) vs. large mutton-fat (granulomatous uveitis e.g. sarcoid, TB)
  • Anterior chamber cells (grade 0-4+) and flare
  • Corneal staining with fluorescein

Step 8: Intraocular Pressure (IOP)

  • Normal range: 10-21 mmHg
  • Goldmann applanation tonometry - the gold standard; done at slit lamp after instilling topical anaesthetic and fluorescein
  • Non-contact tonometry (air puff) - screening only, less accurate
  • Icare rebound tonometer - no anaesthetic needed, useful for children and bedside
  • Perkins tonometer - portable, for supine/examination under anaesthesia

Step 9: Gonioscopy (Angle Examination)

  • Special contact lens placed on the anaesthetised eye to examine the iridocorneal angle
  • Essential for classifying glaucoma (open angle vs. closed angle) and looking for neovascularization of the angle (rubeosis iridis)
  • Shaffer grading of angle width (Grade 0 = closed to Grade 4 = wide open)

Step 10: Fundus Examination (Posterior Segment)

Always dilate the pupil first (tropicamide 1% ± phenylephrine 2.5%) unless contraindicated (shallow anterior chamber, need to monitor pupil neurology).
a) Direct Ophthalmoscopy:
  • Handheld, provides 15x magnification
  • Upright, monocular image - no stereopsis, small field of view
  • Useful at bedside
  • Technique: examiner on same side as eye being examined, use same eye as patient's eye
  • Start with red reflex check from ~25cm (lens/vitreous opacities block the reflex)
  • Then approach to ~3cm, find the optic disc by directing the beam slightly nasally
b) Indirect Ophthalmoscopy (Head-Mounted BIO):
  • Wide field of view, stereoscopic, inverted & laterally reversed image
  • Penetrates media opacities better than slit lamp
  • Essential for peripheral retina (retinal detachment, peripheral tears)
  • Use with scleral indentation for far periphery
c) Slit Lamp with Non-Contact Lens (+78D or +90D):
  • Best for detailed posterior pole examination (macula, disc)
  • Inverted, virtual image
  • Most common method in clinic
What to examine systematically in the fundus:
StructureWhat to look for
Optic discCup:disc ratio (normal <0.5), disc margin clarity, pallor, swelling (papilloedema), haemorrhages, notching
MaculaFoveal reflex, drusen, haemorrhage, exudates, pigmentary changes, membranes, holes
VesselsAV ratio (normal 2:3), arteriovenous nipping, silver/copper wiring, haemorrhages (flame = superficial, dot/blot = deep), exudates (hard = lipid, soft = cotton wool spots = NFL infarcts), neovascularization
Peripheral retinaLattice degeneration, holes, tears, detachment
VitreousHaemorrhage, cells (asteroid hyalosis, inflammation), posterior vitreous detachment

Quick Reference: The Ophthalmology Examination Order

  1. VA (with correction + pinhole)
  2. Colour vision (Ishihara)
  3. Visual fields (confrontation, Amsler grid)
  4. Pupils (direct, consensual, swinging torch for RAPD)
  5. Ocular motility + cover test
  6. External examination (lids, adnexa)
  7. Slit lamp (anterior segment: conjunctiva, cornea, AC, iris, lens)
  8. IOP (Goldmann applanation)
  9. Gonioscopy (if glaucoma suspected)
  10. Dilated fundus exam (disc, macula, vessels, periphery)

Practical tips for postings:
  • Always examine both eyes and compare - most findings are more meaningful in context of the fellow eye.
  • Document findings using standard abbreviations: RE/LE (right/left eye), BCVA, RAPD, KPs, AC cells/flare grade, C:D ratio.
  • Learn to use the slit lamp early - it takes practice. Start with wide beam on low magnification, then narrow down.
  • The Amsler grid and confrontation fields take 1-2 minutes but yield enormous diagnostic value - never skip them.
  • When in doubt about IOP or disc changes, always refer to a senior or formal perimetry before dismissing the patient.
Source: Kanski's Clinical Ophthalmology: A Systematic Approach, 10th edition, Chapter 1

Create a study guide PDF on ophthalmology examination findings

Reading File
Reading File
Running Command

ls -la /home/daytona/workspace/ 2>/dev/null || echo "workspace not found"

Running Command

mkdir -p /home/daytona/workspace/ophthal-study-guide && python3 -c "import reportlab; print('reportlab ok')"

Writing File

~/ophthal-study-guide/build_pdf.py

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

# ── Colour palette ──────────────────────────────────────────────
NAVY      = HexColor("#1B3A6B")
TEAL      = HexColor("#1A7A8A")
GOLD      = HexColor("#D4A017")
LIGHT_BG  = HexColor("#EEF4F8")
PALE_TEAL = HexColor("#D6EEF2")
WHITE     = colors.white
BLACK     = colors.black
DARK_GREY = HexColor("#333333")
MID_GREY  = HexColor("#666666")
LIGHT_GREY= HexColor("#F2F2F2")
RED_SOFT  = HexColor("#C0392B")
GREEN_SOFT= HexColor("#1E8449")

# ── Document ─────────────────────────────────────────────────────
OUTPUT = "/home/daytona/workspace/ophthal-study-guide/Ophthalmology_Examination_Study_Guide.pdf"
doc = SimpleDocTemplate(
    OUTPUT, pagesize=A4,
    leftMargin=18*mm, rightMargin=18*mm,
    topMargin=20*mm, bottomMargin=20*mm
)
W, H = A4
story = []

# ── Styles ────────────────────────────────────────────────────────
base = getSampleStyleSheet()

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

COVER_TITLE = S("CoverTitle", fontSize=32, textColor=WHITE,
                fontName="Helvetica-Bold", alignment=TA_CENTER, leading=40)
COVER_SUB   = S("CoverSub",   fontSize=16, textColor=HexColor("#AADDEE"),
                fontName="Helvetica", alignment=TA_CENTER, leading=22)
COVER_NOTE  = S("CoverNote",  fontSize=10, textColor=HexColor("#BBCCDD"),
                fontName="Helvetica-Oblique", alignment=TA_CENTER)

CH_TITLE  = S("ChTitle",  fontSize=18, textColor=WHITE,
               fontName="Helvetica-Bold", alignment=TA_LEFT, leading=24,
               backColor=NAVY, leftIndent=-4*mm, rightIndent=-4*mm,
               spaceAfter=6, spaceBefore=14,
               borderPad=(6,6,6,6))

SEC_HEAD  = S("SecHead",  fontSize=13, textColor=NAVY,
               fontName="Helvetica-Bold", spaceBefore=10, spaceAfter=4,
               borderPad=2, leftIndent=0)

SUBSEC    = S("Subsec",   fontSize=11, textColor=TEAL,
               fontName="Helvetica-Bold", spaceBefore=7, spaceAfter=3)

BODY      = S("Body",     fontSize=9.5, textColor=DARK_GREY,
               fontName="Helvetica", leading=14, spaceAfter=4,
               alignment=TA_JUSTIFY)

BULLET    = S("Bullet",   fontSize=9.5, textColor=DARK_GREY,
               fontName="Helvetica", leading=13, leftIndent=12,
               spaceAfter=2)

TIP_STYLE = S("Tip",      fontSize=9, textColor=HexColor("#7D4E00"),
               fontName="Helvetica-Oblique", leading=13,
               backColor=HexColor("#FFF8E1"), leftIndent=8,
               borderPad=4, spaceAfter=6, spaceBefore=4)

CAPTION   = S("Caption",  fontSize=8, textColor=MID_GREY,
               fontName="Helvetica-Oblique", alignment=TA_CENTER)

SOURCE    = S("Source",   fontSize=8, textColor=MID_GREY,
               fontName="Helvetica-Oblique", alignment=TA_CENTER)

# ── Helper functions ─────────────────────────────────────────────

def chapter_header(text):
    data = [[Paragraph(f"<font color='white'>{text}</font>", S("CH",
            fontSize=16, fontName="Helvetica-Bold", textColor=WHITE,
            leading=20, alignment=TA_LEFT))]]
    t = Table(data, colWidths=[174*mm])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), NAVY),
        ("TOPPADDING",   (0,0), (-1,-1), 8),
        ("BOTTOMPADDING",(0,0), (-1,-1), 8),
        ("LEFTPADDING",  (0,0), (-1,-1), 10),
        ("RIGHTPADDING", (0,0), (-1,-1), 10),
        ("ROUNDEDCORNERS", [4]),
    ]))
    story.append(t)
    story.append(Spacer(1, 6))

def section(text):
    story.append(Paragraph(text, SEC_HEAD))
    story.append(HRFlowable(width="100%", thickness=1.5, color=TEAL,
                             spaceAfter=4, spaceBefore=0))

def subsection(text):
    story.append(Paragraph(text, SUBSEC))

def body(text):
    story.append(Paragraph(text, BODY))

def bullet(items, indent=12):
    for item in items:
        p = Paragraph(f"<bullet>&bull;</bullet> {item}", BULLET)
        story.append(p)

def tip(text):
    story.append(Paragraph(f"<b>TIP:</b> {text}", TIP_STYLE))

def sp(h=4):
    story.append(Spacer(1, h))

def two_col_table(headers, rows, col_widths=None, header_bg=NAVY, alt_bg=PALE_TEAL):
    if col_widths is None:
        col_widths = [174*mm / len(headers)] * len(headers)
    data = [[Paragraph(f"<font color='white'><b>{h}</b></font>",
                       S("TH", fontSize=9, fontName="Helvetica-Bold",
                         textColor=WHITE, alignment=TA_CENTER, leading=12))
             for h in headers]]
    for i, row in enumerate(rows):
        data.append([Paragraph(str(cell),
                               S("TD", fontSize=9, fontName="Helvetica",
                                 textColor=DARK_GREY, leading=12))
                     for cell in row])
    t = Table(data, colWidths=col_widths, repeatRows=1)
    style = [
        ("BACKGROUND",   (0, 0), (-1,  0), header_bg),
        ("ROWBACKGROUNDS",(0, 1), (-1, -1), [WHITE, LIGHT_GREY]),
        ("GRID",         (0, 0), (-1, -1), 0.4, HexColor("#BBBBBB")),
        ("VALIGN",       (0, 0), (-1, -1), "TOP"),
        ("TOPPADDING",   (0, 0), (-1, -1), 5),
        ("BOTTOMPADDING",(0, 0), (-1, -1), 5),
        ("LEFTPADDING",  (0, 0), (-1, -1), 5),
        ("RIGHTPADDING", (0, 0), (-1, -1), 5),
    ]
    t.setStyle(TableStyle(style))
    story.append(t)
    story.append(Spacer(1, 6))

def info_box(title, items, bg=PALE_TEAL, title_bg=TEAL):
    rows = [[Paragraph(f"<b>{title}</b>",
                       S("IB", fontSize=10, fontName="Helvetica-Bold",
                         textColor=WHITE))]]
    for item in items:
        rows.append([Paragraph(f"• {item}",
                               S("IBB", fontSize=9, fontName="Helvetica",
                                 textColor=DARK_GREY, leading=13))])
    t = Table(rows, colWidths=[174*mm])
    t.setStyle(TableStyle([
        ("BACKGROUND",    (0, 0), (-1,  0), title_bg),
        ("BACKGROUND",    (0, 1), (-1, -1), bg),
        ("TOPPADDING",    (0, 0), (-1, -1), 5),
        ("BOTTOMPADDING", (0, 0), (-1, -1), 5),
        ("LEFTPADDING",   (0, 0), (-1, -1), 8),
        ("RIGHTPADDING",  (0, 0), (-1, -1), 8),
        ("BOX",           (0, 0), (-1, -1), 0.5, TEAL),
    ]))
    story.append(t)
    story.append(Spacer(1, 6))

# ═══════════════════════════════════════════════════════════════════
#  COVER PAGE
# ═══════════════════════════════════════════════════════════════════

def cover_page():
    # Navy background table
    cover_data = [[
        Paragraph("OPHTHALMOLOGY", S("CT1", fontSize=28, fontName="Helvetica-Bold",
                  textColor=WHITE, alignment=TA_CENTER, leading=34)),
    ],[
        Paragraph("EXAMINATION FINDINGS", S("CT2", fontSize=24, fontName="Helvetica-Bold",
                  textColor=GOLD, alignment=TA_CENTER, leading=30)),
    ],[
        Spacer(1, 6),
    ],[
        Paragraph("Comprehensive Study Guide for Clinical Postings",
                  S("CT3", fontSize=13, fontName="Helvetica-Oblique",
                    textColor=HexColor("#AADDEE"), alignment=TA_CENTER, leading=18)),
    ],[
        Spacer(1, 20),
    ],[
        Paragraph("Covering: Visual Acuity \u2022 Pupil Reactions \u2022 Slit Lamp \u2022 Fundoscopy",
                  S("CT4", fontSize=10, fontName="Helvetica",
                    textColor=HexColor("#BBCCDD"), alignment=TA_CENTER, leading=14)),
    ],[
        Paragraph("Anterior Segment \u2022 Posterior Segment \u2022 Glaucoma \u2022 Retina",
                  S("CT4b", fontSize=10, fontName="Helvetica",
                    textColor=HexColor("#BBCCDD"), alignment=TA_CENTER, leading=14)),
    ],[
        Spacer(1, 30),
    ],[
        Paragraph("Based on Kanski's Clinical Ophthalmology, 10th Edition",
                  S("CT5", fontSize=9, fontName="Helvetica-Oblique",
                    textColor=HexColor("#8899AA"), alignment=TA_CENTER)),
    ]]
    t = Table(cover_data, colWidths=[174*mm])
    t.setStyle(TableStyle([
        ("BACKGROUND",    (0, 0), (-1, -1), NAVY),
        ("TOPPADDING",    (0, 0), (-1, -1), 10),
        ("BOTTOMPADDING", (0, 0), (-1, -1), 10),
        ("LEFTPADDING",   (0, 0), (-1, -1), 20),
        ("RIGHTPADDING",  (0, 0), (-1, -1), 20),
        ("BOX",           (0, 0), (-1, -1), 3, GOLD),
    ]))
    # Wrap in a full-page table
    page_table = Table([[t]], colWidths=[174*mm], rowHeights=[240*mm])
    page_table.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,-1), NAVY),
        ("VALIGN",        (0,0), (-1,-1), "MIDDLE"),
        ("TOPPADDING",    (0,0), (-1,-1), 0),
        ("BOTTOMPADDING", (0,0), (-1,-1), 0),
        ("LEFTPADDING",   (0,0), (-1,-1), 0),
        ("RIGHTPADDING",  (0,0), (-1,-1), 0),
    ]))
    story.append(page_table)
    story.append(PageBreak())

cover_page()

# ═══════════════════════════════════════════════════════════════════
#  TABLE OF CONTENTS
# ═══════════════════════════════════════════════════════════════════

chapter_header("Table of Contents")
sp(4)

toc_items = [
    ("1", "The Examination Sequence",           "3"),
    ("2", "Visual Acuity",                       "3"),
    ("3", "Colour Vision & Contrast Sensitivity","4"),
    ("4", "Visual Fields",                       "4"),
    ("5", "Pupil Examination",                   "5"),
    ("6", "Ocular Motility & Cover Test",        "6"),
    ("7", "External & Anterior Segment",         "7"),
    ("8", "Slit Lamp Findings",                  "8"),
    ("9", "Intraocular Pressure & Gonioscopy",   "9"),
    ("10","Fundus Examination",                  "10"),
    ("11","Key Clinical Syndromes at a Glance",  "12"),
    ("12","Quick Reference Tables",              "13"),
]

toc_data = [[
    Paragraph(f"<b>{n}.</b> {title}",
              S("TOC", fontSize=10, fontName="Helvetica", textColor=DARK_GREY, leading=16)),
    Paragraph(f"<b>{pg}</b>",
              S("TOCP", fontSize=10, fontName="Helvetica-Bold", textColor=NAVY,
                alignment=TA_CENTER))
] for n, title, pg in toc_items]

toc_t = Table(toc_data, colWidths=[145*mm, 29*mm])
toc_t.setStyle(TableStyle([
    ("ROWBACKGROUNDS", (0,0), (-1,-1), [WHITE, LIGHT_GREY]),
    ("GRID",          (0,0), (-1,-1), 0.3, HexColor("#CCCCCC")),
    ("TOPPADDING",    (0,0), (-1,-1), 6),
    ("BOTTOMPADDING", (0,0), (-1,-1), 6),
    ("LEFTPADDING",   (0,0), (-1,-1), 8),
    ("RIGHTPADDING",  (0,0), (-1,-1), 6),
    ("VALIGN",        (0,0), (-1,-1), "MIDDLE"),
]))
story.append(toc_t)
story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════
#  CHAPTER 1 - EXAMINATION SEQUENCE
# ═══════════════════════════════════════════════════════════════════

chapter_header("1. The Ophthalmology Examination Sequence")
body("A systematic approach ensures no finding is missed. Always examine BOTH eyes and document each separately. The mnemonic <b>VA-C-F-P-M-E-SL-IOP-GON-FUNDUS</b> covers the full routine.")
sp(6)

seq_data = [
    ["Step", "Examination", "Key Tool / Method"],
    ["1",  "Visual Acuity",               "Snellen / LogMAR chart, Pinhole"],
    ["2",  "Colour Vision",               "Ishihara plates (24-plate)"],
    ["3",  "Visual Fields",               "Confrontation, Amsler grid, Perimetry"],
    ["4",  "Pupils",                      "Pen torch, Swinging flashlight test"],
    ["5",  "Ocular Motility",             "9 positions of gaze, Cover test"],
    ["6",  "External / Adnexa",           "Inspection, Eversion of upper lid"],
    ["7",  "Anterior Segment (Slit Lamp)","Slit lamp biomicroscope"],
    ["8",  "Intraocular Pressure",        "Goldmann applanation tonometer"],
    ["9",  "Gonioscopy",                  "Goldmann / Zeiss goniolens"],
    ["10", "Fundus (Dilated)",            "90D/78D lens, BIO, Direct ophthalmoscope"],
]
two_col_table(seq_data[0], seq_data[1:],
              col_widths=[12*mm, 65*mm, 97*mm])

tip("Always examine pupils BEFORE dilating the eye.")
story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════
#  CHAPTER 2 - VISUAL ACUITY
# ═══════════════════════════════════════════════════════════════════

chapter_header("2. Visual Acuity")
body("Visual acuity (VA) is the most important single measurement in ophthalmology. It should be recorded for each eye separately with and without correction, and with a pinhole.")

section("Distance VA - Snellen Chart")
bullet([
    "Tested at 6 metres (or 3 m with mirror system).",
    "Record as a fraction: numerator = test distance (6m), denominator = distance at which a normal person reads that line.",
    "6/6 = normal (equivalent to 20/20 in USA); 6/60 = only top letter seen at 6 m.",
    "LogMAR chart (ETDRS): more accurate; used in clinical trials and low-vision work. 0.00 = normal (6/6).",
    "If no letters seen at 6 m, move patient closer (e.g., 3/60, 1/60).",
    "Thereafter: Count Fingers (CF) at distance, Hand Motion (HM), Perception of Light (PL), No Perception of Light (NPL).",
])
sp(4)

section("The Pinhole Test")
body("A pinhole disc eliminates refractive error by limiting light to the central optical axis.")
bullet([
    "VA improves with pinhole: refractive cause (myopia, hyperopia, astigmatism, irregular cornea).",
    "VA does NOT improve with pinhole: organic pathology (optic nerve, retina, media opacity).",
])
tip("A patient with poor VA that fully corrects with a pinhole needs refraction, not urgent ophthalmology referral.")

section("Near VA")
bullet([
    "Use Jaeger test types or near LogMAR chart at a comfortable distance (~33 cm).",
    "Always note the reading distance.",
    "Sensitive for early macular disease.",
    "Remember to ask the patient to wear their reading glasses.",
])

section("VA Recording - Quick Reference")
two_col_table(
    ["Snellen", "LogMAR", "Clinical Status"],
    [
        ["6/6",   "0.00",  "Normal"],
        ["6/9",   "0.18",  "Mild reduction"],
        ["6/12",  "0.30",  "Moderate; note for driving threshold"],
        ["6/18",  "0.48",  "Moderate; legal driving limit in many countries"],
        ["6/24",  "0.60",  "Significant impairment"],
        ["6/60",  "1.00",  "Severe; WHO definition of visual impairment"],
        ["3/60",  "1.30",  "Severe; WHO blind threshold"],
        ["CF",    ">1.30", "Counts Fingers only"],
        ["HM",    ">2.00", "Hand Motion only"],
        ["PL",    "N/A",   "Light Perception only"],
        ["NPL",   "N/A",   "No Perception of Light - functionally blind"],
    ],
    col_widths=[35*mm, 35*mm, 104*mm]
)
story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════
#  CHAPTER 3 - COLOUR VISION & CONTRAST SENSITIVITY
# ═══════════════════════════════════════════════════════════════════

chapter_header("3. Colour Vision & Contrast Sensitivity")

section("Ishihara Plates")
bullet([
    "Tests for red-green colour deficiency (most common inherited type).",
    "24-plate version standard; patient reads numbers embedded in coloured dots.",
    "Acquired red-green deficiency: optic nerve disease (optic neuritis, glaucoma), toxic optic neuropathy.",
    "Congenital: X-linked, affects ~8% males, ~0.5% females.",
    "Red desaturation is an early sensitive sign of optic neuritis - test with a bright red target and compare eyes.",
])

section("Light Brightness Comparison")
bullet([
    "Hold a torch before each eye alternately and ask 'Does the light seem equally bright?'",
    "Asymmetry suggests relative afferent pupillary defect (RAPD) or optic neuropathy.",
    "Patient may describe dimmer light as appearing 'grey' or 'like looking through fog'.",
])

section("Contrast Sensitivity")
bullet([
    "Pelli-Robson chart: rows of equal-sized letters of decreasing contrast viewed at 1 metre.",
    "Reduced in: amblyopia, optic neuropathy, cataract, higher-order aberrations.",
    "Useful when VA is preserved but patient complains of visual symptoms in low illumination.",
])
story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════
#  CHAPTER 4 - VISUAL FIELDS
# ═══════════════════════════════════════════════════════════════════

chapter_header("4. Visual Fields")

section("Confrontation Testing (Bedside)")
bullet([
    "Sit directly opposite patient at arm's length (~60 cm).",
    "Each eye tested separately; other eye covered.",
    "Examiner's eye is the reference - compare patient's field with your own.",
    "Bring finger target from periphery in four quadrants (supero-temporal, supero-nasal, infero-temporal, infero-nasal).",
    "Use red hatpin for subtle defects - colour desaturation detected before target disappearance.",
    "Central scotoma: ask patient to look at your face and report if any part is missing.",
])

section("Amsler Grid")
bullet([
    "A 10x10 cm grid with a central fixation dot; viewed at 33 cm.",
    "Patient fixates on central dot and reports: (a) any part missing/blurred, (b) any lines that appear wavy or distorted.",
    "Metamorphopsia (wavy lines) = macular pathology: wet AMD, CSCR, epiretinal membrane.",
    "Absolute scotoma = dense macular pathology.",
    "Use in every patient with macular disease at every visit.",
])

section("Automated Perimetry (Humphrey)")
bullet([
    "Gold standard for glaucoma monitoring.",
    "Static perimetry: tests sensitivity at fixed locations using variable-intensity stimuli.",
    "Standard testing: 24-2 or 30-2 pattern (tests within 24 or 30 degrees of fixation).",
    "Common reliability indices: Fixation Loss (FL), False Positive Rate (FPR), False Negative Rate (FNR) - all should be <20%.",
    "Pattern Standard Deviation (PSD) - elevated in focal field loss (glaucoma).",
    "Mean Deviation (MD) - overall field loss; negative MD = worse than normal.",
])

section("Visual Field Defect Patterns - Localisation")
two_col_table(
    ["Defect Pattern", "Anatomical Location", "Causes"],
    [
        ["Central scotoma",              "Macula or optic nerve",     "AMD, optic neuritis, toxic optic neuropathy"],
        ["Altitudinal defect",           "Optic nerve / retina",      "AION, BRAO, glaucoma"],
        ["Arcuate / Bjerrum scotoma",    "Optic nerve (arcuate NFL)", "Glaucoma (early-mid)"],
        ["Nasal step",                   "Optic nerve",               "Glaucoma"],
        ["Bitemporal hemianopia",        "Optic chiasm",              "Pituitary adenoma"],
        ["Homonymous hemianopia",        "Optic tract / radiation",   "Stroke, tumour, trauma"],
        ["Congruous homonymous defect",  "Occipital cortex",          "Cortical stroke (usually posterior)"],
        ["Enlarged blind spot",          "Optic disc",                "Papilloedema, peripapillary disease"],
    ],
    col_widths=[50*mm, 55*mm, 69*mm]
)
story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════
#  CHAPTER 5 - PUPIL EXAMINATION
# ═══════════════════════════════════════════════════════════════════

chapter_header("5. Pupil Examination")
body("Examine pupils in a semi-dark room. Always check BEFORE dilating. Note size, shape, symmetry, and reactions.")

section("Normal Pupil Reactions")
bullet([
    "Direct light reflex: light in one eye - same pupil constricts (II afferent, III efferent).",
    "Consensual light reflex: light in one eye - opposite pupil also constricts.",
    "Accommodation reflex (near triad): convergence + accommodation + miosis on looking at a near object.",
    "Normal pupil size: 2-5 mm in normal light, up to 8 mm in dark.",
])

section("Swinging Flashlight Test - RAPD")
body("The most clinically important pupil test for detecting unilateral optic nerve or severe retinal disease.")
bullet([
    "Swing torch slowly between eyes every 2-3 seconds in a dark room.",
    "Normal: both pupils constrict equally when light is directed at each eye.",
    "RAPD (Marcus Gunn pupil): When light is swung to the affected eye, the pupil DILATES (paradoxical response).",
    "RAPD indicates: asymmetric optic nerve disease, optic neuritis, AION, severe unilateral retinal disease.",
    "Bilateral symmetric optic neuropathy = no RAPD (both sides equally affected).",
    "Can also grade RAPD using neutral density filters to quantify the asymmetry.",
])
tip("RAPD is one of the most important objective signs in ophthalmology - it cannot be faked.")

section("Abnormal Pupils - Differential Diagnosis")
two_col_table(
    ["Abnormality", "Appearance", "Cause"],
    [
        ["Relative Afferent PD (RAPD)",     "Dilates with light (swinging test)",  "Optic neuritis, AION, optic nerve compression, severe retinal disease"],
        ["Horner Syndrome",                  "Miosis + ptosis + anhidrosis",        "Sympathetic chain lesion (apex lung, carotid, brainstem)"],
        ["CN III Palsy (surgical)",          "Fixed dilated pupil, complete ptosis", "Aneurysm (PCA), uncal herniation - EMERGENCY"],
        ["Adie (tonic) pupil",               "Dilated, slow light reaction, fast near response", "Ciliary ganglion damage; benign; young women"],
        ["Argyll Robertson pupil",           "Small, irregular, accommodate but don't react to light", "Neurosyphilis"],
        ["Pharmacological dilation",         "Fixed dilated, no RAPD",             "Atropine, tropicamide contamination"],
        ["Posterior synechiae",              "Irregular pupil, adhesions to lens",  "Previous uveitis"],
        ["Rubeosis iridis",                  "New vessels on iris",                 "PDR, CRVO, carotid occlusive disease"],
    ],
    col_widths=[42*mm, 55*mm, 77*mm]
)
story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════
#  CHAPTER 6 - OCULAR MOTILITY & COVER TEST
# ═══════════════════════════════════════════════════════════════════

chapter_header("6. Ocular Motility & Cover Test")

section("Ocular Movements - 9 Positions of Gaze")
bullet([
    "Ask patient to follow your finger through an 'H' pattern covering: primary gaze, right/left gaze, right-up/right-down, left-up/left-down, up and down.",
    "Note: restriction of movement, pain on movement, diplopia in any direction.",
    "Note: nystagmus direction and whether it is fast or slow phase.",
])

two_col_table(
    ["Muscle", "Action (Primary)", "Cranial Nerve"],
    [
        ["Medial rectus",    "Adduction",              "CN III"],
        ["Lateral rectus",   "Abduction",              "CN VI"],
        ["Superior rectus",  "Elevation (abducted)",   "CN III"],
        ["Inferior rectus",  "Depression (abducted)",  "CN III"],
        ["Superior oblique", "Depression (adducted) + intorsion", "CN IV"],
        ["Inferior oblique", "Elevation (adducted) + extorsion",  "CN III"],
    ],
    col_widths=[50*mm, 75*mm, 49*mm]
)

section("Cover Test")
bullet([
    "Cover-Uncover test: cover one eye and watch the uncovered eye for movement.",
    "  - Movement inward (nasally) when uncovered: exotropia (divergent squint).",
    "  - Movement outward (temporally) when uncovered: esotropia (convergent squint).",
    "Alternating cover test: rapidly alternate cover; detects latent deviation (phoria - suppressed when both eyes open).",
    "Prism cover test: measures size of deviation in prism dioptres.",
])

section("Cranial Nerve Palsy Patterns")
two_col_table(
    ["CN Palsy", "Deviation", "Special Features"],
    [
        ["CN III",  "Eye down and out; ptosis; dilated fixed pupil (surgical)", "Surgical 3rd palsy = aneurysm until proven otherwise"],
        ["CN IV",   "Hypertropia (affected eye higher); head tilt to opposite side", "Vertical diplopia; worse on downward gaze (stairs)"],
        ["CN VI",   "Esotropia; failure to abduct",  "Most common ocular motor palsy; raised ICP false localising sign"],
    ],
    col_widths=[20*mm, 80*mm, 74*mm]
)
tip("A CN III palsy with pupil involvement is a neurological emergency until an aneurysm is excluded.")
story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════
#  CHAPTER 7 - EXTERNAL & ANTERIOR SEGMENT
# ═══════════════════════════════════════════════════════════════════

chapter_header("7. External Examination & Anterior Segment")
body("Examine systematically from outer to inner structures: periorbita -> lids -> conjunctiva -> cornea -> anterior chamber -> iris -> lens.")

section("Eyelids")
two_col_table(
    ["Finding", "Description", "Significance"],
    [
        ["Ptosis",        "Drooping of upper lid; MRD1 <2mm abnormal",         "CN III palsy (+ dilated pupil), Horner (+ miosis), myasthenia, levator dehiscence"],
        ["Lid lag",       "Upper lid lags behind globe on downgaze",            "Thyroid eye disease (von Graefe sign)"],
        ["Lagophthalmos", "Incomplete lid closure",                             "CN VII palsy; corneal exposure risk"],
        ["Entropion",     "Lid margin turns inward; lashes touch cornea",       "Involutional (elderly); cicatricial (trachoma, OCP)"],
        ["Ectropion",     "Lid margin turns outward; exposed conjunctiva",      "Involutional; paralytic; cicatricial"],
        ["Trichiasis",    "Misdirected lashes touching cornea",                 "Trachoma, lid scarring - corneal abrasion risk"],
        ["Chalazion",     "Painless tarsal cyst - meibomian gland blockage",    "May indent cornea causing astigmatism"],
        ["Hordeolum (stye)", "Acute painful lid abscess",                       "Staphylococcal infection of Zeis/Moll glands"],
        ["Blepharitis",   "Lid margin inflammation; scaling, telangiectasia",   "Staphylococcal / seborrhoeic / meibomian gland disease"],
    ],
    col_widths=[35*mm, 70*mm, 69*mm]
)

section("Conjunctiva - Injection Patterns")
two_col_table(
    ["Pattern", "Location", "Causes"],
    [
        ["Conjunctival injection", "Peripheral / fornices; moves with conjunctiva", "Conjunctivitis (bacterial, viral, allergic)"],
        ["Ciliary / circumcorneal injection", "Limbal, fixed, does not move", "Keratitis, uveitis, acute angle closure - SERIOUS"],
        ["Mixed injection",   "Both patterns",          "Severe conjunctivitis, scleritis"],
        ["Sectoral redness",  "One segment",            "Scleritis, episcleritis"],
    ],
    col_widths=[50*mm, 60*mm, 64*mm]
)

section("Conjunctival Findings")
bullet([
    "Follicles: small rounded elevations; avascular centre; viral (adenovirus), chlamydial, toxic.",
    "Papillae: flat-topped elevations with central vascular core; allergic (giant papillae in VKC/GPC), bacterial.",
    "Chemosis: conjunctival oedema; severe allergy, thyroid eye disease, post-operative.",
    "Subconjunctival haemorrhage: bright red blood; usually benign (Valsalva, hypertension, trauma); check IOP if spontaneous.",
    "Pterygium: fibrovascular tissue encroaching onto cornea from nasal side; UV exposure.",
])

section("Cornea")
two_col_table(
    ["Sign", "Description", "Significance"],
    [
        ["Keratic precipitates (KPs)", "Inflammatory cell deposits on endothelium", "Small/stellate: non-granulomatous uveitis. Mutton-fat: granulomatous (TB, sarcoid, leprosy)"],
        ["Corneal ulcer",       "Epithelial + stromal defect with infiltrate",    "Bacterial (dense, suppurative); fungal (feathery edges); Acanthamoeba (ring infiltrate); HSV (dendritic with fluorescein)"],
        ["Band keratopathy",    "Horizontal calcium band at interpalpebral zone", "Chronic uveitis, hypercalcaemia, long-standing eye disease"],
        ["Arcus senilis",       "Peripheral white ring, clear zone at limbus",    "Normal >60 yrs; premature (<45): hyperlipidaemia"],
        ["Vortex keratopathy",  "Whorl pattern of epithelial deposits",           "Amiodarone, hydroxychloroquine, Fabry disease"],
        ["Bullous keratopathy", "Epithelial blisters; Seidel test negative",      "Endothelial failure (Fuchs, post-cataract surgery)"],
        ["Fluorescein staining","Green stain under cobalt blue light",            "Epithelial defects: abrasion, ulcer, HSV dendrite, exposure keratopathy"],
    ],
    col_widths=[42*mm, 60*mm, 72*mm]
)
story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════
#  CHAPTER 8 - SLIT LAMP FINDINGS
# ═══════════════════════════════════════════════════════════════════

chapter_header("8. Slit Lamp Findings - Anterior Segment")
body("The slit lamp is the cornerstone of ophthalmic examination. It gives a binocular, magnified, co-axially illuminated view of anterior and posterior segments.")

section("Slit Lamp Illumination Techniques")
two_col_table(
    ["Technique", "Method", "Best For"],
    [
        ["Diffuse broad beam",      "Wide beam, low magnification",                  "General survey; gross abnormalities"],
        ["Direct focal (narrow slit)","Narrow bright beam at angle",                "Corneal layers, AC depth, lens opacities"],
        ["Scleral scatter",         "Beam on limbus; microscope centred",            "Subtle corneal stromal haze, infiltrates"],
        ["Retroillumination",       "Reflected light from iris or fundus",           "Epithelial cysts, KPs, corneal NV"],
        ["Specular reflection",     "Angle of incidence = angle of reflection",      "Corneal endothelium: guttata, cell density"],
    ],
    col_widths=[45*mm, 65*mm, 64*mm]
)

section("Anterior Chamber - Cell and Flare Grading")
body("Inflammatory cells and protein (flare) in the anterior chamber are hallmarks of uveitis. Grade each separately.")
two_col_table(
    ["Grade", "Cells (per HPF)", "Flare"],
    [
        ["0",   "None",      "None"],
        ["0.5+","1-5",       "Barely detectable"],
        ["1+",  "6-15",      "Faint (iris/lens detail clear)"],
        ["2+",  "16-25",     "Moderate (iris/lens detail hazy)"],
        ["3+",  "26-50",     "Marked (iris/lens detail very hazy)"],
        ["4+",  ">50 (fibrin/plastic aqueous)", "Intense (fibrin / set aqueous)"],
    ],
    col_widths=[25*mm, 70*mm, 79*mm]
)

section("Uveitis Classification & Slit Lamp Clues")
two_col_table(
    ["Type", "Location", "Key SL Findings", "Causes"],
    [
        ["Anterior uveitis (iridocyclitis)", "AC + anterior vitreous", "KPs, AC cells/flare, posterior synechiae, fibrin", "HLA-B27 (AS, Reiter), herpes, JIA, idiopathic"],
        ["Intermediate uveitis", "Vitreous / pars plana", "Snowball vitreous cells, snowbanking (pars plana)", "Sarcoidosis, MS, Lyme, idiopathic"],
        ["Posterior uveitis",    "Retina / choroid",      "Vitreous haze, retinochoroiditis lesions",          "Toxoplasma, CMV, TB, sarcoid"],
        ["Panuveitis",           "All segments",          "All of above combined",                             "Sarcoid, TB, Behcet, VKH"],
    ],
    col_widths=[38*mm, 30*mm, 55*mm, 51*mm]
)

section("Lens Findings")
two_col_table(
    ["Cataract Type", "Location", "Appearance", "Associations"],
    [
        ["Nuclear sclerosis",      "Central nucleus",            "Yellow-brown discolouration on retro-illum", "Ageing, myopic shift"],
        ["Posterior subcapsular",  "Posterior cortex, axial",    "Dense central plaque on retro-illum",         "Steroids, DM, radiation, ocular inflammation"],
        ["Anterior cortical",      "Anterior cortex, spoke-like","Spoke or cuneiform opacities",                "Ageing, trauma"],
        ["Posterior cortical",     "Posterior cortex",           "Radial spoke pattern",                        "Ageing"],
        ["Mature/Hypermature",     "Whole lens",                 "Completely white; liquefaction in hypermature","Advanced ageing; risk of phacolytic glaucoma"],
        ["Subluxation",            "Displaced lens",             "Iridodonesis; visible zonules",               "Marfan, homocystinuria, Weill-Marchesani, trauma"],
    ],
    col_widths=[42*mm, 35*mm, 48*mm, 49*mm]
)
story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════
#  CHAPTER 9 - IOP & GONIOSCOPY
# ═══════════════════════════════════════════════════════════════════

chapter_header("9. Intraocular Pressure & Gonioscopy")

section("Intraocular Pressure (IOP)")
bullet([
    "Normal range: 10-21 mmHg (population mean ~16 mmHg, SD ~3).",
    "Goldmann applanation tonometry: gold standard; measures force needed to applanate a 3.07 mm diameter area of cornea.",
    "Influenced by central corneal thickness (CCT): thin cornea (< 500 microns) underestimates IOP; thick cornea (> 580 microns) overestimates.",
    "Non-contact (air puff): screening only; less accurate.",
    "Icare rebound: no anaesthetic; useful for children.",
    "IOP > 21 mmHg = ocular hypertension (risk factor for POAG, not diagnostic).",
    "Normal-tension glaucoma (NTG): IOP consistently <21 mmHg but glaucomatous disc/field damage present.",
])

section("Diurnal Variation")
bullet([
    "IOP typically highest in early morning and lowest in the afternoon/evening.",
    "Variation > 5-8 mmHg in a day is significant.",
    "Phasing (multiple readings over a day) may be needed to detect peak IOP in suspected NTG.",
])

section("Gonioscopy - Angle Assessment")
body("A special contact lens placed on the anaesthetised eye allows direct visualisation of the iridocorneal angle - the region through which aqueous drains.")
bullet([
    "Shaffer grading: Grade 0 = closed (no structures seen); Grade 1 = narrow; Grade 2 = at risk of closure; Grade 3-4 = open.",
    "Angle structures from outside in: Schwalbe line, Trabecular meshwork (TM), Scleral spur, Ciliary body band, Iris root.",
    "Pigment in TM: normal ageing, pseudoexfoliation syndrome, pigment dispersion syndrome.",
    "Peripheral anterior synechiae (PAS): angle adhesions from chronic angle closure or inflammation.",
    "Rubeosis (angle NV): neovascularisation - suggests ischaemia (PDR, CRVO, carotid disease) - urgent.",
])
story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════
#  CHAPTER 10 - FUNDUS EXAMINATION
# ═══════════════════════════════════════════════════════════════════

chapter_header("10. Fundus Examination (Posterior Segment)")
body("Always dilate the pupil before fundus examination unless contraindicated. Tropicamide 1% (onset 20-30 min) is standard. Use phenylephrine 2.5% additionally if dilation is poor. Warn patients about photophobia and blurred near vision for 4-6 hours.")

section("Optic Disc - Systematic Assessment")
bullet([
    "Cup-to-disc ratio (CDR): vertical CDR > 0.6 or asymmetry > 0.2 between eyes is suspicious for glaucoma.",
    "Disc margin: sharp (normal) vs. blurred (papilloedema, papillitis) vs. tilted (myopia, anomalous).",
    "Colour: pink/orange normal; pale disc = optic atrophy (previous neuritis, ischaemia, compression, glaucoma).",
    "Rim tissue: ISNT rule - normally Inferior > Superior > Nasal > Temporal in thickness; violation suggests glaucoma.",
    "Disc haemorrhages: splinter haemorrhages at disc margin = significant for glaucoma progression.",
    "Peripapillary atrophy: beta zone (RPE loss) around disc; often in glaucoma and myopia.",
    "Neovascularisation of disc (NVD): in proliferative diabetic retinopathy - urgent.",
])

section("Papilloedema vs Papillitis")
two_col_table(
    ["Feature", "Papilloedema", "Papillitis (Optic Neuritis)"],
    [
        ["Cause",           "Raised intracranial pressure",       "Demyelination (MS), viral, inflammatory"],
        ["Laterality",      "Bilateral (usually)",                "Unilateral (usually)"],
        ["Vision",          "Normal initially; enlarged blind spot","Reduced (often severely)"],
        ["Pain",            "Headache (from raised ICP)",         "Pain on eye movement"],
        ["RAPD",            "Absent (unless longstanding)",        "Present"],
        ["Disc appearance", "Swollen, blurred margins, hyperaemic","Swollen, hyperaemic (or normal in retrobulbar)"],
        ["Urgency",         "Neurological emergency",             "Usually self-limiting; investigate for MS"],
    ],
    col_widths=[40*mm, 65*mm, 69*mm]
)

section("Retinal Haemorrhages - Types and Significance")
two_col_table(
    ["Type", "Appearance", "Location", "Causes"],
    [
        ["Flame haemorrhage",       "Superficial, linear, feathered edges", "Nerve fibre layer",    "Hypertension, CRVO, BRVO, papilloedema"],
        ["Dot/blot haemorrhage",    "Round, dark, discrete",                "Deep retinal layers",  "Diabetes (microaneurysm rupture), CRVO"],
        ["Preretinal haemorrhage",  "Boat/D-shaped; fluid level",           "Pre-retinal space",    "PDR, CRVO, Valsalva, trauma"],
        ["Vitreous haemorrhage",    "Red haze obscuring fundus",            "Vitreous cavity",      "PDR, retinal tear, trauma"],
        ["Sub-RPE haemorrhage",     "Dark, dense, under retina",            "Sub-RPE space",        "Wet AMD, choroidal rupture"],
        ["Roth spots",              "White-centred haemorrhages",           "Nerve fibre layer",    "Infective endocarditis, leukaemia, anaemia"],
    ],
    col_widths=[40*mm, 45*mm, 35*mm, 54*mm]
)

section("Exudates - Hard vs. Soft")
two_col_table(
    ["Type", "Appearance", "Composition", "Significance"],
    [
        ["Hard exudates", "Bright yellow waxy deposits; discrete borders; may form circinate ring", "Lipid + protein leakage from damaged capillaries", "Diabetes, hypertension, CRVO/BRVO; macular hard exudates threaten vision"],
        ["Cotton wool spots (soft exudates)", "White/grey fluffy patches; obscure underlying vessels; transient", "Focal nerve fibre layer infarcts (axoplasmic flow obstruction)", "Hypertension, diabetes, HIV retinopathy, CRVO, vasculitis"],
    ],
    col_widths=[32*mm, 45*mm, 45*mm, 52*mm]
)

section("Macula Assessment")
bullet([
    "Normal: foveal reflex present (bright central light reflection).",
    "Drusen: yellow deposits under RPE; soft drusen (> 63 microns, soft edges) = risk for AMD.",
    "Geographic atrophy (GA): area of RPE/photoreceptor loss; dry AMD end stage.",
    "Subretinal fluid / neovascular membrane: wet AMD; subretinal haemorrhage, grey-green membrane.",
    "Epiretinal membrane (ERM): cellophane/crinkled appearance at macula; causes metamorphopsia.",
    "Macular hole: round full-thickness defect; central scotoma; Watzke-Allen test positive.",
    "Cherry red spot: bright red fovea with surrounding pale retina; CRAO or storage diseases.",
    "Macular star: hard exudate in Henle fibre layer radiating from fovea; hypertensive retinopathy, neuroretinitis.",
])

section("Diabetic Retinopathy Classification")
two_col_table(
    ["Stage", "Features"],
    [
        ["No DR",                          "Normal fundus"],
        ["Mild NPDR",                      "Microaneurysms only"],
        ["Moderate NPDR",                  "Dot/blot haemorrhages, hard exudates, cotton wool spots"],
        ["Severe NPDR (4-2-1 rule)",       "4 quadrants haem/MA, 2 quadrants IRMA, 1 quadrant venous beading"],
        ["Proliferative DR (PDR)",         "Neovascularisation of disc (NVD) and/or elsewhere (NVE)"],
        ["Advanced PDR",                   "Vitreous/preretinal haemorrhage, tractional retinal detachment"],
        ["Diabetic Macular Oedema (DMO)",  "Retinal thickening within 500 microns of fovea (any stage)"],
    ],
    col_widths=[55*mm, 119*mm]
)

section("Hypertensive Retinopathy - Keith-Wagener-Barker Classification")
two_col_table(
    ["Grade", "Features"],
    [
        ["Grade 1", "Mild arteriolar narrowing; increased light reflex (silver/copper wiring)"],
        ["Grade 2", "AV nipping (Salus sign) at crossings; definite arteriolar narrowing"],
        ["Grade 3", "Haemorrhages (flame), cotton wool spots, hard exudates"],
        ["Grade 4", "Grade 3 + papilloedema - hypertensive emergency"],
    ],
    col_widths=[25*mm, 149*mm]
)
story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════
#  CHAPTER 11 - KEY CLINICAL SYNDROMES
# ═══════════════════════════════════════════════════════════════════

chapter_header("11. Key Clinical Syndromes at a Glance")

section("Red Eye - Differential Diagnosis")
two_col_table(
    ["Condition", "Pain", "Vision", "Discharge", "Pupil", "Key Features"],
    [
        ["Conjunctivitis",       "Gritty/burning", "Normal",   "Yes",           "Normal",   "Follicles or papillae; bilateral common"],
        ["Corneal ulcer/abrasion","Severe",         "Reduced",  "Usually",       "Normal",   "Fluorescein positive; ciliary flush"],
        ["Anterior uveitis",     "Aching",          "Reduced",  "No",            "Small/irreg","KPs, cells/flare, ciliary flush, photophobia"],
        ["Acute angle closure",  "Severe; nausea",  "Severely reduced", "No",    "Fixed, mid-dilated", "Hard eye; halos; raised IOP; corneal haze"],
        ["Scleritis",            "Severe boring",   "Variable", "No",            "Normal",   "Scleral tenderness; dark bluish-red hue"],
        ["Episcleritis",         "Mild/none",       "Normal",   "No",            "Normal",   "Sectoral; blanches with phenylephrine 10%"],
        ["Subconj. haemorrhage", "None",            "Normal",   "No",            "Normal",   "Bright red; no pain; reassure"],
    ],
    col_widths=[35*mm, 22*mm, 22*mm, 20*mm, 22*mm, 53*mm]
)

section("Sudden Vision Loss - Differential")
two_col_table(
    ["Onset", "Condition", "Eye / Laterality", "Key Finding"],
    [
        ["Seconds (transient)", "Amaurosis fugax",          "Unilateral",    "Embolic; carotid disease; resolve in minutes"],
        ["Minutes",             "Acute angle closure",      "Unilateral",    "Painful; raised IOP; mid-dilated pupil"],
        ["Hours",               "Wet AMD (haemorrhage)",    "Unilateral",    "Central distortion; subretinal haem"],
        ["Painless, sudden",    "CRAO",                     "Unilateral",    "Cherry red spot; afferent white retina; RAPD"],
        ["Painless, sudden",    "CRVO",                     "Unilateral",    "Flame haemorrhages all 4 quadrants; disc swelling"],
        ["Painless, sudden",    "Vitreous haemorrhage",     "Unilateral",    "Red/dark haze; absent fundus view; PDR/tear"],
        ["Painless, sudden",    "Retinal detachment",       "Unilateral",    "Curtain/shadow; preceded by flashes+floaters"],
        ["With pain, days",     "Optic neuritis",           "Unilateral",    "RAPD; colour desaturation; pain on movement; young female"],
        ["Gradual (weeks/mo)",  "AMD / cataract / POAG",    "Uni/bilateral", "Progressive; corresponding signs"],
    ],
    col_widths=[32*mm, 42*mm, 28*mm, 72*mm]
)
story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════
#  CHAPTER 12 - QUICK REFERENCE TABLES
# ═══════════════════════════════════════════════════════════════════

chapter_header("12. Quick Reference Tables")

section("Fundus Appearance - Classic Findings by Disease")
two_col_table(
    ["Disease", "Classic Fundus Findings"],
    [
        ["Diabetic Retinopathy",      "Microaneurysms, dot/blot haemorrhages, hard exudates, cotton wool spots, NVD/NVE in PDR"],
        ["Hypertensive Retinopathy",  "AV nipping, flame haemorrhages, cotton wool spots, macular star, papilloedema (Gr.4)"],
        ["Wet AMD",                   "Subretinal fluid/blood, grey-green choroidal neovascular membrane, drusen"],
        ["Dry AMD",                   "Drusen (soft/confluent), geographic atrophy, RPE changes, no subretinal fluid"],
        ["CRAO",                      "Pale opaque retina, cherry red spot, attenuated arteries, RAPD"],
        ["CRVO",                      "Dilated tortuous veins, flame haemorrhages all 4 quadrants, disc oedema"],
        ["AION (arteritic/non-art.)", "Swollen pale disc (arteritic) or hyperaemic (non-art.); altitudinal field loss"],
        ["Glaucoma",                  "Enlarged cup (CDR > 0.6), inferior/superior notching, disc haemorrhage, NFL defects"],
        ["Retinitis Pigmentosa",       "Bone-spicule pigmentation (mid-periphery), attenuated vessels, waxy disc pallor"],
        ["Toxoplasma chorioretinitis","Fluffy white retinochoroiditis lesion adjacent to old pigmented scar (headlight in fog)"],
        ["CMV Retinitis",             "Thick white necrotic retina following vessels (pizza pie/scrambled eggs appearance)"],
        ["Retinal Detachment",        "Pale elevated retina with folds; loss of choroidal pattern; retinal tear visible"],
        ["Papilloedema",              "Blurred disc margins, obliteration of cup, disc hyperaemia, Paton lines"],
        ["Macular Hole",              "Round full-thickness defect at fovea; yellow deposits at base"],
        ["Epiretinal Membrane",       "Cellophane sheen over macula; vessel tortuosity; pseudo-hole possible"],
        ["VKH Syndrome",              "Multiple serous retinal detachments; disc hyperaemia; RPE changes"],
    ],
    col_widths=[52*mm, 122*mm]
)

sp(4)
section("Optic Disc Grading - Cup:Disc Ratio")
two_col_table(
    ["CDR", "Interpretation"],
    [
        ["< 0.5",        "Normal"],
        ["0.5 - 0.6",    "Borderline; compare with fellow eye"],
        ["> 0.6",        "Suspicious for glaucoma; correlate with IOP and fields"],
        ["Asymmetry > 0.2 between eyes", "Suspicious for glaucoma regardless of absolute CDR"],
    ],
    col_widths=[60*mm, 114*mm]
)

sp(4)
section("Drug-Induced Ocular Side Effects")
two_col_table(
    ["Drug", "Ocular Effect"],
    [
        ["Hydroxychloroquine (Plaquenil)", "Bull's eye maculopathy; central scotoma; irreversible; screen annually after 5 years"],
        ["Corticosteroids (systemic/topical)", "Posterior subcapsular cataract; raised IOP (steroid responder)"],
        ["Tamsulosin (alpha-blocker)", "Intraoperative floppy iris syndrome (IFIS) during cataract surgery"],
        ["Amiodarone",              "Corneal verticillata (whorl deposits); optic neuropathy"],
        ["Ethambutol",              "Toxic optic neuropathy; red-green colour deficiency; dose-dependent"],
        ["Vigabatrin",              "Irreversible concentric visual field constriction; bilateral"],
        ["Topiramate",              "Acute angle closure glaucoma (bilateral); myopia; choroidal effusion"],
        ["Digoxin (toxicity)",      "Xanthopsia (yellow tinge); halos; visual disturbance"],
        ["Sildenafil",              "Cyanopsia (blue tinge); NAION in susceptible patients"],
        ["Rifampicin",              "Red-orange discolouration of tears/contact lenses"],
    ],
    col_widths=[55*mm, 119*mm]
)

# ── Source footer ─────────────────────────────────────────────────
story.append(Spacer(1, 14))
story.append(HRFlowable(width="100%", thickness=1, color=TEAL, spaceAfter=6))
story.append(Paragraph(
    "Source: Kanski's Clinical Ophthalmology: A Systematic Approach, 10th Edition | "
    "Wills Eye Manual, 8th Edition | Study Guide compiled for clinical postings.",
    SOURCE
))

# ── Build ─────────────────────────────────────────────────────────
doc.build(story)
print(f"PDF created: {OUTPUT}")
Running Command

cd /home/daytona/workspace/ophthal-study-guide && python3 build_pdf.py 2>&1

Running Command

ls -lh /home/daytona/workspace/ophthal-study-guide/

Your study guide is ready. Here's your download link:

Ophthalmology Examination Study Guide

PDF Document · PDF


What's inside (45 KB, ~14 pages):
ChapterContent
1Full 10-step examination sequence with tools
2Visual acuity - Snellen/LogMAR table, pinhole test
3Colour vision, Ishihara plates, contrast sensitivity
4Visual fields - confrontation, Amsler grid, perimetry, field defect localisation
5Pupil examination - RAPD, abnormal pupil differential table
6Ocular motility, cover test, CN palsy patterns
7Eyelid findings, conjunctival injection types, corneal signs
8Slit lamp techniques, uveitis grading, cataract types
9IOP measurement, gonioscopy, Shaffer grading
10Fundus - disc, retinal haemorrhages, exudates, DR staging, hypertensive retinopathy
11Red eye differential, sudden vision loss differential
12Classic fundus findings by disease, drug-induced ocular effects
The guide is formatted with colour-coded chapter headers, graded tables, and clinical tip boxes - built from Kanski's Clinical Ophthalmology, 10th edition.
This is a shared conversation. Sign in to Orris to start your own chat.