attachment
attachment
attachment
attachment

can u makes notes. for this in detail explain in easy word and easy to understand with diagrams and handwritten notes

analyse_media
analyse_media
Now I have all the content. Let me create detailed, easy-to-understand notes with diagrams using a PPTX/PDF approach. Let me first read the skill files to create a proper document.
Reading File
Running Command

mkdir -p /tmp/workspace/general-medicine-notes && ls /tmp/workspace/

Writing File

~/general-medicine-notes/create_notes.py

from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm, mm
from reportlab.platypus import (SimpleDocTemplate, Paragraph, Spacer, Table,
                                 TableStyle, HRFlowable, KeepTogether)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.pdfgen import canvas
from reportlab.platypus import BaseDocTemplate, Frame, PageTemplate, PageBreak
from reportlab.graphics.shapes import Drawing, Rect, Circle, String, Line, Polygon, Ellipse
from reportlab.graphics import renderPDF
import io

# ── Colour palette ──────────────────────────────────────────────────────────
NAVY      = colors.HexColor("#1a237e")
BLUE      = colors.HexColor("#1565c0")
LIGHT_BLUE= colors.HexColor("#e3f2fd")
TEAL      = colors.HexColor("#00695c")
TEAL_LIGHT= colors.HexColor("#e0f2f1")
ORANGE    = colors.HexColor("#e65100")
ORANGE_LIGHT = colors.HexColor("#fff3e0")
GREEN     = colors.HexColor("#2e7d32")
GREEN_LIGHT = colors.HexColor("#e8f5e9")
RED       = colors.HexColor("#c62828")
RED_LIGHT = colors.HexColor("#ffebee")
PURPLE    = colors.HexColor("#6a1b9a")
PURPLE_LIGHT = colors.HexColor("#f3e5f5")
YELLOW    = colors.HexColor("#f9a825")
YELLOW_LIGHT = colors.HexColor("#fffde7")
GRAY_BG   = colors.HexColor("#f5f5f5")
DARK_TEXT = colors.HexColor("#212121")
MID_GRAY  = colors.HexColor("#757575")
WHITE     = colors.white
BLACK     = colors.black

# ── Page template with lined background ─────────────────────────────────────
def draw_notebook_background(canv, doc):
    canv.saveState()
    w, h = A4
    # Cream background
    canv.setFillColor(colors.HexColor("#fffef7"))
    canv.rect(0, 0, w, h, fill=1, stroke=0)
    # Blue ruled lines
    canv.setStrokeColor(colors.HexColor("#d0e8ff"))
    canv.setLineWidth(0.4)
    y = h - 40
    while y > 20:
        canv.line(15, y, w - 15, y)
        y -= 22
    # Red margin line
    canv.setStrokeColor(colors.HexColor("#ffcdd2"))
    canv.setLineWidth(1)
    canv.line(50, h - 10, 50, 10)
    # Page number
    canv.setFont("Helvetica", 8)
    canv.setFillColor(MID_GRAY)
    canv.drawCentredString(w / 2, 10, f"General Medicine Notes  |  Page {doc.page}")
    canv.restoreState()


# ── Helper: coloured box heading ────────────────────────────────────────────
def section_header(text, bg=NAVY, fg=WHITE, font_size=15):
    style = ParagraphStyle("hdr", fontName="Helvetica-Bold",
                           fontSize=font_size, textColor=fg,
                           backColor=bg, borderPad=6,
                           leading=font_size + 4, alignment=TA_LEFT)
    return Paragraph(text, style)


def sub_header(text, color=BLUE):
    style = ParagraphStyle("sub", fontName="Helvetica-Bold",
                           fontSize=11, textColor=color, leading=14)
    return Paragraph(text, style)


def body(text, indent=0):
    style = ParagraphStyle("body", fontName="Helvetica",
                           fontSize=9.5, leading=14, leftIndent=indent,
                           textColor=DARK_TEXT, alignment=TA_JUSTIFY)
    return Paragraph(text, style)


def bullet(text, indent=20, color=BLUE):
    bullet_char = "<bullet>&bull;</bullet>"
    style = ParagraphStyle("bul", fontName="Helvetica",
                           fontSize=9.5, leading=13, leftIndent=indent,
                           bulletIndent=indent - 12, textColor=DARK_TEXT,
                           bulletColor=color)
    return Paragraph(f"<bullet><font color='#{color.hexval()[1:]}'>&#9658;</font></bullet> {text}", style)


def key_box(title, items, bg=LIGHT_BLUE, title_bg=BLUE):
    """Coloured key-points box."""
    data = [[Paragraph(f"<b><font color='white'>{title}</font></b>",
                       ParagraphStyle("kh", fontName="Helvetica-Bold",
                                      fontSize=10, textColor=WHITE))]]
    for item in items:
        data.append([Paragraph(f"&#9654; {item}",
                               ParagraphStyle("ki", fontName="Helvetica",
                                              fontSize=9, textColor=DARK_TEXT,
                                              leading=13))])
    tbl = Table(data, colWidths=[16*cm])
    tbl.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,0), title_bg),
        ("BACKGROUND", (0,1), (-1,-1), bg),
        ("BOX",        (0,0), (-1,-1), 0.8, title_bg),
        ("INNERGRID",  (0,0), (-1,-1), 0.3, colors.HexColor("#bbdefb")),
        ("TOPPADDING",  (0,0), (-1,-1), 4),
        ("BOTTOMPADDING",(0,0),(-1,-1), 4),
        ("LEFTPADDING", (0,0), (-1,-1), 8),
    ]))
    return tbl


def two_col_table(left_items, right_items, l_title="", r_title="",
                  l_bg=LIGHT_BLUE, r_bg=GREEN_LIGHT,
                  l_hdr=BLUE, r_hdr=GREEN):
    def make_cell(items, hdr_bg, body_bg, title):
        rows = []
        if title:
            rows.append(Paragraph(f"<b><font color='white'>{title}</font></b>",
                                   ParagraphStyle("th", fontName="Helvetica-Bold",
                                                  fontSize=9, textColor=WHITE)))
        for i in items:
            rows.append(Paragraph(f"&#9679; {i}",
                                   ParagraphStyle("td", fontName="Helvetica",
                                                  fontSize=8.5, leading=12)))
        return rows

    l_rows = make_cell(left_items, l_hdr, l_bg, l_title)
    r_rows = make_cell(right_items, r_hdr, r_bg, r_title)

    max_rows = max(len(l_rows), len(r_rows))
    while len(l_rows) < max_rows: l_rows.append(Spacer(1,1))
    while len(r_rows) < max_rows: r_rows.append(Spacer(1,1))

    data = list(zip(l_rows, r_rows))
    tbl = Table(data, colWidths=[7.8*cm, 7.8*cm], hAlign="LEFT")
    tbl.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (0, 0), l_hdr),
        ("BACKGROUND", (1,0), (1, 0), r_hdr),
        ("BACKGROUND", (0,1), (0,-1), l_bg),
        ("BACKGROUND", (1,1), (1,-1), r_bg),
        ("BOX",        (0,0), (-1,-1), 0.8, NAVY),
        ("INNERGRID",  (0,0), (-1,-1), 0.3, colors.HexColor("#cfd8dc")),
        ("VALIGN",     (0,0), (-1,-1), "TOP"),
        ("TOPPADDING",    (0,0),(-1,-1), 3),
        ("BOTTOMPADDING", (0,0),(-1,-1), 3),
        ("LEFTPADDING",   (0,0),(-1,-1), 6),
    ]))
    return tbl


# ── Simple ASCII-style diagram using a Drawing ───────────────────────────────
def infection_diagram():
    d = Drawing(400, 120)
    boxes = [("SOURCE\n(Bacteria/\nVirus)", 20, 40), ("SPREAD\n(Air/Water/\nContact)", 130, 40),
             ("HOST\n(Human\nBody)", 240, 40), ("DISEASE\n(Signs &\nSymptoms)", 330, 40)]
    colors_list = [RED, ORANGE, BLUE, GREEN]
    for i, (label, x, col) in enumerate(zip([b[0] for b in boxes],
                                             [b[1] for b in boxes],
                                             colors_list)):
        d.add(Rect(x, 25, 80, 70, fillColor=col, strokeColor=BLACK, strokeWidth=0.5,
                   rx=6, ry=6, fillOpacity=0.8))
        for j, line in enumerate(label.split("\n")):
            d.add(String(x+40, 80-j*12, line, fontSize=7.5, fillColor=WHITE,
                         fontName="Helvetica-Bold", textAnchor="middle"))
        if i < 3:
            d.add(Line(x+80, 60, x+110, 60, strokeColor=NAVY, strokeWidth=2))
            d.add(Polygon([x+110, 55, x+120, 60, x+110, 65],
                           fillColor=NAVY, strokeColor=NAVY))
    d.add(String(200, 8, "Chain of Infection", fontSize=9, fillColor=NAVY,
                 fontName="Helvetica-BoldOblique", textAnchor="middle"))
    return d


def diabetes_diagram():
    d = Drawing(420, 150)
    # Central circle
    d.add(Ellipse(210, 85, 55, 35, fillColor=ORANGE, strokeColor=ORANGE, fillOpacity=0.9))
    d.add(String(210, 80, "DIABETES", fontSize=9, fillColor=WHITE,
                 fontName="Helvetica-Bold", textAnchor="middle"))
    d.add(String(210, 68, "MELLITUS", fontSize=9, fillColor=WHITE,
                 fontName="Helvetica-Bold", textAnchor="middle"))
    # Satellites
    sats = [("Type 1\n(Autoimmune)", 60, 130, RED),
            ("Type 2\n(Insulin Resist.)", 60, 40, BLUE),
            ("Gestational\nDiabetes", 360, 130, GREEN),
            ("MODY\n(Genetic)", 360, 40, PURPLE)]
    for label, x, y, col in sats:
        d.add(Ellipse(x, y, 45, 25, fillColor=col, strokeColor=BLACK,
                      strokeWidth=0.5, fillOpacity=0.85))
        for j, line in enumerate(label.split("\n")):
            d.add(String(x, y+4-j*10, line, fontSize=7, fillColor=WHITE,
                         fontName="Helvetica-Bold", textAnchor="middle"))
        # line to centre
        d.add(Line(x + (40 if x < 200 else -40), y, 
                   210 + (-45 if x < 200 else 45), 85,
                   strokeColor=col, strokeWidth=1.2, strokeDashArray=[3,2]))
    d.add(String(210, 10, "Types of Diabetes Mellitus", fontSize=9,
                 fillColor=NAVY, fontName="Helvetica-BoldOblique", textAnchor="middle"))
    return d


def heart_diagram():
    d = Drawing(420, 140)
    # Big heart shape approximation using ellipse
    d.add(Ellipse(210, 75, 100, 55, fillColor=RED_LIGHT, strokeColor=RED, strokeWidth=1.5))
    d.add(String(210, 78, "HEART", fontSize=11, fillColor=RED,
                 fontName="Helvetica-Bold", textAnchor="middle"))
    d.add(String(210, 64, "Cardiovascular", fontSize=8, fillColor=DARK_TEXT,
                 fontName="Helvetica", textAnchor="middle"))
    # Labels around
    labels = [("Pericarditis", 60, 120), ("Myocarditis", 60, 40),
              ("Endocarditis", 360, 120), ("IHD / Angina", 360, 40),
              ("Hypertension", 210, 128), ("Cardiac Arrest", 210, 18)]
    arrow_colors = [BLUE, GREEN, PURPLE, ORANGE, RED, TEAL]
    for i, (lbl, x, y) in enumerate(labels):
        d.add(Rect(x-42, y-10, 84, 20, fillColor=arrow_colors[i],
                   strokeColor=BLACK, strokeWidth=0.3, rx=4, ry=4, fillOpacity=0.8))
        d.add(String(x, y+2, lbl, fontSize=7.5, fillColor=WHITE,
                     fontName="Helvetica-Bold", textAnchor="middle"))
    d.add(String(210, 2, "Heart Diseases Overview", fontSize=9,
                 fillColor=NAVY, fontName="Helvetica-BoldOblique", textAnchor="middle"))
    return d


def lung_diagram():
    d = Drawing(420, 140)
    # Left lung
    d.add(Ellipse(145, 75, 60, 50, fillColor=colors.HexColor("#e8eaf6"),
                  strokeColor=BLUE, strokeWidth=1.5))
    d.add(String(145, 78, "LEFT", fontSize=8, fillColor=BLUE,
                 fontName="Helvetica-Bold", textAnchor="middle"))
    d.add(String(145, 66, "LUNG", fontSize=8, fillColor=BLUE,
                 fontName="Helvetica-Bold", textAnchor="middle"))
    # Right lung
    d.add(Ellipse(275, 75, 60, 50, fillColor=colors.HexColor("#e8eaf6"),
                  strokeColor=BLUE, strokeWidth=1.5))
    d.add(String(275, 78, "RIGHT", fontSize=8, fillColor=BLUE,
                 fontName="Helvetica-Bold", textAnchor="middle"))
    d.add(String(275, 66, "LUNG", fontSize=8, fillColor=BLUE,
                 fontName="Helvetica-Bold", textAnchor="middle"))
    # Trachea
    d.add(Rect(200, 95, 20, 30, fillColor=TEAL_LIGHT, strokeColor=TEAL, strokeWidth=1))
    d.add(String(210, 113, "T", fontSize=7, fillColor=TEAL,
                 fontName="Helvetica-Bold", textAnchor="middle"))
    # Bronchi lines
    d.add(Line(200, 95, 175, 85, strokeColor=TEAL, strokeWidth=1.5))
    d.add(Line(220, 95, 245, 85, strokeColor=TEAL, strokeWidth=1.5))
    # Disease labels
    diseases = [("Asthma", 50, 125), ("COPD", 50, 108), ("Pneumonia", 350, 125),
                ("TB", 350, 108), ("Emphysema", 145, 20), ("Bronchitis", 275, 20)]
    cols2 = [RED, ORANGE, GREEN, PURPLE, BLUE, TEAL]
    for i, (name, x, y) in enumerate(diseases):
        d.add(Rect(x-32, y-8, 64, 16, fillColor=cols2[i], strokeColor=BLACK,
                   strokeWidth=0.3, rx=3, ry=3, fillOpacity=0.85))
        d.add(String(x, y+2, name, fontSize=7.5, fillColor=WHITE,
                     fontName="Helvetica-Bold", textAnchor="middle"))
    d.add(String(210, 4, "Respiratory System & Key Diseases", fontSize=9,
                 fillColor=NAVY, fontName="Helvetica-BoldOblique", textAnchor="middle"))
    return d


def gi_diagram():
    d = Drawing(420, 145)
    organs = [("Mouth/Esophagus", 210, 128, BLUE, 65, 14),
              ("Stomach", 180, 105, GREEN, 50, 14),
              ("Small Intestine", 210, 78, ORANGE, 70, 14),
              ("Large Intestine", 240, 52, TEAL, 70, 14),
              ("Liver/Gall Bladder", 100, 105, RED, 80, 14),
              ("Pancreas", 310, 100, PURPLE, 55, 14)]
    for name, x, y, col, w, h in organs:
        d.add(Rect(x-w//2, y-h//2, w, h, fillColor=col, strokeColor=BLACK,
                   strokeWidth=0.4, rx=4, ry=4, fillOpacity=0.85))
        d.add(String(x, y+2, name, fontSize=6.8, fillColor=WHITE,
                     fontName="Helvetica-Bold", textAnchor="middle"))
    # Connecting lines
    d.add(Line(210, 121, 180, 112, strokeColor=MID_GRAY, strokeWidth=1))
    d.add(Line(180, 98, 210, 85, strokeColor=MID_GRAY, strokeWidth=1))
    d.add(Line(210, 71, 240, 59, strokeColor=MID_GRAY, strokeWidth=1))
    d.add(String(210, 4, "Digestive System Overview", fontSize=9,
                 fillColor=NAVY, fontName="Helvetica-BoldOblique", textAnchor="middle"))
    return d


# ── Build the PDF ────────────────────────────────────────────────────────────
output_path = "/tmp/workspace/general-medicine-notes/General_Medicine_Notes.pdf"
doc = BaseDocTemplate(output_path, pagesize=A4,
                       leftMargin=60, rightMargin=30,
                       topMargin=30, bottomMargin=30)
frame = Frame(doc.leftMargin, doc.bottomMargin,
              doc.width, doc.height, id="main")
template = PageTemplate(id="notebook", frames=[frame],
                         onPage=draw_notebook_background)
doc.addPageTemplates([template])

story = []
SP = Spacer(1, 6)
SP2 = Spacer(1, 12)

# ════════════════════════════════════════════════════════════════════════════
# TITLE PAGE
# ════════════════════════════════════════════════════════════════════════════
title_style = ParagraphStyle("title", fontName="Helvetica-Bold",
                              fontSize=26, textColor=NAVY, leading=32,
                              alignment=TA_CENTER)
sub_title_style = ParagraphStyle("subtitle", fontName="Helvetica-BoldOblique",
                                  fontSize=13, textColor=TEAL, leading=18,
                                  alignment=TA_CENTER)
info_style = ParagraphStyle("info", fontName="Helvetica",
                             fontSize=10, textColor=DARK_TEXT, leading=16,
                             alignment=TA_CENTER)

