On amblyopia topic I want notes from standard books definitions types management diagnosis and guidelines which are ideal, also for amblyopia treatment studies

Reading File
Finding Sources
Searching PubMed

amblyopia treatment

Reading File
Reading File
Reading File
Reading Article

PMID: 39222269

Reading File
Reading File
Reading Article

PMID: 34534556

Reading Article

PMID: 39607280

Finding Sources
Finding Sources
Reading Article

PMID: 36306974

Reading Article

PMID: 34624028

Finding Sources
Finding Sources
Searching PubMed

amblyopia patching atropine PEDIG randomized trial

Finding Sources
Searching PubMed

amblyopia refractive adaptation spectacles visual acuity children

Searching the Web

amblyopia diagnosis management guidelines 2024 AAO PEDIG patching atropine

I now have comprehensive data. Let me compile the full notes.

Amblyopia - Comprehensive Clinical Notes

Sources: Kanski's Clinical Ophthalmology 10th Ed., Wills Eye Manual 8th Ed., Adams & Victor's Neurology 12th Ed., AAO Preferred Practice Pattern (2022, updated 2024), AOA Clinical Practice Guideline, PEDIG Research, and recent PubMed studies

1. Definition

Kanski's Clinical Ophthalmology (10th Ed.):
"Amblyopia is the unilateral, or rarely bilateral, decrease in best corrected visual acuity (VA) caused by form vision deprivation and/or abnormal binocular interaction, for which there is no identifiable pathology of the eye or visual pathway."
Wills Eye Manual (8th Ed.):
"Poorer vision in one eye that is not entirely improved with refraction and not entirely explained by an organic lesion. Central vision is primarily affected, while the peripheral visual field usually remains normal. The decrease in vision develops during the first decade of life."
AOA Clinical Practice Guideline:
Amblyopia is a unilateral or bilateral condition in which the best corrected VA is reduced because of abnormal visual experience during the critical period of visual development - not attributable to any structural abnormality of the eye or posterior visual pathway.

2. Types / Classification

TypeMechanismNotes
StrabismicAbnormal binocular interaction; continued monocular suppression of the deviating eyeMost common form (along with anisometropic)
AnisometropicDifference in refractive error between eyes (as little as 1 D); more ametropic eye receives blurred imageFrequently associated with microstrabismus; may co-exist with strabismic amblyopia
Stimulus Deprivation (Form Deprivation)Vision deprivation from media opacities (e.g. cataract) or ptosis covering the pupilUnilateral or bilateral; most severe form; can occur from congenital cataracts
Bilateral AmetropicHigh symmetrical refractive errors, usually hypermetropiaBilateral; both eyes affected
MeridionalImage blur in one meridian due to uncorrected astigmatism (usually >1 D)Unilateral or bilateral; results from failure of emmetropization
Occlusion (Iatrogenic)Occurs in the fellow eye due to excessive patching or atropine usePrevented by monitoring at 1 week per year of age
Nutritional/Toxic (Tobacco-Alcohol)B12/folate deficiency or toxic damageDifferent mechanism - not developmental; also called nutritional optic neuropathy
(Kanski, p. 733; Wills Eye Manual, p. 513)

3. Pathophysiology and Critical Period

  • Amblyopia is a neurodevelopmental disorder - the primary defect is cortical, not retinal.
  • The critical period of visual development is the window during which the visual cortex requires normal, balanced visual input from both eyes to develop properly.
  • Strabismic amblyopia: sensitive period typically up to 7-8 years.
  • Anisometropic amblyopia: may extend into the teens, especially where good binocular function is preserved.
  • Mechanisms include:
    • Monocular suppression (strabismic type): the visual cortex actively suppresses input from the deviating eye to avoid diplopia.
    • Blur-induced deprivation (anisometropic type): a chronically defocused image fails to provide adequate stimulation for cortical development.
    • Complete deprivation (stimulus deprivation): the most severe form; no patterned visual input reaches the cortex.
(Kanski p. 733; AAO PPP 2022)

4. Diagnosis

Clinical Features

Critical signs (Wills Eye):
  • Poorer vision in one eye that is NOT entirely improved with refraction
  • NOT entirely explained by an organic lesion
  • Nearly always higher refractive error in the involved eye (anisometropic type)
Other features:
  • Crowding phenomenon: Individual letters are more easily read than a full line (more pronounced in amblyopes than normals). Must be taken into account when testing preverbal children.
  • Neutral density filter effect: In reduced illumination, VA of an amblyopic eye decreases much less than an organically diseased eye.
  • Relative afferent pupillary defect (RAPD): Severe amblyopia may cause a trace RAPD - care needed to avoid false-positive results in strabismus patients.
Kanski diagnostic criterion:
"In the absence of an organic lesion, a difference in best-corrected VA of two Snellen lines or more (or >1 log unit) is indicative of amblyopia."

Workup

  1. History: Childhood eye problem, misaligned eyes, patching history, muscle surgery?
  2. Ocular examination: Rule out organic cause for reduced vision (examine fundi before starting treatment).
  3. Cover-uncover test: Evaluate eye alignment.
  4. Cycloplegic refraction: Both eyes mandatory.
  5. Stereopsis testing: Randot, Titmus fly, Lang test.
  6. Sensory anomaly tests: Worth 4 dot, Bagolini glasses.
(Wills Eye Manual, p. 513-514; Kanski, p. 733)

5. Management

Step 1 - Treat the Underlying Cause First

  • Remove media opacities: Surgery for cataract immediately, then patch the non-amblyopic eye.
  • Correct refractive error: Full cycloplegic refraction - this alone may resolve amblyopia in many children (spectacle correction alone improves VA by ≥2 lines in 77% of anisometropic cases).
  • Strabismus surgery: Delay until vision is equalized or maximal VA is achieved in the amblyopic eye.

Step 2 - Refractive Adaptation Period

  • Allow 6-12 weeks of full-time spectacle wear before adding patching/penalization.
  • Studies show glasses alone can fully treat amblyopia in a significant proportion of patients.
  • If vision remains reduced after refractive adaptation, proceed to amblyopia therapy.

Step 3 - Amblyopia Therapy (for age <12 years)

A. Occlusion (Patching) - FIRST LINE

  • Patch the dominant (better-seeing) eye to force use of the amblyopic eye.
  • Dose: 2-6 hours/day for moderate amblyopia; full-time or part-time depending on age and density.
  • AAO PPP: Most children with moderate amblyopia (20/40-20/80) respond to 2 hours/day of patching.
  • Adhesive patches placed directly over the eye are most effective.
  • Patches worn over glasses are NOT ideal (risk of peeking).
  • Follow-up: 1 week per year of age (e.g., 3 weeks for a 3-year-old).
  • Monitor VA in BOTH eyes - younger patients improve faster but risk occlusion amblyopia in the good eye.
  • If no improvement after 6 months of effective occlusion: further treatment unlikely to be fruitful (Kanski).
  • Continue until vision is equalized or shows no further improvement after three compliant cycles.

B. Pharmacological Penalization (Atropine) - ALTERNATIVE / SECOND LINE

  • Atropine 1% drops instilled in the dominant (non-amblyopic) eye to blur it (cycloplegia prevents accommodation).
  • PEDIG trials: Atropine 1% daily is equally effective as 6 hours of patching for moderate amblyopia (20/40-20/100) in ages 3-7. Patching shows faster initial improvement but outcomes are equal at follow-up.
  • Weekend atropine (Saturday and Sunday only) is equal to daily atropine - improves compliance.
  • Best for: mild-to-moderate amblyopia (6/24 or better), especially anisometropic hypermetropia.
  • Advantage: cannot be thwarted by the child; less psychosocial burden than patching.
  • AAO PPP: most moderate amblyopia responds to weekend atropine.
  • Caution: if hyperopic child has difficulty at school, use full hyperopic correction + +2.50 bifocal during school, or switch to weekend-only dosing.

C. Optical Degradation

  • High plus lens (e.g., +9.00 D or aphakic contact lens) blurs the fellow eye.
  • Remove the minus lens from the preferred eye if highly myopic.

D. Bangerter (Translucent) Filters

  • Translucent foil applied to the spectacle lens of the dominant eye.
  • Graded density options; less cosmetically conspicuous than patching.
  • AAO PPP lists this as a suitable treatment option.

E. Digital Therapeutics (Dichoptic Treatment) - EMERGING

  • See Section 7 for evidence.

Step 4 - Maintenance

  • After achieving maximum improvement: use part-time patching to maintain gains and prevent recurrence.
  • Long-term follow-up required, especially through the sensitive period.
  • Protective glasses recommended if amblyopia cannot be fully treated (one-eyed athlete rule: any child not reaching 20/40 needs sports eye protection).
(Kanski p. 733-734; Wills Eye Manual p. 514-515; AAO PPP 2022/2024)

6. AAO Preferred Practice Pattern Guidelines (2022, Updated May 2026)

Key recommendations from the AAO Amblyopia PPP 2022:
  1. Refractive correction alone can improve VA in anisometropic, strabismic, or combined amblyopia - and also in bilateral refractive amblyopia.
  2. Moderate amblyopia (20/40-20/80): Most respond to 2 hours of daily patching OR weekend atropine.
  3. Following treatment: Continued monitoring is necessary; additional treatment if needed is associated with long-term durability of VA improvement.
  4. Suitable treatment options: optical correction, patching, pharmacological treatment, optical treatment, Bangerter filters, digital therapeutics - in addition to managing the underlying cause.
  5. Older children and adolescents: Treatment may be effective, particularly if previously untreated.
  6. Goals: Identify children at risk, examine at earliest possible age, treat to improve visual function and reduce likelihood of vision-related disability.
Treatment monitoring intervals:
  • 1 week per year of age for patching cases.
  • Regular bilateral VA checks to detect occlusion amblyopia.

7. Treatment Studies - Recent Evidence

A. PEDIG (Pediatric Eye Disease Investigator Group) - Landmark Trials

PEDIG is the primary source of RCT-level evidence for amblyopia management:
Study FocusFinding
Patching vs. AtropineEqual outcomes for moderate amblyopia; patching faster initially
2h vs. 6h daily patchingSimilar outcomes for moderate amblyopia
Weekend vs. daily atropineEqual VA improvement; weekend dosing improves compliance
Spectacles aloneSubstantial improvement in many patients before any occlusion therapy
Older children (7-17y)Patching effective even in previously untreated older children

B. Binocular / Dichoptic Treatment - Systematic Review (2024)

Tsani et al., International Ophthalmology 2024 [PMID: 39222269] - Systematic Review
  • Reviewed 20 RCTs, 1769 patients
  • 12 different binocular amblyopia treatment types identified; two main categories:
    1. Presentation of low-contrast images to the fellow eye (stimulating amblyopic eye only)
    2. Combination of low-contrast fellow-eye images with dichoptic complementary deficits in both eyes
  • Conclusion: Binocular treatment shows promising results for anisometropic, strabismic, and mixed amblyopia. Further RCTs needed to establish optimal dosage, type, and duration before it becomes standard care.

C. Dichoptic Digital Therapeutic RCT - Phase III (2022)

Xiao et al., Ophthalmology 2022 [PMID: 34534556] - Phase III RCT
  • 105 children aged 4-7 with amblyopia; 21 sites in the USA
  • Treatment: dichoptic digital therapeutic (1 hour/day, 6 days/week) + glasses vs. glasses alone
  • At 12 weeks: treatment group improved 1.8 lines vs. 0.8 lines in control (difference = 1.0 lines; P = 0.0011)
  • Trial stopped early for success at pre-planned interim analysis
  • Note: An erratum was published (PMID: 35461530)

D. Eye-Tracking Dichoptic Home Treatment vs. Patching (2023)

Wygnanski-Jaffe et al., Ophthalmology 2023 [PMID: 36306974] - Multicenter RCT
  • 103 children aged 4 to <9; CureSight device (anaglyph glasses + eye tracker, real-time blur around fellow eye fovea)
  • 90 min/day x 5 days/week (120 hours total) vs. 2h patching x 7 days/week (224 hours total)
  • Results: CureSight noninferior to patching (0.28 vs. 0.23 logMAR improvement; 90% CI within prespecified margin)
  • Binocular treatment group had significantly higher adherence (91% vs. 83%, P = 0.011)
  • Similar stereoacuity and binocular VA improvements in both groups
  • Conclusion: Dichoptic eye-tracking treatment is a viable, well-tolerated alternative to patching with better adherence.

E. Binocular Treatment Meta-Analysis (2021)

Roda et al., PLoS One 2021 [PMID: 34624028] - Meta-Analysis (5 RCTs)
  • No significant difference in VA between binocular treatment and patching (SDM = -0.12; P = 0.464)
  • No significant difference in stereopsis (SDM = -0.07; P = 0.809)
  • High between-study heterogeneity (I² = 57-61%)
  • Conclusion: No convincing evidence that binocular treatment should fully replace conventional patching; may serve as complementary therapy in select cases.

F. Video Game Treatment - Meta-Analysis (2022)

Fu et al., Survey of Ophthalmology 2022 [PMID: 34606819] - Meta-Analysis
  • Video game-based dichoptic treatment shows VA improvements comparable to conventional treatments.
  • Better patient engagement and adherence compared to patching.

G. Brazilian Best Practice Guidelines (2024)

Issaho et al., Arq Bras Oftalmol 2024 [PMID: 39607280] - Practice Guideline
  • Gold standard remains: spectacles + patching of the dominant eye
  • Most effective in patients aged <7 years
  • Treatment must be discontinued gradually, tapering patching over at least 5 weeks
  • Atropine indicated for penalization in hyperopic children where amblyopic eye has better VA under cycloplegia
  • Neural plasticity beyond the critical period opens possibilities for new treatment modalities in adults

8. Prognosis and Key Clinical Points

  • Age is the most important prognostic factor: younger = faster improvement but higher risk of reverse amblyopia.
  • VA at start of treatment: better baseline VA = shorter treatment duration needed.
  • Compliance is the single greatest barrier to improvement (Kanski).
  • No improvement after 6 months of effective occlusion: further treatment unlikely to succeed.
  • Recurrence is common after treatment stops; gradual tapering and maintenance patching reduce this.
  • Organic disease must always be excluded before commencing amblyopia treatment (examine fundi first).
  • Amblyopia and organic disease can co-exist - a trial of patching may still be indicated.
  • If acuity does not respond to treatment, reconsider electrophysiology (VEP) or neuroimaging.

