Generate pdf on cancer

Asking for Preferences
Reading File
Reading File
Finding Sources
Finding Sources
Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Reading File
Reading File
Running Command

mkdir -p /home/daytona/workspace/cancer-pdf && ls /home/daytona/workspace/cancer…

Writing File

~/cancer-pdf/generate_cancer_pdf.py

from reportlab.lib.pagesizes import A4
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm
from reportlab.lib import colors
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    HRFlowable, PageBreak, ListFlowable, ListItem, KeepTogether
)
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_JUSTIFY
from reportlab.platypus import BaseDocTemplate, Frame, PageTemplate
from reportlab.lib.colors import HexColor
import datetime

OUTPUT = "/home/daytona/workspace/cancer-pdf/Cancer_Overview_Medical_Students.pdf"

# ── Color palette ──────────────────────────────────────────────────────────────
DARK_BLUE   = HexColor("#1A3A5C")
MED_BLUE    = HexColor("#2E6DA4")
LIGHT_BLUE  = HexColor("#D6E8F7")
ACCENT      = HexColor("#C0392B")  # red accent
TABLE_HEADER= HexColor("#1A3A5C")
TABLE_ROW1  = HexColor("#EAF2FB")
TABLE_ROW2  = HexColor("#FFFFFF")
LIGHT_GRAY  = HexColor("#F5F5F5")
MID_GRAY    = HexColor("#555555")
GREEN       = HexColor("#1A6B3C")

# ── Document setup ─────────────────────────────────────────────────────────────
doc = SimpleDocTemplate(
    OUTPUT,
    pagesize=A4,
    rightMargin=2*cm, leftMargin=2*cm,
    topMargin=2.5*cm, bottomMargin=2.5*cm,
    title="Cancer: A Comprehensive Overview for Medical Students",
    author="Orris Medical Library",
)

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

def S(name, **kw):
    s = ParagraphStyle(name, **kw)
    return s

cover_title = S("CoverTitle",
    fontName="Helvetica-Bold", fontSize=32, textColor=HexColor("#FFFFFF"),
    alignment=TA_CENTER, leading=38, spaceAfter=10)

cover_sub = S("CoverSub",
    fontName="Helvetica", fontSize=15, textColor=HexColor("#D6E8F7"),
    alignment=TA_CENTER, leading=20, spaceAfter=6)

cover_meta = S("CoverMeta",
    fontName="Helvetica", fontSize=11, textColor=HexColor("#AACCE0"),
    alignment=TA_CENTER, leading=16)

h1 = S("H1",
    fontName="Helvetica-Bold", fontSize=17, textColor=DARK_BLUE,
    spaceBefore=18, spaceAfter=6, leading=22,
    borderPad=4)

h2 = S("H2",
    fontName="Helvetica-Bold", fontSize=13, textColor=MED_BLUE,
    spaceBefore=12, spaceAfter=4, leading=17)

h3 = S("H3",
    fontName="Helvetica-Bold", fontSize=11, textColor=HexColor("#2c5f8a"),
    spaceBefore=8, spaceAfter=3, leading=14)

body = S("Body",
    fontName="Helvetica", fontSize=10, textColor=HexColor("#222222"),
    leading=15, spaceAfter=6, alignment=TA_JUSTIFY)

body_bold = S("BodyBold",
    fontName="Helvetica-Bold", fontSize=10, textColor=HexColor("#222222"),
    leading=15, spaceAfter=4)

callout = S("Callout",
    fontName="Helvetica", fontSize=9.5, textColor=HexColor("#1A3A5C"),
    leading=14, spaceAfter=4, alignment=TA_JUSTIFY,
    leftIndent=8, rightIndent=8)

ref_style = S("RefStyle",
    fontName="Helvetica", fontSize=8.5, textColor=MID_GRAY,
    leading=13, spaceAfter=2)

footer_style = S("FooterStyle",
    fontName="Helvetica", fontSize=8, textColor=MID_GRAY,
    alignment=TA_CENTER)

# ── Helper builders ────────────────────────────────────────────────────────────

def section_header(title, subtitle=None):
    elems = []
    elems.append(HRFlowable(width="100%", thickness=3, color=MED_BLUE, spaceAfter=4))
    elems.append(Paragraph(title, h1))
    if subtitle:
        elems.append(Paragraph(subtitle, h2))
    elems.append(Spacer(1, 3))
    return elems

def callout_box(text, bg=LIGHT_BLUE, border=MED_BLUE):
    data = [[Paragraph(text, callout)]]
    t = Table(data, colWidths=[16.5*cm])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), bg),
        ("BOX",        (0,0), (-1,-1), 1.5, border),
        ("LEFTPADDING",(0,0),(-1,-1), 10),
        ("RIGHTPADDING",(0,0),(-1,-1), 10),
        ("TOPPADDING", (0,0),(-1,-1), 8),
        ("BOTTOMPADDING",(0,0),(-1,-1), 8),
        ("ROWBACKGROUNDS",(0,0),(-1,-1),[bg]),
    ]))
    return t

def two_col_table(headers, rows, col_widths=None):
    if col_widths is None:
        col_widths = [8*cm, 8.5*cm]
    all_rows = [[Paragraph(h, S("TH", fontName="Helvetica-Bold", fontSize=10,
                  textColor=HexColor("#FFFFFF"), leading=13)) for h in headers]]
    for i, row in enumerate(rows):
        bg = TABLE_ROW1 if i % 2 == 0 else TABLE_ROW2
        all_rows.append([Paragraph(str(c), S(f"TD{i}", fontName="Helvetica",
                fontSize=9.5, leading=13, textColor=HexColor("#222222"))) for c in row])
    t = Table(all_rows, colWidths=col_widths, repeatRows=1)
    style = [
        ("BACKGROUND",  (0,0), (-1,0), TABLE_HEADER),
        ("ROWBACKGROUNDS", (0,1), (-1,-1), [TABLE_ROW1, TABLE_ROW2]),
        ("BOX",         (0,0), (-1,-1), 1, MED_BLUE),
        ("INNERGRID",   (0,0), (-1,-1), 0.5, HexColor("#CCDDEE")),
        ("TOPPADDING",  (0,0), (-1,-1), 5),
        ("BOTTOMPADDING",(0,0),(-1,-1), 5),
        ("LEFTPADDING", (0,0), (-1,-1), 7),
        ("RIGHTPADDING",(0,0),(-1,-1), 7),
        ("VALIGN",      (0,0), (-1,-1), "TOP"),
    ]
    t.setStyle(TableStyle(style))
    return t

def bullet_list(items, style=body):
    return ListFlowable(
        [ListItem(Paragraph(item, style), bulletColor=MED_BLUE, leftIndent=18) for item in items],
        bulletType="bullet", bulletFontName="Helvetica", bulletFontSize=10,
        leftIndent=12, spaceBefore=2, spaceAfter=2
    )

def numbered_list(items, style=body):
    return ListFlowable(
        [ListItem(Paragraph(item, style), leftIndent=18) for item in items],
        bulletType="1", bulletFontName="Helvetica", bulletFontSize=10,
        leftIndent=12, spaceBefore=2, spaceAfter=2
    )