story.append(Spacer(1, 50))
story.append(Paragraph("πŸ“‹ GENERAL MEDICINE", title_style))
story.append(Spacer(1, 10))
story.append(Paragraph("Detailed Study Notes", sub_title_style))
story.append(Spacer(1, 20))
story.append(HRFlowable(width="80%", thickness=2, color=BLUE, hAlign="CENTER"))
story.append(Spacer(1, 20))

info_data = [
    ["Subject Title", "GENERAL MEDICINE"],
    ["Duration", "25 - 36 Months"],
    ["Total Hours", "60 Hours"],
    ["Theory / Lecture", "2 Hours / Week"],
    ["Assessment", "Written"],
]
info_tbl = Table(info_data, colWidths=[5*cm, 10*cm], hAlign="CENTER")
info_tbl.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (0,-1), LIGHT_BLUE),
    ("BACKGROUND", (1,0), (1,-1), WHITE),
    ("FONTNAME",   (0,0), (0,-1), "Helvetica-Bold"),
    ("FONTNAME",   (1,0), (1,-1), "Helvetica"),
    ("FONTSIZE",   (0,0), (-1,-1), 10),
    ("TEXTCOLOR",  (0,0), (0,-1), NAVY),
    ("BOX",        (0,0), (-1,-1), 1, NAVY),
    ("INNERGRID",  (0,0), (-1,-1), 0.5, BLUE),
    ("TOPPADDING", (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0),(-1,-1), 5),
    ("LEFTPADDING",   (0,0),(-1,-1), 10),
]))
story.append(info_tbl)
story.append(Spacer(1, 20))
story.append(HRFlowable(width="80%", thickness=2, color=BLUE, hAlign="CENTER"))
story.append(Spacer(1, 15))

story.append(Paragraph("Topics Covered:", ParagraphStyle("tc", fontName="Helvetica-Bold",
                                                          fontSize=11, textColor=BLUE,
                                                          alignment=TA_CENTER)))
topics = ["1. Infection  |  2. Poisoning  |  3. Food & Nutrition",
          "4. Endocrine Diseases  |  5. Diseases of the Blood",
          "6. Digestive System  |  7. Cardiovascular Disease",
          "8. Respiratory Disease  |  9. Skin Diseases",
          "10. Pediatrics  |  11. Psychiatric Disorders"]
for t in topics:
    story.append(Paragraph(t, ParagraphStyle("tp", fontName="Helvetica",
                                              fontSize=10, textColor=DARK_TEXT,
                                              alignment=TA_CENTER, leading=16)))
story.append(PageBreak())

# ════════════════════════════════════════════════════════════════════════════
# UNIT 1 - INFECTION
# ════════════════════════════════════════════════════════════════════════════
story.append(section_header("  UNIT 1: INFECTION  [3 Hours]", NAVY))
story.append(SP)
story.append(body("Infection = When harmful germs (bacteria, viruses, fungi, parasites) enter the body and cause damage. Think of it like UNINVITED GUESTS breaking into your house and making a mess!"))
story.append(SP2)

story.append(sub_header("1.1 Chain of Infection (How it spreads)", BLUE))
story.append(SP)
story.append(infection_diagram())
story.append(SP2)

story.append(sub_header("1.2 Types of Infections", BLUE))
story.append(SP)
story.append(two_col_table(
    ["Localized - stays in one area (e.g. skin boil)",
     "Generalized - spreads throughout body",
     "Bacterial - caused by bacteria (e.g. TB, typhoid)",
     "Viral - caused by viruses (e.g. HIV, flu)"],
    ["Fungal - caused by fungi (e.g. ringworm)",
     "Parasitic - caused by parasites (e.g. malaria)",
     "Food poisoning - from contaminated food",
     "STDs - spread through sexual contact"],
    "TYPES A-D", "TYPES E-H", LIGHT_BLUE, GREEN_LIGHT
))
story.append(SP2)

story.append(key_box("VACCINATIONS - Your Body's Shield!", [
    "Vaccines train your immune system BEFORE the real infection arrives",
    "They contain weak/dead germs - your body learns to fight them",
    "Examples: BCG (TB), Polio vaccine, MMR (Measles, Mumps, Rubella)",
    "Herd Immunity: if 70-80% are vaccinated, whole community is protected",
], LIGHT_BLUE, BLUE))
story.append(SP2)

story.append(key_box("HIV & AIDS - Simple Explanation", [
    "HIV = Human Immunodeficiency Virus - attacks CD4 T-cells (your immune soldiers)",
    "AIDS = Acquired Immunodeficiency Syndrome - final stage of HIV infection",
    "Transmission: sexual contact, blood transfusion, sharing needles, mother to child",
    "Remember: HIV positive != AIDS. AIDS is diagnosed when CD4 count < 200 cells/uL",
    "Treatment: ART (Antiretroviral Therapy) - does not cure but controls the virus",
], RED_LIGHT, RED))
story.append(PageBreak())

# ════════════════════════════════════════════════════════════════════════════
# UNIT 2 - POISONING
# ════════════════════════════════════════════════════════════════════════════
story.append(section_header("  UNIT 2: POISONING  [2 Hours]", colors.HexColor("#b71c1c")))
story.append(SP)
story.append(body("Poisoning = entry of harmful substances into the body that disrupt normal function. Can be accidental, intentional, or occupational."))
story.append(SP2)

poison_data = [
    [Paragraph("<b><font color='white'>Category</font></b>",
               ParagraphStyle("ph", fontName="Helvetica-Bold", fontSize=9, textColor=WHITE)),
     Paragraph("<b><font color='white'>Examples</font></b>",
               ParagraphStyle("ph", fontName="Helvetica-Bold", fontSize=9, textColor=WHITE)),
     Paragraph("<b><font color='white'>Key Signs</font></b>",
               ParagraphStyle("ph", fontName="Helvetica-Bold", fontSize=9, textColor=WHITE))],
    [body("Pharmaceutical"), body("Paracetamol, Aspirin, Opioids"), body("Liver failure, bleeding, drowsiness")],
    [body("Pesticides"), body("Organophosphates, Rodenticides"), body("Excessive sweating, seizures, small pupils")],
    [body("Drugs of Misuse"), body("Heroin, Cocaine, Alcohol"), body("Altered consciousness, cardiac issues")],
    [body("Envenomation"), body("Snake bite, Scorpion sting"), body("Local swelling, paralysis, coagulopathy")],
    [body("Chemical"), body("Acid, Alkali, Carbon Monoxide"), body("Burns, headache, coma")],
]
poison_tbl = Table(poison_data, colWidths=[4*cm, 5.5*cm, 6*cm])
poison_tbl.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), RED),
    ("BACKGROUND", (0,1), (-1,-1), RED_LIGHT),
    ("ROWBACKGROUNDS", (0,1), (-1,-1), [RED_LIGHT, WHITE]),
    ("BOX",        (0,0), (-1,-1), 1, RED),
    ("INNERGRID",  (0,0), (-1,-1), 0.3, colors.HexColor("#ef9a9a")),
    ("TOPPADDING", (0,0),(-1,-1), 4),
    ("BOTTOMPADDING",(0,0),(-1,-1), 4),
    ("LEFTPADDING",(0,0),(-1,-1), 6),
]))
story.append(poison_tbl)
story.append(SP2)

story.append(key_box("General Management of Poisoning (ABCDE Approach)", [
    "A - Airway: ensure it's clear, intubate if needed",
    "B - Breathing: give oxygen if required",
    "C - Circulation: IV access, fluids, monitor BP & heart",
    "D - Disability: check consciousness (GCS score), give glucose",
    "E - Exposure & Antidote: identify poison, give specific antidote if available",
    "REMEMBER: Remove from exposure. Never induce vomiting for acid/alkali!",
], ORANGE_LIGHT, ORANGE))
story.append(PageBreak())

# ════════════════════════════════════════════════════════════════════════════
# UNIT 3 - FOOD AND NUTRITION
# ════════════════════════════════════════════════════════════════════════════
story.append(section_header("  UNIT 3: FOOD & NUTRITION  [4 Hours]", GREEN))
story.append(SP)
story.append(body("Nutrition is like FUEL for your body. Wrong fuel = body breaks down. Good nutrition = engine runs smoothly!"))
story.append(SP2)

story.append(sub_header("3.1 Nutritional Requirements (Daily Needs)", GREEN))
story.append(SP)

nutr_data = [
    [Paragraph("<b><font color='white'>Nutrient</font></b>", ParagraphStyle("nh", fontName="Helvetica-Bold", fontSize=9, textColor=WHITE)),
     Paragraph("<b><font color='white'>Function</font></b>", ParagraphStyle("nh", fontName="Helvetica-Bold", fontSize=9, textColor=WHITE)),
     Paragraph("<b><font color='white'>Deficiency Disease</font></b>", ParagraphStyle("nh", fontName="Helvetica-Bold", fontSize=9, textColor=WHITE))],
    [body("Carbohydrates"), body("Main energy source"), body("Fatigue, ketosis")],
    [body("Proteins"), body("Build & repair tissues"), body("Kwashiorkor, Marasmus")],
    [body("Fats"), body("Energy store, hormones"), body("Fat-soluble vitamin deficiency")],
    [body("Vitamin A"), body("Vision, immunity"), body("Night blindness, Xerophthalmia")],
    [body("Vitamin B12"), body("Nerve function, RBC"), body("Pernicious Anemia")],
    [body("Vitamin C"), body("Collagen synthesis"), body("Scurvy (gum bleeding)")],
    [body("Vitamin D"), body("Bone health (calcium)"), body("Rickets (children), Osteomalacia")],
    [body("Iron"), body("Oxygen transport in RBC"), body("Iron-deficiency Anemia")],
    [body("Iodine"), body("Thyroid hormone production"), body("Goitre, Hypothyroidism")],
]
nutr_tbl = Table(nutr_data, colWidths=[4*cm, 5*cm, 6.5*cm])
nutr_tbl.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), GREEN),
    ("ROWBACKGROUNDS", (0,1), (-1,-1), [GREEN_LIGHT, WHITE]),
    ("BOX",        (0,0), (-1,-1), 1, GREEN),
    ("INNERGRID",  (0,0), (-1,-1), 0.3, colors.HexColor("#a5d6a7")),
    ("TOPPADDING", (0,0),(-1,-1), 4),
    ("BOTTOMPADDING",(0,0),(-1,-1), 4),
    ("LEFTPADDING",(0,0),(-1,-1), 6),
]))
story.append(nutr_tbl)
story.append(SP2)

story.append(key_box("Protein-Energy Malnutrition (PEM)", [
    "MARASMUS = Severe lack of ALL nutrients (protein + calories). Looks like a skeleton!",
    "   Signs: severe wasting, very low weight, no edema, 'old man' face",
    "KWASHIORKOR = Protein deficiency with adequate calories",
    "   Signs: edema (swollen belly), hair color change, skin lesions, 'pot belly'",
    "Treatment: Feed slowly with therapeutic foods (F-75 then F-100 formula)",
], ORANGE_LIGHT, ORANGE))
story.append(SP2)

story.append(key_box("OBESITY - Causes, Effects & Management", [
    "Cause: More calories IN than OUT over long time. Also: genetics, hypothyroidism, medications",
    "BMI > 25 = Overweight   |   BMI > 30 = Obese   |   BMI > 40 = Morbidly Obese",
    "Complications: Diabetes, Hypertension, Heart disease, Sleep apnea, Joint problems",
    "Management: Diet (reduce 500 kcal/day) + Exercise (150 min/week) + Medications + Surgery (bariatric)",
], RED_LIGHT, RED))
story.append(PageBreak())

# ════════════════════════════════════════════════════════════════════════════
# UNIT 4 - ENDOCRINE DISEASES
# ════════════════════════════════════════════════════════════════════════════
story.append(section_header("  UNIT 4: ENDOCRINE DISEASES  [4 Hours]", ORANGE))
story.append(SP)
story.append(body("Endocrine system = Your body's MESSAGING SYSTEM. Glands release hormones (chemical messengers) that control almost every body function."))
story.append(SP2)

story.append(sub_header("4.1 Key Endocrine Glands & Their Jobs", ORANGE))
story.append(SP)
gland_data = [
    [Paragraph("<b><font color='white'>Gland</font></b>", ParagraphStyle("gh", fontName="Helvetica-Bold", fontSize=9, textColor=WHITE)),
     Paragraph("<b><font color='white'>Hormone</font></b>", ParagraphStyle("gh", fontName="Helvetica-Bold", fontSize=9, textColor=WHITE)),
     Paragraph("<b><font color='white'>Function</font></b>", ParagraphStyle("gh", fontName="Helvetica-Bold", fontSize=9, textColor=WHITE)),
     Paragraph("<b><font color='white'>Disorder if wrong</font></b>", ParagraphStyle("gh", fontName="Helvetica-Bold", fontSize=9, textColor=WHITE))],
    [body("Thyroid"), body("T3, T4"), body("Controls metabolism"), body("Hypo/Hyperthyroidism, Goitre")],
    [body("Pancreas"), body("Insulin, Glucagon"), body("Blood sugar control"), body("Diabetes Mellitus")],
    [body("Adrenal"), body("Cortisol, Adrenaline"), body("Stress response"), body("Cushing's, Addison's disease")],
    [body("Pituitary"), body("GH, TSH, ACTH..."), body("Controls other glands"), body("Gigantism, Acromegaly, Dwarfism")],
    [body("Parathyroid"), body("PTH"), body("Calcium regulation"), body("Hypo/Hyperparathyroidism")],
]
gland_tbl = Table(gland_data, colWidths=[3*cm, 3.5*cm, 4.5*cm, 4.5*cm])
gland_tbl.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), ORANGE),
    ("ROWBACKGROUNDS", (0,1), (-1,-1), [ORANGE_LIGHT, WHITE]),
    ("BOX",        (0,0), (-1,-1), 1, ORANGE),
    ("INNERGRID",  (0,0), (-1,-1), 0.3, YELLOW),
    ("TOPPADDING", (0,0),(-1,-1), 4),
    ("BOTTOMPADDING",(0,0),(-1,-1), 4),
    ("LEFTPADDING",(0,0),(-1,-1), 6),
]))
story.append(gland_tbl)
story.append(SP2)

story.append(sub_header("4.2 Diabetes Mellitus - The Most Common Endocrine Disease", ORANGE))
story.append(SP)
story.append(diabetes_diagram())
story.append(SP)

story.append(key_box("Diabetes - Signs & Symptoms (The 3 Ps + more)", [
    "Polyuria = Passing lots of urine (excess glucose pulls water out)",
    "Polydipsia = Excessive thirst (losing too much water)",
    "Polyphagia = Increased hunger (cells can't use glucose, brain thinks starving)",
    "Weight loss, fatigue, blurred vision, slow wound healing, frequent infections",
    "DKA (Diabetic Ketoacidosis): fruity breath, rapid breathing, vomiting - EMERGENCY!",
], YELLOW_LIGHT, YELLOW))
story.append(SP)

story.append(key_box("Diabetes Management (Simple Steps)", [
    "Type 1: Insulin injections (must - pancreas makes ZERO insulin)",
    "Type 2: Lifestyle change first, then Metformin, then other pills, then Insulin",
    "Diet: Low GI foods, reduce sugar & refined carbs, regular meals",
    "Exercise: 150 min moderate exercise per week - improves insulin sensitivity",
    "Monitor: Regular HbA1c (target < 7%), blood glucose, BP, kidney function, eye check",
    "Complications to watch: Eyes (retinopathy), Kidneys (nephropathy), Nerves (neuropathy), Feet!",
], ORANGE_LIGHT, ORANGE))
story.append(PageBreak())

# ════════════════════════════════════════════════════════════════════════════
# UNIT 5 - DISEASES OF THE BLOOD
# ════════════════════════════════════════════════════════════════════════════
story.append(section_header("  UNIT 5: DISEASES OF THE BLOOD  [4 Hours]", RED))
story.append(SP)
story.append(body("Blood = the body's TRANSPORT SYSTEM. Red cells carry oxygen, white cells fight infection, platelets stop bleeding, plasma carries nutrients."))
story.append(SP2)

story.append(sub_header("5.1 Anemia - Not Enough Oxygen Carriers", RED))
story.append(SP)

