~/anatomy-pdf/generate_anatomy_pdf.py
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import mm, cm
from reportlab.platypus import (
SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
HRFlowable, PageBreak, KeepTogether
)
from reportlab.lib.enums import TA_CENTER, TA_LEFT
from reportlab.pdfgen import canvas
from reportlab.platypus.doctemplate import PageTemplate, BaseDocTemplate
from reportlab.platypus.frames import Frame
OUTPUT = "/home/daytona/workspace/anatomy-pdf/HighYield_Anatomy_QuickRef.pdf"
# ── Colour palette ──────────────────────────────────────────────────────────
NAVY = colors.HexColor("#1a2c5b")
TEAL = colors.HexColor("#0d7a8a")
AMBER = colors.HexColor("#e07b1a")
LGREY = colors.HexColor("#f0f4f8")
WHITE = colors.white
BLACK = colors.black
DKGREY = colors.HexColor("#333333")
# ── Custom document with header/footer ──────────────────────────────────────
class AnatomyDoc(BaseDocTemplate):
def __init__(self, filename, **kwargs):
super().__init__(filename, **kwargs)
frame = Frame(1.5*cm, 2*cm, 18*cm, 25.5*cm, id='normal')
template = PageTemplate(id='main', frames=[frame], onPage=self._draw_page)
self.addPageTemplates([template])
def _draw_page(self, canvas_obj, doc):
canvas_obj.saveState()
# Header bar
canvas_obj.setFillColor(NAVY)
canvas_obj.rect(0, A4[1]-1.5*cm, A4[0], 1.5*cm, fill=1, stroke=0)
canvas_obj.setFillColor(WHITE)
canvas_obj.setFont("Helvetica-Bold", 10)
canvas_obj.drawString(1.5*cm, A4[1]-1.0*cm, "HIGH-YIELD ANATOMY | MBBS Quick Reference")
canvas_obj.setFont("Helvetica", 8)
canvas_obj.drawRightString(A4[0]-1.5*cm, A4[1]-1.0*cm, f"Page {doc.page}")
# Footer bar
canvas_obj.setFillColor(NAVY)
canvas_obj.rect(0, 0, A4[0], 1.2*cm, fill=1, stroke=0)
canvas_obj.setFillColor(WHITE)
canvas_obj.setFont("Helvetica-Oblique", 7)
canvas_obj.drawCentredString(A4[0]/2, 0.45*cm, "For revision use only | July 2026")
canvas_obj.restoreState()
# ── Styles ───────────────────────────────────────────────────────────────────
styles = getSampleStyleSheet()
TITLE_STYLE = ParagraphStyle("title", fontName="Helvetica-Bold", fontSize=26,
textColor=WHITE, alignment=TA_CENTER, spaceAfter=4)
SUBTITLE_STYLE = ParagraphStyle("subtitle", fontName="Helvetica-Oblique", fontSize=12,
textColor=colors.HexColor("#cce0ff"), alignment=TA_CENTER, spaceAfter=0)
H1 = ParagraphStyle("h1", fontName="Helvetica-Bold", fontSize=13,
textColor=WHITE, backColor=NAVY, leftIndent=-4, rightIndent=-4,
spaceAfter=6, spaceBefore=14, leading=18,
borderPadding=(4,6,4,6))
H2 = ParagraphStyle("h2", fontName="Helvetica-Bold", fontSize=10,
textColor=TEAL, spaceBefore=8, spaceAfter=3)
BODY = ParagraphStyle("body", fontName="Helvetica", fontSize=8.5,
textColor=DKGREY, leading=13, spaceAfter=2)
BULLET = ParagraphStyle("bullet", fontName="Helvetica", fontSize=8.5,
textColor=DKGREY, leading=13, leftIndent=12, bulletIndent=2, spaceAfter=1)
CLINICAL = ParagraphStyle("clinical", fontName="Helvetica-Oblique", fontSize=8,
textColor=colors.HexColor("#8b0000"), leftIndent=8, leading=12, spaceAfter=2)
BOLD_CELL = ParagraphStyle("boldcell", fontName="Helvetica-Bold", fontSize=8, textColor=WHITE)
REG_CELL = ParagraphStyle("regcell", fontName="Helvetica", fontSize=8, textColor=DKGREY, leading=11)
def h1(text):
return Paragraph(f" {text}", H1)
def h2(text):
return Paragraph(text, H2)
def body(text):
return Paragraph(text, BODY)
def bullet(text):
return Paragraph(f"• {text}", BULLET)
def clinical(text):
return Paragraph(f"★ Clinical: {text}", CLINICAL)
def space(n=4):
return Spacer(1, n*mm)
def hr():
return HRFlowable(width="100%", thickness=0.5, color=TEAL, spaceAfter=4, spaceBefore=2)
def table(headers, rows, col_widths=None):
"""Generic shaded table."""
header_row = [Paragraph(h, BOLD_CELL) for h in headers]
data = [header_row]
for i, row in enumerate(rows):
data.append([Paragraph(str(c), REG_CELL) for c in row])
if col_widths is None:
col_widths = [18*cm / len(headers)] * len(headers)
t = Table(data, colWidths=col_widths, repeatRows=1)
style = TableStyle([
("BACKGROUND", (0,0), (-1,0), TEAL),
("ROWBACKGROUNDS", (0,1), (-1,-1), [LGREY, WHITE]),
("GRID", (0,0), (-1,-1), 0.3, colors.HexColor("#bbccd8")),
("VALIGN", (0,0), (-1,-1), "TOP"),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING", (0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 5),
])
t.setStyle(style)
return t
# ══════════════════════════════════════════════════════════════════════════════
# CONTENT
# ══════════════════════════════════════════════════════════════════════════════
story = []
# ── COVER ────────────────────────────────────────────────────────────────────
def cover_page(canvas_obj, doc):
"""Full-bleed cover - called via onFirstPage."""
pass # handled inline with a coloured table block
# Title block as a styled table
cover_data = [[Paragraph("HIGH-YIELD ANATOMY", TITLE_STYLE)],
[Paragraph("MBBS First Year | Quick Reference Guide", SUBTITLE_STYLE)],
[Paragraph("All Regions • Clinical Pearls • Key Tables", SUBTITLE_STYLE)]]
cover_table = Table(cover_data, colWidths=[18*cm])
cover_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), NAVY),
("TOPPADDING", (0,0), (-1,-1), 12),
("BOTTOMPADDING", (0,0), (-1,-1), 8),
("LEFTPADDING", (0,0), (-1,-1), 8),
("RIGHTPADDING", (0,0), (-1,-1), 8),
("LINEBELOW", (0,-1), (-1,-1), 3, AMBER),
]))
story += [space(8), cover_table, space(6)]
story.append(body("This reference card summarises the highest-yield anatomy topics for MBBS "
"first-year examinations. Use it alongside your 2-week revision plan. "
"Each section includes key facts, nerve supplies, clinical correlations, "
"and memory aids."))
story.append(PageBreak())
# ════════════════════════════════════════════════════════════════════════════
# 1. UPPER LIMB
# ════════════════════════════════════════════════════════════════════════════
story.append(h1("1. UPPER LIMB"))
story.append(space(2))
story.append(h2("Brachial Plexus - Roots to Branches"))
story.append(table(
["Component", "Roots", "Key Branches / Nerves"],
[
["Roots", "C5-C8, T1", "Dorsal scapular (C5), Long thoracic (C5-7)"],
["Trunks", "Upper (C5-6), Middle (C7), Lower (C8-T1)", "Suprascapular (upper trunk)"],
["Divisions", "3 Anterior + 3 Posterior", "—"],
["Cords", "Lateral, Posterior, Medial", "Named by relation to axillary artery"],
["Terminal Branches", "5 nerves", "Musculocutaneous, Axillary, Radial, Median, Ulnar"],
],
col_widths=[4*cm, 6*cm, 8*cm]
))
story.append(space(2))
story.append(h2("Key Nerve Injury Patterns"))
story.append(table(
["Nerve", "Root", "Injury Cause", "Deformity / Deficit"],
[
["Axillary (C5-6)", "C5,6", "Surgical neck humerus fracture / dislocation", "Flattened deltoid; loss of shoulder abduction >15°"],
["Radial (C5-T1)", "C5-T1", "Midshaft humerus fracture / Saturday night palsy", "Wrist drop; loss of extension fingers & wrist"],
["Median (C6-T1)", "C6-T1", "Supracondylar fracture (kids); carpal tunnel", "Ape hand; thenar wasting; Pope's blessing sign"],
["Ulnar (C8-T1)", "C8,T1", "Medial epicondyle fracture; cubital tunnel", "Claw hand (ring & little); froment sign"],
["Musculocutaneous (C5-7)", "C5-7", "Coracobrachialis piercing injury", "Weak elbow flexion; loss of lat forearm sensation"],
["Long Thoracic (C5-7)", "C5-7", "Mastectomy / axillary dissection", "Winged scapula"],
],
col_widths=[3.5*cm, 1.8*cm, 5*cm, 7.7*cm]
))
story.append(clinical("Erb's Palsy (C5-C6 injury): 'Waiter's tip' position - arm adducted, medially rotated, forearm pronated."))
story.append(clinical("Klumpke's Palsy (C8-T1): Claw hand + Horner syndrome (if T1 ramus communicans involved)."))
story.append(h2("Rotator Cuff - SITS"))
story.append(table(
["Muscle", "Nerve", "Action", "Common Pathology"],
[
["Supraspinatus", "Suprascapular (C4-6)", "Initiates abduction (0-15°)", "Most commonly torn (supraspinatus tendon)"],
["Infraspinatus", "Suprascapular (C4-6)", "Lateral rotation", "Torn in shoulder dislocation"],
["Teres Minor", "Axillary (C5-6)", "Lateral rotation", "—"],
["Subscapularis", "Upper/Lower subscapular", "Medial rotation", "Least commonly torn"],
],
col_widths=[3.5*cm, 4.5*cm, 4*cm, 6*cm]
))
story.append(PageBreak())
# ════════════════════════════════════════════════════════════════════════════
# 2. LOWER LIMB
# ════════════════════════════════════════════════════════════════════════════
story.append(h1("2. LOWER LIMB"))
story.append(space(2))
story.append(h2("Lumbar & Sacral Plexus Key Nerves"))
story.append(table(
["Nerve", "Root", "Motor", "Sensory", "Injury Cause"],
[
["Femoral", "L2-4", "Quadriceps (knee extension)", "Medial leg/foot", "Psoas haematoma; hip arthroplasty"],
["Obturator", "L2-4", "Hip adductors", "Medial thigh", "Pelvic surgery; obturator hernia"],
["Sciatic", "L4-S3", "Hamstrings + all below knee", "Posterior thigh + leg/foot", "Posterior hip dislocation; IM injection"],
["Common Fibular", "L4-S2", "Dorsiflexors, evertors", "Lateral leg, dorsum foot", "Fibular neck fracture"],
["Tibial", "L4-S3", "Plantar flexors, invertors", "Plantar foot", "Tarsal tunnel syndrome"],
["Superior Gluteal", "L4-S1", "Gluteus medius & minimus", "—", "Hip arthroplasty → Trendelenburg gait"],
["Inferior Gluteal", "L5-S2", "Gluteus maximus", "—", "Posterior hip surgery"],
],
col_widths=[3.2*cm, 1.6*cm, 4.5*cm, 3.8*cm, 4.9*cm]
))
story.append(clinical("Foot drop = common fibular nerve palsy; patient high-steps gait, cannot dorsiflex or evert."))
story.append(clinical("Trendelenburg sign: pelvis drops on unsupported side → superior gluteal nerve lesion ipsilateral."))
story.append(h2("Femoral Triangle & Femoral Canal"))
story.append(body("Boundaries: Inguinal ligament (superior) | Sartorius (lateral) | Adductor longus (medial) | Floor: iliopsoas + pectineus."))
story.append(body("Contents (lateral→medial): Nerve - Artery - Vein - Empty space - Lymphatics → mnemonic NAVEL"))
story.append(body("Femoral canal: most medial compartment of femoral sheath; contains lymphatics + fat; ring = site of femoral hernia."))
story.append(clinical("Femoral hernia: lateral to pubic tubercle, below inguinal ligament. More common in women. High risk of strangulation."))
story.append(h2("Hip Joint"))
story.append(body("Type: Synovial ball-and-socket. Head of femur (2/3 sphere) in acetabulum deepened by labrum."))
story.append(body("Blood supply to femoral head: Medial circumflex femoral artery (main) → at risk in subcapital fracture → avascular necrosis."))
story.append(clinical("Posterior hip dislocation: leg shortened, adducted, internally rotated. Sciatic nerve at risk."))
story.append(PageBreak())
# ════════════════════════════════════════════════════════════════════════════
# 3. THORAX
# ════════════════════════════════════════════════════════════════════════════
story.append(h1("3. THORAX"))
story.append(space(2))
story.append(h2("Heart - Surface Anatomy & Borders"))
story.append(table(
["Border", "Structure", "Surface Landmark"],
[
["Right border", "Right atrium", "Right sternal edge, 3rd-6th rib"],
["Left border", "Left ventricle (mostly) + left auricle", "Left sternal edge 2nd rib to apex"],
["Apex", "Left ventricle", "5th intercostal space, midclavicular line"],
["Base (posterior)", "Left atrium (mainly)", "Behind sternum, T5-T8 level"],
["Inferior (diaphragmatic)", "Right + left ventricles", "Rests on central tendon of diaphragm"],
],
col_widths=[4*cm, 7*cm, 7*cm]
))
story.append(h2("Coronary Arteries"))
story.append(table(
["Artery", "Origin", "Main Supply", "Occlusion Effect"],
[
["Left anterior descending (LAD)", "Left coronary artery", "Anterior LV, anterior 2/3 IVS, apex", "Anterior MI - most common ('widow maker')"],
["Left circumflex (LCx)", "Left coronary artery", "Lateral & posterior LV, LA", "Lateral/posterior MI"],
["Right coronary (RCA)", "Right aortic sinus", "RV, SA node (60%), AV node (80%), posterior IVS", "Inferior MI; heart block"],
],
col_widths=[4*cm, 4*cm, 5.5*cm, 4.5*cm]
))
story.append(clinical("Right dominant circulation (most people): RCA gives posterior interventricular artery."))
story.append(h2("Mediastinum Divisions"))
story.append(table(
["Division", "Key Contents"],
[
["Superior", "Thymus, SVC, arch of aorta & branches, trachea, oesophagus, thoracic duct, vagus, phrenic, left recurrent laryngeal"],
["Anterior (inf. ant.)", "Thymus remnant, fat, lymph nodes"],
["Middle", "Heart + pericardium, ascending aorta, SVC, bifurcation of trachea, phrenic nerves"],
["Posterior", "Descending aorta, oesophagus, thoracic duct, azygos vein, sympathetic trunk, vagus"],
],
col_widths=[4*cm, 14*cm]
))
story.append(clinical("Posterior mediastinal mass: think neurogenic tumour (commonest), oesophageal pathology, or descending aortic aneurysm."))
story.append(h2("Lung Lobes & Bronchopulmonary Segments"))
story.append(body("Right lung: 3 lobes (upper, middle, lower) | 10 segments | Oblique + horizontal fissures"))
story.append(body("Left lung: 2 lobes (upper, lower) | 8-10 segments | Oblique fissure only | Lingula = homologue of right middle lobe"))
story.append(clinical("Inhaled foreign body most likely in right lower lobe (wider, more vertical right main bronchus)."))
story.append(PageBreak())
# ════════════════════════════════════════════════════════════════════════════
# 4. ABDOMEN
# ════════════════════════════════════════════════════════════════════════════
story.append(h1("4. ABDOMEN"))
story.append(space(2))
story.append(h2("Peritoneal vs Retroperitoneal Structures"))
story.append(table(
["Retroperitoneal (SAD PUCKER)", "Intraperitoneal"],
[
["Suprarenal (adrenal) glands", "Stomach"],
["Aorta & IVC", "Liver, spleen, gallbladder"],
["Duodenum (2nd-4th parts)", "Jejunum & ileum"],
["Pancreas (body & tail; head retroperitoneal too)", "Transverse & sigmoid colon"],
["Ureters", "Ovaries / testes (intraperitoneal origin)"],
["Colon (ascending & descending)", "Appendix"],
["Kidneys", "—"],
["Rectum (lower 2/3)", "—"],
],
col_widths=[9*cm, 9*cm]
))
story.append(h2("Porta Hepatis Contents"))
story.append(body("Contents (anterior→posterior): Bile duct (right) | Hepatic artery (left) | Portal vein (posterior) → mnemonic: BD-HA-PV or 'Butter Has Protein'"))
story.append(clinical("Pringle's manoeuvre: compress hepatoduodenal ligament (contents of porta hepatis) to control liver haemorrhage."))
story.append(h2("Inguinal Canal"))
story.append(table(
["Feature", "Detail"],
[
["Length", "~4 cm; above medial half of inguinal ligament"],
["Deep ring", "Lateral to inferior epigastric vessels; in transversalis fascia"],
["Superficial ring", "Above pubic tubercle; in external oblique aponeurosis"],
["Roof", "Internal oblique + transversus abdominis (arching fibres)"],
["Floor", "Inguinal ligament + lacunar ligament (medially)"],
["Anterior wall", "External oblique (full length) + internal oblique (lateral 1/3)"],
["Posterior wall", "Transversalis fascia + conjoint tendon (medially)"],
["Male contents", "Spermatic cord: vas deferens, testicular artery, pampiniform plexus, cremasteric + genital branch of genitofemoral nerve"],
["Female contents", "Round ligament of uterus + ilioinguinal nerve"],
],
col_widths=[5*cm, 13*cm]
))
story.append(clinical("Indirect inguinal hernia: enters deep ring (lateral to inferior epigastric vessels), travels through canal. Congenital patent processus vaginalis."))
story.append(clinical("Direct inguinal hernia: pushes through Hesselbach's triangle (medial to inferior epigastric vessels). Acquired weakness."))
story.append(PageBreak())
# ════════════════════════════════════════════════════════════════════════════
# 5. HEAD & NECK
# ════════════════════════════════════════════════════════════════════════════
story.append(h1("5. HEAD & NECK"))
story.append(space(2))
story.append(h2("Cranial Nerves - High-Yield Summary"))
story.append(table(
["CN", "Name", "Type", "Key Function", "Test / Clinical"],
[
["I", "Olfactory", "S", "Smell", "Unilateral anosmia → anterior fossa fracture"],
["II", "Optic", "S", "Vision", "RAPD, visual field defects; optic disc oedema"],
["III", "Oculomotor", "M+Para", "Eye mvmt (except LR, SO); pupil constriction; lid", "'Down & out' pupil; ptosis; posterior communicating artery aneurysm"],
["IV", "Trochlear", "M", "SO → intorsion, depression of adducted eye", "Vertical diplopia, head tilt; longest intracranial course"],
["V", "Trigeminal", "S+M", "Face sensation (V1/V2/V3); mastication", "Corneal reflex afferent (V1); trigeminal neuralgia"],
["VI", "Abducens", "M", "Lateral rectus → abduction", "Medial squint; raised ICP (false localising sign)"],
["VII", "Facial", "M+S+Para", "Facial expression; taste ant. 2/3; lacrimal/salivary", "UMN (forehead spared) vs LMN (Bell's palsy, all face)"],
["VIII", "Vestibulocochlear", "S", "Hearing + balance", "SNHL, tinnitus, vertigo; acoustic neuroma"],
["IX", "Glossopharyngeal", "M+S+Para", "Stylopharyngeus; taste post. 1/3; parotid", "Gag reflex afferent; carotid sinus innervation"],
["X", "Vagus", "M+S+Para", "Larynx, pharynx, thoracoabdominal viscera", "Hoarseness (recurrent laryngeal); uvula deviates away"],
["XI", "Accessory", "M", "SCM + trapezius", "Can't shrug or turn head against resistance"],
["XII", "Hypoglossal", "M", "Tongue movements", "Tongue deviates TOWARD side of LMN lesion"],
],
col_widths=[0.8*cm, 3.2*cm, 1.2*cm, 5.5*cm, 7.3*cm]
))
story.append(h2("Triangles of the Neck"))
story.append(table(
["Triangle", "Boundaries", "Key Contents"],
[
["Anterior triangle", "Midline, SCM, lower border of mandible", "Carotid arteries, IJV, vagus, submandibular gland, thyroid"],
["Posterior triangle", "SCM (anterior), trapezius (posterior), clavicle (base)", "Accessory nerve (XI), brachial plexus trunks, subclavian vessels"],
["Carotid triangle", "Sub-triangle of anterior", "Common/internal/external carotid, IJV, CN X, XII"],
["Muscular triangle", "Sub-triangle of anterior", "Strap muscles, thyroid, trachea, oesophagus"],
],
col_widths=[4*cm, 7*cm, 7*cm]
))
story.append(clinical("Accessory nerve (XI) crosses posterior triangle - vulnerable in cervical lymph node biopsy → trapezius palsy, shoulder drop."))
story.append(clinical("Recurrent laryngeal nerve (branch of X): loops under aortic arch (left) / subclavian artery (right) → hooks up to larynx. Damaged in thyroid surgery, apical lung tumour → hoarseness."))
story.append(PageBreak())
# ════════════════════════════════════════════════════════════════════════════
# 6. NEUROANATOMY
# ════════════════════════════════════════════════════════════════════════════
story.append(h1("6. NEUROANATOMY"))
story.append(space(2))
story.append(h2("Spinal Cord Tracts"))
story.append(table(
["Tract", "Location in Cord", "Carries", "Features"],
[
["Dorsal columns (DCML)", "Posterior", "Fine touch, vibration, proprioception, 2-point discrimination", "Ipsilateral ascent; cross at medulla (decussation of medial lemniscus)"],
["Spinothalamic (ALS)", "Anterolateral", "Pain, temperature (anterior), crude touch", "Cross within 1-2 segments of entry; contralateral loss below lesion"],
["Corticospinal (lateral)", "Posterior lateral", "Voluntary motor", "Cross at pyramidal decussation (medulla); UMN signs below lesion"],
],
col_widths=[4*cm, 3*cm, 5.5*cm, 5.5*cm]
))
story.append(clinical("Brown-Séquard syndrome (hemisection): ipsilateral motor + DCML loss; contralateral pain & temperature loss below level."))
story.append(h2("Circle of Willis"))
story.append(body("Formed by: ICAs + basilar artery + communicating arteries."))
story.append(body("Anterior: ACA (x2) joined by anterior communicating artery."))
story.append(body("Posterior: PCA (x2) joined to ICA by posterior communicating artery (PComm)."))
story.append(clinical("PComm aneurysm: CN III palsy (first sign - fixed dilated pupil, 'down and out' eye)."))
story.append(clinical("ACA territory stroke: contralateral leg weakness > arm weakness (homunculus - leg area medial)."))
story.append(clinical("MCA territory stroke (most common): contralateral face & arm > leg; aphasia if dominant hemisphere."))
story.append(h2("Ventricular System & CSF"))
story.append(table(
["Structure", "Details"],
[
["Lateral ventricles (x2)", "Largest; in cerebral hemispheres; communicate via interventricular foramina (Monroe) with 3rd ventricle"],
["3rd ventricle", "Diencephalon (between thalami); CSF flows via cerebral aqueduct (Sylvius) to 4th ventricle"],
["4th ventricle", "Between pons/medulla and cerebellum; foramina of Luschka (x2 lateral) + Magendie (1 medial) → subarachnoid space"],
["CSF production", "Choroid plexus (mainly lateral ventricles); ~500 mL/day; total volume ~150 mL"],
["Absorption", "Arachnoid granulations → dural venous sinuses → IJV"],
],
col_widths=[4.5*cm, 13.5*cm]
))
story.append(clinical("Hydrocephalus: obstructive (non-communicating) vs communicating. Bulging fontanelle, 'sunset sign' eyes in infants."))
story.append(PageBreak())
# ════════════════════════════════════════════════════════════════════════════
# 7. EMBRYOLOGY HIGH-YIELD
# ════════════════════════════════════════════════════════════════════════════
story.append(h1("7. HIGH-YIELD EMBRYOLOGY"))
story.append(space(2))
story.append(table(
["Week", "Key Events"],
[
["Week 1", "Fertilisation → zygote → morula → blastocyst → implantation (day 6-7)"],
["Week 2", "Bilaminar disc (epiblast + hypoblast); primitive streak appears end of week 2"],
["Week 3", "Gastrulation → trilaminar disc (ectoderm, mesoderm, endoderm); notochord forms"],
["Week 3-4", "Neurulation: neural plate → neural tube (closes by day 28); somites form"],
["Week 4", "Heart begins to beat; limb buds; embryonic folding; pharyngeal arches appear"],
["Week 4-8", "Organogenesis - most sensitive to teratogens; all major organs formed"],
["Week 9+", "Fetal period: growth and maturation"],
],
col_widths=[3*cm, 15*cm]
))
story.append(space(2))
story.append(table(
["Defect", "Embryological Basis", "Presentation"],
[
["Spina bifida", "Failure of neural tube closure (posterior)", "Meningocele / myelomeningocele; associated with folate deficiency"],
["Anencephaly", "Failure of cranial neural tube closure", "Absent cerebral hemispheres; AFP elevated; incompatible with life"],
["Cleft lip", "Failure of fusion of maxillary + medial nasal process", "Unilateral or bilateral; may be isolated or with cleft palate"],
["Meckel's diverticulum", "Persistent vitello-intestinal (omphalomesenteric) duct", "2 inches long, 2 feet from ileocaecal valve, 2% population; may contain gastric/pancreatic tissue"],
["Patent ductus arteriosus", "Ductus arteriosus fails to close (kept open by PGE2)", "Continuous 'machinery' murmur; treat with indomethacin (NSAIDs)"],
["VSD", "Failure of interventricular septum formation", "Most common congenital heart defect"],
],
col_widths=[4*cm, 6*cm, 8*cm]
))
story.append(PageBreak())
# ════════════════════════════════════════════════════════════════════════════
# 8. MNEMONICS & QUICK-FIRE FACTS
# ════════════════════════════════════════════════════════════════════════════
story.append(h1("8. MNEMONICS & QUICK-FIRE FACTS"))
story.append(space(2))
story.append(h2("Mnemonics"))
mnemonics = [
("Brachial plexus", "Roots Trunks Divisions Cords Branches → 'Real Teens Drink Cold Beer'"),
("Carpal bones (lateral→medial, proximal row)", "Scaphoid, Lunate, Triquetrum, Pisiform → 'She Likes To Party'"),
("Carpal bones (distal row)", "Trapezium, Trapezoid, Capitate, Hamate → 'Then The Carpal Hurts'"),
("Structures under inguinal ligament (lateral→medial)", "Nerve, Artery, Vein, Y-fronts (empty), Lymphatics → NAVEL (Y = empty space)"),
("Cranial nerves", "I II III IV V VI VII VIII IX X XI XII → 'Oh Oh Oh To Touch And Feel Very Good Velvet AH!'"),
("Cranial nerve types (S/M/B)", "Some Say Marry Money But My Brother Says Big Brains Matter More → S/S/M/M/B/M/B/S/B/B/M/M"),
("Rotator cuff", "SITS: Supraspinatus, Infraspinatus, Teres minor, Subscapularis"),
("Femoral triangle contents", "NAVEL: Nerve, Artery, Vein, Empty canal, Lymphatics (lateral → medial)"),
("Layers of scalp", "SCALP: Skin, Connective tissue (dense), Aponeurosis (epicranial), Loose areolar tissue, Pericranium"),
("Thoracic duct drainage", "Drains everything EXCEPT right thorax, right upper limb, right head/neck (→ right lymphatic duct)"),
]
for title, content in mnemonics:
story.append(body(f"<b>{title}:</b> {content}"))
story.append(space(3))
story.append(h2("Quick-Fire High-Yield Facts"))
facts = [
"Longest nerve in body: Sciatic nerve (L4-S3)",
"Smallest bone: Stapes (ear ossicle)",
"Only bone not articulating with another bone: Hyoid",
"Kidney relations: Right kidney lower than left (displaced by liver). Left kidney related to tail of pancreas.",
"Most common site of Berry aneurysm: Anterior communicating artery (AComm) - ~35%",
"Foramen ovale closes at birth due to reversal of pressure gradient (LA > RA)",
"Diaphragm openings: T8 = IVC; T10 = oesophagus + vagus; T12 = aorta + thoracic duct + azygos (mnemonic: I 8 (ate) 10 eggs at 12)",
"Portal-systemic anastomoses: oesophageal, para-umbilical, rectal/anal, retroperitoneal - dilate in portal hypertension",
"Nerve to skin of medial thigh: Obturator (L2-4) - tested in obturator hernia (Howship-Romberg sign)",
"McBurney's point: 1/3 from ASIS to umbilicus - maximum tenderness in appendicitis",
"Commonest cause of primary amenorrhoea: Turner syndrome (45, XO) - streak gonads, short stature",
"Spermatic cord layers (outside-in): External spermatic fascia, cremasteric muscle/fascia, internal spermatic fascia",
]
for f in facts:
story.append(bullet(f))
story.append(PageBreak())
# ════════════════════════════════════════════════════════════════════════════
# 9. PELVIS & PERINEUM
# ════════════════════════════════════════════════════════════════════════════
story.append(h1("9. PELVIS & PERINEUM"))
story.append(space(2))
story.append(h2("Pelvic Floor Muscles"))
story.append(table(
["Muscle", "Origin → Insertion", "Nerve Supply", "Function"],
[
["Levator ani", "Body of pubis + ischial spine → perineal body, coccyx, anococcygeal raphe", "S3-4 + inferior rectal nerve", "Main pelvic floor support; urinary/faecal continence"],
["Pubococcygeus (part of LA)", "Pubis → coccyx", "S3-4", "Most important part; 'puborectalis sling' maintains anorectal angle"],
["Iliococcygeus (part of LA)", "Ischial spine + arcus tendineus → coccyx", "S3-4", "—"],
["Coccygeus", "Ischial spine → coccyx/sacrum", "S4-5", "Supports coccyx"],
],
col_widths=[3.5*cm, 6*cm, 4*cm, 4.5*cm]
))
story.append(clinical("Pelvic floor damage in childbirth → stress urinary incontinence; uterine prolapse."))
story.append(h2("Ureters - Key Relations"))
story.append(body("In females: ureter passes under uterine artery ('water under the bridge') - at risk in hysterectomy."))
story.append(body("In males: vas deferens crosses over ureter near bladder."))
story.append(body("Narrowings (sites of renal stone lodgement): (1) Pelviureteric junction (PUJ) | (2) Pelvic brim (crossing iliac vessels) | (3) Vesicoureteric junction (VUJ) - narrowest."))
story.append(clinical("Renal colic: loin-to-groin pain; haematuria. Stones most commonly lodge at VUJ."))
story.append(PageBreak())
# ════════════════════════════════════════════════════════════════════════════
# FINAL PAGE - REVISION TIPS
# ════════════════════════════════════════════════════════════════════════════
story.append(h1("10. REVISION STRATEGY TIPS"))
story.append(space(2))
tips = [
("Active recall over re-reading", "Close the book and write out the brachial plexus or cranial nerve table from memory. Check after. Repeat."),
("Draw diagrams", "The cross-section of spinal cord, circle of Willis, and brachial plexus are best understood visually. Draw them daily."),
("Teach it back", "Explain a nerve injury (e.g. radial nerve palsy) out loud as if teaching a classmate. Gaps become obvious."),
("Link structure to clinical", "Every muscle/nerve/vessel should be tied to at least one clinical scenario (fracture, surgery complication, hernia)."),
("Use the quiz feature", "Tell me 'quiz me on the lower limb' after each day's study. I'll fire questions at you."),
("Spaced repetition", "Day 1 → review Day 1 again on Day 3, then Day 7. Stops forgetting."),
]
for title, tip in tips:
story.append(body(f"<b>{title}:</b> {tip}"))
story.append(space(6))
story.append(hr())
footer_data = [[Paragraph(
"This quick reference was generated for your 2-week MBBS anatomy revision. "
"Combine with atlas diagrams (Netter / Gray's), past exam questions, and active recall quizzes for best results.",
ParagraphStyle("footer_note", fontName="Helvetica-Oblique", fontSize=8, textColor=TEAL, alignment=TA_CENTER)
)]]
footer_table = Table(footer_data, colWidths=[18*cm])
footer_table.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), LGREY),
("TOPPADDING", (0,0), (-1,-1), 8),
("BOTTOMPADDING", (0,0), (-1,-1), 8),
("LEFTPADDING", (0,0), (-1,-1), 10),
("RIGHTPADDING", (0,0), (-1,-1), 10),
]))
story.append(footer_table)
# ── BUILD ─────────────────────────────────────────────────────────────────
doc = AnatomyDoc(OUTPUT, pagesize=A4,
topMargin=1.8*cm, bottomMargin=1.5*cm,
leftMargin=1.5*cm, rightMargin=1.5*cm,
title="High-Yield Anatomy Quick Reference",
author="Orris AI")
doc.build(story)
print(f"PDF created: {OUTPUT}")