# ── Page callbacks ─────────────────────────────────────────────────────────────
def cover_page_cb(canvas, doc):
    w, h = A4
    # Navy gradient background (simulated with rect)
    canvas.setFillColor(HexColor("#0D2340"))
    canvas.rect(0, 0, w, h, fill=1, stroke=0)
    # Lighter top band
    canvas.setFillColor(HexColor("#1A3A5C"))
    canvas.rect(0, h*0.55, w, h*0.45, fill=1, stroke=0)
    # Accent stripe
    canvas.setFillColor(ACCENT)
    canvas.rect(0, h*0.52, w, 0.5*cm, fill=1, stroke=0)
    # Bottom DNA-like decorative stripe
    canvas.setFillColor(MED_BLUE)
    canvas.rect(0, 2*cm, w, 0.3*cm, fill=1, stroke=0)

def normal_page_cb(canvas, doc):
    """Header + footer for normal pages."""
    w, h = A4
    # Top header bar
    canvas.setFillColor(DARK_BLUE)
    canvas.rect(0, h - 1.5*cm, w, 1.5*cm, fill=1, stroke=0)
    canvas.setFillColor(HexColor("#FFFFFF"))
    canvas.setFont("Helvetica-Bold", 9)
    canvas.drawString(2*cm, h - 1.0*cm, "CANCER: A COMPREHENSIVE OVERVIEW")
    canvas.setFont("Helvetica", 9)
    canvas.drawRightString(w - 2*cm, h - 1.0*cm, "For Medical Students & Clinicians")
    # Footer
    canvas.setFillColor(LIGHT_GRAY)
    canvas.rect(0, 0, w, 1.3*cm, fill=1, stroke=0)
    canvas.setFillColor(MID_GRAY)
    canvas.setFont("Helvetica", 8)
    canvas.drawCentredString(w/2, 0.6*cm, f"Page {doc.page}  |  Sources: Robbins & Kumar Basic Pathology; Robbins, Cotran & Kumar Pathologic Basis of Disease  |  © Orris {datetime.date.today().year}")
    canvas.setFillColor(MED_BLUE)
    canvas.rect(0, 1.3*cm, w, 0.15*cm, fill=1, stroke=0)

# ── Build content ──────────────────────────────────────────────────────────────
story = []

# ═══════════════════════════════════════════════════════════════════════════════
# COVER PAGE
# ═══════════════════════════════════════════════════════════════════════════════
story.append(Spacer(1, 4.5*cm))
story.append(Paragraph("CANCER", cover_title))
story.append(Spacer(1, 0.5*cm))
story.append(Paragraph("A Comprehensive Overview", cover_sub))
story.append(Spacer(1, 0.3*cm))
story.append(Paragraph("Types · Causes · Pathogenesis · Diagnosis · Treatment", cover_sub))
story.append(Spacer(1, 1.5*cm))
story.append(Paragraph("For Medical Students & Clinicians", cover_meta))
story.append(Spacer(1, 0.5*cm))
story.append(Paragraph(f"Compiled July {datetime.date.today().year}", cover_meta))
story.append(Spacer(1, 0.4*cm))
story.append(Paragraph("Sources: Robbins & Kumar Basic Pathology | Robbins, Cotran & Kumar Pathologic Basis of Disease", cover_meta))
story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════════
# 1. INTRODUCTION
# ═══════════════════════════════════════════════════════════════════════════════
story += section_header("1.  Introduction to Cancer")

story.append(Paragraph(
    "Cancer is the second leading cause of death worldwide; only cardiovascular diseases take a greater toll. "
    "Cancer is not a single disease but a heterogeneous group of disorders, all sharing a profound dysregulation "
    "of cell growth and behaviour. Some types of cancer are curable, while others remain virtually always fatal. "
    "Advances in diagnosis, treatment, and prognosis depend on a deeper understanding of the molecular and cellular "
    "basis of each cancer type.", body))

story.append(callout_box(
    "<b>Key concept:</b> Cancer is fundamentally a <b>genetic disorder</b> caused by DNA mutations that may arise "
    "from environmental mutagens, spontaneous replication errors, or inherited germline variants. "
    "These mutations confer selective growth or survival advantages on affected cells, which then expand clonally "
    "and, through stepwise Darwinian selection, give rise to malignant tumours.",
    bg=LIGHT_BLUE, border=MED_BLUE))
story.append(Spacer(1, 8))

story.append(Paragraph("Fundamental Shared Features of All Cancers", h2))
story.append(bullet_list([
    "<b>Genetic origin:</b> DNA mutations (somatic or germline) plus epigenetic alterations.",
    "<b>Clonal expansion:</b> Tumours arise from a single cell and expand clonally.",
    "<b>Tumour progression:</b> Continued Darwinian selection favours genetically aggressive subclones.",
    "<b>Disruption of normal growth controls:</b> Oncogene activation and tumour-suppressor loss.",
    "<b>Ability to invade and metastasise:</b> The hallmark distinguishing malignant from benign.",
]))

story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════════
# 2. NOMENCLATURE & CLASSIFICATION
# ═══════════════════════════════════════════════════════════════════════════════
story += section_header("2.  Nomenclature &amp; Classification")

story.append(Paragraph(
    "Tumours (neoplasms) are classified primarily by their <b>cell of origin</b> and by their "
    "<b>biological behaviour</b> — benign or malignant.", body))

story.append(Paragraph("Benign vs. Malignant Tumours", h2))
story.append(two_col_table(
    ["Feature", "Benign", "Malignant"],
    [
        ["Differentiation", "Well-differentiated; resembles parent tissue", "Variable; may be poorly differentiated (anaplastic)"],
        ["Growth rate", "Slow; mitoses rare and normal", "Rapid; mitoses frequent and abnormal"],
        ["Local invasion", "Non-invasive; remains localised", "Invasive; infiltrates adjacent structures"],
        ["Capsule", "Usually present (fibrous capsule)", "Absent or incomplete"],
        ["Metastasis", "Absent", "Frequently present"],
        ["Effect on host", "Usually not life-threatening", "Can be fatal without treatment"],
        ["Recurrence after excision", "Rare", "Common"],
    ],
    col_widths=[4.5*cm, 6*cm, 6*cm]
))
story.append(Spacer(1, 10))

story.append(Paragraph("Naming Conventions", h2))
story.append(two_col_table(
    ["Cell / Tissue of Origin", "Benign Name", "Malignant Name"],
    [
        ["Epithelial (squamous)", "Squamous cell papilloma", "Squamous cell carcinoma"],
        ["Epithelial (glandular)", "Adenoma", "Adenocarcinoma"],
        ["Smooth muscle", "Leiomyoma", "Leiomyosarcoma"],
        ["Striated muscle", "Rhabdomyoma", "Rhabdomyosarcoma"],
        ["Fat", "Lipoma", "Liposarcoma"],
        ["Bone", "Osteoma", "Osteosarcoma"],
        ["Cartilage", "Chondroma", "Chondrosarcoma"],
        ["Haemopoietic (WBC)", "—", "Leukaemia / Lymphoma"],
        ["Melanocyte", "Melanocytic naevus", "Melanoma"],
        ["Nerve sheath", "Neurofibroma / Schwannoma", "Malignant peripheral nerve sheath tumour"],
    ],
    col_widths=[5.5*cm, 5.5*cm, 5.5*cm]
))
story.append(Spacer(1, 10))