anemia_data = [
    [Paragraph("<b><font color='white'>Type of Anemia</font></b>", ParagraphStyle("ah", fontName="Helvetica-Bold", fontSize=9, textColor=WHITE)),
     Paragraph("<b><font color='white'>Cause</font></b>", ParagraphStyle("ah", fontName="Helvetica-Bold", fontSize=9, textColor=WHITE)),
     Paragraph("<b><font color='white'>Treatment</font></b>", ParagraphStyle("ah", fontName="Helvetica-Bold", fontSize=9, textColor=WHITE))],
    [body("Iron Deficiency"), body("Low iron - most common type"), body("Oral iron supplements, dietary iron")],
    [body("Vitamin B12 Deficiency"), body("Pernicious anemia, vegan diet"), body("B12 injections or supplements")],
    [body("Folate Deficiency"), body("Poor diet, pregnancy, alcohol"), body("Folic acid tablets")],
    [body("Sickle Cell"), body("Genetic - abnormal hemoglobin"), body("Hydroxyurea, transfusions, bone marrow transplant")],
    [body("Aplastic Anemia"), body("Bone marrow failure"), body("Stem cell transplant, immunosuppression")],
    [body("Hemolytic Anemia"), body("RBC destroyed too quickly"), body("Treat cause, steroids, splenectomy")],
]
anemia_tbl = Table(anemia_data, colWidths=[4*cm, 5*cm, 6.5*cm])
anemia_tbl.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), RED),
    ("ROWBACKGROUNDS", (0,1), (-1,-1), [RED_LIGHT, WHITE]),
    ("BOX",        (0,0), (-1,-1), 1, RED),
    ("INNERGRID",  (0,0), (-1,-1), 0.3, colors.HexColor("#ef9a9a")),
    ("TOPPADDING", (0,0),(-1,-1), 4), ("BOTTOMPADDING",(0,0),(-1,-1), 4),
    ("LEFTPADDING",(0,0),(-1,-1), 6),
]))
story.append(anemia_tbl)
story.append(SP2)

story.append(key_box("Common Signs of Anemia (PALE mnemonic)", [
    "P - Pallor (pale skin, pale conjunctiva - look inside lower eyelid!)",
    "A - Angina / shortness of breath (heart works harder)",
    "L - Lethargy (tiredness, weakness, can't concentrate)",
    "E - Exercise intolerance (palpitations on mild exertion)",
    "Also: Brittle nails, hair loss, swollen tongue (glossitis) in iron deficiency",
], RED_LIGHT, RED))
story.append(SP2)

story.append(key_box("HEMOPHILIA - When Blood Won't Clot", [
    "Cause: Genetic X-linked disorder - missing clotting factor VIII (Hemophilia A) or IX (Hemophilia B)",
    "Mostly affects MALES. Females are carriers.",
    "Signs: Prolonged bleeding after cuts, joint bleeding (hemarthrosis), deep muscle bleeds",
    "Severity: Mild (factor level 5-40%), Moderate (1-5%), Severe (<1%)",
    "Management: Factor VIII/IX replacement, DDAVP for mild cases",
    "Complications: Joint damage (from repeated bleeds), viral infections from blood products",
], PURPLE_LIGHT, PURPLE))
story.append(PageBreak())

# ════════════════════════════════════════════════════════════════════════════
# UNIT 6 - DIGESTIVE SYSTEM
# ════════════════════════════════════════════════════════════════════════════
story.append(section_header("  UNIT 6: DISEASES OF THE DIGESTIVE SYSTEM  [7 Hours]", TEAL))
story.append(SP)
story.append(body("The GI tract = a 9-metre long tube that processes food. Think of it as a FACTORY ASSEMBLY LINE from mouth to rectum."))
story.append(SP2)

story.append(gi_diagram())
story.append(SP2)

gi_conditions = [
    ("Peptic Ulcer Disease", "H. pylori infection or NSAID use damages stomach lining", "Burning epigastric pain, worse before meals", "Antacids, PPIs (omeprazole), H. pylori eradication"),
    ("GERD (Reflux Oesophagitis)", "Stomach acid flows back up into oesophagus", "Heartburn, regurgitation, worse lying down", "Lifestyle changes, PPIs, antacids"),
    ("Pancreatitis", "Inflammation of pancreas (alcohol, gallstones)", "Severe upper abdominal pain radiating to back", "Nil by mouth, IV fluids, pain relief"),
    ("Ulcerative Colitis", "Inflammatory bowel disease - colon & rectum", "Bloody diarrhoea, urgency, cramping", "Aminosalicylates, steroids, biologics"),
    ("Viral Hepatitis", "Liver inflammation by Hepatitis A/B/C/D/E virus", "Jaundice, fatigue, dark urine, pale stools", "Rest, antivirals (Hep B/C), avoid alcohol"),
    ("Cholecystitis", "Gallbladder inflammation (usually from gallstones)", "RUQ pain after fatty meals, fever, nausea", "Antibiotics, cholecystectomy (surgery)"),
]

for condition, cause, features, treatment in gi_conditions:
    story.append(sub_header(f"β€’ {condition}", TEAL))
    tbl_data = [
        [Paragraph("<b>Cause:</b>", ParagraphStyle("cl", fontName="Helvetica-Bold", fontSize=9, textColor=TEAL)),
         body(cause)],
        [Paragraph("<b>Features:</b>", ParagraphStyle("fl", fontName="Helvetica-Bold", fontSize=9, textColor=RED)),
         body(features)],
        [Paragraph("<b>Treatment:</b>", ParagraphStyle("tl", fontName="Helvetica-Bold", fontSize=9, textColor=GREEN)),
         body(treatment)],
    ]
    mini_tbl = Table(tbl_data, colWidths=[2.5*cm, 13*cm])
    mini_tbl.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (0,-1), TEAL_LIGHT),
        ("BACKGROUND", (1,0), (1,-1), WHITE),
        ("BOX",        (0,0), (-1,-1), 0.5, TEAL),
        ("INNERGRID",  (0,0), (-1,-1), 0.2, colors.HexColor("#b2dfdb")),
        ("TOPPADDING", (0,0),(-1,-1), 3), ("BOTTOMPADDING",(0,0),(-1,-1), 3),
        ("LEFTPADDING",(0,0),(-1,-1), 5),
    ]))
    story.append(mini_tbl)
    story.append(SP)
story.append(PageBreak())

# ════════════════════════════════════════════════════════════════════════════
# UNIT 7 - CARDIOVASCULAR
# ════════════════════════════════════════════════════════════════════════════
story.append(section_header("  UNIT 7: CARDIOVASCULAR DISEASE  [8 Hours]", RED))
story.append(SP)
story.append(body("The heart is a PUMP that beats ~100,000 times/day. Even a slight malfunction can be life-threatening!"))
story.append(SP2)

story.append(heart_diagram())
story.append(SP2)

story.append(sub_header("7.1 Investigations of the Heart", BLUE))
story.append(SP)
story.append(key_box("Key Cardiac Investigations", [
    "ECG (Electrocardiogram): Records electrical activity of heart. Detects arrhythmias, MI, hypertrophy",
    "Exercise Stress Test (Treadmill): ECG during exercise - detects ischaemia that appears on exertion",
    "Echocardiogram: Ultrasound of heart - shows structure, valves, ejection fraction",
    "Chest X-ray: Shows heart size, pulmonary oedema, pleural effusion",
    "Coronary Angiography: Gold standard for coronary artery disease - dye injected to visualise arteries",
], LIGHT_BLUE, BLUE))
story.append(SP2)

cardio_conditions = [
    ("Ischaemic Heart Disease (IHD)", "Atherosclerosis (fatty plaques) in coronary arteries", "Chest pain (angina), dyspnoea, pain radiates to arm/jaw", "GTN spray, aspirin, statins, beta-blockers, angioplasty/CABG"),
    ("Hypertension", "Unknown (essential) or secondary to kidney/hormonal disease", "Usually NO symptoms! Can cause headache, visual changes", "Lifestyle + ACE inhibitors, Calcium channel blockers, Diuretics"),
    ("Pericarditis", "Viral infection, autoimmune, post-MI", "Sharp chest pain, worse lying flat, better leaning forward", "NSAIDs, colchicine, treat cause"),
    ("Heart Failure", "Damaged heart muscle (IHD, HTN, valvular disease)", "Dyspnoea on exertion, orthopnoea, ankle swelling, fatigue", "ACE inhibitors, beta-blockers, diuretics, spironolactone"),
    ("Cardiac Arrest", "VF/VT, massive MI, PE, electrolyte imbalance", "No pulse, no breathing, unconsciousness", "CPR immediately, defibrillation, adrenaline, ABCDE"),
]
for condition, cause, features, treatment in cardio_conditions:
    story.append(sub_header(f"β€’ {condition}", RED))
    tbl_data = [
        [Paragraph("<b>Cause:</b>", ParagraphStyle("cl2", fontName="Helvetica-Bold", fontSize=9, textColor=ORANGE)),
         body(cause)],
        [Paragraph("<b>Features:</b>", ParagraphStyle("fl2", fontName="Helvetica-Bold", fontSize=9, textColor=RED)),
         body(features)],
        [Paragraph("<b>Treatment:</b>", ParagraphStyle("tl2", fontName="Helvetica-Bold", fontSize=9, textColor=GREEN)),
         body(treatment)],
    ]
    mini_tbl = Table(tbl_data, colWidths=[2.5*cm, 13*cm])
    mini_tbl.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (0,-1), RED_LIGHT),
        ("BACKGROUND", (1,0), (1,-1), WHITE),
        ("BOX",        (0,0), (-1,-1), 0.5, RED),
        ("INNERGRID",  (0,0), (-1,-1), 0.2, colors.HexColor("#ef9a9a")),
        ("TOPPADDING", (0,0),(-1,-1), 3), ("BOTTOMPADDING",(0,0),(-1,-1), 3),
        ("LEFTPADDING",(0,0),(-1,-1), 5),
    ]))
    story.append(mini_tbl)
    story.append(SP)
story.append(PageBreak())

# ════════════════════════════════════════════════════════════════════════════
# UNIT 8 - RESPIRATORY
# ════════════════════════════════════════════════════════════════════════════
story.append(section_header("  UNIT 8: RESPIRATORY DISEASE  [9 Hours]", BLUE))
story.append(SP)
story.append(body("Breathing = OXYGEN IN, CO2 OUT. The lungs are like BELLOWS that never stop working. Even a small blockage can cause serious problems."))
story.append(SP2)

story.append(lung_diagram())
story.append(SP2)

story.append(sub_header("8.1 COPD vs Restrictive Lung Disease", BLUE))
story.append(SP)
story.append(two_col_table(
    ["Obstructive: difficult to BREATHE OUT",
     "Air gets trapped in lungs",
     "FEV1/FVC ratio < 0.7",
     "Causes: Smoking, pollution",
     "Examples: Asthma, Emphysema, Chronic Bronchitis"],
    ["Restrictive: lungs CANNOT expand fully",
     "Less air gets in",
     "FVC reduced, FEV1/FVC normal",
     "Causes: Fibrosis, obesity, scoliosis",
     "Examples: Pulmonary fibrosis, Sarcoidosis"],
    "OBSTRUCTIVE (COPD)", "RESTRICTIVE",
    LIGHT_BLUE, TEAL_LIGHT, BLUE, TEAL
))
story.append(SP2)

resp_conditions = [
    ("Asthma", "Allergens, cold air, exercise, infections trigger airway inflammation", "Wheeze, cough (esp. night), breathlessness, chest tightness - REVERSIBLE", "SABA inhaler (salbutamol) for acute, ICS for prevention, avoid triggers"),
    ("Pneumonia", "Bacterial (Strep pneumoniae most common), viral, fungal infection of alveoli", "Fever, cough with purulent sputum, pleuritic chest pain, consolidation on X-ray", "Antibiotics (amoxicillin for CAP), oxygen, fluids, physiotherapy"),
    ("Tuberculosis (TB)", "Mycobacterium tuberculosis - spread by respiratory droplets", "Chronic cough (>3 weeks), haemoptysis, night sweats, weight loss, fever", "RIPE therapy: Rifampicin, Isoniazid, Pyrazinamide, Ethambutol x 6 months"),
    ("Pulmonary Embolism", "Blood clot in pulmonary artery (usually from DVT in leg)", "Sudden dyspnoea, pleuritic chest pain, haemoptysis, tachycardia", "Anticoagulation (heparin then warfarin/DOAC), thrombolysis if severe"),
]
for condition, cause, features, treatment in resp_conditions:
    story.append(sub_header(f"β€’ {condition}", BLUE))
    tbl_data = [
        [Paragraph("<b>Cause:</b>", ParagraphStyle("cl3", fontName="Helvetica-Bold", fontSize=9, textColor=TEAL)),
         body(cause)],
        [Paragraph("<b>Features:</b>", ParagraphStyle("fl3", fontName="Helvetica-Bold", fontSize=9, textColor=RED)),
         body(features)],
        [Paragraph("<b>Treatment:</b>", ParagraphStyle("tl3", fontName="Helvetica-Bold", fontSize=9, textColor=GREEN)),
         body(treatment)],
    ]
    mini_tbl = Table(tbl_data, colWidths=[2.5*cm, 13*cm])
    mini_tbl.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (0,-1), LIGHT_BLUE),
        ("BACKGROUND", (1,0), (1,-1), WHITE),
        ("BOX",        (0,0), (-1,-1), 0.5, BLUE),
        ("INNERGRID",  (0,0), (-1,-1), 0.2, colors.HexColor("#90caf9")),
        ("TOPPADDING", (0,0),(-1,-1), 3), ("BOTTOMPADDING",(0,0),(-1,-1), 3),
        ("LEFTPADDING",(0,0),(-1,-1), 5),
    ]))
    story.append(mini_tbl)
    story.append(SP)
story.append(PageBreak())

# ════════════════════════════════════════════════════════════════════════════
# UNIT 9 - SKIN
# ════════════════════════════════════════════════════════════════════════════
story.append(section_header("  UNIT 9: DISEASES OF THE SKIN  [6 Hours]", PURPLE))
story.append(SP)
story.append(body("Skin = Body's FIRST LINE OF DEFENSE. It protects against infection, regulates temperature, and provides sensation. When it breaks down, serious problems follow!"))
story.append(SP2)

skin_data = [
    [Paragraph("<b><font color='white'>Condition</font></b>", ParagraphStyle("sk", fontName="Helvetica-Bold", fontSize=9, textColor=WHITE)),
     Paragraph("<b><font color='white'>Cause</font></b>", ParagraphStyle("sk", fontName="Helvetica-Bold", fontSize=9, textColor=WHITE)),
     Paragraph("<b><font color='white'>Key Features</font></b>", ParagraphStyle("sk", fontName="Helvetica-Bold", fontSize=9, textColor=WHITE)),
     Paragraph("<b><font color='white'>Treatment</font></b>", ParagraphStyle("sk", fontName="Helvetica-Bold", fontSize=9, textColor=WHITE))],
    [body("Leprosy"), body("Mycobacterium leprae"), body("Loss of sensation in patches, nerve thickening, deformity"), body("MDT: Rifampicin + Dapsone Β± Clofazimine")],
    [body("Psoriasis"), body("Autoimmune (T-cell mediated)"), body("Well-defined red scaly plaques on elbows, knees, scalp"), body("Topical steroids, Vitamin D analogues, biologics")],
    [body("Eczema / Dermatitis"), body("Allergic, contact, or atopic"), body("Itchy, red, weeping, scaly skin"), body("Emollients, topical steroids, antihistamines")],
    [body("Fungal Infections"), body("Candida, Tinea (ringworm)"), body("Ring-shaped rash, itchy, scaling. Oral thrush = white patches"), body("Antifungals: clotrimazole cream, fluconazole")],
    [body("Viral (Herpes/Warts)"), body("HSV, HPV, Varicella-Zoster"), body("Painful blisters (herpes), warts, vesicular rash (shingles)"), body("Acyclovir for herpes, cryotherapy for warts")],
]
skin_tbl = Table(skin_data, colWidths=[3*cm, 3.5*cm, 5*cm, 4*cm])
skin_tbl.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), PURPLE),
    ("ROWBACKGROUNDS", (0,1), (-1,-1), [PURPLE_LIGHT, WHITE]),
    ("BOX",        (0,0), (-1,-1), 1, PURPLE),
    ("INNERGRID",  (0,0), (-1,-1), 0.3, colors.HexColor("#ce93d8")),
    ("TOPPADDING", (0,0),(-1,-1), 4), ("BOTTOMPADDING",(0,0),(-1,-1), 4),
    ("LEFTPADDING",(0,0),(-1,-1), 5),
    ("FONTSIZE",   (0,0), (-1,-1), 8.5),
]))
story.append(skin_tbl)
story.append(PageBreak())

# ════════════════════════════════════════════════════════════════════════════
# UNIT 10 - PEDIATRICS
# ════════════════════════════════════════════════════════════════════════════
story.append(section_header("  UNIT 10: PEDIATRICS  [8 Hours]", colors.HexColor("#0277bd")))
story.append(SP)
story.append(body("Pediatrics = Medical care of children (0-18 years). Children are NOT just small adults - their bodies, diseases, and treatments are different!"))
story.append(SP2)

story.append(key_box("Low Birth Weight (LBW) Infants", [
    "LBW = Birth weight < 2500 grams",
    "Causes: Prematurity, intrauterine growth restriction (IUGR), infection, maternal malnutrition",
    "Problems: Hypothermia (can't regulate temperature), Hypoglycaemia, Respiratory Distress Syndrome",
    "Management: Kangaroo Mother Care (skin-to-skin), incubator warmth, early feeding, oxygen if needed",
], LIGHT_BLUE, BLUE))
story.append(SP2)

story.append(key_box("Cerebral Palsy (CP)", [
    "Definition: Non-progressive motor disorder due to brain damage before/during/after birth",
    "Causes: Prematurity, birth asphyxia, infections (meningitis), jaundice (kernicterus), trauma",
    "Types: Spastic (most common - stiff muscles), Athetoid (involuntary movements), Ataxic (balance problems)",
    "Features: Delayed milestones, abnormal posture, spasticity, speech difficulties",
    "Treatment: Physiotherapy (KEY!), speech therapy, occupational therapy, medications for spasticity, surgery",
], TEAL_LIGHT, TEAL))
story.append(SP2)