Summary Reference Table

ParameterKey Points
DefinitionDecreased BCVA without identifiable organic pathology, due to abnormal visual development
Most common typesStrabismic + Anisometropic (equally)
Most severe typeStimulus deprivation (form deprivation)
Critical sign≥2 Snellen line difference in BCVA with no organic explanation
CrowdingAmblyopes read single letters better than a full line
Critical period~7-8 years (strabismic); may extend to teens (anisometropic)
First stepFull cycloplegic refraction; 6-12 weeks refractive adaptation
Main treatmentPatching of dominant eye (2-6 h/day for moderate amblyopia)
Equivalent optionAtropine 1% (daily or weekend); equal to patching for moderate amblyopia
Emerging treatmentDichoptic digital therapeutics (noninferior to patching, better adherence)
Monitoring1 week/year of age; bilateral VA checks
Stop treatment whenVA equalized, no response after 3 compliant cycles, or no improvement at 6 months
Gold standard guidelineAAO PPP 2022 (updated 2026); PEDIG RCT evidence

Key Sources:
  • Kanski's Clinical Ophthalmology, 10th Ed., p. 733-734
  • Wills Eye Manual, 8th Ed., p. 512-515
  • AAO Amblyopia Preferred Practice Pattern 2022 (updated 2024/2026)
  • PEDIG Studies summary - AAO
  • Tsani et al. 2024, Binocular treatment SR [PMID: 39222269]
  • Xiao et al. 2022, Dichoptic digital therapeutic Phase III RCT [PMID: 34534556]
  • Wygnanski-Jaffe et al. 2023, Eye-tracking dichoptic RCT [PMID: 36306974]
  • Roda et al. 2021, Binocular treatment meta-analysis [PMID: 34624028]
  • Issaho et al. 2024, Brazilian guidelines [PMID: 39607280]

Create a Word document summary of amblyopia classification, diagnosis, and management protocols for clinical reference

Reading File
Running Command

mkdir -p /home/daytona/workspace/amblyopia-clinical-ref && ls /home/daytona/work…

Browsing Directory

/home/daytona/skills/docx

Writing File

~/amblyopia-clinical-ref/create_amblyopia_doc.js

const {
  Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell,
  HeadingLevel, AlignmentType, BorderStyle, WidthType, ShadingType,
  VerticalAlign, PageNumber, Header, Footer, Tab, UnderlineType,
  TabStopType, TabStopPosition
} = require('docx');
const fs = require('fs');

// ─── Colour palette ───────────────────────────────────────────────────────────
const DEEP_BLUE   = "1B3A6B";  // heading background / accents
const MID_BLUE    = "2E6DA4";  // sub-heading
const LIGHT_BLUE  = "D6E4F0";  // table header fill
const WHITE       = "FFFFFF";
const DARK_TEXT   = "1A1A2E";
const ACCENT_RED  = "C0392B";  // warning / caution boxes

// ─── Helper: solid border ─────────────────────────────────────────────────────
function border(color = "AAAAAA", sz = 6) {
  return { style: BorderStyle.SINGLE, size: sz, color };
}

function noBorder() {
  return { style: BorderStyle.NONE, size: 0, color: "FFFFFF" };
}

// ─── Helper: section heading paragraph ───────────────────────────────────────
function sectionHeading(text) {
  return new Paragraph({
    heading: HeadingLevel.HEADING_1,
    spacing: { before: 360, after: 120 },
    shading: { type: ShadingType.SOLID, color: DEEP_BLUE, fill: DEEP_BLUE },
    children: [
      new TextRun({ text, bold: true, color: WHITE, size: 28, font: "Calibri" })
    ]
  });
}

function subHeading(text) {
  return new Paragraph({
    heading: HeadingLevel.HEADING_2,
    spacing: { before: 240, after: 80 },
    border: { bottom: border(MID_BLUE, 8) },
    children: [
      new TextRun({ text, bold: true, color: MID_BLUE, size: 24, font: "Calibri" })
    ]
  });
}

function subSubHeading(text) {
  return new Paragraph({
    heading: HeadingLevel.HEADING_3,
    spacing: { before: 180, after: 60 },
    children: [
      new TextRun({ text, bold: true, color: DEEP_BLUE, size: 22, font: "Calibri" })
    ]
  });
}

// ─── Helper: body paragraph ───────────────────────────────────────────────────
function body(text, opts = {}) {
  return new Paragraph({
    spacing: { before: 60, after: 60 },
    children: [
      new TextRun({
        text,
        size: 20,
        font: "Calibri",
        color: DARK_TEXT,
        bold: opts.bold || false,
        italics: opts.italic || false
      })
    ]
  });
}

// ─── Helper: bullet ───────────────────────────────────────────────────────────
function bullet(text, level = 0, bold = false) {
  return new Paragraph({
    bullet: { level },
    spacing: { before: 40, after: 40 },
    children: [
      new TextRun({ text, size: 20, font: "Calibri", color: DARK_TEXT, bold })
    ]
  });
}

// ─── Helper: numbered list ────────────────────────────────────────────────────
function numbered(text, level = 0) {
  return new Paragraph({
    numbering: { reference: "main-numbering", level },
    spacing: { before: 40, after: 40 },
    children: [
      new TextRun({ text, size: 20, font: "Calibri", color: DARK_TEXT })
    ]
  });
}

// ─── Helper: callout / info box ───────────────────────────────────────────────
function infoBox(label, text, bgColor = LIGHT_BLUE, labelColor = DEEP_BLUE) {
  return new Table({
    width: { size: 100, type: WidthType.PERCENTAGE },
    margins: { top: 80, bottom: 80, left: 120, right: 120 },
    rows: [
      new TableRow({
        children: [
          new TableCell({
            shading: { type: ShadingType.SOLID, color: bgColor, fill: bgColor },
            borders: { top: border(labelColor, 12), bottom: border(labelColor, 6), left: border(labelColor, 20), right: border(labelColor, 6) },
            margins: { top: 100, bottom: 100, left: 160, right: 160 },
            children: [
              new Paragraph({
                spacing: { before: 0, after: 40 },
                children: [new TextRun({ text: label, bold: true, size: 20, color: labelColor, font: "Calibri" })]
              }),
              new Paragraph({
                spacing: { before: 0, after: 0 },
                children: [new TextRun({ text, size: 20, color: DARK_TEXT, font: "Calibri" })]
              })
            ]
          })
        ]
      })
    ]
  });
}

// ─── Helper: warning box ──────────────────────────────────────────────────────
function warningBox(text) {
  return infoBox("⚠ IMPORTANT", text, "FDECEA", ACCENT_RED);
}

// ─── Helper: spacer ──────────────────────────────────────────────────────────
function spacer(pts = 120) {
  return new Paragraph({ spacing: { before: 0, after: pts }, children: [] });
}

// ─── Helper: 2-col table row ─────────────────────────────────────────────────
function twoColRow(col1, col2, isHeader = false) {
  const bgFill = isHeader ? LIGHT_BLUE : WHITE;
  function cell(txt, width) {
    return new TableCell({
      width: { size: width, type: WidthType.PERCENTAGE },
      shading: { type: ShadingType.SOLID, color: bgFill, fill: bgFill },
      borders: { top: border("CCCCCC"), bottom: border("CCCCCC"), left: border("CCCCCC"), right: border("CCCCCC") },
      margins: { top: 80, bottom: 80, left: 120, right: 120 },
      verticalAlign: VerticalAlign.TOP,
      children: [
        new Paragraph({
          children: [new TextRun({ text: txt, size: 19, font: "Calibri", color: DARK_TEXT, bold: isHeader })]
        })
      ]
    });
  }
  return new TableRow({ children: [cell(col1, 35), cell(col2, 65)] });
}

// ─── Helper: 3-col table row ─────────────────────────────────────────────────
function threeColRow(c1, c2, c3, isHeader = false) {
  const bgFill = isHeader ? LIGHT_BLUE : WHITE;
  function cell(txt, width) {
    return new TableCell({
      width: { size: width, type: WidthType.PERCENTAGE },
      shading: { type: ShadingType.SOLID, color: bgFill, fill: bgFill },
      borders: { top: border("CCCCCC"), bottom: border("CCCCCC"), left: border("CCCCCC"), right: border("CCCCCC") },
      margins: { top: 80, bottom: 80, left: 120, right: 120 },
      verticalAlign: VerticalAlign.TOP,
      children: [
        new Paragraph({
          children: [new TextRun({ text: txt, size: 19, font: "Calibri", color: DARK_TEXT, bold: isHeader })]
        })
      ]
    });
  }
  return new TableRow({ children: [cell(c1, 28), cell(c2, 36), cell(c3, 36)] });
}

// ─── Cover / Title block ─────────────────────────────────────────────────────
function titleBlock() {
  return [
    new Table({
      width: { size: 100, type: WidthType.PERCENTAGE },
      rows: [
        new TableRow({
          children: [
            new TableCell({
              shading: { type: ShadingType.SOLID, color: DEEP_BLUE, fill: DEEP_BLUE },
              borders: { top: noBorder(), bottom: noBorder(), left: noBorder(), right: noBorder() },
              margins: { top: 320, bottom: 320, left: 360, right: 360 },
              children: [
                new Paragraph({
                  alignment: AlignmentType.CENTER,
                  children: [new TextRun({ text: "AMBLYOPIA", bold: true, size: 56, color: WHITE, font: "Calibri" })]
                }),
                new Paragraph({
                  alignment: AlignmentType.CENTER,
                  spacing: { before: 100, after: 60 },
                  children: [new TextRun({ text: "Clinical Reference Guide", size: 32, color: "A8D1F0", font: "Calibri" })]
                }),
                new Paragraph({
                  alignment: AlignmentType.CENTER,
                  children: [new TextRun({ text: "Classification  •  Diagnosis  •  Management Protocols", size: 22, color: "D6E4F0", font: "Calibri", italics: true })]
                }),
              ]
            })
          ]
        })
      ]
    }),
    spacer(60),
    new Table({
      width: { size: 100, type: WidthType.PERCENTAGE },
      rows: [
        new TableRow({
          children: [
            new TableCell({
              shading: { type: ShadingType.SOLID, color: LIGHT_BLUE, fill: LIGHT_BLUE },
              borders: { top: border(MID_BLUE, 8), bottom: border(MID_BLUE, 8), left: border(MID_BLUE, 8), right: border(MID_BLUE, 8) },
              margins: { top: 120, bottom: 120, left: 240, right: 240 },
              children: [
                new Paragraph({
                  alignment: AlignmentType.CENTER,
                  children: [
                    new TextRun({ text: "Sources: ", bold: true, size: 18, color: MID_BLUE, font: "Calibri" }),
                    new TextRun({ text: "Kanski's Clinical Ophthalmology 10th Ed  •  Wills Eye Manual 8th Ed  •  AAO Preferred Practice Pattern 2022 (Updated 2026)  •  PEDIG Evidence Base", size: 18, color: DARK_TEXT, font: "Calibri" })
                  ]
                }),
                new Paragraph({
                  alignment: AlignmentType.CENTER,
                  spacing: { before: 60 },
                  children: [
                    new TextRun({ text: "Prepared: July 2026", size: 18, color: "666666", font: "Calibri", italics: true })
                  ]
                })
              ]
            })
          ]
        })
      ]
    }),
    spacer(200)
  ];
}

// ═══════════════════════════════════════════════════════════════════════════════
//  DOCUMENT CONTENT
// ═══════════════════════════════════════════════════════════════════════════════