story.append(callout_box(
    "<b>Carcinoma in situ (CIS):</b> Cytologically malignant cells occupying the full thickness of the epithelium "
    "with an <i>intact basement membrane</i> — the earliest recognisable form of malignant epithelial neoplasia. "
    "CIS of the cervix (CIN III) and bladder are classic examples.",
    bg=HexColor("#FEF9E7"), border=HexColor("#D4AC0D")))

story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════════
# 3. EPIDEMIOLOGY
# ═══════════════════════════════════════════════════════════════════════════════
story += section_header("3.  Epidemiology")

story.append(Paragraph("Incidence &amp; Mortality", h2))
story.append(Paragraph(
    "Cancer represents a major global health burden. The most common cancers globally include lung, breast, "
    "colorectal, prostate, and stomach cancers. Lung cancer is the leading cause of cancer-related mortality in "
    "both sexes combined. Geographic and demographic variation in incidence reflects differences in environmental "
    "exposures, lifestyle, genetic susceptibility, and access to screening.", body))

story.append(Paragraph("Risk Factors", h2))
story.append(two_col_table(
    ["Category", "Examples"],
    [
        ["Tobacco", "Lung, oral, laryngeal, oesophageal, bladder, renal, pancreatic cancers"],
        ["Ionising radiation", "Leukaemia, thyroid, breast, lung carcinoma"],
        ["Ultraviolet radiation", "Basal cell carcinoma, squamous cell carcinoma, melanoma"],
        ["Chemical carcinogens", "Aflatoxin (liver), benzene (leukaemia), asbestos (mesothelioma), aniline dyes (bladder)"],
        ["Oncogenic viruses", "HPV (cervical/oropharyngeal), EBV (Burkitt lymphoma, NPC), HBV/HCV (hepatocellular), HTLV-1 (adult T-cell leukaemia/lymphoma), HHV-8 (Kaposi sarcoma)"],
        ["Chronic inflammation", "H. pylori (gastric), IBD (colorectal), HBV/HCV (hepatocellular), chronic cholecystitis (gallbladder)"],
        ["Age", "Incidence rises sharply after age 50; multi-hit model requires years for mutation accumulation"],
        ["Hereditary factors", "BRCA1/2 (breast, ovarian), APC (FAP/colorectal), RB1 (retinoblastoma), TP53 (Li-Fraumeni), MLH1/MSH2/MSH6 (Lynch syndrome)"],
        ["Immunodeficiency", "HIV/AIDS, transplant recipients — increased incidence of virus-associated cancers"],
    ],
    col_widths=[5*cm, 11.5*cm]
))

story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════════
# 4. MOLECULAR BASIS — HALLMARKS OF CANCER
# ═══════════════════════════════════════════════════════════════════════════════
story += section_header("4.  Molecular Basis &amp; Hallmarks of Cancer")

story.append(Paragraph(
    "Hanahan and Weinberg described a set of acquired functional capabilities — the <b>hallmarks of cancer</b> — "
    "that together dictate malignant growth. These are enabled by two underlying characteristics: "
    "<b>genomic instability</b> and <b>tumour-promoting inflammation</b>.", body))

story.append(Paragraph("The Hallmarks (Hanahan &amp; Weinberg)", h2))
hallmarks = [
    ("1. Self-sufficiency in growth signals",
     "Oncogene activation (RAS, BRAF, HER2/ERBB2, EGFR). Cancer cells produce their own growth factors "
     "(autocrine loops) or constitutively activate downstream signalling. "
     "RAS point mutations occur in ~15–20% of all human tumours; ~90% of pancreatic adenocarcinomas."),
    ("2. Insensitivity to growth inhibitory signals",
     "Loss of tumour-suppressor genes (TSGs). RB (retinoblastoma protein) is the 'governor of the cell cycle': "
     "when phosphorylated, it releases E2F transcription factors, driving S-phase entry. "
     "TP53 is the 'guardian of the genome': sensing DNA damage, it triggers cell-cycle arrest or apoptosis. "
     "TP53 is mutated in >50% of all human cancers."),
    ("3. Evasion of apoptosis",
     "BCL-2 overexpression (follicular lymphoma t[14;18]). Loss of pro-apoptotic signals. "
     "Survival signals from PI3K/AKT pathway inhibit BAD and caspase-9."),
    ("4. Limitless replicative potential (immortality)",
     "Upregulation of telomerase (TERT) prevents telomere shortening, allowing indefinite cell division. "
     "Normal somatic cells have ~60–70 doublings before replicative senescence."),
    ("5. Sustained angiogenesis",
     "Tumours >1–2 mm require new blood vessels to supply O2 and nutrients. "
     "VEGF (vascular endothelial growth factor) is the primary driver. "
     "An 'angiogenic switch' tips the balance from anti-angiogenic to pro-angiogenic factors."),
    ("6. Invasion and metastasis",
     "Epithelial-to-mesenchymal transition (EMT), basement membrane degradation by MMPs, "
     "intravasation, survival in circulation, extravasation at distant sites, and colonisation."),
    ("7. Evasion of immune surveillance",
     "PD-L1 overexpression, loss of MHC class I, secretion of immunosuppressive cytokines (IL-10, TGF-β), "
     "recruitment of regulatory T cells and MDSCs into the tumour microenvironment."),
    ("8. Reprogramming of energy metabolism (Warburg effect)",
     "Aerobic glycolysis — glucose converted to lactate even in the presence of O2 — "
     "provides biosynthetic precursors for rapid proliferation. IDH1/2 mutations produce the oncometabolite "
     "2-hydroxyglutarate, which inhibits epigenetic enzymes."),
]
for title_h, desc in hallmarks:
    story.append(KeepTogether([
        Paragraph(title_h, h3),
        Paragraph(desc, body),
    ]))

story.append(Paragraph("Key Genetic Lesions in Cancer", h2))
story.append(two_col_table(
    ["Mechanism", "Examples in Cancer"],
    [
        ["Point mutations", "KRAS G12D (pancreatic, colorectal); TP53 R248W (breast, lung); BRAF V600E (melanoma, hairy cell leukaemia)"],
        ["Gene amplification", "HER2/ERBB2 amplification in breast cancer (~20%); MYCN in neuroblastoma; EGFR in glioblastoma"],
        ["Gene rearrangement / fusion", "BCR-ABL (Philadelphia chromosome, CML); EML4-ALK (lung adenocarcinoma); PML-RARα (AML M3)"],
        ["Deletion / LOH", "RB1 deletion (retinoblastoma); CDKN2A/p16 (bladder, lung); VHL (renal cell carcinoma)"],
        ["Epigenetic silencing", "MLH1 promoter methylation (microsatellite instability, colorectal cancer); CDKN2A methylation"],
        ["MicroRNA dysregulation", "miR-21 overexpression (oncomiR); miR-15a/16-1 deletion (CLL)"],
    ],
    col_widths=[5.5*cm, 11*cm]
))

story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════════
# 5. CARCINOGENESIS — MULTISTEP MODEL
# ═══════════════════════════════════════════════════════════════════════════════
story += section_header("5.  Carcinogenesis: The Multistep Model")

story.append(Paragraph(
    "Carcinogenesis is a <b>multistep process</b> involving the stepwise accumulation of complementary mutations "
    "over years or decades. No single mutation is sufficient to produce a fully malignant tumour.", body))