story.append(key_box("Epilepsy in Children", [
    "Definition: Recurrent unprovoked seizures due to abnormal brain electrical activity",
    "Types: Grand mal (tonic-clonic), Absence seizures (blank staring), Febrile seizures",
    "Diagnosis: EEG (electroencephalogram), MRI brain, blood tests",
    "Treatment: Sodium valproate, Carbamazepine, Phenobarbitone. Status epilepticus = diazepam IV!",
    "Key: Most children OUTGROW epilepsy. Education of parents is vital for safety!",
], YELLOW_LIGHT, YELLOW))
story.append(SP2)

story.append(key_box("Developmental Delay - Red Flags", [
    "Not smiling by 2 months | Not sitting by 9 months | Not walking by 18 months",
    "No speech by 18 months | Losing previously gained skills = REGRESSION (serious sign!)",
    "Causes: CP, Down syndrome, Autism, hearing/vision loss, hypothyroidism, abuse/neglect",
    "AUTISM: Social communication difficulties, restricted interests, repetitive behaviors",
    "Management: Early intervention is KEY - speech therapy, OT, PT, special education",
], ORANGE_LIGHT, ORANGE))
story.append(PageBreak())

# ════════════════════════════════════════════════════════════════════════════
# UNIT 11 - PSYCHIATRY
# ════════════════════════════════════════════════════════════════════════════
story.append(section_header("  UNIT 11: PSYCHIATRIC DISORDERS  [5 Hours]", colors.HexColor("#4a148c")))
story.append(SP)
story.append(body("Psychiatry = Diseases of the MIND. Just like any other organ, the brain can malfunction. Mental illness is a medical condition, NOT a character weakness!"))
story.append(SP2)

psych_data = [
    [Paragraph("<b><font color='white'>Disorder</font></b>", ParagraphStyle("ps", fontName="Helvetica-Bold", fontSize=9, textColor=WHITE)),
     Paragraph("<b><font color='white'>Key Features</font></b>", ParagraphStyle("ps", fontName="Helvetica-Bold", fontSize=9, textColor=WHITE)),
     Paragraph("<b><font color='white'>Treatment</font></b>", ParagraphStyle("ps", fontName="Helvetica-Bold", fontSize=9, textColor=WHITE))],
    [body("Depression"), body("Low mood, loss of interest (anhedonia), sleep disturbance, worthlessness, suicidal thoughts"), body("CBT + SSRIs (Fluoxetine, Sertraline)")],
    [body("Anxiety Disorder"), body("Excessive worry, panic attacks, palpitations, sweating, avoidance behaviour"), body("CBT, SSRIs, relaxation techniques")],
    [body("Schizophrenia"), body("Hallucinations (hearing voices), delusions, disorganized thinking, negative symptoms"), body("Antipsychotics (Haloperidol, Olanzapine), CBT")],
    [body("Bipolar Disorder"), body("Alternating mania (euphoria, no sleep needed) and depression episodes"), body("Mood stabilizers (Lithium, Valproate), antipsychotics")],
    [body("OCD"), body("Obsessive thoughts + compulsive behaviours to reduce anxiety (e.g. repeated hand washing)"), body("CBT (ERP therapy), SSRIs (high dose)")],
    [body("PTSD"), body("After trauma: flashbacks, nightmares, hypervigilance, avoidance"), body("Trauma-focused CBT, EMDR, SSRIs")],
]
psych_tbl = Table(psych_data, colWidths=[3.5*cm, 6.5*cm, 5.5*cm])
psych_tbl.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), PURPLE),
    ("ROWBACKGROUNDS", (0,1), (-1,-1), [PURPLE_LIGHT, WHITE]),
    ("BOX",        (0,0), (-1,-1), 1, PURPLE),
    ("INNERGRID",  (0,0), (-1,-1), 0.3, colors.HexColor("#ce93d8")),
    ("TOPPADDING", (0,0),(-1,-1), 4), ("BOTTOMPADDING",(0,0),(-1,-1), 4),
    ("LEFTPADDING",(0,0),(-1,-1), 5),
]))
story.append(psych_tbl)
story.append(SP2)

story.append(key_box("Classification Systems Used in Psychiatry", [
    "ICD-11 (WHO): International Classification of Diseases - used in UK, India, most of world",
    "DSM-5 (APA): Diagnostic and Statistical Manual - used primarily in USA",
    "Both classify by symptoms and duration, NOT by biological tests (no blood test for depression!)",
    "Common treatments: Psychotherapy (talk therapy), Pharmacotherapy (medications), ECT (shock therapy for severe depression)",
], PURPLE_LIGHT, PURPLE))
story.append(SP2)

# ── Recommended Books ────────────────────────────────────────────────────────
story.append(HRFlowable(width="100%", thickness=2, color=NAVY))
story.append(SP)
story.append(section_header("  RECOMMENDED TEXTBOOKS", NAVY))
story.append(SP)
books = [
    ["1", "Davidson's Principles and Practice of Medicine", "Most comprehensive clinical medicine textbook"],
    ["2", "Harrison's Internal Medicine", "Gold standard for internal medicine - very detailed"],
    ["3", "Braunwald's Heart Disease", "Definitive cardiology textbook"],
    ["4", "Text Book of Cardiology by Hurst", "Practical cardiology reference"],
]
book_tbl = Table(books, colWidths=[1*cm, 7*cm, 7.5*cm])
book_tbl.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,-1), LIGHT_BLUE),
    ("ROWBACKGROUNDS", (0,0), (-1,-1), [LIGHT_BLUE, WHITE]),
    ("TEXTCOLOR", (0,0), (-1,-1), DARK_TEXT),
    ("FONTNAME", (0,0), (-1,-1), "Helvetica"),
    ("FONTSIZE", (0,0), (-1,-1), 9.5),
    ("BOX",      (0,0), (-1,-1), 1, NAVY),
    ("INNERGRID",(0,0), (-1,-1), 0.3, BLUE),
    ("TOPPADDING", (0,0),(-1,-1), 6), ("BOTTOMPADDING",(0,0),(-1,-1), 6),
    ("LEFTPADDING",(0,0),(-1,-1), 8),
]))
story.append(book_tbl)
story.append(SP2)
story.append(Paragraph(
    "<i>These notes are a simplified overview for study purposes. Always refer to the recommended textbooks for complete clinical details.</i>",
    ParagraphStyle("disc", fontName="Helvetica-Oblique", fontSize=8.5,
                   textColor=MID_GRAY, alignment=TA_CENTER)
))

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

cd /tmp/workspace/general-medicine-notes && python create_notes.py 2>&1

Running Command

ls -lh /tmp/workspace/general-medicine-notes/

Your General Medicine Notes PDF is ready! Here's what's included:

General Medicine Notes

PDF Document Β· PDF


What's Inside the Notes:

The PDF has a notebook-style background (ruled lines + red margin, just like real handwritten notes) and covers all 11 units from your syllabus:
UnitTopicHours
1Infection - Chain of infection diagram, HIV/AIDS, Vaccinations3 hrs
2Poisoning - Table of poisons + ABCDE management box2 hrs
3Food & Nutrition - Nutrient deficiency table, PEM (Kwashiorkor vs Marasmus), Obesity4 hrs
4Endocrine Diseases - Gland table, Diabetes diagram (4 types), 3 Ps mnemonic4 hrs
5Blood Diseases - Anemia types table, PALE mnemonic, Hemophilia4 hrs
6Digestive System - GI diagram, 6 conditions with cause/features/treatment7 hrs
7Cardiovascular - Heart diagram, ECG/investigations, 5 conditions explained8 hrs
8Respiratory - Lung diagram, COPD vs Restrictive table, Asthma/Pneumonia/TB/PE9 hrs
9Skin Diseases - Leprosy, Psoriasis, Eczema, Fungal infections6 hrs
10Pediatrics - LBW, Cerebral Palsy, Epilepsy, Developmental delay, Autism8 hrs
11Psychiatry - Depression, Schizophrenia, Bipolar, OCD, PTSD table5 hrs

Key Features:

  • Color-coded sections - each unit has its own color for easy navigation
  • Diagrams - Chain of Infection, Diabetes types, Heart diseases, Lung anatomy, GI tract
  • Easy-to-read tables - cause / features / treatment for every condition
  • Memory boxes - mnemonics like PALE for anemia, 3 Ps for diabetes, ABCDE for poisoning
  • Recommended books listed at the end

I don't wants I want brief explanation in easy words hand written note

Asking for Preferences

What format do you want the handwritten-style notes in? Β· Which units do you want notes for?

Got it! PDF with handwritten-style font, all 11 units, brief & easy words. Let me create it now.
Running Command

python3 -c "import matplotlib.font_manager as fm; fonts = [f.name for f in fm.fontManager.ttflist]; hw = [f for f in fonts if any(x in f.lower() for x in ['hand', 'comic', 'cursive', 'chalk', 'indie', 'caveat', 'pacifico', 'shadow', 'patrick', 'kalam', 'dancing'])]; print(hw[:20])"

Running Command

pip install --user requests --quiet && python3 -c " import urllib.request, os # Download a free handwriting font (Patrick Hand from Google Fonts CDN) url = 'https://fonts.gstatic.com/s/patrickhand/v23/LDI1apSQOAYtSuYWp8ZweqbFnZpA.ttf' out = '/tmp/workspace/general-medicine-notes/PatrickHand.ttf' urllib.request.urlretrieve(url, out) print('Downloaded:', os.path.getsize(out), 'bytes') "

Running Command

python3 -c " # Check available system fonts import matplotlib.font_manager as fm import os # List all available font files font_dirs = ['/usr/share/fonts', '/usr/local/share/fonts', os.path.expanduser('~/.fonts')] for d in font_dirs: if os.path.exists(d): for root, dirs, files in os.walk(d): for f in files: if f.lower().endswith(('.ttf', '.otf')): print(os.path.join(root, f)) " 2>/dev/null | head -30

I'll use Matplotlib to draw genuine handwritten-looking pages as images and compile them into a PDF - this will look much more like real handwritten notes with a paper texture.
Writing File

~/general-medicine-notes/handwritten_notes.py

import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from matplotlib.patches import FancyBboxPatch, FancyArrowPatch
import matplotlib.patheffects as pe
import numpy as np
from matplotlib.backends.backend_pdf import PdfPages
import warnings
warnings.filterwarnings('ignore')

# ── Colour palette ───────────────────────────────────────────────────────────
PAPER   = "#fffef5"
LINE_C  = "#c8d8f0"
MARGIN  = "#ffb3b3"
INK     = "#1a1a2e"
BLUE    = "#1565c0"
RED     = "#c62828"
GREEN   = "#2e7d32"
ORANGE  = "#e65100"
PURPLE  = "#6a1b9a"
TEAL    = "#00695c"
YELLOW  = "#f9a825"
BOX_BG  = {
    "blue":   "#e3f2fd",
    "red":    "#ffebee",
    "green":  "#e8f5e9",
    "orange": "#fff3e0",
    "purple": "#f3e5f5",
    "teal":   "#e0f2f1",
    "yellow": "#fffde7",
}

# ── Page setup helper ────────────────────────────────────────────────────────
def new_page():
    fig, ax = plt.subplots(figsize=(8.27, 11.69))   # A4
    fig.patch.set_facecolor(PAPER)
    ax.set_facecolor(PAPER)
    ax.set_xlim(0, 8.27)
    ax.set_ylim(0, 11.69)
    ax.axis('off')

    # Horizontal ruled lines
    for y in np.arange(0.3, 11.69, 0.38):
        ax.axhline(y, color=LINE_C, lw=0.5, zorder=0)

    # Red margin line
    ax.axvline(0.9, color=MARGIN, lw=1.2, zorder=1)

    # Spiral holes
    for y in np.arange(10.8, 0.5, -1.5):
        circ = plt.Circle((0.25, y), 0.07, color="#d0d0d0", zorder=5)
        ax.add_patch(circ)

    return fig, ax


def t(ax, x, y, text, size=11, color=INK, weight='normal', style='normal',
       ha='left', va='bottom', alpha=1.0, family='DejaVu Sans'):
    """Draw text with slight handwriting-like imperfection."""
    ax.text(x, y, text, fontsize=size, color=color, fontweight=weight,
            fontstyle=style, ha=ha, va=va, alpha=alpha,
            fontfamily=family, zorder=10)


def heading(ax, y, text, color=BLUE, size=14, underline=True):
    """Section heading with underline."""
    ax.text(1.05, y, text, fontsize=size, color=color, fontweight='bold',
            fontstyle='italic', va='bottom', zorder=10)
    if underline:
        xlen = len(text) * size * 0.012
        ax.plot([1.05, min(1.05 + xlen, 7.9)], [y - 0.02, y - 0.02],
                color=color, lw=1.5, zorder=9)


def bullet_line(ax, x, y, text, color=BLUE, size=10.5):
    ax.text(x - 0.18, y + 0.06, "➀", fontsize=8, color=color, va='bottom', zorder=10)
    ax.text(x, y, text, fontsize=size, color=INK, va='bottom', zorder=10)


def box(ax, x, y, w, h, bg="blue", title="", title_color=None):
    """Coloured sticky-note style box."""
    bg_c = BOX_BG.get(bg, "#f5f5f5")
    title_c = title_color or {"blue": BLUE, "red": RED, "green": GREEN,
                               "orange": ORANGE, "purple": PURPLE,
                               "teal": TEAL, "yellow": YELLOW}.get(bg, BLUE)
    rect = FancyBboxPatch((x, y), w, h, boxstyle="round,pad=0.04",
                           facecolor=bg_c, edgecolor=title_c, linewidth=1.2, zorder=8)
    ax.add_patch(rect)
    if title:
        ax.text(x + 0.12, y + h - 0.04, title, fontsize=9.5, color=title_c,
                fontweight='bold', va='top', zorder=11)
    return y + h - 0.28   # y position to start writing inside (from top)


def star(ax, x, y, color=YELLOW):
    ax.text(x, y, "β˜…", fontsize=9, color=color, va='bottom', zorder=10)


def arrow_right(ax, x, y, length=0.4, color=BLUE):
    ax.annotate("", xy=(x + length, y + 0.1), xytext=(x, y + 0.1),
                arrowprops=dict(arrowstyle="->", color=color, lw=1.2), zorder=10)