const content = [

  // ── TITLE ──────────────────────────────────────────────────────────────────
  ...titleBlock(),

  // ══════════════════════════════════════════════════════════════════════════
  // SECTION 1: DEFINITION
  // ══════════════════════════════════════════════════════════════════════════
  sectionHeading("1.  DEFINITION"),
  spacer(60),

  infoBox(
    "Standard Definition (Kanski's Clinical Ophthalmology, 10th Ed.)",
    "Amblyopia is the unilateral, or rarely bilateral, decrease in best corrected visual acuity (VA) caused by form vision deprivation and/or abnormal binocular interaction, for which there is no identifiable pathology of the eye or visual pathway."
  ),
  spacer(100),

  infoBox(
    "Wills Eye Manual Definition (8th Ed.)",
    "Poorer vision in one eye that is not entirely improved with refraction and not entirely explained by an organic lesion. Central vision is primarily affected, while the peripheral visual field usually remains normal. The decrease in vision develops during the first decade of life."
  ),
  spacer(100),

  body("Key diagnostic criterion: a difference in best-corrected VA of ≥2 Snellen lines (or >1 log unit) in the absence of organic lesion.", { bold: true }),
  spacer(60),

  // ══════════════════════════════════════════════════════════════════════════
  // SECTION 2: CLASSIFICATION
  // ══════════════════════════════════════════════════════════════════════════
  sectionHeading("2.  CLASSIFICATION"),
  spacer(60),

  new Table({
    width: { size: 100, type: WidthType.PERCENTAGE },
    rows: [
      threeColRow("Type", "Mechanism", "Key Notes", true),
      threeColRow(
        "Strabismic",
        "Abnormal binocular interaction; continued monocular suppression of the deviating eye",
        "Most common (along with anisometropic); eye constantly deviating, non-fixating"
      ),
      threeColRow(
        "Anisometropic",
        "Difference in refractive error between eyes (as little as 1 D); more ametropic eye receives blurred image",
        "Most common (along with strabismic); frequently associated with microstrabismus; may co-exist with strabismic type"
      ),
      threeColRow(
        "Stimulus Deprivation (Form Deprivation)",
        "Physical obstruction of patterned visual input — cataract, corneal scar, ptosis covering pupil",
        "Most SEVERE form; can be unilateral or bilateral; requires urgent treatment in neonates"
      ),
      threeColRow(
        "Bilateral Ametropic",
        "High symmetrical refractive errors (usually high hypermetropia) — both eyes equally deprived",
        "Both eyes affected; often missed as there is no interocular comparison"
      ),
      threeColRow(
        "Meridional",
        "Uncorrected astigmatism (usually >1 D) causes image blur in one meridian beyond period of emmetropization",
        "Unilateral or bilateral; reduced resolution in one axis"
      ),
      threeColRow(
        "Occlusion (Iatrogenic)",
        "Amblyopia induced in the fellow eye by excessive patching or atropine overuse",
        "Prevented by monitoring at 1 week per year of age; reverse treatment immediately if detected"
      ),
    ]
  }),
  spacer(100),

  subHeading("Pathophysiology & Critical Period"),
  body("Amblyopia is a neurodevelopmental cortical disorder — the primary defect is in the visual cortex, not the retina."),
  bullet("Strabismic type: visual cortex actively suppresses input from the deviating eye to prevent diplopia"),
  bullet("Anisometropic type: chronically defocused image fails to adequately stimulate cortical development"),
  bullet("Stimulus deprivation: the most severe form — no patterned input reaches the cortex"),
  spacer(80),
  bullet("Critical period for strabismic amblyopia: up to 7–8 years of age", 0, true),
  bullet("Critical period for anisometropic amblyopia: may extend into the teens (especially with preserved binocularity)", 0, true),
  spacer(80),

  // ══════════════════════════════════════════════════════════════════════════
  // SECTION 3: DIAGNOSIS
  // ══════════════════════════════════════════════════════════════════════════
  sectionHeading("3.  DIAGNOSIS"),
  spacer(60),

  subHeading("Clinical Features"),
  spacer(40),

  new Table({
    width: { size: 100, type: WidthType.PERCENTAGE },
    rows: [
      twoColRow("Feature", "Details", true),
      twoColRow("Reduced BCVA", "≥2 Snellen line difference; not correctable with refraction; no organic explanation"),
      twoColRow("Crowding Phenomenon", "Individual letters read more easily than a full line; more pronounced in amblyopes; critical for testing preverbal children"),
      twoColRow("Neutral Density Filter Effect", "In reduced illumination, VA of amblyopic eye decreases much less than an organically diseased eye"),
      twoColRow("Trace RAPD", "Severe amblyopia may cause a trace relative afferent pupillary defect — caution in strabismic patients (risk of false positive)"),
      twoColRow("Peripheral field", "Usually normal; central fixation affected"),
      twoColRow("Eccentric fixation", "May be found in dense strabismic amblyopia"),
    ]
  }),
  spacer(100),

  subHeading("Diagnostic Workup"),
  spacer(40),

  numbered("History: childhood eye problems, misaligned eyes, patching history, prior strabismus surgery?"),
  numbered("Full ocular examination: rule out organic cause; examine FUNDI before commencing any treatment"),
  numbered("Cover-uncover test: evaluate eye alignment and detect manifest strabismus"),
  numbered("Cycloplegic refraction: both eyes mandatory"),
  numbered("Visual acuity testing: age-appropriate; single optotype vs. full line; evaluate crowding"),
  numbered("Stereopsis assessment: Randot, Titmus fly, Lang stereotest"),
  numbered("Sensory anomaly tests: Worth 4-dot, Bagolini glasses (binocular function assessment)"),
  spacer(80),

  warningBox("Always examine the fundus and exclude organic pathology BEFORE starting amblyopia treatment. Organic disease and amblyopia can co-exist — a trial of patching may still be indicated, but if acuity does not respond, reconsider electrophysiology (VEP) or neuroimaging."),
  spacer(100),

  // ══════════════════════════════════════════════════════════════════════════
  // SECTION 4: MANAGEMENT PROTOCOLS
  // ══════════════════════════════════════════════════════════════════════════
  sectionHeading("4.  MANAGEMENT PROTOCOLS"),
  spacer(60),

  subHeading("Step 1 — Treat the Underlying Cause"),
  bullet("Remove media opacities: Surgery for congenital cataract urgently, then occlude the non-amblyopic eye"),
  bullet("Prescribe full cycloplegic refraction: spectacle correction FIRST"),
  bullet("For strabismus: defer surgery until vision is equalized or maximum VA is achieved in the amblyopic eye"),
  spacer(80),

  subHeading("Step 2 — Refractive Adaptation Period"),
  bullet("Allow 6–12 weeks of full-time spectacle wear before adding active therapy"),
  bullet("Spectacles alone improve VA by ≥2 lines in 77% of anisometropic cases (some cases fully resolve)"),
  bullet("Also effective in strabismic amblyopia — do not rush straight to patching"),
  spacer(80),

  subHeading("Step 3 — Active Amblyopia Therapy (Age <12 Years)"),
  spacer(40),

  subSubHeading("A.  Occlusion (Patching) — First-Line Treatment"),
  spacer(40),

  new Table({
    width: { size: 100, type: WidthType.PERCENTAGE },
    rows: [
      twoColRow("Parameter", "Guidance", true),
      twoColRow("Which eye to patch", "Dominant (better-seeing) eye — force use of the amblyopic eye"),
      twoColRow("Dose (moderate amblyopia)", "2 hours/day (AAO PPP); Wills Eye: 2–6 hours/day based on severity"),
      twoColRow("Dose (severe amblyopia)", "Up to full-time patching depending on age and density"),
      twoColRow("Patch type", "Adhesive patch directly over skin — most effective; patches over glasses allow peeking"),
      twoColRow("Follow-up interval", "1 week per year of age (e.g., 3 weeks for a 3-year-old)"),
      twoColRow("Monitor both eyes", "VA must be checked in BOTH eyes at each visit — younger patients risk occlusion amblyopia"),
      twoColRow("Duration", "Continue until VA equalized or no improvement after 3 compliant treatment cycles"),
      twoColRow("Stop criterion", "No improvement after 6 months of effective, documented occlusion — further treatment unlikely"),
    ]
  }),
  spacer(100),

  subSubHeading("B.  Pharmacological Penalization (Atropine) — Alternative/Second-Line"),
  spacer(40),

  new Table({
    width: { size: 100, type: WidthType.PERCENTAGE },
    rows: [
      twoColRow("Parameter", "Guidance", true),
      twoColRow("Agent", "Atropine 1% drops instilled in the dominant (non-amblyopic) eye"),
      twoColRow("Mechanism", "Cycloplegia prevents accommodation — blurs near vision in the fellow eye"),
      twoColRow("Best indication", "Mild–moderate amblyopia (20/100 / 6/24 or better); anisometropic hypermetropic amblyopia"),
      twoColRow("Regimen (PEDIG)", "Daily atropine = equal efficacy to patching; Weekend-only atropine = equal to daily atropine"),
      twoColRow("School-age issue", "If causing difficulty at school: full hyperopic correction + +2.50 bifocal, or weekend-only drops"),
      twoColRow("Advantage over patching", "Cannot be thwarted by child; better psychosocial acceptance; AAO PPP: 'higher parental acceptability'"),
      twoColRow("Outcome vs. patching", "Equal VA improvement at follow-up; patching shows faster initial improvement"),
    ]
  }),
  spacer(100),

  subSubHeading("C.  Optical Degradation"),
  bullet("High plus lens (e.g., +9.00 D or aphakic contact lens) applied to the dominant eye's spectacle"),
  bullet("If highly myopic: remove the minus lens from the preferred eye"),
  spacer(80),

  subSubHeading("D.  Bangerter (Translucent) Filters"),
  bullet("Graded-density translucent foil applied to the spectacle lens of the dominant eye"),
  bullet("Less cosmetically conspicuous than occlusive patch; graded penalization possible"),
  bullet("Listed as suitable option in AAO PPP 2022"),
  spacer(80),

  subSubHeading("E.  Digital Therapeutics (Dichoptic Treatment) — Emerging"),
  bullet("Dichoptic stimulation: amblyopic eye receives high-contrast image; fellow eye receives low-contrast image or real-time blur"),
  bullet("Delivered via video game, streaming content, or dedicated device (e.g., CureSight eye-tracking system)"),
  bullet("Phase III RCT (Xiao et al., Ophthalmology 2022): 1.8 lines improvement vs. 0.8 lines (glasses only) in 4–7 yr olds"),
  bullet("CureSight RCT (Wygnanski-Jaffe et al., Ophthalmology 2023): noninferior to patching; significantly better adherence (91% vs. 83%)"),
  bullet("Meta-analysis (Roda et al., PLoS One 2021): no significant VA difference vs. patching — cannot fully replace, but valid complement"),
  bullet("AAO PPP 2022: lists digital therapeutics as a suitable treatment option"),
  spacer(100),

  subHeading("Step 4 — Maintenance and Long-Term Follow-Up"),
  bullet("After maximum improvement: use part-time patching to prevent recurrence"),
  bullet("Gradual tapering of patching over at least 5 weeks when discontinuing treatment (Brazilian Guidelines 2024)"),
  bullet("Continue long-term follow-up through the full sensitive period"),
  bullet("If treatment fails or patient presents outside treatment age: prescribe protective glasses (sports eye protection)"),
  bullet("One-eyed athlete rule: any child who cannot reach 20/40 must wear protective eyewear during sports"),
  spacer(100),

  // ══════════════════════════════════════════════════════════════════════════
  // SECTION 5: AAO PPP GUIDELINES SUMMARY
  // ══════════════════════════════════════════════════════════════════════════
  sectionHeading("5.  AAO PREFERRED PRACTICE PATTERN — KEY RECOMMENDATIONS"),
  body("American Academy of Ophthalmology PPP 2022, Updated May 2026", { italic: true }),
  spacer(80),

  bullet("Refractive error correction ALONE can improve VA in anisometropic, strabismic, or combined amblyopia", 0, true),
  bullet("Bilateral refractive amblyopia also substantially improves with refractive correction alone"),
  bullet("Most children with MODERATE amblyopia (20/40–20/80) respond to 2 hours/day patching OR weekend atropine", 0, true),
  bullet("Following treatment for strabismic/anisometropic amblyopia: continued monitoring is necessary; additional treatment if needed ensures long-term durability"),
  bullet("Suitable treatments: optical correction, patching, atropine penalization, optical degradation, Bangerter filters, digital therapeutics + managing the underlying cause"),
  bullet("Amblyopia treatment may be effective in OLDER children and adolescents, particularly if previously untreated", 0, true),
  bullet("Goals: identify at-risk children early, examine at earliest possible age, treat to improve visual function and reduce vision-related disability"),
  spacer(100),

  // ══════════════════════════════════════════════════════════════════════════
  // SECTION 6: PEDIG EVIDENCE BASE
  // ══════════════════════════════════════════════════════════════════════════
  sectionHeading("6.  PEDIG EVIDENCE BASE"),
  body("Pediatric Eye Disease Investigator Group (PEDIG) — Landmark RCT Evidence", { italic: true }),
  spacer(60),

  new Table({
    width: { size: 100, type: WidthType.PERCENTAGE },
    rows: [
      twoColRow("Study Focus", "Key Finding", true),
      twoColRow("Patching vs. Atropine (moderate amblyopia, age 3–7)", "Equal outcomes; patching shows faster initial improvement; atropine has higher parental acceptability"),
      twoColRow("2 hours vs. 6 hours daily patching", "Similar VA outcomes for moderate amblyopia — 2 h/day is sufficient"),
      twoColRow("Weekend vs. Daily Atropine", "Equal VA improvement — weekend dosing improves compliance and reduces side effects"),
      twoColRow("Spectacles alone (before active therapy)", "Substantial amblyopia improvement in many patients — first-line before patching"),
      twoColRow("Older children (age 7–17)", "Patching effective even in previously untreated older children and adolescents"),
      twoColRow("Recurrence after treatment", "Continued part-time patching after improvement associated with durable VA gains"),
    ]
  }),
  spacer(100),

  // ══════════════════════════════════════════════════════════════════════════
  // SECTION 7: CLINICAL PEARLS & QUICK REFERENCE
  // ══════════════════════════════════════════════════════════════════════════
  sectionHeading("7.  CLINICAL PEARLS & QUICK REFERENCE"),
  spacer(60),

  new Table({
    width: { size: 100, type: WidthType.PERCENTAGE },
    rows: [
      twoColRow("Parameter", "Key Point", true),
      twoColRow("Definition", "Decreased BCVA without identifiable organic pathology; abnormal visual development"),
      twoColRow("Most common types", "Strabismic + Anisometropic (equally common)"),
      twoColRow("Most severe type", "Stimulus deprivation (form deprivation) — requires most urgent treatment"),
      twoColRow("Diagnostic criterion", "≥2 Snellen line difference in BCVA; no organic explanation"),
      twoColRow("Crowding phenomenon", "Single letters read better than a full line — hallmark of amblyopia"),
      twoColRow("Critical period", "~7–8 years (strabismic); may extend to teens (anisometropic)"),
      twoColRow("First treatment step", "Full cycloplegic refraction + 6–12 weeks refractive adaptation"),
      twoColRow("Main active treatment", "Patching of dominant eye (2 h/day for moderate amblyopia)"),
      twoColRow("Equal alternative", "Atropine 1% daily or weekend-only; equal to patching for moderate amblyopia"),
      twoColRow("Emerging treatment", "Dichoptic digital therapeutics — noninferior to patching, better adherence"),
      twoColRow("Follow-up schedule", "1 week per year of age; monitor BOTH eyes at each visit"),
      twoColRow("Stop treatment when", "VA equalized; no response after 3 compliant cycles; no improvement at 6 months"),
      twoColRow("Biggest barrier to success", "Non-compliance — spend time educating families at the outset"),
      twoColRow("Gold standard guideline", "AAO PPP 2022 (updated 2026); PEDIG RCT evidence base"),
    ]
  }),
  spacer(100),

  // ── Warnings ──────────────────────────────────────────────────────────────
  warningBox("COMPLIANCE is the single greatest barrier to improvement. Time invested in family communication and education at the outset directly impacts outcomes. (Kanski's Clinical Ophthalmology, 10th Ed.)"),
  spacer(100),

  infoBox(
    "Note on Adult / Late-Onset Treatment",
    "Significant neural plasticity in the amblyopic brain beyond the critical period opens possibilities for new treatment modalities even after childhood. Digital dichoptic therapies and perceptual learning paradigms are active areas of investigation. (Brazilian Best Practice Guidelines 2024; AAO PPP 2022)"
  ),
  spacer(100),

  // ══════════════════════════════════════════════════════════════════════════
  // SECTION 8: REFERENCES
  // ══════════════════════════════════════════════════════════════════════════
  sectionHeading("8.  REFERENCES"),
  spacer(60),

  body("1.  Kanski JJ, Bowling B. Kanski's Clinical Ophthalmology: A Systematic Approach. 10th ed. Elsevier; 2020. pp. 733–734."),
  body("2.  Gerstenblith AT, Rabinowitz MP. The Wills Eye Manual: Office and Emergency Room Diagnosis and Treatment of Eye Disease. 8th ed. Wolters Kluwer; 2022. pp. 512–515."),
  body("3.  American Academy of Ophthalmology. Amblyopia Preferred Practice Pattern. 2022 (Updated May 2026). Available at: https://www.aao.org/education/preferred-practice-pattern/amblyopia-ppp-2022"),
  body("4.  American Optometric Association. Care of the Patient with Amblyopia. Clinical Practice Guideline 4."),
  body("5.  Tsani Z, Ioannopoulos D, Androudi S, et al. Binocular treatment for amblyopia: a systematic review. Int Ophthalmol. 2024. PMID: 39222269."),
  body("6.  Xiao S, Angjeli E, Wu HC, et al. Randomized Controlled Trial of a Dichoptic Digital Therapeutic for Amblyopia. Ophthalmology. 2022;129(1):77–85. PMID: 34534556."),
  body("7.  Wygnanski-Jaffe T, Kushner BJ, Moshkovitz A, et al. An Eye-Tracking-Based Dichoptic Home Treatment for Amblyopia: A Multicenter Randomized Clinical Trial. Ophthalmology. 2023;130(3):274–285. PMID: 36306974."),
  body("8.  Roda M, Pellegrini M, Di Geronimo N, et al. Binocular treatment for amblyopia: A meta-analysis of randomized clinical trials. PLoS One. 2021. PMID: 34624028."),
  body("9.  Issaho DC, Rossetto JD, Curi I, et al. Brazilian best practice guidelines for amblyopia diagnosis and management. Arq Bras Oftalmol. 2024. PMID: 39607280."),
  body("10. PEDIG (Pediatric Eye Disease Investigator Group). Multiple RCTs on patching, atropine, and refractive correction. Available at: https://www.aao.org/education/disease-review/pedig-studies-quality-healthcare-amblyopia-treatme"),
  spacer(160),

];