story.append(Paragraph("Colorectal Cancer as a Model: The Adenoma-Carcinoma Sequence", h2))
story.append(two_col_table(
    ["Step", "Molecular Event", "Morphology"],
    [
        ["1", "Loss of APC (tumour suppressor)", "Normal epithelium → Hyperproliferative epithelium"],
        ["2", "Activation of KRAS oncogene", "Early adenoma (dysplastic crypt focus)"],
        ["3", "Loss of SMAD2/4 (TGF-β signalling)", "Intermediate adenoma"],
        ["4", "Loss of TP53", "Late adenoma (villous features)"],
        ["5", "Additional mutations; telomerase activation", "Invasive carcinoma"],
    ],
    col_widths=[1.5*cm, 7*cm, 7*cm]
))
story.append(Spacer(1, 8))

story.append(Paragraph("Chemical Carcinogens", h2))
story.append(two_col_table(
    ["Type", "Mechanism", "Examples"],
    [
        ["Direct-acting", "Electrophilic; react directly with DNA", "Alkylating agents (cyclophosphamide), acylating agents"],
        ["Indirect-acting (procarcinogens)", "Require metabolic activation by P-450 enzymes", "Polycyclic aromatic hydrocarbons (benzo[a]pyrene in tobacco smoke), aflatoxin B1"],
        ["Promoters", "Not mutagenic; enhance cell proliferation after initiation", "Phorbol esters, hormones, saccharin (in rodents)"],
    ],
    col_widths=[4*cm, 6.5*cm, 6*cm]
))
story.append(Spacer(1, 8))

story.append(Paragraph("Radiation Carcinogenesis", h2))
story.append(bullet_list([
    "<b>Ionising radiation</b> (X-rays, gamma-rays, alpha/beta particles): causes double-strand DNA breaks, base damage, and chromosomal aberrations. Classic association with leukaemia (post-Hiroshima), thyroid carcinoma (post-Chernobyl), and mesothelioma (radon in miners).",
    "<b>Ultraviolet radiation</b> (UV-B, 280–320 nm): forms pyrimidine dimers (cyclobutane dimers and 6-4 photoproducts). Key mutation signature: C→T transitions at dipyrimidine sites. Xeroderma pigmentosum patients (defective nucleotide excision repair) have a 2000-fold elevated skin cancer risk.",
]))

story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════════
# 6. MAJOR CANCER TYPES
# ═══════════════════════════════════════════════════════════════════════════════
story += section_header("6.  Major Cancer Types")

story.append(Paragraph("6a.  Carcinomas (epithelial origin, ~85% of all cancers)", h2))
story.append(two_col_table(
    ["Type", "Common Sites", "Key Molecular Features / Notes"],
    [
        ["Adenocarcinoma", "Lung, breast, colon, prostate, endometrium, pancreas", "Gland-forming; commonly expresses mucin; KRAS, EGFR, HER2 mutations depending on site"],
        ["Squamous cell carcinoma (SCC)", "Lung, head & neck, oesophagus, cervix, skin", "Keratin pearls on histology; EGFR overexpression; HPV-related in oropharynx/cervix"],
        ["Urothelial (transitional cell) carcinoma", "Bladder, ureter, renal pelvis", "Associated with aniline dyes, cyclophosphamide, smoking; frequent FGFR3 mutations in low-grade"],
        ["Hepatocellular carcinoma", "Liver", "Associated with HBV, HCV, aflatoxin, cirrhosis; AFP elevation; TERT promoter mutations"],
        ["Renal cell carcinoma (clear cell)", "Kidney", "VHL mutation/deletion → HIF stabilisation → VEGF overproduction; treated with anti-VEGF and mTOR inhibitors"],
    ],
    col_widths=[4*cm, 5*cm, 7.5*cm]
))
story.append(Spacer(1, 10))

story.append(Paragraph("6b.  Sarcomas (mesenchymal origin, ~1% of cancers)", h2))
story.append(bullet_list([
    "<b>Osteosarcoma:</b> Most common primary bone malignancy; metaphysis of long bones; bimodal peak (adolescents, elderly with Paget's disease); RB1 and TP53 mutations; alkaline phosphatase elevated.",
    "<b>Ewing sarcoma:</b> Diaphysis of long bones; t(11;22) translocation producing EWS-FLI1 fusion; highly aggressive; small round blue cell tumour on histology.",
    "<b>Leiomyosarcoma:</b> Smooth muscle origin; uterus, retroperitoneum; must be distinguished from leiomyoma by mitotic index and necrosis.",
    "<b>Liposarcoma:</b> Most common soft-tissue sarcoma in adults; retroperitoneum and extremities; MDM2 amplification in well-differentiated/dedifferentiated subtypes.",
    "<b>Gastrointestinal stromal tumour (GIST):</b> c-KIT (CD117) mutation in ~85%; responds dramatically to imatinib (KIT/PDGFRA inhibitor).",
]))
story.append(Spacer(1, 8))

story.append(Paragraph("6c.  Haematological Malignancies", h2))
story.append(two_col_table(
    ["Disease", "Cell of Origin", "Key Features"],
    [
        ["Acute myeloid leukaemia (AML)", "Myeloid progenitor", "FAB M3 (APL): t(15;17) PML-RARα; treated with ATRA + arsenic. FLT3, NPM1 mutations are common."],
        ["Chronic myeloid leukaemia (CML)", "Pluripotent HSC", "t(9;22) Philadelphia chromosome; BCR-ABL; imatinib (tyrosine kinase inhibitor) is curative in most."],
        ["Acute lymphoblastic leukaemia (ALL)", "B- or T-lymphoblast", "Most common childhood cancer; Ph+ ALL has worse prognosis; treated with induction/consolidation/maintenance chemo ± TKI."],
        ["Chronic lymphocytic leukaemia (CLL)", "Mature B cell", "Most common adult leukaemia in the West; CD5+/CD19+/CD23+; del(17p) = TP53 loss = poor prognosis; BTK inhibitors (ibrutinib)."],
        ["Diffuse large B-cell lymphoma (DLBCL)", "Germinal centre / activated B cell", "Most common aggressive NHL; BCL-2 and BCL-6 translocations; R-CHOP is standard first-line therapy."],
        ["Hodgkin lymphoma", "Reed-Sternberg cells (B-cell origin)", "Bimodal age distribution; CD15+/CD30+; EBV association in mixed cellularity subtype; ABVD chemotherapy."],
        ["Multiple myeloma", "Plasma cell", "M-protein on SPEP; lytic bone lesions; hypercalcaemia, renal failure, anaemia, bone pain (CRAB). t(4;14), del(17p) = high risk."],
    ],
    col_widths=[4.5*cm, 3.5*cm, 8.5*cm]
))

story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════════
# 7. CHARACTERISTICS OF MALIGNANCY — INVASION & METASTASIS
# ═══════════════════════════════════════════════════════════════════════════════
story += section_header("7.  Invasion &amp; Metastasis")

story.append(Paragraph(
    "Metastasis is defined as the spread of tumour cells to sites <b>physically discontinuous</b> with the primary tumour. "
    "Approximately 30% of patients with newly diagnosed solid tumours have clinically evident metastases, "
    "and a further 20% have occult micrometastases at diagnosis.", body))