# ════════════════════════════════════════════════════════════════════════════
# PAGE 1 - TITLE + UNIT 1: INFECTION
# ════════════════════════════════════════════════════════════════════════════
def page_title_infection():
    fig, ax = new_page()

    # Title banner
    rect = FancyBboxPatch((0.9, 10.9), 6.8, 0.65, boxstyle="round,pad=0.05",
                           facecolor=BLUE, edgecolor=BLUE, zorder=8)
    ax.add_patch(rect)
    ax.text(4.3, 11.27, "πŸ“‹  GENERAL MEDICINE  β€”  STUDY NOTES",
            fontsize=14, color="white", fontweight='bold', ha='center',
            va='center', zorder=11)

    ax.text(4.3, 10.68, "All 11 Units  |  Brief & Easy to Understand",
            fontsize=9.5, color=BLUE, ha='center', va='bottom',
            fontstyle='italic', zorder=10)

    # Subject info box
    ax.text(1.05, 10.38, "Subject:", fontsize=9, color=TEAL, fontweight='bold')
    ax.text(2.2, 10.38, "General Medicine  |  60 Hrs  |  2 Hrs/Week  |  Assessment: Written", fontsize=9, color=INK)

    # UNIT 1 heading
    heading(ax, 9.9, "UNIT 1 β€” INFECTION  (3 hrs)", color=RED)

    t(ax, 1.05, 9.55, "πŸ”‘ Infection = Harmful germs enter body β†’ cause disease", size=10.5, color=INK)

    # Chain of infection - simple arrow diagram
    ax.text(1.05, 9.15, "HOW IT SPREADS  (Chain of Infection):", fontsize=9.5, color=BLUE, fontweight='bold')
    steps = [("SOURCE\n(Germ)", 1.3, RED), ("SPREAD\n(Air/Water/Touch)", 2.7, ORANGE),
             ("HOST\n(Human Body)", 4.4, BLUE), ("DISEASE\n(Illness)", 5.9, GREEN)]
    for label, xc, col in steps:
        rect2 = FancyBboxPatch((xc - 0.5, 8.45), 1.0, 0.52,
                                boxstyle="round,pad=0.04", facecolor=col,
                                edgecolor=col, alpha=0.85, zorder=8)
        ax.add_patch(rect2)
        lines = label.split("\n")
        ax.text(xc, 8.75 - (0.13 if len(lines) > 1 else 0), lines[0],
                fontsize=7.5, color="white", fontweight='bold',
                ha='center', va='center', zorder=11)
        if len(lines) > 1:
            ax.text(xc, 8.56, lines[1], fontsize=6.5, color="white",
                    ha='center', va='center', zorder=11)

    for xarr in [1.8, 3.2, 4.9]:
        ax.annotate("", xy=(xarr + 0.4, 8.71), xytext=(xarr, 8.71),
                    arrowprops=dict(arrowstyle="->", color="#555", lw=1.5), zorder=10)

    # Types
    ax.text(1.05, 8.2, "Types:", fontsize=9.5, color=BLUE, fontweight='bold')
    types_txt = [
        "β€’ Bacterial (TB, Typhoid)  β€’ Viral (HIV, Flu)  β€’ Fungal (Ringworm)",
        "β€’ Localized (skin boil) vs Generalized (spreads all over body)",
        "β€’ Food poisoning  β€’ STDs (sexually transmitted)  β€’ HIV / AIDS"
    ]
    for i, ln in enumerate(types_txt):
        t(ax, 1.05, 7.88 - i * 0.3, ln, size=9.8)

    # HIV box
    box(ax, 1.05, 6.6, 6.2, 1.0, bg="red", title="β˜… HIV & AIDS  (Remember This!)")
    lines_hiv = [
        "HIV = virus attacks CD4 cells (immune soldiers) β†’ AIDS = final stage (CD4 < 200)",
        "Spread: unprotected sex, sharing needles, blood, mother→child",
        "Tx: ART (antiretroviral therapy) β€” controls virus, can't cure"
    ]
    for i, ln in enumerate(lines_hiv):
        t(ax, 1.2, 7.35 - i * 0.27, f"➀ {ln}", size=9.2, color="#b71c1c")

    # Vaccination box
    box(ax, 1.05, 5.45, 6.2, 0.95, bg="green", title="β˜… Vaccinations")
    vac = ["Train immune system BEFORE real infection arrives",
           "BCG (TB), Polio, MMR (Measles/Mumps/Rubella), Hepatitis B",
           "Herd Immunity: 70-80% vaccinated β†’ whole community protected"]
    for i, ln in enumerate(vac):
        t(ax, 1.2, 6.1 - i * 0.27, f"➀ {ln}", size=9.2, color=GREEN)

    # UNIT 2 heading
    heading(ax, 5.1, "UNIT 2 β€” POISONING  (2 hrs)", color=RED)

    t(ax, 1.05, 4.78, "πŸ”‘ Poisoning = harmful substance enters body β†’ disrupts normal function", size=10.5)

    ax.text(1.05, 4.5, "ABCDE Management:", fontsize=9.5, color=RED, fontweight='bold')
    abcde = ["A β€” Airway: keep it clear", "B β€” Breathing: give oxygen",
             "C β€” Circulation: IV line, fluids", "D β€” Disability: check consciousness",
             "E β€” Exposure: identify poison, give antidote"]
    for i, ln in enumerate(abcde):
        t(ax, 1.15, 4.22 - i * 0.28, f"  {ln}", size=9.5)

    ax.text(1.05, 2.88, "Common Poisons:", fontsize=9.5, color=ORANGE, fontweight='bold')
    poisons = ["β€’ Pharmaceutical (paracetamol, opioids) β†’ liver failure, sedation",
               "β€’ Pesticides (organophosphates) β†’ sweating, seizures, small pupils",
               "β€’ Envenomation (snake/scorpion) β†’ swelling, paralysis, bleeding",
               "β€’ ⚠ Never induce vomiting for acid/alkali poisons!"]
    for i, ln in enumerate(poisons):
        t(ax, 1.1, 2.6 - i * 0.28, ln, size=9.5)

    # page number
    ax.text(4.1, 0.12, "β€” Page 1 β€”  General Medicine Notes", fontsize=8,
            color="#aaa", ha='center', fontstyle='italic')
    return fig


# ════════════════════════════════════════════════════════════════════════════
# PAGE 2 - UNIT 3: NUTRITION + UNIT 4: ENDOCRINE
# ════════════════════════════════════════════════════════════════════════════
def page_nutrition_endocrine():
    fig, ax = new_page()

    heading(ax, 11.45, "UNIT 3 β€” FOOD & NUTRITION  (4 hrs)", color=GREEN)

    t(ax, 1.05, 11.1, "πŸ”‘ Food = fuel for body. Wrong fuel = body breaks down!", size=10.5)

    ax.text(1.05, 10.82, "Key Deficiency Diseases:", fontsize=9.5, color=GREEN, fontweight='bold')
    defs = [
        "β€’ Vitamin A β†’ Night blindness (can't see in dark)",
        "β€’ Vitamin C β†’ Scurvy (gum bleeding, wounds won't heal)",
        "β€’ Vitamin D β†’ Rickets in kids / Osteomalacia in adults (soft bones)",
        "β€’ Iron      β†’ Anemia (pale, tired, breathless)",
        "β€’ Iodine    β†’ Goitre / Hypothyroidism (swollen neck, slow metabolism)",
        "β€’ Vitamin B12 β†’ Pernicious Anemia (nerve damage + tired)",
    ]
    for i, ln in enumerate(defs):
        t(ax, 1.1, 10.54 - i * 0.28, ln, size=9.5)

    # PEM box
    box(ax, 1.05, 8.55, 6.2, 1.35, bg="orange", title="β˜… PEM β€” Protein Energy Malnutrition")
    pem = [
        "MARASMUS = lacks BOTH protein + calories",
        "  β†’ Looks like skeleton: very thin, no fat, 'old man' face, no oedema",
        "KWASHIORKOR = only protein deficient (has some calories)",
        "  β†’ Pot belly, swollen legs, hair colour change, skin patches",
        "Tx: Therapeutic feeding (F-75 formula first, then F-100)",
    ]
    for i, ln in enumerate(pem):
        t(ax, 1.2, 9.6 - i * 0.27, ln, size=9.2, color=ORANGE)

    # Obesity
    box(ax, 1.05, 7.45, 6.2, 0.87, bg="red", title="Obesity")
    ob = ["BMI>25=Overweight  BMI>30=Obese  BMI>40=Morbid",
          "Causes: Excess calories, genetics, hormones (thyroid)",
          "Tx: Diet (-500 kcal/day) + Exercise + Meds + Surgery (bariatric)"]
    for i, ln in enumerate(ob):
        t(ax, 1.2, 8.02 - i * 0.27, f"➀ {ln}", size=9, color=RED)

    # UNIT 4
    heading(ax, 7.05, "UNIT 4 β€” ENDOCRINE DISEASES  (4 hrs)", color=ORANGE)
    t(ax, 1.05, 6.72, "πŸ”‘ Endocrine = glands release hormones (chemical messengers)", size=10.5)

    ax.text(1.05, 6.44, "Key Glands:", fontsize=9.5, color=ORANGE, fontweight='bold')
    glands = [
        ("Thyroid",    "T3/T4 β†’ metabolism",   "Hypo/Hyperthyroidism, Goitre"),
        ("Pancreas",   "Insulin β†’ blood sugar", "Diabetes Mellitus"),
        ("Adrenal",    "Cortisol β†’ stress",     "Cushing's / Addison's"),
        ("Pituitary",  "Controls all glands",   "Gigantism / Dwarfism"),
    ]
    ax.text(1.1, 6.18, "Gland", fontsize=8.5, color=BLUE, fontweight='bold')
    ax.text(2.5, 6.18, "Hormone / Job", fontsize=8.5, color=BLUE, fontweight='bold')
    ax.text(4.8, 6.18, "Disease if wrong", fontsize=8.5, color=RED, fontweight='bold')
    ax.plot([1.05, 7.8], [6.1, 6.1], color="#ccc", lw=0.8)
    for i, (g, h, d) in enumerate(glands):
        yy = 5.83 - i * 0.3
        t(ax, 1.1, yy, g, size=9.5, color=TEAL, weight='bold')
        t(ax, 2.5, yy, h, size=9.2)
        t(ax, 4.8, yy, d, size=9.2, color=RED)
        ax.plot([1.05, 7.8], [yy - 0.06, yy - 0.06], color="#eee", lw=0.5)

    # Diabetes
    box(ax, 1.05, 3.0, 6.2, 1.55, bg="orange", title="β˜… DIABETES MELLITUS β€” Most Important!")
    dm = [
        "Type 1: Autoimmune β†’ NO insulin made β†’ daily injections needed",
        "Type 2: Cells resist insulin β†’ most common (lifestyle related)",
        "3 P's β†’ Polyuria (lots of pee)  Polydipsia (lots of thirst)  Polyphagia (lots of hunger)",
        "Plus: weight loss, blurred vision, slow wound healing",
        "Tx: Diet + Exercise β†’ Metformin β†’ other pills β†’ Insulin",
        "Check: HbA1c (target <7%), eyes, kidneys, feet every year!",
    ]
    for i, ln in enumerate(dm):
        t(ax, 1.2, 4.25 - i * 0.28, f"➀ {ln}", size=9.2, color=ORANGE)

    ax.text(1.05, 2.78, "Diabetes Complications (6 things to remember):", fontsize=9, color=RED, fontweight='bold')
    comp = "Eyes (Retinopathy)  |  Kidneys (Nephropathy)  |  Nerves (Neuropathy)"
    t(ax, 1.1, 2.5, comp, size=9.5)
    comp2 = "Feet (Ulcers)  |  Heart (IHD)  |  Brain (Stroke)"
    t(ax, 1.1, 2.22, comp2, size=9.5)

    ax.text(4.1, 0.12, "β€” Page 2 β€”  General Medicine Notes", fontsize=8,
            color="#aaa", ha='center', fontstyle='italic')
    return fig


# ════════════════════════════════════════════════════════════════════════════
# PAGE 3 - UNIT 5: BLOOD + UNIT 6: DIGESTIVE
# ════════════════════════════════════════════════════════════════════════════
def page_blood_digestive():
    fig, ax = new_page()

    heading(ax, 11.45, "UNIT 5 β€” DISEASES OF THE BLOOD  (4 hrs)", color=RED)
    t(ax, 1.05, 11.1, "πŸ”‘ Blood = transport system. RBC (O2), WBC (fight infection), Platelets (clotting)", size=10)

    ax.text(1.05, 10.82, "ANEMIA β€” Not enough oxygen carriers:", fontsize=9.5, color=RED, fontweight='bold')
    ax.text(1.1, 10.58, "Signs: PALE skin, tiredness, breathlessness, fast heart beat", fontsize=9.5, color=INK)
    anemias = [
        ("Iron Deficiency", "(most common)", "Iron tablets, eat leafy veggies/meat"),
        ("B12 Deficiency",  "(nerve damage)", "B12 injections"),
        ("Sickle Cell",     "(genetic)",       "Hydroxyurea, transfusions"),
        ("Aplastic",        "(marrow failure)", "Bone marrow transplant"),
    ]
    ax.text(1.1, 10.32, "Type", fontsize=8.5, color=BLUE, fontweight='bold')
    ax.text(3.0, 10.32, "Note", fontsize=8.5, color=MID := "#777", fontweight='bold')
    ax.text(4.6, 10.32, "Treatment", fontsize=8.5, color=GREEN, fontweight='bold')
    ax.plot([1.05, 7.8], [10.24, 10.24], color="#ccc", lw=0.7)
    for i, (tp, note, tx) in enumerate(anemias):
        yy = 9.98 - i * 0.3
        t(ax, 1.1, yy, tp, size=9.3, color=RED, weight='bold')
        t(ax, 3.0, yy, note, size=8.8, color="#777", style='italic')
        t(ax, 4.6, yy, tx, size=9.2, color=GREEN)
        ax.plot([1.05, 7.8], [yy - 0.06, yy - 0.06], color="#eee", lw=0.5)

    box(ax, 1.05, 8.1, 6.2, 0.95, bg="purple", title="β˜… HEMOPHILIA")
    hemo = ["Genetic (X-linked) β†’ missing clotting factor VIII (A) or IX (B)",
            "Affects MALES mainly. Females = carriers",
            "Signs: prolonged bleeding, joint bleeds (hemarthrosis)",
            "Tx: Factor VIII/IX replacement injections"]
    for i, ln in enumerate(hemo):
        t(ax, 1.2, 8.75 - i * 0.27, f"➀ {ln}", size=9.2, color=PURPLE)

    # UNIT 6
    heading(ax, 7.7, "UNIT 6 β€” DIGESTIVE SYSTEM  (7 hrs)", color=TEAL)
    t(ax, 1.05, 7.38, "πŸ”‘ GI tract = 9 m tube from mouth to anus, breaks down food", size=10)

    # Mini GI diagram
    organs = [("Mouth", 1.4, 7.0), ("Oesophagus", 2.3, 7.0), ("Stomach", 3.4, 7.0),
              ("Small Bowel", 4.6, 7.0), ("Large Bowel", 5.8, 7.0), ("Liver/GB", 3.4, 6.55)]
    colors_gi = [TEAL, BLUE, GREEN, ORANGE, RED, PURPLE]
    for j, (org, xc, yc) in enumerate(organs):
        rect = FancyBboxPatch((xc - 0.5, yc - 0.17), 1.0, 0.32,
                               boxstyle="round,pad=0.03", facecolor=colors_gi[j],
                               edgecolor=colors_gi[j], alpha=0.8, zorder=8)
        ax.add_patch(rect)
        ax.text(xc, yc, org, fontsize=7, color="white", ha='center',
                va='center', fontweight='bold', zorder=11)
    for xarr2 in [1.9, 2.8, 3.9, 5.1]:
        ax.annotate("", xy=(xarr2 + 0.35, 7.0), xytext=(xarr2, 7.0),
                    arrowprops=dict(arrowstyle="->", color="#555", lw=1), zorder=10)
    ax.annotate("", xy=(3.4, 6.83), xytext=(3.4, 6.17+0.5),
                arrowprops=dict(arrowstyle="->", color=PURPLE, lw=1), zorder=10)

    ax.text(1.05, 6.35, "Key Conditions:", fontsize=9.5, color=TEAL, fontweight='bold')
    gi_conds = [
        ("Peptic Ulcer", "H.pylori / NSAIDs β†’ burning pain before meals β†’ PPIs + H.pylori eradication"),
        ("GERD",         "Acid reflux up oesophagus β†’ heartburn, worse lying β†’ PPIs, lifestyle"),
        ("Pancreatitis", "Inflammation (alcohol/gallstones) β†’ severe back pain β†’ nil by mouth + fluids"),
        ("Ulcerative C", "IBD of colon β†’ bloody diarrhoea β†’ aminosalicylates, steroids"),
        ("Hepatitis",    "Liver inflammation (virus A/B/C) β†’ jaundice, dark urine β†’ antivirals"),
        ("Cholecystitis","Gallbladder inflamed (gallstones) β†’ RUQ pain after fatty food β†’ surgery"),
    ]
    for i, (name, desc) in enumerate(gi_conds):
        yy2 = 6.05 - i * 0.32
        t(ax, 1.1, yy2, f"β€’ {name}:", size=9.3, color=TEAL, weight='bold')
        t(ax, 2.65, yy2, desc, size=9.0)

    ax.text(4.1, 0.12, "β€” Page 3 β€”  General Medicine Notes", fontsize=8,
            color="#aaa", ha='center', fontstyle='italic')
    return fig


# ════════════════════════════════════════════════════════════════════════════
# PAGE 4 - UNIT 7: CARDIOVASCULAR
# ════════════════════════════════════════════════════════════════════════════
def page_cardiovascular():
    fig, ax = new_page()

    heading(ax, 11.45, "UNIT 7 β€” CARDIOVASCULAR DISEASE  (8 hrs)", color=RED)
    t(ax, 1.05, 11.1, "πŸ”‘ Heart = pump, beats 100,000x/day! Small problem = big danger", size=10.5)

    # Simple heart diagram
    ax.text(1.05, 10.8, "Heart Investigations:", fontsize=9.5, color=BLUE, fontweight='bold')
    invx = [("ECG", 1.6, 10.5), ("Echo", 2.9, 10.5), ("Stress Test", 4.25, 10.5),
            ("Chest X-ray", 5.75, 10.5), ("Angiogram", 7.0, 10.5)]
    inv_cols = [BLUE, GREEN, ORANGE, TEAL, PURPLE]
    for j, (inv, xc, yc) in enumerate(invx):
        rect = FancyBboxPatch((xc - 0.52, yc - 0.18), 1.04, 0.33,
                               boxstyle="round,pad=0.03", facecolor=inv_cols[j],
                               alpha=0.85, zorder=8)
        ax.add_patch(rect)
        ax.text(xc, yc, inv, fontsize=7.5, color="white", ha='center',
                va='center', fontweight='bold', zorder=11)

    ax.text(1.05, 10.1, "ECG = records electrical activity  |  Echo = ultrasound of heart  |  Angiogram = gold standard", fontsize=8.5, color="#555")

    ax.text(1.05, 9.82, "Key Heart Conditions:", fontsize=9.5, color=RED, fontweight='bold')
    heart_conds = [
        ("IHD / Angina",    "Blocked coronary arteries (fatty plaque)",
         "Chest pain β†’ arm/jaw, worse on exertion",
         "GTN spray, aspirin, statin, angioplasty"),
        ("Hypertension",    "Unknown cause (essential) or kidney/hormones",
         "Silent killer β€” usually NO symptoms!",
         "ACE inhibitor / calcium blocker / diuretic"),
        ("Heart Failure",   "Damaged heart (IHD, HTN, valves)",
         "Breathless, ankle swelling, can't lie flat",
         "ACE-i, beta-blocker, diuretics"),
        ("Pericarditis",    "Viral infection, autoimmune",
         "Sharp chest pain, better leaning forward",
         "NSAIDs, colchicine"),
        ("Cardiac Arrest",  "VF / big MI / electrolyte imbalance",
         "No pulse, unconscious β€” EMERGENCY!",
         "CPR + defibrillation + adrenaline STAT"),
        ("Rheumatic Fever", "Group A strep throat β†’ autoimmune attack on heart valves",
         "Joint pain, fever, heart murmur",
         "Penicillin + aspirin + bed rest"),
    ]
    cols_h = [BLUE, ORANGE, RED, TEAL, RED, PURPLE]
    for i, (name, cause, feat, tx) in enumerate(heart_conds):
        ybase = 9.48 - i * 1.18
        # name banner
        rect3 = FancyBboxPatch((1.05, ybase + 0.72), 6.2, 0.28,
                                boxstyle="round,pad=0.02",
                                facecolor=cols_h[i], alpha=0.85, zorder=8)
        ax.add_patch(rect3)
        ax.text(1.15, ybase + 0.88, name, fontsize=9.5, color="white",
                fontweight='bold', va='center', zorder=11)
        t(ax, 1.15, ybase + 0.56, f"Cause: {cause}", size=9.0, color="#444")
        t(ax, 1.15, ybase + 0.28, f"Signs: {feat}", size=9.0, color=RED)
        t(ax, 1.15, ybase + 0.02, f"Tx: {tx}", size=9.0, color=GREEN)

    ax.text(4.1, 0.12, "β€” Page 4 β€”  General Medicine Notes", fontsize=8,
            color="#aaa", ha='center', fontstyle='italic')
    return fig


