Make pdf of this photo of contents
mkdir -p /tmp/workspace/photos-pdf && cd /tmp/workspace/photos-pdf && curl -s -o img1.jpg "https://d361swluvexzqs.cloudfront.net/chats-attachments/1000101705-1784195013305-8zi50w.jpg" && curl -s -o img2.jpg "https://d361swluvexzqs.cloudfront.net/chats-attachments/1000101704-1784195014128-2mg57c.jpg" && curl -s -o img3.jpg "https://d361swluvexzqs.cloudfront.net/chats-attachments/1000101703-1784195014378-e6wc5s.jpg" && curl -s -o img4.jpg "https://d361swluvexzqs.cloudfront.net/chats-attachments/1000101702-1784195014794-3v5iou.jpg" && curl -s -o img5.jpg "https://d361swluvexzqs.cloudfront.net/chats-attachments/1000101701-1784195015043-1pa1cb.jpg" && curl -s -o img6.jpg "https://d361swluvexzqs.cloudfront.net/chats-attachments/1000101700-1784195015515-dk47f9.jpg" && ls -lh *.jpg
python3 << 'EOF' from PIL import Image from reportlab.lib.pagesizes import A4 from reportlab.pdfgen import canvas import io, os images = [f"/tmp/workspace/photos-pdf/img{i}.jpg" for i in range(1, 7)] output_path = "/tmp/workspace/photos-pdf/contents.pdf" c = canvas.Canvas(output_path, pagesize=A4) page_w, page_h = A4 for img_path in images: img = Image.open(img_path) img_w, img_h = img.size # Scale to fit A4 with small margins margin = 20 max_w = page_w - 2 * margin max_h = page_h - 2 * margin scale = min(max_w / img_w, max_h / img_h) draw_w = img_w * scale draw_h = img_h * scale x = (page_w - draw_w) / 2 y = (page_h - draw_h) / 2 c.drawImage(img_path, x, y, width=draw_w, height=draw_h) c.showPage() c.save() print(f"PDF created: {output_path}") print(f"Size: {os.path.getsize(output_path) / 1024:.1f} KB") EOF
contents
PDF Document · PDF
Create a study guide document from these exam topics
python3 << 'PYEOF' from reportlab.lib.pagesizes import A4 from reportlab.lib import colors from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.lib.units import cm from reportlab.platypus import (SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, HRFlowable, PageBreak) from reportlab.lib.enums import TA_CENTER, TA_LEFT from reportlab.pdfbase import pdfmetrics output = "/tmp/workspace/photos-pdf/MBBS_Study_Guide.pdf" doc = SimpleDocTemplate( output, pagesize=A4, leftMargin=2*cm, rightMargin=2*cm, topMargin=2.2*cm, bottomMargin=2.2*cm, title="MBBS Exam Study Guide", author="Exam Trends & Favorites" ) # ── Colours ────────────────────────────────────────────────────────────────── DARK_BG = colors.HexColor("#1E2A3A") PHYS_CLR = colors.HexColor("#1565C0") # blue ANAT_CLR = colors.HexColor("#2E7D32") # green BIOC_CLR = colors.HexColor("#6A1B9A") # purple GOLD = colors.HexColor("#F9A825") LIGHT_BLU = colors.HexColor("#E3F2FD") LIGHT_GRN = colors.HexColor("#E8F5E9") LIGHT_PUR = colors.HexColor("#F3E5F5") LIGHT_GRY = colors.HexColor("#F5F5F5") WHITE = colors.white TEXT = colors.HexColor("#212121") SUBTEXT = colors.HexColor("#424242") # ── Styles ──────────────────────────────────────────────────────────────────── styles = getSampleStyleSheet() def S(name, **kw): return ParagraphStyle(name, **kw) cover_title = S("CoverTitle", fontSize=28, leading=34, textColor=WHITE, alignment=TA_CENTER, fontName="Helvetica-Bold", spaceAfter=6) cover_sub = S("CoverSub", fontSize=14, leading=18, textColor=GOLD, alignment=TA_CENTER, fontName="Helvetica-Bold", spaceAfter=4) cover_info = S("CoverInfo", fontSize=11, leading=15, textColor=colors.HexColor("#CFD8DC"), alignment=TA_CENTER, fontName="Helvetica") subject_hdr = S("SubjectHdr", fontSize=18, leading=22, textColor=WHITE, fontName="Helvetica-Bold", spaceAfter=4, spaceBefore=8) section_hdr = S("SectionHdr", fontSize=12, leading=15, textColor=WHITE, fontName="Helvetica-Bold", spaceAfter=2, spaceBefore=6) item_style = S("Item", fontSize=10, leading=14, textColor=TEXT, fontName="Helvetica", leftIndent=12, spaceAfter=2) item_bold = S("ItemBold", fontSize=10, leading=14, textColor=TEXT, fontName="Helvetica-Bold", leftIndent=12, spaceAfter=2) note_style = S("Note", fontSize=9, leading=12, textColor=SUBTEXT, fontName="Helvetica-Oblique", leftIndent=24, spaceAfter=2) toc_hdr = S("TocHdr", fontSize=14, leading=18, textColor=DARK_BG, fontName="Helvetica-Bold", spaceBefore=4, spaceAfter=2) toc_item = S("TocItem", fontSize=11, leading=15, textColor=TEXT, fontName="Helvetica", leftIndent=10, spaceAfter=3) priority_no = S("PriorityNo", fontSize=10, leading=14, textColor=TEXT, fontName="Helvetica-Bold", leftIndent=8, spaceAfter=3) # ── Helper builders ─────────────────────────────────────────────────────────── def coloured_bar(text, bg, fg=WHITE, style=None): if style is None: style = section_hdr tbl = Table([[Paragraph(text, style)]], colWidths=[17*cm]) tbl.setStyle(TableStyle([ ("BACKGROUND", (0,0), (-1,-1), bg), ("TOPPADDING", (0,0), (-1,-1), 5), ("BOTTOMPADDING", (0,0), (-1,-1), 5), ("LEFTPADDING", (0,0), (-1,-1), 10), ("RIGHTPADDING", (0,0), (-1,-1), 8), ("ROUNDEDCORNERS", [4,4,4,4]), ])) return tbl def subject_banner(text, color): st = S("SubBan_"+text[:4], fontSize=18, leading=22, textColor=WHITE, fontName="Helvetica-Bold", spaceAfter=4, spaceBefore=8) tbl = Table([[Paragraph(text, st)]], colWidths=[17*cm]) tbl.setStyle(TableStyle([ ("BACKGROUND", (0,0), (-1,-1), color), ("TOPPADDING", (0,0), (-1,-1), 10), ("BOTTOMPADDING", (0,0), (-1,-1), 10), ("LEFTPADDING", (0,0), (-1,-1), 14), ("RIGHTPADDING", (0,0), (-1,-1), 8), ])) return tbl def numbered_items(items, bg_light, bullet_color, bold_prefix=False): rows = [] for i, (num, text) in enumerate(items): num_para = Paragraph(str(num), S(f"nb{i}", fontSize=10, leading=13, textColor=WHITE, fontName="Helvetica-Bold", alignment=TA_CENTER)) num_cell = Table([[num_para]], colWidths=[1*cm]) num_cell.setStyle(TableStyle([ ("BACKGROUND", (0,0), (-1,-1), bullet_color), ("TOPPADDING", (0,0), (-1,-1), 3), ("BOTTOMPADDING", (0,0), (-1,-1), 3), ("LEFTPADDING", (0,0), (-1,-1), 2), ("RIGHTPADDING", (0,0), (-1,-1), 2), ])) txt_para = Paragraph(text, S(f"it{i}", fontSize=10, leading=13, textColor=TEXT, fontName="Helvetica")) row = Table([[num_cell, txt_para]], colWidths=[1.1*cm, 15.5*cm]) row.setStyle(TableStyle([ ("BACKGROUND", (0,0), (-1,-1), bg_light if i%2==0 else WHITE), ("TOPPADDING", (0,0), (-1,-1), 4), ("BOTTOMPADDING", (0,0), (-1,-1), 4), ("LEFTPADDING", (0,0), (-1,-1), 4), ("RIGHTPADDING", (0,0), (-1,-1), 4), ("VALIGN", (0,0), (-1,-1), "MIDDLE"), ])) rows.append(row) rows.append(Spacer(1, 1)) return rows def priority_grid(items, cols=2): """Lay items in a grid table""" cell_w = 8.3*cm rows_data = [] row = [] for i, (num, text) in enumerate(items): cell_p = Paragraph(f"<b>{num}.</b> {text}", S(f"pg{i}", fontSize=9, leading=13, textColor=TEXT, fontName="Helvetica")) cell_t = Table([[cell_p]], colWidths=[cell_w]) cell_t.setStyle(TableStyle([ ("BACKGROUND", (0,0), (-1,-1), LIGHT_GRY if (i//cols)%2==0 else WHITE), ("TOPPADDING", (0,0), (-1,-1), 5), ("BOTTOMPADDING", (0,0), (-1,-1), 5), ("LEFTPADDING", (0,0), (-1,-1), 7), ("RIGHTPADDING", (0,0), (-1,-1), 5), ("BOX", (0,0), (-1,-1), 0.5, colors.HexColor("#E0E0E0")), ])) row.append(cell_t) if len(row) == cols: rows_data.append(row) row = [] if row: while len(row) < cols: row.append(Paragraph("", styles["Normal"])) rows_data.append(row) tbl = Table(rows_data, colWidths=[cell_w]*cols, hAlign="LEFT") tbl.setStyle(TableStyle([ ("VALIGN", (0,0), (-1,-1), "TOP"), ("LEFTPADDING", (0,0), (-1,-1), 0), ("RIGHTPADDING", (0,0), (-1,-1), 3), ("TOPPADDING", (0,0), (-1,-1), 0), ("BOTTOMPADDING",(0,0), (-1,-1), 3), ])) return tbl def sp(h=6): return Spacer(1, h) # ══════════════════════════════════════════════════════════════════════════════ # BUILD STORY # ══════════════════════════════════════════════════════════════════════════════ story = [] # ─── COVER PAGE ─────────────────────────────────────────────────────────────── cover_tbl = Table([[""]], colWidths=[17*cm], rowHeights=[26*cm]) cover_tbl.setStyle(TableStyle([ ("BACKGROUND", (0,0), (-1,-1), DARK_BG), ])) story.append(cover_tbl) # Draw cover content on top using absolute positioning via a nested table cover_inner = [ sp(50), Paragraph("MBBS EXAM", cover_title), Paragraph("STUDY GUIDE", S("CT2", fontSize=34, leading=40, textColor=GOLD, alignment=TA_CENTER, fontName="Helvetica-Bold")), sp(12), HRFlowable(width="60%", thickness=1.5, color=GOLD, hAlign="CENTER"), sp(12), Paragraph("Identified Exam Trends & Favorites", cover_sub), sp(8), Paragraph("Physiology • Anatomy • Biochemistry", cover_info), sp(6), Paragraph("All Subjects · Topic Lists · Quick Revision", cover_info), sp(20), Paragraph("MBBS First Year", S("ci2", fontSize=11, leading=14, textColor=colors.HexColor("#B0BEC5"), alignment=TA_CENTER, fontName="Helvetica-Oblique")), ] # Re-do cover as a big dark table holding inner content cover_bg = Table([[""]], colWidths=[17*cm], rowHeights=[3*cm]) cover_bg.setStyle(TableStyle([("BACKGROUND",(0,0),(-1,-1), DARK_BG)])) story = [] # reset # Use a single large table for the cover background from reportlab.platypus import KeepInFrame cover_content = [ sp(40), Paragraph("MBBS EXAM", S("c1", fontSize=30, leading=36, textColor=WHITE, alignment=TA_CENTER, fontName="Helvetica-Bold")), Paragraph("STUDY GUIDE", S("c2", fontSize=36, leading=42, textColor=GOLD, alignment=TA_CENTER, fontName="Helvetica-Bold")), sp(14), HRFlowable(width="55%", thickness=2, color=GOLD, hAlign="CENTER"), sp(14), Paragraph("Identified Exam Trends & Favorites", S("c3", fontSize=14, leading=18, textColor=GOLD, alignment=TA_CENTER, fontName="Helvetica-Bold")), sp(10), Paragraph("PHYSIOLOGY · ANATOMY · BIOCHEMISTRY", S("c4", fontSize=12, leading=15, textColor=colors.HexColor("#CFD8DC"), alignment=TA_CENTER, fontName="Helvetica-Bold")), sp(6), Paragraph("Most Repeated Topics · Diagrams · Clinical Conditions · Quick Revision", S("c5", fontSize=10, leading=13, textColor=colors.HexColor("#90A4AE"), alignment=TA_CENTER, fontName="Helvetica")), sp(30), Paragraph("MBBS First Year | Exam-Oriented", S("c6", fontSize=10, leading=13, textColor=colors.HexColor("#78909C"), alignment=TA_CENTER, fontName="Helvetica-Oblique")), ] kif = KeepInFrame(17*cm, 25*cm, cover_content, hAlign="CENTER") cover_table = Table([[kif]], colWidths=[17*cm], rowHeights=[25*cm]) cover_table.setStyle(TableStyle([ ("BACKGROUND", (0,0), (-1,-1), DARK_BG), ("TOPPADDING", (0,0), (-1,-1), 0), ("BOTTOMPADDING", (0,0), (-1,-1), 0), ("LEFTPADDING", (0,0), (-1,-1), 0), ("RIGHTPADDING", (0,0), (-1,-1), 0), ])) story.append(cover_table) story.append(PageBreak()) # ─── TABLE OF CONTENTS ──────────────────────────────────────────────────────── story.append(Paragraph("Table of Contents", S("toch", fontSize=20, leading=24, textColor=DARK_BG, fontName="Helvetica-Bold", spaceAfter=8))) story.append(HRFlowable(width="100%", thickness=1.5, color=DARK_BG)) story.append(sp(8)) toc_entries = [ ("1", "PHYSIOLOGY", PHYS_CLR), ("", " · Most Repeated Long Note Topics (5)", colors.HexColor("#555")), ("", " · Most Repeated Short Note Topics (6)", colors.HexColor("#555")), ("", " · Frequently Asked Diagrams (4)", colors.HexColor("#555")), ("", " · Frequently Repeated Clinical Conditions (6)", colors.HexColor("#555")), ("2", "ANATOMY", ANAT_CLR), ("", " · Most Repeated Long Note Topics (6)", colors.HexColor("#555")), ("", " · Most Repeated Short Note Topics (6)", colors.HexColor("#555")), ("", " · Frequently Asked Diagrams (4)", colors.HexColor("#555")), ("", " · Frequently Repeated Clinical Conditions (6)", colors.HexColor("#555")), ("", " · Top 20 Most Important Topics", colors.HexColor("#555")), ("3", "BIOCHEMISTRY", BIOC_CLR), ("", " · Most Repeated Long Note Topics (5)", colors.HexColor("#555")), ("", " · Most Repeated Short Note Topics (7)", colors.HexColor("#555")), ("", " · Frequently Asked Diagrams (5)", colors.HexColor("#555")), ("", " · Frequently Repeated Clinical Conditions (6)", colors.HexColor("#555")), ("", " · Top 20 Most Important Topics", colors.HexColor("#555")), ] for num, label, clr in toc_entries: fs = 13 if num else 11 fn = "Helvetica-Bold" if num else "Helvetica" story.append(Paragraph( f"{'<b>' if num else ''}{(num+'. ') if num else ''}{label}{'</b>' if num else ''}", S(f"toc_{label[:4]}", fontSize=fs, leading=fs+4, textColor=clr, fontName=fn, spaceAfter=3, leftIndent=0 if num else 20))) story.append(PageBreak()) # ══════════════════════════════════════════════════════════════════════════════ # 1. PHYSIOLOGY # ══════════════════════════════════════════════════════════════════════════════ story.append(subject_banner("1. PHYSIOLOGY", PHYS_CLR)) story.append(sp(10)) # Long note story.append(coloured_bar("📋 Most Repeated Long Note Topics (10–20 Marks)", PHYS_CLR)) story.append(sp(4)) long_phys = [ (1, "Blood Pressure Regulation & Shock"), (2, "Cardiac Output (Fick's principle & Determinants)"), (3, "Pyramidal Tracts (Origin, course, lesions)"), (4, "Menstrual Cycle & Endometrial changes"), (5, "Hypoxia (Classification & physiological basis)"), ] for row in numbered_items(long_phys, LIGHT_BLU, PHYS_CLR): story.append(row) story.append(sp(10)) # Short note story.append(coloured_bar("📝 Most Repeated Short Note Topics (5 Marks)", colors.HexColor("#1976D2"))) story.append(sp(4)) short_phys = [ (1, "Neuromuscular Junction / Myasthenia Gravis"), (2, "Surfactant & Respiratory Distress Syndrome"), (3, "Organ of Corti / Mechanism of hearing"), (4, "Visual Pathway & Lesions"), (5, "Functions of Basal Ganglia / Parkinsonism"), (6, "Gastric HCl Secretion"), ] for row in numbered_items(short_phys, LIGHT_BLU, colors.HexColor("#1976D2")): story.append(row) story.append(sp(10)) # Diagrams story.append(coloured_bar("✏️ Frequently Asked Diagrams (Draw & Label)", colors.HexColor("#0D47A1"))) story.append(sp(4)) diag_phys = [ (1, "Oxygen-Hemoglobin Dissociation Curve"), (2, "Visual Pathway and sites of lesions"), (3, "Counter-current Multiplier System"), (4, "ECG normal trace and intervals"), ] for row in numbered_items(diag_phys, LIGHT_BLU, colors.HexColor("#0D47A1")): story.append(row) story.append(sp(10)) # Clinical story.append(coloured_bar("🩺 Frequently Repeated Clinical Conditions (Applied / "What will happen and why")", colors.HexColor("#0288D1"))) story.append(sp(4)) clin_phys = [ (1, "Parkinsonism (Basal ganglia lesion)"), (2, "Myasthenia Gravis"), (3, "Mismatched Blood Transfusion reactions"), (4, "Peptic Ulcer"), (5, "Jaundice (Physiological vs Pathological vs Hemolytic)"), (6, "Acromegaly & Dwarfism"), ] for row in numbered_items(clin_phys, LIGHT_BLU, colors.HexColor("#0288D1")): story.append(row) story.append(PageBreak()) # ══════════════════════════════════════════════════════════════════════════════ # 2. ANATOMY # ══════════════════════════════════════════════════════════════════════════════ story.append(subject_banner("2. ANATOMY", ANAT_CLR)) story.append(sp(10)) story.append(coloured_bar("📋 Most Repeated Long Note Topics (10–20 Marks)", ANAT_CLR)) story.append(sp(4)) long_anat = [ (1, "Thyroid Gland (Gross anatomy, relations, blood supply)"), (2, "Internal Capsule (Parts, fibers, arterial supply)"), (3, "Uterus (Supports, relations, applied)"), (4, "Knee Joint (Ligaments, locking/unlocking)"), (5, "Kidney (Relations, coverings)"), (6, "Stomach (Blood supply, relations/bed)"), ] for row in numbered_items(long_anat, LIGHT_GRN, ANAT_CLR): story.append(row) story.append(sp(10)) story.append(coloured_bar("📝 Most Repeated Short Note Topics (5 Marks)", colors.HexColor("#388E3C"))) story.append(sp(4)) short_anat = [ (1, "Portocaval Anastomosis / Portal Hypertension"), (2, "Lateral Medullary Syndrome (Wallenberg)"), (3, "Carpal Tunnel Syndrome"), (4, "Bronchopulmonary Segments"), (5, "Circle of Willis"), (6, "Cavernous Sinus"), ] for row in numbered_items(short_anat, LIGHT_GRN, colors.HexColor("#388E3C")): story.append(row) story.append(sp(10)) story.append(coloured_bar("✏️ Frequently Asked Diagrams (Draw & Label)", colors.HexColor("#1B5E20"))) story.append(sp(4)) diag_anat = [ (1, "Transverse section of Medulla Oblongata / Midbrain"), (2, "Brachial Plexus formation and branches"), (3, "Relations of posterior aspect of both kidneys"), (4, "Blood supply of the superolateral surface of the cerebrum"), ] for row in numbered_items(diag_anat, LIGHT_GRN, colors.HexColor("#1B5E20")): story.append(row) story.append(sp(10)) story.append(coloured_bar("🩺 Frequently Repeated Clinical Conditions (Explain Why)", colors.HexColor("#0097A7"))) story.append(sp(4)) clin_anat = [ (1, "<b>Erb's / Klumpke's Palsy:</b> Fall on shoulder or pulling infant's arm."), (2, "<b>Wrist Drop:</b> Injury to radial nerve (spiral groove/crutch paralysis)."), (3, "<b>Frey's Syndrome:</b> Sweating while eating post-parotid surgery."), (4, "<b>Horner's Syndrome:</b> Ptosis, miosis, anhydrosis."), (5, "<b>Black Eye:</b> Path of blood from scalp injury."), (6, "<b>Referred Pain:</b> Gallbladder pain to right scapula; Appendicitis to umbilicus."), ] for row in numbered_items(clin_anat, LIGHT_GRN, colors.HexColor("#0097A7")): story.append(row) story.append(sp(14)) story.append(coloured_bar("⭐ Top 20 Most Important Topics — Quick Revision List", DARK_BG)) story.append(sp(4)) story.append(Paragraph( "<i>High-priority checklist based strictly on exam repetition frequency.</i>", S("note2", fontSize=9, leading=12, textColor=SUBTEXT, fontName="Helvetica-Oblique", spaceAfter=6))) top20_anat = [ (1, "Thyroid Gland (Anatomy & Clinicals)"), (2, "Internal Capsule (Fibers & Blood Supply)"), (3, "Brachial Plexus (Formation & Nerve Injuries)"), (4, "Uterus (Supports & Prolapse)"), (5, "Knee Joint (Ligaments & Locking mechanism)"), (6, "Stomach (Stomach bed, Blood Supply & Lymphatics)"), (7, "Portocaval Anastomoses (Sites & Clinical significance)"), (8, "Coronary Circulation (Arterial supply of the heart)"), (9, "Inguinal Canal (Boundaries & Hernia differentiation)"), (10, "Kidney (Posterior relations & Coverings)"), (11, "Anal Canal (Internal features & Ischiorectal fossa)"), (12, "Radial Nerve (Course & Wrist Drop)"), (13, "Mammary Gland (Lymphatic drainage & Cancer spread)"), (14, "Carpal Tunnel Syndrome (Median nerve)"), (15, "Parotid Gland (Relations & Frey's syndrome)"), (16, "Tongue (Nerve supply & Development)"), (17, "Cavernous Sinus (Boundaries & Tributaries)"), (18, "Mediastinum (Divisions & Contents)"), (19, "Coronary Circulation (Vessels & Dominance)"), (20, "Inguinal Canal (Walls, Rings, Hernia types)"), ] story.append(priority_grid(top20_anat, cols=2)) story.append(PageBreak()) # ══════════════════════════════════════════════════════════════════════════════ # 3. BIOCHEMISTRY # ══════════════════════════════════════════════════════════════════════════════ story.append(subject_banner("3. BIOCHEMISTRY", BIOC_CLR)) story.append(sp(10)) story.append(coloured_bar("📋 Most Repeated Long Note Topics (10–20 Marks)", BIOC_CLR)) story.append(sp(4)) long_bioc = [ (1, "Transcription & Post-transcriptional modifications"), (2, "Beta-oxidation of Fatty Acids / Ketogenesis"), (3, "Blood glucose regulation & Diabetes Mellitus"), (4, "Urea Cycle"), (5, "Translation in eukaryotes"), ] for row in numbered_items(long_bioc, LIGHT_PUR, BIOC_CLR): story.append(row) story.append(sp(10)) story.append(coloured_bar("📝 Most Repeated Short Note Topics (4–5 Marks)", colors.HexColor("#7B1FA2"))) story.append(sp(4)) short_bioc = [ (1, "PCR and Recombinant DNA Technology"), (2, "Immunoglobulin structure and functions"), (3, "Competitive inhibition (with examples like Methotrexate)"), (4, "Diagnostic significance of Isoenzymes"), (5, "Vitamin D & C (functions and clinical correlations)"), (6, "Detoxification / Xenobiotic metabolism"), (7, "Tumor Markers"), ] for row in numbered_items(short_bioc, LIGHT_PUR, colors.HexColor("#7B1FA2")): story.append(row) story.append(sp(10)) story.append(coloured_bar("✏️ Frequently Asked Diagrams / Illustrations", colors.HexColor("#4A148C"))) story.append(sp(4)) diag_bioc = [ (1, "Structure of Immunoglobulin (IgG)"), (2, "Operon Concept (Lac Operon)"), (3, "Recombinant DNA / Vectors mapping"), (4, "tRNA structure / Transcription fork"), (5, "Internal Capsule fibers (Anatomy)"), ] for row in numbered_items(diag_bioc, LIGHT_PUR, colors.HexColor("#4A148C")): story.append(row) story.append(sp(10)) story.append(coloured_bar("🩺 Frequently Repeated Clinical Conditions / Cases", colors.HexColor("#880E4F"))) story.append(sp(4)) clin_bioc = [ (1, "<b>Jaundice</b> — Differential diagnosis via LFTs, urine/stool bile markers"), (2, "<b>Diabetes Mellitus & Diabetic Ketoacidosis</b> — Blood gases, HbA1c"), (3, "<b>Gout / Lesch-Nyhan Syndrome</b> — Uric acid levels, purine salvage defect"), (4, "<b>Protein-Energy Malnutrition</b> — Kwashiorkor vs Marasmus differentiation"), (5, "<b>Myocardial Infarction</b> — Cardiac isoenzymes like CK-MB, Troponin"), (6, "<b>Phenylketonuria (PKU)</b> — Enzyme defect, clinical features"), ] for row in numbered_items(clin_bioc, LIGHT_PUR, colors.HexColor("#880E4F")): story.append(row) story.append(sp(14)) story.append(coloured_bar("⭐ Top 20 Most Important Topics — Quick Revision (MBBS Exam-Oriented)", DARK_BG)) story.append(sp(4)) story.append(Paragraph( "<i>High-priority checklist based strictly on exam repetition frequency.</i>", S("note3", fontSize=9, leading=12, textColor=SUBTEXT, fontName="Helvetica-Oblique", spaceAfter=6))) top20_bioc = [ (1, "Liver Function Tests & Differential Diagnosis of Jaundice"), (2, "Diabetes Mellitus, Ketoacidosis & HbA1c"), (3, "Polymerase Chain Reaction (PCR) & Recombinant DNA Tech"), (4, "Transcription process & Post-transcriptional modifications"), (5, "Immunoglobulins (Structure, Classes, Functions)"), (6, "Ketogenesis, Ketolysis & Starvation metabolism"), (7, "Diagnostic Isoenzymes (Cardiac & Hepatic markers)"), (8, "Competitive Enzyme Inhibition & Clinical examples (Methotrexate)"), (9, "Vitamin D (Hormonal action, Synthesis, Rickets/Osteomalacia)"), (10, "Vitamin C (Collagen synthesis, Scurvy, Antioxidant role)"), (11, "Urea Cycle & Ammonia Toxicity mechanism"), (12, "Acid-Base Balance, Metabolic Acidosis/Alkalosis & Buffers"), (13, "Tumor Markers & Oncogenes"), (14, "Renal Clearance Tests (Creatinine vs. Urea)"), (15, "Lipoprotein Metabolism (HDL cycle & Reverse cholesterol transport)"), (16, "Genetic Code features & Mutations"), (17, "Phenylketonuria (PKU) & Tyrosine metabolism"), (18, "Detoxification (Phase I and Phase II reactions)"), (19, "Gout & Purine degradation pathway"), (20, "AETCOM Modules (Medical ethics, breaking bad news, lifelong learning, cadaver respect)"), ] story.append(priority_grid(top20_bioc, cols=2)) # ─── BUILD ──────────────────────────────────────────────────────────────────── doc.build(story) import os size = os.path.getsize(output) print(f"Done. File: {output} | Size: {size/1024:.1f} KB") PYEOF
python3 << 'PYEOF' from reportlab.lib.pagesizes import A4 from reportlab.lib import colors from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.lib.units import cm from reportlab.platypus import (SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, HRFlowable, PageBreak, KeepInFrame) from reportlab.lib.enums import TA_CENTER, TA_LEFT output = "/tmp/workspace/photos-pdf/MBBS_Study_Guide.pdf" doc = SimpleDocTemplate( output, pagesize=A4, leftMargin=2*cm, rightMargin=2*cm, topMargin=2.2*cm, bottomMargin=2.2*cm, title="MBBS Exam Study Guide", ) DARK_BG = colors.HexColor("#1E2A3A") PHYS_CLR = colors.HexColor("#1565C0") ANAT_CLR = colors.HexColor("#2E7D32") BIOC_CLR = colors.HexColor("#6A1B9A") GOLD = colors.HexColor("#F9A825") LIGHT_BLU = colors.HexColor("#E3F2FD") LIGHT_GRN = colors.HexColor("#E8F5E9") LIGHT_PUR = colors.HexColor("#F3E5F5") LIGHT_GRY = colors.HexColor("#F5F5F5") WHITE = colors.white TEXT = colors.HexColor("#212121") SUBTEXT = colors.HexColor("#424242") styles = getSampleStyleSheet() def S(name, **kw): return ParagraphStyle(name, **kw) def coloured_bar(text, bg): st = S("cb_"+text[:6], fontSize=11, leading=14, textColor=WHITE, fontName="Helvetica-Bold") tbl = Table([[Paragraph(text, st)]], colWidths=[17*cm]) tbl.setStyle(TableStyle([ ("BACKGROUND", (0,0), (-1,-1), bg), ("TOPPADDING", (0,0), (-1,-1), 6), ("BOTTOMPADDING", (0,0), (-1,-1), 6), ("LEFTPADDING", (0,0), (-1,-1), 10), ("RIGHTPADDING", (0,0), (-1,-1), 8), ])) return tbl def subject_banner(text, color): st = S("sb_"+text[:4], fontSize=18, leading=22, textColor=WHITE, fontName="Helvetica-Bold") tbl = Table([[Paragraph(text, st)]], colWidths=[17*cm]) tbl.setStyle(TableStyle([ ("BACKGROUND", (0,0), (-1,-1), color), ("TOPPADDING", (0,0), (-1,-1), 10), ("BOTTOMPADDING", (0,0), (-1,-1), 10), ("LEFTPADDING", (0,0), (-1,-1), 14), ("RIGHTPADDING", (0,0), (-1,-1), 8), ])) return tbl def numbered_items(items, bg_light, bullet_color): rows = [] for i, (num, text) in enumerate(items): num_p = Paragraph(str(num), S(f"nb{i}{num}", fontSize=10, leading=13, textColor=WHITE, fontName="Helvetica-Bold", alignment=TA_CENTER)) num_cell = Table([[num_p]], colWidths=[1*cm]) num_cell.setStyle(TableStyle([ ("BACKGROUND", (0,0),(-1,-1), bullet_color), ("TOPPADDING", (0,0),(-1,-1), 3), ("BOTTOMPADDING", (0,0),(-1,-1), 3), ("LEFTPADDING", (0,0),(-1,-1), 2), ("RIGHTPADDING", (0,0),(-1,-1), 2), ])) txt_p = Paragraph(text, S(f"it{i}{num}", fontSize=10, leading=13, textColor=TEXT, fontName="Helvetica")) row = Table([[num_cell, txt_p]], colWidths=[1.1*cm, 15.5*cm]) row.setStyle(TableStyle([ ("BACKGROUND", (0,0),(-1,-1), bg_light if i%2==0 else WHITE), ("TOPPADDING", (0,0),(-1,-1), 4), ("BOTTOMPADDING", (0,0),(-1,-1), 4), ("LEFTPADDING", (0,0),(-1,-1), 4), ("RIGHTPADDING", (0,0),(-1,-1), 4), ("VALIGN", (0,0),(-1,-1), "MIDDLE"), ])) rows.append(row) rows.append(Spacer(1, 1)) return rows def priority_grid(items, cols=2): cell_w = 8.3*cm rows_data = [] row = [] for i, (num, text) in enumerate(items): cell_p = Paragraph("<b>%s.</b> %s" % (num, text), S("pg%s"%i, fontSize=9, leading=13, textColor=TEXT, fontName="Helvetica")) cell_t = Table([[cell_p]], colWidths=[cell_w]) cell_t.setStyle(TableStyle([ ("BACKGROUND", (0,0),(-1,-1), LIGHT_GRY if (i//cols)%2==0 else WHITE), ("TOPPADDING", (0,0),(-1,-1), 5), ("BOTTOMPADDING", (0,0),(-1,-1), 5), ("LEFTPADDING", (0,0),(-1,-1), 7), ("RIGHTPADDING", (0,0),(-1,-1), 5), ("BOX", (0,0),(-1,-1), 0.5, colors.HexColor("#E0E0E0")), ])) row.append(cell_t) if len(row) == cols: rows_data.append(row) row = [] if row: while len(row) < cols: row.append(Paragraph("", styles["Normal"])) rows_data.append(row) tbl = Table(rows_data, colWidths=[cell_w]*cols, hAlign="LEFT") tbl.setStyle(TableStyle([ ("VALIGN", (0,0),(-1,-1), "TOP"), ("LEFTPADDING", (0,0),(-1,-1), 0), ("RIGHTPADDING", (0,0),(-1,-1), 3), ("TOPPADDING", (0,0),(-1,-1), 0), ("BOTTOMPADDING",(0,0),(-1,-1), 3), ])) return tbl def sp(h=6): return Spacer(1, h) story = [] # ── COVER ────────────────────────────────────────────────────────────────── cover_content = [ sp(40), Paragraph("MBBS EXAM", S("c1", fontSize=30, leading=36, textColor=WHITE, alignment=TA_CENTER, fontName="Helvetica-Bold")), Paragraph("STUDY GUIDE", S("c2", fontSize=36, leading=42, textColor=GOLD, alignment=TA_CENTER, fontName="Helvetica-Bold")), sp(14), HRFlowable(width="55%", thickness=2, color=GOLD, hAlign="CENTER"), sp(14), Paragraph("Identified Exam Trends & Favorites", S("c3", fontSize=14, leading=18, textColor=GOLD, alignment=TA_CENTER, fontName="Helvetica-Bold")), sp(10), Paragraph("PHYSIOLOGY | ANATOMY | BIOCHEMISTRY", S("c4", fontSize=12, leading=15, textColor=colors.HexColor("#CFD8DC"), alignment=TA_CENTER, fontName="Helvetica-Bold")), sp(6), Paragraph("Most Repeated Topics | Diagrams | Clinical Conditions | Quick Revision", S("c5", fontSize=10, leading=13, textColor=colors.HexColor("#90A4AE"), alignment=TA_CENTER, fontName="Helvetica")), sp(30), Paragraph("MBBS First Year | Exam-Oriented", S("c6", fontSize=10, leading=13, textColor=colors.HexColor("#78909C"), alignment=TA_CENTER, fontName="Helvetica-Oblique")), ] kif = KeepInFrame(17*cm, 25*cm, cover_content, hAlign="CENTER") cover_table = Table([[kif]], colWidths=[17*cm], rowHeights=[25*cm]) cover_table.setStyle(TableStyle([ ("BACKGROUND", (0,0),(-1,-1), DARK_BG), ("TOPPADDING", (0,0),(-1,-1), 0), ("BOTTOMPADDING", (0,0),(-1,-1), 0), ("LEFTPADDING", (0,0),(-1,-1), 0), ("RIGHTPADDING", (0,0),(-1,-1), 0), ])) story.append(cover_table) story.append(PageBreak()) # ── TABLE OF CONTENTS ────────────────────────────────────────────────────── story.append(Paragraph("Table of Contents", S("toch", fontSize=20, leading=24, textColor=DARK_BG, fontName="Helvetica-Bold", spaceAfter=8))) story.append(HRFlowable(width="100%", thickness=1.5, color=DARK_BG)) story.append(sp(8)) toc_entries = [ ("1", "PHYSIOLOGY", PHYS_CLR, False), ("", "Most Repeated Long Note Topics (5 topics)", colors.HexColor("#555"), True), ("", "Most Repeated Short Note Topics (6 topics)", colors.HexColor("#555"), True), ("", "Frequently Asked Diagrams (4 diagrams)", colors.HexColor("#555"), True), ("", "Frequently Repeated Clinical Conditions (6 conditions)", colors.HexColor("#555"), True), ("2", "ANATOMY", ANAT_CLR, False), ("", "Most Repeated Long Note Topics (6 topics)", colors.HexColor("#555"), True), ("", "Most Repeated Short Note Topics (6 topics)", colors.HexColor("#555"), True), ("", "Frequently Asked Diagrams (4 diagrams)", colors.HexColor("#555"), True), ("", "Frequently Repeated Clinical Conditions (6 conditions)", colors.HexColor("#555"), True), ("", "Top 20 Most Important Topics - Quick Revision", colors.HexColor("#555"), True), ("3", "BIOCHEMISTRY", BIOC_CLR, False), ("", "Most Repeated Long Note Topics (5 topics)", colors.HexColor("#555"), True), ("", "Most Repeated Short Note Topics (7 topics)", colors.HexColor("#555"), True), ("", "Frequently Asked Diagrams (5 diagrams)", colors.HexColor("#555"), True), ("", "Frequently Repeated Clinical Conditions / Cases (6 cases)", colors.HexColor("#555"), True), ("", "Top 20 Most Important Topics - Quick Revision", colors.HexColor("#555"), True), ] for num, label, clr, indent in toc_entries: fs = 13 if num else 11 fn = "Helvetica-Bold" if num else "Helvetica" prefix = (num + ". ") if num else " " story.append(Paragraph( ("<b>" if num else "") + prefix + label + ("</b>" if num else ""), S("toc_"+label[:5]+str(indent), fontSize=fs, leading=fs+5, textColor=clr, fontName=fn, spaceAfter=3, leftIndent=0 if num else 20))) story.append(PageBreak()) # ══════════════════════════════════════════════════════════════════════════════ # 1. PHYSIOLOGY # ══════════════════════════════════════════════════════════════════════════════ story.append(subject_banner("1. PHYSIOLOGY", PHYS_CLR)) story.append(sp(10)) story.append(coloured_bar("Most Repeated Long Note Topics (10-20 Marks)", PHYS_CLR)) story.append(sp(4)) for row in numbered_items([ (1, "Blood Pressure Regulation & Shock"), (2, "Cardiac Output (Fick's principle & Determinants)"), (3, "Pyramidal Tracts (Origin, course, lesions)"), (4, "Menstrual Cycle & Endometrial changes"), (5, "Hypoxia (Classification & physiological basis)"), ], LIGHT_BLU, PHYS_CLR): story.append(row) story.append(sp(10)) story.append(coloured_bar("Most Repeated Short Note Topics (5 Marks)", colors.HexColor("#1976D2"))) story.append(sp(4)) for row in numbered_items([ (1, "Neuromuscular Junction / Myasthenia Gravis"), (2, "Surfactant & Respiratory Distress Syndrome"), (3, "Organ of Corti / Mechanism of hearing"), (4, "Visual Pathway & Lesions"), (5, "Functions of Basal Ganglia / Parkinsonism"), (6, "Gastric HCl Secretion"), ], LIGHT_BLU, colors.HexColor("#1976D2")): story.append(row) story.append(sp(10)) story.append(coloured_bar("Frequently Asked Diagrams (Draw & Label)", colors.HexColor("#0D47A1"))) story.append(sp(4)) for row in numbered_items([ (1, "Oxygen-Hemoglobin Dissociation Curve"), (2, "Visual Pathway and sites of lesions"), (3, "Counter-current Multiplier System"), (4, "ECG normal trace and intervals"), ], LIGHT_BLU, colors.HexColor("#0D47A1")): story.append(row) story.append(sp(10)) story.append(coloured_bar('Frequently Repeated Clinical Conditions (Applied / "What will happen and why")', colors.HexColor("#0288D1"))) story.append(sp(4)) for row in numbered_items([ (1, "Parkinsonism (Basal ganglia lesion)"), (2, "Myasthenia Gravis"), (3, "Mismatched Blood Transfusion reactions"), (4, "Peptic Ulcer"), (5, "Jaundice (Physiological vs Pathological vs Hemolytic)"), (6, "Acromegaly & Dwarfism"), ], LIGHT_BLU, colors.HexColor("#0288D1")): story.append(row) story.append(PageBreak()) # ══════════════════════════════════════════════════════════════════════════════ # 2. ANATOMY # ══════════════════════════════════════════════════════════════════════════════ story.append(subject_banner("2. ANATOMY", ANAT_CLR)) story.append(sp(10)) story.append(coloured_bar("Most Repeated Long Note Topics (10-20 Marks)", ANAT_CLR)) story.append(sp(4)) for row in numbered_items([ (1, "Thyroid Gland (Gross anatomy, relations, blood supply)"), (2, "Internal Capsule (Parts, fibers, arterial supply)"), (3, "Uterus (Supports, relations, applied)"), (4, "Knee Joint (Ligaments, locking/unlocking)"), (5, "Kidney (Relations, coverings)"), (6, "Stomach (Blood supply, relations/bed)"), ], LIGHT_GRN, ANAT_CLR): story.append(row) story.append(sp(10)) story.append(coloured_bar("Most Repeated Short Note Topics (5 Marks)", colors.HexColor("#388E3C"))) story.append(sp(4)) for row in numbered_items([ (1, "Portocaval Anastomosis / Portal Hypertension"), (2, "Lateral Medullary Syndrome (Wallenberg)"), (3, "Carpal Tunnel Syndrome"), (4, "Bronchopulmonary Segments"), (5, "Circle of Willis"), (6, "Cavernous Sinus"), ], LIGHT_GRN, colors.HexColor("#388E3C")): story.append(row) story.append(sp(10)) story.append(coloured_bar("Frequently Asked Diagrams (Draw & Label)", colors.HexColor("#1B5E20"))) story.append(sp(4)) for row in numbered_items([ (1, "Transverse section of Medulla Oblongata / Midbrain"), (2, "Brachial Plexus formation and branches"), (3, "Relations of posterior aspect of both kidneys"), (4, "Blood supply of the superolateral surface of the cerebrum"), ], LIGHT_GRN, colors.HexColor("#1B5E20")): story.append(row) story.append(sp(10)) story.append(coloured_bar("Frequently Repeated Clinical Conditions (Explain Why)", colors.HexColor("#0097A7"))) story.append(sp(4)) for row in numbered_items([ (1, "<b>Erb's / Klumpke's Palsy:</b> Fall on shoulder or pulling infant's arm."), (2, "<b>Wrist Drop:</b> Injury to radial nerve (spiral groove/crutch paralysis)."), (3, "<b>Frey's Syndrome:</b> Sweating while eating post-parotid surgery."), (4, "<b>Horner's Syndrome:</b> Ptosis, miosis, anhydrosis."), (5, "<b>Black Eye:</b> Path of blood from scalp injury."), (6, "<b>Referred Pain:</b> Gallbladder pain to right scapula; Appendicitis to umbilicus."), ], LIGHT_GRN, colors.HexColor("#0097A7")): story.append(row) story.append(sp(14)) story.append(coloured_bar("Top 20 Most Important Topics - Quick Revision List", DARK_BG)) story.append(sp(4)) story.append(Paragraph( "<i>High-priority checklist based strictly on exam repetition frequency.</i>", S("note2", fontSize=9, leading=12, textColor=SUBTEXT, fontName="Helvetica-Oblique", spaceAfter=6))) story.append(priority_grid([ (1, "Thyroid Gland (Anatomy & Clinicals)"), (2, "Internal Capsule (Fibers & Blood Supply)"), (3, "Brachial Plexus (Formation & Nerve Injuries)"), (4, "Uterus (Supports & Prolapse)"), (5, "Knee Joint (Ligaments & Locking mechanism)"), (6, "Stomach (Stomach bed, Blood Supply & Lymphatics)"), (7, "Portocaval Anastomoses (Sites & Clinical significance)"), (8, "Coronary Circulation (Arterial supply of the heart)"), (9, "Inguinal Canal (Boundaries & Hernia differentiation)"), (10, "Kidney (Posterior relations & Coverings)"), (11, "Anal Canal (Internal features & Ischiorectal fossa)"), (12, "Radial Nerve (Course & Wrist Drop)"), (13, "Mammary Gland (Lymphatic drainage & Cancer spread)"), (14, "Carpal Tunnel Syndrome (Median nerve)"), (15, "Parotid Gland (Relations & Frey's syndrome)"), (16, "Tongue (Nerve supply & Development)"), (17, "Cavernous Sinus (Boundaries & Tributaries)"), (18, "Mediastinum (Divisions & Contents)"), (19, "Coronary Circulation (Vessels & Dominance)"), (20, "Inguinal Canal (Walls, Rings, Hernia types)"), ], cols=2)) story.append(PageBreak()) # ══════════════════════════════════════════════════════════════════════════════ # 3. BIOCHEMISTRY # ══════════════════════════════════════════════════════════════════════════════ story.append(subject_banner("3. BIOCHEMISTRY", BIOC_CLR)) story.append(sp(10)) story.append(coloured_bar("Most Repeated Long Note Topics (10-20 Marks)", BIOC_CLR)) story.append(sp(4)) for row in numbered_items([ (1, "Transcription & Post-transcriptional modifications"), (2, "Beta-oxidation of Fatty Acids / Ketogenesis"), (3, "Blood glucose regulation & Diabetes Mellitus"), (4, "Urea Cycle"), (5, "Translation in eukaryotes"), ], LIGHT_PUR, BIOC_CLR): story.append(row) story.append(sp(10)) story.append(coloured_bar("Most Repeated Short Note Topics (4-5 Marks)", colors.HexColor("#7B1FA2"))) story.append(sp(4)) for row in numbered_items([ (1, "PCR and Recombinant DNA Technology"), (2, "Immunoglobulin structure and functions"), (3, "Competitive inhibition (with examples like Methotrexate)"), (4, "Diagnostic significance of Isoenzymes"), (5, "Vitamin D & C (functions and clinical correlations)"), (6, "Detoxification / Xenobiotic metabolism"), (7, "Tumor Markers"), ], LIGHT_PUR, colors.HexColor("#7B1FA2")): story.append(row) story.append(sp(10)) story.append(coloured_bar("Frequently Asked Diagrams / Illustrations", colors.HexColor("#4A148C"))) story.append(sp(4)) for row in numbered_items([ (1, "Structure of Immunoglobulin (IgG)"), (2, "Operon Concept (Lac Operon)"), (3, "Recombinant DNA / Vectors mapping"), (4, "tRNA structure / Transcription fork"), (5, "Internal Capsule fibers (Anatomy)"), ], LIGHT_PUR, colors.HexColor("#4A148C")): story.append(row) story.append(sp(10)) story.append(coloured_bar("Frequently Repeated Clinical Conditions / Cases", colors.HexColor("#880E4F"))) story.append(sp(4)) for row in numbered_items([ (1, "<b>Jaundice</b> - Differential diagnosis via LFTs, urine/stool bile markers"), (2, "<b>Diabetes Mellitus & Diabetic Ketoacidosis</b> - Blood gases, HbA1c"), (3, "<b>Gout / Lesch-Nyhan Syndrome</b> - Uric acid levels, purine salvage defect"), (4, "<b>Protein-Energy Malnutrition</b> - Kwashiorkor vs Marasmus differentiation"), (5, "<b>Myocardial Infarction</b> - Cardiac isoenzymes like CK-MB, Troponin"), (6, "<b>Phenylketonuria (PKU)</b> - Enzyme defect, clinical features"), ], LIGHT_PUR, colors.HexColor("#880E4F")): story.append(row) story.append(sp(14)) story.append(coloured_bar("Top 20 Most Important Topics - Quick Revision (MBBS Exam-Oriented)", DARK_BG)) story.append(sp(4)) story.append(Paragraph( "<i>High-priority checklist based strictly on exam repetition frequency.</i>", S("note3", fontSize=9, leading=12, textColor=SUBTEXT, fontName="Helvetica-Oblique", spaceAfter=6))) story.append(priority_grid([ (1, "Liver Function Tests & Differential Diagnosis of Jaundice"), (2, "Diabetes Mellitus, Ketoacidosis & HbA1c"), (3, "Polymerase Chain Reaction (PCR) & Recombinant DNA Tech"), (4, "Transcription process & Post-transcriptional modifications"), (5, "Immunoglobulins (Structure, Classes, Functions)"), (6, "Ketogenesis, Ketolysis & Starvation metabolism"), (7, "Diagnostic Isoenzymes (Cardiac & Hepatic markers)"), (8, "Competitive Enzyme Inhibition & Clinical examples (Methotrexate)"), (9, "Vitamin D (Hormonal action, Synthesis, Rickets/Osteomalacia)"), (10, "Vitamin C (Collagen synthesis, Scurvy, Antioxidant role)"), (11, "Urea Cycle & Ammonia Toxicity mechanism"), (12, "Acid-Base Balance, Metabolic Acidosis/Alkalosis & Buffers"), (13, "Tumor Markers & Oncogenes"), (14, "Renal Clearance Tests (Creatinine vs. Urea)"), (15, "Lipoprotein Metabolism (HDL cycle & Reverse cholesterol transport)"), (16, "Genetic Code features & Mutations"), (17, "Phenylketonuria (PKU) & Tyrosine metabolism"), (18, "Detoxification (Phase I and Phase II reactions)"), (19, "Gout & Purine degradation pathway"), (20, "AETCOM Modules (Medical ethics, breaking bad news, lifelong learning, cadaver respect)"), ], cols=2)) doc.build(story) import os sz = os.path.getsize(output) print("Done. File: %s | Size: %.1f KB" % (output, sz/1024)) PYEOF
python3 << 'PYEOF' from reportlab.lib.pagesizes import A4 from reportlab.lib import colors from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.lib.units import cm from reportlab.platypus import (SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, HRFlowable, PageBreak, KeepInFrame) from reportlab.lib.enums import TA_CENTER output = "/tmp/workspace/photos-pdf/MBBS_Study_Guide.pdf" doc = SimpleDocTemplate( output, pagesize=A4, leftMargin=2*cm, rightMargin=2*cm, topMargin=1.5*cm, bottomMargin=1.5*cm, title="MBBS Exam Study Guide", ) PW = A4[0] - 4*cm # usable width ~17cm DARK = colors.HexColor("#1E2A3A") PHYS = colors.HexColor("#1565C0") ANAT = colors.HexColor("#2E7D32") BIOC = colors.HexColor("#6A1B9A") GOLD = colors.HexColor("#F9A825") LBLU = colors.HexColor("#E3F2FD") LGRN = colors.HexColor("#E8F5E9") LPUR = colors.HexColor("#F3E5F5") LGRY = colors.HexColor("#F5F5F5") WHT = colors.white TXT = colors.HexColor("#212121") STXT = colors.HexColor("#424242") def S(name, **kw): return ParagraphStyle(name, **kw) ss = getSampleStyleSheet() def banner(text, bg, fs=18): p = Paragraph(text, S("_bn"+text[:4], fontSize=fs, leading=fs+4, textColor=WHT, fontName="Helvetica-Bold")) t = Table([[p]], colWidths=[PW]) t.setStyle(TableStyle([ ("BACKGROUND", (0,0),(-1,-1), bg), ("TOPPADDING", (0,0),(-1,-1), 8), ("BOTTOMPADDING", (0,0),(-1,-1), 8), ("LEFTPADDING", (0,0),(-1,-1), 12), ("RIGHTPADDING", (0,0),(-1,-1), 8), ])) return t def sect(text, bg): p = Paragraph(text, S("_sc"+text[:6], fontSize=11, leading=14, textColor=WHT, fontName="Helvetica-Bold")) t = Table([[p]], colWidths=[PW]) t.setStyle(TableStyle([ ("BACKGROUND", (0,0),(-1,-1), bg), ("TOPPADDING", (0,0),(-1,-1), 5), ("BOTTOMPADDING", (0,0),(-1,-1), 5), ("LEFTPADDING", (0,0),(-1,-1), 10), ("RIGHTPADDING", (0,0),(-1,-1), 8), ])) return t def rows(items, light_bg, dot_color): out = [] for i,(n,txt) in enumerate(items): np = Paragraph(str(n), S("_n%s%s"%(i,n), fontSize=10, leading=13, textColor=WHT, fontName="Helvetica-Bold", alignment=TA_CENTER)) nc = Table([[np]], colWidths=[0.9*cm]) nc.setStyle(TableStyle([("BACKGROUND",(0,0),(-1,-1),dot_color), ("TOPPADDING",(0,0),(-1,-1),3),("BOTTOMPADDING",(0,0),(-1,-1),3), ("LEFTPADDING",(0,0),(-1,-1),2),("RIGHTPADDING",(0,0),(-1,-1),2)])) tp = Paragraph(txt, S("_t%s%s"%(i,n), fontSize=10, leading=13, textColor=TXT, fontName="Helvetica")) r = Table([[nc,tp]], colWidths=[1.0*cm, PW-1.0*cm]) r.setStyle(TableStyle([ ("BACKGROUND",(0,0),(-1,-1), light_bg if i%2==0 else WHT), ("TOPPADDING",(0,0),(-1,-1),4),("BOTTOMPADDING",(0,0),(-1,-1),4), ("LEFTPADDING",(0,0),(-1,-1),4),("RIGHTPADDING",(0,0),(-1,-1),4), ("VALIGN",(0,0),(-1,-1),"MIDDLE"), ])) out.append(r) out.append(Spacer(1,1)) return out def grid(items, cols=2): cw = PW / cols data = [] row = [] for i,(n,txt) in enumerate(items): p = Paragraph("<b>%s.</b> %s"%(n,txt), S("_g%s"%i, fontSize=9, leading=13, textColor=TXT, fontName="Helvetica")) cell = Table([[p]], colWidths=[cw-0.2*cm]) cell.setStyle(TableStyle([ ("BACKGROUND",(0,0),(-1,-1), LGRY if (i//cols)%2==0 else WHT), ("TOPPADDING",(0,0),(-1,-1),5),("BOTTOMPADDING",(0,0),(-1,-1),5), ("LEFTPADDING",(0,0),(-1,-1),6),("RIGHTPADDING",(0,0),(-1,-1),5), ("BOX",(0,0),(-1,-1),0.4, colors.HexColor("#E0E0E0")), ])) row.append(cell) if len(row)==cols: data.append(row); row=[] if row: while len(row)<cols: row.append(Paragraph("",ss["Normal"])) data.append(row) t = Table(data, colWidths=[cw]*cols, hAlign="LEFT") t.setStyle(TableStyle([("VALIGN",(0,0),(-1,-1),"TOP"), ("LEFTPADDING",(0,0),(-1,-1),0),("RIGHTPADDING",(0,0),(-1,-1),2), ("TOPPADDING",(0,0),(-1,-1),0),("BOTTOMPADDING",(0,0),(-1,-1),2)])) return t def sp(h=6): return Spacer(1,h) story = [] # ── COVER ────────────────────────────────────────────────────────────────── # Use Canvas background approach: just a dark table, content separate cover_bg = Table([[""]], colWidths=[PW], rowHeights=[23.5*cm]) cover_bg.setStyle(TableStyle([("BACKGROUND",(0,0),(-1,-1), DARK), ("TOPPADDING",(0,0),(-1,-1),0),("BOTTOMPADDING",(0,0),(-1,-1),0), ("LEFTPADDING",(0,0),(-1,-1),0),("RIGHTPADDING",(0,0),(-1,-1),0)])) cover_inner_items = [ sp(30), Paragraph("MBBS EXAM", S("c1", fontSize=28, leading=34, textColor=WHT, alignment=TA_CENTER, fontName="Helvetica-Bold")), Paragraph("STUDY GUIDE", S("c2", fontSize=34, leading=40, textColor=GOLD, alignment=TA_CENTER, fontName="Helvetica-Bold")), sp(12), HRFlowable(width="50%", thickness=2, color=GOLD, hAlign="CENTER"), sp(12), Paragraph("Identified Exam Trends & Favorites", S("c3", fontSize=13, leading=17, textColor=GOLD, alignment=TA_CENTER, fontName="Helvetica-Bold")), sp(8), Paragraph("PHYSIOLOGY | ANATOMY | BIOCHEMISTRY", S("c4", fontSize=11, leading=14, textColor=colors.HexColor("#CFD8DC"), alignment=TA_CENTER, fontName="Helvetica-Bold")), sp(5), Paragraph("Most Repeated Topics | Diagrams | Clinical Conditions | Quick Revision", S("c5", fontSize=9, leading=12, textColor=colors.HexColor("#90A4AE"), alignment=TA_CENTER, fontName="Helvetica")), sp(20), Paragraph("MBBS First Year | Exam-Oriented", S("c6", fontSize=9, leading=12, textColor=colors.HexColor("#78909C"), alignment=TA_CENTER, fontName="Helvetica-Oblique")), ] kif = KeepInFrame(PW, 23*cm, cover_inner_items, hAlign="CENTER", mode="shrink") cover_tbl = Table([[kif]], colWidths=[PW], rowHeights=[23.5*cm]) cover_tbl.setStyle(TableStyle([("BACKGROUND",(0,0),(-1,-1), DARK), ("TOPPADDING",(0,0),(-1,-1),0),("BOTTOMPADDING",(0,0),(-1,-1),0), ("LEFTPADDING",(0,0),(-1,-1),0),("RIGHTPADDING",(0,0),(-1,-1),0)])) story.append(cover_tbl) story.append(PageBreak()) # ── TOC ──────────────────────────────────────────────────────────────────── story.append(Paragraph("Table of Contents", S("toh", fontSize=20, leading=24, textColor=DARK, fontName="Helvetica-Bold", spaceAfter=6))) story.append(HRFlowable(width="100%", thickness=1.5, color=DARK)) story.append(sp(8)) for num, lbl, clr, ind in [ ("1","PHYSIOLOGY",PHYS,False), (""," Most Repeated Long Note Topics (5 topics)",colors.HexColor("#555"),True), (""," Most Repeated Short Note Topics (6 topics)",colors.HexColor("#555"),True), (""," Frequently Asked Diagrams (4 diagrams)",colors.HexColor("#555"),True), (""," Frequently Repeated Clinical Conditions (6)",colors.HexColor("#555"),True), ("2","ANATOMY",ANAT,False), (""," Most Repeated Long Note Topics (6 topics)",colors.HexColor("#555"),True), (""," Most Repeated Short Note Topics (6 topics)",colors.HexColor("#555"),True), (""," Frequently Asked Diagrams (4 diagrams)",colors.HexColor("#555"),True), (""," Frequently Repeated Clinical Conditions (6)",colors.HexColor("#555"),True), (""," Top 20 Most Important Topics",colors.HexColor("#555"),True), ("3","BIOCHEMISTRY",BIOC,False), (""," Most Repeated Long Note Topics (5 topics)",colors.HexColor("#555"),True), (""," Most Repeated Short Note Topics (7 topics)",colors.HexColor("#555"),True), (""," Frequently Asked Diagrams (5 diagrams)",colors.HexColor("#555"),True), (""," Frequently Repeated Clinical Conditions (6)",colors.HexColor("#555"),True), (""," Top 20 Most Important Topics",colors.HexColor("#555"),True), ]: fs = 13 if num else 11 fn = "Helvetica-Bold" if num else "Helvetica" txt = ("<b>%s. %s</b>" % (num, lbl)) if num else lbl story.append(Paragraph(txt, S("tc"+lbl[:4]+str(ind), fontSize=fs, leading=fs+5, textColor=clr, fontName=fn, spaceAfter=3, leftIndent=0 if num else 16))) story.append(PageBreak()) # ══════════════════════════════════════════════════════════════════════════════ # 1. PHYSIOLOGY # ══════════════════════════════════════════════════════════════════════════════ story.append(banner("1. PHYSIOLOGY", PHYS)) story.append(sp(10)) story.append(sect("Most Repeated Long Note Topics (10-20 Marks)", PHYS)) story.append(sp(4)) for r in rows([(1,"Blood Pressure Regulation & Shock"), (2,"Cardiac Output (Fick's principle & Determinants)"), (3,"Pyramidal Tracts (Origin, course, lesions)"), (4,"Menstrual Cycle & Endometrial changes"), (5,"Hypoxia (Classification & physiological basis)")],LBLU,PHYS): story.append(r) story.append(sp(10)) story.append(sect("Most Repeated Short Note Topics (5 Marks)", colors.HexColor("#1976D2"))) story.append(sp(4)) for r in rows([(1,"Neuromuscular Junction / Myasthenia Gravis"), (2,"Surfactant & Respiratory Distress Syndrome"), (3,"Organ of Corti / Mechanism of hearing"), (4,"Visual Pathway & Lesions"), (5,"Functions of Basal Ganglia / Parkinsonism"), (6,"Gastric HCl Secretion")],LBLU,colors.HexColor("#1976D2")): story.append(r) story.append(sp(10)) story.append(sect("Frequently Asked Diagrams (Draw & Label)", colors.HexColor("#0D47A1"))) story.append(sp(4)) for r in rows([(1,"Oxygen-Hemoglobin Dissociation Curve"), (2,"Visual Pathway and sites of lesions"), (3,"Counter-current Multiplier System"), (4,"ECG normal trace and intervals")],LBLU,colors.HexColor("#0D47A1")): story.append(r) story.append(sp(10)) story.append(sect('Frequently Repeated Clinical Conditions (Applied / "What will happen and why")',colors.HexColor("#0288D1"))) story.append(sp(4)) for r in rows([(1,"Parkinsonism (Basal ganglia lesion)"), (2,"Myasthenia Gravis"), (3,"Mismatched Blood Transfusion reactions"), (4,"Peptic Ulcer"), (5,"Jaundice (Physiological vs Pathological vs Hemolytic)"), (6,"Acromegaly & Dwarfism")],LBLU,colors.HexColor("#0288D1")): story.append(r) story.append(PageBreak()) # ══════════════════════════════════════════════════════════════════════════════ # 2. ANATOMY # ══════════════════════════════════════════════════════════════════════════════ story.append(banner("2. ANATOMY", ANAT)) story.append(sp(10)) story.append(sect("Most Repeated Long Note Topics (10-20 Marks)", ANAT)) story.append(sp(4)) for r in rows([(1,"Thyroid Gland (Gross anatomy, relations, blood supply)"), (2,"Internal Capsule (Parts, fibers, arterial supply)"), (3,"Uterus (Supports, relations, applied)"), (4,"Knee Joint (Ligaments, locking/unlocking)"), (5,"Kidney (Relations, coverings)"), (6,"Stomach (Blood supply, relations/bed)")],LGRN,ANAT): story.append(r) story.append(sp(10)) story.append(sect("Most Repeated Short Note Topics (5 Marks)", colors.HexColor("#388E3C"))) story.append(sp(4)) for r in rows([(1,"Portocaval Anastomosis / Portal Hypertension"), (2,"Lateral Medullary Syndrome (Wallenberg)"), (3,"Carpal Tunnel Syndrome"), (4,"Bronchopulmonary Segments"), (5,"Circle of Willis"), (6,"Cavernous Sinus")],LGRN,colors.HexColor("#388E3C")): story.append(r) story.append(sp(10)) story.append(sect("Frequently Asked Diagrams (Draw & Label)", colors.HexColor("#1B5E20"))) story.append(sp(4)) for r in rows([(1,"Transverse section of Medulla Oblongata / Midbrain"), (2,"Brachial Plexus formation and branches"), (3,"Relations of posterior aspect of both kidneys"), (4,"Blood supply of the superolateral surface of the cerebrum")],LGRN,colors.HexColor("#1B5E20")): story.append(r) story.append(sp(10)) story.append(sect("Frequently Repeated Clinical Conditions (Explain Why)", colors.HexColor("#0097A7"))) story.append(sp(4)) for r in rows([(1,"<b>Erb's / Klumpke's Palsy:</b> Fall on shoulder or pulling infant's arm."), (2,"<b>Wrist Drop:</b> Injury to radial nerve (spiral groove/crutch paralysis)."), (3,"<b>Frey's Syndrome:</b> Sweating while eating post-parotid surgery."), (4,"<b>Horner's Syndrome:</b> Ptosis, miosis, anhydrosis."), (5,"<b>Black Eye:</b> Path of blood from scalp injury."), (6,"<b>Referred Pain:</b> Gallbladder pain to right scapula; Appendicitis to umbilicus.")], LGRN,colors.HexColor("#0097A7")): story.append(r) story.append(sp(14)) story.append(sect("Top 20 Most Important Topics - Quick Revision List", DARK)) story.append(sp(4)) story.append(Paragraph("<i>High-priority checklist based strictly on exam repetition frequency.</i>", S("n2", fontSize=9, leading=12, textColor=STXT, fontName="Helvetica-Oblique", spaceAfter=6))) story.append(grid([ (1,"Thyroid Gland (Anatomy & Clinicals)"), (2,"Internal Capsule (Fibers & Blood Supply)"), (3,"Brachial Plexus (Formation & Nerve Injuries)"), (4,"Uterus (Supports & Prolapse)"), (5,"Knee Joint (Ligaments & Locking mechanism)"), (6,"Stomach (Stomach bed, Blood Supply & Lymphatics)"), (7,"Portocaval Anastomoses (Sites & Clinical significance)"), (8,"Coronary Circulation (Arterial supply of the heart)"), (9,"Inguinal Canal (Boundaries & Hernia differentiation)"), (10,"Kidney (Posterior relations & Coverings)"), (11,"Anal Canal (Internal features & Ischiorectal fossa)"), (12,"Radial Nerve (Course & Wrist Drop)"), (13,"Mammary Gland (Lymphatic drainage & Cancer spread)"), (14,"Carpal Tunnel Syndrome (Median nerve)"), (15,"Parotid Gland (Relations & Frey's syndrome)"), (16,"Tongue (Nerve supply & Development)"), (17,"Cavernous Sinus (Boundaries & Tributaries)"), (18,"Mediastinum (Divisions & Contents)"), (19,"Coronary Circulation (Vessels & Dominance)"), (20,"Inguinal Canal (Walls, Rings, Hernia types)"), ])) story.append(PageBreak()) # ══════════════════════════════════════════════════════════════════════════════ # 3. BIOCHEMISTRY # ══════════════════════════════════════════════════════════════════════════════ story.append(banner("3. BIOCHEMISTRY", BIOC)) story.append(sp(10)) story.append(sect("Most Repeated Long Note Topics (10-20 Marks)", BIOC)) story.append(sp(4)) for r in rows([(1,"Transcription & Post-transcriptional modifications"), (2,"Beta-oxidation of Fatty Acids / Ketogenesis"), (3,"Blood glucose regulation & Diabetes Mellitus"), (4,"Urea Cycle"), (5,"Translation in eukaryotes")],LPUR,BIOC): story.append(r) story.append(sp(10)) story.append(sect("Most Repeated Short Note Topics (4-5 Marks)", colors.HexColor("#7B1FA2"))) story.append(sp(4)) for r in rows([(1,"PCR and Recombinant DNA Technology"), (2,"Immunoglobulin structure and functions"), (3,"Competitive inhibition (with examples like Methotrexate)"), (4,"Diagnostic significance of Isoenzymes"), (5,"Vitamin D & C (functions and clinical correlations)"), (6,"Detoxification / Xenobiotic metabolism"), (7,"Tumor Markers")],LPUR,colors.HexColor("#7B1FA2")): story.append(r) story.append(sp(10)) story.append(sect("Frequently Asked Diagrams / Illustrations", colors.HexColor("#4A148C"))) story.append(sp(4)) for r in rows([(1,"Structure of Immunoglobulin (IgG)"), (2,"Operon Concept (Lac Operon)"), (3,"Recombinant DNA / Vectors mapping"), (4,"tRNA structure / Transcription fork"), (5,"Internal Capsule fibers (Anatomy)")],LPUR,colors.HexColor("#4A148C")): story.append(r) story.append(sp(10)) story.append(sect("Frequently Repeated Clinical Conditions / Cases", colors.HexColor("#880E4F"))) story.append(sp(4)) for r in rows([(1,"<b>Jaundice</b> - Differential diagnosis via LFTs, urine/stool bile markers"), (2,"<b>Diabetes Mellitus & DKA</b> - Blood gases, HbA1c"), (3,"<b>Gout / Lesch-Nyhan Syndrome</b> - Uric acid levels, purine salvage defect"), (4,"<b>Protein-Energy Malnutrition</b> - Kwashiorkor vs Marasmus differentiation"), (5,"<b>Myocardial Infarction</b> - Cardiac isoenzymes like CK-MB, Troponin"), (6,"<b>Phenylketonuria (PKU)</b> - Enzyme defect, clinical features")], LPUR,colors.HexColor("#880E4F")): story.append(r) story.append(sp(14)) story.append(sect("Top 20 Most Important Topics - Quick Revision (MBBS Exam-Oriented)", DARK)) story.append(sp(4)) story.append(Paragraph("<i>High-priority checklist based strictly on exam repetition frequency.</i>", S("n3", fontSize=9, leading=12, textColor=STXT, fontName="Helvetica-Oblique", spaceAfter=6))) story.append(grid([ (1,"Liver Function Tests & Differential Diagnosis of Jaundice"), (2,"Diabetes Mellitus, Ketoacidosis & HbA1c"), (3,"Polymerase Chain Reaction (PCR) & Recombinant DNA Tech"), (4,"Transcription process & Post-transcriptional modifications"), (5,"Immunoglobulins (Structure, Classes, Functions)"), (6,"Ketogenesis, Ketolysis & Starvation metabolism"), (7,"Diagnostic Isoenzymes (Cardiac & Hepatic markers)"), (8,"Competitive Enzyme Inhibition & Clinical examples (Methotrexate)"), (9,"Vitamin D (Hormonal action, Synthesis, Rickets/Osteomalacia)"), (10,"Vitamin C (Collagen synthesis, Scurvy, Antioxidant role)"), (11,"Urea Cycle & Ammonia Toxicity mechanism"), (12,"Acid-Base Balance, Metabolic Acidosis/Alkalosis & Buffers"), (13,"Tumor Markers & Oncogenes"), (14,"Renal Clearance Tests (Creatinine vs. Urea)"), (15,"Lipoprotein Metabolism (HDL cycle & Reverse cholesterol transport)"), (16,"Genetic Code features & Mutations"), (17,"Phenylketonuria (PKU) & Tyrosine metabolism"), (18,"Detoxification (Phase I and Phase II reactions)"), (19,"Gout & Purine degradation pathway"), (20,"AETCOM Modules (Medical ethics, breaking bad news, lifelong learning, cadaver respect)"), ])) doc.build(story) import os sz = os.path.getsize(output) print("Done. %s %.1f KB" % (output, sz/1024)) PYEOF
MBBS Study Guide
PDF Document · PDF
Based on the image provided, here is the table detailing Anatomy topics, their repetition frequency, years asked, and exam priority: | Topic Name | Number of Repetitions | Years Asked | Priority for Exam Preparation | | :------------------------------------------------- | :-------------------- | :--------------------------------- | :---------------------------- | | **HEAD, NECK & NEUROANATOMY** | | | | | Thyroid Gland (Gross, Micro, Dev, Applied) | 9 | 2025, '24, '23, '22, '21, '20, '19 | Very High Yield | | Internal Capsule (Relations, Fibers, Blood supply) | 7 | 2025, '24, '23, '21, '20, '19 | Very High Yield | | Parotid Gland & Frey's Syndrome | 6 | 2025, '23, '22, '21, '20 | Very High Yield | | Tongue (Dev, Nerve supply, Gross) | 6 | 2024, '22, '21, '20, '19 | Very High Yield | | Cavernous Sinus | 5 | 2025, '23, '22, '21 | High Yield | | Lateral Medullary Syndrome | 4 | 2025, '23, '21 | High Yield | | Circle of Willis / Brain Blood Supply | 4 | 2024, '23, '21, '19 | High Yield | | Palatine Tonsil | 3 | 2023, '22, '21 | Moderate Yield | | **UPPER LIMB** | | | | | Brachial Plexus (Formation, Branches, Palsies) | 7 | 2025, '24, '23, '21, '20, '19 | Very High Yield | | Radial Nerve & Wrist Drop | 6 | 2025, '24, '23, '21, '20, '19 | Very High Yield | | Mammary Gland / Breast (Lymphatics, Fixity) | 5 | 2024, '23, '21, '19 | Very High Yield | | Carpal Tunnel Syndrome / Median Nerve | 5 | 2025, '23, '21, '20 | Very High Yield | | Shoulder Joint (Movement, Dislocation) | 4 | 2025, '23, '21, '19 | High Yield | | Cubital Fossa | 2 | 2023, '22 | Moderate Yield | | **ABDOMEN & PELVIS** | | | | | Portocaval Anastomosis / Portal Vein | 6 | 2025, '23, '22, '21, '20, '19 | Very High Yield | | Stomach (Relations, Blood supply, Ulcers) | 6 | 2025, '24, '23, '22, '21, '19 | Very High Yield | | Uterus (Supports, Relations, Prolapse) | 6 | 2025, '23, '22, '21, '20, '19 | Very High Yield | | Inguinal Canal & Hernia | 5 | 2025, '23, '22, '21 | Very High Yield | | Kidney (Anatomy, Relations, Coverings) | 5 | 2023, '21, '20, '19 | Very High Yield | | Anal Canal / Ischiorectal Fossa | 5 | 2025, '23, '22, '19 | Very High Yield | | Spleen (Relations, Microanatomy) | 4 | 2025, '24, '23, '20 | High Yield | | Prostate Gland | 3 | 2025, '22, '20 | Moderate Yield | | **LOWER LIMB** | | | | | Knee Joint (Locking/Unlocking, Ligaments) | 6 | 2025, '23, '22, '21, '19 | Very High Yield | | Great Saphenous Vein (CABG, Varicose Veins) | 4 | 2025, '24, '22, '19 | High Yield | | Popliteal Fossa | 3 | 2023, '21, '19 | Moderate Yield | | Arches of Foot | 3 | 2023, '22, '21 | Moderate Yield | | **THORAX** | | | | | Coronary Circulation / Arterial Supply of Heart | 5 | 2024, '23, '22, '21, '20 | Very High Yield | | Mediastinum | 4 | 2025, '24, '22, '19 | High Yield | | Bronchopulmonary Segments | 4 | 2023, '22, '21, '20 | High Yield | | Thoracic Duct | 4 | 2023, '21, '20, '19 | High Yield | | **GENETICS / EMBRYO / HISTO (General)** | | | | | First Pharyngeal Arch Derivatives | 3 | 2023, '21, '19 | Moderate Yield | | Turner's / Downs / Klinefelter's Syndromes | 3 | 2025, '24, '23 | Moderate Yield | | Tetralogy of Fallot | 3 | 2025, '24, '20 | Moderate Yield | | Cadaver as First Teacher (AETCOM) | 1 | 2025 | Low Yield |
python3 << 'PYEOF' from reportlab.lib.pagesizes import A4, landscape from reportlab.lib import colors from reportlab.lib.styles import ParagraphStyle from reportlab.lib.units import cm from reportlab.platypus import (SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, HRFlowable, PageBreak) from reportlab.lib.enums import TA_CENTER, TA_LEFT output = "/tmp/workspace/photos-pdf/Anatomy_Topic_Frequency.pdf" doc = SimpleDocTemplate( output, pagesize=landscape(A4), leftMargin=1.5*cm, rightMargin=1.5*cm, topMargin=1.5*cm, bottomMargin=1.5*cm, title="Anatomy Topic Frequency Table", ) # Page width in landscape: A4 = 297mm wide, minus margins PW = 297*0.0352778*cm - 3*cm # ~26.6 cm usable # ── Colours ────────────────────────────────────────────────────────────────── DARK = colors.HexColor("#1E2A3A") ANAT = colors.HexColor("#2E7D32") ANAT_LT = colors.HexColor("#C8E6C9") GOLD = colors.HexColor("#F9A825") VHY_CLR = colors.HexColor("#B71C1C") # Very High Yield - dark red HY_CLR = colors.HexColor("#E65100") # High Yield - orange MY_CLR = colors.HexColor("#1565C0") # Moderate Yield - blue LY_CLR = colors.HexColor("#424242") # Low Yield - grey VHY_BG = colors.HexColor("#FFEBEE") HY_BG = colors.HexColor("#FFF3E0") MY_BG = colors.HexColor("#E3F2FD") LY_BG = colors.HexColor("#F5F5F5") HDR_BG = colors.HexColor("#1B5E20") SEC_BG = colors.HexColor("#388E3C") ROW_ALT = colors.HexColor("#F9FBE7") WHT = colors.white TXT = colors.HexColor("#212121") def S(name, **kw): return ParagraphStyle(name, **kw) def sp(h=6): return Spacer(1, h) # Priority badge colours PRIORITY_MAP = { "Very High Yield": (VHY_CLR, VHY_BG), "High Yield": (HY_CLR, HY_BG), "Moderate Yield": (MY_CLR, MY_BG), "Low Yield": (LY_CLR, LY_BG), } def priority_cell(text): fg, bg = PRIORITY_MAP.get(text, (TXT, WHT)) p = Paragraph("<b>%s</b>" % text, S("_pr"+text[:3], fontSize=8, leading=11, textColor=fg, fontName="Helvetica-Bold", alignment=TA_CENTER)) t = Table([[p]], colWidths=[3.8*cm]) t.setStyle(TableStyle([ ("BACKGROUND", (0,0),(-1,-1), bg), ("TOPPADDING", (0,0),(-1,-1), 3), ("BOTTOMPADDING", (0,0),(-1,-1), 3), ("LEFTPADDING", (0,0),(-1,-1), 4), ("RIGHTPADDING", (0,0),(-1,-1), 4), ("ROUNDEDCORNERS",[3,3,3,3]), ("BOX", (0,0),(-1,-1), 0.5, fg), ])) return t def section_row(label): p = Paragraph("<b>%s</b>" % label, S("_sr"+label[:4], fontSize=9, leading=12, textColor=WHT, fontName="Helvetica-Bold")) return [p, "", "", ""] # Column widths: Topic | Reps | Years | Priority CW = [9.2*cm, 1.8*cm, 9.5*cm, 4.2*cm] # ── Data ───────────────────────────────────────────────────────────────────── data_sections = [ ("HEAD, NECK & NEUROANATOMY", [ ("Thyroid Gland (Gross, Micro, Dev, Applied)", "9", "2025, '24, '23, '22, '21, '20, '19", "Very High Yield"), ("Internal Capsule (Relations, Fibers, Blood supply)", "7", "2025, '24, '23, '21, '20, '19", "Very High Yield"), ("Parotid Gland & Frey's Syndrome", "6", "2025, '23, '22, '21, '20", "Very High Yield"), ("Tongue (Dev, Nerve supply, Gross)", "6", "2024, '22, '21, '20, '19", "Very High Yield"), ("Cavernous Sinus", "5", "2025, '23, '22, '21", "High Yield"), ("Lateral Medullary Syndrome", "4", "2025, '23, '21", "High Yield"), ("Circle of Willis / Brain Blood Supply", "4", "2024, '23, '21, '19", "High Yield"), ("Palatine Tonsil", "3", "2023, '22, '21", "Moderate Yield"), ]), ("UPPER LIMB", [ ("Brachial Plexus (Formation, Branches, Palsies)", "7", "2025, '24, '23, '21, '20, '19", "Very High Yield"), ("Radial Nerve & Wrist Drop", "6", "2025, '24, '23, '21, '20, '19", "Very High Yield"), ("Mammary Gland / Breast (Lymphatics, Fixity)", "5", "2024, '23, '21, '19", "Very High Yield"), ("Carpal Tunnel Syndrome / Median Nerve", "5", "2025, '23, '21, '20", "Very High Yield"), ("Shoulder Joint (Movement, Dislocation)", "4", "2025, '23, '21, '19", "High Yield"), ("Cubital Fossa", "2", "2023, '22", "Moderate Yield"), ]), ("ABDOMEN & PELVIS", [ ("Portocaval Anastomosis / Portal Vein", "6", "2025, '23, '22, '21, '20, '19", "Very High Yield"), ("Stomach (Relations, Blood supply, Ulcers)", "6", "2025, '24, '23, '22, '21, '19", "Very High Yield"), ("Uterus (Supports, Relations, Prolapse)", "6", "2025, '23, '22, '21, '20, '19", "Very High Yield"), ("Inguinal Canal & Hernia", "5", "2025, '23, '22, '21", "Very High Yield"), ("Kidney (Anatomy, Relations, Coverings)", "5", "2023, '21, '20, '19", "Very High Yield"), ("Anal Canal / Ischiorectal Fossa", "5", "2025, '23, '22, '19", "Very High Yield"), ("Spleen (Relations, Microanatomy)", "4", "2025, '24, '23, '20", "High Yield"), ("Prostate Gland", "3", "2025, '22, '20", "Moderate Yield"), ]), ("LOWER LIMB", [ ("Knee Joint (Locking/Unlocking, Ligaments)", "6", "2025, '23, '22, '21, '19", "Very High Yield"), ("Great Saphenous Vein (CABG, Varicose Veins)", "4", "2025, '24, '22, '19", "High Yield"), ("Popliteal Fossa", "3", "2023, '21, '19", "Moderate Yield"), ("Arches of Foot", "3", "2023, '22, '21", "Moderate Yield"), ]), ("THORAX", [ ("Coronary Circulation / Arterial Supply of Heart", "5", "2024, '23, '22, '21, '20", "Very High Yield"), ("Mediastinum", "4", "2025, '24, '22, '19", "High Yield"), ("Bronchopulmonary Segments", "4", "2023, '22, '21, '20", "High Yield"), ("Thoracic Duct", "4", "2023, '21, '20, '19", "High Yield"), ]), ("GENETICS / EMBRYO / HISTO (General)", [ ("First Pharyngeal Arch Derivatives", "3", "2023, '21, '19", "Moderate Yield"), ("Turner's / Downs / Klinefelter's Syndromes", "3", "2025, '24, '23", "Moderate Yield"), ("Tetralogy of Fallot", "3", "2025, '24, '20", "Moderate Yield"), ("Cadaver as First Teacher (AETCOM)", "1", "2025", "Low Yield"), ]), ] # ── Build story ─────────────────────────────────────────────────────────────── story = [] # Title block title_p = Paragraph("ANATOMY - Topic Repetition Frequency Table", S("ttl", fontSize=18, leading=22, textColor=WHT, fontName="Helvetica-Bold", alignment=TA_CENTER)) sub_p = Paragraph("MBBS First Year | Exam Trends 2019-2025 | Identified Patterns", S("sub", fontSize=10, leading=14, textColor=GOLD, fontName="Helvetica", alignment=TA_CENTER)) title_tbl = Table([[title_p],[sub_p]], colWidths=[sum(CW)+0.6*cm]) title_tbl.setStyle(TableStyle([ ("BACKGROUND", (0,0),(-1,-1), DARK), ("TOPPADDING", (0,0),(-1,-1), 10), ("BOTTOMPADDING", (0,0),(-1,-1), 10), ("LEFTPADDING", (0,0),(-1,-1), 14), ("RIGHTPADDING", (0,0),(-1,-1), 14), ])) story.append(title_tbl) story.append(sp(10)) # Legend row legend_items = [ ("Very High Yield", VHY_CLR, VHY_BG), ("High Yield", HY_CLR, HY_BG), ("Moderate Yield", MY_CLR, MY_BG), ("Low Yield", LY_CLR, LY_BG), ] leg_cells = [] for lbl, fg, bg in legend_items: p = Paragraph("<b>%s</b>" % lbl, S("_leg"+lbl[:3], fontSize=9, leading=12, textColor=fg, fontName="Helvetica-Bold", alignment=TA_CENTER)) t = Table([[p]], colWidths=[3.5*cm]) t.setStyle(TableStyle([ ("BACKGROUND", (0,0),(-1,-1), bg), ("BOX", (0,0),(-1,-1), 0.5, fg), ("TOPPADDING", (0,0),(-1,-1), 3), ("BOTTOMPADDING", (0,0),(-1,-1), 3), ("LEFTPADDING", (0,0),(-1,-1), 6), ("RIGHTPADDING", (0,0),(-1,-1), 6), ])) leg_cells.append(t) leg_cells.append(Spacer(1,1)) leg_para = Paragraph("Priority Legend:", S("_lp", fontSize=9, leading=12, textColor=DARK, fontName="Helvetica-Bold")) leg_tbl = Table([[leg_para] + leg_cells], colWidths=[2.5*cm]+[3.6*cm,0.2*cm]*4) leg_tbl.setStyle(TableStyle([ ("VALIGN",(0,0),(-1,-1),"MIDDLE"), ("TOPPADDING",(0,0),(-1,-1),0), ("BOTTOMPADDING",(0,0),(-1,-1),0), ("LEFTPADDING",(0,0),(-1,-1),0), ("RIGHTPADDING",(0,0),(-1,-1),0), ])) story.append(leg_tbl) story.append(sp(8)) # ── Main table ──────────────────────────────────────────────────────────────── # Header hdr_style = S("_hdr", fontSize=10, leading=13, textColor=WHT, fontName="Helvetica-Bold", alignment=TA_CENTER) table_rows = [[ Paragraph("TOPIC NAME", hdr_style), Paragraph("REPS", hdr_style), Paragraph("YEARS ASKED", hdr_style), Paragraph("PRIORITY", hdr_style), ]] style_cmds = [ # Header ("BACKGROUND", (0,0), (-1,0), HDR_BG), ("TEXTCOLOR", (0,0), (-1,0), WHT), ("TOPPADDING", (0,0), (-1,0), 7), ("BOTTOMPADDING", (0,0), (-1,0), 7), ("LEFTPADDING", (0,0), (-1,-1), 6), ("RIGHTPADDING", (0,0), (-1,-1), 6), ("VALIGN", (0,0), (-1,-1), "MIDDLE"), # Grid ("GRID", (0,0), (-1,-1), 0.3, colors.HexColor("#BDBDBD")), ("LINEBELOW", (0,0), (-1,0), 1.5, HDR_BG), ] row_idx = 1 for section_label, topics in data_sections: # Section sub-header sec_p = Paragraph("<b>%s</b>" % section_label, S("_sec"+section_label[:4], fontSize=9, leading=12, textColor=WHT, fontName="Helvetica-Bold")) table_rows.append([sec_p, "", "", ""]) style_cmds += [ ("BACKGROUND", (0,row_idx),(-1,row_idx), SEC_BG), ("SPAN", (0,row_idx),(-1,row_idx)), ("TOPPADDING", (0,row_idx),(-1,row_idx), 5), ("BOTTOMPADDING",(0,row_idx),(-1,row_idx), 5), ] row_idx += 1 for i, (topic, reps, years, priority) in enumerate(topics): # Alternating row bg based on priority fg, bg = PRIORITY_MAP.get(priority, (TXT, WHT)) topic_p = Paragraph(topic, S("_tp%s"%row_idx, fontSize=9, leading=13, textColor=TXT, fontName="Helvetica")) reps_p = Paragraph("<b>%s</b>" % reps, S("_rp%s"%row_idx, fontSize=11, leading=14, textColor=fg, fontName="Helvetica-Bold", alignment=TA_CENTER)) years_p = Paragraph(years, S("_yr%s"%row_idx, fontSize=8, leading=12, textColor=colors.HexColor("#555555"), fontName="Helvetica")) pri_p = Paragraph("<b>%s</b>" % priority, S("_pr%s"%row_idx, fontSize=8, leading=11, textColor=fg, fontName="Helvetica-Bold", alignment=TA_CENTER)) table_rows.append([topic_p, reps_p, years_p, pri_p]) row_bg = colors.HexColor("#FAFAFA") if i%2==0 else WHT style_cmds += [ ("BACKGROUND", (0,row_idx),(-1,row_idx), row_bg), ("BACKGROUND", (3,row_idx),( 3,row_idx), bg), ("TOPPADDING", (0,row_idx),(-1,row_idx), 4), ("BOTTOMPADDING", (0,row_idx),(-1,row_idx), 4), ] row_idx += 1 main_tbl = Table(table_rows, colWidths=CW, repeatRows=1) main_tbl.setStyle(TableStyle(style_cmds)) story.append(main_tbl) story.append(sp(10)) story.append(Paragraph( "Source: Identified Exam Trends & Favorites | MBBS Anatomy Paper 2019-2025", S("_ft", fontSize=8, leading=11, textColor=colors.HexColor("#9E9E9E"), fontName="Helvetica-Oblique", alignment=TA_CENTER))) doc.build(story) import os sz = os.path.getsize(output) print("Done. %s | %.1f KB" % (output, sz/1024)) PYEOF
Anatomy Topic Frequency
PDF Document · PDF