// ─── Document construction ────────────────────────────────────────────────────
const doc = new Document({
  numbering: {
    config: [
      {
        reference: "main-numbering",
        levels: [
          {
            level: 0,
            format: "decimal",
            text: "%1.",
            alignment: AlignmentType.LEFT,
            style: {
              paragraph: { indent: { left: 360, hanging: 360 } },
              run: { size: 20, font: "Calibri", color: DARK_TEXT }
            }
          }
        ]
      }
    ]
  },
  styles: {
    default: {
      document: {
        run: { font: "Calibri", size: 20, color: DARK_TEXT },
        paragraph: { spacing: { line: 276 } }
      }
    }
  },
  sections: [
    {
      properties: {
        page: {
          margin: { top: 1080, bottom: 1080, left: 1080, right: 1080 }
        }
      },
      headers: {
        default: new Header({
          children: [
            new Table({
              width: { size: 100, type: WidthType.PERCENTAGE },
              rows: [
                new TableRow({
                  children: [
                    new TableCell({
                      shading: { type: ShadingType.SOLID, color: DEEP_BLUE, fill: DEEP_BLUE },
                      borders: { top: noBorder(), bottom: noBorder(), left: noBorder(), right: noBorder() },
                      margins: { top: 80, bottom: 80, left: 240, right: 240 },
                      width: { size: 80, type: WidthType.PERCENTAGE },
                      children: [new Paragraph({
                        children: [new TextRun({ text: "AMBLYOPIA — Clinical Reference Guide", bold: true, size: 18, color: WHITE, font: "Calibri" })]
                      })]
                    }),
                    new TableCell({
                      shading: { type: ShadingType.SOLID, color: DEEP_BLUE, fill: DEEP_BLUE },
                      borders: { top: noBorder(), bottom: noBorder(), left: noBorder(), right: noBorder() },
                      margins: { top: 80, bottom: 80, left: 120, right: 240 },
                      width: { size: 20, type: WidthType.PERCENTAGE },
                      children: [new Paragraph({
                        alignment: AlignmentType.RIGHT,
                        children: [new TextRun({ text: "July 2026", size: 18, color: "A8D1F0", font: "Calibri" })]
                      })]
                    })
                  ]
                })
              ]
            })
          ]
        })
      },
      footers: {
        default: new Footer({
          children: [
            new Paragraph({
              border: { top: border("AAAAAA", 6) },
              spacing: { before: 80 },
              children: [
                new TextRun({ text: "Amblyopia Clinical Reference  |  Sources: Kanski 10th Ed, Wills Eye 8th Ed, AAO PPP 2022/2026, PEDIG  |  Page ", size: 16, color: "888888", font: "Calibri" }),
                new TextRun({ children: [new PageNumber()], size: 16, color: "888888", font: "Calibri" })
              ]
            })
          ]
        })
      },
      children: content
    }
  ]
});

Packer.toBuffer(doc).then(buffer => {
  fs.writeFileSync("/home/daytona/workspace/amblyopia-clinical-ref/Amblyopia_Clinical_Reference.docx", buffer);
  console.log("SUCCESS: Document created.");
}).catch(err => {
  console.error("ERROR:", err);
  process.exit(1);
});
Running Command

cd /home/daytona/workspace/amblyopia-clinical-ref && node create_amblyopia_doc.j…

Running Command

cd /home/daytona/workspace/amblyopia-clinical-ref && node -e "const d = require(…

Running Command

cd /home/daytona/workspace/amblyopia-clinical-ref && node -e "const { PageNumber…

Editing File

~/amblyopia-clinical-ref/create_amblyopia_doc.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/amblyopia-clinical-ref/create_amblyopia_doc.js'
Editing File

~/amblyopia-clinical-ref/create_amblyopia_doc.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/amblyopia-clinical-ref/create_amblyopia_doc.js'
Running Command

cd /home/daytona/workspace/amblyopia-clinical-ref && node create_amblyopia_doc.j…

Running Command

python3 /home/daytona/skills/docx/scripts/office/validate.py /home/daytona/works…

Running Command

cd /home/daytona/workspace/amblyopia-clinical-ref && python3 -c " import zipfile…

Your Word document is ready for download:

Amblyopia Clinical Reference

Word Document · DOCX


Here is what is included in the document:
8 fully formatted sections:
  1. Definition - Standard definitions from Kanski 10th Ed and Wills Eye Manual 8th Ed, highlighted in styled callout boxes
  2. Classification - Full 3-column table covering all 6 types (Strabismic, Anisometropic, Stimulus Deprivation, Bilateral Ametropic, Meridional, Occlusion/Iatrogenic) with mechanism and key notes; plus pathophysiology and critical period summary
  3. Diagnosis - Clinical features table (crowding phenomenon, neutral density filter effect, trace RAPD), full diagnostic workup as numbered steps, and a warning box on excluding organic pathology first
  4. Management Protocols - Step-by-step protocol: underlying cause treatment → refractive adaptation → active therapy (Patching, Atropine, Optical degradation, Bangerter filters, Dichoptic digital therapeutics) with structured tables for each modality, dosing, and monitoring schedules
  5. AAO Preferred Practice Pattern Key Recommendations - Bullet summary of the 2022/2026 guidelines
  6. PEDIG Evidence Base - Table of all landmark PEDIG RCT findings
  7. Clinical Pearls & Quick Reference - At-a-glance summary table for bedside/clinic use; includes warning box on compliance and a note on adult treatment potential
  8. References - 10 fully cited sources (textbooks, AAO PPP, PEDIG, and recent PubMed studies)
Formatting: Deep blue section headings with white text, styled callout boxes, colour-coded warning boxes, branded header/footer with page numbers on every page.

Can you make pdf from Khurana squint and orthoptics books and Leela Ahuja squint books with more detailed version of types classification and details of amblyopia treatment studies

Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Searching PubMed

amblyopia patching atropine penalization treatment children randomized

Reading File
Reading File
Reading Article

PMID: 31461545

Reading Article

PMID: 32450849

Searching PubMed

amblyopia dichoptic binocular digital treatment

Running Command

mkdir -p /home/daytona/workspace/amblyopia-pdf && python3 -c "import reportlab; …

Writing File

~/amblyopia-pdf/build_pdf.py

#!/usr/bin/env python3
"""
Amblyopia – Detailed Clinical Reference PDF
Sources: Kanski's Clinical Ophthalmology 10th Ed, Wills Eye Manual 8th Ed,
         AAO PPP 2022/2026, PEDIG evidence, PubMed studies
"""

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

# ── Palette ────────────────────────────────────────────────────────────────────
DEEP_BLUE   = HexColor("#1B3A6B")
MID_BLUE    = HexColor("#2E6DA4")
LIGHT_BLUE  = HexColor("#D6E4F0")
PALE_BLUE   = HexColor("#EBF4FB")
TEAL        = HexColor("#0E7C7B")
DARK_TEXT   = HexColor("#1A1A2E")
GRAY        = HexColor("#555555")
LIGHT_GRAY  = HexColor("#F5F5F5")
RED_WARN    = HexColor("#C0392B")
RED_LIGHT   = HexColor("#FDECEA")
GOLD        = HexColor("#B8860B")
GOLD_LIGHT  = HexColor("#FFF8E1")
GREEN       = HexColor("#1A6B3A")
GREEN_LIGHT = HexColor("#E8F5E9")
ORANGE      = HexColor("#E65100")
ORANGE_LIGHT= HexColor("#FFF3E0")

W, H = A4
MARGIN_L = 2.0*cm
MARGIN_R = 2.0*cm
MARGIN_T = 2.2*cm
MARGIN_B = 2.2*cm
CONTENT_W = W - MARGIN_L - MARGIN_R

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

def style(name, parent='Normal', **kw):
    return ParagraphStyle(name, parent=base[parent], **kw)

COVER_TITLE  = style('CoverTitle',  'Normal',  fontName='Helvetica-Bold',  fontSize=34, textColor=white,      alignment=TA_CENTER, leading=42, spaceAfter=8)
COVER_SUB    = style('CoverSub',    'Normal',  fontName='Helvetica',       fontSize=15, textColor=HexColor("#A8D1F0"), alignment=TA_CENTER, leading=20, spaceAfter=4)
COVER_META   = style('CoverMeta',   'Normal',  fontName='Helvetica-Oblique',fontSize=10,textColor=HexColor("#D6E4F0"), alignment=TA_CENTER, leading=14)
SEC_HDG      = style('SecHdg',      'Normal',  fontName='Helvetica-Bold',  fontSize=13, textColor=white,      spaceBefore=16, spaceAfter=4, leading=16)
SUB_HDG      = style('SubHdg',      'Normal',  fontName='Helvetica-Bold',  fontSize=11, textColor=DEEP_BLUE,  spaceBefore=12, spaceAfter=4, leading=14)
SUB2_HDG     = style('Sub2Hdg',     'Normal',  fontName='Helvetica-Bold',  fontSize=10, textColor=MID_BLUE,   spaceBefore=8,  spaceAfter=3, leading=13)
BODY         = style('Body',        'Normal',  fontName='Helvetica',       fontSize=9,  textColor=DARK_TEXT,  spaceBefore=3,  spaceAfter=3, leading=13, alignment=TA_JUSTIFY)
BODY_BOLD    = style('BodyBold',    'Normal',  fontName='Helvetica-Bold',  fontSize=9,  textColor=DARK_TEXT,  spaceBefore=3,  spaceAfter=3, leading=13)
BULLET       = style('Bullet',      'Normal',  fontName='Helvetica',       fontSize=9,  textColor=DARK_TEXT,  spaceBefore=2,  spaceAfter=2, leading=13, leftIndent=14, firstLineIndent=-8)
BULLET2      = style('Bullet2',     'Normal',  fontName='Helvetica',       fontSize=8.5,textColor=DARK_TEXT,  spaceBefore=1,  spaceAfter=1, leading=12, leftIndent=26, firstLineIndent=-10)
TABLE_HDR    = style('TblHdr',      'Normal',  fontName='Helvetica-Bold',  fontSize=8.5,textColor=white,      alignment=TA_CENTER, leading=12)
TABLE_HDR_L  = style('TblHdrL',     'Normal',  fontName='Helvetica-Bold',  fontSize=8.5,textColor=white,      alignment=TA_LEFT,   leading=12)
TABLE_CELL   = style('TblCell',     'Normal',  fontName='Helvetica',       fontSize=8.5,textColor=DARK_TEXT,  leading=12, spaceBefore=1, spaceAfter=1)
TABLE_CELL_B = style('TblCellB',    'Normal',  fontName='Helvetica-Bold',  fontSize=8.5,textColor=DARK_TEXT,  leading=12)
TABLE_CELL_C = style('TblCellC',    'Normal',  fontName='Helvetica',       fontSize=8.5,textColor=DARK_TEXT,  leading=12, alignment=TA_CENTER)
CITE         = style('Cite',        'Normal',  fontName='Helvetica-Oblique',fontSize=8, textColor=GRAY,       spaceBefore=2,  spaceAfter=4,  leading=12)
REF          = style('Ref',         'Normal',  fontName='Helvetica',       fontSize=8,  textColor=DARK_TEXT,  spaceBefore=2,  spaceAfter=2,  leading=12)
FOOTER_S     = style('Footer',      'Normal',  fontName='Helvetica',       fontSize=7.5,textColor=GRAY,       alignment=TA_CENTER)
NOTE_S       = style('Note',        'Normal',  fontName='Helvetica-Oblique',fontSize=8.5,textColor=DARK_TEXT, spaceBefore=2, spaceAfter=2, leading=12, alignment=TA_JUSTIFY)

def sp(h=6): return Spacer(1, h)
def hr(c=MID_BLUE, t=0.5): return HRFlowable(width="100%", thickness=t, color=c, spaceAfter=4, spaceBefore=4)

def bullet_para(text, level=0):
    s = BULLET if level == 0 else BULLET2
    bullet_char = "•" if level == 0 else "–"
    return Paragraph(f"{bullet_char}  {text}", s)

def num_para(n, text):
    return Paragraph(f"<b>{n}.</b>  {text}", BODY)

# ── Section heading with blue bar ─────────────────────────────────────────────
def section_heading(text):
    t = Table([[Paragraph(text, SEC_HDG)]],
              colWidths=[CONTENT_W])
    t.setStyle(TableStyle([
        ('BACKGROUND', (0,0), (-1,-1), DEEP_BLUE),
        ('TOPPADDING',   (0,0), (-1,-1), 7),
        ('BOTTOMPADDING',(0,0), (-1,-1), 7),
        ('LEFTPADDING',  (0,0), (-1,-1), 10),
        ('RIGHTPADDING', (0,0), (-1,-1), 10),
        ('ROWBACKGROUNDS',(0,0),(-1,-1),[DEEP_BLUE]),
    ]))
    return t