story.append(Paragraph("Routes of Spread", h2))
story.append(two_col_table(
    ["Route", "Mechanism", "Typical Cancers"],
    [
        ["Lymphatic (most common for carcinomas)", "Tumour cells enter lymphatics and travel to regional nodes, then to the thoracic duct and systemic circulation", "Breast, colorectal, lung, melanoma"],
        ["Haematogenous", "Tumour cells invade blood vessels (especially thin-walled veins); portal system → liver; inferior vena cava → lung; Batson's plexus → vertebrae", "Sarcomas, renal cell carcinoma, hepatocellular carcinoma"],
        ["Transcoelomic (cavity seeding)", "Direct seeding across peritoneum, pleura, or pericardium", "Ovarian carcinoma (peritoneum), lung cancer (pleura)"],
        ["Perineural spread", "Tumour cells migrate along nerve sheaths", "Adenoid cystic carcinoma, prostate cancer"],
    ],
    col_widths=[4.5*cm, 7.5*cm, 4.5*cm]
))
story.append(Spacer(1, 8))

story.append(Paragraph("Steps of Metastasis (Invasion-Metastasis Cascade)", h2))
story.append(numbered_list([
    "<b>Local invasion:</b> E-cadherin downregulation → epithelial-to-mesenchymal transition (EMT); MMP secretion degrades basement membrane and extracellular matrix.",
    "<b>Intravasation:</b> Tumour cells enter blood or lymphatic vessels.",
    "<b>Survival in circulation:</b> Cancer cells form emboli with platelets; evade NK cells.",
    "<b>Arrest and extravasation:</b> Cells adhere to endothelium at distant site using selectins and integrins.",
    "<b>Colonisation:</b> Establishment of a metastatic niche; requires tumour-stroma interactions and evasion of local immunity.",
]))
story.append(Spacer(1, 8))

story.append(callout_box(
    "<b>Organ tropism (Seed and Soil hypothesis — Paget, 1889):</b> Certain tumours preferentially metastasise to "
    "specific organs: breast → bone/liver/lung/brain; prostate → bone (osteoblastic); lung → brain/adrenal/bone; "
    "colorectal → liver (via portal circulation); melanoma → brain/liver/lung.",
    bg=HexColor("#F9EBEA"), border=ACCENT))

story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════════
# 8. CLINICAL ASPECTS
# ═══════════════════════════════════════════════════════════════════════════════
story += section_header("8.  Clinical Aspects of Cancer")

story.append(Paragraph("Local &amp; Systemic Effects of Tumours", h2))
story.append(two_col_table(
    ["Effect", "Mechanism / Examples"],
    [
        ["Mass effect / obstruction", "Colonic carcinoma causing obstruction; pituitary adenoma compressing optic chiasm"],
        ["Haemorrhage / ulceration", "GI bleeding from gastric carcinoma; haemoptysis from lung cancer"],
        ["Cancer cachexia", "TNF-α (cachectin), IL-1, IL-6, IFN-γ secreted by tumour and immune cells → lipolysis, proteolysis, anorexia, fatigue; associated with poor prognosis"],
        ["Infection", "Neutropenia, mucosal disruption, immunosuppression from tumour or treatment"],
        ["Bone marrow replacement", "Myelophthisic anaemia; leukoerythroblastic blood picture"],
    ],
    col_widths=[5*cm, 11.5*cm]
))
story.append(Spacer(1, 8))

story.append(Paragraph("Paraneoplastic Syndromes", h2))
story.append(Paragraph(
    "Paraneoplastic syndromes are symptom complexes not attributable to tumour mass, metastasis, or metabolic "
    "disturbances. They result from <b>ectopic hormone production</b>, <b>autoimmune/cross-reactive mechanisms</b>, "
    "or secretion of <b>bioactive peptides</b>.", body))
story.append(two_col_table(
    ["Syndrome", "Mediator / Mechanism", "Associated Tumour"],
    [
        ["SIADH (hyponatraemia)", "Ectopic ADH secretion", "Small cell lung carcinoma (SCLC)"],
        ["Cushing syndrome", "Ectopic ACTH secretion", "SCLC, bronchial carcinoid, pancreatic neuroendocrine tumour"],
        ["Hypercalcaemia of malignancy", "PTHrP (parathyroid hormone-related peptide) or osteolytic metastases", "Squamous cell carcinoma (lung, head & neck), renal cell carcinoma, multiple myeloma"],
        ["Eaton-Lambert syndrome", "Auto-antibodies against voltage-gated calcium channels (VGCC)", "Small cell lung carcinoma"],
        ["Cerebellar degeneration", "Anti-Yo (anti-Purkinje cell) antibodies", "Ovarian and breast carcinoma"],
        ["Acanthosis nigricans", "Ectopic insulin-like / TGF-α signalling", "Gastric, lung, uterine carcinoma"],
        ["Migratory thrombophlebitis (Trousseau sign)", "Tumour mucin activates clotting; hypercoagulability", "Pancreatic adenocarcinoma, other mucin-secreting carcinomas"],
        ["Carcinoid syndrome", "Serotonin, histamine, bradykinin secretion", "Carcinoid tumour (especially hepatic metastases); pancreatic NET"],
    ],
    col_widths=[5*cm, 6*cm, 5.5*cm]
))

story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════════
# 9. GRADING & STAGING
# ═══════════════════════════════════════════════════════════════════════════════
story += section_header("9.  Grading &amp; Staging")

story.append(two_col_table(
    ["Parameter", "Grading", "Staging"],
    [
        ["Definition", "Pathological assessment of tumour differentiation (cytological atypia, mitotic rate, necrosis)", "Clinical/pathological extent of disease spread"],
        ["Basis", "Microscopic morphology of tumour cells", "Tumour size, lymph node involvement, distant metastases"],
        ["Purpose", "Indicates biological aggressiveness of individual tumour cells", "Guides treatment selection and predicts prognosis"],
        ["Examples", "WHO Grade 1–4 (brain); Gleason score (prostate); Scarff-Bloom-Richardson (breast)", "TNM system (T = primary tumour, N = nodes, M = metastasis); FIGO for gynaecological cancers"],
        ["Limitation", "May not reflect overall tumour behaviour in all sites", "Does not capture tumour biology or molecular features"],
    ],
    col_widths=[3.5*cm, 7*cm, 6*cm]
))
story.append(Spacer(1, 10))

story.append(Paragraph("TNM Staging System", h2))
story.append(two_col_table(
    ["Stage", "Definition"],
    [
        ["Stage 0", "Carcinoma in situ; no invasion"],
        ["Stage I", "Small tumour localised to organ of origin; no node involvement"],
        ["Stage II", "Larger tumour and/or regional node involvement (N1)"],
        ["Stage III", "Extensive local/regional disease; multiple node groups involved"],
        ["Stage IV", "Distant metastases (M1) — any T, any N"],
    ],
    col_widths=[3.5*cm, 13*cm]
))

story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════════
# 10. LABORATORY DIAGNOSIS
# ═══════════════════════════════════════════════════════════════════════════════
story += section_header("10.  Laboratory Diagnosis")