# ════════════════════════════════════════════════════════════════════════════
# PAGE 5 - UNIT 8: RESPIRATORY
# ════════════════════════════════════════════════════════════════════════════
def page_respiratory():
    fig, ax = new_page()

    heading(ax, 11.45, "UNIT 8 β€” RESPIRATORY DISEASE  (9 hrs)", color=BLUE)
    t(ax, 1.05, 11.1, "πŸ”‘ Lungs = bellows that never stop. O2 in, CO2 out β€” every breath counts!", size=10.5)

    # Lung sketch
    ax.text(1.05, 10.82, "Investigations:", fontsize=9.5, color=BLUE, fontweight='bold')
    ax.text(1.1, 10.55, "Chest X-ray  |  PFT (Pulmonary Function Tests)  |  ABG (Arterial Blood Gas)  |  CT scan  |  Sputum culture", fontsize=9, color=INK)

    # COPD vs Restrictive
    box(ax, 1.05, 9.1, 2.9, 1.2, bg="blue", title="OBSTRUCTIVE (COPD)")
    ob_txt = ["Hard to BREATHE OUT", "Air gets trapped in lungs",
              "FEV1/FVC < 0.7", "Causes: smoking, pollution",
              "Types: Asthma, Emphysema,", "Chronic Bronchitis"]
    for i, ln in enumerate(ob_txt):
        t(ax, 1.15, 9.98 - i * 0.24, ln, size=8.5, color=BLUE)

    box(ax, 4.2, 9.1, 2.9, 1.2, bg="teal", title="RESTRICTIVE")
    res_txt = ["Lungs can't EXPAND fully",
               "Less air gets IN",
               "FVC reduced, FEV1/FVC OK",
               "Causes: fibrosis, obesity",
               "Types: Pulm. Fibrosis,",
               "Sarcoidosis, Scoliosis"]
    for i, ln in enumerate(res_txt):
        t(ax, 4.35, 9.98 - i * 0.24, ln, size=8.5, color=TEAL)

    ax.text(1.05, 8.9, "Key Lung Diseases:", fontsize=9.5, color=BLUE, fontweight='bold')
    resp_conds = [
        ("ASTHMA",       "Allergens/cold/exercise trigger airway inflammation",
         "WHEEZE, cough (night), tight chest β†’ REVERSIBLE",
         "SABA inhaler (salbutamol) acute; ICS (steroid inhaler) to prevent"),
        ("PNEUMONIA",    "Bacteria (Strep pneumoniae), virus, fungi infect alveoli",
         "Fever, green sputum, chest pain, consolidation on X-ray",
         "Antibiotics (amoxicillin), O2, fluids, physio"),
        ("TB",           "Mycobacterium tuberculosis β€” respiratory droplets",
         "Cough >3 weeks, blood in sputum, night sweats, weight loss",
         "RIPE Γ— 6 months: Rifampicin, Isoniazid, Pyrazinamide, Ethambutol"),
        ("COPD",         "Smoking β†’ chronic damage to airways and alveoli",
         "Chronic cough, breathless on exertion, barrel chest (emphysema)",
         "Stop smoking! Inhalers (LABA + ICS), pulm rehab, O2"),
        ("PE",           "Blood clot in pulmonary artery (usually from leg DVT)",
         "Sudden breathlessness, pleuritic pain, coughing blood, fast heart",
         "Anticoagulation (heparin β†’ warfarin/DOAC), thrombolysis if severe"),
    ]
    resp_cols = [BLUE, GREEN, RED, ORANGE, PURPLE]
    for i, (name, cause, feat, tx) in enumerate(resp_conds):
        ybase = 8.56 - i * 1.08
        rect4 = FancyBboxPatch((1.05, ybase + 0.68), 6.2, 0.27,
                                boxstyle="round,pad=0.02",
                                facecolor=resp_cols[i], alpha=0.85, zorder=8)
        ax.add_patch(rect4)
        ax.text(1.15, ybase + 0.83, name, fontsize=9.5, color="white",
                fontweight='bold', va='center', zorder=11)
        t(ax, 1.15, ybase + 0.52, f"Cause: {cause}", size=8.8, color="#444")
        t(ax, 1.15, ybase + 0.26, f"Signs: {feat}", size=8.8, color=RED)
        t(ax, 1.15, ybase + 0.02, f"Tx: {tx}", size=8.8, color=GREEN)

    ax.text(4.1, 0.12, "β€” Page 5 β€”  General Medicine Notes", fontsize=8,
            color="#aaa", ha='center', fontstyle='italic')
    return fig


# ════════════════════════════════════════════════════════════════════════════
# PAGE 6 - UNIT 9: SKIN + UNIT 10: PEDIATRICS + UNIT 11: PSYCHIATRY
# ════════════════════════════════════════════════════════════════════════════
def page_skin_paeds_psych():
    fig, ax = new_page()

    heading(ax, 11.45, "UNIT 9 β€” SKIN DISEASES  (6 hrs)", color=PURPLE)
    t(ax, 1.05, 11.1, "πŸ”‘ Skin = first line of defence. Largest organ of the body!", size=10.5)

    skin_data = [
        ("Leprosy",    "M. leprae (bacteria)",      "Numb skin patches, nerve thickening", "MDT: Rifampicin+Dapsone"),
        ("Psoriasis",  "Autoimmune (T-cells)",       "Red, scaly plaques on elbows/knees",  "Steroids, Vit D cream, biologics"),
        ("Eczema",     "Allergic/atopic",            "Itchy, weeping, red skin",            "Emollients, steroid creams"),
        ("Fungal",     "Candida, Tinea",             "Ring-shaped itchy rash, white patches","Antifungals (clotrimazole)"),
        ("Herpes/Warts","HSV/HPV virus",             "Painful blisters / warts",            "Acyclovir (herpes), cryo (warts)"),
    ]
    ax.text(1.1, 10.82, "Condition", fontsize=8.5, color=PURPLE, fontweight='bold')
    ax.text(2.5, 10.82, "Cause", fontsize=8.5, color=BLUE, fontweight='bold')
    ax.text(3.95, 10.82, "Key Signs", fontsize=8.5, color=RED, fontweight='bold')
    ax.text(5.75, 10.82, "Treatment", fontsize=8.5, color=GREEN, fontweight='bold')
    ax.plot([1.05, 7.8], [10.74, 10.74], color="#ccc", lw=0.7)
    for i, (cond, cause, signs, tx) in enumerate(skin_data):
        yy = 10.48 - i * 0.31
        t(ax, 1.1, yy, cond, size=9, color=PURPLE, weight='bold')
        t(ax, 2.5, yy, cause, size=8.8)
        t(ax, 3.95, yy, signs, size=8.5, color=RED)
        t(ax, 5.75, yy, tx, size=8.5, color=GREEN)
        ax.plot([1.05, 7.8], [yy - 0.07, yy - 0.07], color="#eee", lw=0.5)

    # UNIT 10
    heading(ax, 8.85, "UNIT 10 β€” PEDIATRICS  (8 hrs)", color=TEAL)
    t(ax, 1.05, 8.52, "πŸ”‘ Children are NOT small adults β€” different diseases, doses, treatment!", size=10.5)

    paeds_boxes = [
        ("LBW Infants\n(Low Birth Weight < 2500g)",
         "Causes: prematurity, IUGR\nProblems: cold, low sugar, breathing difficulty\nTx: Kangaroo Mother Care + warmth + early feeds",
         "teal"),
        ("Cerebral Palsy (CP)",
         "Brain damage before/during/after birth β†’ permanent motor disorder\nTypes: Spastic (stiff), Athetoid (jerky), Ataxic (balance)\nTx: Physiotherapy KEY! + Speech therapy + medications",
         "blue"),
        ("Epilepsy in Children",
         "Seizures = abnormal brain electricity. Types: Grand mal, Absence, Febrile\nDx: EEG + MRI. Tx: Sodium valproate / Carbamazepine\nStatus epilepticus = IV diazepam immediately!",
         "orange"),
        ("Developmental Delay β€” Red Flags",
         "No smile @2m, no sit @9m, no walk @18m, no words @18m\nCauses: CP, Autism, Down syndrome, hypothyroidism, neglect\nAutism: social difficulties + repetitive behaviour\nTx: Early intervention = speech + OT + physio + special school",
         "purple"),
    ]
    for i, (title, content, col) in enumerate(paeds_boxes):
        n_lines = len(content.split("\n"))
        ht = 0.2 + n_lines * 0.27 + 0.25
        ybase = 8.12 - i * 1.18
        box(ax, 1.05, ybase, 6.2, ht, bg=col, title=title)
        for j, ln in enumerate(content.split("\n")):
            t(ax, 1.2, ybase + ht - 0.33 - j * 0.27, ln, size=8.8)

    # UNIT 11
    heading(ax, 3.15, "UNIT 11 β€” PSYCHIATRIC DISORDERS  (5 hrs)", color=PURPLE)
    t(ax, 1.05, 2.82, "πŸ”‘ Brain can also get sick! Mental illness = medical condition, not weakness", size=10)

    psych_data = [
        ("Depression",    "Low mood, no interest, sleep problems, suicidal thoughts",   "CBT + SSRIs (fluoxetine)"),
        ("Anxiety",       "Excessive worry, panic attacks, palpitations, avoidance",     "CBT + SSRIs + relaxation"),
        ("Schizophrenia", "Hearing voices, delusions, disorganized thinking",            "Antipsychotics (olanzapine)"),
        ("Bipolar",       "Mania (no sleep, euphoria) ↔ Depression swings",             "Lithium / Valproate"),
        ("OCD",           "Obsessive thoughts + compulsive acts (e.g. washing hands)",  "CBT (ERP) + high dose SSRI"),
    ]
    ax.text(1.1, 2.53, "Disorder", fontsize=8.5, color=PURPLE, fontweight='bold')
    ax.text(2.8, 2.53, "Key Features", fontsize=8.5, color=RED, fontweight='bold')
    ax.text(5.85, 2.53, "Treatment", fontsize=8.5, color=GREEN, fontweight='bold')
    ax.plot([1.05, 7.8], [2.45, 2.45], color="#ccc", lw=0.7)
    for i, (dis, feat, tx) in enumerate(psych_data):
        yy = 2.2 - i * 0.31
        t(ax, 1.1, yy, dis, size=8.8, color=PURPLE, weight='bold')
        t(ax, 2.8, yy, feat, size=8.5)
        t(ax, 5.85, yy, tx, size=8.5, color=GREEN)
        ax.plot([1.05, 7.8], [yy - 0.07, yy - 0.07], color="#eee", lw=0.5)

    ax.text(1.05, 0.65, "Recommended Books:", fontsize=9, color=BLUE, fontweight='bold')
    ax.text(1.1, 0.4, "1. Davidson's Principles of Medicine  2. Harrison's Internal Medicine  3. Braunwald's Cardiology", fontsize=8.5, color=INK)

    ax.text(4.1, 0.12, "β€” Page 6 β€”  General Medicine Notes", fontsize=8,
            color="#aaa", ha='center', fontstyle='italic')
    return fig


# ── Save all pages to PDF ────────────────────────────────────────────────────
output = "/tmp/workspace/general-medicine-notes/GM_Handwritten_Notes.pdf"
with PdfPages(output) as pdf:
    for page_func in [page_title_infection, page_nutrition_endocrine,
                       page_blood_digestive, page_cardiovascular,
                       page_respiratory, page_skin_paeds_psych]:
        fig = page_func()
        pdf.savefig(fig, bbox_inches='tight', dpi=150)
        plt.close(fig)
        print(f"  βœ“ {page_func.__name__}")

import os
print(f"\nDone! File: {output}  ({os.path.getsize(output)//1024} KB)")
Running Command

cd /tmp/workspace/general-medicine-notes && python3 handwritten_notes.py 2>&1

Editing File

~/general-medicine-notes/handwritten_notes.py

Successfully replaced 1 instance(s) of the string in '/tmp/workspace/general-medicine-notes/handwritten_notes.py'
Running Command

cd /tmp/workspace/general-medicine-notes && python3 handwritten_notes.py 2>&1

Your handwritten-style notes are ready! πŸŽ‰

GM Handwritten Notes

PDF Document Β· PDF