def sub_heading(text):
    return KeepTogether([
        Paragraph(text, SUB_HDG),
        HRFlowable(width="100%", thickness=1.5, color=MID_BLUE, spaceAfter=3, spaceBefore=0)
    ])

def sub2_heading(text):
    return Paragraph(text, SUB2_HDG)

# ── Coloured info / warning box ───────────────────────────────────────────────
def info_box(label, content_paras, bg=PALE_BLUE, border_color=MID_BLUE, label_color=DEEP_BLUE):
    label_p = Paragraph(f"<b>{label}</b>", ParagraphStyle('IB', parent=BODY_BOLD, textColor=label_color, spaceAfter=4))
    rows = [[label_p]] + [[p] for p in content_paras]
    t = Table(rows, colWidths=[CONTENT_W - 20])
    t.setStyle(TableStyle([
        ('BACKGROUND',   (0,0), (-1,-1), bg),
        ('LEFTPADDING',  (0,0), (-1,-1), 10),
        ('RIGHTPADDING', (0,0), (-1,-1), 10),
        ('TOPPADDING',   (0,0), (-1,-1), 4),
        ('BOTTOMPADDING',(0,0), (-1,-1), 4),
        ('LINEAFTER',  (0,0),(0,-1), 3, border_color),
        ('LINEBEFORE', (0,0),(0,-1), 3, border_color),
        ('LINEABOVE',  (0,0),(-1,0), 1.5, border_color),
        ('LINEBELOW',  (0,-1),(-1,-1), 1.5, border_color),
        ('ROWBACKGROUNDS',(0,0),(-1,-1),[bg]),
    ]))
    outer = Table([[t]], colWidths=[CONTENT_W])
    outer.setStyle(TableStyle([
        ('LEFTPADDING',(0,0),(-1,-1),0),('RIGHTPADDING',(0,0),(-1,-1),0),
        ('TOPPADDING',(0,0),(-1,-1),4),('BOTTOMPADDING',(0,0),(-1,-1),4),
    ]))
    return outer

def warn_box(text):
    return info_box("⚠  IMPORTANT", [Paragraph(text, NOTE_S)], bg=RED_LIGHT, border_color=RED_WARN, label_color=RED_WARN)

def tip_box(text):
    return info_box("✦  CLINICAL TIP", [Paragraph(text, NOTE_S)], bg=GOLD_LIGHT, border_color=GOLD, label_color=GOLD)

def evidence_box(label, text):
    return info_box(f"📋  EVIDENCE: {label}", [Paragraph(text, NOTE_S)], bg=GREEN_LIGHT, border_color=GREEN, label_color=GREEN)

def study_box(label, text):
    return info_box(f"🔬  {label}", [Paragraph(text, NOTE_S)], bg=ORANGE_LIGHT, border_color=ORANGE, label_color=ORANGE)

# ── Generic table builder ─────────────────────────────────────────────────────
def build_table(headers, rows, col_widths, stripe=True):
    hdr_cells = [Paragraph(h, TABLE_HDR) for h in headers]
    data = [hdr_cells]
    for r in rows:
        data.append([Paragraph(str(c), TABLE_CELL) if not isinstance(c, Paragraph) else c for c in r])
    t = Table(data, colWidths=col_widths, repeatRows=1)
    cmds = [
        ('BACKGROUND', (0,0), (-1,0), DEEP_BLUE),
        ('TEXTCOLOR',  (0,0), (-1,0), white),
        ('ALIGN',      (0,0), (-1,-1), 'LEFT'),
        ('VALIGN',     (0,0), (-1,-1), 'TOP'),
        ('FONTNAME',   (0,0), (-1,0), 'Helvetica-Bold'),
        ('FONTSIZE',   (0,0), (-1,-1), 8.5),
        ('TOPPADDING',   (0,0), (-1,-1), 5),
        ('BOTTOMPADDING',(0,0), (-1,-1), 5),
        ('LEFTPADDING',  (0,0), (-1,-1), 6),
        ('RIGHTPADDING', (0,0), (-1,-1), 6),
        ('GRID',       (0,0), (-1,-1), 0.5, HexColor("#CCCCCC")),
        ('ROWBACKGROUNDS', (0,1), (-1,-1), [white, LIGHT_BLUE] if stripe else [white]),
    ]
    t.setStyle(TableStyle(cmds))
    return t

def build_table_left_hdr(headers, rows, col_widths):
    """Table with left-aligned headers."""
    hdr_cells = [Paragraph(h, TABLE_HDR_L) for h in headers]
    data = [hdr_cells]
    for r in rows:
        data.append([Paragraph(str(c), TABLE_CELL) if not isinstance(c, Paragraph) else c for c in r])
    t = Table(data, colWidths=col_widths, repeatRows=1)
    t.setStyle(TableStyle([
        ('BACKGROUND', (0,0), (-1,0), DEEP_BLUE),
        ('TEXTCOLOR',  (0,0), (-1,0), white),
        ('ALIGN',      (0,0), (-1,-1), 'LEFT'),
        ('VALIGN',     (0,0), (-1,-1), 'TOP'),
        ('FONTNAME',   (0,0), (-1,0), 'Helvetica-Bold'),
        ('FONTSIZE',   (0,0), (-1,-1), 8.5),
        ('TOPPADDING',   (0,0), (-1,-1), 5),
        ('BOTTOMPADDING',(0,0), (-1,-1), 5),
        ('LEFTPADDING',  (0,0), (-1,-1), 6),
        ('RIGHTPADDING', (0,0), (-1,-1), 6),
        ('GRID',       (0,0), (-1,-1), 0.5, HexColor("#CCCCCC")),
        ('ROWBACKGROUNDS', (0,1), (-1,-1), [white, LIGHT_BLUE]),
    ]))
    return t

# ══════════════════════════════════════════════════════════════════════════════
#  COVER PAGE
# ══════════════════════════════════════════════════════════════════════════════
def cover_page():
    elems = []

    # Title block
    cover_data = [[
        Paragraph("AMBLYOPIA", COVER_TITLE),
        Paragraph("Comprehensive Clinical Reference", COVER_SUB),
        Paragraph("Classification  •  Types  •  Diagnosis  •  Management  •  Treatment Studies", COVER_META),
    ]]
    cover_t = Table([[Paragraph("AMBLYOPIA", COVER_TITLE)],
                     [Paragraph("Comprehensive Clinical Reference", COVER_SUB)],
                     [sp(6)],
                     [Paragraph("Classification  •  Types  •  Diagnosis  •  Management  •  Treatment Studies", COVER_META)],
                     [sp(6)],
                     [Paragraph("July 2026", COVER_META)]],
                    colWidths=[CONTENT_W])
    cover_t.setStyle(TableStyle([
        ('BACKGROUND', (0,0), (-1,-1), DEEP_BLUE),
        ('LEFTPADDING', (0,0), (-1,-1), 20),
        ('RIGHTPADDING', (0,0), (-1,-1), 20),
        ('TOPPADDING', (0,0), (-1,-1), 6),
        ('BOTTOMPADDING', (0,0), (-1,-1), 6),
        ('TOPPADDING', (0,0), (0,0), 40),
        ('BOTTOMPADDING', (0,-1), (-1,-1), 40),
    ]))
    elems.append(cover_t)
    elems.append(sp(10))

    # Sources strip
    src = Table([[
        Paragraph(
            "<b>Primary Sources:</b>  Kanski's Clinical Ophthalmology 10th Ed  •  Wills Eye Manual 8th Ed  •  "
            "AAO Preferred Practice Pattern 2022 (Updated 2026)  •  PEDIG Research  •  "
            "Cochrane Reviews  •  PubMed RCTs &amp; Meta-Analyses",
            ParagraphStyle('SrcStrip', parent=BODY, textColor=DARK_TEXT, alignment=TA_CENTER, fontSize=8)
        )
    ]], colWidths=[CONTENT_W])
    src.setStyle(TableStyle([
        ('BACKGROUND', (0,0), (-1,-1), LIGHT_BLUE),
        ('TOPPADDING',    (0,0), (-1,-1), 8),
        ('BOTTOMPADDING', (0,0), (-1,-1), 8),
        ('LEFTPADDING',   (0,0), (-1,-1), 12),
        ('RIGHTPADDING',  (0,0), (-1,-1), 12),
        ('BOX', (0,0), (-1,-1), 1, MID_BLUE),
    ]))
    elems.append(src)
    elems.append(sp(14))

    # Disclaimer
    elems.append(info_box(
        "Library Note",
        [Paragraph(
            "The textbook library available for this document contains Kanski's Clinical Ophthalmology (10th Ed) "
            "and Wills Eye Manual (8th Ed). Khurana's Ophthalmology and Leela Ahuja's books are not in the "
            "current library. This PDF therefore draws on the best available ophthalmology textbook sources "
            "combined with the full spectrum of PubMed-indexed treatment evidence including PEDIG RCTs, "
            "Cochrane reviews, and recent meta-analyses, giving comprehensive, evidence-based coverage of "
            "all requested topics.", BODY)],
        bg=PALE_BLUE, border_color=MID_BLUE
    ))
    return elems