story.append(Paragraph("Morphological Methods", h2))
story.append(two_col_table(
    ["Method", "Description / Use"],
    [
        ["Excisional / incisional biopsy", "Gold standard for solid tumours; provides architecture and margin status"],
        ["Core needle biopsy", "Preserves architecture; used for breast, liver, kidney, prostate"],
        ["Fine needle aspiration cytology (FNAC)", "Cytology only; useful for thyroid, lymph nodes, salivary gland; cannot assess invasion"],
        ["Frozen section", "Intraoperative; guides extent of surgical resection; less accurate than paraffin"],
        ["Immunohistochemistry (IHC)", "Identifies cell lineage, receptor status (ER/PR/HER2 in breast), prognostic markers; essential for lymphoma classification"],
        ["Electron microscopy", "Ultrastructural characterisation; Birbeck granules (Langerhans histiocytosis); dense-core granules (neuroendocrine tumours)"],
        ["Flow cytometry", "Immunophenotyping of haematological malignancies; determines T vs B cell, clonality"],
    ],
    col_widths=[5*cm, 11.5*cm]
))
story.append(Spacer(1, 8))

story.append(Paragraph("Tumour Markers", h2))
story.append(two_col_table(
    ["Marker", "Cancer Association", "Clinical Use"],
    [
        ["AFP (alpha-fetoprotein)", "Hepatocellular carcinoma, germ cell tumours", "Diagnosis, monitoring; raised in yolk sac tumour"],
        ["CEA (carcinoembryonic antigen)", "Colorectal, gastric, breast, lung carcinoma", "Monitoring recurrence; not screening (low specificity)"],
        ["PSA (prostate-specific antigen)", "Prostate carcinoma", "Screening (controversial), staging, monitoring treatment response"],
        ["hCG (beta-human chorionic gonadotropin)", "Choriocarcinoma, germ cell tumours", "Highly sensitive marker; used for staging and monitoring"],
        ["CA 125", "Ovarian carcinoma (especially serous)", "Monitoring response; elevated in other conditions (low specificity for screening)"],
        ["CA 19-9", "Pancreatic adenocarcinoma, biliary tract", "Monitoring; not useful as screening test"],
        ["LDH (lactate dehydrogenase)", "Lymphoma, germ cell tumours, melanoma", "Reflects tumour bulk and disease activity"],
        ["Calcitonin", "Medullary thyroid carcinoma", "Diagnosis and follow-up; elevated in familial MEN2"],
        ["Chromogranin A", "Neuroendocrine tumours (carcinoids, phaeochromocytoma)", "Diagnosis and monitoring NETs"],
    ],
    col_widths=[4*cm, 5.5*cm, 7*cm]
))
story.append(Spacer(1, 8))

story.append(Paragraph("Molecular &amp; Genomic Diagnosis", h2))
story.append(bullet_list([
    "<b>PCR / RT-PCR:</b> Detection of fusion transcripts (BCR-ABL, PML-RARα); minimal residual disease (MRD) monitoring.",
    "<b>Fluorescence in situ hybridisation (FISH):</b> Gene amplifications (HER2, ALK, ROS1) and chromosomal translocations.",
    "<b>Next-generation sequencing (NGS) / comprehensive genomic profiling:</b> Simultaneous detection of SNVs, indels, CNVs, fusions, and TMB/MSI status across hundreds of genes.",
    "<b>Liquid biopsy (cell-free DNA / ctDNA):</b> Non-invasive monitoring of tumour evolution, treatment response, and resistance mutations.",
    "<b>Microsatellite instability (MSI) / mismatch repair (MMR) testing:</b> Predicts response to immune checkpoint inhibitors; required for Lynch syndrome screening in colorectal cancers.",
]))

story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════════
# 11. TREATMENT
# ═══════════════════════════════════════════════════════════════════════════════
story += section_header("11.  Treatment Modalities")

story.append(Paragraph("Overview of Treatment Strategies", h2))
story.append(two_col_table(
    ["Modality", "Mechanism", "Key Indications / Examples"],
    [
        ["Surgery", "Physical removal of primary tumour ± regional nodes; potentially curative for localised disease", "Most solid tumours (Stage I–III); also palliative (bypass, decompression)"],
        ["Radiotherapy (RT)", "Ionising radiation causes DNA damage → apoptosis; kills proliferating cells in tumour and margin", "Head & neck SCC (definitive RT), breast (adjuvant), cervical cancer (chemoRT), brain metastases (WBRT/SRS), palliative bone pain"],
        ["Conventional chemotherapy", "Cytotoxic drugs target rapidly dividing cells: alkylating agents, antimetabolites, topoisomerase inhibitors, spindle poisons (taxanes, vinca alkaloids)", "Haematological malignancies, germ cell tumours, small cell lung cancer; adjuvant in breast, colon cancers"],
        ["Targeted therapy", "Small molecules or antibodies block specific oncogenic drivers", "Imatinib → BCR-ABL (CML); trastuzumab → HER2 (breast); erlotinib/osimertinib → EGFR (lung); vemurafenib → BRAF V600E (melanoma); venetoclax → BCL-2 (CLL); ibrutinib → BTK (CLL/MCL)"],
        ["Immunotherapy", "Restore or amplify anti-tumour immune responses", "PD-1/PD-L1 checkpoint inhibitors (pembrolizumab, nivolumab, atezolizumab) — melanoma, NSCLC, MSI-H tumours; CTLA-4 (ipilimumab); CAR-T cell therapy (DLBCL, ALL, multiple myeloma)"],
        ["Hormone therapy", "Deprive hormone-sensitive tumours of trophic signals", "Tamoxifen / aromatase inhibitors (ER+ breast cancer); ADT/enzalutamide/abiraterone (prostate cancer); progestins (endometrial cancer)"],
        ["Stem cell transplantation (SCT)", "High-dose chemotherapy ± TBI followed by autologous or allogeneic haematopoietic reconstitution", "Autologous SCT: multiple myeloma, lymphoma. Allogeneic SCT: AML, ALL, MDS — graft-vs-leukaemia (GVL) effect is therapeutic."],
    ],
    col_widths=[4*cm, 5.5*cm, 7*cm]
))
story.append(Spacer(1, 8))

story.append(callout_box(
    "<b>Precision oncology:</b> Comprehensive molecular profiling of each patient's tumour enables selection of "
    "agents targeting that specific tumour's driver alterations. Examples: KRAS G12C inhibitors (sotorasib) in "
    "NSCLC; NTRK inhibitors (larotrectinib) in TRK fusion-positive cancers; PARP inhibitors (olaparib) in "
    "BRCA1/2-mutated breast and ovarian cancers; RET inhibitors (selpercatinib) in RET-fusion lung and thyroid cancers.",
    bg=HexColor("#E8F8F5"), border=GREEN))

story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════════
# 12. IMMUNE SURVEILLANCE & IMMUNOTHERAPY
# ═══════════════════════════════════════════════════════════════════════════════
story += section_header("12.  Tumour Immunology &amp; Immunotherapy")