Here's what's inside (6 pages, notebook style with ruled lines + red margin):
PageContent
Page 1Unit 1: Infection (Chain of Infection diagram, HIV/AIDS, Vaccinations) + Unit 2: Poisoning (ABCDE rule)
Page 2Unit 3: Nutrition (deficiency table, Kwashiorkor vs Marasmus, Obesity) + Unit 4: Endocrine (glands table, Diabetes β€” 3 P's)
Page 3Unit 5: Blood (Anemia types, PALE signs, Haemophilia) + Unit 6: Digestive (GI diagram, 6 conditions)
Page 4Unit 7: Cardiovascular (ECG/investigations, 6 heart conditions with cause→signs→treatment)
Page 5Unit 8: Respiratory (COPD vs Restrictive, Asthma/Pneumonia/TB/COPD/PE)
Page 6Unit 9: Skin + Unit 10: Pediatrics (LBW, CP, Epilepsy, Autism) + Unit 11: Psychiatry (5 disorders)
Style features:
  • Cream paper background with blue ruled lines + red margin line
  • Color-coded boxes for each topic
  • Arrow diagrams (chain of infection, GI tract, heart investigations)
  • Brief, plain-language explanations β€” easy words, no jargon
  • Each condition = Cause β†’ Signs β†’ Treatment format

best YouTube page understand this tosyllabus

Searching the Web

best YouTube channels general medicine medical students easy explanation 2024

Searching the Web

best YouTube channel learn cardiology respiratory medicine easy for students

Here are the best YouTube channels for your General Medicine syllabus, topic by topic:

πŸ† Top Channels β€” All Units Covered


1. πŸ”΅ Osmosis (Best Overall)

Best for: Everything β€” Infection, Diabetes, Heart, Lungs, Blood, GI, Skin, Psychiatry
  • Animated videos with whiteboard drawings
  • Super simple language, perfect for beginners
  • Covers almost every condition in your syllabus

2. 🟒 Ninja Nerd (Most Visual & Detailed)

Best for: Cardiovascular, Respiratory, Endocrine, Blood disorders
  • Whiteboard-style teaching with colored diagrams
  • Explains step-by-step in very easy language
  • Great for understanding HOW diseases happen

3. πŸ”΄ MedCram (Best for Respiratory & Cardiology)

Best for: Asthma, COPD, Pneumonia, ECG, Heart Failure, ABG
  • Doctor explains clearly with drawings
  • Brilliant for Respiratory (Unit 8) and Cardiovascular (Unit 7)

4. 🟑 Khan Academy Medicine (Best Free Resource)

Best for: Endocrine (Diabetes), GI system, Blood diseases, Cardiology, Psychiatry
  • Completely free, very easy explanations
  • Covers Unit 3, 4, 5, 6, 7 perfectly

5. 🟣 Dr. Najeeb Lectures (Most In-Depth)

Best for: When you want deep understanding β€” Physiology behind diseases
  • Very detailed, lecture-style teaching
  • Best once you understand the basics

6. 🟠 Armando Hasudungan (Best Diagrams)

Best for: Blood diseases, Immunology, Infection, Liver diseases
  • Hand-draws everything as he explains
  • Feels like a real handwritten note being made live!

πŸ“š Unit-by-Unit Quick Guide

Your UnitBest Channel to Watch
Infection / HIVOsmosis, Armando Hasudungan
PoisoningMedCram, Osmosis
Nutrition & DiabetesKhan Academy, Osmosis
Blood / AnemiaNinja Nerd, Armando Hasudungan
Digestive / LiverOsmosis, Ninja Nerd
CardiovascularMedCram, Ninja Nerd
RespiratoryMedCram (best!), Ninja Nerd
Skin diseasesOsmosis
PediatricsOsmosis
PsychiatryOsmosis, Khan Academy

My top pick for you: Start with Osmosis for every topic β€” it uses simple animations and easy words just like you asked for in your notes. Then use Ninja Nerd for Cardiology and Respiratory where you need diagrams.

is there all in one

Searching the Web

Osmosis YouTube complete general medicine playlist all topics infection endocrine cardiovascular respiratory pediatrics psychiatry

Yes! Osmosis is your single all-in-one answer. It covers every single unit in your syllabus - infection, nutrition, diabetes, blood, GI, heart, lungs, skin, pediatrics, psychiatry - all in one place, all in easy animated videos.

βœ… ONE Channel = ALL 11 Units

πŸ₯‡ OSMOSIS β€” The #1 All-in-One Channel

Why it's perfect for you:
  • Covers every topic in your General Medicine syllabus
  • Uses simple animations β€” no boring lectures
  • Easy English, explains like a story
  • 6 million+ medical students use it worldwide
  • FREE on YouTube

Your Syllabus β€” All on Osmosis βœ…

UnitSearch on Osmosis
Infection / HIV"Osmosis HIV" / "Osmosis infection"
Poisoning"Osmosis toxicology"
Nutrition / Diabetes"Osmosis diabetes mellitus"
Blood / Anemia"Osmosis anemia" / "Osmosis hemophilia"
Digestive System"Osmosis peptic ulcer" / "Osmosis hepatitis"
Cardiovascular"Osmosis heart failure" / "Osmosis hypertension"
Respiratory"Osmosis asthma" / "Osmosis COPD" / "Osmosis pneumonia"
Skin Diseases"Osmosis psoriasis" / "Osmosis leprosy"
Pediatrics"Osmosis cerebral palsy" / "Osmosis epilepsy"
Psychiatry"Osmosis depression" / "Osmosis schizophrenia"

How to use it:
  1. Open YouTube
  2. Go to Osmosis from Elsevier channel
  3. Search any topic from your notes
  4. Watch the 5-10 min animated video
  5. Done - topic understood! βœ…
It's literally like watching your handwritten notes come alive with cartoons and clear voice explanation. Perfect match for how you want to learn!

Create a study schedule matching YouTube videos to your syllabus units

Asking for Preferences

How many days per week can you study? Β· How many hours per day can you study?

7 days a week, 1 hour a day. Let me build the full schedule now.
Writing File

~/general-medicine-notes/study_schedule.py

import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from matplotlib.patches import FancyBboxPatch
from matplotlib.backends.backend_pdf import PdfPages
import numpy as np
import warnings
warnings.filterwarnings('ignore')

# ── Colours ──────────────────────────────────────────────────────────────────
PAPER   = "#fffef5"
LINE_C  = "#c8d8f0"
MARGIN  = "#ffb3b3"
INK     = "#1a1a2e"
NAVY    = "#1a237e"
BLUE    = "#1565c0"
RED     = "#c62828"
GREEN   = "#2e7d32"
ORANGE  = "#e65100"
PURPLE  = "#6a1b9a"
TEAL    = "#00695c"
YELLOW  = "#f57f17"
PINK    = "#880e4f"
GRAY    = "#546e7a"

WEEK_COLORS = [BLUE, TEAL, GREEN, ORANGE, PURPLE, RED]

# ── Week/Day data ─────────────────────────────────────────────────────────────
# Each entry: (Day label, Unit, Topic, Osmosis search query, Time split)
# 6 weeks Γ— 7 days = 42 study sessions
# Syllabus hours: U1=3, U2=2, U3=4, U4=4, U5=4, U6=7, U7=8, U8=9, U9=6, U10=8, U11=5  Total=60

SCHEDULE = {
    1: {  # WEEK 1 β€” Infection & Poisoning
        "theme": "UNIT 1: Infection  &  UNIT 2: Poisoning",
        "color": BLUE,
        "days": [
            ("Mon", "U1", "What is Infection? Types of germs",
             "Osmosis – Introduction to Infectious Disease",
             "30 min watch + 20 min notes + 10 min quiz"),
            ("Tue", "U1", "How infection spreads: Chain of Infection",
             "Osmosis – Modes of Transmission of Infection",
             "30 min watch + 20 min notes + 10 min review"),
            ("Wed", "U1", "Vaccinations & Herd Immunity",
             "Osmosis – Vaccines and Immunization",
             "30 min watch + 20 min notes + 10 min flashcards"),
            ("Thu", "U1", "HIV & AIDS β€” Pathology & Management",
             "Osmosis – HIV and AIDS",
             "30 min watch + 20 min notes + 10 min quiz"),
            ("Fri", "U1", "STDs, Food Poisoning & Gastroenteritis",
             "Osmosis – Sexually Transmitted Infections",
             "30 min watch + 20 min notes + 10 min review"),
            ("Sat", "U2", "Poisoning: General Management (ABCDE)",
             "Osmosis – Approach to the Poisoned Patient",
             "30 min watch + 20 min notes + 10 min practice"),
            ("Sun", "U1+U2", "REVISION β€” Week 1 Full Review",
             "Re-watch your top 2 weakest videos from this week",
             "30 min re-watch + 30 min write notes from memory"),
        ]
    },
    2: {  # WEEK 2 β€” Nutrition & Endocrine
        "theme": "UNIT 3: Food & Nutrition  &  UNIT 4: Endocrine Diseases",
        "color": TEAL,
        "days": [
            ("Mon", "U2", "Types of Poisons: Drugs, Pesticides, Envenomation",
             "Osmosis – Organophosphate Poisoning",
             "30 min watch + 20 min notes + 10 min quiz"),
            ("Tue", "U3", "Nutritional Requirements & Deficiency Diseases",
             "Osmosis – Nutritional Deficiencies",
             "30 min watch + 20 min notes + 10 min table"),
            ("Wed", "U3", "Kwashiorkor vs Marasmus (PEM)",
             "Osmosis – Kwashiorkor and Marasmus",
             "30 min watch + 20 min notes + 10 min compare"),
            ("Thu", "U3", "Obesity: Causes, Complications, Management",
             "Osmosis – Obesity",
             "30 min watch + 20 min notes + 10 min review"),
            ("Fri", "U4", "Endocrine Glands Overview + Thyroid Disorders",
             "Osmosis – Hypothyroidism and Hyperthyroidism",
             "30 min watch + 20 min notes + 10 min quiz"),
            ("Sat", "U4", "Diabetes Mellitus: Type 1 vs Type 2",
             "Osmosis – Diabetes Mellitus Type 1 and Type 2",
             "30 min watch + 20 min notes + 10 min flashcards"),
            ("Sun", "U3+U4", "REVISION β€” Week 2 Full Review",
             "Re-watch: Nutrition + Diabetes videos",
             "30 min re-watch + 30 min write notes from memory"),
        ]
    },
    3: {  # WEEK 3 β€” Endocrine cont. & Blood
        "theme": "UNIT 4 (cont.): Diabetes Complications  &  UNIT 5: Blood Diseases",
        "color": GREEN,
        "days": [
            ("Mon", "U4", "Diabetes Complications (eyes, kidneys, nerves, feet)",
             "Osmosis – Diabetic Retinopathy + Diabetic Nephropathy",
             "30 min watch + 20 min notes + 10 min quiz"),
            ("Tue", "U4", "Adrenal Disorders: Cushing's & Addison's",
             "Osmosis – Cushing Syndrome + Addison Disease",
             "30 min watch + 20 min notes + 10 min compare"),
            ("Wed", "U5", "Blood Overview + Anemia: Types & Signs",
             "Osmosis – Anemia β€” Approach and Pathophysiology",
             "30 min watch + 20 min notes + 10 min table"),
            ("Thu", "U5", "Iron Deficiency & B12 Deficiency Anemia",
             "Osmosis – Iron Deficiency Anemia + B12 Deficiency",
             "30 min watch + 20 min notes + 10 min flashcards"),
            ("Fri", "U5", "Sickle Cell Disease & Thalassemia",
             "Osmosis – Sickle Cell Disease",
             "30 min watch + 20 min notes + 10 min review"),
            ("Sat", "U5", "Hemophilia A & B",
             "Osmosis – Hemophilia",
             "30 min watch + 20 min notes + 10 min quiz"),
            ("Sun", "U4+U5", "REVISION β€” Week 3 Full Review",
             "Re-watch: Diabetes complications + Anemia",
             "30 min re-watch + 30 min write notes from memory"),
        ]
    },
    4: {  # WEEK 4 β€” Digestive System
        "theme": "UNIT 6: Diseases of the Digestive System",
        "color": ORANGE,
        "days": [
            ("Mon", "U6", "GI Overview + Peptic Ulcer Disease",
             "Osmosis – Peptic Ulcer Disease",
             "30 min watch + 20 min notes + 10 min quiz"),
            ("Tue", "U6", "GERD & Achalasia Cardia",
             "Osmosis – Gastroesophageal Reflux Disease (GERD)",
             "30 min watch + 20 min notes + 10 min review"),
            ("Wed", "U6", "GI Bleeding, Pancreatitis, Malabsorption",
             "Osmosis – Acute Pancreatitis + GI Bleeding",
             "30 min watch + 20 min notes + 10 min table"),
            ("Thu", "U6", "Ulcerative Colitis & Peritonitis",
             "Osmosis – Inflammatory Bowel Disease (IBD)",
             "30 min watch + 20 min notes + 10 min compare"),
            ("Fri", "U6", "Viral Hepatitis A, B, C, D, E",
             "Osmosis – Hepatitis A B C D E",
             "30 min watch + 20 min notes + 10 min flashcards"),
            ("Sat", "U6", "Wilson's Disease, Liver Tumors, Cholecystitis",
             "Osmosis – Wilson Disease + Cholecystitis",
             "30 min watch + 20 min notes + 10 min quiz"),
            ("Sun", "U6", "REVISION β€” Week 4 Full Review",
             "Re-watch: your 2 weakest GI topics",
             "30 min re-watch + 30 min draw GI diagram from memory"),
        ]
    },
    5: {  # WEEK 5 β€” Cardiovascular & Respiratory
        "theme": "UNIT 7: Cardiovascular  &  UNIT 8: Respiratory Disease",
        "color": PURPLE,
        "days": [
            ("Mon", "U7", "Cardiovascular Exam + ECG Basics",
             "Osmosis – Introduction to ECG / EKG",
             "30 min watch + 20 min notes + 10 min practice ECG"),
            ("Tue", "U7", "Ischaemic Heart Disease & Cardiac Arrest",
             "Osmosis – Ischaemic Heart Disease + Cardiac Arrest",
             "30 min watch + 20 min notes + 10 min quiz"),
            ("Wed", "U7", "Heart Failure, Hypertension, Pericarditis",
             "Osmosis – Heart Failure + Hypertension",
             "30 min watch + 20 min notes + 10 min review"),
            ("Thu", "U7", "Rheumatic Fever, Endocarditis, Valve Disorders",
             "Osmosis – Rheumatic Fever + Endocarditis",
             "30 min watch + 20 min notes + 10 min flashcards"),
            ("Fri", "U8", "Respiratory System: COPD vs Restrictive + PFTs",
             "Osmosis – COPD + Pulmonary Function Tests",
             "30 min watch + 20 min notes + 10 min compare"),
            ("Sat", "U8", "Asthma, Pneumonia, Tuberculosis",
             "Osmosis – Asthma + Pneumonia + Tuberculosis",
             "30 min watch + 20 min notes + 10 min table"),
            ("Sun", "U7+U8", "REVISION β€” Week 5 Full Review",
             "Re-watch: Heart failure + Asthma (most exam-common)",
             "30 min re-watch + 30 min write notes from memory"),
        ]
    },
    6: {  # WEEK 6 β€” Skin, Paeds, Psychiatry + FINAL REVISION
        "theme": "UNIT 8 (cont.) + UNIT 9: Skin  +  UNIT 10: Pediatrics  +  UNIT 11: Psychiatry",
        "color": RED,
        "days": [
            ("Mon", "U8", "Pulmonary Embolism, Respiratory Failure, Pleural Effusion",
             "Osmosis – Pulmonary Embolism + Respiratory Failure",
             "30 min watch + 20 min notes + 10 min quiz"),
            ("Tue", "U9", "Skin: Leprosy, Psoriasis, Eczema",
             "Osmosis – Leprosy + Psoriasis + Eczema (Dermatitis)",
             "30 min watch + 20 min notes + 10 min table"),
            ("Wed", "U9", "Skin: Fungal, Viral (Herpes, Warts)",
             "Osmosis – Fungal Skin Infections + Herpes",
             "30 min watch + 20 min notes + 10 min flashcards"),
            ("Thu", "U10", "Pediatrics: LBW, CP, Epilepsy, Spina Bifida",
             "Osmosis – Cerebral Palsy + Neonatal Care + Epilepsy",
             "30 min watch + 20 min notes + 10 min review"),
            ("Fri", "U10+U11", "Pediatrics: Autism, ADHD + Psychiatry Overview",
             "Osmosis – Autism Spectrum Disorder + Depression + Schizophrenia",
             "30 min watch + 20 min notes + 10 min quiz"),
            ("Sat", "U11", "Psychiatry: Bipolar, OCD, PTSD, Anxiety",
             "Osmosis – Bipolar Disorder + OCD + PTSD",
             "30 min watch + 20 min notes + 10 min flashcards"),
            ("Sun", "ALL", "GRAND REVISION β€” Full Syllabus Review",
             "Go through all 11 units of your handwritten notes",
             "20 min notes review + 40 min: write key points from memory"),
        ]
    },
}

# ── Drawing helpers ──────────────────────────────────────────────────────────
def new_page(title=""):
    fig, ax = plt.subplots(figsize=(8.27, 11.69))
    fig.patch.set_facecolor(PAPER)
    ax.set_facecolor(PAPER)
    ax.set_xlim(0, 8.27)
    ax.set_ylim(0, 11.69)
    ax.axis('off')
    for y in np.arange(0.3, 11.69, 0.38):
        ax.axhline(y, color=LINE_C, lw=0.4, zorder=0)
    ax.axvline(0.9, color=MARGIN, lw=1.0, zorder=1)
    for y in np.arange(10.8, 0.5, -1.5):
        circ = plt.Circle((0.25, y), 0.065, color="#d0d0d0", zorder=5)
        ax.add_patch(circ)
    return fig, ax

def banner(ax, text, color, y=11.2, h=0.42):
    rect = FancyBboxPatch((0.9, y), 6.8, h, boxstyle="round,pad=0.04",
                           facecolor=color, edgecolor=color, zorder=8)
    ax.add_patch(rect)
    ax.text(4.3, y + h/2, text, fontsize=12, color="white",
            fontweight='bold', ha='center', va='center', zorder=11)

def day_block(ax, y, day, unit, topic, search, time_split, color):
    """Draw one day row."""
    h = 0.88
    # Day pill
    pill = FancyBboxPatch((0.92, y), 0.72, h - 0.06,
                           boxstyle="round,pad=0.03",
                           facecolor=color, edgecolor=color, alpha=0.9, zorder=8)
    ax.add_patch(pill)
    ax.text(1.28, y + (h-0.06)/2, day, fontsize=10, color="white",
            fontweight='bold', ha='center', va='center', zorder=11)

    # Unit tag
    unit_pill = FancyBboxPatch((1.7, y + 0.52), 0.6, 0.28,
                                boxstyle="round,pad=0.02",
                                facecolor=color, alpha=0.25, edgecolor=color,
                                linewidth=0.8, zorder=8)
    ax.add_patch(unit_pill)
    ax.text(2.0, y + 0.68, unit, fontsize=7.5, color=color,
            fontweight='bold', ha='center', va='center', zorder=11)

    # Topic
    ax.text(2.38, y + 0.65, topic, fontsize=9.5, color=INK,
            fontweight='bold', va='bottom', zorder=10)

    # Osmosis search
    ax.text(1.72, y + 0.35, "β–Ά Search:", fontsize=8, color="#e65100",
            fontweight='bold', va='bottom', zorder=10)
    ax.text(2.38, y + 0.35, search, fontsize=8.3, color="#1565c0",
            fontstyle='italic', va='bottom', zorder=10)

    # Time split icons
    ax.text(1.72, y + 0.07, "⏱", fontsize=8, color=GRAY, va='bottom', zorder=10)
    ax.text(2.0, y + 0.07, time_split, fontsize=8, color=GRAY,
            va='bottom', zorder=10)

    # Checkbox
    rect_cb = FancyBboxPatch((7.6, y + 0.28), 0.22, 0.22,
                              boxstyle="round,pad=0.02",
                              facecolor="white", edgecolor=color,
                              linewidth=1, zorder=8)
    ax.add_patch(rect_cb)
    ax.text(7.71, y + 0.39, "βœ“", fontsize=7, color="#bbb",
            ha='center', va='center', zorder=11)

    # Divider line
    ax.plot([0.92, 7.85], [y - 0.04, y - 0.04], color="#e0e0e0", lw=0.5)


# ── COVER PAGE ───────────────────────────────────────────────────────────────
def cover_page():
    fig, ax = new_page()

    # Big title box
    rect = FancyBboxPatch((0.9, 9.8), 6.8, 1.6,
                           boxstyle="round,pad=0.06", facecolor=NAVY,
                           edgecolor=NAVY, zorder=8)
    ax.add_patch(rect)
    ax.text(4.3, 10.95, "πŸ“…  6-WEEK STUDY SCHEDULE",
            fontsize=16, color="white", fontweight='bold',
            ha='center', va='center', zorder=11)
    ax.text(4.3, 10.45, "General Medicine Syllabus  Γ—  Osmosis YouTube",
            fontsize=11, color="#90caf9", ha='center', va='center',
            fontstyle='italic', zorder=11)
    ax.text(4.3, 10.1, "7 days/week  β€’  1 hour/day  β€’  All 11 Units Covered",
            fontsize=9.5, color="#b3e5fc", ha='center', va='center', zorder=11)

    # How to use box
    htb = FancyBboxPatch((0.9, 8.6), 6.8, 0.95,
                          boxstyle="round,pad=0.04", facecolor="#e3f2fd",
                          edgecolor=BLUE, linewidth=1.2, zorder=8)
    ax.add_patch(htb)
    ax.text(1.1, 9.3, "HOW TO USE THIS SCHEDULE:", fontsize=9.5,
            color=BLUE, fontweight='bold', va='bottom', zorder=11)
    steps = ["1. Open YouTube β†’ Search the exact text shown on each day (β–Ά Search: ...)",
             "2. Watch the video (usually 8-15 min) β†’ pause and take notes",
             "3. Spend 20 min writing key points in your own words",
             "4. Tick the checkbox βœ“ when done  |  Sunday = always revision day"]
    for i, s in enumerate(steps):
        ax.text(1.1, 9.05 - i * 0.24, s, fontsize=8.8, color=INK,
                va='bottom', zorder=11)

    # Week overview boxes
    ax.text(4.3, 8.3, "WHAT YOU WILL COVER EACH WEEK",
            fontsize=10, color=NAVY, fontweight='bold',
            ha='center', va='bottom', zorder=10)
    ax.plot([0.9, 7.7], [8.22, 8.22], color="#ccc", lw=0.7)

    week_info = [
        ("WEEK 1", "Infection + Poisoning", BLUE),
        ("WEEK 2", "Nutrition + Endocrine", TEAL),
        ("WEEK 3", "Endocrine cont. + Blood", GREEN),
        ("WEEK 4", "Digestive System", ORANGE),
        ("WEEK 5", "Cardiovascular + Respiratory", PURPLE),
        ("WEEK 6", "Respiratory cont. + Skin + Paeds + Psychiatry", RED),
    ]
    for i, (wk, desc, col) in enumerate(week_info):
        yrow = 7.88 - i * 0.56
        rect_w = FancyBboxPatch((0.92, yrow), 1.2, 0.38,
                                 boxstyle="round,pad=0.03",
                                 facecolor=col, edgecolor=col, alpha=0.85, zorder=8)
        ax.add_patch(rect_w)
        ax.text(1.52, yrow + 0.19, wk, fontsize=9, color="white",
                fontweight='bold', ha='center', va='center', zorder=11)
        ax.text(2.28, yrow + 0.19, desc, fontsize=9.5, color=INK,
                va='center', zorder=11)
        # progress bar bg
        pbar_bg = FancyBboxPatch((5.5, yrow + 0.08), 2.15, 0.2,
                                  boxstyle="round,pad=0.02",
                                  facecolor="#eeeeee", edgecolor="#ddd",
                                  linewidth=0.5, zorder=8)
        ax.add_patch(pbar_bg)
        ax.text(5.52, yrow + 0.19, "Progress: β–‘β–‘β–‘β–‘β–‘β–‘β–‘", fontsize=7.5,
                color="#aaa", va='center', zorder=11)

    # Syllabus hours pie-ish bar
    ax.text(4.3, 4.28, "SYLLABUS HOURS BREAKDOWN",
            fontsize=10, color=NAVY, fontweight='bold',
            ha='center', va='bottom', zorder=10)
    ax.plot([0.9, 7.7], [4.2, 4.22], color="#ccc", lw=0.7)

    units_hours = [
        ("U1 Infection", 3, BLUE), ("U2 Poison", 2, TEAL),
        ("U3 Nutrition", 4, GREEN), ("U4 Endocrine", 4, ORANGE),
        ("U5 Blood", 4, RED), ("U6 Digestive", 7, PINK),
        ("U7 Cardio", 8, PURPLE), ("U8 Resp", 9, BLUE),
        ("U9 Skin", 6, TEAL), ("U10 Paeds", 8, GREEN),
        ("U11 Psych", 5, ORANGE),
    ]
    total = 60
    x_start = 0.92
    bar_total_w = 6.8
    ax.text(0.92, 3.98, "Total: 60 hours", fontsize=8.5, color=GRAY)
    for uname, hrs, col in units_hours:
        bw = (hrs / total) * bar_total_w
        rect_u = FancyBboxPatch((x_start, 3.55), bw - 0.02, 0.32,
                                 boxstyle="square,pad=0",
                                 facecolor=col, edgecolor="white",
                                 linewidth=0.8, alpha=0.85, zorder=8)
        ax.add_patch(rect_u)
        if bw > 0.5:
            ax.text(x_start + bw/2, 3.71, str(hrs)+"h",
                    fontsize=6.5, color="white", ha='center',
                    va='center', fontweight='bold', zorder=11)
        x_start += bw

    # legend
    x_leg = 0.92
    for uname, hrs, col in units_hours:
        rect_l = FancyBboxPatch((x_leg, 3.12), 0.14, 0.14,
                                 boxstyle="square,pad=0",
                                 facecolor=col, edgecolor="none", zorder=8)
        ax.add_patch(rect_l)
        ax.text(x_leg + 0.18, 3.19, uname, fontsize=6.5, color=INK,
                va='center', zorder=11)
        x_leg += 0.58
        if x_leg > 7.2:
            x_leg = 0.92

    # bottom note
    ax.text(4.3, 0.42, "β˜…  Every Sunday = Revision Day. Never skip revision!  β˜…",
            fontsize=9, color=RED, ha='center', fontweight='bold', zorder=10)
    ax.text(4.3, 0.18, "Channel: Osmosis from Elsevier  |  youtube.com/@OsmosisFromElsevier",
            fontsize=8.5, color=BLUE, ha='center', fontstyle='italic', zorder=10)
    ax.text(4.3, 0.04, "β€” Cover β€”  General Medicine Study Schedule",
            fontsize=7.5, color="#aaa", ha='center', zorder=10)
    return fig


# ── WEEK PAGES ───────────────────────────────────────────────────────────────
def week_page(week_num):
    data = SCHEDULE[week_num]
    fig, ax = new_page()

    banner(ax, f"πŸ“…  WEEK {week_num}  β€”  {data['theme']}",
           data['color'], y=11.18, h=0.42)

    # Column headers
    ax.text(1.28, 10.98, "Day", fontsize=8, color=data['color'],
            fontweight='bold', ha='center')
    ax.text(2.0, 10.98, "Unit", fontsize=8, color=data['color'],
            fontweight='bold', ha='center')
    ax.text(2.5, 10.98, "Topic  /  Osmosis Search  /  Time Plan",
            fontsize=8, color=data['color'], fontweight='bold')
    ax.text(7.65, 10.98, "Done", fontsize=8, color=data['color'],
            fontweight='bold', ha='center')
    ax.plot([0.92, 7.85], [10.92, 10.92], color=data['color'], lw=0.7)

    y_pos = 10.82
    for day_name, unit, topic, search, time_sp in data['days']:
        col = RED if day_name == "Sun" else data['color']
        day_block(ax, y_pos - 0.88, day_name, unit, topic,
                  search, time_sp, col)
        y_pos -= 0.96

    # Tips box at bottom
    tips_y = y_pos - 0.15
    tips_box = FancyBboxPatch((0.92, tips_y - 0.62), 6.8, 0.82,
                               boxstyle="round,pad=0.04",
                               facecolor="#fff9c4", edgecolor=YELLOW,
                               linewidth=1, zorder=8)
    ax.add_patch(tips_box)
    ax.text(1.1, tips_y + 0.1, "πŸ’‘  WEEK TIPS:", fontsize=9,
            color=YELLOW, fontweight='bold', va='bottom', zorder=11)

    week_tips = {
        1: "Search exactly: 'Osmosis HIV' or 'Osmosis Chain of Infection' on YouTube. Play at 1.25x speed to save time.",
        2: "Draw the Kwashiorkor vs Marasmus comparison table on paper after watching. Great for memory!",
        3: "For Anemia, make a colour-coded table: Iron = red, B12 = blue, Sickle = purple.",
        4: "GI system is BIG. Focus on Peptic Ulcer, Hepatitis B&C, and Cholecystitis β€” most exam-common.",
        5: "ECG basics is must-know! Rewatch the ECG video twice. Heart Failure is very high yield.",
        6: "Final week β€” pace yourself. Use Sunday Grand Revision to go through ALL your handwritten notes.",
    }
    ax.text(1.1, tips_y - 0.2, week_tips[week_num], fontsize=8.5,
            color=INK, va='bottom', zorder=11, wrap=True)

    # Progress tracker
    ax.text(1.1, tips_y - 0.48, "Weekly Progress:  β–‘ Mon  β–‘ Tue  β–‘ Wed  β–‘ Thu  β–‘ Fri  β–‘ Sat  β–‘ Sun",
            fontsize=8.5, color=GRAY, va='bottom', zorder=11)

    ax.text(4.1, 0.06, f"β€” Week {week_num} β€”  General Medicine Study Schedule",
            fontsize=7.5, color="#aaa", ha='center', zorder=10)
    return fig


# ── QUICK REFERENCE PAGE ─────────────────────────────────────────────────────
def quick_ref_page():
    fig, ax = new_page()
    banner(ax, "πŸ”  QUICK REFERENCE: All Osmosis Search Terms", NAVY, y=11.18, h=0.42)

    ax.text(4.3, 10.98, "Copy these into YouTube search β†’ find your video in seconds",
            fontsize=9, color=GRAY, ha='center', fontstyle='italic')
    ax.plot([0.9, 7.7], [10.9, 10.9], color="#ccc", lw=0.6)

    all_searches = [
        ("U1 – Infection", BLUE, [
            "Osmosis – Introduction to Infectious Disease",
            "Osmosis – Modes of Transmission of Infection",
            "Osmosis – Vaccines and Immunization",
            "Osmosis – HIV and AIDS",
            "Osmosis – Sexually Transmitted Infections",
        ]),
        ("U2 – Poisoning", TEAL, [
            "Osmosis – Approach to the Poisoned Patient",
            "Osmosis – Organophosphate Poisoning",
        ]),
        ("U3 – Nutrition", GREEN, [
            "Osmosis – Nutritional Deficiencies",
            "Osmosis – Kwashiorkor and Marasmus",
            "Osmosis – Obesity",
        ]),
        ("U4 – Endocrine", ORANGE, [
            "Osmosis – Hypothyroidism and Hyperthyroidism",
            "Osmosis – Diabetes Mellitus Type 1 and Type 2",
            "Osmosis – Diabetic Retinopathy + Diabetic Nephropathy",
            "Osmosis – Cushing Syndrome + Addison Disease",
        ]),
        ("U5 – Blood", RED, [
            "Osmosis – Anemia β€” Approach and Pathophysiology",
            "Osmosis – Iron Deficiency Anemia",
            "Osmosis – Sickle Cell Disease",
            "Osmosis – Hemophilia",
        ]),
        ("U6 – Digestive", PINK, [
            "Osmosis – Peptic Ulcer Disease",
            "Osmosis – Gastroesophageal Reflux Disease (GERD)",
            "Osmosis – Acute Pancreatitis",
            "Osmosis – Inflammatory Bowel Disease (IBD)",
            "Osmosis – Hepatitis A B C D E",
            "Osmosis – Wilson Disease + Cholecystitis",
        ]),
        ("U7 – Cardiovascular", PURPLE, [
            "Osmosis – Introduction to ECG / EKG",
            "Osmosis – Ischaemic Heart Disease",
            "Osmosis – Heart Failure",
            "Osmosis – Hypertension",
            "Osmosis – Rheumatic Fever + Endocarditis",
        ]),
        ("U8 – Respiratory", BLUE, [
            "Osmosis – COPD + Pulmonary Function Tests",
            "Osmosis – Asthma",
            "Osmosis – Pneumonia",
            "Osmosis – Tuberculosis",
            "Osmosis – Pulmonary Embolism",
            "Osmosis – Respiratory Failure",
        ]),
        ("U9 – Skin", TEAL, [
            "Osmosis – Leprosy",
            "Osmosis – Psoriasis",
            "Osmosis – Eczema (Dermatitis)",
            "Osmosis – Fungal Skin Infections",
            "Osmosis – Herpes",
        ]),
        ("U10 – Pediatrics", GREEN, [
            "Osmosis – Neonatal Care + LBW",
            "Osmosis – Cerebral Palsy",
            "Osmosis – Epilepsy (Seizure disorders)",
            "Osmosis – Autism Spectrum Disorder",
        ]),
        ("U11 – Psychiatry", ORANGE, [
            "Osmosis – Depression",
            "Osmosis – Schizophrenia",
            "Osmosis – Bipolar Disorder",
            "Osmosis – OCD + PTSD",
        ]),
    ]

    y_cur = 10.68
    col_break = 6  # switch to right column after this many units
    right_col = False
    x_base = 0.95

    for idx, (unit_name, col, searches) in enumerate(all_searches):
        if idx == 6:   # move to right column
            right_col = True
            x_base = 4.15
            y_cur = 10.68

        # Unit label
        rect_u = FancyBboxPatch((x_base, y_cur - 0.01), 2.9, 0.28,
                                 boxstyle="round,pad=0.03",
                                 facecolor=col, edgecolor=col, alpha=0.85, zorder=8)
        ax.add_patch(rect_u)
        ax.text(x_base + 0.1, y_cur + 0.13, unit_name, fontsize=9,
                color="white", fontweight='bold', va='center', zorder=11)
        y_cur -= 0.32

        for s in searches:
            ax.text(x_base + 0.15, y_cur, f"β–Ά {s}", fontsize=8,
                    color=INK, va='bottom', zorder=10)
            y_cur -= 0.25
        y_cur -= 0.08

    ax.text(4.3, 0.28, "β˜… YouTube Channel: Osmosis from Elsevier  |  @OsmosisFromElsevier",
            fontsize=9, color=BLUE, ha='center', fontweight='bold', zorder=10)
    ax.text(4.3, 0.08, "β€” Quick Reference β€”  General Medicine Study Schedule",
            fontsize=7.5, color="#aaa", ha='center', zorder=10)
    return fig


# ── Build PDF ─────────────────────────────────────────────────────────────────
output = "/tmp/workspace/general-medicine-notes/GM_Study_Schedule.pdf"
with PdfPages(output) as pdf:
    # Cover
    fig = cover_page()
    pdf.savefig(fig, bbox_inches='tight', dpi=150)
    plt.close(fig)
    print("  βœ“ Cover page")

    # 6 week pages
    for w in range(1, 7):
        fig = week_page(w)
        pdf.savefig(fig, bbox_inches='tight', dpi=150)
        plt.close(fig)
        print(f"  βœ“ Week {w}")

    # Quick reference
    fig = quick_ref_page()
    pdf.savefig(fig, bbox_inches='tight', dpi=150)
    plt.close(fig)
    print("  βœ“ Quick Reference page")

import os
print(f"\nDone! {output}  ({os.path.getsize(output)//1024} KB)")
Running Command

cd /tmp/workspace/general-medicine-notes && python3 study_schedule.py 2>&1

Your 6-week study schedule is ready! πŸŽ‰

GM Study Schedule

PDF Document Β· PDF


What's Inside (8 pages, notebook style):

πŸ“„ Page 1 β€” Cover Page
  • Full overview of all 6 weeks
  • How to use the schedule
  • Syllabus hours bar chart (visual breakdown of all 11 units)
πŸ“„ Pages 2-7 β€” One Page Per Week
WeekUnitsDays
Week 1Infection + Poisoning7 days
Week 2Nutrition + Endocrine7 days
Week 3Endocrine cont. + Blood7 days
Week 4Digestive System7 days
Week 5Cardiovascular + Respiratory7 days
Week 6Skin + Paeds + Psychiatry + Grand Revision7 days
Each day shows:
  • β–Ά Exact Osmosis search term to type into YouTube
  • ⏱ Time split β€” 30 min watch + 20 min notes + 10 min quiz
  • βœ“ Checkbox to tick when done
  • Weekly tips + progress tracker
πŸ“„ Page 8 β€” Quick Reference
  • All 42 Osmosis search terms in one place, organized by unit

How to start: Open YouTube β†’ go to @OsmosisFromElsevier β†’ search the exact text shown for Monday Week 1. That's it! πŸš€
This is a shared conversation. Sign in to Orris to start your own chat.