# ══════════════════════════════════════════════════════════════════════════════
#  SECTION 1: DEFINITION & EPIDEMIOLOGY
# ══════════════════════════════════════════════════════════════════════════════
def section_definition():
    e = [section_heading("1.  DEFINITION & EPIDEMIOLOGY"), sp(6)]

    e += [sub_heading("Standard Definitions")]
    e.append(info_box(
        "Kanski's Clinical Ophthalmology, 10th Edition",
        [Paragraph(
            ""Amblyopia is the unilateral, or rarely bilateral, decrease in best corrected visual acuity (VA) "
            "caused by form vision deprivation and/or abnormal binocular interaction, for which there is no "
            "identifiable pathology of the eye or visual pathway."", BODY)],
        bg=PALE_BLUE, border_color=DEEP_BLUE
    ))
    e.append(sp(6))
    e.append(info_box(
        "Wills Eye Manual, 8th Edition",
        [Paragraph(
            ""Poorer vision in one eye that is not entirely improved with refraction and not entirely explained by "
            "an organic lesion. Central vision is primarily affected, while the peripheral visual field usually remains "
            "normal. The decrease in vision develops during the first decade of life."", BODY)],
        bg=PALE_BLUE, border_color=DEEP_BLUE
    ))
    e.append(sp(8))
    e += [sub_heading("Epidemiology")]
    for b in [
        "<b>Prevalence:</b> 2–4% of the general population; the most common cause of monocular visual impairment in children and working-age adults in developed countries.",
        "<b>Age of onset:</b> Always begins during the critical period of visual development (birth to approximately 7–9 years).",
        "<b>Sex:</b> No significant sex predilection.",
        "<b>Laterality:</b> Unilateral in the vast majority; bilateral forms occur with high bilateral refractive errors or bilateral deprivation.",
        "<b>Comorbidities:</b> ~50% of amblyopic children also have strabismus; significant overlap between types is common.",
    ]:
        e.append(bullet_para(b))
    return e

# ══════════════════════════════════════════════════════════════════════════════
#  SECTION 2: PATHOPHYSIOLOGY & CRITICAL PERIOD
# ══════════════════════════════════════════════════════════════════════════════
def section_pathophysiology():
    e = [section_heading("2.  PATHOPHYSIOLOGY & CRITICAL PERIOD"), sp(6)]

    e += [sub_heading("Neurological Basis")]
    e.append(Paragraph(
        "Amblyopia is fundamentally a <b>cortical disorder</b>. The primary defect is not in the eye but in the "
        "visual cortex (V1 and higher visual areas). During the critical period, binocular competition shapes "
        "ocular dominance columns in V1. Abnormal visual input disrupts this process.", BODY))
    e.append(sp(5))

    e += [sub_heading("Mechanisms by Type")]
    rows = [
        ["Monocular suppression", "Strabismic", "The visual cortex actively suppresses input from the deviating eye to avoid diplopia and confusion. Sustained suppression leads to failure of cortical development of that eye's representation."],
        ["Blur-induced deprivation", "Anisometropic", "Chronically defocused retinal image from the more ametropic eye fails to provide sharp spatial frequency information, preventing normal cortical maturation. Spatial tuning of neurons is degraded."],
        ["Complete form deprivation", "Stimulus deprivation", "Absence of any patterned visual input (e.g. dense cataract). Most severe cortical disruption — affects all spatial frequencies. Binocular rivalry is absent; the cortex is entirely deprived of input from that eye."],
        ["Bilateral blur", "Bilateral ametropic", "Both eyes receive defocused images symmetrically. Binocular competition is preserved but absolute acuity is reduced in both eyes. Less severe than unilateral forms."],
        ["Meridional blur", "Meridional", "High uncorrected astigmatism results in blur in one meridian. Cortical neurons tuned to that orientation fail to develop normally — 'meridional amblyopia.'"],
    ]
    e.append(build_table(
        ["Mechanism", "Amblyopia Type", "Cortical Effect"],
        rows,
        [3.8*cm, 3.8*cm, CONTENT_W - 7.6*cm]
    ))
    e.append(sp(8))

    e += [sub_heading("Critical / Sensitive Period")]
    e.append(Paragraph(
        "The critical period is the developmental window during which the visual cortex requires balanced, "
        "high-quality binocular input. Outside this window, treatment becomes progressively less effective.", BODY))
    e.append(sp(4))
    rows_cp = [
        ["Strabismic amblyopia",    "Up to 7–8 years", "Earlier = more severe; suppression develops rapidly"],
        ["Anisometropic amblyopia", "May extend to teens", "Especially where binocularity is partially preserved"],
        ["Stimulus deprivation",    "First weeks to months of life", "Most urgent — dense unilateral cataracts must be removed within 6–8 weeks"],
        ["Bilateral ametropic",     "Up to 7–8 years", "Both eyes affected; may be subtler and missed"],
    ]
    e.append(build_table(
        ["Amblyopia Type", "Critical Period", "Key Note"],
        rows_cp,
        [4.5*cm, 3.8*cm, CONTENT_W - 8.3*cm]
    ))
    e.append(sp(6))
    e.append(tip_box(
        "Kanski: 'The sensitive period during which acuity of an amblyopic eye can be improved is usually up to "
        "7–8 years in strabismic amblyopia and may be longer (into the teens) for anisometropic amblyopia where "
        "good binocular function is present.' — Kanski's Clinical Ophthalmology, 10th Ed., p. 733."
    ))
    return e

# ══════════════════════════════════════════════════════════════════════════════
#  SECTION 3: CLASSIFICATION (DETAILED)
# ══════════════════════════════════════════════════════════════════════════════
def section_classification():
    e = [section_heading("3.  CLASSIFICATION OF AMBLYOPIA (DETAILED)"), sp(6)]

    types = [
        {
            "title": "3.1  Strabismic Amblyopia",
            "bg": PALE_BLUE,
            "bc": MID_BLUE,
            "points": [
                "<b>Definition:</b> Results from abnormal binocular interaction where there is continued monocular suppression of the deviating eye (Kanski, 10th Ed.).",
                "<b>Prevalence:</b> Most common form alongside anisometropic; together they account for >90% of amblyopia cases.",
                "<b>Mechanism:</b> Eyes are misaligned. The brain suppresses the image from the consistently deviating (non-fixating) eye to prevent diplopia. Sustained suppression → failure of cortical development.",
                "<b>Eye affected:</b> The consistently deviating, non-fixating eye. Alternating squint rarely causes amblyopia as each eye takes turns fixating.",
                "<b>Refractive error:</b> Not necessarily present; strabismus can be purely motor.",
                "<b>Fixation:</b> May be central or eccentric. In deep amblyopia, eccentric fixation develops — a parafoveal point is used for fixation rather than the fovea.",
                "<b>Strabismus ↔ Amblyopia relationship:</b> Strabismus can cause OR be the result of amblyopia (Wills Eye Manual, 8th Ed., p. 513).",
                "<b>Treatment:</b> Address refractive error first; then patching/penalization; strabismus surgery only after maximal VA achieved.",
            ]
        },
        {
            "title": "3.2  Anisometropic Amblyopia",
            "bg": PALE_BLUE,
            "bc": MID_BLUE,
            "points": [
                "<b>Definition:</b> Caused by a difference in refractive error between the eyes (Kanski: may result from a difference of as little as 1 dioptre).",
                "<b>Prevalence:</b> Most common form alongside strabismic.",
                "<b>Mechanism:</b> The more ametropic eye receives a chronically blurred retinal image — a form of mild but sustained visual deprivation. The cortex preferentially develops the representation of the sharper-seeing eye.",
                "<b>Threshold values (Wills Eye, 8th Ed.):</b> Typically ≥1.50 D difference in spherical equivalent; clinically significant astigmatic anisometropia ≥1.5–2.0 D.",
                "<b>Aetiology of anisometropia:</b> Idiopathic; eyelid hemangioma or congenital ptosis causing astigmatism (Wills Eye, p. 513); post-surgical (e.g. aphakia in one eye).",
                "<b>Association with strabismus:</b> Frequently associated with microstrabismus; may co-exist with strabismic amblyopia (combined mechanism) — Kanski, 10th Ed.",
                "<b>Fixation:</b> Usually central, unlike strabismic amblyopia.",
                "<b>Prognosis:</b> Responds well to optical correction + patching; critical period may extend longer than strabismic type.",
                "<b>Screening pearl:</b> Often clinically silent — the child does not complain because the better eye compensates. Detected on VA testing or cycloplegic refraction.",
            ]
        },
        {
            "title": "3.3  Stimulus Deprivation Amblyopia (Form Deprivation)",
            "bg": RED_LIGHT,
            "bc": RED_WARN,
            "points": [
                "<b>Definition:</b> Results from vision deprivation — a physical obstruction preventing a well-focused, high-contrast image reaching the retina (Kanski: caused by opacities in the media or ptosis covering the pupil).",
                "<b>Severity:</b> The MOST SEVERE form of amblyopia — all spatial frequencies affected; near-complete loss of cortical input.",
                "<b>Causes (unilateral):</b> Congenital cataract (most important), corneal scar or opacity, persistent fetal vasculature (PFV), dense vitreous haemorrhage, complete ptosis obstructing the visual axis.",
                "<b>Causes (bilateral):</b> Bilateral congenital cataracts, bilateral corneal opacities, bilateral ptosis.",
                "<b>Laterality:</b> May be unilateral or bilateral.",
                "<b>Urgency:</b> Congenital unilateral dense cataract must be removed within 6–8 weeks of birth and contact lens/aphakic correction + patching begun immediately. Delay beyond 3 months results in severe, often irreversible amblyopia.",
                "<b>Nystagmus:</b> Late presentation of bilateral stimulus deprivation may result in nystagmus.",
                "<b>Treatment:</b> Remove the cause (surgery for cataract) + optical correction + aggressive patching of the non-amblyopic eye.",
            ]
        },
        {
            "title": "3.4  Bilateral Ametropic Amblyopia",
            "bg": PALE_BLUE,
            "bc": MID_BLUE,
            "points": [
                "<b>Definition:</b> Results from high SYMMETRICAL refractive errors, usually hypermetropia, affecting both eyes equally (Kanski, 10th Ed.).",
                "<b>Mechanism:</b> Both eyes receive equally defocused images. No interocular competition occurs, but absolute cortical development is impaired as no sharp image ever forms.",
                "<b>Typical refractive errors:</b> High bilateral hypermetropia (usually >4–5 D); high bilateral myopia; high bilateral astigmatism.",
                "<b>Detection challenge:</b> Child functions visually with both eyes and may not appear impaired. Detected only on formal VA testing with cycloplegic refraction.",
                "<b>Treatment:</b> Full optical correction. In most cases, VA improves substantially with spectacles alone without any occlusion therapy. Monitor for residual reduction requiring penalization.",
            ]
        },
        {
            "title": "3.5  Meridional Amblyopia",
            "bg": PALE_BLUE,
            "bc": MID_BLUE,
            "points": [
                "<b>Definition:</b> Results from image blur in one meridian — caused by uncorrected astigmatism (usually >1 D) persisting beyond the period of emmetropization in early childhood (Kanski, 10th Ed.).",
                "<b>Mechanism:</b> Neurons in the visual cortex tuned to the axis of the uncorrected astigmatism fail to develop normal resolution. The affected meridian shows reduced contrast sensitivity and acuity (meridional amblyopia).",
                "<b>Laterality:</b> Unilateral or bilateral depending on astigmatism distribution.",
                "<b>Clinical test:</b> VA testing with gratings oriented at different axes reveals meridional deficits; Snellen acuity may be surprisingly good because the astigmatic axis is not always tested.",
                "<b>Treatment:</b> Full astigmatic correction from as early as possible; patching if VA remains reduced after refractive adaptation.",
            ]
        },
        {
            "title": "3.6  Occlusion (Iatrogenic) Amblyopia",
            "bg": GOLD_LIGHT,
            "bc": GOLD,
            "points": [
                "<b>Definition (Wills Eye, 8th Ed.):</b> Amblyopia that occurs in the fellow eye as a result of too much patching or excessive use of atropine.",
                "<b>At-risk group:</b> Younger children (especially infants) — plasticity is highest and the good eye can quickly develop amblyopia from over-occlusion.",
                "<b>Prevention:</b> Monitor at 1 week per year of age; use part-time rather than full-time patching when possible; use full cycloplegic refraction when prescribing atropine.",
                "<b>Management:</b> If detected, patch the OPPOSITE eye (the amblyopic eye, which was originally being treated) for a short period (1 day per year of age), then repeat the examination.",
            ]
        },
    ]

    for t in types:
        e.append(sp(4))
        e.append(sub2_heading(t["title"]))
        box_paras = [bullet_para(p) for p in t["points"]]
        e.append(info_box("", box_paras, bg=t["bg"], border_color=t["bc"], label_color=t["bc"]))
        e.append(sp(4))

    return e

# ══════════════════════════════════════════════════════════════════════════════
#  SECTION 4: DIAGNOSIS
# ══════════════════════════════════════════════════════════════════════════════
def section_diagnosis():
    e = [section_heading("4.  DIAGNOSIS"), sp(6)]

    e += [sub_heading("Diagnostic Criteria")]
    e.append(info_box(
        "Kanski Criterion",
        [Paragraph("In the absence of an organic lesion, a difference in best-corrected VA of <b>two Snellen lines or more (or >1 log unit)</b> is indicative of amblyopia.", BODY)],
        bg=PALE_BLUE, border_color=DEEP_BLUE
    ))
    e.append(sp(8))

    e += [sub_heading("Clinical Features")]
    rows = [
        ["Reduced BCVA", "Critical", "≥2 Snellen lines difference; not correctable with refraction; no organic explanation"],
        ["Crowding phenomenon", "Critical", "Individual letters read more easily than a full line. More pronounced in amblyopes. Kanski: 'must be taken into account when testing preverbal children.' Caused by lateral inhibition in the abnormally developed cortex."],
        ["Neutral density filter effect", "Important", "In reduced illumination, VA of an amblyopic eye decreases far less than an organically diseased eye. Helps distinguish functional from organic visual loss."],
        ["Trace RAPD", "Variable", "Severe amblyopia may cause a trace relative afferent pupillary defect. Wills Eye caution: direct light carefully along same axis in each eye — strabismus causes false-positive results if light directed off-axis."],
        ["Peripheral visual field", "Typically normal", "Central fixation primarily affected; peripheral field preserved."],
        ["Eccentric fixation", "In severe cases", "Particularly in dense strabismic amblyopia — a parafoveal point used instead of the fovea. Tested with visuoscopy."],
        ["Colour vision", "Usually normal", "Unlike optic nerve disease; helps in differential diagnosis."],
    ]
    e.append(build_table_left_hdr(
        ["Feature", "Importance", "Details"],
        rows,
        [3.5*cm, 2.8*cm, CONTENT_W - 6.3*cm]
    ))
    e.append(sp(8))

    e += [sub_heading("Diagnostic Workup (Wills Eye Manual, 8th Ed.)")]
    steps = [
        ("<b>History</b>", "Childhood eye problems, misaligned eyes, prior patching treatment, strabismus surgery. History of relevant conditions: prematurity, family history of amblyopia/strabismus."),
        ("<b>Full ocular examination</b>", "MUST examine fundi to exclude organic pathology BEFORE commencing treatment. Organic disease and amblyopia can co-exist."),
        ("<b>Visual acuity testing</b>", "Age-appropriate: Cardiff cards / Teller acuity cards (infants); HOTV / Lea symbols (preschool); Snellen (school-age). Test each eye individually. Use crowded optotypes, not single letters, to avoid underestimating amblyopia."),
        ("<b>Cover-uncover test</b>", "Detect manifest strabismus (tropia). Alternate cover test reveals maximum total deviation. Prism cover test measures angle."),
        ("<b>Cycloplegic refraction</b>", "Mandatory in both eyes. Use cyclopentolate 1% (or atropine 1% in children <1 year). Full refractive correction must be prescribed before judging amblyopia."),
        ("<b>Stereopsis assessment</b>", "Randot stereotest, Titmus fly (gross stereopsis), Lang stereotest. Stereoacuity is a sensitive marker of binocular function and helps gauge depth of amblyopia."),
        ("<b>Sensory anomaly tests</b>", "Worth 4-dot test (binocular status, suppression, diplopia); Bagolini striated glasses (most natural binocular test). Used to detect suppression scotoma."),
        ("<b>Fixation assessment</b>", "Visuscopy / direct ophthalmoscope: determines central vs. eccentric fixation in the amblyopic eye. Steady central fixation is a good prognostic sign."),
        ("<b>Contrast sensitivity</b>", "Pelli-Robson chart; Vistech gratings. Amblyopia impairs contrast sensitivity, especially at middle spatial frequencies."),
    ]
    for n, (label, desc) in enumerate(steps, 1):
        e.append(Paragraph(f"<b>{n}.</b>  {label}:  {desc}", BODY))
        e.append(sp(3))

    e.append(sp(6))
    e.append(warn_box(
        "Always examine the fundus and exclude organic pathology BEFORE starting amblyopia treatment. "
        "If acuity does not respond to treatment, reconsider investigations such as electrophysiology (VEP) "
        "or neuroimaging. (Kanski's Clinical Ophthalmology, 10th Ed.)"
    ))
    return e

# ══════════════════════════════════════════════════════════════════════════════
#  SECTION 5: MANAGEMENT PROTOCOLS
# ══════════════════════════════════════════════════════════════════════════════
def section_management():
    e = [section_heading("5.  MANAGEMENT PROTOCOLS"), sp(6)]

    e += [sub_heading("Overview: Step-by-Step Approach")]
    steps_overview = [
        ("Step 1", "Treat the underlying cause", "Remove media opacities; correct refractive error with full cycloplegic refraction; address strabismus after VA equalization."),
        ("Step 2", "Refractive adaptation", "6–12 weeks of full-time spectacles before adding active therapy. Many cases resolve with glasses alone."),
        ("Step 3", "Active amblyopia therapy", "Occlusion (patching) first-line; atropine penalization as alternative or when compliance is poor."),
        ("Step 4", "Adjuncts if needed", "Bangerter filters; optical degradation; digital dichoptic therapeutics (emerging)."),
        ("Step 5", "Maintenance & monitoring", "Part-time patching after VA improvement; gradual taper; long-term follow-up through sensitive period."),
    ]
    e.append(build_table(
        ["Step", "Action", "Details"],
        steps_overview,
        [1.6*cm, 4.5*cm, CONTENT_W - 6.1*cm]
    ))
    e.append(sp(10))

    # ── Step 1 ──────────────────────────────────────────────────────────────
    e.append(sub2_heading("Step 1: Treat the Underlying Cause"))
    e.append(bullet_para("<b>Media opacities (stimulus deprivation):</b> Surgical removal is urgent — congenital cataract should be removed within 6–8 weeks and optical correction (contact lens/glasses) + patching started immediately."))
    e.append(bullet_para("<b>Refractive correction:</b> Prescribe full cycloplegic refraction. Spectacles alone are effective in many cases."))
    e.append(bullet_para("<b>Spectacles-only evidence:</b> Amblyopia improved by ≥2 lines in 77% of anisometropic cases treated with glasses alone; complete resolution in 27% (AAO PPP data). Strabismic cases also show significant improvement."))
    e.append(bullet_para("<b>Strabismus surgery:</b> Delay until vision is equalized or maximal VA achieved in the amblyopic eye (Wills Eye Manual)."))
    e.append(sp(8))

    # ── Step 2 ──────────────────────────────────────────────────────────────
    e.append(sub2_heading("Step 2: Refractive Adaptation Period (6–12 Weeks)"))
    e.append(Paragraph(
        "Allow 6–12 weeks of full-time spectacle wear before adding occlusion or penalization. This is now standard "
        "practice based on PEDIG data showing substantial VA improvement with glasses alone in many children.", BODY))
    e.append(sp(4))
    e.append(tip_box("Prescribing optical correction for refractive amblyopia before jumping to patching is evidence-based "
                     "practice. Many children achieve normal VA with spectacles alone and never need patching."))
    e.append(sp(8))

    # ── Step 3 ──────────────────────────────────────────────────────────────
    e.append(sub2_heading("Step 3A: Occlusion (Patching) — First-Line Treatment"))
    e.append(Paragraph("<b>Principle:</b> Occlude the dominant (better-seeing) eye to force use of the amblyopic eye, driving cortical reorganization.", BODY))
    e.append(sp(4))
    patch_rows = [
        ["Eye to patch",      "Dominant (better-seeing) eye — NEVER the amblyopic eye for primary treatment"],
        ["Dose — moderate (20/40–20/80)", "2 hours/day — AAO PPP 2022 (equally effective as higher doses per PEDIG)"],
        ["Dose — severe (<20/400)",       "Up to 6 hours/day or full-time depending on age and density of amblyopia"],
        ["Patch type",        "Adhesive patch directly over skin — most effective. Patches over glasses allow peeking and are not ideal."],
        ["Skin irritation",   "Tincture of benzoin on skin before applying; warm compresses before removal"],
        ["Follow-up",         "1 week per year of age (e.g., 3 weeks for a 3-year-old; 6 weeks for a 6-year-old)"],
        ["Monitoring",        "Check VA in BOTH eyes at every visit — younger children have higher risk of reverse (occlusion) amblyopia in the patched eye"],
        ["Near activities",   "Encourage visually demanding near work during patching hours (colouring, puzzles, reading) — shown to improve efficacy"],
        ["Duration",          "Until VA equalized or no improvement after 3 consecutive compliant treatment cycles"],
        ["Stop criterion",    "No improvement after 6 months of documented, effective occlusion — further treatment unlikely (Kanski)"],
    ]
    e.append(build_table_left_hdr(
        ["Parameter", "Guidance"],
        patch_rows,
        [4.5*cm, CONTENT_W - 4.5*cm]
    ))
    e.append(sp(8))

    e.append(sub2_heading("Step 3B: Pharmacological Penalization (Atropine) — Alternative / Second-Line"))
    e.append(Paragraph(
        "<b>Principle:</b> Cycloplegic drops instilled in the dominant (non-amblyopic) eye blur near vision, forcing "
        "use of the amblyopic eye for close work.", BODY))
    e.append(sp(4))
    atr_rows = [
        ["Agent",               "Atropine 1% ophthalmic solution"],
        ["Eye treated",         "Non-amblyopic (dominant) eye — NOT the amblyopic eye"],
        ["Standard dose",       "1 drop once daily (Monday–Friday or daily)"],
        ["Weekend regimen",     "Saturday + Sunday only — equal efficacy to daily dosing per PEDIG (improved compliance)"],
        ["Best indication",     "Mild–moderate amblyopia (VA 20/100 / 6/24 or better); anisometropic hypermetropic amblyopia"],
        ["Effect enhancement",  "Remove the hyperopic spectacle lens from the non-amblyopic eye if VA does not improve"],
        ["School-age children", "If causing difficulty at school: prescribe full hyperopic correction + +2.50 bifocal during school hours; or weekend-only dosing"],
        ["Advantage over patch","Cannot be thwarted by child; less psychosocial burden; higher parental acceptability (Cochrane)"],
        ["Atropine vs. patching","Equal VA outcomes; patching has faster initial improvement; atropine has better adherence and QoL scores (Cochrane PMID 31461545)"],
        ["Side effects",        "Photophobia, near blur in atropinized eye, mild transient conjunctival/lid irritation; very rare systemic toxicity"],
    ]
    e.append(build_table_left_hdr(
        ["Parameter", "Guidance"],
        atr_rows,
        [4.5*cm, CONTENT_W - 4.5*cm]
    ))
    e.append(sp(8))

    e.append(sub2_heading("Step 4: Adjunct and Emerging Treatments"))
    adjuncts = [
        ("<b>Optical Degradation:</b>", "High plus lens (+9.00 D or aphakic contact lens) in the spectacle of the fellow eye; or remove the minus lens for high myopes. Less commonly used."),
        ("<b>Bangerter (Translucent) Filters:</b>", "Graded-density foil applied to the spectacle lens of the dominant eye. Provides graduated penalization; less conspicuous than patching. Listed as a suitable option in AAO PPP 2022."),
        ("<b>Dichoptic / Binocular Digital Therapeutics:</b>", "Separate images presented to each eye — high contrast to amblyopic eye, reduced contrast to fellow eye. Delivered via video games, streaming (CureSight), or dedicated devices. Phase III RCTs show non-inferiority to patching with better adherence. See Section 6 for full study evidence."),
        ("<b>Perceptual Learning:</b>", "Repeated exposure to fine spatial discriminations trains cortical neurons. Early adult studies show modest gains even after the critical period. Not yet standard of care."),
        ("<b>Levodopa augmentation:</b>", "Experimental — dopaminergic agonists may reopen cortical plasticity; small RCTs show modest VA improvement. Not currently recommended outside research settings."),
    ]
    for label, desc in adjuncts:
        e.append(Paragraph(f"• {label}  {desc}", BULLET))
        e.append(sp(3))
    e.append(sp(8))

    e.append(sub2_heading("Step 5: Maintenance, Tapering, and Long-Term Follow-up"))
    e.append(bullet_para("After achieving maximum VA improvement: switch to <b>part-time patching</b> to maintain gains and prevent recurrence."))
    e.append(bullet_para("Taper patching <b>gradually over at least 5 weeks</b> when discontinuing treatment (Brazilian Best Practice Guidelines, 2024)."))
    e.append(bullet_para("Long-term follow-up through the sensitive period is essential — recurrence is common."))
    e.append(bullet_para("<b>Protective eyewear:</b> If amblyopia cannot be fully treated, prescribe protective glasses at all times. One-eyed athlete rule: any child not achieving 20/40 must wear protective eyewear during sports."))
    e.append(bullet_para("<b>Compliance</b> is the single greatest barrier to improvement. Kanski: 'Amblyopia treatment benefits from time spent at the outset on communication of the rationale and the difficulties involved.'"))
    e.append(sp(6))
    e.append(warn_box("Poor compliance is the single greatest barrier to improvement. Address this proactively with the family."))
    return e

# ══════════════════════════════════════════════════════════════════════════════
#  SECTION 6: TREATMENT STUDIES (DETAILED)
# ══════════════════════════════════════════════════════════════════════════════
def section_studies():
    e = [section_heading("6.  AMBLYOPIA TREATMENT STUDIES — DETAILED EVIDENCE"), sp(6)]

    e += [sub_heading("6.1  PEDIG (Pediatric Eye Disease Investigator Group) — Landmark RCT Series")]
    e.append(Paragraph(
        "PEDIG has produced the most robust RCT evidence base for amblyopia management. Key findings:", BODY))
    e.append(sp(4))
    pedig_rows = [
        ["Patching vs. Atropine (moderate amblyopia)", "≥3 y", "Equal VA outcomes at 6 months and 2 years; patching showed faster initial improvement; atropine had higher parental acceptability and compliance"],
        ["2 h vs. 6 h daily patching", "3–7 y", "2 h/day equivalent to 6 h/day for moderate amblyopia (20/40–20/100) — supports lower-dose regimens"],
        ["Weekend vs. daily atropine", "3–7 y", "Weekend atropine = daily atropine in VA improvement; weekend dosing improves compliance"],
        ["Spectacles alone before patching", "3–7 y", "Substantial VA improvement with glasses alone; first-line before occlusion therapy"],
        ["Older children (7–17 y, naïve)", "7–17 y", "Patching effective even in older, previously untreated children — extends treatment window beyond assumed critical period"],
        ["Near activities during patching", "3–7 y", "Patching + near activities: modestly superior to patching + distance activities for severe amblyopia"],
        ["Recurrence after treatment stops", "Various", "Continued part-time patching after improvement associated with durable VA gains; gradual taper reduces recurrence risk"],
    ]
    e.append(build_table(
        ["Study Focus", "Age Range", "Key Finding"],
        pedig_rows,
        [5.5*cm, 2.0*cm, CONTENT_W - 7.5*cm]
    ))
    e.append(sp(8))

    # ── Cochrane Review ───────────────────────────────────────────────────────
    e += [sub_heading("6.2  Cochrane Systematic Review: Occlusion vs. Atropine")]
    e.append(evidence_box(
        "Li T et al., Cochrane Database Syst Rev 2019 [PMID: 31461545]",
        "7 RCTs (5 randomized + 2 quasi-randomized), 1177 amblyopic eyes, 6 countries (China, India, Iran, Ireland, "
        "Spain, USA). "
        "Key findings: (1) Atropine penalization is AS EFFECTIVE as conventional occlusion in improving VA at all "
        "time points from 5 weeks to 10 years. (2) Both treatments produced similar improvements in ocular alignment, "
        "stereoacuity, and sound-eye VA (moderate-certainty evidence). "
        "(3) Atropine: better adherence, better quality of life, lower cost; associated with mild transient VA reduction "
        "in the sound eye and photosensitivity. (4) Patching: more skin/lid irritation. "
        "Authors' conclusion: Atropine penalization appears as effective as conventional occlusion."
    ))
    e.append(sp(8))

    # ── Network Meta-Analysis ─────────────────────────────────────────────────
    e += [sub_heading("6.3  Network Meta-Analysis: All Amblyopia Interventions Compared")]
    e.append(evidence_box(
        "Li Y et al., BMC Ophthalmol 2020 [PMID: 32450849] — Network Meta-Analysis",
        "23 RCTs, 3279 patients. Included: spectacles alone, patch 2h, patch 6h, patch 12h, patch+near activities, "
        "patch+distant activities, daily atropine, weekly atropine, weekly atropine+plano lens, optical penalization, "
        "binocular therapy. "
        "Results: Optical penalization was the LEAST EFFECTIVE. All other modalities showed broadly comparable VA "
        "improvement. Patch 6h and patch 2h+near activities were statistically superior to spectacles alone "
        "(MD 0.73 lines and 0.84 lines respectively, 95% CrI not crossing zero). "
        "Conclusion: Most treatment modalities for amblyopia have comparable efficacy; further high-quality RCTs needed "
        "to determine optimal acceptability and adherence profiles."
    ))
    e.append(sp(8))

    # ── Binocular Treatment SR ────────────────────────────────────────────────
    e += [sub_heading("6.4  Binocular Treatment — Systematic Review (2024)")]
    e.append(study_box(
        "Tsani Z et al., Int Ophthalmol 2024 [PMID: 39222269] — Systematic Review",
        "20 RCTs, 1769 patients. 12 different binocular treatment types identified in two main categories: "
        "(1) Low-contrast images presented to the fellow eye only (stimulating the amblyopic eye preferentially); "
        "(2) Complementary dichoptic image deficits in both eyes to encourage simultaneous binocular use. "
        "Findings: Binocular treatment shows PROMISING results for anisometropic, strabismic, and mixed amblyopia. "
        "Conclusion: Further RCTs needed to establish optimal dosage, type, and duration before binocular therapy "
        "becomes a standard component of amblyopia care."
    ))
    e.append(sp(8))

    # ── Dichoptic Digital Therapeutic Phase III ──────────────────────────────
    e += [sub_heading("6.5  Dichoptic Digital Therapeutic — Phase III RCT")]
    e.append(study_box(
        "Xiao S et al., Ophthalmology 2022 [PMID: 34534556] — Phase III Multicenter RCT",
        "105 children aged 4–7 years with amblyopia; 21 sites (academic + community, USA). "
        "Design: dichoptic digital therapeutic (1 hour/day, 6 days/week, at home) + glasses vs. glasses alone. "
        "Primary outcome: change in amblyopic eye VA at 12 weeks (masked examiners). "
        "Results: Treatment group improved 1.8 lines (95% CI 1.4–2.3) vs. 0.8 lines (95% CI 0.4–1.3) in control. "
        "Difference = 1.0 lines (P=0.0011). Trial stopped early for success at pre-planned interim analysis. "
        "No serious adverse events. "
        "Significance: First Phase III RCT of a dichoptic digital therapeutic; supports its value in clinical practice "
        "as an effective treatment. Note: erratum published (PMID: 35461530)."
    ))
    e.append(sp(8))

    # ── Eye-tracking dichoptic RCT ────────────────────────────────────────────
    e += [sub_heading("6.6  Eye-Tracking Dichoptic Home Treatment vs. Patching — Multicenter RCT")]
    e.append(study_box(
        "Wygnanski-Jaffe T et al., Ophthalmology 2023 [PMID: 36306974] — Multicenter Noninferiority RCT",
        "103 children aged 4 to <9 years; anisometropic, small-angle strabismic, or mixed amblyopia. "
        "CureSight device (NovaSight): anaglyph glasses + eye tracker delivering real-time blur around the fellow "
        "eye fovea in dichoptic streaming video content. "
        "Regimen: 90 min/day × 5 days/week × 16 weeks (120 total hours) vs. 2h patching × 7 days/week (224 hours). "
        "Results: CureSight VA improvement 0.28 logMAR vs. patching 0.23 logMAR — NONINFERIOR to patching "
        "(90% CI of difference −0.008 to 0.076, within prespecified 1-line margin). "
        "Stereoacuity improvement: 0.40 log arcseconds in both groups (P<0.0001). "
        "Adherence: CureSight group SIGNIFICANTLY HIGHER (91% vs. 83%, P=0.011). "
        "Significance: A viable, well-tolerated alternative to patching with superior adherence using fewer treatment hours."
    ))
    e.append(sp(8))

    # ── Binocular meta-analysis ───────────────────────────────────────────────
    e += [sub_heading("6.7  Binocular Treatment Meta-Analysis — Patching Comparison")]
    e.append(evidence_box(
        "Roda M et al., PLoS One 2021 [PMID: 34624028] — Meta-Analysis of 5 RCTs",
        "No significant difference in VA between binocular treatment and patching (SDM = −0.12; 95% CI −0.45 to 0.20; "
        "P=0.464). No significant difference in stereopsis (SDM = −0.07; 95% CI −0.61 to 0.48; P=0.809). "
        "High between-study heterogeneity (I² = 57–61%). "
        "Conclusion: No convincing evidence that binocular treatment should fully replace conventional patching. "
        "May serve as a valid complementary therapy in selected cases. Further studies required."
    ))
    e.append(sp(8))

    # ── Video game treatment ──────────────────────────────────────────────────
    e += [sub_heading("6.8  Video Game Treatment — Meta-Analysis")]
    e.append(evidence_box(
        "Fu E et al., Surv Ophthalmol 2022 [PMID: 34606819] — Meta-Analysis",
        "Dichoptic video game treatment shows VA improvements comparable to conventional treatments. "
        "Better patient engagement and adherence versus patching. "
        "VA improvements ranged from 1–2 lines in most studies. "
        "Conclusion: Video game-based dichoptic therapy is a promising, adherence-friendly treatment option "
        "for amblyopia in children, particularly as an alternative or supplement to patching."
    ))
    e.append(sp(8))

    # ── Brazilian guideline ───────────────────────────────────────────────────
    e += [sub_heading("6.9  Brazilian Best Practice Guidelines — Amblyopia (2024)")]
    e.append(evidence_box(
        "Issaho DC et al., Arq Bras Oftalmol 2024 [PMID: 39607280] — Practice Guideline",
        "Gold standard: spectacles + patching of the dominant eye. Most effective in patients aged <7 years. "
        "Treatment must be discontinued gradually, tapering patching for at least 5 weeks. "
        "Atropine indicated for penalization in hyperopic children where amblyopic eye has better VA under "
        "cycloplegia than the fellow eye. "
        "Key insight: The discovery of significant neural plasticity in the amblyopic brain AFTER the critical period "
        "opens possibilities for new treatment modalities even beyond childhood."
    ))
    e.append(sp(8))

    # ── Summary comparison table ──────────────────────────────────────────────
    e += [sub_heading("6.10  Treatment Modalities — Evidence Comparison Summary")]
    comp_rows = [
        ["Spectacles alone",     "High — PEDIG",          "Substantial VA improvement before any occlusion; 27% resolve completely (anisometropic)"],
        ["Patching 2h/day",      "High — PEDIG",          "Equivalent to 6h/day for moderate amblyopia; first-line per AAO PPP 2022"],
        ["Atropine (daily)",     "High — PEDIG, Cochrane","Equal to patching; better adherence; higher parental acceptability; lower cost"],
        ["Atropine (weekend)",   "High — PEDIG",          "Equal to daily atropine; further improves compliance"],
        ["Bangerter filters",    "Moderate — PEDIG",      "Non-inferior to patching for mild/moderate amblyopia in some PEDIG studies"],
        ["Dichoptic digital",    "Moderate — Phase III",  "Non-inferior to patching; better adherence; shorter daily treatment time required"],
        ["Binocular therapy",    "Moderate — SR/MA",      "Promising; not yet sufficient to replace patching; good adherence"],
        ["Optical penalization", "Low-Moderate — NMA",    "Least effective in network meta-analysis (Li 2020); not generally preferred"],
        ["Levodopa",             "Low — small RCTs",      "Modest, short-lived gains; not recommended outside research"],
        ["Perceptual learning",  "Low — pilot studies",   "May extend treatment window into adulthood; not yet standard of care"],
    ]
    e.append(build_table(
        ["Treatment", "Evidence Level", "Key Summary"],
        comp_rows,
        [3.8*cm, 3.5*cm, CONTENT_W - 7.3*cm]
    ))
    return e

# ══════════════════════════════════════════════════════════════════════════════
#  SECTION 7: AAO PPP GUIDELINES
# ══════════════════════════════════════════════════════════════════════════════
def section_guidelines():
    e = [section_heading("7.  AAO PREFERRED PRACTICE PATTERN — KEY RECOMMENDATIONS"), sp(6)]
    e.append(Paragraph("American Academy of Ophthalmology PPP 2022, Updated May 2026", CITE))
    e.append(sp(6))
    recs = [
        "Refractive error correction ALONE can improve VA in anisometropic, strabismic, or combined amblyopia. Bilateral refractive amblyopia also substantially improves with correction alone.",
        "Most children with MODERATE amblyopia (20/40–20/80) respond to 2 hours/day of patching OR weekend atropine.",
        "Following treatment for strabismic/anisometropic amblyopia: continued monitoring is necessary. Additional treatment if needed is associated with long-term durability of VA improvement.",
        "Suitable treatments: optical correction, patching, pharmacological penalization, optical degradation, Bangerter filters, digital therapeutics — in addition to managing the underlying cause.",
        "Amblyopia treatment may be EFFECTIVE IN OLDER CHILDREN AND ADOLESCENTS, particularly if previously untreated.",
        "Goals: identify at-risk children early; examine at the earliest possible age; treat to improve visual function and reduce likelihood of vision-related disability.",
        "Treatment monitoring: scheduled at appropriate intervals based on age, type, and dose of treatment.",
    ]
    for r in recs:
        e.append(bullet_para(r))
    return e

# ══════════════════════════════════════════════════════════════════════════════
#  SECTION 8: CLINICAL PEARLS & QUICK REFERENCE
# ══════════════════════════════════════════════════════════════════════════════
def section_pearls():
    e = [section_heading("8.  CLINICAL PEARLS & QUICK REFERENCE"), sp(6)]
    rows = [
        ["Definition",              "Decreased BCVA without identifiable organic pathology; abnormal visual development during critical period"],
        ["Most common types",       "Strabismic + Anisometropic — together account for >90% of cases"],
        ["Most severe type",        "Stimulus deprivation — requires most urgent treatment (congenital cataract within 6–8 weeks)"],
        ["Diagnostic criterion",    "≥2 Snellen line BCVA difference; no organic explanation"],
        ["Crowding phenomenon",     "Single letters read better than full line — hallmark; use crowded charts for testing"],
        ["Critical period (strabi.)", "Up to 7–8 years"],
        ["Critical period (anis.)", "May extend into teens (especially with preserved binocularity)"],
        ["First step always",       "Full cycloplegic refraction + 6–12 weeks refractive adaptation before active therapy"],
        ["First-line treatment",    "Patching of dominant eye (2h/day for moderate amblyopia)"],
        ["Equal alternative",       "Atropine 1% — daily or weekend-only; equal efficacy to patching per Cochrane 2019"],
        ["Emerging option",         "Dichoptic digital therapeutics — non-inferior to patching; better adherence (Wygnanski-Jaffe 2023)"],
        ["Follow-up schedule",      "1 week per year of age; bilateral VA check at every visit"],
        ["Stop criterion",          "No improvement after 6 months of effective, documented occlusion (Kanski)"],
        ["Biggest barrier",         "Non-compliance — invest time in family education at outset (Kanski)"],
        ["After improvement",       "Taper gradually (≥5 weeks); part-time maintenance patching to prevent recurrence"],
        ["If treatment fails",      "Protective glasses mandatory; one-eyed athlete rule (<20/40 → sports eye protection)"],
    ]
    e.append(build_table_left_hdr(
        ["Parameter", "Key Point"],
        rows,
        [4.5*cm, CONTENT_W - 4.5*cm]
    ))
    return e

# ══════════════════════════════════════════════════════════════════════════════
#  SECTION 9: REFERENCES
# ══════════════════════════════════════════════════════════════════════════════
def section_references():
    e = [section_heading("9.  REFERENCES"), sp(6)]
    refs = [
        "1.  Kanski JJ, Bowling B. Kanski's Clinical Ophthalmology: A Systematic Approach. 10th ed. Elsevier; 2020. pp. 733–734.",
        "2.  Gerstenblith AT, Rabinowitz MP. The Wills Eye Manual: Office and Emergency Room Diagnosis and Treatment of Eye Disease. 8th ed. Wolters Kluwer; 2022. pp. 512–515.",
        "3.  American Academy of Ophthalmology. Amblyopia Preferred Practice Pattern. 2022 (Updated May 2026). https://www.aao.org/education/preferred-practice-pattern/amblyopia-ppp-2022",
        "4.  Li T, Qureshi R, Taylor K. Conventional occlusion versus pharmacologic penalization for amblyopia. Cochrane Database Syst Rev. 2019;(8):CD006460. PMID: 31461545.",
        "5.  Li Y, Sun H, Zhu X, et al. Efficacy of interventions for amblyopia: a systematic review and network meta-analysis. BMC Ophthalmol. 2020;20:222. PMID: 32450849.",
        "6.  Tsani Z, Ioannopoulos D, Androudi S, et al. Binocular treatment for amblyopia: a systematic review. Int Ophthalmol. 2024. PMID: 39222269.",
        "7.  Xiao S, Angjeli E, Wu HC, et al. Randomized Controlled Trial of a Dichoptic Digital Therapeutic for Amblyopia. Ophthalmology. 2022;129(1):77–85. PMID: 34534556.",
        "8.  Wygnanski-Jaffe T, Kushner BJ, Moshkovitz A, et al. An Eye-Tracking-Based Dichoptic Home Treatment for Amblyopia: A Multicenter Randomized Clinical Trial. Ophthalmology. 2023;130(3):274–285. PMID: 36306974.",
        "9.  Roda M, Pellegrini M, Di Geronimo N, et al. Binocular treatment for amblyopia: A meta-analysis of randomized clinical trials. PLoS One. 2021. PMID: 34624028.",
        "10. Fu E, Wang T, Li J. Video game treatment of amblyopia. Surv Ophthalmol. 2022;67(3):858–872. PMID: 34606819.",
        "11. Issaho DC, Rossetto JD, Curi I, et al. Brazilian best practice guidelines for amblyopia diagnosis and management. Arq Bras Oftalmol. 2024. PMID: 39607280.",
        "12. PEDIG (Pediatric Eye Disease Investigator Group). Multiple RCTs on patching, atropine, refractive correction, older children. https://www.aao.org/education/disease-review/pedig-studies-quality-healthcare-amblyopia-treatme",
    ]
    for r in refs:
        e.append(Paragraph(r, REF))
        e.append(sp(2))
    return e

# ══════════════════════════════════════════════════════════════════════════════
#  PAGE TEMPLATES
# ══════════════════════════════════════════════════════════════════════════════
def on_page(canvas, doc):
    canvas.saveState()
    # Header bar
    canvas.setFillColor(DEEP_BLUE)
    canvas.rect(MARGIN_L, H - MARGIN_T + 4, W - MARGIN_L - MARGIN_R, 18, fill=1, stroke=0)
    canvas.setFillColor(white)
    canvas.setFont("Helvetica-Bold", 8)
    canvas.drawString(MARGIN_L + 4, H - MARGIN_T + 10, "AMBLYOPIA — Comprehensive Clinical Reference")
    canvas.setFont("Helvetica", 8)
    canvas.setFillColor(HexColor("#A8D1F0"))
    canvas.drawRightString(W - MARGIN_R - 4, H - MARGIN_T + 10, "July 2026")
    # Footer
    canvas.setStrokeColor(HexColor("#AAAAAA"))
    canvas.setLineWidth(0.4)
    canvas.line(MARGIN_L, MARGIN_B - 4, W - MARGIN_R, MARGIN_B - 4)
    canvas.setFillColor(GRAY)
    canvas.setFont("Helvetica", 7)
    canvas.drawCentredString(W/2, MARGIN_B - 14,
        f"Amblyopia Clinical Reference  |  Sources: Kanski 10th Ed, Wills Eye 8th Ed, AAO PPP 2022/2026, PEDIG  |  Page {doc.page}")
    canvas.restoreState()

# ══════════════════════════════════════════════════════════════════════════════
#  BUILD
# ══════════════════════════════════════════════════════════════════════════════
OUT = "/home/daytona/workspace/amblyopia-pdf/Amblyopia_Comprehensive_Reference.pdf"

doc = SimpleDocTemplate(
    OUT,
    pagesize=A4,
    leftMargin=MARGIN_L, rightMargin=MARGIN_R,
    topMargin=MARGIN_T + 6, bottomMargin=MARGIN_B + 6,
    title="Amblyopia Comprehensive Clinical Reference",
    author="Orris AI",
    subject="Amblyopia Classification, Diagnosis, Management & Treatment Studies",
)

story = []
story += cover_page()
story += section_definition()
story.append(PageBreak())
story += section_pathophysiology()
story.append(PageBreak())
story += section_classification()
story.append(PageBreak())
story += section_diagnosis()
story.append(PageBreak())
story += section_management()
story.append(PageBreak())
story += section_studies()
story.append(PageBreak())
story += section_guidelines()
story += section_pearls()
story.append(PageBreak())
story += section_references()

doc.build(story, onFirstPage=on_page, onLaterPages=on_page)
print(f"SUCCESS: {OUT}")
Running Command

cd /home/daytona/workspace/amblyopia-pdf && python3 build_pdf.py 2>&1

Running Command

cd /home/daytona/workspace/amblyopia-pdf && python3 -c " content = open('build_p…

Running Command

cd /home/daytona/workspace/amblyopia-pdf && python3 build_pdf.py 2>&1

Running Command

cd /home/daytona/workspace/amblyopia-pdf && python3 -c " with open('build_pdf.py…

Running Command

cd /home/daytona/workspace/amblyopia-pdf && python3 -c " with open('build_pdf.py…

Running Command

cd /home/daytona/workspace/amblyopia-pdf && python3 -c " with open('build_pdf.py…

Running Command

cd /home/daytona/workspace/amblyopia-pdf && python3 -c " with open('build_pdf.py…

Running Command

cd /home/daytona/workspace/amblyopia-pdf && python3 -c " with open('build_pdf.py…

Running Command

cd /home/daytona/workspace/amblyopia-pdf && python3 - << 'PYEOF' with open('buil…

Running Command

cd /home/daytona/workspace/amblyopia-pdf && python3 build_pdf.py 2>&1 && ls -lh …

Model call limits exceeded: run limit (20/20)
This is a shared conversation. Sign in to Orris to start your own chat.