story.append(Paragraph("Tumour Antigens", h2))
story.append(bullet_list([
    "<b>Tumour-specific antigens (TSAs) / neoantigens:</b> Arise from somatic mutations; unique to tumour cells; recognised by cytotoxic T lymphocytes (CTLs). High TMB (tumour mutational burden) tumours — melanoma, NSCLC — have many neoantigens.",
    "<b>Tumour-associated antigens (TAAs):</b> Overexpressed in tumours but also present on normal cells (e.g., HER2, WT1, MAGE, NY-ESO-1).",
    "<b>Oncofetal antigens:</b> AFP, CEA — re-expressed in malignancy from foetal gene programmes.",
    "<b>Differentiation antigens:</b> CD20 (B-cell lymphoma → rituximab); prostate-specific antigen (PSA); melanocyte differentiation antigens (MART-1, gp100).",
]))
story.append(Spacer(1, 8))

story.append(Paragraph("Mechanisms of Immune Evasion", h2))
story.append(bullet_list([
    "Loss of MHC class I expression → invisible to CD8+ CTLs.",
    "Expression of PD-L1 (CD274) → binds PD-1 on T cells → T-cell exhaustion.",
    "CTLA-4 engagement → downregulates early T-cell activation.",
    "Secretion of TGF-β, IL-10, VEGF → immunosuppressive tumour microenvironment.",
    "Recruitment of regulatory T cells (Tregs) and myeloid-derived suppressor cells (MDSCs).",
    "IDO (indoleamine-2,3-dioxygenase) production → tryptophan depletion → suppresses T-cell function.",
]))
story.append(Spacer(1, 8))

story.append(Paragraph("Immune Checkpoint Inhibitors (ICIs)", h2))
story.append(two_col_table(
    ["Agent", "Target", "Approved Indications (selected)"],
    [
        ["Pembrolizumab (Keytruda)", "PD-1", "NSCLC, melanoma, MSI-H/dMMR solid tumours, HNSCC, urothelial, cervical, TMB-high"],
        ["Nivolumab (Opdivo)", "PD-1", "Melanoma, NSCLC, renal cell, HCC, HNSCC, gastric, colorectal (dMMR)"],
        ["Atezolizumab (Tecentriq)", "PD-L1", "NSCLC, urothelial carcinoma, triple-negative breast cancer (PD-L1+)"],
        ["Durvalumab (Imfinzi)", "PD-L1", "NSCLC (consolidation after CRT), biliary tract cancer"],
        ["Ipilimumab (Yervoy)", "CTLA-4", "Melanoma, RCC (combo with nivolumab), colorectal (dMMR)"],
        ["Tremelimumab (Imjudo)", "CTLA-4", "HCC (combo with durvalumab)"],
    ],
    col_widths=[5*cm, 3*cm, 8.5*cm]
))
story.append(Spacer(1, 8))

story.append(callout_box(
    "<b>Immune-related adverse events (irAEs):</b> Autoimmune toxicity is the principal side-effect of ICIs. "
    "Common irAEs include colitis (anti-CTLA-4 > anti-PD-1), pneumonitis, hepatitis, thyroiditis, and hypophysitis. "
    "Managed with corticosteroids (prednisolone 1–2 mg/kg/day for grade ≥3); permanent discontinuation for "
    "severe (grade 4) events.",
    bg=HexColor("#FEF9E7"), border=HexColor("#D4AC0D")))

story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════════
# 13. CANCER PREVENTION & SCREENING
# ═══════════════════════════════════════════════════════════════════════════════
story += section_header("13.  Cancer Prevention &amp; Screening")

story.append(Paragraph("Primary Prevention", h2))
story.append(bullet_list([
    "<b>Tobacco cessation:</b> Single most impactful intervention; reduces risk of lung, head & neck, bladder, renal, oesophageal, and pancreatic cancers.",
    "<b>Vaccination:</b> HPV vaccine (Gardasil 9) — prevents ~90% of cervical cancer and HPV-associated oropharyngeal SCC; HBV vaccine — prevents hepatocellular carcinoma.",
    "<b>Diet & obesity:</b> Obesity is an independent risk factor for colorectal, endometrial, breast (post-menopausal), renal, and oesophageal cancers; associated with elevated oestrogen, insulin, and IGF-1.",
    "<b>H. pylori eradication:</b> Reduces risk of gastric adenocarcinoma and MALT lymphoma.",
    "<b>Chemoprevention:</b> Tamoxifen/raloxifene in high-risk women for breast cancer; aspirin/NSAIDs reduce colorectal adenoma recurrence.",
    "<b>Sun protection:</b> SPF ≥30 sunscreen, protective clothing to reduce UV-associated skin cancers.",
]))
story.append(Spacer(1, 8))

story.append(Paragraph("Screening Programmes", h2))
story.append(two_col_table(
    ["Cancer", "Recommended Test", "Target Population (general)"],
    [
        ["Colorectal", "Colonoscopy (every 10 years) or annual FIT/FOBT; flexible sigmoidoscopy", "Age 45–75 years (ACS); 50–75 (USPSTF)"],
        ["Breast", "Mammography (± DBT)", "Women 40–74 years (ACS: annual 40–54; biennial 55+)"],
        ["Cervical", "HPV testing ± Pap smear", "Women 25–65 years; HPV-vaccinated populations may extend interval"],
        ["Lung", "Low-dose CT (LDCT)", "Age 50–80, ≥20 pack-year smoking history, current or quit <15 years"],
        ["Prostate", "PSA ± DRE (shared decision-making)", "Men ≥50 (average risk); ≥40–45 (high risk: Black men, BRCA2)"],
        ["Hepatocellular", "Liver ultrasound ± AFP every 6 months", "Cirrhosis; chronic HBV (with active disease or family history)"],
    ],
    col_widths=[3.5*cm, 6*cm, 7*cm]
))

story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════════
# 14. EMERGING CONCEPTS
# ═══════════════════════════════════════════════════════════════════════════════
story += section_header("14.  Emerging Concepts in Oncology")

story.append(Paragraph("Cancer Stem Cells (CSCs)", h2))
story.append(Paragraph(
    "A subpopulation of tumour cells (cancer stem cells or tumour-initiating cells) possesses self-renewal capacity, "
    "resistance to conventional chemotherapy and radiotherapy, and the ability to regenerate the tumour mass. "
    "CSCs may arise from normal tissue stem cells or from differentiated cells that acquire stemness through EMT. "
    "Markers include CD44+/CD24- (breast), CD133+ (colon, brain), EpCAM+ (liver).", body))

story.append(Paragraph("Tumour Microenvironment (TME)", h2))
story.append(Paragraph(
    "The TME comprises cancer-associated fibroblasts (CAFs), tumour-associated macrophages (TAMs), "
    "endothelial cells, pericytes, immune cells, and the extracellular matrix. "
    "TAMs typically adopt an M2 immunosuppressive phenotype, promoting angiogenesis and immune evasion. "
    "CAFs remodel the ECM and secrete paracrine survival signals. The TME is a therapeutic target: "
    "VEGF inhibition (bevacizumab), FAK inhibition, and stromal reprogramming strategies are under investigation.", body))

story.append(Paragraph("Liquid Biopsy", h2))
story.append(Paragraph(
    "Analysis of cell-free circulating tumour DNA (ctDNA), circulating tumour cells (CTCs), and exosomes "
    "in blood provides real-time tumour profiling. Applications include early detection (GRAIL Galleri test), "
    "monitoring treatment response, detecting minimal residual disease, and identifying mechanisms of acquired "
    "drug resistance (e.g., EGFR T790M/C797S in osimertinib-resistant lung cancer).", body))

