Input: I am attaching an MCQ PDF containing hundreds of multiple-choice questions (single best answer type). Task: Perform a complete topic-wise analysis of every single MCQ in the PDF and convert it into the most concise, high-yield revision notes possible. Step-by-step instructions (follow exactly): Extract & Categorize Read every MCQ. Identify the exact disease/condition/syndrome/topic each question is testing. Note the chapter/system if mentioned. Merge Common Topics Aggressively merge all overlapping or related topics into single master topics. For every merged topic, first write one single line at the top: Merged Topics: Acute Rheumatic Fever, Rheumatic Heart Disease, Jones criteria, Mitral stenosis, Aortic regurgitation (all MCQs merged). Output Format for EACH Merged Topic (strict structure): Topic Name: [Clear, concise, exam-friendly name] Merged Topics: [One-line list of all original topics merged] Stem Clues (High-yield presentation): • Bullet list of the most common MCQ stem triggers and classic presentations that point to this disease (age, gender, key symptoms, signs, risk factors, “classic vignette” phrases). Investigations (Key & Diagnostic): • Most important lab tests, imaging, special tests with their characteristic findings. • Mention gold-standard test and any pathognomonic findings. Treatment & Management: • First-line drugs/doses (if asked frequently), step-wise management, surgical indications, follow-up. • Any “must-know” emergency treatment or specific guidelines. Specific Peculiarities & Red Flags (Differentiation): • Unique clinical pearls, pathognomonic signs, buzzwords, or features that instantly distinguish this disease from close differentials in MCQs. • Any “never miss” or “always think of” points. Quick-Revision Memory Aids (Last 30-minute revision): • Mnemonics, acronyms, short memory hooks, visual associations, “one-liner” facts, or tables that can be revised in under 2 minutes before the exam. • Include any high-yield numbers (incidence, cut-offs, percentages) that repeatedly appear in MCQs. Final Output Instructions: Organise all topics in a logical order (by system → by frequency of appearance). Use clear headings, bullet points, bold text, and tables wherever helpful. Keep language extremely concise and exam-oriented (no long paragraphs). At the very end, add a one-page “Most Important Topics” summary list (top 10–15 merged topics that appeared most frequently in the PDF). Begin your response directly with the first merged topic. Avoid abbreviations And write questions numbers which all are merged just below topic.Do not add any meta-commentary or apology. Start working immediately after you receive the PDF. Generate answer in PDF. Recheck all MCQ, Don't miss any. . And recheck for all missing MCQ. Make one table as list in last where it shows first column MCQ number and in second column it's explained in which number sutopics.No backgrounds colours. It will waste ink during printing. All text must be in black ink. Use only bold, italic or different font size to differentiate heading or some important stuff. Keep all diagrams and in output. Remove all blank space. So I can take printout in minimal number of pages.
You have access to the file /home/daytona/workspace/ophthal_questions.txt which contains 54 ophthalmology MCQs (MRCP II Pastest 2023) extracted from a PDF. Each question block starts with "QUESTION N" and contains the clinical vignette, answer options, the correct answer, and a detailed explanation. YOUR TASK: Read ALL question blocks from the file, analyze every MCQ, then generate a comprehensive topic-wise high-yield revision notes PDF using reportlab. ## STEP 1: Read the full questions file Read the file /home/daytona/workspace/ophthal_questions.txt in chunks (offset 0, 300, 600, 900, 1200, 1500, 1800, 2100, 2400, 2700, 3000 etc.) until you have read ALL content. There are roughly 3200 lines total. ## STEP 2: Identify all 54 questions and their topics Based on your reading, identify what topic each question tests. The questions cover these ophthalmology topics (you may discover more): - Questions 1: Episcleritis (IBD-related) - Questions 2: Giant Cell Arteritis / AION - Questions 3: Central Retinal Vein Occlusion - Questions 4: Glaucoma - Questions 5: Diabetic Retinopathy (pre-proliferative) - Questions 6: Age-related Macular Degeneration - Questions 7: Optic Neuritis / MS - Questions 8: Cataracts - Questions 9: Retinal Detachment - Questions 10: Retinitis Pigmentosa - Questions 11: Diabetic Maculopathy - Questions 12-58: various other ophthalmology topics ## STEP 3: Generate the PDF Write a Python script using reportlab to generate a PDF at /home/daytona/workspace/Ophthalmology_Revision_Notes.pdf ### PDF Requirements: - NO background colors anywhere (white background only - saves ink for printing) - ALL text must be black - Use ONLY bold, italic, or different font sizes to differentiate headings - Remove all excessive blank space - compact layout for minimal pages - Use bullet points, tables, and structure as specified below ### PDF Structure for EACH merged topic: **Topic Name** (large bold heading) **Merged Topics:** [one-line list of all questions/subtopics merged] - include all Q numbers **Questions:** Q1, Q5, Q12... (all question numbers under this topic) Then these exact sections: 1. **Stem Clues (High-yield presentation):** bullet list of classic vignette triggers, age/gender/symptoms 2. **Investigations (Key & Diagnostic):** key tests, gold standard, pathognomonic findings 3. **Treatment & Management:** first-line drugs/doses, stepwise management, surgical indications 4. **Specific Peculiarities & Red Flags:** unique pearls, pathognomonic signs, buzzwords, differentials 5. **Quick-Revision Memory Aids:** mnemonics, one-liner facts, high-yield numbers ### At the very end: - "MOST IMPORTANT TOPICS" section listing top 10-15 topics by MCQ frequency - A TABLE with two columns: "MCQ Number" | "Topic/Subtopic Number" - mapping every Q number to which topic section it appears in ### Topics to create (merged): **TOPIC 1: Episcleritis & Scleritis** Qs: 1 + any others about red eye inflammatory conditions from the file **TOPIC 2: Giant Cell Arteritis (GCA) & Anterior Ischaemic Optic Neuropathy (AION)** Qs: 2 + any others about GCA, temporal arteritis, AION **TOPIC 3: Retinal Vascular Occlusions** (Central Retinal Vein Occlusion, Branch RVO, Central Retinal Artery Occlusion, Branch RAO) Qs: 3 + any others **TOPIC 4: Glaucoma** (Open-angle, Closed-angle, Normal tension, Secondary) Qs: 4 + any others **TOPIC 5: Diabetic Retinopathy & Diabetic Eye Disease** (Background, Pre-proliferative, Proliferative, Maculopathy, Cataract in DM) Qs: 5, 11 + any others **TOPIC 6: Age-Related Macular Degeneration (AMD)** (Dry, Wet, Anti-VEGF) **TOPIC 7: Optic Nerve Disorders** (Optic Neuritis, Papilloedema, Optic Atrophy, NAION) **TOPIC 8: Uveitis & Inflammatory Eye Conditions** (Anterior Uveitis/Iritis, Posterior Uveitis, Panuveitis, associations with systemic disease) **TOPIC 9: Retinal Disorders** (Retinal Detachment, Retinitis Pigmentosa, Macular Hole, Epiretinal Membrane) **TOPIC 10: Cataracts** **TOPIC 11: Hypertensive Retinopathy** **TOPIC 12: Infections & External Eye** (Conjunctivitis - bacterial/viral/allergic, Keratitis, Herpes, Trachoma, Orbital Cellulitis) **TOPIC 13: Neuro-ophthalmology** (Horner syndrome, CN III/IV/VI palsies, Visual field defects, Internuclear ophthalmoplegia, Nystagmus) **TOPIC 14: Systemic Disease Eye Manifestations** (Sarcoidosis, Thyroid eye disease, Rheumatoid, SLE, Wilson's, etc.) **TOPIC 15: Drugs & Eye Toxicity** (Chloroquine/hydroxychloroquine, amiodarone, steroids, ethambutol, etc.) Assign each of the 54 questions to the most appropriate topic, and reference all Q numbers in each topic. ## STEP 4: Write the Python/reportlab script Here is a template to follow for the PDF generation: ```python from reportlab.lib.pagesizes import A4 from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.lib.units import cm from reportlab.lib import colors from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, HRFlowable from reportlab.lib.enums import TA_LEFT, TA_CENTER doc = SimpleDocTemplate( '/home/daytona/workspace/Ophthalmology_Revision_Notes.pdf', pagesize=A4, rightMargin=1.5*cm, leftMargin=1.5*cm, topMargin=1.5*cm, bottomMargin=1.5*cm ) styles = getSampleStyleSheet() # Define custom styles - NO colors except black title_style = ParagraphStyle('title', fontSize=16, fontName='Helvetica-Bold', spaceAfter=4, spaceBefore=6, textColor=colors.black) topic_style = ParagraphStyle('topic', fontSize=13, fontName='Helvetica-Bold', spaceAfter=3, spaceBefore=8, textColor=colors.black) section_style = ParagraphStyle('section', fontSize=10, fontName='Helvetica-Bold', spaceAfter=2, spaceBefore=4, textColor=colors.black) body_style = ParagraphStyle('body', fontSize=8.5, fontName='Helvetica', spaceAfter=1, spaceBefore=1, textColor=colors.black, leading=11) bullet_style = ParagraphStyle('bullet', fontSize=8.5, fontName='Helvetica', spaceAfter=1, spaceBefore=0, leftIndent=12, textColor=colors.black, leading=11) merged_style = ParagraphStyle('merged', fontSize=8, fontName='Helvetica-Oblique', spaceAfter=2, spaceBefore=1, textColor=colors.black, leading=10) story = [] # ... build content doc.build(story) ``` Use `Paragraph("• bullet text", bullet_style)` for bullets. Use `HRFlowable(width="100%", thickness=0.5, color=colors.black)` as dividers between topics. Use `Spacer(1, 0.1*cm)` for minimal spacing only. For tables (like the MCQ mapping table at end), use: ```python data = [['MCQ Number', 'Topic/Section'], ['Q1', 'Topic 1: Episcleritis'], ...] t = Table(data, colWidths=[3*cm, 14*cm]) t.setStyle(TableStyle([ ('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'), ('FONTSIZE', (0,0), (-1,-1), 8), ('GRID', (0,0), (-1,-1), 0.3, colors.black), ('BACKGROUND', (0,0), (-1,0), colors.white), ('TEXTCOLOR', (0,0), (-1,-1), colors.black), ('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.white, colors.white]), ('TOPPADDING', (0,0), (-1,-1), 2), ('BOTTOMPADDING', (0,0), (-1,-1), 2), ])) ``` ## IMPORTANT CONTENT INSTRUCTIONS: - Every section must be data-rich and exam-focused - Include specific drug names and doses where relevant (e.g., prednisolone 40-60mg for GCA) - Include specific numerical values (e.g., IOP >21 mmHg for glaucoma, VA 6/60 etc.) - Keep bullets SHORT - max 10-12 words each - Include mnemonics where helpful - Make content based on what you actually read from the questions file ## EXECUTION: 1. Read the full questions file first 2. Write the complete Python script to /home/daytona/workspace/gen_ophthal_notes.py 3. Execute it with: python3 /home/daytona/workspace/gen_ophthal_notes.py 4. Verify the PDF was created 5. Return: confirmation that PDF was created at /home/daytona/workspace/Ophthalmology_Revision_Notes.pdf, along with a summary of all 54 Q numbers and which topic each was assigned to.