story.append(Paragraph("Artificial Intelligence in Oncology", h2))
story.append(Paragraph(
    "AI/deep learning models are being applied to: histopathological image analysis (automated grading, "
    "tumour detection); radiomics (extracting quantitative features from CT/MRI/PET); genomic data integration; "
    "drug response prediction; and clinical outcome modelling. "
    "Several FDA-cleared AI tools are now available for digital pathology (e.g., Paige Prostate, Lunit SCOPE).", body))

story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════════
# 15. QUICK-REFERENCE SUMMARY TABLE
# ═══════════════════════════════════════════════════════════════════════════════
story += section_header("15.  Quick-Reference: Top 10 Cancers")

story.append(two_col_table(
    ["Cancer", "Major RF", "Key Molecular Marker", "First-line Treatment Overview"],
    [
        ["Lung adenocarcinoma", "Smoking, radon, asbestos", "EGFR, ALK, ROS1, KRAS G12C, PD-L1", "TKI if driver mutation; pembrolizumab if PD-L1 ≥50% / chemo-IO combo"],
        ["Breast (ER+)", "Age, obesity, BRCA1/2, HRT", "ER/PR+, HER2-, Ki-67", "Endocrine therapy ± CDK4/6 inhibitor (palbociclib)"],
        ["Breast (HER2+)", "HER2 amplification", "HER2 3+ / ISH amplified", "Pertuzumab + trastuzumab + docetaxel (neoadjuvant / adjuvant); T-DM1 / T-DXd"],
        ["Colorectal", "Diet, IBD, Lynch, FAP", "KRAS/NRAS/BRAF WT; MSI-H", "FOLFOX/FOLFIRI ± bevacizumab or EGFR antibody; pembrolizumab (MSI-H)"],
        ["Prostate", "Age, Black race, BRCA2", "PSA, AR, BRCA1/2", "ADT ± enzalutamide/abiraterone; PARP inhibitor (BRCA2 mutated)"],
        ["Gastric", "H. pylori, diet, EBV", "HER2, MSI, PD-L1, CLDN18.2", "Perioperative FLOT or FOLFOX; trastuzumab (HER2+); nivolumab + chemo"],
        ["Hepatocellular", "HBV, HCV, cirrhosis, aflatoxin", "AFP, VEGF, PD-L1", "Sorafenib or lenvatinib (systemic); atezolizumab + bevacizumab (first-line IO)"],
        ["Pancreatic", "Smoking, obesity, BRCA2, familial", "KRAS G12D/V, SMAD4, TP53", "FOLFIRINOX or gemcitabine + nab-paclitaxel; olaparib (BRCA1/2 maintenance)"],
        ["Melanoma", "UV, fair skin, CDKN2A, BRCA2", "BRAF V600E (~50%), PD-L1, TMB", "Nivolumab + ipilimumab; BRAF + MEK inhibitor (dabrafenib + trametinib)"],
        ["CML", "BCR-ABL (Ph chromosome)", "BCR-ABL fusion transcript / FISH", "Imatinib, dasatinib, or nilotinib (first-line TKI); asciminib (T315I resistant)"],
    ],
    col_widths=[3.5*cm, 4*cm, 4.5*cm, 4.5*cm]
))

story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════════
# 16. REFERENCES
# ═══════════════════════════════════════════════════════════════════════════════
story += section_header("References")
refs = [
    "Kumar V, Abbas AK, Aster JC. <i>Robbins &amp; Kumar Basic Pathology</i>. 11th ed. Philadelphia: Elsevier; 2023. Chapter 6: Neoplasia, pp. 187–229.",
    "Kumar V, Abbas AK, Aster JC, et al. <i>Robbins and Cotran Pathologic Basis of Disease</i>. 10th ed. Philadelphia: Elsevier; 2021. Chapter 7: Neoplasia, pp. 259–330.",
    "Hanahan D. Hallmarks of Cancer: New Dimensions. <i>Cancer Discovery</i>. 2022;12(1):31–46. doi:10.1158/2159-8290.CD-21-1059",
    "Hanahan D, Weinberg RA. Hallmarks of cancer: the next generation. <i>Cell</i>. 2011;144(5):646–674.",
    "World Health Organization. <i>World Cancer Report 2022</i>. Geneva: WHO; 2022.",
    "NCCN Clinical Practice Guidelines in Oncology (NCCN Guidelines). National Comprehensive Cancer Network. Available at: www.nccn.org [Accessed July 2026].",
    "Siegel RL, Giaquinto AN, Jemal A. Cancer statistics, 2024. <i>CA Cancer J Clin</i>. 2024;74(1):12–49.",
]
for i, r in enumerate(refs, 1):
    story.append(Paragraph(f"{i}. {r}", ref_style))
    story.append(Spacer(1, 3))

# ── Build PDF ──────────────────────────────────────────────────────────────────
def make_doc():
    # We use onFirstPage / onLaterPages callbacks
    doc.build(story,
              onFirstPage=cover_page_cb,
              onLaterPages=normal_page_cb)

make_doc()
print(f"PDF saved to {OUTPUT}")
Running Command

cd /home/daytona/workspace/cancer-pdf && python generate_cancer_pdf.py 2>&1

Running Command

ls -lh /home/daytona/workspace/cancer-pdf/Cancer_Overview_Medical_Students.pdf

Your PDF is ready. Here is the download link:

Cancer Overview Medical Students

PDF Document · PDF


What's inside (15 sections, ~20 pages, A4 format):
SectionContent
Cover pageProfessional navy-blue cover with title and source attribution
1. IntroductionFundamental shared features of all cancers
2. Nomenclature & ClassificationBenign vs. malignant table, naming conventions, carcinoma in situ
3. EpidemiologyRisk factors — tobacco, radiation, viruses, chronic inflammation, hereditary syndromes
4. Molecular BasisAll 8 Hallmarks of Cancer (Hanahan & Weinberg), key oncogenes & TSGs, genetic lesion types
5. CarcinogenesisMultistep model, colorectal adenoma-carcinoma sequence, chemical & radiation carcinogens
6. Major Cancer TypesCarcinomas, sarcomas, and haematological malignancies (leukaemias, lymphomas, myeloma)
7. Invasion & MetastasisRoutes of spread, invasion-metastasis cascade, organ tropism (seed & soil)
8. Clinical AspectsMass effects, cancer cachexia, paraneoplastic syndromes
9. Grading & StagingTNM staging, grading vs staging comparison
10. Lab DiagnosisBiopsy types, IHC, FISH, NGS, liquid biopsy, tumour markers table
11. TreatmentSurgery, RT, chemotherapy, targeted therapy, immunotherapy, hormone therapy, SCT
12. Tumour ImmunologyTumour antigens, immune evasion, ICI drugs table, irAE management
13. Prevention & ScreeningPrimary prevention, HPV/HBV vaccination, screening programmes (colorectal, breast, lung, prostate)
14. Emerging ConceptsCancer stem cells, tumour microenvironment, liquid biopsy, AI in oncology
15. Quick-ReferenceTop 10 cancers with molecular markers and first-line treatment
ReferencesRobbins Basic Pathology, Robbins Cotran, Hanahan & Weinberg, WHO, NCCN, CA Cancer J Clin
This is a shared conversation. Sign in to Orris to start your own chat.